import{a as $}from"./chunk-DMWOYWYQ.js";import{a as X}from"./chunk-SRCUB3EX.js";import{a as A}from"./chunk-4R6SYGKS.js";import"./chunk-X43UMWSZ.js";import"./chunk-DZQRYCWR.js";import"./chunk-QXIJPCUK.js";import"./chunk-GO6ZTN3G.js";import"./chunk-7BGAJP6A.js";import"./chunk-PNXCYZAZ.js";import"./chunk-BWRTTESZ.js";import"./chunk-5JNRF4JL.js";import"./chunk-PKSFXE6N.js";import"./chunk-7ZGKZ6HH.js";import{a as D}from"./chunk-PDRDFWTH.js";import{C as u}from"./chunk-UKZIEWH5.js";import"./chunk-GP6TCC26.js";import{A as x,N as C,R as B,S as T,T as y,U as V,V as N,W as S,X as _,r as k}from"./chunk-37QI3DOO.js";import{g as o,i as w}from"./chunk-JRNAXTJ7.js";import"./chunk-F57K64GP.js";import"./chunk-URMDZFG4.js";import{j as f}from"./chunk-RMXJBC7V.js";var l=new A(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),H=o(()=>{l.reset(),B()},"clear"),I=o(()=>l.records.stack[0],"getRoot"),L=o(()=>l.records.cnt,"getCount"),R=k.treeView,W=o(()=>u(R,x().treeView),"getConfig"),E=o((e,t)=>{for(;e<=l.records.stack[l.records.stack.length-1].level;)l.records.stack.pop();let r={id:l.records.cnt++,level:e,name:t,children:[]};l.records.stack[l.records.stack.length-1].children.push(r),l.records.stack.push(r)},"addNode"),M={clear:H,addNode:E,getRoot:I,getCount:L,getConfig:W,getAccTitle:y,getAccDescription:N,getDiagramTitle:_,setAccDescription:V,setAccTitle:T,setDiagramTitle:S},b=M,F=o(e=>{$(e,b),e.nodes.map(t=>b.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),Y={parse:o(e=>f(null,null,function*(){let t=yield X("treeView",e);w.debug(t),F(t)}),"parse")},j=o((e,t,r,n,s)=>{let c=n.append("text").text(r.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:g,width:a}=c.node().getBBox(),d=g+s.paddingY*2,i=a+s.paddingX*2;c.attr("x",e+s.paddingX),c.attr("y",t+d/2),r.BBox={x:e,y:t,width:i,height:d}},"positionLabel"),z=o((e,t,r,n,s,c)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",s).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),q=o((e,t,r)=>{let n=0,s=0,c=o((a,d,i,h)=>{let m=h*(i.rowIndent+i.paddingX);j(m,n,d,a,i);let{height:p,width:v}=d.BBox;z(a,m-i.rowIndent,n+p/2,m,n+p/2,i.lineThickness),s=Math.max(s,m+v),n+=p},"drawNode"),g=o((a,d=0)=>{c(e,a,r,d),a.children.forEach(p=>{g(p,d+1)});let{x:i,y:h,height:m}=a.BBox;if(a.children.length){let{y:p,height:v}=a.children[a.children.length-1].BBox;z(e,i+r.paddingX,h+m,i+r.paddingX,p+v/2+r.lineThickness/2,r.lineThickness)}},"processNode");return g(t),{totalHeight:n,totalWidth:s}},"drawTree"),G=o((e,t,r,n)=>{w.debug(`Rendering treeView diagram
`+e);let s=n.db,c=s.getRoot(),g=s.getConfig(),a=D(t),d=a.append("g");d.attr("class","tree-view");let{totalHeight:i,totalWidth:h}=q(d,c,g);a.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),C(a,i,h,g.useMaxWidth)},"draw"),J={draw:G},K=J,O={labelFontSize:"16px",labelColor:"black",lineColor:"black"},P=o(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:n}=u(O,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${r};
    }
    .treeView-node-line {
        stroke: ${n};
    }
    `},"styles"),Q=P,ne={db:b,renderer:K,parser:Y,styles:Q};export{ne as diagram};
