import{q as x,b as f,s as C,t as B,g as T,a as y,_ as s,G as u,l as k,K as V,e as _,E as N,H as S,z as D}from"./mermaid.core.Cx6undGY.js";import{p as $}from"./chunk-4BX2VUAB.CvoNA9AZ.js";import{I as z}from"./chunk-QZHKN3VN.UddxqWsm.js";import{p as A}from"./wardley-RL74JXVD.D9QdwmmD.js";import"./framework.Cre9sSJa.js";import"./index.BYYR_MCp.js";import"./AtomicAssemblyDemoPanel.DJ3tgb2D.js";import"./DemoCodeGroup.EbOw_123.js";import"./min.B26m6Sr8.js";import"./baseUniq.D4JeVWyp.js";var d=new z(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),H=s(()=>{d.reset(),D()},"clear"),I=s(()=>d.records.stack[0],"getRoot"),X=s(()=>d.records.cnt,"getCount"),E=S.treeView,L=s(()=>u(E,N().treeView),"getConfig"),R=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"),W={clear:H,addNode:R,getRoot:I,getCount:X,getConfig:L,getAccTitle:y,getAccDescription:T,getDiagramTitle:B,setAccDescription:C,setAccTitle:f,setDiagramTitle:x},w=W,M=s(e=>{$(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 A("treeView",e);k.debug(t),M(t)},"parse")},Y=s((e,t,r,i,n)=>{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+n.paddingY*2,o=a+n.paddingX*2;c.attr("x",e+n.paddingX),c.attr("y",t+l/2),r.BBox={x:e,y:t,width:o,height:l}},"positionLabel"),b=s((e,t,r,i,n,c)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",i).attr("y2",n).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),q=s((e,t,r)=>{let i=0,n=0;const c=s((a,l,o,h)=>{const m=h*(o.rowIndent+o.paddingX);Y(m,i,l,a,o);const{height:g,width:v}=l.BBox;b(a,m-o.rowIndent,i+g/2,m,i+g/2,o.lineThickness),n=Math.max(n,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:o,y:h,height:m}=a.BBox;if(a.children.length){const{y:g,height:v}=a.children[a.children.length-1].BBox;b(e,o+r.paddingX,h+m,o+r.paddingX,g+v/2+r.lineThickness/2,r.lineThickness)}},"processNode");return p(t),{totalHeight:i,totalWidth:n}},"drawTree"),G=s((e,t,r,i)=>{k.debug(`Rendering treeView diagram
`+e);const n=i.db,c=n.getRoot(),p=n.getConfig(),a=V(t),l=a.append("g");l.attr("class","tree-view");const{totalHeight:o,totalWidth:h}=q(l,c,p);a.attr("viewBox",`-${p.lineThickness/2} 0 ${h} ${o}`),_(a,o,h,p.useMaxWidth)},"draw"),K={draw:G},j=K,J={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=s(({treeView:e})=>{const{labelFontSize:t,labelColor:r,lineColor:i}=u(J,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${r};
    }
    .treeView-node-line {
        stroke: ${i};
    }
    `},"styles"),P=O,ne={db:w,renderer:j,parser:F,styles:P};export{ne as diagram};
