mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
3 lines • 117 kB
JavaScript
import{a as Yt}from"./chunk-LM6QDVU5.mjs";import{c as pt}from"./chunk-UCQ5T4NL.mjs";import{d as ot}from"./chunk-I5SP4YIW.mjs";import{i as yt,k as xe,o as lt,q as Z}from"./chunk-QS5O44OF.mjs";import{A as mt,F as qt,G as U,H as Xt,I as Bt,K as ue,L as ye,X,_ as Tt,b as z,ga as Y,s as de}from"./chunk-QJLC67TO.mjs";import{a as u}from"./chunk-GTKDMUJJ.mjs";var C=u(async(l,t,o)=>{let r,e=t.useHtmlLabels||U(X()?.htmlLabels);o?r=o:r="node default";let a=l.insert("g").attr("class",r).attr("id",t.domId||t.id),h=a.insert("g").attr("class","label").attr("style",Z(t.labelStyle)),s;t.label===void 0?s="":s=typeof t.label=="string"?t.label:t.label[0];let c=await ot(h,qt(lt(s),X()),{useHtmlLabels:e,width:t.width||X().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img}),i=c.getBBox(),n=(t?.padding??0)/2;if(e){let p=c.children[0],f=Y(c),m=p.getElementsByTagName("img");if(m){let g=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...m].map(d=>new Promise(y=>{function x(){if(d.style.display="flex",d.style.flexDirection="column",g){let b=X().fontSize?X().fontSize:window.getComputedStyle(document.body).fontSize,S=5,[$=de.fontSize]=xe(b),w=$*S+"px";d.style.minWidth=w,d.style.maxWidth=w}else d.style.width="100%";y(d)}u(x,"setupImage"),setTimeout(()=>{d.complete&&x()}),d.addEventListener("error",x),d.addEventListener("load",x)})))}i=p.getBoundingClientRect(),f.attr("width",i.width),f.attr("height",i.height)}return e?h.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"):h.attr("transform","translate(0, "+-i.height/2+")"),t.centerLabel&&h.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),h.insert("rect",":first-child"),{shapeSvg:a,bbox:i,halfPadding:n,label:h}},"labelHelper"),Ct=u(async(l,t,o)=>{let r=o.useHtmlLabels||U(X()?.flowchart?.htmlLabels),e=l.insert("g").attr("class","label").attr("style",o.labelStyle||""),a=await ot(e,qt(lt(t),X()),{useHtmlLabels:r,width:o.width||X()?.flowchart?.wrappingWidth,style:o.labelStyle,addSvgBackground:!!o.icon||!!o.img}),h=a.getBBox(),s=o.padding/2;if(U(X()?.flowchart?.htmlLabels)){let c=a.children[0],i=Y(a);h=c.getBoundingClientRect(),i.attr("width",h.width),i.attr("height",h.height)}return r?e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"):e.attr("transform","translate(0, "+-h.height/2+")"),o.centerLabel&&e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),e.insert("rect",":first-child"),{shapeSvg:l,bbox:h,halfPadding:s,label:e}},"insertLabel"),M=u((l,t)=>{let o=t.node().getBBox();l.width=o.width,l.height=o.height},"updateNodeBounds");var T=u((l,t)=>(l.look==="handDrawn"?"rough-node":"node")+" "+l.cssClasses+" "+(t||""),"getNodeClasses");function V(l){let t=l.map((o,r)=>`${r===0?"M":"L"}${o.x},${o.y}`);return t.push("Z"),t.join(" ")}u(V,"createPathFromPoints");function at(l,t,o,r,e,a){let h=[],c=o-l,i=r-t,n=c/a,p=2*Math.PI/n,f=t+i/2;for(let m=0;m<=50;m++){let g=m/50,d=l+g*c,y=f+e*Math.sin(p*(d-l));h.push({x:d,y})}return h}u(at,"generateFullSineWavePoints");function Rt(l,t,o,r,e,a){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=l+o*Math.cos(f),g=t+o*Math.sin(f);h.push({x:-m,y:-g})}return h}u(Rt,"generateCirclePoints");function Zt(l,t,o){if(l&&l.length){let[r,e]=t,a=Math.PI/180*o,h=Math.cos(a),s=Math.sin(a);for(let c of l){let[i,n]=c;c[0]=(i-r)*h-(n-e)*s+r,c[1]=(i-r)*s+(n-e)*h+e}}}u(Zt,"t");function Ys(l,t){return l[0]===t[0]&&l[1]===t[1]}u(Ys,"e");function Zs(l,t,o,r=1){let e=o,a=Math.max(t,.1),h=l[0]&&l[0][0]&&typeof l[0][0]=="number"?[l]:l,s=[0,0];if(e)for(let i of h)Zt(i,s,e);let c=function(i,n,p){let f=[];for(let b of i){let S=[...b];Ys(S[0],S[S.length-1])||S.push([S[0][0],S[0][1]]),S.length>2&&f.push(S)}let m=[];n=Math.max(n,.1);let g=[];for(let b of f)for(let S=0;S<b.length-1;S++){let $=b[S],w=b[S+1];if($[1]!==w[1]){let P=Math.min($[1],w[1]);g.push({ymin:P,ymax:Math.max($[1],w[1]),x:P===$[1]?$[0]:w[0],islope:(w[0]-$[0])/(w[1]-$[1])})}}if(g.sort((b,S)=>b.ymin<S.ymin?-1:b.ymin>S.ymin?1:b.x<S.x?-1:b.x>S.x?1:b.ymax===S.ymax?0:(b.ymax-S.ymax)/Math.abs(b.ymax-S.ymax)),!g.length)return m;let d=[],y=g[0].ymin,x=0;for(;d.length||g.length;){if(g.length){let b=-1;for(let S=0;S<g.length&&!(g[S].ymin>y);S++)b=S;g.splice(0,b+1).forEach(S=>{d.push({s:y,edge:S})})}if(d=d.filter(b=>!(b.edge.ymax<=y)),d.sort((b,S)=>b.edge.x===S.edge.x?0:(b.edge.x-S.edge.x)/Math.abs(b.edge.x-S.edge.x)),(p!==1||x%n==0)&&d.length>1)for(let b=0;b<d.length;b+=2){let S=b+1;if(S>=d.length)break;let $=d[b].edge,w=d[S].edge;m.push([[Math.round($.x),y],[Math.round(w.x),y]])}y+=p,d.forEach(b=>{b.edge.x=b.edge.x+p*b.edge.islope}),x++}return m}(h,a,r);if(e){for(let i of h)Zt(i,s,-e);(function(i,n,p){let f=[];i.forEach(m=>f.push(...m)),Zt(f,n,p)})(c,s,-e)}return c}u(Zs,"s");function kt(l,t){var o;let r=t.hachureAngle+90,e=t.hachureGap;e<0&&(e=4*t.strokeWidth),e=Math.round(Math.max(e,.1));let a=1;return t.roughness>=1&&(((o=t.randomizer)===null||o===void 0?void 0:o.next())||Math.random())>.7&&(a=e),Zs(l,e,r,a||1)}u(kt,"n");var Mt=class{static{u(this,"o")}constructor(t){this.helper=t}fillPolygons(t,o){return this._fillPolygons(t,o)}_fillPolygons(t,o){let r=kt(t,o);return{type:"fillSketch",ops:this.renderLines(r,o)}}renderLines(t,o){let r=[];for(let e of t)r.push(...this.helper.doubleLineOps(e[0][0],e[0][1],e[1][0],e[1][1],o));return r}};function Vt(l){let t=l[0],o=l[1];return Math.sqrt(Math.pow(t[0]-o[0],2)+Math.pow(t[1]-o[1],2))}u(Vt,"a");var te=class extends Mt{static{u(this,"h")}fillPolygons(t,o){let r=o.hachureGap;r<0&&(r=4*o.strokeWidth),r=Math.max(r,.1);let e=kt(t,Object.assign({},o,{hachureGap:r})),a=Math.PI/180*o.hachureAngle,h=[],s=.5*r*Math.cos(a),c=.5*r*Math.sin(a);for(let[i,n]of e)Vt([i,n])&&h.push([[i[0]-s,i[1]+c],[...n]],[[i[0]+s,i[1]-c],[...n]]);return{type:"fillSketch",ops:this.renderLines(h,o)}}},ee=class extends Mt{static{u(this,"r")}fillPolygons(t,o){let r=this._fillPolygons(t,o),e=Object.assign({},o,{hachureAngle:o.hachureAngle+90}),a=this._fillPolygons(t,e);return r.ops=r.ops.concat(a.ops),r}},se=class{static{u(this,"i")}constructor(t){this.helper=t}fillPolygons(t,o){let r=kt(t,o=Object.assign({},o,{hachureAngle:0}));return this.dotsOnLines(r,o)}dotsOnLines(t,o){let r=[],e=o.hachureGap;e<0&&(e=4*o.strokeWidth),e=Math.max(e,.1);let a=o.fillWeight;a<0&&(a=o.strokeWidth/2);let h=e/4;for(let s of t){let c=Vt(s),i=c/e,n=Math.ceil(i)-1,p=c-n*e,f=(s[0][0]+s[1][0])/2-e/4,m=Math.min(s[0][1],s[1][1]);for(let g=0;g<n;g++){let d=m+p+g*e,y=f-h+2*Math.random()*h,x=d-h+2*Math.random()*h,b=this.helper.ellipse(y,x,a,a,o);r.push(...b.ops)}}return{type:"fillSketch",ops:r}}},re=class{static{u(this,"c")}constructor(t){this.helper=t}fillPolygons(t,o){let r=kt(t,o);return{type:"fillSketch",ops:this.dashedLine(r,o)}}dashedLine(t,o){let r=o.dashOffset<0?o.hachureGap<0?4*o.strokeWidth:o.hachureGap:o.dashOffset,e=o.dashGap<0?o.hachureGap<0?4*o.strokeWidth:o.hachureGap:o.dashGap,a=[];return t.forEach(h=>{let s=Vt(h),c=Math.floor(s/(r+e)),i=(s+e-c*(r+e))/2,n=h[0],p=h[1];n[0]>p[0]&&(n=h[1],p=h[0]);let f=Math.atan((p[1]-n[1])/(p[0]-n[0]));for(let m=0;m<c;m++){let g=m*(r+e),d=g+r,y=[n[0]+g*Math.cos(f)+i*Math.cos(f),n[1]+g*Math.sin(f)+i*Math.sin(f)],x=[n[0]+d*Math.cos(f)+i*Math.cos(f),n[1]+d*Math.sin(f)+i*Math.sin(f)];a.push(...this.helper.doubleLineOps(y[0],y[1],x[0],x[1],o))}}),a}},oe=class{static{u(this,"l")}constructor(t){this.helper=t}fillPolygons(t,o){let r=o.hachureGap<0?4*o.strokeWidth:o.hachureGap,e=o.zigzagOffset<0?r:o.zigzagOffset,a=kt(t,o=Object.assign({},o,{hachureGap:r+e}));return{type:"fillSketch",ops:this.zigzagLines(a,e,o)}}zigzagLines(t,o,r){let e=[];return t.forEach(a=>{let h=Vt(a),s=Math.round(h/(2*o)),c=a[0],i=a[1];c[0]>i[0]&&(c=a[1],i=a[0]);let n=Math.atan((i[1]-c[1])/(i[0]-c[0]));for(let p=0;p<s;p++){let f=2*p*o,m=2*(p+1)*o,g=Math.sqrt(2*Math.pow(o,2)),d=[c[0]+f*Math.cos(n),c[1]+f*Math.sin(n)],y=[c[0]+m*Math.cos(n),c[1]+m*Math.sin(n)],x=[d[0]+g*Math.cos(n+Math.PI/4),d[1]+g*Math.sin(n+Math.PI/4)];e.push(...this.helper.doubleLineOps(d[0],d[1],x[0],x[1],r),...this.helper.doubleLineOps(x[0],x[1],y[0],y[1],r))}}),e}},et={},ae=class{static{u(this,"p")}constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Us=0,Ut=1,be=2,Gt={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Qt(l,t){return l.type===t}u(Qt,"k");function pe(l){let t=[],o=function(h){let s=new Array;for(;h!=="";)if(h.match(/^([ \t\r\n,]+)/))h=h.substr(RegExp.$1.length);else if(h.match(/^([aAcChHlLmMqQsStTvVzZ])/))s[s.length]={type:Us,text:RegExp.$1},h=h.substr(RegExp.$1.length);else{if(!h.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];s[s.length]={type:Ut,text:`${parseFloat(RegExp.$1)}`},h=h.substr(RegExp.$1.length)}return s[s.length]={type:be,text:""},s}(l),r="BOD",e=0,a=o[e];for(;!Qt(a,be);){let h=0,s=[];if(r==="BOD"){if(a.text!=="M"&&a.text!=="m")return pe("M0,0"+l);e++,h=Gt[a.text],r=a.text}else Qt(a,Ut)?h=Gt[r]:(e++,h=Gt[a.text],r=a.text);if(!(e+h<o.length))throw new Error("Path data ended short");for(let c=e;c<e+h;c++){let i=o[c];if(!Qt(i,Ut))throw new Error("Param not a number: "+r+","+i.text);s[s.length]=+i.text}if(typeof Gt[r]!="number")throw new Error("Bad segment: "+r);{let c={key:r,data:s};t.push(c),e+=h,a=o[e],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}u(pe,"b");function $e(l){let t=0,o=0,r=0,e=0,a=[];for(let{key:h,data:s}of l)switch(h){case"M":a.push({key:"M",data:[...s]}),[t,o]=s,[r,e]=s;break;case"m":t+=s[0],o+=s[1],a.push({key:"M",data:[t,o]}),r=t,e=o;break;case"L":a.push({key:"L",data:[...s]}),[t,o]=s;break;case"l":t+=s[0],o+=s[1],a.push({key:"L",data:[t,o]});break;case"C":a.push({key:"C",data:[...s]}),t=s[4],o=s[5];break;case"c":{let c=s.map((i,n)=>n%2?i+o:i+t);a.push({key:"C",data:c}),t=c[4],o=c[5];break}case"Q":a.push({key:"Q",data:[...s]}),t=s[2],o=s[3];break;case"q":{let c=s.map((i,n)=>n%2?i+o:i+t);a.push({key:"Q",data:c}),t=c[2],o=c[3];break}case"A":a.push({key:"A",data:[...s]}),t=s[5],o=s[6];break;case"a":t+=s[5],o+=s[6],a.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,o]});break;case"H":a.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],a.push({key:"H",data:[t]});break;case"V":a.push({key:"V",data:[...s]}),o=s[0];break;case"v":o+=s[0],a.push({key:"V",data:[o]});break;case"S":a.push({key:"S",data:[...s]}),t=s[2],o=s[3];break;case"s":{let c=s.map((i,n)=>n%2?i+o:i+t);a.push({key:"S",data:c}),t=c[2],o=c[3];break}case"T":a.push({key:"T",data:[...s]}),t=s[0],o=s[1];break;case"t":t+=s[0],o+=s[1],a.push({key:"T",data:[t,o]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=r,o=e}return a}u($e,"y");function Pe(l){let t=[],o="",r=0,e=0,a=0,h=0,s=0,c=0;for(let{key:i,data:n}of l){switch(i){case"M":t.push({key:"M",data:[...n]}),[r,e]=n,[a,h]=n;break;case"C":t.push({key:"C",data:[...n]}),r=n[4],e=n[5],s=n[2],c=n[3];break;case"L":t.push({key:"L",data:[...n]}),[r,e]=n;break;case"H":r=n[0],t.push({key:"L",data:[r,e]});break;case"V":e=n[0],t.push({key:"L",data:[r,e]});break;case"S":{let p=0,f=0;o==="C"||o==="S"?(p=r+(r-s),f=e+(e-c)):(p=r,f=e),t.push({key:"C",data:[p,f,...n]}),s=n[0],c=n[1],r=n[2],e=n[3];break}case"T":{let[p,f]=n,m=0,g=0;o==="Q"||o==="T"?(m=r+(r-s),g=e+(e-c)):(m=r,g=e);let d=r+2*(m-r)/3,y=e+2*(g-e)/3,x=p+2*(m-p)/3,b=f+2*(g-f)/3;t.push({key:"C",data:[d,y,x,b,p,f]}),s=m,c=g,r=p,e=f;break}case"Q":{let[p,f,m,g]=n,d=r+2*(p-r)/3,y=e+2*(f-e)/3,x=m+2*(p-m)/3,b=g+2*(f-g)/3;t.push({key:"C",data:[d,y,x,b,m,g]}),s=p,c=f,r=m,e=g;break}case"A":{let p=Math.abs(n[0]),f=Math.abs(n[1]),m=n[2],g=n[3],d=n[4],y=n[5],x=n[6];p===0||f===0?(t.push({key:"C",data:[r,e,y,x,y,x]}),r=y,e=x):(r!==y||e!==x)&&(Be(r,e,y,x,p,f,m,g,d).forEach(function(b){t.push({key:"C",data:b})}),r=y,e=x);break}case"Z":t.push({key:"Z",data:[]}),r=a,e=h}o=i}return t}u(Pe,"m");function vt(l,t,o){return[l*Math.cos(o)-t*Math.sin(o),l*Math.sin(o)+t*Math.cos(o)]}u(vt,"w");function Be(l,t,o,r,e,a,h,s,c,i){let n=(p=h,Math.PI*p/180);var p;let f=[],m=0,g=0,d=0,y=0;if(i)[m,g,d,y]=i;else{[l,t]=vt(l,t,-n),[o,r]=vt(o,r,-n);let A=(l-o)/2,L=(t-r)/2,H=A*A/(e*e)+L*L/(a*a);H>1&&(H=Math.sqrt(H),e*=H,a*=H);let O=e*e,F=a*a,W=O*F-O*L*L-F*A*A,q=O*L*L+F*A*A,Q=(s===c?-1:1)*Math.sqrt(Math.abs(W/q));d=Q*e*L/a+(l+o)/2,y=Q*-a*A/e+(t+r)/2,m=Math.asin(parseFloat(((t-y)/a).toFixed(9))),g=Math.asin(parseFloat(((r-y)/a).toFixed(9))),l<d&&(m=Math.PI-m),o<d&&(g=Math.PI-g),m<0&&(m=2*Math.PI+m),g<0&&(g=2*Math.PI+g),c&&m>g&&(m-=2*Math.PI),!c&&g>m&&(g-=2*Math.PI)}let x=g-m;if(Math.abs(x)>120*Math.PI/180){let A=g,L=o,H=r;g=c&&g>m?m+120*Math.PI/180*1:m+120*Math.PI/180*-1,f=Be(o=d+e*Math.cos(g),r=y+a*Math.sin(g),L,H,e,a,h,0,c,[g,A,d,y])}x=g-m;let b=Math.cos(m),S=Math.sin(m),$=Math.cos(g),w=Math.sin(g),P=Math.tan(x/4),B=4/3*e*P,R=4/3*a*P,j=[l,t],G=[l+B*S,t-R*b],E=[o+B*w,r-R*$],I=[o,r];if(G[0]=2*j[0]-G[0],G[1]=2*j[1]-G[1],i)return[G,E,I].concat(f);{f=[G,E,I].concat(f);let A=[];for(let L=0;L<f.length;L+=3){let H=vt(f[L][0],f[L][1],n),O=vt(f[L+1][0],f[L+1][1],n),F=vt(f[L+2][0],f[L+2][1],n);A.push([H[0],H[1],O[0],O[1],F[0],F[1]])}return A}}u(Be,"x");var Qs={randOffset:u(function(l,t){return _(l,t)},"randOffset"),randOffsetWithRange:u(function(l,t,o){return Lt(l,t,o)},"randOffsetWithRange"),ellipse:u(function(l,t,o,r,e){let a=Ce(o,r,e);return ie(l,t,e,a).opset},"ellipse"),doubleLineOps:u(function(l,t,o,r,e){return ft(l,t,o,r,e,!0)},"doubleLineOps")};function Te(l,t,o,r,e){return{type:"path",ops:ft(l,t,o,r,e)}}u(Te,"v");function At(l,t,o){let r=(l||[]).length;if(r>2){let e=[];for(let a=0;a<r-1;a++)e.push(...ft(l[a][0],l[a][1],l[a+1][0],l[a+1][1],o));return t&&e.push(...ft(l[r-1][0],l[r-1][1],l[0][0],l[0][1],o)),{type:"path",ops:e}}return r===2?Te(l[0][0],l[0][1],l[1][0],l[1][1],o):{type:"path",ops:[]}}u(At,"S");function Js(l,t,o,r,e){return function(a,h){return At(a,!0,h)}([[l,t],[l+o,t],[l+o,t+r],[l,t+r]],e)}u(Js,"O");function Se(l,t){if(l.length){let o=typeof l[0][0]=="number"?[l]:l,r=Et(o[0],1*(1+.2*t.roughness),t),e=t.disableMultiStroke?[]:Et(o[0],1.5*(1+.22*t.roughness),ve(t));for(let a=1;a<o.length;a++){let h=o[a];if(h.length){let s=Et(h,1*(1+.2*t.roughness),t),c=t.disableMultiStroke?[]:Et(h,1.5*(1+.22*t.roughness),ve(t));for(let i of s)i.op!=="move"&&r.push(i);for(let i of c)i.op!=="move"&&e.push(i)}}return{type:"path",ops:r.concat(e)}}return{type:"path",ops:[]}}u(Se,"L");function Ce(l,t,o){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(l/2,2)+Math.pow(t/2,2))/2)),e=Math.ceil(Math.max(o.curveStepCount,o.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/e,h=Math.abs(l/2),s=Math.abs(t/2),c=1-o.curveFitting;return h+=_(h*c,o),s+=_(s*c,o),{increment:a,rx:h,ry:s}}u(Ce,"T");function ie(l,t,o,r){let[e,a]=De(r.increment,l,t,r.rx,r.ry,1,r.increment*Lt(.1,Lt(.4,1,o),o),o),h=Ht(e,null,o);if(!o.disableMultiStroke&&o.roughness!==0){let[s]=De(r.increment,l,t,r.rx,r.ry,1.5,0,o),c=Ht(s,null,o);h=h.concat(c)}return{estimatedPoints:a,opset:{type:"path",ops:h}}}u(ie,"D");function we(l,t,o,r,e,a,h,s,c){let i=l,n=t,p=Math.abs(o/2),f=Math.abs(r/2);p+=_(.01*p,c),f+=_(.01*f,c);let m=e,g=a;for(;m<0;)m+=2*Math.PI,g+=2*Math.PI;g-m>2*Math.PI&&(m=0,g=2*Math.PI);let d=2*Math.PI/c.curveStepCount,y=Math.min(d/2,(g-m)/2),x=Me(y,i,n,p,f,m,g,1,c);if(!c.disableMultiStroke){let b=Me(y,i,n,p,f,m,g,1.5,c);x.push(...b)}return h&&(s?x.push(...ft(i,n,i+p*Math.cos(m),n+f*Math.sin(m),c),...ft(i,n,i+p*Math.cos(g),n+f*Math.sin(g),c)):x.push({op:"lineTo",data:[i,n]},{op:"lineTo",data:[i+p*Math.cos(m),n+f*Math.sin(m)]})),{type:"path",ops:x}}u(we,"A");function Ne(l,t){let o=Pe($e(pe(l))),r=[],e=[0,0],a=[0,0];for(let{key:h,data:s}of o)switch(h){case"M":a=[s[0],s[1]],e=[s[0],s[1]];break;case"L":r.push(...ft(a[0],a[1],s[0],s[1],t)),a=[s[0],s[1]];break;case"C":{let[c,i,n,p,f,m]=s;r.push(...Ks(c,i,n,p,f,m,a,t)),a=[f,m];break}case"Z":r.push(...ft(a[0],a[1],e[0],e[1],t)),a=[e[0],e[1]]}return{type:"path",ops:r}}u(Ne,"_");function Jt(l,t){let o=[];for(let r of l)if(r.length){let e=t.maxRandomnessOffset||0,a=r.length;if(a>2){o.push({op:"move",data:[r[0][0]+_(e,t),r[0][1]+_(e,t)]});for(let h=1;h<a;h++)o.push({op:"lineTo",data:[r[h][0]+_(e,t),r[h][1]+_(e,t)]})}}return{type:"fillPath",ops:o}}u(Jt,"I");function bt(l,t){return function(o,r){let e=o.fillStyle||"hachure";if(!et[e])switch(e){case"zigzag":et[e]||(et[e]=new te(r));break;case"cross-hatch":et[e]||(et[e]=new ee(r));break;case"dots":et[e]||(et[e]=new se(r));break;case"dashed":et[e]||(et[e]=new re(r));break;case"zigzag-line":et[e]||(et[e]=new oe(r));break;default:e="hachure",et[e]||(et[e]=new Mt(r))}return et[e]}(t,Qs).fillPolygons(l,t)}u(bt,"C");function ve(l){let t=Object.assign({},l);return t.randomizer=void 0,l.seed&&(t.seed=l.seed+1),t}u(ve,"z");function Re(l){return l.randomizer||(l.randomizer=new ae(l.seed||0)),l.randomizer.next()}u(Re,"W");function Lt(l,t,o,r=1){return o.roughness*r*(Re(o)*(t-l)+l)}u(Lt,"E");function _(l,t,o=1){return Lt(-l,l,t,o)}u(_,"G");function ft(l,t,o,r,e,a=!1){let h=a?e.disableMultiStrokeFill:e.disableMultiStroke,s=ne(l,t,o,r,e,!0,!1);if(h)return s;let c=ne(l,t,o,r,e,!0,!0);return s.concat(c)}u(ft,"$");function ne(l,t,o,r,e,a,h){let s=Math.pow(l-o,2)+Math.pow(t-r,2),c=Math.sqrt(s),i=1;i=c<200?1:c>500?.4:-.0016668*c+1.233334;let n=e.maxRandomnessOffset||0;n*n*100>s&&(n=c/10);let p=n/2,f=.2+.2*Re(e),m=e.bowing*e.maxRandomnessOffset*(r-t)/200,g=e.bowing*e.maxRandomnessOffset*(l-o)/200;m=_(m,e,i),g=_(g,e,i);let d=[],y=u(()=>_(p,e,i),"M"),x=u(()=>_(n,e,i),"k"),b=e.preserveVertices;return a&&(h?d.push({op:"move",data:[l+(b?0:y()),t+(b?0:y())]}):d.push({op:"move",data:[l+(b?0:_(n,e,i)),t+(b?0:_(n,e,i))]})),h?d.push({op:"bcurveTo",data:[m+l+(o-l)*f+y(),g+t+(r-t)*f+y(),m+l+2*(o-l)*f+y(),g+t+2*(r-t)*f+y(),o+(b?0:y()),r+(b?0:y())]}):d.push({op:"bcurveTo",data:[m+l+(o-l)*f+x(),g+t+(r-t)*f+x(),m+l+2*(o-l)*f+x(),g+t+2*(r-t)*f+x(),o+(b?0:x()),r+(b?0:x())]}),d}u(ne,"R");function Et(l,t,o){if(!l.length)return[];let r=[];r.push([l[0][0]+_(t,o),l[0][1]+_(t,o)]),r.push([l[0][0]+_(t,o),l[0][1]+_(t,o)]);for(let e=1;e<l.length;e++)r.push([l[e][0]+_(t,o),l[e][1]+_(t,o)]),e===l.length-1&&r.push([l[e][0]+_(t,o),l[e][1]+_(t,o)]);return Ht(r,null,o)}u(Et,"j");function Ht(l,t,o){let r=l.length,e=[];if(r>3){let a=[],h=1-o.curveTightness;e.push({op:"move",data:[l[1][0],l[1][1]]});for(let s=1;s+2<r;s++){let c=l[s];a[0]=[c[0],c[1]],a[1]=[c[0]+(h*l[s+1][0]-h*l[s-1][0])/6,c[1]+(h*l[s+1][1]-h*l[s-1][1])/6],a[2]=[l[s+1][0]+(h*l[s][0]-h*l[s+2][0])/6,l[s+1][1]+(h*l[s][1]-h*l[s+2][1])/6],a[3]=[l[s+1][0],l[s+1][1]],e.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let s=o.maxRandomnessOffset;e.push({op:"lineTo",data:[t[0]+_(s,o),t[1]+_(s,o)]})}}else r===3?(e.push({op:"move",data:[l[1][0],l[1][1]]}),e.push({op:"bcurveTo",data:[l[1][0],l[1][1],l[2][0],l[2][1],l[2][0],l[2][1]]})):r===2&&e.push(...ne(l[0][0],l[0][1],l[1][0],l[1][1],o,!0,!0));return e}u(Ht,"q");function De(l,t,o,r,e,a,h,s){let c=[],i=[];if(s.roughness===0){l/=4,i.push([t+r*Math.cos(-l),o+e*Math.sin(-l)]);for(let n=0;n<=2*Math.PI;n+=l){let p=[t+r*Math.cos(n),o+e*Math.sin(n)];c.push(p),i.push(p)}i.push([t+r*Math.cos(0),o+e*Math.sin(0)]),i.push([t+r*Math.cos(l),o+e*Math.sin(l)])}else{let n=_(.5,s)-Math.PI/2;i.push([_(a,s)+t+.9*r*Math.cos(n-l),_(a,s)+o+.9*e*Math.sin(n-l)]);let p=2*Math.PI+n-.01;for(let f=n;f<p;f+=l){let m=[_(a,s)+t+r*Math.cos(f),_(a,s)+o+e*Math.sin(f)];c.push(m),i.push(m)}i.push([_(a,s)+t+r*Math.cos(n+2*Math.PI+.5*h),_(a,s)+o+e*Math.sin(n+2*Math.PI+.5*h)]),i.push([_(a,s)+t+.98*r*Math.cos(n+h),_(a,s)+o+.98*e*Math.sin(n+h)]),i.push([_(a,s)+t+.9*r*Math.cos(n+.5*h),_(a,s)+o+.9*e*Math.sin(n+.5*h)])}return[i,c]}u(De,"F");function Me(l,t,o,r,e,a,h,s,c){let i=a+_(.1,c),n=[];n.push([_(s,c)+t+.9*r*Math.cos(i-l),_(s,c)+o+.9*e*Math.sin(i-l)]);for(let p=i;p<=h;p+=l)n.push([_(s,c)+t+r*Math.cos(p),_(s,c)+o+e*Math.sin(p)]);return n.push([t+r*Math.cos(h),o+e*Math.sin(h)]),n.push([t+r*Math.cos(h),o+e*Math.sin(h)]),Ht(n,null,c)}u(Me,"V");function Ks(l,t,o,r,e,a,h,s){let c=[],i=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],n=[0,0],p=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let m=0;m<p;m++)m===0?c.push({op:"move",data:[h[0],h[1]]}):c.push({op:"move",data:[h[0]+(f?0:_(i[0],s)),h[1]+(f?0:_(i[0],s))]}),n=f?[e,a]:[e+_(i[m],s),a+_(i[m],s)],c.push({op:"bcurveTo",data:[l+_(i[m],s),t+_(i[m],s),o+_(i[m],s),r+_(i[m],s),n[0],n[1]]});return c}u(Ks,"Z");function Dt(l){return[...l]}u(Dt,"Q");function ke(l,t=0){let o=l.length;if(o<3)throw new Error("A curve must have at least three points.");let r=[];if(o===3)r.push(Dt(l[0]),Dt(l[1]),Dt(l[2]),Dt(l[2]));else{let e=[];e.push(l[0],l[0]);for(let s=1;s<l.length;s++)e.push(l[s]),s===l.length-1&&e.push(l[s]);let a=[],h=1-t;r.push(Dt(e[0]));for(let s=1;s+2<e.length;s++){let c=e[s];a[0]=[c[0],c[1]],a[1]=[c[0]+(h*e[s+1][0]-h*e[s-1][0])/6,c[1]+(h*e[s+1][1]-h*e[s-1][1])/6],a[2]=[e[s+1][0]+(h*e[s][0]-h*e[s+2][0])/6,e[s+1][1]+(h*e[s][1]-h*e[s+2][1])/6],a[3]=[e[s+1][0],e[s+1][1]],r.push(a[1],a[2],a[3])}}return r}u(ke,"H");function Ot(l,t){return Math.pow(l[0]-t[0],2)+Math.pow(l[1]-t[1],2)}u(Ot,"N");function tr(l,t,o){let r=Ot(t,o);if(r===0)return Ot(l,t);let e=((l[0]-t[0])*(o[0]-t[0])+(l[1]-t[1])*(o[1]-t[1]))/r;return e=Math.max(0,Math.min(1,e)),Ot(l,xt(t,o,e))}u(tr,"B");function xt(l,t,o){return[l[0]+(t[0]-l[0])*o,l[1]+(t[1]-l[1])*o]}u(xt,"J");function le(l,t,o,r){let e=r||[];if(function(s,c){let i=s[c+0],n=s[c+1],p=s[c+2],f=s[c+3],m=3*n[0]-2*i[0]-f[0];m*=m;let g=3*n[1]-2*i[1]-f[1];g*=g;let d=3*p[0]-2*f[0]-i[0];d*=d;let y=3*p[1]-2*f[1]-i[1];return y*=y,m<d&&(m=d),g<y&&(g=y),m+g}(l,t)<o){let s=l[t+0];e.length?(a=e[e.length-1],h=s,Math.sqrt(Ot(a,h))>1&&e.push(s)):e.push(s),e.push(l[t+3])}else{let c=l[t+0],i=l[t+1],n=l[t+2],p=l[t+3],f=xt(c,i,.5),m=xt(i,n,.5),g=xt(n,p,.5),d=xt(f,m,.5),y=xt(m,g,.5),x=xt(d,y,.5);le([c,f,d,x],0,o,e),le([x,y,g,p],0,o,e)}var a,h;return e}u(le,"K");function er(l,t){return Wt(l,0,l.length,t)}u(er,"U");function Wt(l,t,o,r,e){let a=e||[],h=l[t],s=l[o-1],c=0,i=1;for(let n=t+1;n<o-1;++n){let p=tr(l[n],h,s);p>c&&(c=p,i=n)}return Math.sqrt(c)>r?(Wt(l,t,i+1,r,a),Wt(l,i,o,r,a)):(a.length||a.push(h),a.push(s)),a}u(Wt,"X");function Kt(l,t=.15,o){let r=[],e=(l.length-1)/3;for(let a=0;a<e;a++)le(l,3*a,t,r);return o&&o>0?Wt(r,0,r.length,o):r}u(Kt,"Y");var st="none",St=class{static{u(this,"et")}constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,o,r){return{shape:t,sets:o||[],options:r||this.defaultOptions}}line(t,o,r,e,a){let h=this._o(a);return this._d("line",[Te(t,o,r,e,h)],h)}rectangle(t,o,r,e,a){let h=this._o(a),s=[],c=Js(t,o,r,e,h);if(h.fill){let i=[[t,o],[t+r,o],[t+r,o+e],[t,o+e]];h.fillStyle==="solid"?s.push(Jt([i],h)):s.push(bt([i],h))}return h.stroke!==st&&s.push(c),this._d("rectangle",s,h)}ellipse(t,o,r,e,a){let h=this._o(a),s=[],c=Ce(r,e,h),i=ie(t,o,h,c);if(h.fill)if(h.fillStyle==="solid"){let n=ie(t,o,h,c).opset;n.type="fillPath",s.push(n)}else s.push(bt([i.estimatedPoints],h));return h.stroke!==st&&s.push(i.opset),this._d("ellipse",s,h)}circle(t,o,r,e){let a=this.ellipse(t,o,r,r,e);return a.shape="circle",a}linearPath(t,o){let r=this._o(o);return this._d("linearPath",[At(t,!1,r)],r)}arc(t,o,r,e,a,h,s=!1,c){let i=this._o(c),n=[],p=we(t,o,r,e,a,h,s,!0,i);if(s&&i.fill)if(i.fillStyle==="solid"){let f=Object.assign({},i);f.disableMultiStroke=!0;let m=we(t,o,r,e,a,h,!0,!1,f);m.type="fillPath",n.push(m)}else n.push(function(f,m,g,d,y,x,b){let S=f,$=m,w=Math.abs(g/2),P=Math.abs(d/2);w+=_(.01*w,b),P+=_(.01*P,b);let B=y,R=x;for(;B<0;)B+=2*Math.PI,R+=2*Math.PI;R-B>2*Math.PI&&(B=0,R=2*Math.PI);let j=(R-B)/b.curveStepCount,G=[];for(let E=B;E<=R;E+=j)G.push([S+w*Math.cos(E),$+P*Math.sin(E)]);return G.push([S+w*Math.cos(R),$+P*Math.sin(R)]),G.push([S,$]),bt([G],b)}(t,o,r,e,a,h,i));return i.stroke!==st&&n.push(p),this._d("arc",n,i)}curve(t,o){let r=this._o(o),e=[],a=Se(t,r);if(r.fill&&r.fill!==st)if(r.fillStyle==="solid"){let h=Se(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));e.push({type:"fillPath",ops:this._mergedShape(h.ops)})}else{let h=[],s=t;if(s.length){let c=typeof s[0][0]=="number"?[s]:s;for(let i of c)i.length<3?h.push(...i):i.length===3?h.push(...Kt(ke([i[0],i[0],i[1],i[2]]),10,(1+r.roughness)/2)):h.push(...Kt(ke(i),10,(1+r.roughness)/2))}h.length&&e.push(bt([h],r))}return r.stroke!==st&&e.push(a),this._d("curve",e,r)}polygon(t,o){let r=this._o(o),e=[],a=At(t,!0,r);return r.fill&&(r.fillStyle==="solid"?e.push(Jt([t],r)):e.push(bt([t],r))),r.stroke!==st&&e.push(a),this._d("polygon",e,r)}path(t,o){let r=this._o(o),e=[];if(!t)return this._d("path",e,r);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=r.fill&&r.fill!=="transparent"&&r.fill!==st,h=r.stroke!==st,s=!!(r.simplification&&r.simplification<1),c=function(n,p,f){let m=Pe($e(pe(n))),g=[],d=[],y=[0,0],x=[],b=u(()=>{x.length>=4&&d.push(...Kt(x,p)),x=[]},"i"),S=u(()=>{b(),d.length&&(g.push(d),d=[])},"c");for(let{key:w,data:P}of m)switch(w){case"M":S(),y=[P[0],P[1]],d.push(y);break;case"L":b(),d.push([P[0],P[1]]);break;case"C":if(!x.length){let B=d.length?d[d.length-1]:y;x.push([B[0],B[1]])}x.push([P[0],P[1]]),x.push([P[2],P[3]]),x.push([P[4],P[5]]);break;case"Z":b(),d.push([y[0],y[1]])}if(S(),!f)return g;let $=[];for(let w of g){let P=er(w,f);P.length&&$.push(P)}return $}(t,1,s?4-4*(r.simplification||1):(1+r.roughness)/2),i=Ne(t,r);if(a)if(r.fillStyle==="solid")if(c.length===1){let n=Ne(t,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));e.push({type:"fillPath",ops:this._mergedShape(n.ops)})}else e.push(Jt(c,r));else e.push(bt(c,r));return h&&(s?c.forEach(n=>{e.push(At(n,!1,r))}):e.push(i)),this._d("path",e,r)}opsToPath(t,o){let r="";for(let e of t.ops){let a=typeof o=="number"&&o>=0?e.data.map(h=>+h.toFixed(o)):e.data;switch(e.op){case"move":r+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":r+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":r+=`L${a[0]} ${a[1]} `}}return r.trim()}toPaths(t){let o=t.sets||[],r=t.options||this.defaultOptions,e=[];for(let a of o){let h=null;switch(a.type){case"path":h={d:this.opsToPath(a),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:st};break;case"fillPath":h={d:this.opsToPath(a),stroke:st,strokeWidth:0,fill:r.fill||st};break;case"fillSketch":h=this.fillSketch(a,r)}h&&e.push(h)}return e}fillSketch(t,o){let r=o.fillWeight;return r<0&&(r=o.strokeWidth/2),{d:this.opsToPath(t),stroke:o.fill||st,strokeWidth:r,fill:st}}_mergedShape(t){return t.filter((o,r)=>r===0||o.op!=="move")}},ce=class{static{u(this,"st")}constructor(t,o){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new St(o)}draw(t){let o=t.sets||[],r=t.options||this.getDefaultOptions(),e=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let h of o)switch(h.type){case"path":e.save(),e.strokeStyle=r.stroke==="none"?"transparent":r.stroke,e.lineWidth=r.strokeWidth,r.strokeLineDash&&e.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(e.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(e,h,a),e.restore();break;case"fillPath":{e.save(),e.fillStyle=r.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(e,h,a,s),e.restore();break}case"fillSketch":this.fillSketch(e,h,r)}}fillSketch(t,o,r){let e=r.fillWeight;e<0&&(e=r.strokeWidth/2),t.save(),r.fillLineDash&&t.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(t.lineDashOffset=r.fillLineDashOffset),t.strokeStyle=r.fill||"",t.lineWidth=e,this._drawToContext(t,o,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,o,r,e="nonzero"){t.beginPath();for(let a of o.ops){let h=typeof r=="number"&&r>=0?a.data.map(s=>+s.toFixed(r)):a.data;switch(a.op){case"move":t.moveTo(h[0],h[1]);break;case"bcurveTo":t.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]);break;case"lineTo":t.lineTo(h[0],h[1])}}o.type==="fillPath"?t.fill(e):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,o,r,e,a){let h=this.gen.line(t,o,r,e,a);return this.draw(h),h}rectangle(t,o,r,e,a){let h=this.gen.rectangle(t,o,r,e,a);return this.draw(h),h}ellipse(t,o,r,e,a){let h=this.gen.ellipse(t,o,r,e,a);return this.draw(h),h}circle(t,o,r,e){let a=this.gen.circle(t,o,r,e);return this.draw(a),a}linearPath(t,o){let r=this.gen.linearPath(t,o);return this.draw(r),r}polygon(t,o){let r=this.gen.polygon(t,o);return this.draw(r),r}arc(t,o,r,e,a,h,s=!1,c){let i=this.gen.arc(t,o,r,e,a,h,s,c);return this.draw(i),i}curve(t,o){let r=this.gen.curve(t,o);return this.draw(r),r}path(t,o){let r=this.gen.path(t,o);return this.draw(r),r}},jt="http://www.w3.org/2000/svg",he=class{static{u(this,"ot")}constructor(t,o){this.svg=t,this.gen=new St(o)}draw(t){let o=t.sets||[],r=t.options||this.getDefaultOptions(),e=this.svg.ownerDocument||window.document,a=e.createElementNS(jt,"g"),h=t.options.fixedDecimalPlaceDigits;for(let s of o){let c=null;switch(s.type){case"path":c=e.createElementNS(jt,"path"),c.setAttribute("d",this.opsToPath(s,h)),c.setAttribute("stroke",r.stroke),c.setAttribute("stroke-width",r.strokeWidth+""),c.setAttribute("fill","none"),r.strokeLineDash&&c.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":c=e.createElementNS(jt,"path"),c.setAttribute("d",this.opsToPath(s,h)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||c.setAttribute("fill-rule","evenodd");break;case"fillSketch":c=this.fillSketch(e,s,r)}c&&a.appendChild(c)}return a}fillSketch(t,o,r){let e=r.fillWeight;e<0&&(e=r.strokeWidth/2);let a=t.createElementNS(jt,"path");return a.setAttribute("d",this.opsToPath(o,r.fixedDecimalPlaceDigits)),a.setAttribute("stroke",r.fill||""),a.setAttribute("stroke-width",e+""),a.setAttribute("fill","none"),r.fillLineDash&&a.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,o){return this.gen.opsToPath(t,o)}line(t,o,r,e,a){let h=this.gen.line(t,o,r,e,a);return this.draw(h)}rectangle(t,o,r,e,a){let h=this.gen.rectangle(t,o,r,e,a);return this.draw(h)}ellipse(t,o,r,e,a){let h=this.gen.ellipse(t,o,r,e,a);return this.draw(h)}circle(t,o,r,e){let a=this.gen.circle(t,o,r,e);return this.draw(a)}linearPath(t,o){let r=this.gen.linearPath(t,o);return this.draw(r)}polygon(t,o){let r=this.gen.polygon(t,o);return this.draw(r)}arc(t,o,r,e,a,h,s=!1,c){let i=this.gen.arc(t,o,r,e,a,h,s,c);return this.draw(i)}curve(t,o){let r=this.gen.curve(t,o);return this.draw(r)}path(t,o){let r=this.gen.path(t,o);return this.draw(r)}},v={canvas:u((l,t)=>new ce(l,t),"canvas"),svg:u((l,t)=>new he(l,t),"svg"),generator:u(l=>new St(l),"generator"),newSeed:u(()=>St.newSeed(),"newSeed")};var sr=u((l,t)=>{var o=l.x,r=l.y,e=t.x-o,a=t.y-r,h=l.width/2,s=l.height/2,c,i;return Math.abs(a)*h>Math.abs(e)*s?(a<0&&(s=-s),c=a===0?0:s*e/a,i=s):(e<0&&(h=-h),c=h,i=e===0?0:h*a/e),{x:o+c,y:r+i}},"intersectRect"),gt=sr;function rr(l,t){t&&l.attr("style",t)}u(rr,"applyStyle");async function or(l){let t=Y(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),o=t.append("xhtml:div"),r=l.label;l.label&&Bt(l.label)&&(r=await ue(l.label.replace(ye.lineBreakRegex,`
`),X()));let e=l.isNode?"nodeLabel":"edgeLabel";return o.html('<span class="'+e+'" '+(l.labelStyle?'style="'+l.labelStyle+'"':"")+">"+r+"</span>"),rr(o,l.labelStyle),o.style("display","inline-block"),o.style("padding-right","1px"),o.style("white-space","nowrap"),o.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}u(or,"addHtmlLabel");var ar=u(async(l,t,o,r)=>{let e=l||"";if(typeof e=="object"&&(e=e[0]),U(X().flowchart.htmlLabels)){e=e.replace(/\\n|\n/g,"<br />"),z.info("vertexText"+e);let a={isNode:r,label:lt(e).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await or(a)}else{let a=document.createElementNS("http://www.w3.org/2000/svg","text");a.setAttribute("style",t.replace("color:","fill:"));let h=[];typeof e=="string"?h=e.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(e)?h=e:h=[];for(let s of h){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"),o?c.setAttribute("class","title-row"):c.setAttribute("class","row"),c.textContent=s.trim(),a.appendChild(c)}return a}},"createLabel"),$t=ar;var J=u((l,t,o,r,e)=>["M",l+e,t,"H",l+o-e,"A",e,e,0,0,1,l+o,t+e,"V",t+r-e,"A",e,e,0,0,1,l+o-e,t+r,"H",l+e,"A",e,e,0,0,1,l,t+r-e,"V",t+e,"A",e,e,0,0,1,l+e,t,"Z"].join(" "),"createRoundedRectPathD");var Ge=u(l=>{let{handDrawnSeed:t}=X();return{fill:l,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:l,seed:t}},"solidStateFill"),nt=u(l=>{let t=ir([...l.cssCompiledStyles||[],...l.cssStyles||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),ir=u(l=>{let t=new Map;return l.forEach(o=>{let[r,e]=o.split(":");t.set(r.trim(),e?.trim())}),t},"styles2Map"),nr=u(l=>l==="color"||l==="font-size"||l==="font-family"||l==="font-weight"||l==="font-style"||l==="text-decoration"||l==="text-align"||l==="text-transform"||l==="line-height"||l==="letter-spacing"||l==="word-spacing"||l==="text-shadow"||l==="text-overflow"||l==="white-space"||l==="word-wrap"||l==="word-break"||l==="overflow-wrap"||l==="hyphens","isLabelStyle"),k=u(l=>{let{stylesArray:t}=nt(l),o=[],r=[],e=[],a=[];return t.forEach(h=>{let s=h[0];nr(s)?o.push(h.join(":")+" !important"):(r.push(h.join(":")+" !important"),s.includes("stroke")&&e.push(h.join(":")+" !important"),s==="fill"&&a.push(h.join(":")+" !important"))}),{labelStyles:o.join(";"),nodeStyles:r.join(";"),stylesArray:t,borderStyles:e,backgroundStyles:a}},"styles2String"),D=u((l,t)=>{let{themeVariables:o,handDrawnSeed:r}=X(),{nodeBorder:e,mainBkg:a}=o,{stylesMap:h}=nt(l);return Object.assign({roughness:.7,fill:h.get("fill")||a,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:h.get("stroke")||e,seed:r,strokeWidth:h.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0]},t)},"userNodeOverrides");var Ee=u(async(l,t)=>{z.info("Creating subgraph rect for ",t.id,t);let o=X(),{themeVariables:r,handDrawnSeed:e}=o,{clusterBkg:a,clusterBorder:h}=r,{labelStyles:s,nodeStyles:c,borderStyles:i,backgroundStyles:n}=k(t),p=l.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=U(o.flowchart.htmlLabels),m=p.insert("g").attr("class","cluster-label "),g=await ot(m,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),d=g.getBBox();if(U(o.flowchart.htmlLabels)){let B=g.children[0],R=Y(g);d=B.getBoundingClientRect(),R.attr("width",d.width),R.attr("height",d.height)}let y=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height,b=t.x-y/2,S=t.y-x/2;z.trace("Data ",t,JSON.stringify(t));let $;if(t.look==="handDrawn"){let B=v.svg(p),R=D(t,{roughness:.7,fill:a,stroke:h,fillWeight:3,seed:e}),j=B.path(J(b,S,y,x,0),R);$=p.insert(()=>(z.debug("Rough node insert CXC",j),j),":first-child"),$.select("path:nth-child(2)").attr("style",i.join(";")),$.select("path").attr("style",n.join(";").replace("fill","stroke"))}else $=p.insert("rect",":first-child"),$.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",S).attr("width",y).attr("height",x);let{subGraphTitleTopMargin:w}=Yt(o);if(m.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+w})`),s){let B=m.select("span");B&&B.attr("style",s)}let P=$.node().getBBox();return t.offsetX=0,t.width=P.width,t.height=P.height,t.offsetY=d.height-t.padding/2,t.intersect=function(B){return gt(t,B)},{cluster:p,labelBBox:d}},"rect"),lr=u((l,t)=>{let o=l.insert("g").attr("class","note-cluster").attr("id",t.id),r=o.insert("rect",":first-child"),e=0*t.padding,a=e/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+e).attr("height",t.height+e).attr("fill","none");let h=r.node().getBBox();return t.width=h.width,t.height=h.height,t.intersect=function(s){return gt(t,s)},{cluster:o,labelBBox:{width:0,height:0}}},"noteGroup"),cr=u(async(l,t)=>{let o=X(),{themeVariables:r,handDrawnSeed:e}=o,{altBackground:a,compositeBackground:h,compositeTitleBackground:s,nodeBorder:c}=r,i=l.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),n=i.insert("g",":first-child"),p=i.insert("g").attr("class","cluster-label"),f=i.append("rect"),m=p.node().appendChild(await $t(t.label,t.labelStyle,void 0,!0)),g=m.getBBox();if(U(o.flowchart.htmlLabels)){let j=m.children[0],G=Y(m);g=j.getBoundingClientRect(),G.attr("width",g.width),G.attr("height",g.height)}let d=0*t.padding,y=d/2,x=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+d;t.width<=g.width+t.padding?t.diff=(x-t.width)/2-t.padding:t.diff=-t.padding;let b=t.height+d,S=t.height+d-g.height-6,$=t.x-x/2,w=t.y-b/2;t.width=x;let P=t.y-t.height/2-y+g.height+2,B;if(t.look==="handDrawn"){let j=t.cssClasses.includes("statediagram-cluster-alt"),G=v.svg(i),E=t.rx||t.ry?G.path(J($,w,x,b,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:c,seed:e}):G.rectangle($,w,x,b,{seed:e});B=i.insert(()=>E,":first-child");let I=G.rectangle($,P,x,S,{fill:j?a:h,fillStyle:j?"hachure":"solid",stroke:c,seed:e});B=i.insert(()=>E,":first-child"),f=i.insert(()=>I)}else B=n.insert("rect",":first-child"),B.attr("class","outer").attr("x",$).attr("y",w).attr("width",x).attr("height",b).attr("data-look",t.look),f.attr("class","inner").attr("x",$).attr("y",P).attr("width",x).attr("height",S);p.attr("transform",`translate(${t.x-g.width/2}, ${w+1-(U(o.flowchart.htmlLabels)?0:3)})`);let R=B.node().getBBox();return t.height=R.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(j){return gt(t,j)},{cluster:i,labelBBox:g}},"roundedWithTitle"),hr=u(async(l,t)=>{z.info("Creating subgraph rect for ",t.id,t);let o=X(),{themeVariables:r,handDrawnSeed:e}=o,{clusterBkg:a,clusterBorder:h}=r,{labelStyles:s,nodeStyles:c,borderStyles:i,backgroundStyles:n}=k(t),p=l.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=U(o.flowchart.htmlLabels),m=p.insert("g").attr("class","cluster-label "),g=await ot(m,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width}),d=g.getBBox();if(U(o.flowchart.htmlLabels)){let B=g.children[0],R=Y(g);d=B.getBoundingClientRect(),R.attr("width",d.width),R.attr("height",d.height)}let y=t.width<=d.width+t.padding?d.width+t.padding:t.width;t.width<=d.width+t.padding?t.diff=(y-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height,b=t.x-y/2,S=t.y-x/2;z.trace("Data ",t,JSON.stringify(t));let $;if(t.look==="handDrawn"){let B=v.svg(p),R=D(t,{roughness:.7,fill:a,stroke:h,fillWeight:4,seed:e}),j=B.path(J(b,S,y,x,t.rx),R);$=p.insert(()=>(z.debug("Rough node insert CXC",j),j),":first-child"),$.select("path:nth-child(2)").attr("style",i.join(";")),$.select("path").attr("style",n.join(";").replace("fill","stroke"))}else $=p.insert("rect",":first-child"),$.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",S).attr("width",y).attr("height",x);let{subGraphTitleTopMargin:w}=Yt(o);if(m.attr("transform",`translate(${t.x-d.width/2}, ${t.y-t.height/2+w})`),s){let B=m.select("span");B&&B.attr("style",s)}let P=$.node().getBBox();return t.offsetX=0,t.width=P.width,t.height=P.height,t.offsetY=d.height-t.padding/2,t.intersect=function(B){return gt(t,B)},{cluster:p,labelBBox:d}},"kanbanSection"),pr=u((l,t)=>{let o=X(),{themeVariables:r,handDrawnSeed:e}=o,{nodeBorder:a}=r,h=l.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),s=h.insert("g",":first-child"),c=0*t.padding,i=t.width+c;t.diff=-t.padding;let n=t.height+c,p=t.x-i/2,f=t.y-n/2;t.width=i;let m;if(t.look==="handDrawn"){let y=v.svg(h).rectangle(p,f,i,n,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:a,seed:e});m=h.insert(()=>y,":first-child")}else m=s.insert("rect",":first-child"),m.attr("class","divider").attr("x",p).attr("y",f).attr("width",i).attr("height",n).attr("data-look",t.look);let g=m.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(d){return gt(t,d)},{cluster:h,labelBBox:{}}},"divider"),mr=Ee,fr={rect:Ee,squareRect:mr,roundedWithTitle:cr,noteGroup:lr,divider:pr,kanbanSection:hr},je=new Map,yo=u(async(l,t)=>{let o=t.shape||"rect",r=await fr[o](l,t);return je.set(t.id,r),r},"insertCluster");var xo=u(()=>{je=new Map},"clear");function gr(l,t){return l.intersect(t)}u(gr,"intersectNode");var Ae=gr;function dr(l,t,o,r){var e=l.x,a=l.y,h=e-r.x,s=a-r.y,c=Math.sqrt(t*t*s*s+o*o*h*h),i=Math.abs(t*o*h/c);r.x<e&&(i=-i);var n=Math.abs(t*o*s/c);return r.y<a&&(n=-n),{x:e+i,y:a+n}}u(dr,"intersectEllipse");var It=dr;function ur(l,t,o){return It(l,t,t,o)}u(ur,"intersectCircle");var Oe=ur;function yr(l,t,o,r){var e,a,h,s,c,i,n,p,f,m,g,d,y,x,b;if(e=t.y-l.y,h=l.x-t.x,c=t.x*l.y-l.x*t.y,f=e*o.x+h*o.y+c,m=e*r.x+h*r.y+c,!(f!==0&&m!==0&&Le(f,m))&&(a=r.y-o.y,s=o.x-r.x,i=r.x*o.y-o.x*r.y,n=a*l.x+s*l.y+i,p=a*t.x+s*t.y+i,!(n!==0&&p!==0&&Le(n,p))&&(g=e*s-a*h,g!==0)))return d=Math.abs(g/2),y=h*i-s*c,x=y<0?(y-d)/g:(y+d)/g,y=a*c-e*i,b=y<0?(y-d)/g:(y+d)/g,{x,y:b}}u(yr,"intersectLine");function Le(l,t){return l*t>0}u(Le,"sameSign");var He=yr;function xr(l,t,o){let r=l.x,e=l.y,a=[],h=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(n){h=Math.min(h,n.x),s=Math.min(s,n.y)}):(h=Math.min(h,t.x),s=Math.min(s,t.y));let c=r-l.width/2-h,i=e-l.height/2-s;for(let n=0;n<t.length;n++){let p=t[n],f=t[n<t.length-1?n+1:0],m=He(l,o,{x:c+p.x,y:i+p.y},{x:c+f.x,y:i+f.y});m&&a.push(m)}return a.length?(a.length>1&&a.sort(function(n,p){let f=n.x-o.x,m=n.y-o.y,g=Math.sqrt(f*f+m*m),d=p.x-o.x,y=p.y-o.y,x=Math.sqrt(d*d+y*y);return g<x?-1:g===x?0:1}),a[0]):l}u(xr,"intersectPolygon");var We=xr;var N={node:Ae,circle:Oe,ellipse:It,polygon:We,rect:gt};function Ve(l,t){let{labelStyles:o}=k(t);t.labelStyle=o;let r=T(t),e=r;r||(e="anchor");let a=l.insert("g").attr("class",e).attr("id",t.domId||t.id),h=1,{cssStyles:s}=t,c=v.svg(a),i=D(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(i.roughness=0);let n=c.circle(0,0,h*2,i),p=a.insert(()=>n,":first-child");return p.attr("class","anchor").attr("style",Z(s)),M(t,p),t.intersect=function(f){return z.info("Circle intersect",t,h,f),N.circle(t,h,f)},a}u(Ve,"anchor");function Ie(l,t,o,r,e,a,h){let c=(l+o)/2,i=(t+r)/2,n=Math.atan2(r-t,o-l),p=(o-l)/2,f=(r-t)/2,m=p/e,g=f/a,d=Math.sqrt(m**2+g**2);if(d>1)throw new Error("The given radii are too small to create an arc between the points.");let y=Math.sqrt(1-d**2),x=c+y*a*Math.sin(n)*(h?-1:1),b=i-y*e*Math.cos(n)*(h?-1:1),S=Math.atan2((t-b)/a,(l-x)/e),w=Math.atan2((r-b)/a,(o-x)/e)-S;h&&w<0&&(w+=2*Math.PI),!h&&w>0&&(w-=2*Math.PI);let P=[];for(let B=0;B<20;B++){let R=B/19,j=S+R*w,G=x+e*Math.cos(j),E=b+a*Math.sin(j);P.push({x:G,y:E})}return P}u(Ie,"generateArcPoints");async function Fe(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o;let{shapeSvg:e,bbox:a}=await C(l,t,T(t)),h=a.width+t.padding+20,s=a.height+t.padding,c=s/2,i=c/(2.5+s/50),{cssStyles:n}=t,p=[{x:h/2,y:-s/2},{x:-h/2,y:-s/2},...Ie(-h/2,-s/2,-h/2,s/2,i,c,!1),{x:h/2,y:s/2},...Ie(h/2,s/2,h/2,-s/2,i,c,!0)],f=v.svg(e),m=D(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let g=V(p),d=f.path(g,m),y=e.insert(()=>d,":first-child");return y.attr("class","basic label-container"),n&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",r),y.attr("transform",`translate(${i/2}, 0)`),M(t,y),t.intersect=function(x){return N.polygon(t,p,x)},e}u(Fe,"bowTieRect");function K(l,t,o,r){return l.insert("polygon",":first-child").attr("points",r.map(function(e){return e.x+","+e.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+o/2+")")}u(K,"insertPolygonShape");async function _e(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o;let{shapeSvg:e,bbox:a}=await C(l,t,T(t)),h=a.height+t.padding,s=12,c=a.width+t.padding+s,i=0,n=c,p=-h,f=0,m=[{x:i+s,y:p},{x:n,y:p},{x:n,y:f},{x:i,y:f},{x:i,y:p+s},{x:i+s,y:p}],g,{cssStyles:d}=t;if(t.look==="handDrawn"){let y=v.svg(e),x=D(t,{}),b=V(m),S=y.path(b,x);g=e.insert(()=>S,":first-child").attr("transform",`translate(${-c/2}, ${h/2})`),d&&g.attr("style",d)}else g=K(e,c,h,m);return r&&g.attr("style",r),M(t,g),t.intersect=function(y){return N.polygon(t,m,y)},e}u(_e,"card");function ze(l,t){let{nodeStyles:o}=k(t);t.label="";let r=l.insert("g").attr("class",T(t)).attr("id",t.domId??t.id),{cssStyles:e}=t,a=Math.max(28,t.width??0),h=[{x:0,y:a/2},{x:a/2,y:0},{x:0,y:-a/2},{x:-a/2,y:0}],s=v.svg(r),c=D(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");let i=V(h),n=s.path(i,c),p=r.insert(()=>n,":first-child");return e&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",e),o&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",o),t.width=28,t.height=28,t.intersect=function(f){return N.polygon(t,h,f)},r}u(ze,"choice");async function qe(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o;let{shapeSvg:e,bbox:a,halfPadding:h}=await C(l,t,T(t)),s=a.width/2+h,c,{cssStyles:i}=t;if(t.look==="handDrawn"){let n=v.svg(e),p=D(t,{}),f=n.circle(0,0,s*2,p);c=e.insert(()=>f,":first-child"),c.attr("class","basic label-container").attr("style",Z(i))}else c=e.insert("circle",":first-child").attr("class","basic label-container").attr("style",r).attr("r",s).attr("cx",0).attr("cy",0);return M(t,c),t.intersect=function(n){return z.info("Circle intersect",t,s,n),N.circle(t,s,n)},e}u(qe,"circle");function br(l){let t=Math.cos(Math.PI/4),o=Math.sin(Math.PI/4),r=l*2,e={x:r/2*t,y:r/2*o},a={x:-(r/2)*t,y:r/2*o},h={x:-(r/2)*t,y:-(r/2)*o},s={x:r/2*t,y:-(r/2)*o};return`M ${a.x},${a.y} L ${s.x},${s.y}
M ${e.x},${e.y} L ${h.x},${h.y}`}u(br,"createLine");function Xe(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o,t.label="";let e=l.insert("g").attr("class",T(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:h}=t,s=v.svg(e),c=D(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");let i=s.circle(0,0,a*2,c),n=br(a),p=s.path(n,c),f=e.insert(()=>i,":first-child");return f.insert(()=>p),h&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",h),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),M(t,f),t.intersect=function(m){return z.info("crossedCircle intersect",t,{radius:a,point:m}),N.circle(t,a,m)},e}u(Xe,"crossedCircle");function dt(l,t,o,r=100,e=0,a=180){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=l+o*Math.cos(f),g=t+o*Math.sin(f);h.push({x:-m,y:-g})}return h}u(dt,"generateCirclePoints");async function Ye(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o;let{shapeSvg:e,bbox:a,label:h}=await C(l,t,T(t)),s=a.width+(t.padding??0),c=a.height+(t.padding??0),i=Math.max(5,c*.1),{cssStyles:n}=t,p=[...dt(s/2,-c/2,i,30,-90,0),{x:-s/2-i,y:i},...dt(s/2+i*2,-i,i,20,-180,-270),...dt(s/2+i*2,i,i,20,-90,-180),{x:-s/2-i,y:-c/2},...dt(s/2,c/2,i,20,0,90)],f=[{x:s/2,y:-c/2-i},{x:-s/2,y:-c/2-i},...dt(s/2,-c/2,i,20,-90,0),{x:-s/2-i,y:-i},...dt(s/2+s*.1,-i,i,20,-180,-270),...dt(s/2+s*.1,i,i,20,-90,-180),{x:-s/2-i,y:c/2},...dt(s/2,c/2,i,20,0,90),{x:-s/2,y:c/2+i},{x:s/2,y:c/2+i}],m=v.svg(e),g=D(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=V(p).replace("Z",""),x=m.path(y,g),b=V(f),S=m.path(b,{...g}),$=e.insert("g",":first-child");return $.insert(()=>S,":first-child").attr("stroke-opacity",0),$.insert(()=>x,":first-child"),$.attr("class","text"),n&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",r),$.attr("transform",`translate(${i}, 0)`),h.attr("transform",`translate(${-s/2+i-(a.x-(a.left??0))},${-c/2+(t.padding??0)/2-(a.y-(a.top??0))})`),M(t,$),t.intersect=function(w){return N.polygon(t,f,w)},e}u(Ye,"curlyBraceLeft");function ut(l,t,o,r=100,e=0,a=180){let h=[],s=e*Math.PI/180,n=(a*Math.PI/180-s)/(r-1);for(let p=0;p<r;p++){let f=s+p*n,m=l+o*Math.cos(f),g=t+o*Math.sin(f);h.push({x:m,y:g})}return h}u(ut,"generateCirclePoints");async function Ze(l,t){let{labelStyles:o,nodeStyles:r}=k(t);t.labelStyle=o;let{shapeSvg:e,bbox:a,label:h}=await C(l,t,T(t)),s=a.width+(t.padding??0),c=a.height+(t.padding??0),i=Math.max(5,c*.1),{cssStyles:n}=t,p=[...ut(s/2,-c/2,i,20,-90,0),{x:s/2+i,y:-i},...ut(s/2+i*2,-i,i,20,-180,-270),...ut(s/2+i*2,i,i,20,-90,-180),{x:s/2+i,y:c/2},...ut(s/2,c/2,i,20,0,90)],f=[{x:-s/2,y:-c/2-i},{x:s/2,y:-c/2-i},...ut(s/2,-c/2,i,20,-90,0),{x:s/2+i,y:-i},...ut(s/2+i*2,-i,i,20,-180,-270),...ut(s/2+i*2,i,i,20,-90,-180),{x:s/2+i,y:c/2},...ut(s/2,c/2,i,20,0,90),{x:s/2,y:c/2+i},{x:-s/2,y:c/2+i}],m=v.svg(e),g=D(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=V(p).replace("Z",""),x=m.path(y,g),b=V(f),S=m.path(b,{...g}),$=e.insert("g",":first-child");return $.insert(()=>S,":first-child").attr("stroke-opacity",0),$.insert(()=>x,":first-child"),$.attr("class","text"),n&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&$.selectAll("path").attr("style",r),$.attr("transform",`translate(${-i}, 0)`),h.attr("transform",`translate(${-s/2+(t.padd