import{a as $}from"./chunk-FKJDPLBD.js";import{a as D}from"./chunk-TCSUPM5X.js";import{a as A}from"./chunk-KU3KRRIP.js";import"./chunk-EVYRJEN4.js";import{a as _}from"./chunk-CKZWEBBA.js";import"./chunk-UJGYKXFV.js";import"./chunk-SVS6VOAY.js";import"./chunk-7PMLKA6X.js";import"./chunk-OX3BH5OR.js";import"./chunk-EQI6FYDH.js";import"./chunk-KCFSBXDE.js";import"./chunk-OQIZJQUY.js";import"./chunk-WIPFUQZE.js";import{o as u}from"./chunk-PKRYIESI.js";import"./chunk-JBQZ5UCE.js";import{B as k,O as x,T as C,U as B,V as T,W as y,X as V,Y as N,Z as S,r as f}from"./chunk-VBOJ6TJX.js";import{b as o,d as w}from"./chunk-XDY7PRES.js";import"./chunk-YKM3JX66.js";import"./chunk-ZIJQPUA2.js";import"./chunk-OOJM4CTU.js";var l=new $(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),z=o(()=>{l.reset(),C()},"clear"),H=o(()=>l.records.stack[0],"getRoot"),I=o(()=>l.records.cnt,"getCount"),L=f.treeView,R=o(()=>u(L,k().treeView),"getConfig"),W=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"),E={clear:z,addNode:W,getRoot:H,getCount:I,getConfig:R,getAccTitle:T,getAccDescription:V,getDiagramTitle:S,setAccDescription:y,setAccTitle:B,setDiagramTitle:N},b=E,M=o(e=>{D(e,b),e.nodes.map(t=>b.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),F={parse:o(async e=>{let t=await A("treeView",e);w.debug(t),M(t)},"parse")},Y=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"),X=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"),j=o((e,t,r)=>{let n=0,s=0,c=o((a,d,i,h)=>{let m=h*(i.rowIndent+i.paddingX);Y(m,n,d,a,i);let{height:p,width:v}=d.BBox;X(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;X(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"),q=o((e,t,r,n)=>{w.debug(`Rendering treeView diagram
`+e);let s=n.db,c=s.getRoot(),g=s.getConfig(),a=_(t),d=a.append("g");d.attr("class","tree-view");let{totalHeight:i,totalWidth:h}=j(d,c,g);a.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),x(a,i,h,g.useMaxWidth)},"draw"),G={draw:q},J=G,K={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=o(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:n}=u(K,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${r};
    }
    .treeView-node-line {
        stroke: ${n};
    }
    `},"styles"),P=O,oe={db:b,renderer:J,parser:F,styles:P};export{oe as diagram};
