import{s as e,d as t,p as l}from"./styles-b83b31c9-BJypBZQ1.js";import{k as a,e as o,j as n,J as s,z as i,t as r,A as d,B as c,x as p}from"./mermaid-CC8t29Kt.js";import{G as b}from"./graph-CMMNd1iJ.js";import{r as f}from"./index-01f381cb-BTZhYtjS.js";import"./layout-OpUkgN66.js";import"./clone-Pz4U-6so.js";import"./edges-066a5561-DwxP7WHg.js";import"./createText-ca0c5216-CK9IizCN.js";const y=e=>r.sanitizeText(e,o());let g={dividerMargin:10,padding:5,textHeight:10,curve:void 0};const u=function(e,t,l,n,s){const i=Object.keys(e);a.info("keys:",i),a.info(e),i.filter(t=>e[t].parent==s).forEach(function(l){var i,r;const c=e[l],p=c.cssClasses.join(" "),b=d(c.styles),f={labelStyle:b.labelStyle,shape:"class_box",labelText:y(c.label??c.id),classData:c,rx:0,ry:0,class:p,style:b.style,id:c.id,domId:c.domId,tooltip:n.db.getTooltip(c.id,s)||"",haveCallback:c.haveCallback,link:c.link,width:"group"===c.type?500:void 0,type:c.type,padding:(null==(i=o().flowchart)?void 0:i.padding)??(null==(r=o().class)?void 0:r.padding)};t.setNode(c.id,f),s&&t.setParent(c.id,s),a.info("setNode",f)})};function h(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}const m={parser:l,db:t,renderer:{setConf:function(e){g={...g,...e}},draw:async function(e,t,l,m){a.info("Drawing class - ",t);const v=o().flowchart??o().class,x=o().securityLevel;a.info("config:",v);const w=(null==v?void 0:v.nodeSpacing)??50,k=(null==v?void 0:v.rankSpacing)??50,T=new b({multigraph:!0,compound:!0}).setGraph({rankdir:m.db.getDirection(),nodesep:w,ranksep:k,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),S=m.db.getNamespaces(),L=m.db.getClasses(),j=m.db.getRelations(),E=m.db.getNotes();let N;a.info(j),function(e,t,l,n){const s=Object.keys(e);a.info("keys:",s),a.info(e),s.forEach(function(l){var s,i;const r=e[l],d={shape:"rect",id:r.id,domId:r.domId,labelText:y(r.id),labelStyle:"",style:"fill: none; stroke: black",padding:(null==(s=o().flowchart)?void 0:s.padding)??(null==(i=o().class)?void 0:i.padding)};t.setNode(r.id,d),u(r.classes,t,0,n,r.id),a.info("setNode",d)})}(S,T,0,m),u(L,T,0,m),function(e,t){const l=o().flowchart;let n=0;e.forEach(function(e){var s;n++;const i={classes:"relation",pattern:1==e.relation.lineType?"dashed":"solid",id:`id_${e.id1}_${e.id2}_${n}`,arrowhead:"arrow_open"===e.type?"none":"normal",startLabelRight:"none"===e.relationTitle1?"":e.relationTitle1,endLabelLeft:"none"===e.relationTitle2?"":e.relationTitle2,arrowTypeStart:h(e.relation.type1),arrowTypeEnd:h(e.relation.type2),style:"fill:none",labelStyle:"",curve:c(null==l?void 0:l.curve,p)};if(a.info(i,e),void 0!==e.style){const t=d(e.style);i.style=t.style,i.labelStyle=t.labelStyle}e.text=e.title,void 0===e.text?void 0!==e.style&&(i.arrowheadStyle="fill: #333"):(i.arrowheadStyle="fill: #333",i.labelpos="c",(null==(s=o().flowchart)?void 0:s.htmlLabels)??o().htmlLabels?(i.labelType="html",i.label='<span class="edgeLabel">'+e.text+"</span>"):(i.labelType="text",i.label=e.text.replace(r.lineBreakRegex,"\n"),void 0===e.style&&(i.style=i.style||"stroke: #333; stroke-width: 1.5px;fill:none"),i.labelStyle=i.labelStyle.replace("color:","fill:"))),t.setEdge(e.id1,e.id2,i,n)})}(j,T),function(e,t,l,n){a.info(e),e.forEach(function(e,s){var i,r;const d=e,b={labelStyle:"",shape:"note",labelText:y(d.text),noteData:d,rx:0,ry:0,class:"",style:"",id:d.id,domId:d.id,tooltip:"",type:"note",padding:(null==(i=o().flowchart)?void 0:i.padding)??(null==(r=o().class)?void 0:r.padding)};if(t.setNode(d.id,b),a.info("setNode",b),!d.class||!(d.class in n))return;const f=l+s,u={id:`edgeNote${f}`,classes:"relation",pattern:"dotted",arrowhead:"none",startLabelRight:"",endLabelLeft:"",arrowTypeStart:"none",arrowTypeEnd:"none",style:"fill:none",labelStyle:"",curve:c(g.curve,p)};t.setEdge(d.id,d.class,u,f)})}(E,T,j.length+1,L),"sandbox"===x&&(N=n("#i"+t));const A=n("sandbox"===x?N.nodes()[0].contentDocument.body:"body"),D=A.select(`[id="${t}"]`),B=A.select("#"+t+" g");if(await f(B,T,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",t),s.insertTitle(D,"classTitleText",(null==v?void 0:v.titleTopMargin)??5,m.db.getDiagramTitle()),i(T,D,null==v?void 0:v.diagramPadding,null==v?void 0:v.useMaxWidth),!(null==v?void 0:v.htmlLabels)){const e="sandbox"===x?N.nodes()[0].contentDocument:document,l=e.querySelectorAll('[id="'+t+'"] .edgeLabel .label');for(const t of l){const l=t.getBBox(),a=e.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("rx",0),a.setAttribute("ry",0),a.setAttribute("width",l.width),a.setAttribute("height",l.height),t.insertBefore(a,t.firstChild)}}}},styles:e,init:e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute,t.clear()}};export{m as diagram};
