import{a as j}from"./chunk-VHPDVOG3.mjs";import{a as J}from"./chunk-GBZW3Q7D.mjs";import{b as O}from"./chunk-OJ4XBKBL.mjs";import{x as U}from"./chunk-MISPJMMF.mjs";import{a as V,b as M}from"./chunk-3HPIZZTI.mjs";import{a as h,c as y,p as w}from"./chunk-BW7V6N3L.mjs";var pt=h((r,t,e,n)=>{t.forEach(a=>{Lt[a](r,e,n)})},"insertMarkers"),dt=h((r,t,e)=>{y.trace("Making markers for ",e),r.append("defs").append("marker").attr("id",t+"-extensionStart").attr("class","marker extension "+t).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),r.append("defs").append("marker").attr("id",t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),xt=h((r,t)=>{r.append("defs").append("marker").attr("id",t+"-compositionStart").attr("class","marker composition "+t).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),r.append("defs").append("marker").attr("id",t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),ut=h((r,t)=>{r.append("defs").append("marker").attr("id",t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),r.append("defs").append("marker").attr("id",t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),yt=h((r,t)=>{r.append("defs").append("marker").attr("id",t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),r.append("defs").append("marker").attr("id",t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),bt=h((r,t)=>{r.append("defs").append("marker").attr("id",t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",0).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","white").attr("cx",6).attr("cy",7).attr("r",6)},"lollipop"),gt=h((r,t)=>{r.append("marker").attr("id",t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",10).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),r.append("marker").attr("id",t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),mt=h((r,t)=>{r.append("marker").attr("id",t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),r.append("marker").attr("id",t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),wt=h((r,t)=>{r.append("marker").attr("id",t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),r.append("marker").attr("id",t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),kt=h((r,t)=>{r.append("defs").append("marker").attr("id",t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),Lt={extension:dt,composition:xt,aggregation:ut,dependency:yt,lollipop:bt,point:gt,circle:mt,cross:wt,barb:kt},ir=pt;import{select as vt}from"d3";function St(r,t){t&&r.attr("style",t)}h(St,"applyStyle");function Bt(r){let t=vt(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),e=t.append("xhtml:div"),n=r.label,a=r.isNode?"nodeLabel":"edgeLabel";return e.html('"+n+""),St(e,r.labelStyle),e.style("display","inline-block"),e.style("white-space","nowrap"),e.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}h(Bt,"addHtmlLabel");var Et=h((r,t,e,n)=>{let a=r||"";if(typeof a=="object"&&(a=a[0]),M(w().flowchart.htmlLabels)){a=a.replace(/\\n|\n/g,"
"),y.info("vertexText"+a);let s={isNode:n,label:O(a).replace(/fa[blrs]?:fa-[\w-]+/g,l=>``),labelStyle:t.replace("fill:","color:")};return Bt(s)}else{let s=document.createElementNS("http://www.w3.org/2000/svg","text");s.setAttribute("style",t.replace("color:","fill:"));let i=[];typeof a=="string"?i=a.split(/\\n|\n|
/gi):Array.isArray(a)?i=a:i=[];for(let l of i){let c=document.createElementNS("http://www.w3.org/2000/svg","tspan");c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),c.setAttribute("dy","1em"),c.setAttribute("x","0"),e?c.setAttribute("class","title-row"):c.setAttribute("class","row"),c.textContent=l.trim(),s.appendChild(c)}return s}},"createLabel"),C=Et;import{select as Ct}from"d3";var v=h(async(r,t,e,n)=>{let a,s=t.useHtmlLabels||M(w().flowchart.htmlLabels);e?a=e:a="node default";let i=r.insert("g").attr("class",a).attr("id",t.domId||t.id),l=i.insert("g").attr("class","label").attr("style",t.labelStyle),c;t.labelText===void 0?c="":c=typeof t.labelText=="string"?t.labelText:t.labelText[0];let f=l.node(),o;t.labelType==="markdown"?o=j(l,V(O(c),w()),{useHtmlLabels:s,width:t.width||w().flowchart.wrappingWidth,classes:"markdown-node-label"}):o=f.appendChild(C(V(O(c),w()),t.labelStyle,!1,n));let p=o.getBBox(),b=t.padding/2;if(M(w().flowchart.htmlLabels)){let d=o.children[0],x=Ct(o),u=d.getElementsByTagName("img");if(u){let g=c.replace(/]*>/g,"").trim()==="";await Promise.all([...u].map(m=>new Promise(_=>{function N(){if(m.style.display="flex",m.style.flexDirection="column",g){let T=w().fontSize?w().fontSize:window.getComputedStyle(document.body).fontSize,$=5;m.style.width=parseInt(T,10)*$+"px"}else m.style.width="100%";_(m)}h(N,"setupImage"),setTimeout(()=>{m.complete&&N()}),m.addEventListener("error",N),m.addEventListener("load",N)})))}p=d.getBoundingClientRect(),x.attr("width",p.width),x.attr("height",p.height)}return s?l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"):l.attr("transform","translate(0, "+-p.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:i,bbox:p,halfPadding:b,label:l}},"labelHelper"),L=h((r,t)=>{let e=t.node().getBBox();r.width=e.width,r.height=e.height},"updateNodeBounds");function W(r,t,e,n){return r.insert("polygon",":first-child").attr("points",n.map(function(a){return a.x+","+a.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+e/2+")")}h(W,"insertPolygonShape");import{select as H}from"d3";function Mt(r,t){return r.intersect(t)}h(Mt,"intersectNode");var K=Mt;function Tt(r,t,e,n){var a=r.x,s=r.y,i=a-n.x,l=s-n.y,c=Math.sqrt(t*t*l*l+e*e*i*i),f=Math.abs(t*e*i/c);n.x0}h(P,"sameSign");var tt=Ht;var rt=It;function It(r,t,e){var n=r.x,a=r.y,s=[],i=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(x){i=Math.min(i,x.x),l=Math.min(l,x.y)}):(i=Math.min(i,t.x),l=Math.min(l,t.y));for(var c=n-r.width/2-i,f=a-r.height/2-l,o=0;o1&&s.sort(function(x,u){var g=x.x-e.x,m=x.y-e.y,_=Math.sqrt(g*g+m*m),N=u.x-e.x,T=u.y-e.y,$=Math.sqrt(N*N+T*T);return _<$?-1:_===$?0:1}),s[0]):r}h(It,"intersectPolygon");var Nt=h((r,t)=>{var e=r.x,n=r.y,a=t.x-e,s=t.y-n,i=r.width/2,l=r.height/2,c,f;return Math.abs(s)*i>Math.abs(a)*l?(s<0&&(l=-l),c=s===0?0:l*a/s,f=l):(a<0&&(i=-i),c=i,f=a===0?0:i*s/a),{x:e+c,y:n+f}},"intersectRect"),at=Nt;var k={node:K,circle:G,ellipse:z,polygon:rt,rect:at};var _t=h(async(r,t)=>{t.useHtmlLabels||w().flowchart.htmlLabels||(t.centerLabel=!0);let{shapeSvg:n,bbox:a,halfPadding:s}=await v(r,t,"node "+t.classes,!0);y.info("Classes = ",t.classes);let i=n.insert("rect",":first-child");return i.attr("rx",t.rx).attr("ry",t.ry).attr("x",-a.width/2-s).attr("y",-a.height/2-s).attr("width",a.width+t.padding).attr("height",a.height+t.padding),L(t,i),t.intersect=function(l){return k.rect(t,l)},n},"note"),et=_t;var st=h(r=>r?" "+r:"","formatClass"),I=h((r,t)=>`${t||"node default"}${st(r.classes)} ${st(r.class)}`,"getClassesFromNode"),it=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=a+s,l=[{x:i/2,y:0},{x:i,y:-i/2},{x:i/2,y:-i},{x:0,y:-i/2}];y.info("Question main (Circle)");let c=W(e,i,i,l);return c.attr("style",t.style),L(t,c),t.intersect=function(f){return y.warn("Intersect called"),k.polygon(t,l,f)},e},"question"),Wt=h((r,t)=>{let e=r.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=28,a=[{x:0,y:n/2},{x:n/2,y:0},{x:0,y:-n/2},{x:-n/2,y:0}];return e.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(i){return k.circle(t,14,i)},e},"choice"),Xt=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=4,s=n.height+t.padding,i=s/a,l=n.width+2*i+t.padding,c=[{x:i,y:0},{x:l-i,y:0},{x:l,y:-s/2},{x:l-i,y:-s},{x:i,y:-s},{x:0,y:-s/2}],f=W(e,l,s,c);return f.attr("style",t.style),L(t,f),t.intersect=function(o){return k.polygon(t,c,o)},e},"hexagon"),$t=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:-s/2,y:0},{x:a,y:0},{x:a,y:-s},{x:-s/2,y:-s},{x:0,y:-s/2}];return W(e,a,s,i).attr("style",t.style),t.width=a+s,t.height=s,t.intersect=function(c){return k.polygon(t,i,c)},e},"rect_left_inv_arrow"),Yt=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:a-s/6,y:0},{x:a+2*s/6,y:-s},{x:s/6,y:-s}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"lean_right"),Ut=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:2*s/6,y:0},{x:a+s/6,y:0},{x:a-2*s/6,y:-s},{x:-s/6,y:-s}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"lean_left"),At=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:-2*s/6,y:0},{x:a+2*s/6,y:0},{x:a-s/6,y:-s},{x:s/6,y:-s}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"trapezoid"),Dt=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:s/6,y:0},{x:a-s/6,y:0},{x:a+2*s/6,y:-s},{x:-2*s/6,y:-s}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"inv_trapezoid"),Ot=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:a+s/2,y:0},{x:a,y:-s/2},{x:a+s/2,y:-s},{x:0,y:-s}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"rect_right_inv_arrow"),jt=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=a/2,i=s/(2.5+a/50),l=n.height+i+t.padding,c="M 0,"+i+" a "+s+","+i+" 0,0,0 "+a+" 0 a "+s+","+i+" 0,0,0 "+-a+" 0 l 0,"+l+" a "+s+","+i+" 0,0,0 "+a+" 0 l 0,"+-l,f=e.attr("label-offset-y",i).insert("path",":first-child").attr("style",t.style).attr("d",c).attr("transform","translate("+-a/2+","+-(l/2+i)+")");return L(t,f),t.intersect=function(o){let p=k.rect(t,o),b=p.x-t.x;if(s!=0&&(Math.abs(b)t.height/2-i)){let d=i*i*(1-b*b/(s*s));d!=0&&(d=Math.sqrt(d)),d=i-d,o.y-t.y>0&&(d=-d),p.y+=d}return p},e},"cylinder"),zt=h(async(r,t)=>{let{shapeSvg:e,bbox:n,halfPadding:a}=await v(r,t,"node "+t.classes+" "+t.class,!0),s=e.insert("rect",":first-child"),i=n.width+t.padding,l=n.height+t.padding;if(s.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",-n.width/2-a).attr("y",-n.height/2-a).attr("width",i).attr("height",l),t.props){let c=new Set(Object.keys(t.props));t.props.borders&&(ct(s,t.props.borders,i,l),c.delete("borders")),c.forEach(f=>{y.warn(`Unknown node property ${f}`)})}return L(t,s),t.intersect=function(c){return k.rect(t,c)},e},"rect"),Zt=h(async(r,t)=>{let{shapeSvg:e}=await v(r,t,"label",!0);y.trace("Classes = ",t.class);let n=e.insert("rect",":first-child"),a=0,s=0;if(n.attr("width",a).attr("height",s),e.attr("class","label edgeLabel"),t.props){let i=new Set(Object.keys(t.props));t.props.borders&&(ct(n,t.props.borders,a,s),i.delete("borders")),i.forEach(l=>{y.warn(`Unknown node property ${l}`)})}return L(t,n),t.intersect=function(i){return k.rect(t,i)},e},"labelRect");function ct(r,t,e,n){let a=[],s=h(l=>{a.push(l,0)},"addBorder"),i=h(l=>{a.push(0,l)},"skipBorder");t.includes("t")?(y.debug("add top border"),s(e)):i(e),t.includes("r")?(y.debug("add right border"),s(n)):i(n),t.includes("b")?(y.debug("add bottom border"),s(e)):i(e),t.includes("l")?(y.debug("add left border"),s(n)):i(n),r.attr("stroke-dasharray",a.join(" "))}h(ct,"applyNodePropertyBorders");var Ft=h((r,t)=>{let e;t.classes?e="node "+t.classes:e="node default";let n=r.insert("g").attr("class",e).attr("id",t.domId||t.id),a=n.insert("rect",":first-child"),s=n.insert("line"),i=n.insert("g").attr("class","label"),l=t.labelText.flat?t.labelText.flat():t.labelText,c="";typeof l=="object"?c=l[0]:c=l,y.info("Label text abc79",c,l,typeof l=="object");let f=i.node().appendChild(C(c,t.labelStyle,!0,!0)),o={width:0,height:0};if(M(w().flowchart.htmlLabels)){let u=f.children[0],g=H(f);o=u.getBoundingClientRect(),g.attr("width",o.width),g.attr("height",o.height)}y.info("Text 2",l);let p=l.slice(1,l.length),b=f.getBBox(),d=i.node().appendChild(C(p.join?p.join("
"):p,t.labelStyle,!0,!0));if(M(w().flowchart.htmlLabels)){let u=d.children[0],g=H(d);o=u.getBoundingClientRect(),g.attr("width",o.width),g.attr("height",o.height)}let x=t.padding/2;return H(d).attr("transform","translate( "+(o.width>b.width?0:(b.width-o.width)/2)+", "+(b.height+x+5)+")"),H(f).attr("transform","translate( "+(o.width{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.height+t.padding,s=n.width+a/4+t.padding,i=e.insert("rect",":first-child").attr("style",t.style).attr("rx",a/2).attr("ry",a/2).attr("x",-s/2).attr("y",-a/2).attr("width",s).attr("height",a);return L(t,i),t.intersect=function(l){return k.rect(t,l)},e},"stadium"),Vt=h(async(r,t)=>{let{shapeSvg:e,bbox:n,halfPadding:a}=await v(r,t,I(t,void 0),!0),s=e.insert("circle",":first-child");return s.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+a).attr("width",n.width+t.padding).attr("height",n.height+t.padding),y.info("Circle main"),L(t,s),t.intersect=function(i){return y.info("Circle intersect",t,n.width/2+a,i),k.circle(t,n.width/2+a,i)},e},"circle"),Jt=h(async(r,t)=>{let{shapeSvg:e,bbox:n,halfPadding:a}=await v(r,t,I(t,void 0),!0),s=5,i=e.insert("g",":first-child"),l=i.insert("circle"),c=i.insert("circle");return i.attr("class",t.class),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+a+s).attr("width",n.width+t.padding+s*2).attr("height",n.height+t.padding+s*2),c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",n.width/2+a).attr("width",n.width+t.padding).attr("height",n.height+t.padding),y.info("DoubleCircle main"),L(t,l),t.intersect=function(f){return y.info("DoubleCircle intersect",t,n.width/2+a+s,f),k.circle(t,n.width/2+a+s,f)},e},"doublecircle"),qt=h(async(r,t)=>{let{shapeSvg:e,bbox:n}=await v(r,t,I(t,void 0),!0),a=n.width+t.padding,s=n.height+t.padding,i=[{x:0,y:0},{x:a,y:0},{x:a,y:-s},{x:0,y:-s},{x:0,y:0},{x:-8,y:0},{x:a+8,y:0},{x:a+8,y:-s},{x:-8,y:-s},{x:-8,y:0}],l=W(e,a,s,i);return l.attr("style",t.style),L(t,l),t.intersect=function(c){return k.polygon(t,i,c)},e},"subroutine"),Kt=h((r,t)=>{let e=r.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=e.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),L(t,n),t.intersect=function(a){return k.circle(t,7,a)},e},"start"),nt=h((r,t,e)=>{let n=r.insert("g").attr("class","node default").attr("id",t.domId||t.id),a=70,s=10;e==="LR"&&(a=10,s=70);let i=n.append("rect").attr("x",-1*a/2).attr("y",-1*s/2).attr("width",a).attr("height",s).attr("class","fork-join");return L(t,i),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(l){return k.rect(t,l)},n},"forkJoin"),Gt=h((r,t)=>{let e=r.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=e.insert("circle",":first-child"),a=e.insert("circle",":first-child");return a.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),n.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),L(t,a),t.intersect=function(s){return k.circle(t,7,s)},e},"end"),Pt=h((r,t)=>{let e=t.padding/2,n=4,a=8,s;t.classes?s="node "+t.classes:s="node default";let i=r.insert("g").attr("class",s).attr("id",t.domId||t.id),l=i.insert("rect",":first-child"),c=i.insert("line"),f=i.insert("line"),o=0,p=n,b=i.insert("g").attr("class","label"),d=0,x=t.classData.annotations&&t.classData.annotations[0],u=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",g=b.node().appendChild(C(u,t.labelStyle,!0,!0)),m=g.getBBox();if(M(w().flowchart.htmlLabels)){let S=g.children[0],B=H(g);m=S.getBoundingClientRect(),B.attr("width",m.width),B.attr("height",m.height)}t.classData.annotations[0]&&(p+=m.height+n,o+=m.width);let _=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(w().flowchart.htmlLabels?_+="<"+t.classData.type+">":_+="<"+t.classData.type+">");let N=b.node().appendChild(C(_,t.labelStyle,!0,!0));H(N).attr("class","classTitle");let T=N.getBBox();if(M(w().flowchart.htmlLabels)){let S=N.children[0],B=H(N);T=S.getBoundingClientRect(),B.attr("width",T.width),B.attr("height",T.height)}p+=T.height+n,T.width>o&&(o=T.width);let $=[];t.classData.members.forEach(S=>{let B=J(S),Y=B.displayText;w().flowchart.htmlLabels&&(Y=Y.replace(//g,">"));let X=b.node().appendChild(C(Y,B.cssStyle?B.cssStyle:t.labelStyle,!0,!0)),R=X.getBBox();if(M(w().flowchart.htmlLabels)){let Q=X.children[0],D=H(X);R=Q.getBoundingClientRect(),D.attr("width",R.width),D.attr("height",R.height)}R.width>o&&(o=R.width),p+=R.height+n,$.push(X)}),p+=a;let q=[];if(t.classData.methods.forEach(S=>{let B=J(S),Y=B.displayText;w().flowchart.htmlLabels&&(Y=Y.replace(//g,">"));let X=b.node().appendChild(C(Y,B.cssStyle?B.cssStyle:t.labelStyle,!0,!0)),R=X.getBBox();if(M(w().flowchart.htmlLabels)){let Q=X.children[0],D=H(X);R=Q.getBoundingClientRect(),D.attr("width",R.width),D.attr("height",R.height)}R.width>o&&(o=R.width),p+=R.height+n,q.push(X)}),p+=a,x){let S=(o-m.width)/2;H(g).attr("transform","translate( "+(-1*o/2+S)+", "+-1*p/2+")"),d=m.height+n}let ft=(o-T.width)/2;return H(N).attr("transform","translate( "+(-1*o/2+ft)+", "+(-1*p/2+d)+")"),d+=T.height+n,c.attr("class","divider").attr("x1",-o/2-e).attr("x2",o/2+e).attr("y1",-p/2-e+a+d).attr("y2",-p/2-e+a+d),d+=a,$.forEach(S=>{H(S).attr("transform","translate( "+-o/2+", "+(-1*p/2+d+a/2)+")");let B=S?.getBBox();d+=(B?.height??0)+n}),d+=a,f.attr("class","divider").attr("x1",-o/2-e).attr("x2",o/2+e).attr("y1",-p/2-e+a+d).attr("y2",-p/2-e+a+d),d+=a,q.forEach(S=>{H(S).attr("transform","translate( "+-o/2+", "+(-1*p/2+d)+")");let B=S?.getBBox();d+=(B?.height??0)+n}),l.attr("class","outer title-state").attr("x",-o/2-e).attr("y",-(p/2)-e).attr("width",o+t.padding).attr("height",p+t.padding),L(t,l),t.intersect=function(S){return k.rect(t,S)},i},"class_box"),lt={rhombus:it,question:it,rect:zt,labelRect:Zt,rectWithTitle:Ft,choice:Wt,circle:Vt,doublecircle:Jt,stadium:Qt,hexagon:Xt,rect_left_inv_arrow:$t,lean_right:Yt,lean_left:Ut,trapezoid:At,inv_trapezoid:Dt,rect_right_inv_arrow:Ot,cylinder:jt,start:Kt,end:Gt,note:et,subroutine:qt,fork:nt,join:nt,class_box:Pt},A={},sa=h(async(r,t,e)=>{let n,a;if(t.link){let s;w().securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),n=r.insert("svg:a").attr("xlink:href",t.link).attr("target",s),a=await lt[t.shape](n,t,e)}else a=await lt[t.shape](r,t,e),n=a;return t.tooltip&&a.attr("title",t.tooltip),t.class&&a.attr("class","node default "+t.class),A[t.id]=n,t.haveCallback&&A[t.id].attr("class",A[t.id].attr("class")+" clickable"),n},"insertNode"),ia=h((r,t)=>{A[t.id]=r},"setNodeElem"),na=h(()=>{A={}},"clear"),la=h(r=>{let t=A[r.id];y.trace("Transforming node",r.diff,r,"translate("+(r.x-r.width/2-5)+", "+r.width/2+")");let e=8,n=r.diff||0;return r.clusterNode?t.attr("transform","translate("+(r.x+n-r.width/2)+", "+(r.y-r.height/2-e)+")"):t.attr("transform","translate("+r.x+", "+r.y+")"),n},"positionNode");import{line as tr,curveBasis as ot,select as rr}from"d3";var F={},E={},ba=h(()=>{F={},E={}},"clear"),ga=h((r,t)=>{let e=M(w().flowchart.htmlLabels),n=t.labelType==="markdown"?j(r,t.label,{style:t.labelStyle,useHtmlLabels:e,addSvgBackground:!0}):C(t.label,t.labelStyle);y.info("abc82",t,t.labelType);let a=r.insert("g").attr("class","edgeLabel"),s=a.insert("g").attr("class","label");s.node().appendChild(n);let i=n.getBBox();if(e){let c=n.children[0],f=rr(n);i=c.getBoundingClientRect(),f.attr("width",i.width),f.attr("height",i.height)}s.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),F[t.id]=a,t.width=i.width,t.height=i.height;let l;if(t.startLabelLeft){let c=C(t.startLabelLeft,t.labelStyle),f=r.insert("g").attr("class","edgeTerminals"),o=f.insert("g").attr("class","inner");l=o.node().appendChild(c);let p=c.getBBox();o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),E[t.id]||(E[t.id]={}),E[t.id].startLeft=f,Z(l,t.startLabelLeft)}if(t.startLabelRight){let c=C(t.startLabelRight,t.labelStyle),f=r.insert("g").attr("class","edgeTerminals"),o=f.insert("g").attr("class","inner");l=f.node().appendChild(c),o.node().appendChild(c);let p=c.getBBox();o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),E[t.id]||(E[t.id]={}),E[t.id].startRight=f,Z(l,t.startLabelRight)}if(t.endLabelLeft){let c=C(t.endLabelLeft,t.labelStyle),f=r.insert("g").attr("class","edgeTerminals"),o=f.insert("g").attr("class","inner");l=o.node().appendChild(c);let p=c.getBBox();o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),f.node().appendChild(c),E[t.id]||(E[t.id]={}),E[t.id].endLeft=f,Z(l,t.endLabelLeft)}if(t.endLabelRight){let c=C(t.endLabelRight,t.labelStyle),f=r.insert("g").attr("class","edgeTerminals"),o=f.insert("g").attr("class","inner");l=o.node().appendChild(c);let p=c.getBBox();o.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),f.node().appendChild(c),E[t.id]||(E[t.id]={}),E[t.id].endRight=f,Z(l,t.endLabelRight)}return n},"insertEdgeLabel");function Z(r,t){w().flowchart.htmlLabels&&r&&(r.style.width=t.length*9+"px",r.style.height="12px")}h(Z,"setTerminalWidth");var ma=h((r,t)=>{y.info("Moving label abc78 ",r.id,r.label,F[r.id]);let e=t.updatedPath?t.updatedPath:t.originalPath;if(r.label){let n=F[r.id],a=r.x,s=r.y;if(e){let i=U.calcLabelPosition(e);y.info("Moving label "+r.label+" from (",a,",",s,") to (",i.x,",",i.y,") abc78"),t.updatedPath&&(a=i.x,s=i.y)}n.attr("transform","translate("+a+", "+s+")")}if(r.startLabelLeft){let n=E[r.id].startLeft,a=r.x,s=r.y;if(e){let i=U.calcTerminalLabelPosition(r.arrowTypeStart?10:0,"start_left",e);a=i.x,s=i.y}n.attr("transform","translate("+a+", "+s+")")}if(r.startLabelRight){let n=E[r.id].startRight,a=r.x,s=r.y;if(e){let i=U.calcTerminalLabelPosition(r.arrowTypeStart?10:0,"start_right",e);a=i.x,s=i.y}n.attr("transform","translate("+a+", "+s+")")}if(r.endLabelLeft){let n=E[r.id].endLeft,a=r.x,s=r.y;if(e){let i=U.calcTerminalLabelPosition(r.arrowTypeEnd?10:0,"end_left",e);a=i.x,s=i.y}n.attr("transform","translate("+a+", "+s+")")}if(r.endLabelRight){let n=E[r.id].endRight,a=r.x,s=r.y;if(e){let i=U.calcTerminalLabelPosition(r.arrowTypeEnd?10:0,"end_right",e);a=i.x,s=i.y}n.attr("transform","translate("+a+", "+s+")")}},"positionEdgeLabel"),ar=h((r,t)=>{let e=r.x,n=r.y,a=Math.abs(t.x-e),s=Math.abs(t.y-n),i=r.width/2,l=r.height/2;return a>=i||s>=l},"outsideNode"),er=h((r,t,e)=>{y.warn(`intersection calc abc89:
outsidePoint: ${JSON.stringify(t)}
insidePoint : ${JSON.stringify(e)}
node : x:${r.x} y:${r.y} w:${r.width} h:${r.height}`);let n=r.x,a=r.y,s=Math.abs(n-e.x),i=r.width/2,l=e.xMath.abs(n-t.x)*c){let p=e.y{y.warn("abc88 cutPathAtIntersect",r,t);let e=[],n=r[0],a=!1;return r.forEach(s=>{if(y.info("abc88 checking point",s,t),!ar(t,s)&&!a){let i=er(t,n,s);y.warn("abc88 inside",s,n,i),y.warn("abc88 intersection",i);let l=!1;e.forEach(c=>{l=l||c.x===i.x&&c.y===i.y}),e.some(c=>c.x===i.x&&c.y===i.y)?y.warn("abc88 no intersect",i,e):e.push(i),a=!0}else y.warn("abc88 outside",s,n),n=s,a||e.push(s)}),y.warn("abc88 returning points",e),e},"cutPathAtIntersect"),wa=h(function(r,t,e,n,a,s){let i=e.points,l=!1,c=s.node(t.v);var f=s.node(t.w);y.info("abc88 InsertEdge: ",e),f.intersect&&c.intersect&&(i=i.slice(1,e.points.length-1),i.unshift(c.intersect(i[0])),y.info("Last point",i[i.length-1],f,f.intersect(i[i.length-1])),i.push(f.intersect(i[i.length-1]))),e.toCluster&&(y.info("to cluster abc88",n[e.toCluster]),i=ht(e.points,n[e.toCluster].node),l=!0),e.fromCluster&&(y.info("from cluster abc88",n[e.fromCluster]),i=ht(i.reverse(),n[e.fromCluster].node).reverse(),l=!0);let o=i.filter(m=>!Number.isNaN(m.y)),p;a==="graph"||a==="flowchart"?p=e.curve||ot:p=ot;let b=tr().x(function(m){return m.x}).y(function(m){return m.y}).curve(p),d;switch(e.thickness){case"normal":d="edge-thickness-normal";break;case"thick":d="edge-thickness-thick";break;case"invisible":d="edge-thickness-thick";break;default:d=""}switch(e.pattern){case"solid":d+=" edge-pattern-solid";break;case"dotted":d+=" edge-pattern-dotted";break;case"dashed":d+=" edge-pattern-dashed";break}let x=r.append("path").attr("d",b(o)).attr("id",e.id).attr("class"," "+d+(e.classes?" "+e.classes:"")).attr("style",e.style),u="";switch((w().flowchart.arrowMarkerAbsolute||w().state.arrowMarkerAbsolute)&&(u=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,u=u.replace(/\(/g,"\\("),u=u.replace(/\)/g,"\\)")),y.info("arrowTypeStart",e.arrowTypeStart),y.info("arrowTypeEnd",e.arrowTypeEnd),e.arrowTypeStart){case"arrow_cross":x.attr("marker-start","url("+u+"#"+a+"-crossStart)");break;case"arrow_point":x.attr("marker-start","url("+u+"#"+a+"-pointStart)");break;case"arrow_barb":x.attr("marker-start","url("+u+"#"+a+"-barbStart)");break;case"arrow_circle":x.attr("marker-start","url("+u+"#"+a+"-circleStart)");break;case"aggregation":x.attr("marker-start","url("+u+"#"+a+"-aggregationStart)");break;case"extension":x.attr("marker-start","url("+u+"#"+a+"-extensionStart)");break;case"composition":x.attr("marker-start","url("+u+"#"+a+"-compositionStart)");break;case"dependency":x.attr("marker-start","url("+u+"#"+a+"-dependencyStart)");break;case"lollipop":x.attr("marker-start","url("+u+"#"+a+"-lollipopStart)");break;default:}switch(e.arrowTypeEnd){case"arrow_cross":x.attr("marker-end","url("+u+"#"+a+"-crossEnd)");break;case"arrow_point":x.attr("marker-end","url("+u+"#"+a+"-pointEnd)");break;case"arrow_barb":x.attr("marker-end","url("+u+"#"+a+"-barbEnd)");break;case"arrow_circle":x.attr("marker-end","url("+u+"#"+a+"-circleEnd)");break;case"aggregation":x.attr("marker-end","url("+u+"#"+a+"-aggregationEnd)");break;case"extension":x.attr("marker-end","url("+u+"#"+a+"-extensionEnd)");break;case"composition":x.attr("marker-end","url("+u+"#"+a+"-compositionEnd)");break;case"dependency":x.attr("marker-end","url("+u+"#"+a+"-dependencyEnd)");break;case"lollipop":x.attr("marker-end","url("+u+"#"+a+"-lollipopEnd)");break;default:}let g={};return l&&(g.updatedPath=i),g.originalPath=e.points,g},"insertEdge");export{ir as a,C as b,v as c,L as d,at as e,sa as f,ia as g,na as h,la as i,ba as j,ga as k,ma as l,wa as m};