import"./chunk-DseTPa7n.js";import{t as e}from"./dist-C9I7GKwI.js";import{C as t,R as n,Rt as r,T as i,Ut as a,_ as o,b as s,s as c,z as l,zt as u}from"./mermaid-b5860b54-0Lyr29sO.js";import{h as d}from"./step-CltBpEWI.js";import{t as f}from"./graphlib-78OoZqt6.js";import"./dagre-JFNtiDgC.js";import{n as p,r as m,t as h}from"./styles-9a916d00-B8beHA8k.js";import{t as g}from"./index-3862675e-9pdE5SVz.js";a(),e(),r();var _=e=>c.sanitizeText(e,o()),v={dividerMargin:10,padding:5,textHeight:10,curve:void 0},y=function(e,t,n,r){let a=Object.keys(e);i.info(`keys:`,a),i.info(e),a.forEach(function(a){let s=e[a],c={shape:`rect`,id:s.id,domId:s.domId,labelText:_(s.id),labelStyle:``,style:`fill: none; stroke: black`,padding:o().flowchart?.padding??o().class?.padding};t.setNode(s.id,c),b(s.classes,t,n,r,s.id),i.info(`setNode`,c)})},b=function(e,t,n,r,a){let c=Object.keys(e);i.info(`keys:`,c),i.info(e),c.filter(t=>e[t].parent==a).forEach(function(n){let c=e[n],l=c.cssClasses.join(` `),u=s(c.styles),d=c.label??c.id,f={labelStyle:u.labelStyle,shape:`class_box`,labelText:_(d),classData:c,rx:0,ry:0,class:l,style:u.style,id:c.id,domId:c.domId,tooltip:r.db.getTooltip(c.id,a)||``,haveCallback:c.haveCallback,link:c.link,width:c.type===`group`?500:void 0,type:c.type,padding:o().flowchart?.padding??o().class?.padding};t.setNode(c.id,f),a&&t.setParent(c.id,a),i.info(`setNode`,f)})},x=function(e,n,r,a){i.info(e),e.forEach(function(e,s){let c=e,l={labelStyle:``,style:``},u=c.text,f={labelStyle:l.labelStyle,shape:`note`,labelText:_(u),noteData:c,rx:0,ry:0,class:``,style:l.style,id:c.id,domId:c.id,tooltip:``,type:`note`,padding:o().flowchart?.padding??o().class?.padding};if(n.setNode(c.id,f),i.info(`setNode`,f),!c.class||!(c.class in a))return;let p=r+s,m={id:`edgeNote${p}`,classes:`relation`,pattern:`dotted`,arrowhead:`none`,startLabelRight:``,endLabelLeft:``,arrowTypeStart:`none`,arrowTypeEnd:`none`,style:`fill:none`,labelStyle:``,curve:t(v.curve,d)};n.setEdge(c.id,c.class,m,p)})},S=function(e,n){let r=o().flowchart,a=0;e.forEach(function(e){a++;let l={classes:`relation`,pattern:e.relation.lineType==1?`dashed`:`solid`,id:`id_${e.id1}_${e.id2}_${a}`,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:t(r?.curve,d)};if(i.info(l,e),e.style!==void 0){let t=s(e.style);l.style=t.style,l.labelStyle=t.labelStyle}e.text=e.title,e.text===void 0?e.style!==void 0&&(l.arrowheadStyle=`fill: #333`):(l.arrowheadStyle=`fill: #333`,l.labelpos=`c`,o().flowchart?.htmlLabels??o().htmlLabels?(l.labelType=`html`,l.label=`<span class="edgeLabel">`+e.text+`</span>`):(l.labelType=`text`,l.label=e.text.replace(c.lineBreakRegex,`
`),e.style===void 0&&(l.style=l.style||`stroke: #333; stroke-width: 1.5px;fill:none`),l.labelStyle=l.labelStyle.replace(`color:`,`fill:`))),n.setEdge(e.id1,e.id2,l,a)})},C=function(e){v={...v,...e}},w=async function(e,t,r,a){i.info(`Drawing class - `,t);let s=o().flowchart??o().class,c=o().securityLevel;i.info(`config:`,s);let d=s?.nodeSpacing??50,p=s?.rankSpacing??50,m=new f({multigraph:!0,compound:!0}).setGraph({rankdir:a.db.getDirection(),nodesep:d,ranksep:p,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),h=a.db.getNamespaces(),_=a.db.getClasses(),v=a.db.getRelations(),C=a.db.getNotes();i.info(v),y(h,m,t,a),b(_,m,t,a),S(v,m),x(C,m,v.length+1,_);let w;c===`sandbox`&&(w=u(`#i`+t));let T=u(c===`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),l.insertTitle(E,`classTitleText`,s?.titleTopMargin??5,a.db.getDiagramTitle()),n(m,E,s?.diagramPadding,s?.useMaxWidth),!s?.htmlLabels){let e=c===`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};