UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

3 lines 118 kB
import{a as Jt}from"./chunk-LM6QDVU5.mjs";import{a as ve,b as dt,d as k,e as D}from"./chunk-Z2NOIGJN.mjs";import{c as gt,g as nt}from"./chunk-IXVBHSNP.mjs";import{i as wt,k as Ne,o as ht,q as U}from"./chunk-3R3PQ5PD.mjs";import{$ as At,A as Z,B as Qt,C as Et,E as Se,F as we,Y as q,c as z,ha as Y,l as be,t as ft,y as $t}from"./chunk-F632ZYSZ.mjs";import{a as x}from"./chunk-GTKDMUJJ.mjs";var T=x(async(c,t,i)=>{let r,e=t.useHtmlLabels||Z(q()?.htmlLabels);i?r=i:r="node default";let a=c.insert("g").attr("class",r).attr("id",t.domId||t.id),h=a.insert("g").attr("class","label").attr("style",U(t.labelStyle)),s;t.label===void 0?s="":s=typeof t.label=="string"?t.label:t.label[0];let l=await nt(h,$t(ht(s),q()),{useHtmlLabels:e,width:t.width||q().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img}),o=l.getBBox(),n=(t?.padding??0)/2;if(e){let p=l.children[0],f=Y(l),m=p.getElementsByTagName("img");if(m){let g=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...m].map(d=>new Promise(y=>{function u(){if(d.style.display="flex",d.style.flexDirection="column",g){let b=q().fontSize?q().fontSize:window.getComputedStyle(document.body).fontSize,S=5,[M=be.fontSize]=Ne(b),w=M*S+"px";d.style.minWidth=w,d.style.maxWidth=w}else d.style.width="100%";y(d)}x(u,"setupImage"),setTimeout(()=>{d.complete&&u()}),d.addEventListener("error",u),d.addEventListener("load",u)})))}o=p.getBoundingClientRect(),f.attr("width",o.width),f.attr("height",o.height)}return e?h.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"):h.attr("transform","translate(0, "+-o.height/2+")"),t.centerLabel&&h.attr("transform","translate("+-o.width/2+", "+-o.height/2+")"),h.insert("rect",":first-child"),{shapeSvg:a,bbox:o,halfPadding:n,label:h}},"labelHelper"),jt=x(async(c,t,i)=>{let r=i.useHtmlLabels||Z(q()?.flowchart?.htmlLabels),e=c.insert("g").attr("class","label").attr("style",i.labelStyle||""),a=await nt(e,$t(ht(t),q()),{useHtmlLabels:r,width:i.width||q()?.flowchart?.wrappingWidth,style:i.labelStyle,addSvgBackground:!!i.icon||!!i.img}),h=a.getBBox(),s=i.padding/2;if(Z(q()?.flowchart?.htmlLabels)){let l=a.children[0],o=Y(a);h=l.getBoundingClientRect(),o.attr("width",h.width),o.attr("height",h.height)}return r?e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"):e.attr("transform","translate(0, "+-h.height/2+")"),i.centerLabel&&e.attr("transform","translate("+-h.width/2+", "+-h.height/2+")"),e.insert("rect",":first-child"),{shapeSvg:c,bbox:h,halfPadding:s,label:e}},"insertLabel"),$=x((c,t)=>{let i=t.node().getBBox();c.width=i.width,c.height=i.height},"updateNodeBounds");var C=x((c,t)=>(c.look==="handDrawn"?"rough-node":"node")+" "+c.cssClasses+" "+(t||""),"getNodeClasses");function H(c){let t=c.map((i,r)=>`${r===0?"M":"L"}${i.x},${i.y}`);return t.push("Z"),t.join(" ")}x(H,"createPathFromPoints");function lt(c,t,i,r,e,a){let h=[],l=i-c,o=r-t,n=l/a,p=2*Math.PI/n,f=t+o/2;for(let m=0;m<=50;m++){let g=m/50,d=c+g*l,y=f+e*Math.sin(p*(d-c));h.push({x:d,y})}return h}x(lt,"generateFullSineWavePoints");function Nt(c,t,i,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=c+i*Math.cos(f),g=t+i*Math.sin(f);h.push({x:-m,y:-g})}return h}x(Nt,"generateCirclePoints");function Kt(c,t,i){if(c&&c.length){let[r,e]=t,a=Math.PI/180*i,h=Math.cos(a),s=Math.sin(a);for(let l of c){let[o,n]=l;l[0]=(o-r)*h-(n-e)*s+r,l[1]=(o-r)*s+(n-e)*h+e}}}x(Kt,"t");function Js(c,t){return c[0]===t[0]&&c[1]===t[1]}x(Js,"e");function Ks(c,t,i,r=1){let e=i,a=Math.max(t,.1),h=c[0]&&c[0][0]&&typeof c[0][0]=="number"?[c]:c,s=[0,0];if(e)for(let o of h)Kt(o,s,e);let l=function(o,n,p){let f=[];for(let b of o){let S=[...b];Js(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 M=b[S],w=b[S+1];if(M[1]!==w[1]){let P=Math.min(M[1],w[1]);g.push({ymin:P,ymax:Math.max(M[1],w[1]),x:P===M[1]?M[0]:w[0],islope:(w[0]-M[0])/(w[1]-M[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,u=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||u%n==0)&&d.length>1)for(let b=0;b<d.length;b+=2){let S=b+1;if(S>=d.length)break;let M=d[b].edge,w=d[S].edge;m.push([[Math.round(M.x),y],[Math.round(w.x),y]])}y+=p,d.forEach(b=>{b.edge.x=b.edge.x+p*b.edge.islope}),u++}return m}(h,a,r);if(e){for(let o of h)Kt(o,s,-e);(function(o,n,p){let f=[];o.forEach(m=>f.push(...m)),Kt(f,n,p)})(l,s,-e)}return l}x(Ks,"s");function Tt(c,t){var i;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&&(((i=t.randomizer)===null||i===void 0?void 0:i.next())||Math.random())>.7&&(a=e),Ks(c,e,r,a||1)}x(Tt,"n");var Bt=class{static{x(this,"o")}constructor(t){this.helper=t}fillPolygons(t,i){return this._fillPolygons(t,i)}_fillPolygons(t,i){let r=Tt(t,i);return{type:"fillSketch",ops:this.renderLines(r,i)}}renderLines(t,i){let r=[];for(let e of t)r.push(...this.helper.doubleLineOps(e[0][0],e[0][1],e[1][0],e[1][1],i));return r}};function zt(c){let t=c[0],i=c[1];return Math.sqrt(Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2))}x(zt,"a");var ae=class extends Bt{static{x(this,"h")}fillPolygons(t,i){let r=i.hachureGap;r<0&&(r=4*i.strokeWidth),r=Math.max(r,.1);let e=Tt(t,Object.assign({},i,{hachureGap:r})),a=Math.PI/180*i.hachureAngle,h=[],s=.5*r*Math.cos(a),l=.5*r*Math.sin(a);for(let[o,n]of e)zt([o,n])&&h.push([[o[0]-s,o[1]+l],[...n]],[[o[0]+s,o[1]-l],[...n]]);return{type:"fillSketch",ops:this.renderLines(h,i)}}},oe=class extends Bt{static{x(this,"r")}fillPolygons(t,i){let r=this._fillPolygons(t,i),e=Object.assign({},i,{hachureAngle:i.hachureAngle+90}),a=this._fillPolygons(t,e);return r.ops=r.ops.concat(a.ops),r}},ie=class{static{x(this,"i")}constructor(t){this.helper=t}fillPolygons(t,i){let r=Tt(t,i=Object.assign({},i,{hachureAngle:0}));return this.dotsOnLines(r,i)}dotsOnLines(t,i){let r=[],e=i.hachureGap;e<0&&(e=4*i.strokeWidth),e=Math.max(e,.1);let a=i.fillWeight;a<0&&(a=i.strokeWidth/2);let h=e/4;for(let s of t){let l=zt(s),o=l/e,n=Math.ceil(o)-1,p=l-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,u=d-h+2*Math.random()*h,b=this.helper.ellipse(y,u,a,a,i);r.push(...b.ops)}}return{type:"fillSketch",ops:r}}},ne=class{static{x(this,"c")}constructor(t){this.helper=t}fillPolygons(t,i){let r=Tt(t,i);return{type:"fillSketch",ops:this.dashedLine(r,i)}}dashedLine(t,i){let r=i.dashOffset<0?i.hachureGap<0?4*i.strokeWidth:i.hachureGap:i.dashOffset,e=i.dashGap<0?i.hachureGap<0?4*i.strokeWidth:i.hachureGap:i.dashGap,a=[];return t.forEach(h=>{let s=zt(h),l=Math.floor(s/(r+e)),o=(s+e-l*(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<l;m++){let g=m*(r+e),d=g+r,y=[n[0]+g*Math.cos(f)+o*Math.cos(f),n[1]+g*Math.sin(f)+o*Math.sin(f)],u=[n[0]+d*Math.cos(f)+o*Math.cos(f),n[1]+d*Math.sin(f)+o*Math.sin(f)];a.push(...this.helper.doubleLineOps(y[0],y[1],u[0],u[1],i))}}),a}},le=class{static{x(this,"l")}constructor(t){this.helper=t}fillPolygons(t,i){let r=i.hachureGap<0?4*i.strokeWidth:i.hachureGap,e=i.zigzagOffset<0?r:i.zigzagOffset,a=Tt(t,i=Object.assign({},i,{hachureGap:r+e}));return{type:"fillSketch",ops:this.zigzagLines(a,e,i)}}zigzagLines(t,i,r){let e=[];return t.forEach(a=>{let h=zt(a),s=Math.round(h/(2*i)),l=a[0],o=a[1];l[0]>o[0]&&(l=a[1],o=a[0]);let n=Math.atan((o[1]-l[1])/(o[0]-l[0]));for(let p=0;p<s;p++){let f=2*p*i,m=2*(p+1)*i,g=Math.sqrt(2*Math.pow(i,2)),d=[l[0]+f*Math.cos(n),l[1]+f*Math.sin(n)],y=[l[0]+m*Math.cos(n),l[1]+m*Math.sin(n)],u=[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],u[0],u[1],r),...this.helper.doubleLineOps(u[0],u[1],y[0],y[1],r))}}),e}},et={},ce=class{static{x(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()}},tr=0,te=1,De=2,Ot={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 ee(c,t){return c.type===t}x(ee,"k");function de(c){let t=[],i=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:tr,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:te,text:`${parseFloat(RegExp.$1)}`},h=h.substr(RegExp.$1.length)}return s[s.length]={type:De,text:""},s}(c),r="BOD",e=0,a=i[e];for(;!ee(a,De);){let h=0,s=[];if(r==="BOD"){if(a.text!=="M"&&a.text!=="m")return de("M0,0"+c);e++,h=Ot[a.text],r=a.text}else ee(a,te)?h=Ot[r]:(e++,h=Ot[a.text],r=a.text);if(!(e+h<i.length))throw new Error("Path data ended short");for(let l=e;l<e+h;l++){let o=i[l];if(!ee(o,te))throw new Error("Param not a number: "+r+","+o.text);s[s.length]=+o.text}if(typeof Ot[r]!="number")throw new Error("Bad segment: "+r);{let l={key:r,data:s};t.push(l),e+=h,a=i[e],r==="M"&&(r="L"),r==="m"&&(r="l")}}return t}x(de,"b");function Re(c){let t=0,i=0,r=0,e=0,a=[];for(let{key:h,data:s}of c)switch(h){case"M":a.push({key:"M",data:[...s]}),[t,i]=s,[r,e]=s;break;case"m":t+=s[0],i+=s[1],a.push({key:"M",data:[t,i]}),r=t,e=i;break;case"L":a.push({key:"L",data:[...s]}),[t,i]=s;break;case"l":t+=s[0],i+=s[1],a.push({key:"L",data:[t,i]});break;case"C":a.push({key:"C",data:[...s]}),t=s[4],i=s[5];break;case"c":{let l=s.map((o,n)=>n%2?o+i:o+t);a.push({key:"C",data:l}),t=l[4],i=l[5];break}case"Q":a.push({key:"Q",data:[...s]}),t=s[2],i=s[3];break;case"q":{let l=s.map((o,n)=>n%2?o+i:o+t);a.push({key:"Q",data:l}),t=l[2],i=l[3];break}case"A":a.push({key:"A",data:[...s]}),t=s[5],i=s[6];break;case"a":t+=s[5],i+=s[6],a.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,i]});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]}),i=s[0];break;case"v":i+=s[0],a.push({key:"V",data:[i]});break;case"S":a.push({key:"S",data:[...s]}),t=s[2],i=s[3];break;case"s":{let l=s.map((o,n)=>n%2?o+i:o+t);a.push({key:"S",data:l}),t=l[2],i=l[3];break}case"T":a.push({key:"T",data:[...s]}),t=s[0],i=s[1];break;case"t":t+=s[0],i+=s[1],a.push({key:"T",data:[t,i]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=r,i=e}return a}x(Re,"y");function Ge(c){let t=[],i="",r=0,e=0,a=0,h=0,s=0,l=0;for(let{key:o,data:n}of c){switch(o){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],l=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;i==="C"||i==="S"?(p=r+(r-s),f=e+(e-l)):(p=r,f=e),t.push({key:"C",data:[p,f,...n]}),s=n[0],l=n[1],r=n[2],e=n[3];break}case"T":{let[p,f]=n,m=0,g=0;i==="Q"||i==="T"?(m=r+(r-s),g=e+(e-l)):(m=r,g=e);let d=r+2*(m-r)/3,y=e+2*(g-e)/3,u=p+2*(m-p)/3,b=f+2*(g-f)/3;t.push({key:"C",data:[d,y,u,b,p,f]}),s=m,l=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,u=m+2*(p-m)/3,b=g+2*(f-g)/3;t.push({key:"C",data:[d,y,u,b,m,g]}),s=p,l=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],u=n[6];p===0||f===0?(t.push({key:"C",data:[r,e,y,u,y,u]}),r=y,e=u):(r!==y||e!==u)&&(Ee(r,e,y,u,p,f,m,g,d).forEach(function(b){t.push({key:"C",data:b})}),r=y,e=u);break}case"Z":t.push({key:"Z",data:[]}),r=a,e=h}i=o}return t}x(Ge,"m");function Pt(c,t,i){return[c*Math.cos(i)-t*Math.sin(i),c*Math.sin(i)+t*Math.cos(i)]}x(Pt,"w");function Ee(c,t,i,r,e,a,h,s,l,o){let n=(p=h,Math.PI*p/180);var p;let f=[],m=0,g=0,d=0,y=0;if(o)[m,g,d,y]=o;else{[c,t]=Pt(c,t,-n),[i,r]=Pt(i,r,-n);let G=(c-i)/2,A=(t-r)/2,V=G*G/(e*e)+A*A/(a*a);V>1&&(V=Math.sqrt(V),e*=V,a*=V);let j=e*e,I=a*a,F=j*I-j*A*A-I*G*G,Q=j*A*A+I*G*G,it=(s===l?-1:1)*Math.sqrt(Math.abs(F/Q));d=it*e*A/a+(c+i)/2,y=it*-a*G/e+(t+r)/2,m=Math.asin(parseFloat(((t-y)/a).toFixed(9))),g=Math.asin(parseFloat(((r-y)/a).toFixed(9))),c<d&&(m=Math.PI-m),i<d&&(g=Math.PI-g),m<0&&(m=2*Math.PI+m),g<0&&(g=2*Math.PI+g),l&&m>g&&(m-=2*Math.PI),!l&&g>m&&(g-=2*Math.PI)}let u=g-m;if(Math.abs(u)>120*Math.PI/180){let G=g,A=i,V=r;g=l&&g>m?m+120*Math.PI/180*1:m+120*Math.PI/180*-1,f=Ee(i=d+e*Math.cos(g),r=y+a*Math.sin(g),A,V,e,a,h,0,l,[g,G,d,y])}u=g-m;let b=Math.cos(m),S=Math.sin(m),M=Math.cos(g),w=Math.sin(g),P=Math.tan(u/4),B=4/3*e*P,R=4/3*a*P,E=[c,t],L=[c+B*S,t-R*b],O=[i+B*w,r-R*M],W=[i,r];if(L[0]=2*E[0]-L[0],L[1]=2*E[1]-L[1],o)return[L,O,W].concat(f);{f=[L,O,W].concat(f);let G=[];for(let A=0;A<f.length;A+=3){let V=Pt(f[A][0],f[A][1],n),j=Pt(f[A+1][0],f[A+1][1],n),I=Pt(f[A+2][0],f[A+2][1],n);G.push([V[0],V[1],j[0],j[1],I[0],I[1]])}return G}}x(Ee,"x");var er={randOffset:x(function(c,t){return _(c,t)},"randOffset"),randOffsetWithRange:x(function(c,t,i){return It(c,t,i)},"randOffsetWithRange"),ellipse:x(function(c,t,i,r,e){let a=je(i,r,e);return he(c,t,e,a).opset},"ellipse"),doubleLineOps:x(function(c,t,i,r,e){return ut(c,t,i,r,e,!0)},"doubleLineOps")};function Ae(c,t,i,r,e){return{type:"path",ops:ut(c,t,i,r,e)}}x(Ae,"v");function Wt(c,t,i){let r=(c||[]).length;if(r>2){let e=[];for(let a=0;a<r-1;a++)e.push(...ut(c[a][0],c[a][1],c[a+1][0],c[a+1][1],i));return t&&e.push(...ut(c[r-1][0],c[r-1][1],c[0][0],c[0][1],i)),{type:"path",ops:e}}return r===2?Ae(c[0][0],c[0][1],c[1][0],c[1][1],i):{type:"path",ops:[]}}x(Wt,"S");function sr(c,t,i,r,e){return function(a,h){return Wt(a,!0,h)}([[c,t],[c+i,t],[c+i,t+r],[c,t+r]],e)}x(sr,"O");function Me(c,t){if(c.length){let i=typeof c[0][0]=="number"?[c]:c,r=Lt(i[0],1*(1+.2*t.roughness),t),e=t.disableMultiStroke?[]:Lt(i[0],1.5*(1+.22*t.roughness),Pe(t));for(let a=1;a<i.length;a++){let h=i[a];if(h.length){let s=Lt(h,1*(1+.2*t.roughness),t),l=t.disableMultiStroke?[]:Lt(h,1.5*(1+.22*t.roughness),Pe(t));for(let o of s)o.op!=="move"&&r.push(o);for(let o of l)o.op!=="move"&&e.push(o)}}return{type:"path",ops:r.concat(e)}}return{type:"path",ops:[]}}x(Me,"L");function je(c,t,i){let r=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(c/2,2)+Math.pow(t/2,2))/2)),e=Math.ceil(Math.max(i.curveStepCount,i.curveStepCount/Math.sqrt(200)*r)),a=2*Math.PI/e,h=Math.abs(c/2),s=Math.abs(t/2),l=1-i.curveFitting;return h+=_(h*l,i),s+=_(s*l,i),{increment:a,rx:h,ry:s}}x(je,"T");function he(c,t,i,r){let[e,a]=Ce(r.increment,c,t,r.rx,r.ry,1,r.increment*It(.1,It(.4,1,i),i),i),h=Ft(e,null,i);if(!i.disableMultiStroke&&i.roughness!==0){let[s]=Ce(r.increment,c,t,r.rx,r.ry,1.5,0,i),l=Ft(s,null,i);h=h.concat(l)}return{estimatedPoints:a,opset:{type:"path",ops:h}}}x(he,"D");function ke(c,t,i,r,e,a,h,s,l){let o=c,n=t,p=Math.abs(i/2),f=Math.abs(r/2);p+=_(.01*p,l),f+=_(.01*f,l);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/l.curveStepCount,y=Math.min(d/2,(g-m)/2),u=Be(y,o,n,p,f,m,g,1,l);if(!l.disableMultiStroke){let b=Be(y,o,n,p,f,m,g,1.5,l);u.push(...b)}return h&&(s?u.push(...ut(o,n,o+p*Math.cos(m),n+f*Math.sin(m),l),...ut(o,n,o+p*Math.cos(g),n+f*Math.sin(g),l)):u.push({op:"lineTo",data:[o,n]},{op:"lineTo",data:[o+p*Math.cos(m),n+f*Math.sin(m)]})),{type:"path",ops:u}}x(ke,"A");function $e(c,t){let i=Ge(Re(de(c))),r=[],e=[0,0],a=[0,0];for(let{key:h,data:s}of i)switch(h){case"M":a=[s[0],s[1]],e=[s[0],s[1]];break;case"L":r.push(...ut(a[0],a[1],s[0],s[1],t)),a=[s[0],s[1]];break;case"C":{let[l,o,n,p,f,m]=s;r.push(...rr(l,o,n,p,f,m,a,t)),a=[f,m];break}case"Z":r.push(...ut(a[0],a[1],e[0],e[1],t)),a=[e[0],e[1]]}return{type:"path",ops:r}}x($e,"_");function se(c,t){let i=[];for(let r of c)if(r.length){let e=t.maxRandomnessOffset||0,a=r.length;if(a>2){i.push({op:"move",data:[r[0][0]+_(e,t),r[0][1]+_(e,t)]});for(let h=1;h<a;h++)i.push({op:"lineTo",data:[r[h][0]+_(e,t),r[h][1]+_(e,t)]})}}return{type:"fillPath",ops:i}}x(se,"I");function Mt(c,t){return function(i,r){let e=i.fillStyle||"hachure";if(!et[e])switch(e){case"zigzag":et[e]||(et[e]=new ae(r));break;case"cross-hatch":et[e]||(et[e]=new oe(r));break;case"dots":et[e]||(et[e]=new ie(r));break;case"dashed":et[e]||(et[e]=new ne(r));break;case"zigzag-line":et[e]||(et[e]=new le(r));break;default:e="hachure",et[e]||(et[e]=new Bt(r))}return et[e]}(t,er).fillPolygons(c,t)}x(Mt,"C");function Pe(c){let t=Object.assign({},c);return t.randomizer=void 0,c.seed&&(t.seed=c.seed+1),t}x(Pe,"z");function Oe(c){return c.randomizer||(c.randomizer=new ce(c.seed||0)),c.randomizer.next()}x(Oe,"W");function It(c,t,i,r=1){return i.roughness*r*(Oe(i)*(t-c)+c)}x(It,"E");function _(c,t,i=1){return It(-c,c,t,i)}x(_,"G");function ut(c,t,i,r,e,a=!1){let h=a?e.disableMultiStrokeFill:e.disableMultiStroke,s=pe(c,t,i,r,e,!0,!1);if(h)return s;let l=pe(c,t,i,r,e,!0,!0);return s.concat(l)}x(ut,"$");function pe(c,t,i,r,e,a,h){let s=Math.pow(c-i,2)+Math.pow(t-r,2),l=Math.sqrt(s),o=1;o=l<200?1:l>500?.4:-.0016668*l+1.233334;let n=e.maxRandomnessOffset||0;n*n*100>s&&(n=l/10);let p=n/2,f=.2+.2*Oe(e),m=e.bowing*e.maxRandomnessOffset*(r-t)/200,g=e.bowing*e.maxRandomnessOffset*(c-i)/200;m=_(m,e,o),g=_(g,e,o);let d=[],y=x(()=>_(p,e,o),"M"),u=x(()=>_(n,e,o),"k"),b=e.preserveVertices;return a&&(h?d.push({op:"move",data:[c+(b?0:y()),t+(b?0:y())]}):d.push({op:"move",data:[c+(b?0:_(n,e,o)),t+(b?0:_(n,e,o))]})),h?d.push({op:"bcurveTo",data:[m+c+(i-c)*f+y(),g+t+(r-t)*f+y(),m+c+2*(i-c)*f+y(),g+t+2*(r-t)*f+y(),i+(b?0:y()),r+(b?0:y())]}):d.push({op:"bcurveTo",data:[m+c+(i-c)*f+u(),g+t+(r-t)*f+u(),m+c+2*(i-c)*f+u(),g+t+2*(r-t)*f+u(),i+(b?0:u()),r+(b?0:u())]}),d}x(pe,"R");function Lt(c,t,i){if(!c.length)return[];let r=[];r.push([c[0][0]+_(t,i),c[0][1]+_(t,i)]),r.push([c[0][0]+_(t,i),c[0][1]+_(t,i)]);for(let e=1;e<c.length;e++)r.push([c[e][0]+_(t,i),c[e][1]+_(t,i)]),e===c.length-1&&r.push([c[e][0]+_(t,i),c[e][1]+_(t,i)]);return Ft(r,null,i)}x(Lt,"j");function Ft(c,t,i){let r=c.length,e=[];if(r>3){let a=[],h=1-i.curveTightness;e.push({op:"move",data:[c[1][0],c[1][1]]});for(let s=1;s+2<r;s++){let l=c[s];a[0]=[l[0],l[1]],a[1]=[l[0]+(h*c[s+1][0]-h*c[s-1][0])/6,l[1]+(h*c[s+1][1]-h*c[s-1][1])/6],a[2]=[c[s+1][0]+(h*c[s][0]-h*c[s+2][0])/6,c[s+1][1]+(h*c[s][1]-h*c[s+2][1])/6],a[3]=[c[s+1][0],c[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=i.maxRandomnessOffset;e.push({op:"lineTo",data:[t[0]+_(s,i),t[1]+_(s,i)]})}}else r===3?(e.push({op:"move",data:[c[1][0],c[1][1]]}),e.push({op:"bcurveTo",data:[c[1][0],c[1][1],c[2][0],c[2][1],c[2][0],c[2][1]]})):r===2&&e.push(...pe(c[0][0],c[0][1],c[1][0],c[1][1],i,!0,!0));return e}x(Ft,"q");function Ce(c,t,i,r,e,a,h,s){let l=[],o=[];if(s.roughness===0){c/=4,o.push([t+r*Math.cos(-c),i+e*Math.sin(-c)]);for(let n=0;n<=2*Math.PI;n+=c){let p=[t+r*Math.cos(n),i+e*Math.sin(n)];l.push(p),o.push(p)}o.push([t+r*Math.cos(0),i+e*Math.sin(0)]),o.push([t+r*Math.cos(c),i+e*Math.sin(c)])}else{let n=_(.5,s)-Math.PI/2;o.push([_(a,s)+t+.9*r*Math.cos(n-c),_(a,s)+i+.9*e*Math.sin(n-c)]);let p=2*Math.PI+n-.01;for(let f=n;f<p;f+=c){let m=[_(a,s)+t+r*Math.cos(f),_(a,s)+i+e*Math.sin(f)];l.push(m),o.push(m)}o.push([_(a,s)+t+r*Math.cos(n+2*Math.PI+.5*h),_(a,s)+i+e*Math.sin(n+2*Math.PI+.5*h)]),o.push([_(a,s)+t+.98*r*Math.cos(n+h),_(a,s)+i+.98*e*Math.sin(n+h)]),o.push([_(a,s)+t+.9*r*Math.cos(n+.5*h),_(a,s)+i+.9*e*Math.sin(n+.5*h)])}return[o,l]}x(Ce,"F");function Be(c,t,i,r,e,a,h,s,l){let o=a+_(.1,l),n=[];n.push([_(s,l)+t+.9*r*Math.cos(o-c),_(s,l)+i+.9*e*Math.sin(o-c)]);for(let p=o;p<=h;p+=c)n.push([_(s,l)+t+r*Math.cos(p),_(s,l)+i+e*Math.sin(p)]);return n.push([t+r*Math.cos(h),i+e*Math.sin(h)]),n.push([t+r*Math.cos(h),i+e*Math.sin(h)]),Ft(n,null,l)}x(Be,"V");function rr(c,t,i,r,e,a,h,s){let l=[],o=[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?l.push({op:"move",data:[h[0],h[1]]}):l.push({op:"move",data:[h[0]+(f?0:_(o[0],s)),h[1]+(f?0:_(o[0],s))]}),n=f?[e,a]:[e+_(o[m],s),a+_(o[m],s)],l.push({op:"bcurveTo",data:[c+_(o[m],s),t+_(o[m],s),i+_(o[m],s),r+_(o[m],s),n[0],n[1]]});return l}x(rr,"Z");function Ct(c){return[...c]}x(Ct,"Q");function Te(c,t=0){let i=c.length;if(i<3)throw new Error("A curve must have at least three points.");let r=[];if(i===3)r.push(Ct(c[0]),Ct(c[1]),Ct(c[2]),Ct(c[2]));else{let e=[];e.push(c[0],c[0]);for(let s=1;s<c.length;s++)e.push(c[s]),s===c.length-1&&e.push(c[s]);let a=[],h=1-t;r.push(Ct(e[0]));for(let s=1;s+2<e.length;s++){let l=e[s];a[0]=[l[0],l[1]],a[1]=[l[0]+(h*e[s+1][0]-h*e[s-1][0])/6,l[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}x(Te,"H");function Vt(c,t){return Math.pow(c[0]-t[0],2)+Math.pow(c[1]-t[1],2)}x(Vt,"N");function ar(c,t,i){let r=Vt(t,i);if(r===0)return Vt(c,t);let e=((c[0]-t[0])*(i[0]-t[0])+(c[1]-t[1])*(i[1]-t[1]))/r;return e=Math.max(0,Math.min(1,e)),Vt(c,vt(t,i,e))}x(ar,"B");function vt(c,t,i){return[c[0]+(t[0]-c[0])*i,c[1]+(t[1]-c[1])*i]}x(vt,"J");function me(c,t,i,r){let e=r||[];if(function(s,l){let o=s[l+0],n=s[l+1],p=s[l+2],f=s[l+3],m=3*n[0]-2*o[0]-f[0];m*=m;let g=3*n[1]-2*o[1]-f[1];g*=g;let d=3*p[0]-2*f[0]-o[0];d*=d;let y=3*p[1]-2*f[1]-o[1];return y*=y,m<d&&(m=d),g<y&&(g=y),m+g}(c,t)<i){let s=c[t+0];e.length?(a=e[e.length-1],h=s,Math.sqrt(Vt(a,h))>1&&e.push(s)):e.push(s),e.push(c[t+3])}else{let l=c[t+0],o=c[t+1],n=c[t+2],p=c[t+3],f=vt(l,o,.5),m=vt(o,n,.5),g=vt(n,p,.5),d=vt(f,m,.5),y=vt(m,g,.5),u=vt(d,y,.5);me([l,f,d,u],0,i,e),me([u,y,g,p],0,i,e)}var a,h;return e}x(me,"K");function or(c,t){return _t(c,0,c.length,t)}x(or,"U");function _t(c,t,i,r,e){let a=e||[],h=c[t],s=c[i-1],l=0,o=1;for(let n=t+1;n<i-1;++n){let p=ar(c[n],h,s);p>l&&(l=p,o=n)}return Math.sqrt(l)>r?(_t(c,t,o+1,r,a),_t(c,o,i,r,a)):(a.length||a.push(h),a.push(s)),a}x(_t,"X");function re(c,t=.15,i){let r=[],e=(c.length-1)/3;for(let a=0;a<e;a++)me(c,3*a,t,r);return i&&i>0?_t(r,0,r.length,i):r}x(re,"Y");var ot="none",kt=class{static{x(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,i,r){return{shape:t,sets:i||[],options:r||this.defaultOptions}}line(t,i,r,e,a){let h=this._o(a);return this._d("line",[Ae(t,i,r,e,h)],h)}rectangle(t,i,r,e,a){let h=this._o(a),s=[],l=sr(t,i,r,e,h);if(h.fill){let o=[[t,i],[t+r,i],[t+r,i+e],[t,i+e]];h.fillStyle==="solid"?s.push(se([o],h)):s.push(Mt([o],h))}return h.stroke!==ot&&s.push(l),this._d("rectangle",s,h)}ellipse(t,i,r,e,a){let h=this._o(a),s=[],l=je(r,e,h),o=he(t,i,h,l);if(h.fill)if(h.fillStyle==="solid"){let n=he(t,i,h,l).opset;n.type="fillPath",s.push(n)}else s.push(Mt([o.estimatedPoints],h));return h.stroke!==ot&&s.push(o.opset),this._d("ellipse",s,h)}circle(t,i,r,e){let a=this.ellipse(t,i,r,r,e);return a.shape="circle",a}linearPath(t,i){let r=this._o(i);return this._d("linearPath",[Wt(t,!1,r)],r)}arc(t,i,r,e,a,h,s=!1,l){let o=this._o(l),n=[],p=ke(t,i,r,e,a,h,s,!0,o);if(s&&o.fill)if(o.fillStyle==="solid"){let f=Object.assign({},o);f.disableMultiStroke=!0;let m=ke(t,i,r,e,a,h,!0,!1,f);m.type="fillPath",n.push(m)}else n.push(function(f,m,g,d,y,u,b){let S=f,M=m,w=Math.abs(g/2),P=Math.abs(d/2);w+=_(.01*w,b),P+=_(.01*P,b);let B=y,R=u;for(;B<0;)B+=2*Math.PI,R+=2*Math.PI;R-B>2*Math.PI&&(B=0,R=2*Math.PI);let E=(R-B)/b.curveStepCount,L=[];for(let O=B;O<=R;O+=E)L.push([S+w*Math.cos(O),M+P*Math.sin(O)]);return L.push([S+w*Math.cos(R),M+P*Math.sin(R)]),L.push([S,M]),Mt([L],b)}(t,i,r,e,a,h,o));return o.stroke!==ot&&n.push(p),this._d("arc",n,o)}curve(t,i){let r=this._o(i),e=[],a=Me(t,r);if(r.fill&&r.fill!==ot)if(r.fillStyle==="solid"){let h=Me(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 l=typeof s[0][0]=="number"?[s]:s;for(let o of l)o.length<3?h.push(...o):o.length===3?h.push(...re(Te([o[0],o[0],o[1],o[2]]),10,(1+r.roughness)/2)):h.push(...re(Te(o),10,(1+r.roughness)/2))}h.length&&e.push(Mt([h],r))}return r.stroke!==ot&&e.push(a),this._d("curve",e,r)}polygon(t,i){let r=this._o(i),e=[],a=Wt(t,!0,r);return r.fill&&(r.fillStyle==="solid"?e.push(se([t],r)):e.push(Mt([t],r))),r.stroke!==ot&&e.push(a),this._d("polygon",e,r)}path(t,i){let r=this._o(i),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!==ot,h=r.stroke!==ot,s=!!(r.simplification&&r.simplification<1),l=function(n,p,f){let m=Ge(Re(de(n))),g=[],d=[],y=[0,0],u=[],b=x(()=>{u.length>=4&&d.push(...re(u,p)),u=[]},"i"),S=x(()=>{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(!u.length){let B=d.length?d[d.length-1]:y;u.push([B[0],B[1]])}u.push([P[0],P[1]]),u.push([P[2],P[3]]),u.push([P[4],P[5]]);break;case"Z":b(),d.push([y[0],y[1]])}if(S(),!f)return g;let M=[];for(let w of g){let P=or(w,f);P.length&&M.push(P)}return M}(t,1,s?4-4*(r.simplification||1):(1+r.roughness)/2),o=$e(t,r);if(a)if(r.fillStyle==="solid")if(l.length===1){let n=$e(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(se(l,r));else e.push(Mt(l,r));return h&&(s?l.forEach(n=>{e.push(Wt(n,!1,r))}):e.push(o)),this._d("path",e,r)}opsToPath(t,i){let r="";for(let e of t.ops){let a=typeof i=="number"&&i>=0?e.data.map(h=>+h.toFixed(i)):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 i=t.sets||[],r=t.options||this.defaultOptions,e=[];for(let a of i){let h=null;switch(a.type){case"path":h={d:this.opsToPath(a),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:ot};break;case"fillPath":h={d:this.opsToPath(a),stroke:ot,strokeWidth:0,fill:r.fill||ot};break;case"fillSketch":h=this.fillSketch(a,r)}h&&e.push(h)}return e}fillSketch(t,i){let r=i.fillWeight;return r<0&&(r=i.strokeWidth/2),{d:this.opsToPath(t),stroke:i.fill||ot,strokeWidth:r,fill:ot}}_mergedShape(t){return t.filter((i,r)=>r===0||i.op!=="move")}},fe=class{static{x(this,"st")}constructor(t,i){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new kt(i)}draw(t){let i=t.sets||[],r=t.options||this.getDefaultOptions(),e=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let h of i)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,i,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,i,r.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,i,r,e="nonzero"){t.beginPath();for(let a of i.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])}}i.type==="fillPath"?t.fill(e):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,i,r,e,a){let h=this.gen.line(t,i,r,e,a);return this.draw(h),h}rectangle(t,i,r,e,a){let h=this.gen.rectangle(t,i,r,e,a);return this.draw(h),h}ellipse(t,i,r,e,a){let h=this.gen.ellipse(t,i,r,e,a);return this.draw(h),h}circle(t,i,r,e){let a=this.gen.circle(t,i,r,e);return this.draw(a),a}linearPath(t,i){let r=this.gen.linearPath(t,i);return this.draw(r),r}polygon(t,i){let r=this.gen.polygon(t,i);return this.draw(r),r}arc(t,i,r,e,a,h,s=!1,l){let o=this.gen.arc(t,i,r,e,a,h,s,l);return this.draw(o),o}curve(t,i){let r=this.gen.curve(t,i);return this.draw(r),r}path(t,i){let r=this.gen.path(t,i);return this.draw(r),r}},Ht="http://www.w3.org/2000/svg",ge=class{static{x(this,"ot")}constructor(t,i){this.svg=t,this.gen=new kt(i)}draw(t){let i=t.sets||[],r=t.options||this.getDefaultOptions(),e=this.svg.ownerDocument||window.document,a=e.createElementNS(Ht,"g"),h=t.options.fixedDecimalPlaceDigits;for(let s of i){let l=null;switch(s.type){case"path":l=e.createElementNS(Ht,"path"),l.setAttribute("d",this.opsToPath(s,h)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break;case"fillPath":l=e.createElementNS(Ht,"path"),l.setAttribute("d",this.opsToPath(s,h)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||l.setAttribute("fill-rule","evenodd");break;case"fillSketch":l=this.fillSketch(e,s,r)}l&&a.appendChild(l)}return a}fillSketch(t,i,r){let e=r.fillWeight;e<0&&(e=r.strokeWidth/2);let a=t.createElementNS(Ht,"path");return a.setAttribute("d",this.opsToPath(i,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,i){return this.gen.opsToPath(t,i)}line(t,i,r,e,a){let h=this.gen.line(t,i,r,e,a);return this.draw(h)}rectangle(t,i,r,e,a){let h=this.gen.rectangle(t,i,r,e,a);return this.draw(h)}ellipse(t,i,r,e,a){let h=this.gen.ellipse(t,i,r,e,a);return this.draw(h)}circle(t,i,r,e){let a=this.gen.circle(t,i,r,e);return this.draw(a)}linearPath(t,i){let r=this.gen.linearPath(t,i);return this.draw(r)}polygon(t,i){let r=this.gen.polygon(t,i);return this.draw(r)}arc(t,i,r,e,a,h,s=!1,l){let o=this.gen.arc(t,i,r,e,a,h,s,l);return this.draw(o)}curve(t,i){let r=this.gen.curve(t,i);return this.draw(r)}path(t,i){let r=this.gen.path(t,i);return this.draw(r)}},v={canvas:x((c,t)=>new fe(c,t),"canvas"),svg:x((c,t)=>new ge(c,t),"svg"),generator:x(c=>new kt(c),"generator"),newSeed:x(()=>kt.newSeed(),"newSeed")};var ir=x((c,t)=>{var i=c.x,r=c.y,e=t.x-i,a=t.y-r,h=c.width/2,s=c.height/2,l,o;return Math.abs(a)*h>Math.abs(e)*s?(a<0&&(s=-s),l=a===0?0:s*e/a,o=s):(e<0&&(h=-h),l=h,o=e===0?0:h*a/e),{x:i+l,y:r+o}},"intersectRect"),yt=ir;function nr(c,t){t&&c.attr("style",t)}x(nr,"applyStyle");async function lr(c){let t=Y(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),i=t.append("xhtml:div"),r=q(),e=c.label;c.label&&Et(c.label)&&(e=await Se(c.label.replace(we.lineBreakRegex,` `),r));let h='<span class="'+(c.isNode?"nodeLabel":"edgeLabel")+'" '+(c.labelStyle?'style="'+c.labelStyle+'"':"")+">"+e+"</span>";return i.html($t(h,r)),nr(i,c.labelStyle),i.style("display","inline-block"),i.style("padding-right","1px"),i.style("white-space","nowrap"),i.attr("xmlns","http://www.w3.org/1999/xhtml"),t.node()}x(lr,"addHtmlLabel");var cr=x(async(c,t,i,r)=>{let e=c||"";if(typeof e=="object"&&(e=e[0]),Z(q().flowchart.htmlLabels)){e=e.replace(/\\n|\n/g,"<br />"),z.info("vertexText"+e);let a={isNode:r,label:ht(e).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await lr(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 l=document.createElementNS("http://www.w3.org/2000/svg","tspan");l.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),l.setAttribute("dy","1em"),l.setAttribute("x","0"),i?l.setAttribute("class","title-row"):l.setAttribute("class","row"),l.textContent=s.trim(),a.appendChild(l)}return a}},"createLabel"),Rt=cr;var st=x((c,t,i,r,e)=>["M",c+e,t,"H",c+i-e,"A",e,e,0,0,1,c+i,t+e,"V",t+r-e,"A",e,e,0,0,1,c+i-e,t+r,"H",c+e,"A",e,e,0,0,1,c,t+r-e,"V",t+e,"A",e,e,0,0,1,c+e,t,"Z"].join(" "),"createRoundedRectPathD");var Le=x(async(c,t)=>{z.info("Creating subgraph rect for ",t.id,t);let i=q(),{themeVariables:r,handDrawnSeed:e}=i,{clusterBkg:a,clusterBorder:h}=r,{labelStyles:s,nodeStyles:l,borderStyles:o,backgroundStyles:n}=k(t),p=c.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=Z(i.flowchart.htmlLabels),m=p.insert("g").attr("class","cluster-label "),g=await nt(m,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),d=g.getBBox();if(Z(i.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 u=t.height,b=t.x-y/2,S=t.y-u/2;z.trace("Data ",t,JSON.stringify(t));let M;if(t.look==="handDrawn"){let B=v.svg(p),R=D(t,{roughness:.7,fill:a,stroke:h,fillWeight:3,seed:e}),E=B.path(st(b,S,y,u,0),R);M=p.insert(()=>(z.debug("Rough node insert CXC",E),E),":first-child"),M.select("path:nth-child(2)").attr("style",o.join(";")),M.select("path").attr("style",n.join(";").replace("fill","stroke"))}else M=p.insert("rect",":first-child"),M.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",S).attr("width",y).attr("height",u);let{subGraphTitleTopMargin:w}=Jt(i);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=M.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 yt(t,B)},{cluster:p,labelBBox:d}},"rect"),hr=x((c,t)=>{let i=c.insert("g").attr("class","note-cluster").attr("id",t.id),r=i.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 yt(t,s)},{cluster:i,labelBBox:{width:0,height:0}}},"noteGroup"),pr=x(async(c,t)=>{let i=q(),{themeVariables:r,handDrawnSeed:e}=i,{altBackground:a,compositeBackground:h,compositeTitleBackground:s,nodeBorder:l}=r,o=c.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),n=o.insert("g",":first-child"),p=o.insert("g").attr("class","cluster-label"),f=o.append("rect"),m=p.node().appendChild(await Rt(t.label,t.labelStyle,void 0,!0)),g=m.getBBox();if(Z(i.flowchart.htmlLabels)){let E=m.children[0],L=Y(m);g=E.getBoundingClientRect(),L.attr("width",g.width),L.attr("height",g.height)}let d=0*t.padding,y=d/2,u=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+d;t.width<=g.width+t.padding?t.diff=(u-t.width)/2-t.padding:t.diff=-t.padding;let b=t.height+d,S=t.height+d-g.height-6,M=t.x-u/2,w=t.y-b/2;t.width=u;let P=t.y-t.height/2-y+g.height+2,B;if(t.look==="handDrawn"){let E=t.cssClasses.includes("statediagram-cluster-alt"),L=v.svg(o),O=t.rx||t.ry?L.path(st(M,w,u,b,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:l,seed:e}):L.rectangle(M,w,u,b,{seed:e});B=o.insert(()=>O,":first-child");let W=L.rectangle(M,P,u,S,{fill:E?a:h,fillStyle:E?"hachure":"solid",stroke:l,seed:e});B=o.insert(()=>O,":first-child"),f=o.insert(()=>W)}else B=n.insert("rect",":first-child"),B.attr("class","outer").attr("x",M).attr("y",w).attr("width",u).attr("height",b).attr("data-look",t.look),f.attr("class","inner").attr("x",M).attr("y",P).attr("width",u).attr("height",S);p.attr("transform",`translate(${t.x-g.width/2}, ${w+1-(Z(i.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(E){return yt(t,E)},{cluster:o,labelBBox:g}},"roundedWithTitle"),mr=x(async(c,t)=>{z.info("Creating subgraph rect for ",t.id,t);let i=q(),{themeVariables:r,handDrawnSeed:e}=i,{clusterBkg:a,clusterBorder:h}=r,{labelStyles:s,nodeStyles:l,borderStyles:o,backgroundStyles:n}=k(t),p=c.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=Z(i.flowchart.htmlLabels),m=p.insert("g").attr("class","cluster-label "),g=await nt(m,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width}),d=g.getBBox();if(Z(i.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 u=t.height,b=t.x-y/2,S=t.y-u/2;z.trace("Data ",t,JSON.stringify(t));let M;if(t.look==="handDrawn"){let B=v.svg(p),R=D(t,{roughness:.7,fill:a,stroke:h,fillWeight:4,seed:e}),E=B.path(st(b,S,y,u,t.rx),R);M=p.insert(()=>(z.debug("Rough node insert CXC",E),E),":first-child"),M.select("path:nth-child(2)").attr("style",o.join(";")),M.select("path").attr("style",n.join(";").replace("fill","stroke"))}else M=p.insert("rect",":first-child"),M.attr("style",l).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",S).attr("width",y).attr("height",u);let{subGraphTitleTopMargin:w}=Jt(i);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=M.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 yt(t,B)},{cluster:p,labelBBox:d}},"kanbanSection"),fr=x((c,t)=>{let i=q(),{themeVariables:r,handDrawnSeed:e}=i,{nodeBorder:a}=r,h=c.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-look",t.look),s=h.insert("g",":first-child"),l=0*t.padding,o=t.width+l;t.diff=-t.padding;let n=t.height+l,p=t.x-o/2,f=t.y-n/2;t.width=o;let m;if(t.look==="handDrawn"){let y=v.svg(h).rectangle(p,f,o,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",o).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 yt(t,d)},{cluster:h,labelBBox:{}}},"divider"),gr=Le,dr={rect:Le,squareRect:gr,roundedWithTitle:pr,noteGroup:hr,divider:fr,kanbanSection:mr},He=new Map,ga=x(async(c,t)=>{let i=t.shape||"rect",r=await dr[i](c,t);return He.set(t.id,r),r},"insertCluster");var da=x(()=>{He=new Map},"clear");function ur(c,t){return c.intersect(t)}x(ur,"intersectNode");var We=ur;function yr(c,t,i,r){var e=c.x,a=c.y,h=e-r.x,s=a-r.y,l=Math.sqrt(t*t*s*s+i*i*h*h),o=Math.abs(t*i*h/l);r.x<e&&(o=-o);var n=Math.abs(t*i*s/l);return r.y<a&&(n=-n),{x:e+o,y:a+n}}x(yr,"intersectEllipse");var qt=yr;function xr(c,t,i){return qt(c,t,t,i)}x(xr,"intersectCircle");var Ve=xr;function br(c,t,i,r){var e,a,h,s,l,o,n,p,f,m,g,d,y,u,b;if(e=t.y-c.y,h=c.x-t.x,l=t.x*c.y-c.x*t.y,f=e*i.x+h*i.y+l,m=e*r.x+h*r.y+l,!(f!==0&&m!==0&&Ie(f,m))&&(a=r.y-i.y,s=i.x-r.x,o=r.x*i.y-i.x*r.y,n=a*c.x+s*c.y+o,p=a*t.x+s*t.y+o,!(n!==0&&p!==0&&Ie(n,p))&&(g=e*s-a*h,g!==0)))return d=Math.abs(g/2),y=h*o-s*l,u=y<0?(y-d)/g:(y+d)/g,y=a*l-e*o,b=y<0?(y-d)/g:(y+d)/g,{x:u,y:b}}x(br,"intersectLine");function Ie(c,t){return c*t>0}x(Ie,"sameSign");var Fe=br;function Sr(c,t,i){let r=c.x,e=c.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 l=r-c.width/2-h,o=e-c.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=Fe(c,i,{x:l+p.x,y:o+p.y},{x:l+f.x,y:o+f.y});m&&a.push(m)}return a.length?(a.length>1&&a.sort(function(n,p){let f=n.x-i.x,m=n.y-i.y,g=Math.sqrt(f*f+m*m),d=p.x-i.x,y=p.y-i.y,u=Math.sqrt(d*d+y*y);return g<u?-1:g===u?0:1}),a[0]):c}x(Sr,"intersectPolygon");var _e=Sr;var N={node:We,circle:Ve,ellipse:qt,polygon:_e,rect:yt};function ze(c,t){let{labelStyles:i}=k(t);t.labelStyle=i;let r=C(t),e=r;r||(e="anchor");let a=c.insert("g").attr("class",e).attr("id",t.domId||t.id),h=1,{cssStyles:s}=t,l=v.svg(a),o=D(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(o.roughness=0);let n=l.circle(0,0,h*2,o),p=a.insert(()=>n,":first-child");return p.attr("class","anchor").attr("style",U(s)),$(t,p),t.intersect=function(f){return z.info("Circle intersect",t,h,f),N.circle(t,h,f)},a}x(ze,"anchor");function qe(c,t,i,r,e,a,h){let l=(c+i)/2,o=(t+r)/2,n=Math.atan2(r-t,i-c),p=(i-c)/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),u=l+y*a*Math.sin(n)*(h?-1:1),b=o-y*e*Math.cos(n)*(h?-1:1),S=Math.atan2((t-b)/a,(c-u)/e),w=Math.atan2((r-b)/a,(i-u)/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,E=S+R*w,L=u+e*Math.cos(E),O=b+a*Math.sin(E);P.push({x:L,y:O})}return P}x(qe,"generateArcPoints");async function Xe(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a}=await T(c,t,C(t)),h=a.width+t.padding+20,s=a.height+t.padding,l=s/2,o=l/(2.5+s/50),{cssStyles:n}=t,p=[{x:h/2,y:-s/2},{x:-h/2,y:-s/2},...qe(-h/2,-s/2,-h/2,s/2,o,l,!1),{x:h/2,y:s/2},...qe(h/2,s/2,h/2,-s/2,o,l,!0)],f=v.svg(e),m=D(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let g=H(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(${o/2}, 0)`),$(t,y),t.intersect=function(u){return N.polygon(t,p,u)},e}x(Xe,"bowTieRect");function rt(c,t,i,r){return c.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+","+i/2+")")}x(rt,"insertPolygonShape");async function Ye(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a}=await T(c,t,C(t)),h=a.height+t.padding,s=12,l=a.width+t.padding+s,o=0,n=l,p=-h,f=0,m=[{x:o+s,y:p},{x:n,y:p},{x:n,y:f},{x:o,y:f},{x:o,y:p+s},{x:o+s,y:p}],g,{cssStyles:d}=t;if(t.look==="handDrawn"){let y=v.svg(e),u=D(t,{}),b=H(m),S=y.path(b,u);g=e.insert(()=>S,":first-child").attr("transform",`translate(${-l/2}, ${h/2})`),d&&g.attr("style",d)}else g=rt(e,l,h,m);return r&&g.attr("style",r),$(t,g),t.intersect=function(y){return N.polygon(t,m,y)},e}x(Ye,"card");function Ze(c,t){let{nodeStyles:i}=k(t);t.label="";let r=c.insert("g").attr("class",C(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),l=D(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let o=H(h),n=s.path(o,l),p=r.insert(()=>n,":first-child");return e&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",e),i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),t.width=28,t.height=28,t.intersect=function(f){return N.polygon(t,h,f)},r}x(Ze,"choice");async function Ue(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,halfPadding:h}=await T(c,t,C(t)),s=a.width/2+h,l,{cssStyles:o}=t;if(t.look==="handDrawn"){let n=v.svg(e),p=D(t,{}),f=n.circle(0,0,s*2,p);l=e.insert(()=>f,":first-child"),l.attr("class","basic label-container").attr("style",U(o))}else l=e.insert("circle",":first-child").attr("class","basic label-container").attr("style",r).attr("r",s).attr("cx",0).attr("cy",0);return $(t,l),t.intersect=function(n){return z.info("Circle intersect",t,s,n),N.circle(t,s,n)},e}x(Ue,"circle");function wr(c){let t=Math.cos(Math.PI/4),i=Math.sin(Math.PI/4),r=c*2,e={x:r/2*t,y:r/2*i},a={x:-(r/2)*t,y:r/2*i},h={x:-(r/2)*t,y:-(r/2)*i},s={x:r/2*t,y:-(r/2)*i};return`M ${a.x},${a.y} L ${s.x},${s.y} M ${e.x},${e.y} L ${h.x},${h.y}`}x(wr,"createLine");function Qe(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i,t.label="";let e=c.insert("g").attr("class",C(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:h}=t,s=v.svg(e),l=D(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let o=s.circle(0,0,a*2,l),n=wr(a),p=s.path(n,l),f=e.insert(()=>o,":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),$(t,f),t.intersect=function(m){return z.info("crossedCircle intersect",t,{radius:a,point:m}),N.circle(t,a,m)},e}x(Qe,"crossedCircle");function xt(c,t,i,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=c+i*Math.cos(f),g=t+i*Math.sin(f);h.push({x:-m,y:-g})}return h}x(xt,"generateCirclePoints");async function Je(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await T(c,t,C(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...xt(s/2,-l/2,o,30,-90,0),{x:-s/2-o,y:o},...xt(s/2+o*2,-o,o,20,-180,-270),...xt(s/2+o*2,o,o,20,-90,-180),{x:-s/2-o,y:-l/2},...xt(s/2,l/2,o,20,0,90)],f=[{x:s/2,y:-l/2-o},{x:-s/2,y:-l/2-o},...xt(s/2,-l/2,o,20,-90,0),{x:-s/2-o,y:-o},...xt(s/2+s*.1,-o,o,20,-180,-270),...xt(s/2+s*.1,o,o,20,-90,-180),{x:-s/2-o,y:l/2},...xt(s/2,l/2,o,20,0,90),{x:-s/2,y:l/2+o},{x:s/2,y:l/2+o}],m=v.svg(e),g=D(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=H(p).replace("Z",""),u=m.path(y,g),b=H(f),S=m.path(b,{...g}),M=e.insert("g",":first-child");return M.insert(()=>S,":first-child").attr("stroke-opacity",0),M.insert(()=>u,":first-child"),M.attr("class","text"),n&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",r),M.attr("transform",`translate(${o}, 0)`),h.attr("transform",`translate(${-s/2+o-(a.x-(a.left??0))},${-l/2+(t.padding??0)/2-(a.y-(a.top??0))})`),$(t,M),t.intersect=function(w){return N.polygon(t,f,w)},e}x(Je,"curlyBraceLeft");function bt(c,t,i,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=c+i*Math.cos(f),g=t+i*Math.sin(f);h.push({x:m,y:g})}return h}x(bt,"generateCirclePoints");async function Ke(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await T(c,t,C(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...bt(s/2,-l/2,o,20,-90,0),{x:s/2+o,y:-o},...bt(s/2+o*2,-o,o,20,-180,-270),...bt(s/2+o*2,o,o,20,-90,-180),{x:s/2+o,y:l/2},...bt(s/2,l/2,o,20,0,90)],f=[{x:-s/2,y:-l/2-o},{x:s/2,y:-l/2-o},...bt(s/2,-l/2,o,20,-90,0),{x:s/2+o,y:-o},...bt(s/2+o*2,-o,o,20,-180,-270),...bt(s/2+o*2,o,o,20,-90,-180),{x:s/2+o,y:l/2},...bt(s/2,l/2,o,20,0,90),{x:s/2,y:l/2+o},{x:-s/2,y:l/2+o}],m=v.svg(e),g=D(t,{fill:"none"});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=H(p).replace("Z",""),u=m.path(y,g),b=H(f),S=m.path(b,{...g}),M=e.insert("g",":first-child");return M.insert(()=>S,":first-child").attr("stroke-opacity",0),M.insert(()=>u,":first-child"),M.attr("class","text"),n&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",r),M.attr("transform",`translate(${-o}, 0)`),h.attr("transform",`translate(${-s/2+(t.padding??0)/2-(a.x-(a.left??0))},${-l/2+(t.padding??0)/2-(a.y-(a.top??0))})`),$(t,M),t.intersect=function(w){return N.polygon(t,f,w)},e}x(Ke,"curlyBraceRight");function K(c,t,i,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=c+i*Math.cos(f),g=t+i*Math.sin(f);h.push({x:-m,y:-g})}return h}x(K,"generateCirclePoints");async function ts(c,t){let{labelStyles:i,nodeStyles:r}=k(t);t.labelStyle=i;let{shapeSvg:e,bbox:a,label:h}=await T(c,t,C(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),o=Math.max(5,l*.1),{cssStyles:n}=t,p=[...K(s/2,-l/2,o,30,-90,0),{x:-s/2-o,y:o},...K(s/2+o*2,-o,o,20,-180,-270),...K(s/2+o*2,o,o,20,-90,-180),{x:-s/2-o,y:-l/2},...K(s/2,l/2,o,20,0,90)],f=[...K(-s/2+o+o/2,-l/2,o,20,-90,-180),{x:s/2-o/2,y:o},...K(-s/2-o/2,-o,o,20,0,90),...K(-s/2-o/2,o,o,20,-90,0),{x:s/2-o/2,y:-o},...K(-s/2+o+o/2,l/2,o,30,-180,-270)],m=[{x:s/2,y:-l/2-o},{x:-s/2,y:-l/2-o},...K(s/2,-l/2,o,20,-90,0),{x:-s/2-o,y:-o},...K(s/2+o*2,-o,o,20,-180,-270),...K(s/2+o*2,o,o,20,-90,-180),{x:-s/2-o,y:l/2},...K(s/2,l/2,o,20,0,90),{x:-s/2,y:l/2+o},{x:s/2-o-o/2,y:l/2+o},...K(-s/2+o+o/2,-l/2,o,20,-90,-180),{x:s/2-o/2,y:o},...K(-s/2-o/2,-o,o,20,0,90),...K(-s/2-o/2,o,o,20,-90,0),{x:s/2-o/2,y:-o},...K(-s/2+o+o/2,l/2,o,30,-180,-270)],g=v.svg(e),d=D(t,{fill:"none"});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let u=H(p).replace("Z",""),b=g.path(u,d