import{a as B,b as v,c as P}from"./chunk-2I4GBYVG.mjs";import{a as I}from"./chunk-HSQXRKDU.mjs";import"./chunk-GEQQM2ES.mjs";import"./chunk-K47GUC6A.mjs";import"./chunk-FEAVFCBA.mjs";import"./chunk-GY5XJE3P.mjs";import{a as G}from"./chunk-QGYOO2S6.mjs";import"./chunk-NMROEIYC.mjs";import"./chunk-UR2MHPN3.mjs";import{B as T,C as R,L as A}from"./chunk-BMJLAD6R.mjs";import{e as S}from"./chunk-B5PMS7SM.mjs";import"./chunk-QEUXDD35.mjs";import{H as k,a as p,g as c,m as x,ra as i,va as M}from"./chunk-FI53XPFH.mjs";var N=p(o=>S.sanitizeText(o,i()),"sanitizeText"),C={dividerMargin:10,padding:5,textHeight:10,curve:void 0},H=p(function(o,t,y,n){let e=Object.keys(o);c.info("keys:",e),c.info(o),e.forEach(function(a){let s=o[a],r={shape:"rect",id:s.id,domId:s.domId,labelText:N(s.id),labelStyle:"",style:"fill: none; stroke: black",padding:i().flowchart?.padding??i().class?.padding};t.setNode(s.id,r),z(s.classes,t,y,n,s.id),c.info("setNode",r)})},"addNamespaces"),z=p(function(o,t,y,n,e){let a=Object.keys(o);c.info("keys:",a),c.info(o),a.filter(s=>o[s].parent==e).forEach(function(s){let l=o[s],r=l.cssClasses.join(" "),b={labelStyle:"",style:""},m=l.label??l.id,f=0,g="class_box",d={labelStyle:b.labelStyle,shape:g,labelText:N(m),classData:l,rx:f,ry:f,class:r,style:b.style,id:l.id,domId:l.domId,tooltip:n.db.getTooltip(l.id,e)||"",haveCallback:l.haveCallback,link:l.link,width:l.type==="group"?500:void 0,type:l.type,padding:i().flowchart?.padding??i().class?.padding};t.setNode(l.id,d),e&&t.setParent(l.id,e),c.info("setNode",d)})},"addClasses"),V=p(function(o,t,y,n){c.info(o),o.forEach(function(e,a){let s=e,l="",r={labelStyle:"",style:""},b=s.text,m=0,f="note",g={labelStyle:r.labelStyle,shape:f,labelText:N(b),noteData:s,rx:m,ry:m,class:l,style:r.style,id:s.id,domId:s.id,tooltip:"",type:"note",padding:i().flowchart?.padding??i().class?.padding};if(t.setNode(s.id,g),c.info("setNode",g),!s.class||!(s.class in n))return;let d=y+a,u={id:`edgeNote${d}`,classes:"relation",pattern:"dotted",arrowhead:"none",startLabelRight:"",endLabelLeft:"",arrowTypeStart:"none",arrowTypeEnd:"none",style:"fill:none",labelStyle:"",curve:T(C.curve,k)};t.setEdge(s.id,s.class,u,d)})},"addNotes"),W=p(function(o,t){let y=i().flowchart,n=0;o.forEach(function(e){n++;let a={classes:"relation",pattern:e.relation.lineType==1?"dashed":"solid",id:"id"+n,arrowhead:e.type==="arrow_open"?"none":"normal",startLabelRight:e.relationTitle1==="none"?"":e.relationTitle1,endLabelLeft:e.relationTitle2==="none"?"":e.relationTitle2,arrowTypeStart:_(e.relation.type1),arrowTypeEnd:_(e.relation.type2),style:"fill:none",labelStyle:"",curve:T(y?.curve,k)};if(c.info(a,e),e.style!==void 0){let s=R(e.style);a.style=s.style,a.labelStyle=s.labelStyle}e.text=e.title,e.text===void 0?e.style!==void 0&&(a.arrowheadStyle="fill: #333"):(a.arrowheadStyle="fill: #333",a.labelpos="c",i().flowchart?.htmlLabels??i().htmlLabels?(a.labelType="html",a.label=''+e.text+""):(a.labelType="text",a.label=e.text.replace(S.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,n)})},"addRelations"),J=p(function(o){C={...C,...o}},"setConf"),K=p(async function(o,t,y,n){c.info("Drawing class - ",t);let e=i().flowchart??i().class,a=i().securityLevel;c.info("config:",e);let s=e?.nodeSpacing??50,l=e?.rankSpacing??50,r=new G({multigraph:!0,compound:!0}).setGraph({rankdir:n.db.getDirection(),nodesep:s,ranksep:l,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),b=n.db.getNamespaces(),m=n.db.getClasses(),f=n.db.getRelations(),g=n.db.getNotes();c.info(f),H(b,r,t,n),z(m,r,t,n),W(f,r),V(g,r,f.length+1,m);let d;a==="sandbox"&&(d=x("#i"+t));let u=a==="sandbox"?x(d.nodes()[0].contentDocument.body):x("body"),D=u.select(`[id="${t}"]`),q=u.select("#"+t+" g");if(await I(q,r,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",t),A.insertTitle(D,"classTitleText",e?.titleTopMargin??5,n.db.getDiagramTitle()),M(r,D,e?.diagramPadding,e?.useMaxWidth),!e?.htmlLabels){let L=a==="sandbox"?d.nodes()[0].contentDocument:document,F=L.querySelectorAll('[id="'+t+'"] .edgeLabel .label');for(let w of F){let E=w.getBBox(),h=L.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("rx",0),h.setAttribute("ry",0),h.setAttribute("width",E.width),h.setAttribute("height",E.height),w.insertBefore(h,w.firstChild)}}},"draw");function _(o){let t;switch(o){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}p(_,"getArrowMarker");var $={setConf:J,draw:K};var ie={parser:B,db:v,renderer:$,styles:P,init:o=>{o.class||(o.class={}),o.class.arrowMarkerAbsolute=o.arrowMarkerAbsolute,v.clear()}};export{ie as diagram};