import{At as e,D as t,E as n,J as r,Lt as i,a,jt as o,tt as s}from"./chunk.p3hCiSrt.js";var c=i(o(),1),l=e(),u=(e,t)=>{if(!t)return e;let n=t.toLowerCase();return e.reduce((e,r)=>{if(r.children){let i=u(r.children,t);i.length>0?e.push({...r,children:i}):r.label.toLowerCase().includes(n)&&e.push(r)}else r.label.toLowerCase().includes(n)&&e.push(r);return e},[])},d=e=>{let t=0;for(let n of e)n.children&&n.children.length>0?t+=d(n.children):t++;return t},f=({nodes:e,selectedId:t,openNodes:n,search:r=``,onSelect:i,onToggle:o,showLeafCount:s=!0})=>(0,l.jsx)(a,{direction:`column`,gap:2,style:{minHeight:0},children:(0,c.useMemo)(()=>u(e,r),[e,r]).map(e=>(0,l.jsx)(p,{node:e,depth:0,selectedId:t,openNodes:n,onSelect:i,onToggle:o,showLeafCount:s},e.id))}),p=({node:e,depth:i,selectedId:o,openNodes:c,onSelect:u,onToggle:f,showLeafCount:m})=>{let h=!!e.children&&e.children.length>0,g=c.has(e.id),_=o===e.id,v=h?d(e.children):0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s,{w:`100%`,py:4,className:`devtools-tree-node`,"data-selected":_||void 0,style:{borderRadius:6,paddingLeft:8+i*20,paddingRight:8,transition:`background 100ms ease`},onClick:()=>{h?f(e.id):u(e.id)},children:(0,l.jsxs)(a,{gap:8,wrap:`nowrap`,children:[h?(0,l.jsx)(a,{style:{width:14,flexShrink:0,display:`flex`,alignItems:`center`},children:g?(0,l.jsx)(t,{size:14,opacity:.5}):(0,l.jsx)(n,{size:14,opacity:.5})}):(0,l.jsx)(a,{style:{width:14,flexShrink:0,display:`flex`,alignItems:`center`}}),e.icon,(0,l.jsx)(r,{fz:12,fw:_?600:400,truncate:!0,style:{flex:1},children:e.label}),e.badge,h&&m&&v>0&&(0,l.jsx)(r,{fz:10,c:`dimmed`,style:{flexShrink:0},children:v})]})}),h&&g&&(0,l.jsx)(a,{direction:`column`,gap:2,style:{minHeight:0},children:e.children.map(e=>(0,l.jsx)(p,{node:e,depth:i+1,selectedId:o,openNodes:c,onSelect:u,onToggle:f,showLeafCount:m},e.id))})]})};export{f as t};