import{q as x,b as f,s as C,t as B,g as T,a as y,_ as s,H as u,l as k,L as V,e as _,F as N,I as S,A}from"./mermaid.core-fp4eZkQa.js";import{p as D}from"./chunk-4BX2VUAB-DIKptROz.js";import{I}from"./chunk-QZHKN3VN-D7UOHiY9.js";import{p as $}from"./wardley-RL74JXVD-zRsGpA04.js";import"./index-DOFLUERq.js";import"./_commonjsHelpers-CE1G-McA.js";import"./_baseUniq-BljFQBTR.js";import"./_arrayEach-DpGxo2Of.js";import"./min-BhuoKARR.js";var d=new I(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),H=s(()=>{d.reset(),A()},"clear"),L=s(()=>d.records.stack[0],"getRoot"),X=s(()=>d.records.cnt,"getCount"),z=S.treeView,R=s(()=>u(z,N().treeView),"getConfig"),W=s((e,t)=>{for(;e<=d.records.stack[d.records.stack.length-1].level;)d.records.stack.pop();const r={id:d.records.cnt++,level:e,name:t,children:[]};d.records.stack[d.records.stack.length-1].children.push(r),d.records.stack.push(r)},"addNode"),E={clear:H,addNode:W,getRoot:L,getCount:X,getConfig:R,getAccTitle:y,getAccDescription:T,getDiagramTitle:B,setAccDescription:C,setAccTitle:f,setDiagramTitle:x},w=E,F=s(e=>{D(e,w),e.nodes.map(t=>w.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),M={parse:s(async e=>{const t=await $("treeView",e);k.debug(t),F(t)},"parse")},Y=s((e,t,r,i,o)=>{const c=i.append("text").text(r.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:p,width:a}=c.node().getBBox(),l=p+o.paddingY*2,n=a+o.paddingX*2;c.attr("x",e+o.paddingX),c.attr("y",t+l/2),r.BBox={x:e,y:t,width:n,height:l}},"positionLabel"),b=s((e,t,r,i,o,c)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",i).attr("y2",o).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),q=s((e,t,r)=>{let i=0,o=0;const c=s((a,l,n,h)=>{const m=h*(n.rowIndent+n.paddingX);Y(m,i,l,a,n);const{height:g,width:v}=l.BBox;b(a,m-n.rowIndent,i+g/2,m,i+g/2,n.lineThickness),o=Math.max(o,m+v),i+=g},"drawNode"),p=s((a,l=0)=>{c(e,a,r,l),a.children.forEach(g=>{p(g,l+1)});const{x:n,y:h,height:m}=a.BBox;if(a.children.length){const{y:g,height:v}=a.children[a.children.length-1].BBox;b(e,n+r.paddingX,h+m,n+r.paddingX,g+v/2+r.lineThickness/2,r.lineThickness)}},"processNode");return p(t),{totalHeight:i,totalWidth:o}},"drawTree"),j=s((e,t,r,i)=>{k.debug(`Rendering treeView diagram
`+e);const o=i.db,c=o.getRoot(),p=o.getConfig(),a=V(t),l=a.append("g");l.attr("class","tree-view");const{totalHeight:n,totalWidth:h}=q(l,c,p);a.attr("viewBox",`-${p.lineThickness/2} 0 ${h} ${n}`),_(a,n,h,p.useMaxWidth)},"draw"),G={draw:j},J=G,K={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=s(({treeView:e})=>{const{labelFontSize:t,labelColor:r,lineColor:i}=u(K,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${r};
    }
    .treeView-node-line {
        stroke: ${i};
    }
    `},"styles"),P=O,ne={db:w,renderer:J,parser:M,styles:P};export{ne as diagram};
