import{a as v}from"./chunk-T5OCTHI4.mjs";import{a as N}from"./chunk-JQRUD6KW.mjs";import{a as E}from"./chunk-2T2R6R2M.mjs";import"./chunk-UP6H54XL.mjs";import"./chunk-UXSXWOXI.mjs";import"./chunk-C62D2QBJ.mjs";import"./chunk-CEXFNPSA.mjs";import"./chunk-RERM46MO.mjs";import"./chunk-J5EP6P6S.mjs";import"./chunk-RLI5ZMPA.mjs";import"./chunk-2UTLFMKG.mjs";import"./chunk-RKZBBQEN.mjs";import{a as R}from"./chunk-LRIF4GLE.mjs";import{o as D}from"./chunk-QA3QBVWF.mjs";import"./chunk-KNLZD3CH.mjs";import{O as b,S as T,T as S,U as C,V as x,W as k,X as B,Y as G,j as u,t as y}from"./chunk-67TQ5CYL.mjs";import{b as h}from"./chunk-7W6UQGC5.mjs";import"./chunk-KGYTTC2M.mjs";import"./chunk-4R4BOZG6.mjs";import{a as r}from"./chunk-AQ6EADP3.mjs";var d=new v(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),I=r(()=>{d.reset(),T()},"clear"),P=r(()=>d.records.stack[0],"getRoot"),X=r(()=>d.records.cnt,"getCount"),z=u.treeView,F=r(()=>D(z,y().treeView),"getConfig"),H=r((e,t)=>{for(;e<=d.records.stack[d.records.stack.length-1].level;)d.records.stack.pop();let i={id:d.records.cnt++,level:e,name:t,children:[]};d.records.stack[d.records.stack.length-1].children.push(i),d.records.stack.push(i)},"addNode"),M={clear:I,addNode:H,getRoot:P,getCount:X,getConfig:F,getAccTitle:C,getAccDescription:k,getDiagramTitle:G,setAccDescription:x,setAccTitle:S,setDiagramTitle:B},w=M;var W=r(e=>{N(e,w),e.nodes.map(t=>w.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),j={parse:r(async e=>{let t=await E("treeView",e);h.debug(t),W(t)},"parse")};var L=r((e,t,i,n,s)=>{let l=n.append("text").text(i.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:c,width:o}=l.node().getBBox(),m=c+s.paddingY*2,a=o+s.paddingX*2;l.attr("x",e+s.paddingX),l.attr("y",t+m/2),i.BBox={x:e,y:t,width:a,height:m}},"positionLabel"),A=r((e,t,i,n,s,l)=>e.append("line").attr("x1",t).attr("y1",i).attr("x2",n).attr("y2",s).attr("stroke-width",l).attr("class","treeView-node-line"),"positionLine"),Y=r((e,t,i)=>{let n=0,s=0,l=r((o,m,a,g)=>{let f=g*(a.rowIndent+a.paddingX);L(f,n,m,o,a);let{height:p,width:V}=m.BBox;A(o,f-a.rowIndent,n+p/2,f,n+p/2,a.lineThickness),s=Math.max(s,f+V),n+=p},"drawNode"),c=r((o,m=0)=>{l(e,o,i,m),o.children.forEach(p=>{c(p,m+1)});let{x:a,y:g,height:f}=o.BBox;if(o.children.length){let{y:p,height:V}=o.children[o.children.length-1].BBox;A(e,a+i.paddingX,g+f,a+i.paddingX,p+V/2+i.lineThickness/2,i.lineThickness)}},"processNode");return c(t),{totalHeight:n,totalWidth:s}},"drawTree"),_=r((e,t,i,n)=>{h.debug(`Rendering treeView diagram
`+e);let s=n.db,l=s.getRoot(),c=s.getConfig(),o=R(t),m=o.append("g");m.attr("class","tree-view");let{totalHeight:a,totalWidth:g}=Y(m,l,c);o.attr("viewBox",`-${c.lineThickness/2} 0 ${g} ${a}`),b(o,a,g,c.useMaxWidth)},"draw"),O={draw:_},q=O;var U={labelFontSize:"16px",labelColor:"black",lineColor:"black"},J=r(({treeView:e})=>{let{labelFontSize:t,labelColor:i,lineColor:n}=D(U,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${i};
    }
    .treeView-node-line {
        stroke: ${n};
    }
    `},"styles"),$=J;var Te={db:w,renderer:q,parser:j,styles:$};export{Te as diagram};
