import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import"./lucide-C4oWPzu4.js";import{a as t,t as n}from"./src-CaF7C-tn.js";import"./purify.es-BI1OWkCK.js";import{h as r}from"./step-7IFzWEMw.js";import"./dagre-t-mlF8Ny.js";import{t as i}from"./graphlib-mnK_OidP.js";import{B as a,C as o,L as s,R as c,T as l,_ as u,b as d,s as f}from"./mermaid-7ea9cbd6-CTdxebQd.js";import{n as p,r as m,t as h}from"./styles-b4e223ce-BwKjtmN4.js";import"./json-aXCw5XEy.js";import{t as g}from"./index-5325376f-uAj4SDoV.js";e(t(),1),a();var _=e=>f.sanitizeText(e,u()),v={dividerMargin:10,padding:5,textHeight:10,curve:void 0},y=function(e,t,n,r){let i=Object.keys(e);l.info(`keys:`,i),l.info(e),i.forEach(function(i){let a=e[i],o={shape:`rect`,id:a.id,domId:a.domId,labelText:_(a.id),labelStyle:``,style:`fill: none; stroke: black`,padding:u().flowchart?.padding??u().class?.padding};t.setNode(a.id,o),b(a.classes,t,n,r,a.id),l.info(`setNode`,o)})},b=function(e,t,n,r,i){let a=Object.keys(e);l.info(`keys:`,a),l.info(e),a.filter(t=>e[t].parent==i).forEach(function(n){let a=e[n],o=a.cssClasses.join(` `),s=d(a.styles),c=a.label??a.id,f={labelStyle:s.labelStyle,shape:`class_box`,labelText:_(c),classData:a,rx:0,ry:0,class:o,style:s.style,id:a.id,domId:a.domId,tooltip:r.db.getTooltip(a.id,i)||``,haveCallback:a.haveCallback,link:a.link,width:a.type===`group`?500:void 0,type:a.type,padding:u().flowchart?.padding??u().class?.padding};t.setNode(a.id,f),i&&t.setParent(a.id,i),l.info(`setNode`,f)})},x=function(e,t,n,i){l.info(e),e.forEach(function(e,a){let s=e,c={labelStyle:``,style:``},d=s.text,f={labelStyle:c.labelStyle,shape:`note`,labelText:_(d),noteData:s,rx:0,ry:0,class:``,style:c.style,id:s.id,domId:s.id,tooltip:``,type:`note`,padding:u().flowchart?.padding??u().class?.padding};if(t.setNode(s.id,f),l.info(`setNode`,f),!s.class||!(s.class in i))return;let p=n+a,m={id:`edgeNote${p}`,classes:`relation`,pattern:`dotted`,arrowhead:`none`,startLabelRight:``,endLabelLeft:``,arrowTypeStart:`none`,arrowTypeEnd:`none`,style:`fill:none`,labelStyle:``,curve:o(v.curve,r)};t.setEdge(s.id,s.class,m,p)})},S=function(e,t){let n=u().flowchart,i=0;e.forEach(function(e){i++;let a={classes:`relation`,pattern:e.relation.lineType==1?`dashed`:`solid`,id:`id_${e.id1}_${e.id2}_${i}`,arrowhead:e.type===`arrow_open`?`none`:`normal`,startLabelRight:e.relationTitle1===`none`?``:e.relationTitle1,endLabelLeft:e.relationTitle2===`none`?``:e.relationTitle2,arrowTypeStart:T(e.relation.type1),arrowTypeEnd:T(e.relation.type2),style:`fill:none`,labelStyle:``,curve:o(n?.curve,r)};if(l.info(a,e),e.style!==void 0){let t=d(e.style);a.style=t.style,a.labelStyle=t.labelStyle}e.text=e.title,e.text===void 0?e.style!==void 0&&(a.arrowheadStyle=`fill: #333`):(a.arrowheadStyle=`fill: #333`,a.labelpos=`c`,u().flowchart?.htmlLabels??u().htmlLabels?(a.labelType=`html`,a.label=`<span class="edgeLabel">`+e.text+`</span>`):(a.labelType=`text`,a.label=e.text.replace(f.lineBreakRegex,`
`),e.style===void 0&&(a.style=a.style||`stroke: #333; stroke-width: 1.5px;fill:none`),a.labelStyle=a.labelStyle.replace(`color:`,`fill:`))),t.setEdge(e.id1,e.id2,a,i)})},C=function(e){v={...v,...e}},w=async function(e,t,r,a){l.info(`Drawing class - `,t);let o=u().flowchart??u().class,d=u().securityLevel;l.info(`config:`,o);let f=o?.nodeSpacing??50,p=o?.rankSpacing??50,m=new i({multigraph:!0,compound:!0}).setGraph({rankdir:a.db.getDirection(),nodesep:f,ranksep:p,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),h=a.db.getNamespaces(),_=a.db.getClasses(),v=a.db.getRelations(),C=a.db.getNotes();l.info(v),y(h,m,t,a),b(_,m,t,a),S(v,m),x(C,m,v.length+1,_);let w;d===`sandbox`&&(w=n(`#i`+t));let T=n(d===`sandbox`?w.nodes()[0].contentDocument.body:`body`),E=T.select(`[id="${t}"]`);if(await g(T.select(`#`+t+` g`),m,[`aggregation`,`extension`,`composition`,`dependency`,`lollipop`],`classDiagram`,t),c.insertTitle(E,`classTitleText`,o?.titleTopMargin??5,a.db.getDiagramTitle()),s(m,E,o?.diagramPadding,o?.useMaxWidth),!o?.htmlLabels){let e=d===`sandbox`?w.nodes()[0].contentDocument:document,n=e.querySelectorAll(`[id="`+t+`"] .edgeLabel .label`);for(let t of n){let n=t.getBBox(),r=e.createElementNS(`http://www.w3.org/2000/svg`,`rect`);r.setAttribute(`rx`,0),r.setAttribute(`ry`,0),r.setAttribute(`width`,n.width),r.setAttribute(`height`,n.height),t.insertBefore(r,t.firstChild)}}};function T(e){let t;switch(e){case 0:t=`aggregation`;break;case 1:t=`extension`;break;case 2:t=`composition`;break;case 3:t=`dependency`;break;case 4:t=`lollipop`;break;default:t=`none`}return t}var E={parser:p,db:h,renderer:{setConf:C,draw:w},styles:m,init:e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute,h.clear()}};export{E as diagram};