import{a as mt}from"./chunk-CM5D5KZN.min.js";import{Ea as F,Ha as _,Ia as A,Ja as N,Ka as R,La as H,Ma as D,N as $,Na as O,Oa as j,Pa as z,Qa as U,Ra as k,Sa as G,Ta as J,Ua as X,Va as Y,Wa as q,Xa as Z,Ya as K,Za as Q,h as s,ia as L,j as f,m,p as E,s as b,w as I}from"./chunk-U3SD26FK.min.js";import{T as V,k as w}from"./chunk-CXRPJJJE.min.js";import{d as gt}from"./chunk-OSRY5VT3.min.js";var nt=gt(mt(),1);var vt="\u200B",yt={curveBasis:N,curveBasisClosed:R,curveBasisOpen:H,curveBumpX:_,curveBumpY:A,curveBundle:D,curveCardinalClosed:j,curveCardinalOpen:z,curveCardinal:O,curveCatmullRomClosed:k,curveCatmullRomOpen:G,curveCatmullRom:U,curveLinear:F,curveLinearClosed:J,curveMonotoneX:X,curveMonotoneY:Y,curveNatural:q,curveStep:Z,curveStepAfter:Q,curveStepBefore:K},xt=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,pt=s(function(e,t){let r=rt(e,/(?:init\b)|(?:initialize\b)/),n={};if(Array.isArray(r)){let a=r.map(l=>l.args);I(a),n=b(n,[...a])}else n=r.args;if(!n)return;let i=E(e,t),o="config";return n[o]!==void 0&&(i==="flowchart-v2"&&(i="flowchart"),n[i]=n[o],delete n[o]),n},"detectInit"),rt=s(function(e,t=null){try{let r=new RegExp(`[%]{2}(?![{]${xt.source})(?=[}][%]{2}).* `,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),f.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let n,i=[];for(;(n=m.exec(e))!==null;)if(n.index===m.lastIndex&&m.lastIndex++,n&&!t||t&&n[1]?.match(t)||t&&n[2]?.match(t)){let o=n[1]?n[1]:n[2],a=n[3]?n[3].trim():n[4]?JSON.parse(n[4].trim()):null;i.push({type:o,args:a})}return i.length===0?{type:e,args:null}:i.length===1?i[0]:i}catch(r){return f.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),Ht=s(function(e){return e.replace(m,"")},"removeDirectives"),$t=s(function(e,t){for(let[r,n]of t.entries())if(n.match(e))return r;return-1},"isSubstringInArray");function it(e,t){if(!e)return t;let r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return yt[r]??t}s(it,"interpolateToCurve");function ot(e,t){let r=e.trim();if(r)return t.securityLevel!=="loose"?(0,nt.sanitizeUrl)(r):r}s(ot,"formatUrl");var wt=s((e,...t)=>{let r=e.split("."),n=r.length-1,i=r[n],o=window;for(let a=0;a{r+=B(i,t),t=i});let n=r/2;return S(e,n)}s(at,"traverseEdge");function st(e){return e.length===1?e[0]:at(e)}s(st,"calcLabelPosition");var tt=s((e,t=2)=>{let r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),S=s((e,t)=>{let r,n=t;for(let i of e){if(r){let o=B(i,r);if(o=1)return{x:i.x,y:i.y};if(a>0&&a<1)return{x:tt((1-a)*r.x+a*i.x,5),y:tt((1-a)*r.y+a*i.y,5)}}}r=i}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),Mt=s((e,t,r)=>{f.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());let i=S(t,25),o=e?10:5,a=Math.atan2(t[0].y-i.y,t[0].x-i.x),l={x:0,y:0};return l.x=Math.sin(a)*o+(t[0].x+i.x)/2,l.y=-Math.cos(a)*o+(t[0].y+i.y)/2,l},"calcCardinalityPosition");function ct(e,t,r){let n=structuredClone(r);f.info("our points",n),t!=="start_left"&&t!=="start_right"&&n.reverse();let i=25+e,o=S(n,i),a=10+e*.5,l=Math.atan2(n[0].y-o.y,n[0].x-o.x),c={x:0,y:0};return t==="start_left"?(c.x=Math.sin(l+Math.PI)*a+(n[0].x+o.x)/2,c.y=-Math.cos(l+Math.PI)*a+(n[0].y+o.y)/2):t==="end_right"?(c.x=Math.sin(l-Math.PI)*a+(n[0].x+o.x)/2-5,c.y=-Math.cos(l-Math.PI)*a+(n[0].y+o.y)/2-5):t==="end_left"?(c.x=Math.sin(l)*a+(n[0].x+o.x)/2-5,c.y=-Math.cos(l)*a+(n[0].y+o.y)/2-5):(c.x=Math.sin(l)*a+(n[0].x+o.x)/2,c.y=-Math.cos(l)*a+(n[0].y+o.y)/2),c}s(ct,"calcTerminalLabelPosition");function lt(e){let t="",r="";for(let n of e)n!==void 0&&(n.startsWith("color:")||n.startsWith("text-align:")?r=r+n+";":t=t+n+";");return{style:t,labelStyle:r}}s(lt,"getStylesFromArray");var et=0,bt=s(()=>(et++,"id-"+Math.random().toString(36).substr(2,12)+"-"+et),"generateId");function ut(e){let t="",r="0123456789abcdef",n=r.length;for(let i=0;iut(e.length),"random"),St=s(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),Wt=s(function(e,t){let r=t.text.replace($.lineBreakRegex," "),[,n]=T(t.fontSize),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.style("text-anchor",t.anchor),i.style("font-family",t.fontFamily),i.style("font-size",n),i.style("font-weight",t.fontWeight),i.attr("fill",t.fill),t.class!==void 0&&i.attr("class",t.class);let o=i.append("tspan");return o.attr("x",t.x+t.textMargin*2),o.attr("fill",t.fill),o.text(r),i},"drawSimpleText"),Tt=w((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
"},r),$.lineBreakRegex.test(e)))return e;let n=e.split(" ").filter(Boolean),i=[],o="";return n.forEach((a,l)=>{let c=v(`${a} `,r),u=v(o,r);if(c>t){let{hyphenatedStrings:g,remainingWord:h}=Ct(a,t,"-",r);i.push(o,...g),o=h}else u+c>=t?(i.push(o),o=a):o=[o,a].filter(Boolean).join(" ");l+1===n.length&&i.push(o)}),i.filter(a=>a!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),Ct=w((e,t,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...e],o=[],a="";return i.forEach((l,c)=>{let u=`${a}${l}`;if(v(u,n)>=t){let x=c+1,g=i.length===x,h=`${u}${r}`;o.push(g?u:h),a=""}else a=u}),{hyphenatedStrings:o,remainingWord:a}},(e,t,r="-",n)=>`${e}${t}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);function ht(e,t){return W(e,t).height}s(ht,"calculateTextHeight");function v(e,t){return W(e,t).width}s(v,"calculateTextWidth");var W=w((e,t)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=t;if(!e)return{width:0,height:0};let[,o]=T(r),a=["sans-serif",n],l=e.split($.lineBreakRegex),c=[],u=L("body");if(!u.remove)return{width:0,height:0,lineHeight:0};let y=u.append("svg");for(let g of a){let h=0,d={width:0,height:0,lineHeight:0};for(let ft of l){let C=St();C.text=ft||vt;let P=Wt(y,C).style("font-size",o).style("font-weight",i).style("font-family",g),p=(P._groups||P)[0][0].getBBox();if(p.width===0&&p.height===0)throw new Error("svg element not in render tree");d.width=Math.round(Math.max(d.width,p.width)),h=Math.round(p.height),d.height+=h,d.lineHeight=Math.round(Math.max(d.lineHeight,h))}c.push(d)}y.remove();let x=isNaN(c[1].height)||isNaN(c[1].width)||isNaN(c[1].lineHeight)||c[0].height>c[1].height&&c[0].width>c[1].width&&c[0].lineHeight>c[1].lineHeight?0:1;return c[x]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),Pt=class{constructor(e=!1,t){this.count=0,this.count=t?t.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{s(this,"InitIDGenerator")}},M,Et=s(function(e){return M=M||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),M.innerHTML=e,unescape(M.textContent)},"entityDecode");function It(e){return"str"in e}s(It,"isDetailedError");var Lt=s((e,t,r,n)=>{if(!n)return;let i=e.node()?.getBBox();i&&e.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",t)},"insertTitle"),T=s(e=>{if(typeof e=="number")return[e,e+"px"];let t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");function dt(e,t){return V({},e,t)}s(dt,"cleanAndMerge");var Dt={assignWithDepth:b,wrapLabel:Tt,calculateTextHeight:ht,calculateTextWidth:v,calculateTextDimensions:W,cleanAndMerge:dt,detectInit:pt,detectDirective:rt,isSubstringInArray:$t,interpolateToCurve:it,calcLabelPosition:st,calcCardinalityPosition:Mt,calcTerminalLabelPosition:ct,formatUrl:ot,getStylesFromArray:lt,generateId:bt,random:Bt,runFunc:wt,entityDecode:Et,insertTitle:Lt,parseFontSize:T,InitIDGenerator:Pt},Ot=s(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),t},"encodeEntities"),jt=s(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),zt=s((e,t,{counter:r=0,prefix:n,suffix:i})=>`${n?`${n}_`:""}${e}_${t}_${r}${i?`_${i}`:""}`,"getEdgeId");function Ft(e){return e??null}s(Ft,"handleUndefinedAttr");export{vt as a,Ht as b,it as c,lt as d,bt as e,Bt as f,Tt as g,ht as h,v as i,It as j,T as k,dt as l,Dt as m,Ot as n,jt as o,zt as p,Ft as q}; //# sourceMappingURL=chunk-PYPO7LRM.min.js.map