import React from "react"; function parseTree(content) { const lines = content.split("\n").filter(l => l.trim()); const root = { name: "Root", children: [], level: -1 }; const stack = [root]; lines.forEach(line => { const indentMatch = line.match(/^([ │]*)([├└]─+ )?(.*)$/); if (!indentMatch) return; const [_, indent, marker, name] = indentMatch; const depth = Math.floor(indent.length / 4) + (marker ? 1 : 0); const node = { name: name.trim(), children: [] }; while (stack.length > depth + 1) { stack.pop(); } stack[stack.length - 1].children.push(node); stack.push(node); }); return root.children; } function TreeNode({ node, isLast }) { const hasChildren = node.children && node.children.length > 0; return (
{content};
}
}