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