import{q as B,b as u,s as y,t as C,g as T,a as V,_ as r,G as b,l as f,K as v,e as $,E as N,z as X,H as z}from"./mermaid.core-Dtgfxwda.chunk.mjs";import{p as A}from"./chunk-4BX2VUAB-D9ya9k3n.chunk.mjs";import{I as D}from"./chunk-QZHKN3VN-BVWQyMrg.chunk.mjs";import{p as I}from"./wardley-L42UT6IY-l714qEXi.chunk.mjs";import"./preload-helper-BorfeO-5.chunk.mjs";import"./emoji-picker-hi3Hwbeu.chunk.mjs";import"./NcLoadingIcon-Bdu4Z_fo.chunk.mjs";import"./vue.runtime.esm-CbNPNm8f.chunk.mjs";import"./index-xQwnxqUU.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";var l=new D(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),R=r(()=>{l.reset(),X()},"clear"),H=r(()=>l.records.stack[0],"getRoot"),W=r(()=>l.records.cnt,"getCount"),E=z.treeView,F=r(()=>b(E,N().treeView),"getConfig"),L=r((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"),M={clear:R,addNode:L,getRoot:H,getCount:W,getConfig:F,getAccTitle:V,getAccDescription:T,getDiagramTitle:C,setAccDescription:y,setAccTitle:u,setDiagramTitle:B},x=M,S=r(e=>{A(e,x),e.nodes.map(t=>x.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),q={parse:r(async e=>{const t=await I("treeView",e);f.debug(t),S(t)},"parse")},G=r((e,t,a,i,s)=>{const c=i.append("text").text(a.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:p,width:o}=c.node().getBBox(),d=p+s.paddingY*2,n=o+s.paddingX*2;c.attr("x",e+s.paddingX),c.attr("y",t+d/2),a.BBox={x:e,y:t,width:n,height:d}},"positionLabel"),k=r((e,t,a,i,s,c)=>e.append("line").attr("x1",t).attr("y1",a).attr("x2",i).attr("y2",s).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),K=r((e,t,a)=>{let i=0,s=0;const c=r((o,d,n,h)=>{const m=h*(n.rowIndent+n.paddingX);G(m,i,d,o,n);const{height:g,width:w}=d.BBox;k(o,m-n.rowIndent,i+g/2,m,i+g/2,n.lineThickness),s=Math.max(s,m+w),i+=g},"drawNode"),p=r((o,d=0)=>{c(e,o,a,d),o.children.forEach(g=>{p(g,d+1)});const{x:n,y:h,height:m}=o.BBox;if(o.children.length){const{y:g,height:w}=o.children[o.children.length-1].BBox;k(e,n+a.paddingX,h+m,n+a.paddingX,g+w/2+a.lineThickness/2,a.lineThickness)}},"processNode");return p(t),{totalHeight:i,totalWidth:s}},"drawTree"),Y=r((e,t,a,i)=>{f.debug(`Rendering treeView diagram
`+e);const s=i.db,c=s.getRoot(),p=s.getConfig(),o=v(t),d=o.append("g");d.attr("class","tree-view");const{totalHeight:n,totalWidth:h}=K(d,c,p);o.attr("viewBox",`-${p.lineThickness/2} 0 ${h} ${n}`),$(o,n,h,p.useMaxWidth)},"draw"),_={draw:Y},j=_,J={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=r(({treeView:e})=>{const{labelFontSize:t,labelColor:a,lineColor:i}=b(J,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${a};
    }
    .treeView-node-line {
        stroke: ${i};
    }
    `},"styles"),P=O,se={db:x,renderer:j,parser:q,styles:P};export{se as diagram};
//# sourceMappingURL=diagram-5GNKFQAL-Cha_oPZJ.chunk.mjs.map
