56 lines
118 KiB
JavaScript
Executable File
56 lines
118 KiB
JavaScript
Executable File
import{a as Zt}from"./chunk-ANLQN3B7.min.js";import{a as Me,b as Mt,d as T,e as W}from"./chunk-OEBO5CRK.min.js";import{d as vt,g as ht}from"./chunk-XCAVDAZC.min.js";import{i as kt,k as ke,o as xt,q as U}from"./chunk-QZZKR5JD.min.js";import{D as Lt,F as J,G as Xt,H as Yt,J as Se,K as $e,W as V,Z as Vt,q as we,y as mt}from"./chunk-3EE2TK35.min.js";import{b as $,d as F,j as Y}from"./chunk-6TVUEPFY.min.js";function Qt(o,t,i){if(o&&o.length){let[a,e]=t,r=Math.PI/180*i,h=Math.cos(r),s=Math.sin(r);for(let c of o){let[n,l]=c;c[0]=(n-a)*h-(l-e)*s+a,c[1]=(n-a)*s+(l-e)*h+e}}}function ia(o,t){return o[0]===t[0]&&o[1]===t[1]}function la(o,t,i,a=1){let e=i,r=Math.max(t,.1),h=o[0]&&o[0][0]&&typeof o[0][0]=="number"?[o]:o,s=[0,0];if(e)for(let n of h)Qt(n,s,e);let c=(function(n,l,g){let f=[];for(let x of n){let b=[...x];ia(b[0],b[b.length-1])||b.push([b[0][0],b[0][1]]),b.length>2&&f.push(b)}let p=[];l=Math.max(l,.1);let u=[];for(let x of f)for(let b=0;b<x.length-1;b++){let M=x[b],w=x[b+1];if(M[1]!==w[1]){let k=Math.min(M[1],w[1]);u.push({ymin:k,ymax:Math.max(M[1],w[1]),x:k===M[1]?M[0]:w[0],islope:(w[0]-M[0])/(w[1]-M[1])})}}if(u.sort(((x,b)=>x.ymin<b.ymin?-1:x.ymin>b.ymin?1:x.x<b.x?-1:x.x>b.x?1:x.ymax===b.ymax?0:(x.ymax-b.ymax)/Math.abs(x.ymax-b.ymax))),!u.length)return p;let y=[],m=u[0].ymin,d=0;for(;y.length||u.length;){if(u.length){let x=-1;for(let b=0;b<u.length&&!(u[b].ymin>m);b++)x=b;u.splice(0,x+1).forEach((b=>{y.push({s:m,edge:b})}))}if(y=y.filter((x=>!(x.edge.ymax<=m))),y.sort(((x,b)=>x.edge.x===b.edge.x?0:(x.edge.x-b.edge.x)/Math.abs(x.edge.x-b.edge.x))),(g!==1||d%l==0)&&y.length>1)for(let x=0;x<y.length;x+=2){let b=x+1;if(b>=y.length)break;let M=y[x].edge,w=y[b].edge;p.push([[Math.round(M.x),m],[Math.round(w.x),m]])}m+=g,y.forEach((x=>{x.edge.x=x.edge.x+g*x.edge.islope})),d++}return p})(h,r,a);if(e){for(let n of h)Qt(n,s,-e);(function(n,l,g){let f=[];n.forEach((p=>f.push(...p))),Qt(f,l,g)})(c,s,-e)}return c}function Ct(o,t){var i;let a=t.hachureAngle+90,e=t.hachureGap;e<0&&(e=4*t.strokeWidth),e=Math.round(Math.max(e,.1));let r=1;return t.roughness>=1&&(((i=t.randomizer)===null||i===void 0?void 0:i.next())||Math.random())>.7&&(r=e),la(o,e,a,r||1)}var Bt=class{constructor(t){this.helper=t}fillPolygons(t,i){return this._fillPolygons(t,i)}_fillPolygons(t,i){let a=Ct(t,i);return{type:"fillSketch",ops:this.renderLines(a,i)}}renderLines(t,i){let a=[];for(let e of t)a.push(...this.helper.doubleLineOps(e[0][0],e[0][1],e[1][0],e[1][1],i));return a}};function jt(o){let t=o[0],i=o[1];return Math.sqrt(Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2))}var ee=class extends Bt{fillPolygons(t,i){let a=i.hachureGap;a<0&&(a=4*i.strokeWidth),a=Math.max(a,.1);let e=Ct(t,Object.assign({},i,{hachureGap:a})),r=Math.PI/180*i.hachureAngle,h=[],s=.5*a*Math.cos(r),c=.5*a*Math.sin(r);for(let[n,l]of e)jt([n,l])&&h.push([[n[0]-s,n[1]+c],[...l]],[[n[0]+s,n[1]-c],[...l]]);return{type:"fillSketch",ops:this.renderLines(h,i)}}},se=class extends Bt{fillPolygons(t,i){let a=this._fillPolygons(t,i),e=Object.assign({},i,{hachureAngle:i.hachureAngle+90}),r=this._fillPolygons(t,e);return a.ops=a.ops.concat(r.ops),a}},ae=class{constructor(t){this.helper=t}fillPolygons(t,i){let a=Ct(t,i=Object.assign({},i,{hachureAngle:0}));return this.dotsOnLines(a,i)}dotsOnLines(t,i){let a=[],e=i.hachureGap;e<0&&(e=4*i.strokeWidth),e=Math.max(e,.1);let r=i.fillWeight;r<0&&(r=i.strokeWidth/2);let h=e/4;for(let s of t){let c=jt(s),n=c/e,l=Math.ceil(n)-1,g=c-l*e,f=(s[0][0]+s[1][0])/2-e/4,p=Math.min(s[0][1],s[1][1]);for(let u=0;u<l;u++){let y=p+g+u*e,m=f-h+2*Math.random()*h,d=y-h+2*Math.random()*h,x=this.helper.ellipse(m,d,r,r,i);a.push(...x.ops)}}return{type:"fillSketch",ops:a}}},re=class{constructor(t){this.helper=t}fillPolygons(t,i){let a=Ct(t,i);return{type:"fillSketch",ops:this.dashedLine(a,i)}}dashedLine(t,i){let a=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,r=[];return t.forEach((h=>{let s=jt(h),c=Math.floor(s/(a+e)),n=(s+e-c*(a+e))/2,l=h[0],g=h[1];l[0]>g[0]&&(l=h[1],g=h[0]);let f=Math.atan((g[1]-l[1])/(g[0]-l[0]));for(let p=0;p<c;p++){let u=p*(a+e),y=u+a,m=[l[0]+u*Math.cos(f)+n*Math.cos(f),l[1]+u*Math.sin(f)+n*Math.sin(f)],d=[l[0]+y*Math.cos(f)+n*Math.cos(f),l[1]+y*Math.sin(f)+n*Math.sin(f)];r.push(...this.helper.doubleLineOps(m[0],m[1],d[0],d[1],i))}})),r}},ne=class{constructor(t){this.helper=t}fillPolygons(t,i){let a=i.hachureGap<0?4*i.strokeWidth:i.hachureGap,e=i.zigzagOffset<0?a:i.zigzagOffset,r=Ct(t,i=Object.assign({},i,{hachureGap:a+e}));return{type:"fillSketch",ops:this.zigzagLines(r,e,i)}}zigzagLines(t,i,a){let e=[];return t.forEach((r=>{let h=jt(r),s=Math.round(h/(2*i)),c=r[0],n=r[1];c[0]>n[0]&&(c=r[1],n=r[0]);let l=Math.atan((n[1]-c[1])/(n[0]-c[0]));for(let g=0;g<s;g++){let f=2*g*i,p=2*(g+1)*i,u=Math.sqrt(2*Math.pow(i,2)),y=[c[0]+f*Math.cos(l),c[1]+f*Math.sin(l)],m=[c[0]+p*Math.cos(l),c[1]+p*Math.sin(l)],d=[y[0]+u*Math.cos(l+Math.PI/4),y[1]+u*Math.sin(l+Math.PI/4)];e.push(...this.helper.doubleLineOps(y[0],y[1],d[0],d[1],a),...this.helper.doubleLineOps(d[0],d[1],m[0],m[1],a))}})),e}},et={},ie=class{constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},ca=0,Jt=1,ve=2,Wt={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 Kt(o,t){return o.type===t}function pe(o){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:ca,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:Jt,text:`${parseFloat(RegExp.$1)}`},h=h.substr(RegExp.$1.length)}return s[s.length]={type:ve,text:""},s})(o),a="BOD",e=0,r=i[e];for(;!Kt(r,ve);){let h=0,s=[];if(a==="BOD"){if(r.text!=="M"&&r.text!=="m")return pe("M0,0"+o);e++,h=Wt[r.text],a=r.text}else Kt(r,Jt)?h=Wt[a]:(e++,h=Wt[r.text],a=r.text);if(!(e+h<i.length))throw new Error("Path data ended short");for(let c=e;c<e+h;c++){let n=i[c];if(!Kt(n,Jt))throw new Error("Param not a number: "+a+","+n.text);s[s.length]=+n.text}if(typeof Wt[a]!="number")throw new Error("Bad segment: "+a);{let c={key:a,data:s};t.push(c),e+=h,r=i[e],a==="M"&&(a="L"),a==="m"&&(a="l")}}return t}function Le(o){let t=0,i=0,a=0,e=0,r=[];for(let{key:h,data:s}of o)switch(h){case"M":r.push({key:"M",data:[...s]}),[t,i]=s,[a,e]=s;break;case"m":t+=s[0],i+=s[1],r.push({key:"M",data:[t,i]}),a=t,e=i;break;case"L":r.push({key:"L",data:[...s]}),[t,i]=s;break;case"l":t+=s[0],i+=s[1],r.push({key:"L",data:[t,i]});break;case"C":r.push({key:"C",data:[...s]}),t=s[4],i=s[5];break;case"c":{let c=s.map(((n,l)=>l%2?n+i:n+t));r.push({key:"C",data:c}),t=c[4],i=c[5];break}case"Q":r.push({key:"Q",data:[...s]}),t=s[2],i=s[3];break;case"q":{let c=s.map(((n,l)=>l%2?n+i:n+t));r.push({key:"Q",data:c}),t=c[2],i=c[3];break}case"A":r.push({key:"A",data:[...s]}),t=s[5],i=s[6];break;case"a":t+=s[5],i+=s[6],r.push({key:"A",data:[s[0],s[1],s[2],s[3],s[4],t,i]});break;case"H":r.push({key:"H",data:[...s]}),t=s[0];break;case"h":t+=s[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...s]}),i=s[0];break;case"v":i+=s[0],r.push({key:"V",data:[i]});break;case"S":r.push({key:"S",data:[...s]}),t=s[2],i=s[3];break;case"s":{let c=s.map(((n,l)=>l%2?n+i:n+t));r.push({key:"S",data:c}),t=c[2],i=c[3];break}case"T":r.push({key:"T",data:[...s]}),t=s[0],i=s[1];break;case"t":t+=s[0],i+=s[1],r.push({key:"T",data:[t,i]});break;case"Z":case"z":r.push({key:"Z",data:[]}),t=a,i=e}return r}function We(o){let t=[],i="",a=0,e=0,r=0,h=0,s=0,c=0;for(let{key:n,data:l}of o){switch(n){case"M":t.push({key:"M",data:[...l]}),[a,e]=l,[r,h]=l;break;case"C":t.push({key:"C",data:[...l]}),a=l[4],e=l[5],s=l[2],c=l[3];break;case"L":t.push({key:"L",data:[...l]}),[a,e]=l;break;case"H":a=l[0],t.push({key:"L",data:[a,e]});break;case"V":e=l[0],t.push({key:"L",data:[a,e]});break;case"S":{let g=0,f=0;i==="C"||i==="S"?(g=a+(a-s),f=e+(e-c)):(g=a,f=e),t.push({key:"C",data:[g,f,...l]}),s=l[0],c=l[1],a=l[2],e=l[3];break}case"T":{let[g,f]=l,p=0,u=0;i==="Q"||i==="T"?(p=a+(a-s),u=e+(e-c)):(p=a,u=e);let y=a+2*(p-a)/3,m=e+2*(u-e)/3,d=g+2*(p-g)/3,x=f+2*(u-f)/3;t.push({key:"C",data:[y,m,d,x,g,f]}),s=p,c=u,a=g,e=f;break}case"Q":{let[g,f,p,u]=l,y=a+2*(g-a)/3,m=e+2*(f-e)/3,d=p+2*(g-p)/3,x=u+2*(f-u)/3;t.push({key:"C",data:[y,m,d,x,p,u]}),s=g,c=f,a=p,e=u;break}case"A":{let g=Math.abs(l[0]),f=Math.abs(l[1]),p=l[2],u=l[3],y=l[4],m=l[5],d=l[6];g===0||f===0?(t.push({key:"C",data:[a,e,m,d,m,d]}),a=m,e=d):(a!==m||e!==d)&&(Te(a,e,m,d,g,f,p,u,y).forEach((function(x){t.push({key:"C",data:x})})),a=m,e=d);break}case"Z":t.push({key:"Z",data:[]}),a=r,e=h}i=n}return t}function Dt(o,t,i){return[o*Math.cos(i)-t*Math.sin(i),o*Math.sin(i)+t*Math.cos(i)]}function Te(o,t,i,a,e,r,h,s,c,n){let l=(g=h,Math.PI*g/180);var g;let f=[],p=0,u=0,y=0,m=0;if(n)[p,u,y,m]=n;else{[o,t]=Dt(o,t,-l),[i,a]=Dt(i,a,-l);let P=(o-i)/2,C=(t-a)/2,E=P*P/(e*e)+C*C/(r*r);E>1&&(E=Math.sqrt(E),e*=E,r*=E);let R=e*e,O=r*r,z=R*O-R*C*C-O*P*P,Z=R*C*C+O*P*P,rt=(s===c?-1:1)*Math.sqrt(Math.abs(z/Z));y=rt*e*C/r+(o+i)/2,m=rt*-r*P/e+(t+a)/2,p=Math.asin(parseFloat(((t-m)/r).toFixed(9))),u=Math.asin(parseFloat(((a-m)/r).toFixed(9))),o<y&&(p=Math.PI-p),i<y&&(u=Math.PI-u),p<0&&(p=2*Math.PI+p),u<0&&(u=2*Math.PI+u),c&&p>u&&(p-=2*Math.PI),!c&&u>p&&(u-=2*Math.PI)}let d=u-p;if(Math.abs(d)>120*Math.PI/180){let P=u,C=i,E=a;u=c&&u>p?p+120*Math.PI/180*1:p+120*Math.PI/180*-1,f=Te(i=y+e*Math.cos(u),a=m+r*Math.sin(u),C,E,e,r,h,0,c,[u,P,y,m])}d=u-p;let x=Math.cos(p),b=Math.sin(p),M=Math.cos(u),w=Math.sin(u),k=Math.tan(d/4),v=4/3*e*k,D=4/3*r*k,B=[o,t],L=[o+v*b,t-D*x],A=[i+v*w,a-D*M],I=[i,a];if(L[0]=2*B[0]-L[0],L[1]=2*B[1]-L[1],n)return[L,A,I].concat(f);{f=[L,A,I].concat(f);let P=[];for(let C=0;C<f.length;C+=3){let E=Dt(f[C][0],f[C][1],l),R=Dt(f[C+1][0],f[C+1][1],l),O=Dt(f[C+2][0],f[C+2][1],l);P.push([E[0],E[1],R[0],R[1],O[0],O[1]])}return P}}var oa={randOffset:function(o,t){return j(o,t)},randOffsetWithRange:function(o,t,i){return Ot(o,t,i)},ellipse:function(o,t,i,a,e){let r=Ie(i,a,e);return le(o,t,e,r).opset},doubleLineOps:function(o,t,i,a,e){return gt(o,t,i,a,e,!0)}};function He(o,t,i,a,e){return{type:"path",ops:gt(o,t,i,a,e)}}function It(o,t,i){let a=(o||[]).length;if(a>2){let e=[];for(let r=0;r<a-1;r++)e.push(...gt(o[r][0],o[r][1],o[r+1][0],o[r+1][1],i));return t&&e.push(...gt(o[a-1][0],o[a-1][1],o[0][0],o[0][1],i)),{type:"path",ops:e}}return a===2?He(o[0][0],o[0][1],o[1][0],o[1][1],i):{type:"path",ops:[]}}function ha(o,t,i,a,e){return(function(r,h){return It(r,!0,h)})([[o,t],[o+i,t],[o+i,t+a],[o,t+a]],e)}function De(o,t){if(o.length){let i=typeof o[0][0]=="number"?[o]:o,a=Tt(i[0],1*(1+.2*t.roughness),t),e=t.disableMultiStroke?[]:Tt(i[0],1.5*(1+.22*t.roughness),Ce(t));for(let r=1;r<i.length;r++){let h=i[r];if(h.length){let s=Tt(h,1*(1+.2*t.roughness),t),c=t.disableMultiStroke?[]:Tt(h,1.5*(1+.22*t.roughness),Ce(t));for(let n of s)n.op!=="move"&&a.push(n);for(let n of c)n.op!=="move"&&e.push(n)}}return{type:"path",ops:a.concat(e)}}return{type:"path",ops:[]}}function Ie(o,t,i){let a=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(o/2,2)+Math.pow(t/2,2))/2)),e=Math.ceil(Math.max(i.curveStepCount,i.curveStepCount/Math.sqrt(200)*a)),r=2*Math.PI/e,h=Math.abs(o/2),s=Math.abs(t/2),c=1-i.curveFitting;return h+=j(h*c,i),s+=j(s*c,i),{increment:r,rx:h,ry:s}}function le(o,t,i,a){let[e,r]=Ne(a.increment,o,t,a.rx,a.ry,1,a.increment*Ot(.1,Ot(.4,1,i),i),i),h=_t(e,null,i);if(!i.disableMultiStroke&&i.roughness!==0){let[s]=Ne(a.increment,o,t,a.rx,a.ry,1.5,0,i),c=_t(s,null,i);h=h.concat(c)}return{estimatedPoints:r,opset:{type:"path",ops:h}}}function Pe(o,t,i,a,e,r,h,s,c){let n=o,l=t,g=Math.abs(i/2),f=Math.abs(a/2);g+=j(.01*g,c),f+=j(.01*f,c);let p=e,u=r;for(;p<0;)p+=2*Math.PI,u+=2*Math.PI;u-p>2*Math.PI&&(p=0,u=2*Math.PI);let y=2*Math.PI/c.curveStepCount,m=Math.min(y/2,(u-p)/2),d=Re(m,n,l,g,f,p,u,1,c);if(!c.disableMultiStroke){let x=Re(m,n,l,g,f,p,u,1.5,c);d.push(...x)}return h&&(s?d.push(...gt(n,l,n+g*Math.cos(p),l+f*Math.sin(p),c),...gt(n,l,n+g*Math.cos(u),l+f*Math.sin(u),c)):d.push({op:"lineTo",data:[n,l]},{op:"lineTo",data:[n+g*Math.cos(p),l+f*Math.sin(p)]})),{type:"path",ops:d}}function Be(o,t){let i=We(Le(pe(o))),a=[],e=[0,0],r=[0,0];for(let{key:h,data:s}of i)switch(h){case"M":r=[s[0],s[1]],e=[s[0],s[1]];break;case"L":a.push(...gt(r[0],r[1],s[0],s[1],t)),r=[s[0],s[1]];break;case"C":{let[c,n,l,g,f,p]=s;a.push(...ga(c,n,l,g,f,p,r,t)),r=[f,p];break}case"Z":a.push(...gt(r[0],r[1],e[0],e[1],t)),r=[e[0],e[1]]}return{type:"path",ops:a}}function Ut(o,t){let i=[];for(let a of o)if(a.length){let e=t.maxRandomnessOffset||0,r=a.length;if(r>2){i.push({op:"move",data:[a[0][0]+j(e,t),a[0][1]+j(e,t)]});for(let h=1;h<r;h++)i.push({op:"lineTo",data:[a[h][0]+j(e,t),a[h][1]+j(e,t)]})}}return{type:"fillPath",ops:i}}function bt(o,t){return(function(i,a){let e=i.fillStyle||"hachure";if(!et[e])switch(e){case"zigzag":et[e]||(et[e]=new ee(a));break;case"cross-hatch":et[e]||(et[e]=new se(a));break;case"dots":et[e]||(et[e]=new ae(a));break;case"dashed":et[e]||(et[e]=new re(a));break;case"zigzag-line":et[e]||(et[e]=new ne(a));break;default:e="hachure",et[e]||(et[e]=new Bt(a))}return et[e]})(t,oa).fillPolygons(o,t)}function Ce(o){let t=Object.assign({},o);return t.randomizer=void 0,o.seed&&(t.seed=o.seed+1),t}function Ee(o){return o.randomizer||(o.randomizer=new ie(o.seed||0)),o.randomizer.next()}function Ot(o,t,i,a=1){return i.roughness*a*(Ee(i)*(t-o)+o)}function j(o,t,i=1){return Ot(-o,o,t,i)}function gt(o,t,i,a,e,r=!1){let h=r?e.disableMultiStrokeFill:e.disableMultiStroke,s=ce(o,t,i,a,e,!0,!1);if(h)return s;let c=ce(o,t,i,a,e,!0,!0);return s.concat(c)}function ce(o,t,i,a,e,r,h){let s=Math.pow(o-i,2)+Math.pow(t-a,2),c=Math.sqrt(s),n=1;n=c<200?1:c>500?.4:-.0016668*c+1.233334;let l=e.maxRandomnessOffset||0;l*l*100>s&&(l=c/10);let g=l/2,f=.2+.2*Ee(e),p=e.bowing*e.maxRandomnessOffset*(a-t)/200,u=e.bowing*e.maxRandomnessOffset*(o-i)/200;p=j(p,e,n),u=j(u,e,n);let y=[],m=()=>j(g,e,n),d=()=>j(l,e,n),x=e.preserveVertices;return r&&(h?y.push({op:"move",data:[o+(x?0:m()),t+(x?0:m())]}):y.push({op:"move",data:[o+(x?0:j(l,e,n)),t+(x?0:j(l,e,n))]})),h?y.push({op:"bcurveTo",data:[p+o+(i-o)*f+m(),u+t+(a-t)*f+m(),p+o+2*(i-o)*f+m(),u+t+2*(a-t)*f+m(),i+(x?0:m()),a+(x?0:m())]}):y.push({op:"bcurveTo",data:[p+o+(i-o)*f+d(),u+t+(a-t)*f+d(),p+o+2*(i-o)*f+d(),u+t+2*(a-t)*f+d(),i+(x?0:d()),a+(x?0:d())]}),y}function Tt(o,t,i){if(!o.length)return[];let a=[];a.push([o[0][0]+j(t,i),o[0][1]+j(t,i)]),a.push([o[0][0]+j(t,i),o[0][1]+j(t,i)]);for(let e=1;e<o.length;e++)a.push([o[e][0]+j(t,i),o[e][1]+j(t,i)]),e===o.length-1&&a.push([o[e][0]+j(t,i),o[e][1]+j(t,i)]);return _t(a,null,i)}function _t(o,t,i){let a=o.length,e=[];if(a>3){let r=[],h=1-i.curveTightness;e.push({op:"move",data:[o[1][0],o[1][1]]});for(let s=1;s+2<a;s++){let c=o[s];r[0]=[c[0],c[1]],r[1]=[c[0]+(h*o[s+1][0]-h*o[s-1][0])/6,c[1]+(h*o[s+1][1]-h*o[s-1][1])/6],r[2]=[o[s+1][0]+(h*o[s][0]-h*o[s+2][0])/6,o[s+1][1]+(h*o[s][1]-h*o[s+2][1])/6],r[3]=[o[s+1][0],o[s+1][1]],e.push({op:"bcurveTo",data:[r[1][0],r[1][1],r[2][0],r[2][1],r[3][0],r[3][1]]})}if(t&&t.length===2){let s=i.maxRandomnessOffset;e.push({op:"lineTo",data:[t[0]+j(s,i),t[1]+j(s,i)]})}}else a===3?(e.push({op:"move",data:[o[1][0],o[1][1]]}),e.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[2][0],o[2][1]]})):a===2&&e.push(...ce(o[0][0],o[0][1],o[1][0],o[1][1],i,!0,!0));return e}function Ne(o,t,i,a,e,r,h,s){let c=[],n=[];if(s.roughness===0){o/=4,n.push([t+a*Math.cos(-o),i+e*Math.sin(-o)]);for(let l=0;l<=2*Math.PI;l+=o){let g=[t+a*Math.cos(l),i+e*Math.sin(l)];c.push(g),n.push(g)}n.push([t+a*Math.cos(0),i+e*Math.sin(0)]),n.push([t+a*Math.cos(o),i+e*Math.sin(o)])}else{let l=j(.5,s)-Math.PI/2;n.push([j(r,s)+t+.9*a*Math.cos(l-o),j(r,s)+i+.9*e*Math.sin(l-o)]);let g=2*Math.PI+l-.01;for(let f=l;f<g;f+=o){let p=[j(r,s)+t+a*Math.cos(f),j(r,s)+i+e*Math.sin(f)];c.push(p),n.push(p)}n.push([j(r,s)+t+a*Math.cos(l+2*Math.PI+.5*h),j(r,s)+i+e*Math.sin(l+2*Math.PI+.5*h)]),n.push([j(r,s)+t+.98*a*Math.cos(l+h),j(r,s)+i+.98*e*Math.sin(l+h)]),n.push([j(r,s)+t+.9*a*Math.cos(l+.5*h),j(r,s)+i+.9*e*Math.sin(l+.5*h)])}return[n,c]}function Re(o,t,i,a,e,r,h,s,c){let n=r+j(.1,c),l=[];l.push([j(s,c)+t+.9*a*Math.cos(n-o),j(s,c)+i+.9*e*Math.sin(n-o)]);for(let g=n;g<=h;g+=o)l.push([j(s,c)+t+a*Math.cos(g),j(s,c)+i+e*Math.sin(g)]);return l.push([t+a*Math.cos(h),i+e*Math.sin(h)]),l.push([t+a*Math.cos(h),i+e*Math.sin(h)]),_t(l,null,c)}function ga(o,t,i,a,e,r,h,s){let c=[],n=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],l=[0,0],g=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<g;p++)p===0?c.push({op:"move",data:[h[0],h[1]]}):c.push({op:"move",data:[h[0]+(f?0:j(n[0],s)),h[1]+(f?0:j(n[0],s))]}),l=f?[e,r]:[e+j(n[p],s),r+j(n[p],s)],c.push({op:"bcurveTo",data:[o+j(n[p],s),t+j(n[p],s),i+j(n[p],s),a+j(n[p],s),l[0],l[1]]});return c}function Pt(o){return[...o]}function Ae(o,t=0){let i=o.length;if(i<3)throw new Error("A curve must have at least three points.");let a=[];if(i===3)a.push(Pt(o[0]),Pt(o[1]),Pt(o[2]),Pt(o[2]));else{let e=[];e.push(o[0],o[0]);for(let s=1;s<o.length;s++)e.push(o[s]),s===o.length-1&&e.push(o[s]);let r=[],h=1-t;a.push(Pt(e[0]));for(let s=1;s+2<e.length;s++){let c=e[s];r[0]=[c[0],c[1]],r[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],r[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],r[3]=[e[s+1][0],e[s+1][1]],a.push(r[1],r[2],r[3])}}return a}function Et(o,t){return Math.pow(o[0]-t[0],2)+Math.pow(o[1]-t[1],2)}function pa(o,t,i){let a=Et(t,i);if(a===0)return Et(o,t);let e=((o[0]-t[0])*(i[0]-t[0])+(o[1]-t[1])*(i[1]-t[1]))/a;return e=Math.max(0,Math.min(1,e)),Et(o,dt(t,i,e))}function dt(o,t,i){return[o[0]+(t[0]-o[0])*i,o[1]+(t[1]-o[1])*i]}function oe(o,t,i,a){let e=a||[];if((function(s,c){let n=s[c+0],l=s[c+1],g=s[c+2],f=s[c+3],p=3*l[0]-2*n[0]-f[0];p*=p;let u=3*l[1]-2*n[1]-f[1];u*=u;let y=3*g[0]-2*f[0]-n[0];y*=y;let m=3*g[1]-2*f[1]-n[1];return m*=m,p<y&&(p=y),u<m&&(u=m),p+u})(o,t)<i){let s=o[t+0];e.length?(r=e[e.length-1],h=s,Math.sqrt(Et(r,h))>1&&e.push(s)):e.push(s),e.push(o[t+3])}else{let c=o[t+0],n=o[t+1],l=o[t+2],g=o[t+3],f=dt(c,n,.5),p=dt(n,l,.5),u=dt(l,g,.5),y=dt(f,p,.5),m=dt(p,u,.5),d=dt(y,m,.5);oe([c,f,y,d],0,i,e),oe([d,m,u,g],0,i,e)}var r,h;return e}function fa(o,t){return zt(o,0,o.length,t)}function zt(o,t,i,a,e){let r=e||[],h=o[t],s=o[i-1],c=0,n=1;for(let l=t+1;l<i-1;++l){let g=pa(o[l],h,s);g>c&&(c=g,n=l)}return Math.sqrt(c)>a?(zt(o,t,n+1,a,r),zt(o,n,i,a,r)):(r.length||r.push(h),r.push(s)),r}function te(o,t=.15,i){let a=[],e=(o.length-1)/3;for(let r=0;r<e;r++)oe(o,3*r,t,a);return i&&i>0?zt(a,0,a.length,i):a}var at="none",wt=class{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,a){return{shape:t,sets:i||[],options:a||this.defaultOptions}}line(t,i,a,e,r){let h=this._o(r);return this._d("line",[He(t,i,a,e,h)],h)}rectangle(t,i,a,e,r){let h=this._o(r),s=[],c=ha(t,i,a,e,h);if(h.fill){let n=[[t,i],[t+a,i],[t+a,i+e],[t,i+e]];h.fillStyle==="solid"?s.push(Ut([n],h)):s.push(bt([n],h))}return h.stroke!==at&&s.push(c),this._d("rectangle",s,h)}ellipse(t,i,a,e,r){let h=this._o(r),s=[],c=Ie(a,e,h),n=le(t,i,h,c);if(h.fill)if(h.fillStyle==="solid"){let l=le(t,i,h,c).opset;l.type="fillPath",s.push(l)}else s.push(bt([n.estimatedPoints],h));return h.stroke!==at&&s.push(n.opset),this._d("ellipse",s,h)}circle(t,i,a,e){let r=this.ellipse(t,i,a,a,e);return r.shape="circle",r}linearPath(t,i){let a=this._o(i);return this._d("linearPath",[It(t,!1,a)],a)}arc(t,i,a,e,r,h,s=!1,c){let n=this._o(c),l=[],g=Pe(t,i,a,e,r,h,s,!0,n);if(s&&n.fill)if(n.fillStyle==="solid"){let f=Object.assign({},n);f.disableMultiStroke=!0;let p=Pe(t,i,a,e,r,h,!0,!1,f);p.type="fillPath",l.push(p)}else l.push((function(f,p,u,y,m,d,x){let b=f,M=p,w=Math.abs(u/2),k=Math.abs(y/2);w+=j(.01*w,x),k+=j(.01*k,x);let v=m,D=d;for(;v<0;)v+=2*Math.PI,D+=2*Math.PI;D-v>2*Math.PI&&(v=0,D=2*Math.PI);let B=(D-v)/x.curveStepCount,L=[];for(let A=v;A<=D;A+=B)L.push([b+w*Math.cos(A),M+k*Math.sin(A)]);return L.push([b+w*Math.cos(D),M+k*Math.sin(D)]),L.push([b,M]),bt([L],x)})(t,i,a,e,r,h,n));return n.stroke!==at&&l.push(g),this._d("arc",l,n)}curve(t,i){let a=this._o(i),e=[],r=De(t,a);if(a.fill&&a.fill!==at)if(a.fillStyle==="solid"){let h=De(t,Object.assign(Object.assign({},a),{disableMultiStroke:!0,roughness:a.roughness?a.roughness+a.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 n of c)n.length<3?h.push(...n):n.length===3?h.push(...te(Ae([n[0],n[0],n[1],n[2]]),10,(1+a.roughness)/2)):h.push(...te(Ae(n),10,(1+a.roughness)/2))}h.length&&e.push(bt([h],a))}return a.stroke!==at&&e.push(r),this._d("curve",e,a)}polygon(t,i){let a=this._o(i),e=[],r=It(t,!0,a);return a.fill&&(a.fillStyle==="solid"?e.push(Ut([t],a)):e.push(bt([t],a))),a.stroke!==at&&e.push(r),this._d("polygon",e,a)}path(t,i){let a=this._o(i),e=[];if(!t)return this._d("path",e,a);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let r=a.fill&&a.fill!=="transparent"&&a.fill!==at,h=a.stroke!==at,s=!!(a.simplification&&a.simplification<1),c=(function(l,g,f){let p=We(Le(pe(l))),u=[],y=[],m=[0,0],d=[],x=()=>{d.length>=4&&y.push(...te(d,g)),d=[]},b=()=>{x(),y.length&&(u.push(y),y=[])};for(let{key:w,data:k}of p)switch(w){case"M":b(),m=[k[0],k[1]],y.push(m);break;case"L":x(),y.push([k[0],k[1]]);break;case"C":if(!d.length){let v=y.length?y[y.length-1]:m;d.push([v[0],v[1]])}d.push([k[0],k[1]]),d.push([k[2],k[3]]),d.push([k[4],k[5]]);break;case"Z":x(),y.push([m[0],m[1]])}if(b(),!f)return u;let M=[];for(let w of u){let k=fa(w,f);k.length&&M.push(k)}return M})(t,1,s?4-4*(a.simplification||1):(1+a.roughness)/2),n=Be(t,a);if(r)if(a.fillStyle==="solid")if(c.length===1){let l=Be(t,Object.assign(Object.assign({},a),{disableMultiStroke:!0,roughness:a.roughness?a.roughness+a.fillShapeRoughnessGain:0}));e.push({type:"fillPath",ops:this._mergedShape(l.ops)})}else e.push(Ut(c,a));else e.push(bt(c,a));return h&&(s?c.forEach((l=>{e.push(It(l,!1,a))})):e.push(n)),this._d("path",e,a)}opsToPath(t,i){let a="";for(let e of t.ops){let r=typeof i=="number"&&i>=0?e.data.map((h=>+h.toFixed(i))):e.data;switch(e.op){case"move":a+=`M${r[0]} ${r[1]} `;break;case"bcurveTo":a+=`C${r[0]} ${r[1]}, ${r[2]} ${r[3]}, ${r[4]} ${r[5]} `;break;case"lineTo":a+=`L${r[0]} ${r[1]} `}}return a.trim()}toPaths(t){let i=t.sets||[],a=t.options||this.defaultOptions,e=[];for(let r of i){let h=null;switch(r.type){case"path":h={d:this.opsToPath(r),stroke:a.stroke,strokeWidth:a.strokeWidth,fill:at};break;case"fillPath":h={d:this.opsToPath(r),stroke:at,strokeWidth:0,fill:a.fill||at};break;case"fillSketch":h=this.fillSketch(r,a)}h&&e.push(h)}return e}fillSketch(t,i){let a=i.fillWeight;return a<0&&(a=i.strokeWidth/2),{d:this.opsToPath(t),stroke:i.fill||at,strokeWidth:a,fill:at}}_mergedShape(t){return t.filter(((i,a)=>a===0||i.op!=="move"))}},he=class{constructor(t,i){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new wt(i)}draw(t){let i=t.sets||[],a=t.options||this.getDefaultOptions(),e=this.ctx,r=t.options.fixedDecimalPlaceDigits;for(let h of i)switch(h.type){case"path":e.save(),e.strokeStyle=a.stroke==="none"?"transparent":a.stroke,e.lineWidth=a.strokeWidth,a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),this._drawToContext(e,h,r),e.restore();break;case"fillPath":{e.save(),e.fillStyle=a.fill||"";let s=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(e,h,r,s),e.restore();break}case"fillSketch":this.fillSketch(e,h,a)}}fillSketch(t,i,a){let e=a.fillWeight;e<0&&(e=a.strokeWidth/2),t.save(),a.fillLineDash&&t.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(t.lineDashOffset=a.fillLineDashOffset),t.strokeStyle=a.fill||"",t.lineWidth=e,this._drawToContext(t,i,a.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,i,a,e="nonzero"){t.beginPath();for(let r of i.ops){let h=typeof a=="number"&&a>=0?r.data.map((s=>+s.toFixed(a))):r.data;switch(r.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,a,e,r){let h=this.gen.line(t,i,a,e,r);return this.draw(h),h}rectangle(t,i,a,e,r){let h=this.gen.rectangle(t,i,a,e,r);return this.draw(h),h}ellipse(t,i,a,e,r){let h=this.gen.ellipse(t,i,a,e,r);return this.draw(h),h}circle(t,i,a,e){let r=this.gen.circle(t,i,a,e);return this.draw(r),r}linearPath(t,i){let a=this.gen.linearPath(t,i);return this.draw(a),a}polygon(t,i){let a=this.gen.polygon(t,i);return this.draw(a),a}arc(t,i,a,e,r,h,s=!1,c){let n=this.gen.arc(t,i,a,e,r,h,s,c);return this.draw(n),n}curve(t,i){let a=this.gen.curve(t,i);return this.draw(a),a}path(t,i){let a=this.gen.path(t,i);return this.draw(a),a}},Ht="http://www.w3.org/2000/svg",ge=class{constructor(t,i){this.svg=t,this.gen=new wt(i)}draw(t){let i=t.sets||[],a=t.options||this.getDefaultOptions(),e=this.svg.ownerDocument||window.document,r=e.createElementNS(Ht,"g"),h=t.options.fixedDecimalPlaceDigits;for(let s of i){let c=null;switch(s.type){case"path":c=e.createElementNS(Ht,"path"),c.setAttribute("d",this.opsToPath(s,h)),c.setAttribute("stroke",a.stroke),c.setAttribute("stroke-width",a.strokeWidth+""),c.setAttribute("fill","none"),a.strokeLineDash&&c.setAttribute("stroke-dasharray",a.strokeLineDash.join(" ").trim()),a.strokeLineDashOffset&&c.setAttribute("stroke-dashoffset",`${a.strokeLineDashOffset}`);break;case"fillPath":c=e.createElementNS(Ht,"path"),c.setAttribute("d",this.opsToPath(s,h)),c.setAttribute("stroke","none"),c.setAttribute("stroke-width","0"),c.setAttribute("fill",a.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||c.setAttribute("fill-rule","evenodd");break;case"fillSketch":c=this.fillSketch(e,s,a)}c&&r.appendChild(c)}return r}fillSketch(t,i,a){let e=a.fillWeight;e<0&&(e=a.strokeWidth/2);let r=t.createElementNS(Ht,"path");return r.setAttribute("d",this.opsToPath(i,a.fixedDecimalPlaceDigits)),r.setAttribute("stroke",a.fill||""),r.setAttribute("stroke-width",e+""),r.setAttribute("fill","none"),a.fillLineDash&&r.setAttribute("stroke-dasharray",a.fillLineDash.join(" ").trim()),a.fillLineDashOffset&&r.setAttribute("stroke-dashoffset",`${a.fillLineDashOffset}`),r}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,i){return this.gen.opsToPath(t,i)}line(t,i,a,e,r){let h=this.gen.line(t,i,a,e,r);return this.draw(h)}rectangle(t,i,a,e,r){let h=this.gen.rectangle(t,i,a,e,r);return this.draw(h)}ellipse(t,i,a,e,r){let h=this.gen.ellipse(t,i,a,e,r);return this.draw(h)}circle(t,i,a,e){let r=this.gen.circle(t,i,a,e);return this.draw(r)}linearPath(t,i){let a=this.gen.linearPath(t,i);return this.draw(a)}polygon(t,i){let a=this.gen.polygon(t,i);return this.draw(a)}arc(t,i,a,e,r,h,s=!1,c){let n=this.gen.arc(t,i,a,e,r,h,s,c);return this.draw(n)}curve(t,i){let a=this.gen.curve(t,i);return this.draw(a)}path(t,i){let a=this.gen.path(t,i);return this.draw(a)}},S={canvas:(o,t)=>new he(o,t),svg:(o,t)=>new ge(o,t),generator:o=>new wt(o),newSeed:()=>wt.newSeed()};var G=$(async(o,t,i)=>{let a,e=t.useHtmlLabels||J(V()?.htmlLabels);i?a=i:a="node default";let r=o.insert("g").attr("class",a).attr("id",t.domId||t.id),h=r.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 c=await ht(h,Lt(xt(s),V()),{useHtmlLabels:e,width:t.width||V().flowchart?.wrappingWidth,cssClasses:"markdown-node-label",style:t.labelStyle,addSvgBackground:!!t.icon||!!t.img}),n=c.getBBox(),l=(t?.padding??0)/2;if(e){let g=c.children[0],f=Y(c),p=g.getElementsByTagName("img");if(p){let u=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(y=>new Promise(m=>{function d(){if(y.style.display="flex",y.style.flexDirection="column",u){let x=V().fontSize?V().fontSize:window.getComputedStyle(document.body).fontSize,b=5,[M=we.fontSize]=ke(x),w=M*b+"px";y.style.minWidth=w,y.style.maxWidth=w}else y.style.width="100%";m(y)}$(d,"setupImage"),setTimeout(()=>{y.complete&&d()}),y.addEventListener("error",d),y.addEventListener("load",d)})))}n=g.getBoundingClientRect(),f.attr("width",n.width),f.attr("height",n.height)}return e?h.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"):h.attr("transform","translate(0, "+-n.height/2+")"),t.centerLabel&&h.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"),h.insert("rect",":first-child"),{shapeSvg:r,bbox:n,halfPadding:l,label:h}},"labelHelper"),fe=$(async(o,t,i)=>{let a=i.useHtmlLabels||J(V()?.flowchart?.htmlLabels),e=o.insert("g").attr("class","label").attr("style",i.labelStyle||""),r=await ht(e,Lt(xt(t),V()),{useHtmlLabels:a,width:i.width||V()?.flowchart?.wrappingWidth,style:i.labelStyle,addSvgBackground:!!i.icon||!!i.img}),h=r.getBBox(),s=i.padding/2;if(J(V()?.flowchart?.htmlLabels)){let c=r.children[0],n=Y(r);h=c.getBoundingClientRect(),n.attr("width",h.width),n.attr("height",h.height)}return a?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:o,bbox:h,halfPadding:s,label:e}},"insertLabel"),H=$((o,t)=>{let i=t.node().getBBox();o.width=i.width,o.height=i.height},"updateNodeBounds"),_=$((o,t)=>(o.look==="handDrawn"?"rough-node":"node")+" "+o.cssClasses+" "+(t||""),"getNodeClasses");function q(o){let t=o.map((i,a)=>`${a===0?"M":"L"}${i.x},${i.y}`);return t.push("Z"),t.join(" ")}$(q,"createPathFromPoints");function pt(o,t,i,a,e,r){let h=[],c=i-o,n=a-t,l=c/r,g=2*Math.PI/l,f=t+n/2;for(let p=0;p<=50;p++){let u=p/50,y=o+u*c,m=f+e*Math.sin(g*(y-o));h.push({x:y,y:m})}return h}$(pt,"generateFullSineWavePoints");function At(o,t,i,a,e,r){let h=[],s=e*Math.PI/180,l=(r*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*l,p=o+i*Math.cos(f),u=t+i*Math.sin(f);h.push({x:-p,y:-u})}return h}$(At,"generateCirclePoints");var ua=$((o,t)=>{var i=o.x,a=o.y,e=t.x-i,r=t.y-a,h=o.width/2,s=o.height/2,c,n;return Math.abs(r)*h>Math.abs(e)*s?(r<0&&(s=-s),c=r===0?0:s*e/r,n=s):(e<0&&(h=-h),c=h,n=e===0?0:h*r/e),{x:i+c,y:a+n}},"intersectRect"),$t=ua;function Oe(o,t){t&&o.attr("style",t)}$(Oe,"applyStyle");async function _e(o){let t=Y(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),i=t.append("xhtml:div"),a=V(),e=o.label;o.label&&Yt(o.label)&&(e=await Se(o.label.replace($e.lineBreakRegex,`
|
|
`),a));let h='<span class="'+(o.isNode?"nodeLabel":"edgeLabel")+'" '+(o.labelStyle?'style="'+o.labelStyle+'"':"")+">"+e+"</span>";return i.html(Lt(h,a)),Oe(i,o.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()}$(_e,"addHtmlLabel");var ya=$(async(o,t,i,a)=>{let e=o||"";if(typeof e=="object"&&(e=e[0]),J(V().flowchart.htmlLabels)){e=e.replace(/\\n|\n/g,"<br />"),F.info("vertexText"+e);let r={isNode:a,label:xt(e).replace(/fa[blrs]?:fa-[\w-]+/g,s=>`<i class='${s.replace(":"," ")}'></i>`),labelStyle:t&&t.replace("fill:","color:")};return await _e(r)}else{let r=document.createElementNS("http://www.w3.org/2000/svg","text");r.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"),i?c.setAttribute("class","title-row"):c.setAttribute("class","row"),c.textContent=s.trim(),r.appendChild(c)}return r}},"createLabel"),ue=ya,ft=$((o,t,i,a,e)=>["M",o+e,t,"H",o+i-e,"A",e,e,0,0,1,o+i,t+e,"V",t+a-e,"A",e,e,0,0,1,o+i-e,t+a,"H",o+e,"A",e,e,0,0,1,o,t+a-e,"V",t+e,"A",e,e,0,0,1,o+e,t,"Z"].join(" "),"createRoundedRectPathD"),ze=$(async(o,t)=>{F.info("Creating subgraph rect for ",t.id,t);let i=V(),{themeVariables:a,handDrawnSeed:e}=i,{clusterBkg:r,clusterBorder:h}=a,{labelStyles:s,nodeStyles:c,borderStyles:n,backgroundStyles:l}=T(t),g=o.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=J(i.flowchart.htmlLabels),p=g.insert("g").attr("class","cluster-label "),u=await ht(p,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0}),y=u.getBBox();if(J(i.flowchart.htmlLabels)){let v=u.children[0],D=Y(u);y=v.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}let m=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;let d=t.height,x=t.x-m/2,b=t.y-d/2;F.trace("Data ",t,JSON.stringify(t));let M;if(t.look==="handDrawn"){let v=S.svg(g),D=W(t,{roughness:.7,fill:r,stroke:h,fillWeight:3,seed:e}),B=v.path(ft(x,b,m,d,0),D);M=g.insert(()=>(F.debug("Rough node insert CXC",B),B),":first-child"),M.select("path:nth-child(2)").attr("style",n.join(";")),M.select("path").attr("style",l.join(";").replace("fill","stroke"))}else M=g.insert("rect",":first-child"),M.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",b).attr("width",m).attr("height",d);let{subGraphTitleTopMargin:w}=Zt(i);if(p.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+w})`),s){let v=p.select("span");v&&v.attr("style",s)}let k=M.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=y.height-t.padding/2,t.intersect=function(v){return $t(t,v)},{cluster:g,labelBBox:y}},"rect"),da=$((o,t)=>{let i=o.insert("g").attr("class","note-cluster").attr("id",t.id),a=i.insert("rect",":first-child"),e=0*t.padding,r=e/2;a.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-r).attr("y",t.y-t.height/2-r).attr("width",t.width+e).attr("height",t.height+e).attr("fill","none");let h=a.node().getBBox();return t.width=h.width,t.height=h.height,t.intersect=function(s){return $t(t,s)},{cluster:i,labelBBox:{width:0,height:0}}},"noteGroup"),ma=$(async(o,t)=>{let i=V(),{themeVariables:a,handDrawnSeed:e}=i,{altBackground:r,compositeBackground:h,compositeTitleBackground:s,nodeBorder:c}=a,n=o.insert("g").attr("class",t.cssClasses).attr("id",t.id).attr("data-id",t.id).attr("data-look",t.look),l=n.insert("g",":first-child"),g=n.insert("g").attr("class","cluster-label"),f=n.append("rect"),p=g.node().appendChild(await ue(t.label,t.labelStyle,void 0,!0)),u=p.getBBox();if(J(i.flowchart.htmlLabels)){let B=p.children[0],L=Y(p);u=B.getBoundingClientRect(),L.attr("width",u.width),L.attr("height",u.height)}let y=0*t.padding,m=y/2,d=(t.width<=u.width+t.padding?u.width+t.padding:t.width)+y;t.width<=u.width+t.padding?t.diff=(d-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height+y,b=t.height+y-u.height-6,M=t.x-d/2,w=t.y-x/2;t.width=d;let k=t.y-t.height/2-m+u.height+2,v;if(t.look==="handDrawn"){let B=t.cssClasses.includes("statediagram-cluster-alt"),L=S.svg(n),A=t.rx||t.ry?L.path(ft(M,w,d,x,10),{roughness:.7,fill:s,fillStyle:"solid",stroke:c,seed:e}):L.rectangle(M,w,d,x,{seed:e});v=n.insert(()=>A,":first-child");let I=L.rectangle(M,k,d,b,{fill:B?r:h,fillStyle:B?"hachure":"solid",stroke:c,seed:e});v=n.insert(()=>A,":first-child"),f=n.insert(()=>I)}else v=l.insert("rect",":first-child"),v.attr("class","outer").attr("x",M).attr("y",w).attr("width",d).attr("height",x).attr("data-look",t.look),f.attr("class","inner").attr("x",M).attr("y",k).attr("width",d).attr("height",b);g.attr("transform",`translate(${t.x-u.width/2}, ${w+1-(J(i.flowchart.htmlLabels)?0:3)})`);let D=v.node().getBBox();return t.height=D.height,t.offsetX=0,t.offsetY=u.height-t.padding/2,t.labelBBox=u,t.intersect=function(B){return $t(t,B)},{cluster:n,labelBBox:u}},"roundedWithTitle"),xa=$(async(o,t)=>{F.info("Creating subgraph rect for ",t.id,t);let i=V(),{themeVariables:a,handDrawnSeed:e}=i,{clusterBkg:r,clusterBorder:h}=a,{labelStyles:s,nodeStyles:c,borderStyles:n,backgroundStyles:l}=T(t),g=o.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.id).attr("data-look",t.look),f=J(i.flowchart.htmlLabels),p=g.insert("g").attr("class","cluster-label "),u=await ht(p,t.label,{style:t.labelStyle,useHtmlLabels:f,isNode:!0,width:t.width}),y=u.getBBox();if(J(i.flowchart.htmlLabels)){let v=u.children[0],D=Y(u);y=v.getBoundingClientRect(),D.attr("width",y.width),D.attr("height",y.height)}let m=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(m-t.width)/2-t.padding:t.diff=-t.padding;let d=t.height,x=t.x-m/2,b=t.y-d/2;F.trace("Data ",t,JSON.stringify(t));let M;if(t.look==="handDrawn"){let v=S.svg(g),D=W(t,{roughness:.7,fill:r,stroke:h,fillWeight:4,seed:e}),B=v.path(ft(x,b,m,d,t.rx),D);M=g.insert(()=>(F.debug("Rough node insert CXC",B),B),":first-child"),M.select("path:nth-child(2)").attr("style",n.join(";")),M.select("path").attr("style",l.join(";").replace("fill","stroke"))}else M=g.insert("rect",":first-child"),M.attr("style",c).attr("rx",t.rx).attr("ry",t.ry).attr("x",x).attr("y",b).attr("width",m).attr("height",d);let{subGraphTitleTopMargin:w}=Zt(i);if(p.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+w})`),s){let v=p.select("span");v&&v.attr("style",s)}let k=M.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=y.height-t.padding/2,t.intersect=function(v){return $t(t,v)},{cluster:g,labelBBox:y}},"kanbanSection"),ba=$((o,t)=>{let i=V(),{themeVariables:a,handDrawnSeed:e}=i,{nodeBorder:r}=a,h=o.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,n=t.width+c;t.diff=-t.padding;let l=t.height+c,g=t.x-n/2,f=t.y-l/2;t.width=n;let p;if(t.look==="handDrawn"){let m=S.svg(h).rectangle(g,f,n,l,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:r,seed:e});p=h.insert(()=>m,":first-child")}else p=s.insert("rect",":first-child"),p.attr("class","divider").attr("x",g).attr("y",f).attr("width",n).attr("height",l).attr("data-look",t.look);let u=p.node().getBBox();return t.height=u.height,t.offsetX=0,t.offsetY=0,t.intersect=function(y){return $t(t,y)},{cluster:h,labelBBox:{}}},"divider"),wa=ze,Sa={rect:ze,squareRect:wa,roundedWithTitle:ma,noteGroup:da,divider:ba,kanbanSection:xa},je=new Map,Ua=$(async(o,t)=>{let i=t.shape||"rect",a=await Sa[i](o,t);return je.set(t.id,a),a},"insertCluster"),tr=$(()=>{je=new Map},"clear");function Ge(o,t){return o.intersect(t)}$(Ge,"intersectNode");var $a=Ge;function qe(o,t,i,a){var e=o.x,r=o.y,h=e-a.x,s=r-a.y,c=Math.sqrt(t*t*s*s+i*i*h*h),n=Math.abs(t*i*h/c);a.x<e&&(n=-n);var l=Math.abs(t*i*s/c);return a.y<r&&(l=-l),{x:e+n,y:r+l}}$(qe,"intersectEllipse");var Fe=qe;function Xe(o,t,i){return Fe(o,t,t,i)}$(Xe,"intersectCircle");var Ma=Xe;function Ye(o,t,i,a){{let e=t.y-o.y,r=o.x-t.x,h=t.x*o.y-o.x*t.y,s=e*i.x+r*i.y+h,c=e*a.x+r*a.y+h,n=1e-6;if(s!==0&&c!==0&&ye(s,c))return;let l=a.y-i.y,g=i.x-a.x,f=a.x*i.y-i.x*a.y,p=l*o.x+g*o.y+f,u=l*t.x+g*t.y+f;if(Math.abs(p)<n&&Math.abs(u)<n&&ye(p,u))return;let y=e*g-l*r;if(y===0)return;let m=Math.abs(y/2),d=r*f-g*h,x=d<0?(d-m)/y:(d+m)/y;d=l*h-e*f;let b=d<0?(d-m)/y:(d+m)/y;return{x,y:b}}}$(Ye,"intersectLine");function ye(o,t){return o*t>0}$(ye,"sameSign");var ka=Ye;function Ve(o,t,i){let a=o.x,e=o.y,r=[],h=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(l){h=Math.min(h,l.x),s=Math.min(s,l.y)}):(h=Math.min(h,t.x),s=Math.min(s,t.y));let c=a-o.width/2-h,n=e-o.height/2-s;for(let l=0;l<t.length;l++){let g=t[l],f=t[l<t.length-1?l+1:0],p=ka(o,i,{x:c+g.x,y:n+g.y},{x:c+f.x,y:n+f.y});p&&r.push(p)}return r.length?(r.length>1&&r.sort(function(l,g){let f=l.x-i.x,p=l.y-i.y,u=Math.sqrt(f*f+p*p),y=g.x-i.x,m=g.y-i.y,d=Math.sqrt(y*y+m*m);return u<d?-1:u===d?0:1}),r[0]):o}$(Ve,"intersectPolygon");var va=Ve,N={node:$a,circle:Ma,ellipse:Fe,polygon:va,rect:$t};function Ze(o,t){let{labelStyles:i}=T(t);t.labelStyle=i;let a=_(t),e=a;a||(e="anchor");let r=o.insert("g").attr("class",e).attr("id",t.domId||t.id),h=1,{cssStyles:s}=t,c=S.svg(r),n=W(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(n.roughness=0);let l=c.circle(0,0,h*2,n),g=r.insert(()=>l,":first-child");return g.attr("class","anchor").attr("style",U(s)),H(t,g),t.intersect=function(f){return F.info("Circle intersect",t,h,f),N.circle(t,h,f)},r}$(Ze,"anchor");function de(o,t,i,a,e,r,h){let c=(o+i)/2,n=(t+a)/2,l=Math.atan2(a-t,i-o),g=(i-o)/2,f=(a-t)/2,p=g/e,u=f/r,y=Math.sqrt(p**2+u**2);if(y>1)throw new Error("The given radii are too small to create an arc between the points.");let m=Math.sqrt(1-y**2),d=c+m*r*Math.sin(l)*(h?-1:1),x=n-m*e*Math.cos(l)*(h?-1:1),b=Math.atan2((t-x)/r,(o-d)/e),w=Math.atan2((a-x)/r,(i-d)/e)-b;h&&w<0&&(w+=2*Math.PI),!h&&w>0&&(w-=2*Math.PI);let k=[];for(let v=0;v<20;v++){let D=v/19,B=b+D*w,L=d+e*Math.cos(B),A=x+r*Math.sin(B);k.push({x:L,y:A})}return k}$(de,"generateArcPoints");async function Qe(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.width+t.padding+20,s=r.height+t.padding,c=s/2,n=c/(2.5+s/50),{cssStyles:l}=t,g=[{x:h/2,y:-s/2},{x:-h/2,y:-s/2},...de(-h/2,-s/2,-h/2,s/2,n,c,!1),{x:h/2,y:s/2},...de(h/2,s/2,h/2,-s/2,n,c,!0)],f=S.svg(e),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=q(g),y=f.path(u,p),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",l),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),m.attr("transform",`translate(${n/2}, 0)`),H(t,m),t.intersect=function(d){return N.polygon(t,g,d)},e}$(Qe,"bowTieRect");function ut(o,t,i,a){return o.insert("polygon",":first-child").attr("points",a.map(function(e){return e.x+","+e.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+i/2+")")}$(ut,"insertPolygonShape");async function Je(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.height+t.padding,s=12,c=r.width+t.padding+s,n=0,l=c,g=-h,f=0,p=[{x:n+s,y:g},{x:l,y:g},{x:l,y:f},{x:n,y:f},{x:n,y:g+s},{x:n+s,y:g}],u,{cssStyles:y}=t;if(t.look==="handDrawn"){let m=S.svg(e),d=W(t,{}),x=q(p),b=m.path(x,d);u=e.insert(()=>b,":first-child").attr("transform",`translate(${-c/2}, ${h/2})`),y&&u.attr("style",y)}else u=ut(e,c,h,p);return a&&u.attr("style",a),H(t,u),t.intersect=function(m){return N.polygon(t,p,m)},e}$(Je,"card");function Ke(o,t){let{nodeStyles:i}=T(t);t.label="";let a=o.insert("g").attr("class",_(t)).attr("id",t.domId??t.id),{cssStyles:e}=t,r=Math.max(28,t.width??0),h=[{x:0,y:r/2},{x:r/2,y:0},{x:0,y:-r/2},{x:-r/2,y:0}],s=S.svg(a),c=W(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");let n=q(h),l=s.path(n,c),g=a.insert(()=>l,":first-child");return e&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",e),i&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",i),t.width=28,t.height=28,t.intersect=function(f){return N.polygon(t,h,f)},a}$(Ke,"choice");async function me(o,t,i){let{labelStyles:a,nodeStyles:e}=T(t);t.labelStyle=a;let{shapeSvg:r,bbox:h,halfPadding:s}=await G(o,t,_(t)),c=i?.padding??s,n=h.width/2+c,l,{cssStyles:g}=t;if(t.look==="handDrawn"){let f=S.svg(r),p=W(t,{}),u=f.circle(0,0,n*2,p);l=r.insert(()=>u,":first-child"),l.attr("class","basic label-container").attr("style",U(g))}else l=r.insert("circle",":first-child").attr("class","basic label-container").attr("style",e).attr("r",n).attr("cx",0).attr("cy",0);return H(t,l),t.calcIntersect=function(f,p){let u=f.width/2;return N.circle(f,u,p)},t.intersect=function(f){return F.info("Circle intersect",t,n,f),N.circle(t,n,f)},r}$(me,"circle");function Ue(o){let t=Math.cos(Math.PI/4),i=Math.sin(Math.PI/4),a=o*2,e={x:a/2*t,y:a/2*i},r={x:-(a/2)*t,y:a/2*i},h={x:-(a/2)*t,y:-(a/2)*i},s={x:a/2*t,y:-(a/2)*i};return`M ${r.x},${r.y} L ${s.x},${s.y}
|
|
M ${e.x},${e.y} L ${h.x},${h.y}`}$(Ue,"createLine");function ts(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i,t.label="";let e=o.insert("g").attr("class",_(t)).attr("id",t.domId??t.id),r=Math.max(30,t?.width??0),{cssStyles:h}=t,s=S.svg(e),c=W(t,{});t.look!=="handDrawn"&&(c.roughness=0,c.fillStyle="solid");let n=s.circle(0,0,r*2,c),l=Ue(r),g=s.path(l,c),f=e.insert(()=>n,":first-child");return f.insert(()=>g),h&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",h),a&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",a),H(t,f),t.intersect=function(p){return F.info("crossedCircle intersect",t,{radius:r,point:p}),N.circle(t,r,p)},e}$(ts,"crossedCircle");function lt(o,t,i,a=100,e=0,r=180){let h=[],s=e*Math.PI/180,l=(r*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*l,p=o+i*Math.cos(f),u=t+i*Math.sin(f);h.push({x:-p,y:-u})}return h}$(lt,"generateCirclePoints");async function es(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=r.width+(t.padding??0),c=r.height+(t.padding??0),n=Math.max(5,c*.1),{cssStyles:l}=t,g=[...lt(s/2,-c/2,n,30,-90,0),{x:-s/2-n,y:n},...lt(s/2+n*2,-n,n,20,-180,-270),...lt(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:-c/2},...lt(s/2,c/2,n,20,0,90)],f=[{x:s/2,y:-c/2-n},{x:-s/2,y:-c/2-n},...lt(s/2,-c/2,n,20,-90,0),{x:-s/2-n,y:-n},...lt(s/2+s*.1,-n,n,20,-180,-270),...lt(s/2+s*.1,n,n,20,-90,-180),{x:-s/2-n,y:c/2},...lt(s/2,c/2,n,20,0,90),{x:-s/2,y:c/2+n},{x:s/2,y:c/2+n}],p=S.svg(e),u=W(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let m=q(g).replace("Z",""),d=p.path(m,u),x=q(f),b=p.path(x,{...u}),M=e.insert("g",":first-child");return M.insert(()=>b,":first-child").attr("stroke-opacity",0),M.insert(()=>d,":first-child"),M.attr("class","text"),l&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",l),a&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",a),M.attr("transform",`translate(${n}, 0)`),h.attr("transform",`translate(${-s/2+n-(r.x-(r.left??0))},${-c/2+(t.padding??0)/2-(r.y-(r.top??0))})`),H(t,M),t.intersect=function(w){return N.polygon(t,f,w)},e}$(es,"curlyBraceLeft");function ct(o,t,i,a=100,e=0,r=180){let h=[],s=e*Math.PI/180,l=(r*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*l,p=o+i*Math.cos(f),u=t+i*Math.sin(f);h.push({x:p,y:u})}return h}$(ct,"generateCirclePoints");async function ss(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=r.width+(t.padding??0),c=r.height+(t.padding??0),n=Math.max(5,c*.1),{cssStyles:l}=t,g=[...ct(s/2,-c/2,n,20,-90,0),{x:s/2+n,y:-n},...ct(s/2+n*2,-n,n,20,-180,-270),...ct(s/2+n*2,n,n,20,-90,-180),{x:s/2+n,y:c/2},...ct(s/2,c/2,n,20,0,90)],f=[{x:-s/2,y:-c/2-n},{x:s/2,y:-c/2-n},...ct(s/2,-c/2,n,20,-90,0),{x:s/2+n,y:-n},...ct(s/2+n*2,-n,n,20,-180,-270),...ct(s/2+n*2,n,n,20,-90,-180),{x:s/2+n,y:c/2},...ct(s/2,c/2,n,20,0,90),{x:s/2,y:c/2+n},{x:-s/2,y:c/2+n}],p=S.svg(e),u=W(t,{fill:"none"});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let m=q(g).replace("Z",""),d=p.path(m,u),x=q(f),b=p.path(x,{...u}),M=e.insert("g",":first-child");return M.insert(()=>b,":first-child").attr("stroke-opacity",0),M.insert(()=>d,":first-child"),M.attr("class","text"),l&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",l),a&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",a),M.attr("transform",`translate(${-n}, 0)`),h.attr("transform",`translate(${-s/2+(t.padding??0)/2-(r.x-(r.left??0))},${-c/2+(t.padding??0)/2-(r.y-(r.top??0))})`),H(t,M),t.intersect=function(w){return N.polygon(t,f,w)},e}$(ss,"curlyBraceRight");function K(o,t,i,a=100,e=0,r=180){let h=[],s=e*Math.PI/180,l=(r*Math.PI/180-s)/(a-1);for(let g=0;g<a;g++){let f=s+g*l,p=o+i*Math.cos(f),u=t+i*Math.sin(f);h.push({x:-p,y:-u})}return h}$(K,"generateCirclePoints");async function as(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=r.width+(t.padding??0),c=r.height+(t.padding??0),n=Math.max(5,c*.1),{cssStyles:l}=t,g=[...K(s/2,-c/2,n,30,-90,0),{x:-s/2-n,y:n},...K(s/2+n*2,-n,n,20,-180,-270),...K(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:-c/2},...K(s/2,c/2,n,20,0,90)],f=[...K(-s/2+n+n/2,-c/2,n,20,-90,-180),{x:s/2-n/2,y:n},...K(-s/2-n/2,-n,n,20,0,90),...K(-s/2-n/2,n,n,20,-90,0),{x:s/2-n/2,y:-n},...K(-s/2+n+n/2,c/2,n,30,-180,-270)],p=[{x:s/2,y:-c/2-n},{x:-s/2,y:-c/2-n},...K(s/2,-c/2,n,20,-90,0),{x:-s/2-n,y:-n},...K(s/2+n*2,-n,n,20,-180,-270),...K(s/2+n*2,n,n,20,-90,-180),{x:-s/2-n,y:c/2},...K(s/2,c/2,n,20,0,90),{x:-s/2,y:c/2+n},{x:s/2-n-n/2,y:c/2+n},...K(-s/2+n+n/2,-c/2,n,20,-90,-180),{x:s/2-n/2,y:n},...K(-s/2-n/2,-n,n,20,0,90),...K(-s/2-n/2,n,n,20,-90,0),{x:s/2-n/2,y:-n},...K(-s/2+n+n/2,c/2,n,30,-180,-270)],u=S.svg(e),y=W(t,{fill:"none"});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let d=q(g).replace("Z",""),x=u.path(d,y),M=q(f).replace("Z",""),w=u.path(M,y),k=q(p),v=u.path(k,{...y}),D=e.insert("g",":first-child");return D.insert(()=>v,":first-child").attr("stroke-opacity",0),D.insert(()=>x,":first-child"),D.insert(()=>w,":first-child"),D.attr("class","text"),l&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",l),a&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",a),D.attr("transform",`translate(${n-n/4}, 0)`),h.attr("transform",`translate(${-s/2+(t.padding??0)/2-(r.x-(r.left??0))},${-c/2+(t.padding??0)/2-(r.y-(r.top??0))})`),H(t,D),t.intersect=function(B){return N.polygon(t,p,B)},e}$(as,"curlyBraces");async function rs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=80,s=20,c=Math.max(h,(r.width+(t.padding??0)*2)*1.25,t?.width??0),n=Math.max(s,r.height+(t.padding??0)*2,t?.height??0),l=n/2,{cssStyles:g}=t,f=S.svg(e),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=c,y=n,m=u-l,d=y/4,x=[{x:m,y:0},{x:d,y:0},{x:0,y:y/2},{x:d,y},{x:m,y},...At(-m,-y/2,l,50,270,90)],b=q(x),M=f.path(b,p),w=e.insert(()=>M,":first-child");return w.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&w.selectChildren("path").attr("style",a),w.attr("transform",`translate(${-c/2}, ${-n/2})`),H(t,w),t.intersect=function(k){return N.polygon(t,x,k)},e}$(rs,"curvedTrapezoid");var Da=$((o,t,i,a,e,r)=>[`M${o},${t+r}`,`a${e},${r} 0,0,0 ${i},0`,`a${e},${r} 0,0,0 ${-i},0`,`l0,${a}`,`a${e},${r} 0,0,0 ${i},0`,`l0,${-a}`].join(" "),"createCylinderPathD"),Pa=$((o,t,i,a,e,r)=>[`M${o},${t+r}`,`M${o+i},${t+r}`,`a${e},${r} 0,0,0 ${-i},0`,`l0,${a}`,`a${e},${r} 0,0,0 ${i},0`,`l0,${-a}`].join(" "),"createOuterCylinderPathD"),Ba=$((o,t,i,a,e,r)=>[`M${o-i/2},${-a/2}`,`a${e},${r} 0,0,0 ${i},0`].join(" "),"createInnerCylinderPathD");async function ns(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+t.padding,t.width??0),c=s/2,n=c/(2.5+s/50),l=Math.max(r.height+n+t.padding,t.height??0),g,{cssStyles:f}=t;if(t.look==="handDrawn"){let p=S.svg(e),u=Pa(0,0,s,l,c,n),y=Ba(0,n,s,l,c,n),m=p.path(u,W(t,{})),d=p.path(y,W(t,{fill:"none"}));g=e.insert(()=>d,":first-child"),g=e.insert(()=>m,":first-child"),g.attr("class","basic label-container"),f&&g.attr("style",f)}else{let p=Da(0,0,s,l,c,n);g=e.insert("path",":first-child").attr("d",p).attr("class","basic label-container").attr("style",U(f)).attr("style",a)}return g.attr("label-offset-y",n),g.attr("transform",`translate(${-s/2}, ${-(l/2+n)})`),H(t,g),h.attr("transform",`translate(${-(r.width/2)-(r.x-(r.left??0))}, ${-(r.height/2)+(t.padding??0)/1.5-(r.y-(r.top??0))})`),t.intersect=function(p){let u=N.rect(t,p),y=u.x-(t.x??0);if(c!=0&&(Math.abs(y)<(t.width??0)/2||Math.abs(y)==(t.width??0)/2&&Math.abs(u.y-(t.y??0))>(t.height??0)/2-n)){let m=n*n*(1-y*y/(c*c));m>0&&(m=Math.sqrt(m)),m=n-m,p.y-(t.y??0)>0&&(m=-m),u.y+=m}return u},e}$(ns,"cylinder");async function is(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=r.width+t.padding,c=r.height+t.padding,n=c*.2,l=-s/2,g=-c/2-n/2,{cssStyles:f}=t,p=S.svg(e),u=W(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:l,y:g+n},{x:-l,y:g+n},{x:-l,y:-g},{x:l,y:-g},{x:l,y:g},{x:-l,y:g},{x:-l,y:g+n}],m=p.polygon(y.map(x=>[x.x,x.y]),u),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),h.attr("transform",`translate(${l+(t.padding??0)/2-(r.x-(r.left??0))}, ${g+n+(t.padding??0)/2-(r.y-(r.top??0))})`),H(t,d),t.intersect=function(x){return N.rect(t,x)},e}$(is,"dividedRectangle");async function ls(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,halfPadding:h}=await G(o,t,_(t)),c=r.width/2+h+5,n=r.width/2+h,l,{cssStyles:g}=t;if(t.look==="handDrawn"){let f=S.svg(e),p=W(t,{roughness:.2,strokeWidth:2.5}),u=W(t,{roughness:.2,strokeWidth:1.5}),y=f.circle(0,0,c*2,p),m=f.circle(0,0,n*2,u);l=e.insert("g",":first-child"),l.attr("class",U(t.cssClasses)).attr("style",U(g)),l.node()?.appendChild(y),l.node()?.appendChild(m)}else{l=e.insert("g",":first-child");let f=l.insert("circle",":first-child"),p=l.insert("circle");l.attr("class","basic label-container").attr("style",a),f.attr("class","outer-circle").attr("style",a).attr("r",c).attr("cx",0).attr("cy",0),p.attr("class","inner-circle").attr("style",a).attr("r",n).attr("cx",0).attr("cy",0)}return H(t,l),t.intersect=function(f){return F.info("DoubleCircle intersect",t,c,f),N.circle(t,c,f)},e}$(ls,"doublecircle");function cs(o,t,{config:{themeVariables:i}}){let{labelStyles:a,nodeStyles:e}=T(t);t.label="",t.labelStyle=a;let r=o.insert("g").attr("class",_(t)).attr("id",t.domId??t.id),h=7,{cssStyles:s}=t,c=S.svg(r),{nodeBorder:n}=i,l=W(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(l.roughness=0);let g=c.circle(0,0,h*2,l),f=r.insert(()=>g,":first-child");return f.selectAll("path").attr("style",`fill: ${n} !important;`),s&&s.length>0&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",s),e&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",e),H(t,f),t.intersect=function(p){return F.info("filledCircle intersect",t,{radius:h,point:p}),N.circle(t,h,p)},r}$(cs,"filledCircle");async function os(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=r.width+(t.padding??0),c=s+r.height,n=s+r.height,l=[{x:0,y:-c},{x:n,y:-c},{x:n/2,y:0}],{cssStyles:g}=t,f=S.svg(e),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=q(l),y=f.path(u,p),m=e.insert(()=>y,":first-child").attr("transform",`translate(${-c/2}, ${c/2})`);return g&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",a),t.width=s,t.height=c,H(t,m),h.attr("transform",`translate(${-r.width/2-(r.x-(r.left??0))}, ${-c/2+(t.padding??0)/2+(r.y-(r.top??0))})`),t.intersect=function(d){return F.info("Triangle intersect",t,l,d),N.polygon(t,l,d)},e}$(os,"flippedTriangle");function hs(o,t,{dir:i,config:{state:a,themeVariables:e}}){let{nodeStyles:r}=T(t);t.label="";let h=o.insert("g").attr("class",_(t)).attr("id",t.domId??t.id),{cssStyles:s}=t,c=Math.max(70,t?.width??0),n=Math.max(10,t?.height??0);i==="LR"&&(c=Math.max(10,t?.width??0),n=Math.max(70,t?.height??0));let l=-1*c/2,g=-1*n/2,f=S.svg(h),p=W(t,{stroke:e.lineColor,fill:e.lineColor});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=f.rectangle(l,g,c,n,p),y=h.insert(()=>u,":first-child");s&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",s),r&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",r),H(t,y);let m=a?.padding??0;return t.width&&t.height&&(t.width+=m/2||0,t.height+=m/2||0),t.intersect=function(d){return N.rect(t,d)},h}$(hs,"forkJoin");async function gs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let e=80,r=50,{shapeSvg:h,bbox:s}=await G(o,t,_(t)),c=Math.max(e,s.width+(t.padding??0)*2,t?.width??0),n=Math.max(r,s.height+(t.padding??0)*2,t?.height??0),l=n/2,{cssStyles:g}=t,f=S.svg(h),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:-c/2,y:-n/2},{x:c/2-l,y:-n/2},...At(-c/2+l,0,l,50,90,270),{x:c/2-l,y:n/2},{x:-c/2,y:n/2}],y=q(u),m=f.path(y,p),d=h.insert(()=>m,":first-child");return d.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),H(t,d),t.intersect=function(x){return F.info("Pill intersect",t,{radius:l,point:x}),N.polygon(t,u,x)},h}$(gs,"halfRoundedRectangle");async function ps(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.height+(t.padding??0),s=r.width+(t.padding??0)*2.5,{cssStyles:c}=t,n=S.svg(e),l=W(t,{});t.look!=="handDrawn"&&(l.roughness=0,l.fillStyle="solid");let g=s/2,f=g/6;g=g+f;let p=h/2,u=p/2,y=g-u,m=[{x:-y,y:-p},{x:0,y:-p},{x:y,y:-p},{x:g,y:0},{x:y,y:p},{x:0,y:p},{x:-y,y:p},{x:-g,y:0}],d=q(m),x=n.path(d,l),b=e.insert(()=>x,":first-child");return b.attr("class","basic label-container"),c&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",c),a&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",a),t.width=s,t.height=h,H(t,b),t.intersect=function(M){return N.polygon(t,m,M)},e}$(ps,"hexagon");async function fs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.label="",t.labelStyle=i;let{shapeSvg:e}=await G(o,t,_(t)),r=Math.max(30,t?.width??0),h=Math.max(30,t?.height??0),{cssStyles:s}=t,c=S.svg(e),n=W(t,{});t.look!=="handDrawn"&&(n.roughness=0,n.fillStyle="solid");let l=[{x:0,y:0},{x:r,y:0},{x:0,y:h},{x:r,y:h}],g=q(l),f=c.path(g,n),p=e.insert(()=>f,":first-child");return p.attr("class","basic label-container"),s&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",s),a&&t.look!=="handDrawn"&&p.selectChildren("path").attr("style",a),p.attr("transform",`translate(${-r/2}, ${-h/2})`),H(t,p),t.intersect=function(u){return F.info("Pill intersect",t,{points:l}),N.polygon(t,l,u)},e}$(fs,"hourglass");async function us(o,t,{config:{themeVariables:i,flowchart:a}}){let{labelStyles:e}=T(t);t.labelStyle=e;let r=t.assetHeight??48,h=t.assetWidth??48,s=Math.max(r,h),c=a?.wrappingWidth;t.width=Math.max(s,c??0);let{shapeSvg:n,bbox:l,label:g}=await G(o,t,"icon-shape default"),f=t.pos==="t",p=s,u=s,{nodeBorder:y}=i,{stylesMap:m}=Mt(t),d=-u/2,x=-p/2,b=t.label?8:0,M=S.svg(n),w=W(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let k=M.rectangle(d,x,u,p,w),v=Math.max(u,l.width),D=p+l.height+b,B=M.rectangle(-v/2,-D/2,v,D,{...w,fill:"transparent",stroke:"none"}),L=n.insert(()=>k,":first-child"),A=n.insert(()=>B);if(t.icon){let I=n.append("g");I.html(`<g>${await vt(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let P=I.node().getBBox(),C=P.width,E=P.height,R=P.x,O=P.y;I.attr("transform",`translate(${-C/2-R},${f?l.height/2+b/2-E/2-O:-l.height/2-b/2-E/2-O})`),I.attr("style",`color: ${m.get("stroke")??y};`)}return g.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))},${f?-D/2:D/2-l.height})`),L.attr("transform",`translate(0,${f?l.height/2+b/2:-l.height/2-b/2})`),H(t,A),t.intersect=function(I){if(F.info("iconSquare intersect",t,I),!t.label)return N.rect(t,I);let P=t.x??0,C=t.y??0,E=t.height??0,R=[];return f?R=[{x:P-l.width/2,y:C-E/2},{x:P+l.width/2,y:C-E/2},{x:P+l.width/2,y:C-E/2+l.height+b},{x:P+u/2,y:C-E/2+l.height+b},{x:P+u/2,y:C+E/2},{x:P-u/2,y:C+E/2},{x:P-u/2,y:C-E/2+l.height+b},{x:P-l.width/2,y:C-E/2+l.height+b}]:R=[{x:P-u/2,y:C-E/2},{x:P+u/2,y:C-E/2},{x:P+u/2,y:C-E/2+p},{x:P+l.width/2,y:C-E/2+p},{x:P+l.width/2/2,y:C+E/2},{x:P-l.width/2,y:C+E/2},{x:P-l.width/2,y:C-E/2+p},{x:P-u/2,y:C-E/2+p}],N.polygon(t,R,I)},n}$(us,"icon");async function ys(o,t,{config:{themeVariables:i,flowchart:a}}){let{labelStyles:e}=T(t);t.labelStyle=e;let r=t.assetHeight??48,h=t.assetWidth??48,s=Math.max(r,h),c=a?.wrappingWidth;t.width=Math.max(s,c??0);let{shapeSvg:n,bbox:l,label:g}=await G(o,t,"icon-shape default"),f=20,p=t.label?8:0,u=t.pos==="t",{nodeBorder:y,mainBkg:m}=i,{stylesMap:d}=Mt(t),x=S.svg(n),b=W(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let M=d.get("fill");b.stroke=M??m;let w=n.append("g");t.icon&&w.html(`<g>${await vt(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let k=w.node().getBBox(),v=k.width,D=k.height,B=k.x,L=k.y,A=Math.max(v,D)*Math.SQRT2+f*2,I=x.circle(0,0,A,b),P=Math.max(A,l.width),C=A+l.height+p,E=x.rectangle(-P/2,-C/2,P,C,{...b,fill:"transparent",stroke:"none"}),R=n.insert(()=>I,":first-child"),O=n.insert(()=>E);return w.attr("transform",`translate(${-v/2-B},${u?l.height/2+p/2-D/2-L:-l.height/2-p/2-D/2-L})`),w.attr("style",`color: ${d.get("stroke")??y};`),g.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))},${u?-C/2:C/2-l.height})`),R.attr("transform",`translate(0,${u?l.height/2+p/2:-l.height/2-p/2})`),H(t,O),t.intersect=function(z){return F.info("iconSquare intersect",t,z),N.rect(t,z)},n}$(ys,"iconCircle");async function ds(o,t,{config:{themeVariables:i,flowchart:a}}){let{labelStyles:e}=T(t);t.labelStyle=e;let r=t.assetHeight??48,h=t.assetWidth??48,s=Math.max(r,h),c=a?.wrappingWidth;t.width=Math.max(s,c??0);let{shapeSvg:n,bbox:l,halfPadding:g,label:f}=await G(o,t,"icon-shape default"),p=t.pos==="t",u=s+g*2,y=s+g*2,{nodeBorder:m,mainBkg:d}=i,{stylesMap:x}=Mt(t),b=-y/2,M=-u/2,w=t.label?8:0,k=S.svg(n),v=W(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let D=x.get("fill");v.stroke=D??d;let B=k.path(ft(b,M,y,u,5),v),L=Math.max(y,l.width),A=u+l.height+w,I=k.rectangle(-L/2,-A/2,L,A,{...v,fill:"transparent",stroke:"none"}),P=n.insert(()=>B,":first-child").attr("class","icon-shape2"),C=n.insert(()=>I);if(t.icon){let E=n.append("g");E.html(`<g>${await vt(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let R=E.node().getBBox(),O=R.width,z=R.height,Z=R.x,rt=R.y;E.attr("transform",`translate(${-O/2-Z},${p?l.height/2+w/2-z/2-rt:-l.height/2-w/2-z/2-rt})`),E.attr("style",`color: ${x.get("stroke")??m};`)}return f.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))},${p?-A/2:A/2-l.height})`),P.attr("transform",`translate(0,${p?l.height/2+w/2:-l.height/2-w/2})`),H(t,C),t.intersect=function(E){if(F.info("iconSquare intersect",t,E),!t.label)return N.rect(t,E);let R=t.x??0,O=t.y??0,z=t.height??0,Z=[];return p?Z=[{x:R-l.width/2,y:O-z/2},{x:R+l.width/2,y:O-z/2},{x:R+l.width/2,y:O-z/2+l.height+w},{x:R+y/2,y:O-z/2+l.height+w},{x:R+y/2,y:O+z/2},{x:R-y/2,y:O+z/2},{x:R-y/2,y:O-z/2+l.height+w},{x:R-l.width/2,y:O-z/2+l.height+w}]:Z=[{x:R-y/2,y:O-z/2},{x:R+y/2,y:O-z/2},{x:R+y/2,y:O-z/2+u},{x:R+l.width/2,y:O-z/2+u},{x:R+l.width/2/2,y:O+z/2},{x:R-l.width/2,y:O+z/2},{x:R-l.width/2,y:O-z/2+u},{x:R-y/2,y:O-z/2+u}],N.polygon(t,Z,E)},n}$(ds,"iconRounded");async function ms(o,t,{config:{themeVariables:i,flowchart:a}}){let{labelStyles:e}=T(t);t.labelStyle=e;let r=t.assetHeight??48,h=t.assetWidth??48,s=Math.max(r,h),c=a?.wrappingWidth;t.width=Math.max(s,c??0);let{shapeSvg:n,bbox:l,halfPadding:g,label:f}=await G(o,t,"icon-shape default"),p=t.pos==="t",u=s+g*2,y=s+g*2,{nodeBorder:m,mainBkg:d}=i,{stylesMap:x}=Mt(t),b=-y/2,M=-u/2,w=t.label?8:0,k=S.svg(n),v=W(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let D=x.get("fill");v.stroke=D??d;let B=k.path(ft(b,M,y,u,.1),v),L=Math.max(y,l.width),A=u+l.height+w,I=k.rectangle(-L/2,-A/2,L,A,{...v,fill:"transparent",stroke:"none"}),P=n.insert(()=>B,":first-child"),C=n.insert(()=>I);if(t.icon){let E=n.append("g");E.html(`<g>${await vt(t.icon,{height:s,width:s,fallbackPrefix:""})}</g>`);let R=E.node().getBBox(),O=R.width,z=R.height,Z=R.x,rt=R.y;E.attr("transform",`translate(${-O/2-Z},${p?l.height/2+w/2-z/2-rt:-l.height/2-w/2-z/2-rt})`),E.attr("style",`color: ${x.get("stroke")??m};`)}return f.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))},${p?-A/2:A/2-l.height})`),P.attr("transform",`translate(0,${p?l.height/2+w/2:-l.height/2-w/2})`),H(t,C),t.intersect=function(E){if(F.info("iconSquare intersect",t,E),!t.label)return N.rect(t,E);let R=t.x??0,O=t.y??0,z=t.height??0,Z=[];return p?Z=[{x:R-l.width/2,y:O-z/2},{x:R+l.width/2,y:O-z/2},{x:R+l.width/2,y:O-z/2+l.height+w},{x:R+y/2,y:O-z/2+l.height+w},{x:R+y/2,y:O+z/2},{x:R-y/2,y:O+z/2},{x:R-y/2,y:O-z/2+l.height+w},{x:R-l.width/2,y:O-z/2+l.height+w}]:Z=[{x:R-y/2,y:O-z/2},{x:R+y/2,y:O-z/2},{x:R+y/2,y:O-z/2+u},{x:R+l.width/2,y:O-z/2+u},{x:R+l.width/2/2,y:O+z/2},{x:R-l.width/2,y:O+z/2},{x:R-l.width/2,y:O-z/2+u},{x:R-y/2,y:O-z/2+u}],N.polygon(t,Z,E)},n}$(ms,"iconSquare");async function xs(o,t,{config:{flowchart:i}}){let a=new Image;a.src=t?.img??"",await a.decode();let e=Number(a.naturalWidth.toString().replace("px","")),r=Number(a.naturalHeight.toString().replace("px",""));t.imageAspectRatio=e/r;let{labelStyles:h}=T(t);t.labelStyle=h;let s=i?.wrappingWidth;t.defaultWidth=i?.wrappingWidth;let c=Math.max(t.label?s??0:0,t?.assetWidth??e),n=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:c,l=t.constraint==="on"?n/t.imageAspectRatio:t?.assetHeight??r;t.width=Math.max(n,s??0);let{shapeSvg:g,bbox:f,label:p}=await G(o,t,"image-shape default"),u=t.pos==="t",y=-n/2,m=-l/2,d=t.label?8:0,x=S.svg(g),b=W(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let M=x.rectangle(y,m,n,l,b),w=Math.max(n,f.width),k=l+f.height+d,v=x.rectangle(-w/2,-k/2,w,k,{...b,fill:"none",stroke:"none"}),D=g.insert(()=>M,":first-child"),B=g.insert(()=>v);if(t.img){let L=g.append("image");L.attr("href",t.img),L.attr("width",n),L.attr("height",l),L.attr("preserveAspectRatio","none"),L.attr("transform",`translate(${-n/2},${u?k/2-l:-k/2})`)}return p.attr("transform",`translate(${-f.width/2-(f.x-(f.left??0))},${u?-l/2-f.height/2-d/2:l/2-f.height/2+d/2})`),D.attr("transform",`translate(0,${u?f.height/2+d/2:-f.height/2-d/2})`),H(t,B),t.intersect=function(L){if(F.info("iconSquare intersect",t,L),!t.label)return N.rect(t,L);let A=t.x??0,I=t.y??0,P=t.height??0,C=[];return u?C=[{x:A-f.width/2,y:I-P/2},{x:A+f.width/2,y:I-P/2},{x:A+f.width/2,y:I-P/2+f.height+d},{x:A+n/2,y:I-P/2+f.height+d},{x:A+n/2,y:I+P/2},{x:A-n/2,y:I+P/2},{x:A-n/2,y:I-P/2+f.height+d},{x:A-f.width/2,y:I-P/2+f.height+d}]:C=[{x:A-n/2,y:I-P/2},{x:A+n/2,y:I-P/2},{x:A+n/2,y:I-P/2+l},{x:A+f.width/2,y:I-P/2+l},{x:A+f.width/2/2,y:I+P/2},{x:A-f.width/2,y:I+P/2},{x:A-f.width/2,y:I-P/2+l},{x:A-n/2,y:I-P/2+l}],N.polygon(t,C,L)},g}$(xs,"imageSquare");async function bs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=Math.max(r.width+(t.padding??0)*2,t?.width??0),s=Math.max(r.height+(t.padding??0)*2,t?.height??0),c=[{x:0,y:0},{x:h,y:0},{x:h+3*s/6,y:-s},{x:-3*s/6,y:-s}],n,{cssStyles:l}=t;if(t.look==="handDrawn"){let g=S.svg(e),f=W(t,{}),p=q(c),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),l&&n.attr("style",l)}else n=ut(e,h,s,c);return a&&n.attr("style",a),t.width=h,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,c,g)},e}$(bs,"inv_trapezoid");async function Gt(o,t,i){let{labelStyles:a,nodeStyles:e}=T(t);t.labelStyle=a;let{shapeSvg:r,bbox:h}=await G(o,t,_(t)),s=Math.max(h.width+i.labelPaddingX*2,t?.width||0),c=Math.max(h.height+i.labelPaddingY*2,t?.height||0),n=-s/2,l=-c/2,g,{rx:f,ry:p}=t,{cssStyles:u}=t;if(i?.rx&&i.ry&&(f=i.rx,p=i.ry),t.look==="handDrawn"){let y=S.svg(r),m=W(t,{}),d=f||p?y.path(ft(n,l,s,c,f||0),m):y.rectangle(n,l,s,c,m);g=r.insert(()=>d,":first-child"),g.attr("class","basic label-container").attr("style",U(u))}else g=r.insert("rect",":first-child"),g.attr("class","basic label-container").attr("style",e).attr("rx",U(f)).attr("ry",U(p)).attr("x",n).attr("y",l).attr("width",s).attr("height",c);return H(t,g),t.calcIntersect=function(y,m){return N.rect(y,m)},t.intersect=function(y){return N.rect(t,y)},r}$(Gt,"drawRect");async function ws(o,t){let{shapeSvg:i,bbox:a,label:e}=await G(o,t,"label"),r=i.insert("rect",":first-child");return r.attr("width",.1).attr("height",.1),i.attr("class","label edgeLabel"),e.attr("transform",`translate(${-(a.width/2)-(a.x-(a.left??0))}, ${-(a.height/2)-(a.y-(a.top??0))})`),H(t,r),t.intersect=function(c){return N.rect(t,c)},i}$(ws,"labelRect");async function Ss(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=Math.max(r.width+(t.padding??0),t?.width??0),s=Math.max(r.height+(t.padding??0),t?.height??0),c=[{x:0,y:0},{x:h+3*s/6,y:0},{x:h,y:-s},{x:-(3*s)/6,y:-s}],n,{cssStyles:l}=t;if(t.look==="handDrawn"){let g=S.svg(e),f=W(t,{}),p=q(c),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),l&&n.attr("style",l)}else n=ut(e,h,s,c);return a&&n.attr("style",a),t.width=h,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,c,g)},e}$(Ss,"lean_left");async function $s(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=Math.max(r.width+(t.padding??0),t?.width??0),s=Math.max(r.height+(t.padding??0),t?.height??0),c=[{x:-3*s/6,y:0},{x:h,y:0},{x:h+3*s/6,y:-s},{x:0,y:-s}],n,{cssStyles:l}=t;if(t.look==="handDrawn"){let g=S.svg(e),f=W(t,{}),p=q(c),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),l&&n.attr("style",l)}else n=ut(e,h,s,c);return a&&n.attr("style",a),t.width=h,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,c,g)},e}$($s,"lean_right");function Ms(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.label="",t.labelStyle=i;let e=o.insert("g").attr("class",_(t)).attr("id",t.domId??t.id),{cssStyles:r}=t,h=Math.max(35,t?.width??0),s=Math.max(35,t?.height??0),c=7,n=[{x:h,y:0},{x:0,y:s+c/2},{x:h-2*c,y:s+c/2},{x:0,y:2*s},{x:h,y:s-c/2},{x:2*c,y:s-c/2}],l=S.svg(e),g=W(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let f=q(n),p=l.path(f,g),u=e.insert(()=>p,":first-child");return r&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",r),a&&t.look!=="handDrawn"&&u.selectAll("path").attr("style",a),u.attr("transform",`translate(-${h/2},${-s})`),H(t,u),t.intersect=function(y){return F.info("lightningBolt intersect",t,y),N.polygon(t,n,y)},e}$(Ms,"lightningBolt");var Ca=$((o,t,i,a,e,r,h)=>[`M${o},${t+r}`,`a${e},${r} 0,0,0 ${i},0`,`a${e},${r} 0,0,0 ${-i},0`,`l0,${a}`,`a${e},${r} 0,0,0 ${i},0`,`l0,${-a}`,`M${o},${t+r+h}`,`a${e},${r} 0,0,0 ${i},0`].join(" "),"createCylinderPathD"),Na=$((o,t,i,a,e,r,h)=>[`M${o},${t+r}`,`M${o+i},${t+r}`,`a${e},${r} 0,0,0 ${-i},0`,`l0,${a}`,`a${e},${r} 0,0,0 ${i},0`,`l0,${-a}`,`M${o},${t+r+h}`,`a${e},${r} 0,0,0 ${i},0`].join(" "),"createOuterCylinderPathD"),Ra=$((o,t,i,a,e,r)=>[`M${o-i/2},${-a/2}`,`a${e},${r} 0,0,0 ${i},0`].join(" "),"createInnerCylinderPathD");async function ks(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0),t.width??0),c=s/2,n=c/(2.5+s/50),l=Math.max(r.height+n+(t.padding??0),t.height??0),g=l*.1,f,{cssStyles:p}=t;if(t.look==="handDrawn"){let u=S.svg(e),y=Na(0,0,s,l,c,n,g),m=Ra(0,n,s,l,c,n),d=W(t,{}),x=u.path(y,d),b=u.path(m,d);e.insert(()=>b,":first-child").attr("class","line"),f=e.insert(()=>x,":first-child"),f.attr("class","basic label-container"),p&&f.attr("style",p)}else{let u=Ca(0,0,s,l,c,n,g);f=e.insert("path",":first-child").attr("d",u).attr("class","basic label-container").attr("style",U(p)).attr("style",a)}return f.attr("label-offset-y",n),f.attr("transform",`translate(${-s/2}, ${-(l/2+n)})`),H(t,f),h.attr("transform",`translate(${-(r.width/2)-(r.x-(r.left??0))}, ${-(r.height/2)+n-(r.y-(r.top??0))})`),t.intersect=function(u){let y=N.rect(t,u),m=y.x-(t.x??0);if(c!=0&&(Math.abs(m)<(t.width??0)/2||Math.abs(m)==(t.width??0)/2&&Math.abs(y.y-(t.y??0))>(t.height??0)/2-n)){let d=n*n*(1-m*m/(c*c));d>0&&(d=Math.sqrt(d)),d=n-d,u.y-(t.y??0)>0&&(d=-d),y.y+=d}return y},e}$(ks,"linedCylinder");async function vs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=c/4,l=c+n,{cssStyles:g}=t,f=S.svg(e),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:-s/2-s/2*.1,y:-l/2},{x:-s/2-s/2*.1,y:l/2},...pt(-s/2-s/2*.1,l/2,s/2+s/2*.1,l/2,n,.8),{x:s/2+s/2*.1,y:-l/2},{x:-s/2-s/2*.1,y:-l/2},{x:-s/2,y:-l/2},{x:-s/2,y:l/2*1.1},{x:-s/2,y:-l/2}],y=f.polygon(u.map(d=>[d.x,d.y]),p),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",g),a&&t.look!=="handDrawn"&&m.selectAll("path").attr("style",a),m.attr("transform",`translate(0,${-n/2})`),h.attr("transform",`translate(${-s/2+(t.padding??0)+s/2*.1/2-(r.x-(r.left??0))},${-c/2+(t.padding??0)-n/2-(r.y-(r.top??0))})`),H(t,m),t.intersect=function(d){return N.polygon(t,u,d)},e}$(vs,"linedWaveEdgedRect");async function Ds(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=5,l=-s/2,g=-c/2,{cssStyles:f}=t,p=S.svg(e),u=W(t,{}),y=[{x:l-n,y:g+n},{x:l-n,y:g+c+n},{x:l+s-n,y:g+c+n},{x:l+s-n,y:g+c},{x:l+s,y:g+c},{x:l+s,y:g+c-n},{x:l+s+n,y:g+c-n},{x:l+s+n,y:g-n},{x:l+n,y:g-n},{x:l+n,y:g},{x:l,y:g},{x:l,y:g+n}],m=[{x:l,y:g+n},{x:l+s-n,y:g+n},{x:l+s-n,y:g+c},{x:l+s,y:g+c},{x:l+s,y:g},{x:l,y:g}];t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=q(y),x=p.path(d,u),b=q(m),M=p.path(b,{...u,fill:"none"}),w=e.insert(()=>M,":first-child");return w.insert(()=>x,":first-child"),w.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),h.attr("transform",`translate(${-(r.width/2)-n-(r.x-(r.left??0))}, ${-(r.height/2)+n-(r.y-(r.top??0))})`),H(t,w),t.intersect=function(k){return N.polygon(t,y,k)},e}$(Ds,"multiRect");async function Ps(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=c/4,l=c+n,g=-s/2,f=-l/2,p=5,{cssStyles:u}=t,y=pt(g-p,f+l+p,g+s-p,f+l+p,n,.8),m=y?.[y.length-1],d=[{x:g-p,y:f+p},{x:g-p,y:f+l+p},...y,{x:g+s-p,y:m.y-p},{x:g+s,y:m.y-p},{x:g+s,y:m.y-2*p},{x:g+s+p,y:m.y-2*p},{x:g+s+p,y:f-p},{x:g+p,y:f-p},{x:g+p,y:f},{x:g,y:f},{x:g,y:f+p}],x=[{x:g,y:f+p},{x:g+s-p,y:f+p},{x:g+s-p,y:m.y-p},{x:g+s,y:m.y-p},{x:g+s,y:f},{x:g,y:f}],b=S.svg(e),M=W(t,{});t.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let w=q(d),k=b.path(w,M),v=q(x),D=b.path(v,M),B=e.insert(()=>k,":first-child");return B.insert(()=>D),B.attr("class","basic label-container"),u&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",u),a&&t.look!=="handDrawn"&&B.selectAll("path").attr("style",a),B.attr("transform",`translate(0,${-n/2})`),h.attr("transform",`translate(${-(r.width/2)-p-(r.x-(r.left??0))}, ${-(r.height/2)+p-n/2-(r.y-(r.top??0))})`),H(t,B),t.intersect=function(L){return N.polygon(t,d,L)},e}$(Ps,"multiWaveEdgedRectangle");async function Bs(o,t,{config:{themeVariables:i}}){let{labelStyles:a,nodeStyles:e}=T(t);t.labelStyle=a,t.useHtmlLabels||mt().flowchart?.htmlLabels!==!1||(t.centerLabel=!0);let{shapeSvg:h,bbox:s,label:c}=await G(o,t,_(t)),n=Math.max(s.width+(t.padding??0)*2,t?.width??0),l=Math.max(s.height+(t.padding??0)*2,t?.height??0),g=-n/2,f=-l/2,{cssStyles:p}=t,u=S.svg(h),y=W(t,{fill:i.noteBkgColor,stroke:i.noteBorderColor});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let m=u.rectangle(g,f,n,l,y),d=h.insert(()=>m,":first-child");return d.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",p),e&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",e),c.attr("transform",`translate(${-s.width/2-(s.x-(s.left??0))}, ${-(s.height/2)-(s.y-(s.top??0))})`),H(t,d),t.intersect=function(x){return N.rect(t,x)},h}$(Bs,"note");var Aa=$((o,t,i)=>[`M${o+i/2},${t}`,`L${o+i},${t-i/2}`,`L${o+i/2},${t-i}`,`L${o},${t-i/2}`,"Z"].join(" "),"createDecisionBoxPathD");async function Cs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.width+t.padding,s=r.height+t.padding,c=h+s,n=.5,l=[{x:c/2,y:0},{x:c,y:-c/2},{x:c/2,y:-c},{x:0,y:-c/2}],g,{cssStyles:f}=t;if(t.look==="handDrawn"){let p=S.svg(e),u=W(t,{}),y=Aa(0,0,c),m=p.path(y,u);g=e.insert(()=>m,":first-child").attr("transform",`translate(${-c/2+n}, ${c/2})`),f&&g.attr("style",f)}else g=ut(e,c,c,l),g.attr("transform",`translate(${-c/2+n}, ${c/2})`);return a&&g.attr("style",a),H(t,g),t.calcIntersect=function(p,u){let y=p.width,m=[{x:y/2,y:0},{x:y,y:-y/2},{x:y/2,y:-y},{x:0,y:-y/2}],d=N.polygon(p,m,u);return{x:d.x-.5,y:d.y-.5}},t.intersect=function(p){return this.calcIntersect(t,p)},e}$(Cs,"question");async function Ns(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0),t?.width??0),c=Math.max(r.height+(t.padding??0),t?.height??0),n=-s/2,l=-c/2,g=l/2,f=[{x:n+g,y:l},{x:n,y:0},{x:n+g,y:-l},{x:-n,y:-l},{x:-n,y:l}],{cssStyles:p}=t,u=S.svg(e),y=W(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let m=q(f),d=u.path(m,y),x=e.insert(()=>d,":first-child");return x.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",p),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),x.attr("transform",`translate(${-g/2},0)`),h.attr("transform",`translate(${-g/2-r.width/2-(r.x-(r.left??0))}, ${-(r.height/2)-(r.y-(r.top??0))})`),H(t,x),t.intersect=function(b){return N.polygon(t,f,b)},e}$(Ns,"rect_left_inv_arrow");async function Rs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let e;t.cssClasses?e="node "+t.cssClasses:e="node default";let r=o.insert("g").attr("class",e).attr("id",t.domId||t.id),h=r.insert("g"),s=r.insert("g").attr("class","label").attr("style",a),c=t.description,n=t.label,l=s.node().appendChild(await ue(n,t.labelStyle,!0,!0)),g={width:0,height:0};if(J(V()?.flowchart?.htmlLabels)){let D=l.children[0],B=Y(l);g=D.getBoundingClientRect(),B.attr("width",g.width),B.attr("height",g.height)}F.info("Text 2",c);let f=c||[],p=l.getBBox(),u=s.node().appendChild(await ue(f.join?f.join("<br/>"):f,t.labelStyle,!0,!0)),y=u.children[0],m=Y(u);g=y.getBoundingClientRect(),m.attr("width",g.width),m.attr("height",g.height);let d=(t.padding||0)/2;Y(u).attr("transform","translate( "+(g.width>p.width?0:(p.width-g.width)/2)+", "+(p.height+d+5)+")"),Y(l).attr("transform","translate( "+(g.width<p.width?0:-(p.width-g.width)/2)+", 0)"),g=s.node().getBBox(),s.attr("transform","translate("+-g.width/2+", "+(-g.height/2-d+3)+")");let x=g.width+(t.padding||0),b=g.height+(t.padding||0),M=-g.width/2-d,w=-g.height/2-d,k,v;if(t.look==="handDrawn"){let D=S.svg(r),B=W(t,{}),L=D.path(ft(M,w,x,b,t.rx||0),B),A=D.line(-g.width/2-d,-g.height/2-d+p.height+d,g.width/2+d,-g.height/2-d+p.height+d,B);v=r.insert(()=>(F.debug("Rough node insert CXC",L),A),":first-child"),k=r.insert(()=>(F.debug("Rough node insert CXC",L),L),":first-child")}else k=h.insert("rect",":first-child"),v=h.insert("line"),k.attr("class","outer title-state").attr("style",a).attr("x",-g.width/2-d).attr("y",-g.height/2-d).attr("width",g.width+(t.padding||0)).attr("height",g.height+(t.padding||0)),v.attr("class","divider").attr("x1",-g.width/2-d).attr("x2",g.width/2+d).attr("y1",-g.height/2-d+p.height+d).attr("y2",-g.height/2-d+p.height+d);return H(t,k),t.intersect=function(D){return N.rect(t,D)},r}$(Rs,"rectWithTitle");function Nt(o,t,i,a,e,r,h){let c=(o+i)/2,n=(t+a)/2,l=Math.atan2(a-t,i-o),g=(i-o)/2,f=(a-t)/2,p=g/e,u=f/r,y=Math.sqrt(p**2+u**2);if(y>1)throw new Error("The given radii are too small to create an arc between the points.");let m=Math.sqrt(1-y**2),d=c+m*r*Math.sin(l)*(h?-1:1),x=n-m*e*Math.cos(l)*(h?-1:1),b=Math.atan2((t-x)/r,(o-d)/e),w=Math.atan2((a-x)/r,(i-d)/e)-b;h&&w<0&&(w+=2*Math.PI),!h&&w>0&&(w-=2*Math.PI);let k=[];for(let v=0;v<20;v++){let D=v/19,B=b+D*w,L=d+e*Math.cos(B),A=x+r*Math.sin(B);k.push({x:L,y:A})}return k}$(Nt,"generateArcPoints");async function As(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=t?.padding??0,s=t?.padding??0,c=(t?.width?t?.width:r.width)+h*2,n=(t?.height?t?.height:r.height)+s*2,l=t.radius||5,g=t.taper||5,{cssStyles:f}=t,p=S.svg(e),u=W(t,{});t.stroke&&(u.stroke=t.stroke),t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:-c/2+g,y:-n/2},{x:c/2-g,y:-n/2},...Nt(c/2-g,-n/2,c/2,-n/2+g,l,l,!0),{x:c/2,y:-n/2+g},{x:c/2,y:n/2-g},...Nt(c/2,n/2-g,c/2-g,n/2,l,l,!0),{x:c/2-g,y:n/2},{x:-c/2+g,y:n/2},...Nt(-c/2+g,n/2,-c/2,n/2-g,l,l,!0),{x:-c/2,y:n/2-g},{x:-c/2,y:-n/2+g},...Nt(-c/2,-n/2+g,-c/2+g,-n/2,l,l,!0)],m=q(y),d=p.path(m,u),x=e.insert(()=>d,":first-child");return x.attr("class","basic label-container outer-path"),f&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",f),a&&t.look!=="handDrawn"&&x.selectChildren("path").attr("style",a),H(t,x),t.intersect=function(b){return N.polygon(t,y,b)},e}$(As,"roundedRect");async function Ls(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=t?.padding??0,c=Math.max(r.width+(t.padding??0)*2,t?.width??0),n=Math.max(r.height+(t.padding??0)*2,t?.height??0),l=-r.width/2-s,g=-r.height/2-s,{cssStyles:f}=t,p=S.svg(e),u=W(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=[{x:l,y:g},{x:l+c+8,y:g},{x:l+c+8,y:g+n},{x:l-8,y:g+n},{x:l-8,y:g},{x:l,y:g},{x:l,y:g+n}],m=p.polygon(y.map(x=>[x.x,x.y]),u),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container").attr("style",U(f)),a&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),f&&t.look!=="handDrawn"&&d.selectAll("path").attr("style",a),h.attr("transform",`translate(${-c/2+4+(t.padding??0)-(r.x-(r.left??0))},${-n/2+(t.padding??0)-(r.y-(r.top??0))})`),H(t,d),t.intersect=function(x){return N.rect(t,x)},e}$(Ls,"shadedProcess");async function Ws(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=-s/2,l=-c/2,{cssStyles:g}=t,f=S.svg(e),p=W(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let u=[{x:n,y:l},{x:n,y:l+c},{x:n+s,y:l+c},{x:n+s,y:l-c/2}],y=q(u),m=f.path(y,p),d=e.insert(()=>m,":first-child");return d.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",g),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),d.attr("transform",`translate(0, ${c/4})`),h.attr("transform",`translate(${-s/2+(t.padding??0)-(r.x-(r.left??0))}, ${-c/4+(t.padding??0)-(r.y-(r.top??0))})`),H(t,d),t.intersect=function(x){return N.polygon(t,u,x)},e}$(Ws,"slopedRect");async function Ts(o,t){let i={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??(t?.padding||0)*2,labelPaddingY:(t?.padding||0)*1};return Gt(o,t,i)}$(Ts,"squareRect");async function Hs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.height+t.padding,s=r.width+h/4+t.padding,c=h/2,{cssStyles:n}=t,l=S.svg(e),g=W(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let f=[{x:-s/2+c,y:-h/2},{x:s/2-c,y:-h/2},...At(-s/2+c,0,c,50,90,270),{x:s/2-c,y:h/2},...At(s/2-c,0,c,50,270,450)],p=q(f),u=l.path(p,g),y=e.insert(()=>u,":first-child");return y.attr("class","basic label-container outer-path"),n&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",n),a&&t.look!=="handDrawn"&&y.selectChildren("path").attr("style",a),H(t,y),t.intersect=function(m){return N.polygon(t,f,m)},e}$(Hs,"stadium");async function Is(o,t){return Gt(o,t,{rx:5,ry:5,classes:"flowchart-node"})}$(Is,"state");function Es(o,t,{config:{themeVariables:i}}){let{labelStyles:a,nodeStyles:e}=T(t);t.labelStyle=a;let{cssStyles:r}=t,{lineColor:h,stateBorder:s,nodeBorder:c}=i,n=o.insert("g").attr("class","node default").attr("id",t.domId||t.id),l=S.svg(n),g=W(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let f=l.circle(0,0,14,{...g,stroke:h,strokeWidth:2}),p=s??c,u=l.circle(0,0,5,{...g,fill:p,stroke:p,strokeWidth:2,fillStyle:"solid"}),y=n.insert(()=>f,":first-child");return y.insert(()=>u),r&&y.selectAll("path").attr("style",r),e&&y.selectAll("path").attr("style",e),H(t,y),t.intersect=function(m){return N.circle(t,7,m)},n}$(Es,"stateEnd");function Os(o,t,{config:{themeVariables:i}}){let{lineColor:a}=i,e=o.insert("g").attr("class","node default").attr("id",t.domId||t.id),r;if(t.look==="handDrawn"){let s=S.svg(e).circle(0,0,14,Me(a));r=e.insert(()=>s),r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14)}else r=e.insert("circle",":first-child"),r.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14);return H(t,r),t.intersect=function(h){return N.circle(t,7,h)},e}$(Os,"stateStart");async function _s(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=(t?.padding||0)/2,s=r.width+t.padding,c=r.height+t.padding,n=-r.width/2-h,l=-r.height/2-h,g=[{x:0,y:0},{x:s,y:0},{x:s,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:s+8,y:0},{x:s+8,y:-c},{x:-8,y:-c},{x:-8,y:0}];if(t.look==="handDrawn"){let f=S.svg(e),p=W(t,{}),u=f.rectangle(n-8,l,s+16,c,p),y=f.line(n,l,n,l+c,p),m=f.line(n+s,l,n+s,l+c,p);e.insert(()=>y,":first-child"),e.insert(()=>m,":first-child");let d=e.insert(()=>u,":first-child"),{cssStyles:x}=t;d.attr("class","basic label-container").attr("style",U(x)),H(t,d)}else{let f=ut(e,s,c,g);a&&f.attr("style",a),H(t,f)}return t.intersect=function(f){return N.polygon(t,g,f)},e}$(_s,"subroutine");async function zs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=Math.max(r.width+(t.padding??0)*2,t?.width??0),s=Math.max(r.height+(t.padding??0)*2,t?.height??0),c=-h/2,n=-s/2,l=.2*s,g=.2*s,{cssStyles:f}=t,p=S.svg(e),u=W(t,{}),y=[{x:c-l/2,y:n},{x:c+h+l/2,y:n},{x:c+h+l/2,y:n+s},{x:c-l/2,y:n+s}],m=[{x:c+h-l/2,y:n+s},{x:c+h+l/2,y:n+s},{x:c+h+l/2,y:n+s-g}];t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=q(y),x=p.path(d,u),b=q(m),M=p.path(b,{...u,fillStyle:"solid"}),w=e.insert(()=>M,":first-child");return w.insert(()=>x,":first-child"),w.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),H(t,w),t.intersect=function(k){return N.polygon(t,y,k)},e}$(zs,"taggedRect");async function js(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=c/4,l=.2*s,g=.2*c,f=c+n,{cssStyles:p}=t,u=S.svg(e),y=W(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let m=[{x:-s/2-s/2*.1,y:f/2},...pt(-s/2-s/2*.1,f/2,s/2+s/2*.1,f/2,n,.8),{x:s/2+s/2*.1,y:-f/2},{x:-s/2-s/2*.1,y:-f/2}],d=-s/2+s/2*.1,x=-f/2-g*.4,b=[{x:d+s-l,y:(x+c)*1.4},{x:d+s,y:x+c-g},{x:d+s,y:(x+c)*.9},...pt(d+s,(x+c)*1.3,d+s-l,(x+c)*1.5,-c*.03,.5)],M=q(m),w=u.path(M,y),k=q(b),v=u.path(k,{...y,fillStyle:"solid"}),D=e.insert(()=>v,":first-child");return D.insert(()=>w,":first-child"),D.attr("class","basic label-container"),p&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",p),a&&t.look!=="handDrawn"&&D.selectAll("path").attr("style",a),D.attr("transform",`translate(0,${-n/2})`),h.attr("transform",`translate(${-s/2+(t.padding??0)-(r.x-(r.left??0))},${-c/2+(t.padding??0)-n/2-(r.y-(r.top??0))})`),H(t,D),t.intersect=function(B){return N.polygon(t,m,B)},e}$(js,"taggedWaveEdgedRectangle");async function Gs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=Math.max(r.width+t.padding,t?.width||0),s=Math.max(r.height+t.padding,t?.height||0),c=-h/2,n=-s/2,l=e.insert("rect",":first-child");return l.attr("class","text").attr("style",a).attr("rx",0).attr("ry",0).attr("x",c).attr("y",n).attr("width",h).attr("height",s),H(t,l),t.intersect=function(g){return N.rect(t,g)},e}$(Gs,"text");var La=$((o,t,i,a,e,r)=>`M${o},${t}
|
|
a${e},${r} 0,0,1 0,${-a}
|
|
l${i},0
|
|
a${e},${r} 0,0,1 0,${a}
|
|
M${i},${-a}
|
|
a${e},${r} 0,0,0 0,${a}
|
|
l${-i},0`,"createCylinderPathD"),Wa=$((o,t,i,a,e,r)=>[`M${o},${t}`,`M${o+i},${t}`,`a${e},${r} 0,0,0 0,${-a}`,`l${-i},0`,`a${e},${r} 0,0,0 0,${a}`,`l${i},0`].join(" "),"createOuterCylinderPathD"),Ta=$((o,t,i,a,e,r)=>[`M${o+i/2},${-a/2}`,`a${e},${r} 0,0,0 0,${a}`].join(" "),"createInnerCylinderPathD");async function qs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h,halfPadding:s}=await G(o,t,_(t)),c=t.look==="neo"?s*2:s,n=r.height+c,l=n/2,g=l/(2.5+n/50),f=r.width+g+c,{cssStyles:p}=t,u;if(t.look==="handDrawn"){let y=S.svg(e),m=Wa(0,0,f,n,g,l),d=Ta(0,0,f,n,g,l),x=y.path(m,W(t,{})),b=y.path(d,W(t,{fill:"none"}));u=e.insert(()=>b,":first-child"),u=e.insert(()=>x,":first-child"),u.attr("class","basic label-container"),p&&u.attr("style",p)}else{let y=La(0,0,f,n,g,l);u=e.insert("path",":first-child").attr("d",y).attr("class","basic label-container").attr("style",U(p)).attr("style",a),u.attr("class","basic label-container"),p&&u.selectAll("path").attr("style",p),a&&u.selectAll("path").attr("style",a)}return u.attr("label-offset-x",g),u.attr("transform",`translate(${-f/2}, ${n/2} )`),h.attr("transform",`translate(${-(r.width/2)-g-(r.x-(r.left??0))}, ${-(r.height/2)-(r.y-(r.top??0))})`),H(t,u),t.intersect=function(y){let m=N.rect(t,y),d=m.y-(t.y??0);if(l!=0&&(Math.abs(d)<(t.height??0)/2||Math.abs(d)==(t.height??0)/2&&Math.abs(m.x-(t.x??0))>(t.width??0)/2-g)){let x=g*g*(1-d*d/(l*l));x!=0&&(x=Math.sqrt(Math.abs(x))),x=g-x,y.x-(t.x??0)>0&&(x=-x),m.x+=x}return m},e}$(qs,"tiltedCylinder");async function Fs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=r.width+t.padding,s=r.height+t.padding,c=[{x:-3*s/6,y:0},{x:h+3*s/6,y:0},{x:h,y:-s},{x:0,y:-s}],n,{cssStyles:l}=t;if(t.look==="handDrawn"){let g=S.svg(e),f=W(t,{}),p=q(c),u=g.path(p,f);n=e.insert(()=>u,":first-child").attr("transform",`translate(${-h/2}, ${s/2})`),l&&n.attr("style",l)}else n=ut(e,h,s,c);return a&&n.attr("style",a),t.width=h,t.height=s,H(t,n),t.intersect=function(g){return N.polygon(t,c,g)},e}$(Fs,"trapezoid");async function Xs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=60,s=20,c=Math.max(h,r.width+(t.padding??0)*2,t?.width??0),n=Math.max(s,r.height+(t.padding??0)*2,t?.height??0),{cssStyles:l}=t,g=S.svg(e),f=W(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let p=[{x:-c/2*.8,y:-n/2},{x:c/2*.8,y:-n/2},{x:c/2,y:-n/2*.6},{x:c/2,y:n/2},{x:-c/2,y:n/2},{x:-c/2,y:-n/2*.6}],u=q(p),y=g.path(u,f),m=e.insert(()=>y,":first-child");return m.attr("class","basic label-container"),l&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",l),a&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",a),H(t,m),t.intersect=function(d){return N.polygon(t,p,d)},e}$(Xs,"trapezoidalPentagon");async function Ys(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=J(V().flowchart?.htmlLabels),c=r.width+(t.padding??0),n=c+r.height,l=c+r.height,g=[{x:0,y:0},{x:l,y:0},{x:l/2,y:-n}],{cssStyles:f}=t,p=S.svg(e),u=W(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=q(g),m=p.path(y,u),d=e.insert(()=>m,":first-child").attr("transform",`translate(${-n/2}, ${n/2})`);return f&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",f),a&&t.look!=="handDrawn"&&d.selectChildren("path").attr("style",a),t.width=c,t.height=n,H(t,d),h.attr("transform",`translate(${-r.width/2-(r.x-(r.left??0))}, ${n/2-(r.height+(t.padding??0)/(s?2:1)-(r.y-(r.top??0)))})`),t.intersect=function(x){return F.info("Triangle intersect",t,g,x),N.polygon(t,g,x)},e}$(Ys,"triangle");async function Vs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=c/8,l=c+n,{cssStyles:g}=t,p=70-s,u=p>0?p/2:0,y=S.svg(e),m=W(t,{});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let d=[{x:-s/2-u,y:l/2},...pt(-s/2-u,l/2,s/2+u,l/2,n,.8),{x:s/2+u,y:-l/2},{x:-s/2-u,y:-l/2}],x=q(d),b=y.path(x,m),M=e.insert(()=>b,":first-child");return M.attr("class","basic label-container"),g&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",g),a&&t.look!=="handDrawn"&&M.selectAll("path").attr("style",a),M.attr("transform",`translate(0,${-n/2})`),h.attr("transform",`translate(${-s/2+(t.padding??0)-(r.x-(r.left??0))},${-c/2+(t.padding??0)-n-(r.y-(r.top??0))})`),H(t,M),t.intersect=function(w){return N.polygon(t,d,w)},e}$(Vs,"waveEdgedRectangle");async function Zs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r}=await G(o,t,_(t)),h=100,s=50,c=Math.max(r.width+(t.padding??0)*2,t?.width??0),n=Math.max(r.height+(t.padding??0)*2,t?.height??0),l=c/n,g=c,f=n;g>f*l?f=g/l:g=f*l,g=Math.max(g,h),f=Math.max(f,s);let p=Math.min(f*.2,f/4),u=f+p*2,{cssStyles:y}=t,m=S.svg(e),d=W(t,{});t.look!=="handDrawn"&&(d.roughness=0,d.fillStyle="solid");let x=[{x:-g/2,y:u/2},...pt(-g/2,u/2,g/2,u/2,p,1),{x:g/2,y:-u/2},...pt(g/2,-u/2,-g/2,-u/2,p,-1)],b=q(x),M=m.path(b,d),w=e.insert(()=>M,":first-child");return w.attr("class","basic label-container"),y&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",y),a&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",a),H(t,w),t.intersect=function(k){return N.polygon(t,x,k)},e}$(Zs,"waveRectangle");async function Qs(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,label:h}=await G(o,t,_(t)),s=Math.max(r.width+(t.padding??0)*2,t?.width??0),c=Math.max(r.height+(t.padding??0)*2,t?.height??0),n=5,l=-s/2,g=-c/2,{cssStyles:f}=t,p=S.svg(e),u=W(t,{}),y=[{x:l-n,y:g-n},{x:l-n,y:g+c},{x:l+s,y:g+c},{x:l+s,y:g-n}],m=`M${l-n},${g-n} L${l+s},${g-n} L${l+s},${g+c} L${l-n},${g+c} L${l-n},${g-n}
|
|
M${l-n},${g} L${l+s},${g}
|
|
M${l},${g-n} L${l},${g+c}`;t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let d=p.path(m,u),x=e.insert(()=>d,":first-child");return x.attr("transform",`translate(${n/2}, ${n/2})`),x.attr("class","basic label-container"),f&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",f),a&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",a),h.attr("transform",`translate(${-(r.width/2)+n/2-(r.x-(r.left??0))}, ${-(r.height/2)+n/2-(r.y-(r.top??0))})`),H(t,x),t.intersect=function(b){return N.polygon(t,y,b)},e}$(Qs,"windowPane");async function xe(o,t){let i=t;if(i.alias&&(t.label=i.alias),t.look==="handDrawn"){let{themeVariables:X}=mt(),{background:Q}=X,tt={...t,id:t.id+"-background",look:"default",cssStyles:["stroke: none",`fill: ${Q}`]};await xe(o,tt)}let a=mt();t.useHtmlLabels=a.htmlLabels;let e=a.er?.diagramPadding??10,r=a.er?.entityPadding??6,{cssStyles:h}=t,{labelStyles:s,nodeStyles:c}=T(t);if(i.attributes.length===0&&t.label){let X={rx:0,ry:0,labelPaddingX:e,labelPaddingY:e*1.5,classes:""};kt(t.label,a)+X.labelPaddingX*2<a.er.minEntityWidth&&(t.width=a.er.minEntityWidth);let Q=await Gt(o,t,X);if(!J(a.htmlLabels)){let tt=Q.select("text"),st=tt.node()?.getBBox();tt.attr("transform",`translate(${-st.width/2}, 0)`)}return Q}a.htmlLabels||(e*=1.25,r*=1.25);let n=_(t);n||(n="node default");let l=o.insert("g").attr("class",n).attr("id",t.domId||t.id),g=await St(l,t.label??"",a,0,0,["name"],s);g.height+=r;let f=0,p=[],u=[],y=0,m=0,d=0,x=0,b=!0,M=!0;for(let X of i.attributes){let Q=await St(l,X.type,a,0,f,["attribute-type"],s);y=Math.max(y,Q.width+e);let tt=await St(l,X.name,a,0,f,["attribute-name"],s);m=Math.max(m,tt.width+e);let st=await St(l,X.keys.join(),a,0,f,["attribute-keys"],s);d=Math.max(d,st.width+e);let yt=await St(l,X.comment,a,0,f,["attribute-comment"],s);x=Math.max(x,yt.width+e);let ot=Math.max(Q.height,tt.height,st.height,yt.height)+r;u.push({yOffset:f,rowHeight:ot}),f+=ot}let w=4;d<=e&&(b=!1,d=0,w--),x<=e&&(M=!1,x=0,w--);let k=l.node().getBBox();if(g.width+e*2-(y+m+d+x)>0){let X=g.width+e*2-(y+m+d+x);y+=X/w,m+=X/w,d>0&&(d+=X/w),x>0&&(x+=X/w)}let v=y+m+d+x,D=S.svg(l),B=W(t,{});t.look!=="handDrawn"&&(B.roughness=0,B.fillStyle="solid");let L=0;u.length>0&&(L=u.reduce((X,Q)=>X+(Q?.rowHeight??0),0));let A=Math.max(k.width+e*2,t?.width||0,v),I=Math.max((L??0)+g.height,t?.height||0),P=-A/2,C=-I/2;l.selectAll("g:not(:first-child)").each((X,Q,tt)=>{let st=Y(tt[Q]),yt=st.attr("transform"),ot=0,be=0;if(yt){let Ft=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(yt);Ft&&(ot=parseFloat(Ft[1]),be=parseFloat(Ft[2]),st.attr("class").includes("attribute-name")?ot+=y:st.attr("class").includes("attribute-keys")?ot+=y+m:st.attr("class").includes("attribute-comment")&&(ot+=y+m+d))}st.attr("transform",`translate(${P+e/2+ot}, ${be+C+g.height+r/2})`)}),l.select(".name").attr("transform","translate("+-g.width/2+", "+(C+r/2)+")");let E=D.rectangle(P,C,A,I,B),R=l.insert(()=>E,":first-child").attr("style",h.join("")),{themeVariables:O}=mt(),{rowEven:z,rowOdd:Z,nodeBorder:rt}=O;p.push(0);for(let[X,Q]of u.entries()){let st=(X+1)%2===0&&Q.yOffset!==0,yt=D.rectangle(P,g.height+C+Q?.yOffset,A,Q?.rowHeight,{...B,fill:st?z:Z,stroke:rt});l.insert(()=>yt,"g.label").attr("style",h.join("")).attr("class",`row-rect-${st?"even":"odd"}`)}let it=D.line(P,g.height+C,A+P,g.height+C,B);l.insert(()=>it).attr("class","divider"),it=D.line(y+P,g.height+C,y+P,I+C,B),l.insert(()=>it).attr("class","divider"),b&&(it=D.line(y+m+P,g.height+C,y+m+P,I+C,B),l.insert(()=>it).attr("class","divider")),M&&(it=D.line(y+m+d+P,g.height+C,y+m+d+P,I+C,B),l.insert(()=>it).attr("class","divider"));for(let X of p)it=D.line(P,g.height+C+X,A+P,g.height+C+X,B),l.insert(()=>it).attr("class","divider");if(H(t,R),c&&t.look!=="handDrawn"){let Q=c.split(";")?.filter(tt=>tt.includes("stroke"))?.map(tt=>`${tt}`).join("; ");l.selectAll("path").attr("style",Q??""),l.selectAll(".row-rect-even path").attr("style",c)}return t.intersect=function(X){return N.rect(t,X)},l}$(xe,"erBox");async function St(o,t,i,a=0,e=0,r=[],h=""){let s=o.insert("g").attr("class",`label ${r.join(" ")}`).attr("transform",`translate(${a}, ${e})`).attr("style",h);t!==Xt(t)&&(t=Xt(t),t=t.replaceAll("<","<").replaceAll(">",">"));let c=s.node().appendChild(await ht(s,t,{width:kt(t,i)+100,style:h,useHtmlLabels:i.htmlLabels},i));if(t.includes("<")||t.includes(">")){let l=c.children[0];for(l.textContent=l.textContent.replaceAll("<","<").replaceAll(">",">");l.childNodes[0];)l=l.childNodes[0],l.textContent=l.textContent.replaceAll("<","<").replaceAll(">",">")}let n=c.getBBox();if(J(i.htmlLabels)){let l=c.children[0];l.style.textAlign="start";let g=Y(c);n=l.getBoundingClientRect(),g.attr("width",n.width),g.attr("height",n.height)}return n}$(St,"addText");async function Js(o,t,i,a,e=i.class.padding??12){let r=a?0:3,h=o.insert("g").attr("class",_(t)).attr("id",t.domId||t.id),s=null,c=null,n=null,l=null,g=0,f=0,p=0;if(s=h.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let x=t.annotations[0];await Rt(s,{text:`\xAB${x}\xBB`},0),g=s.node().getBBox().height}c=h.insert("g").attr("class","label-group text"),await Rt(c,t,0,["font-weight: bolder"]);let u=c.node().getBBox();f=u.height,n=h.insert("g").attr("class","members-group text");let y=0;for(let x of t.members){let b=await Rt(n,x,y,[x.parseClassifier()]);y+=b+r}p=n.node().getBBox().height,p<=0&&(p=e/2),l=h.insert("g").attr("class","methods-group text");let m=0;for(let x of t.methods){let b=await Rt(l,x,m,[x.parseClassifier()]);m+=b+r}let d=h.node().getBBox();if(s!==null){let x=s.node().getBBox();s.attr("transform",`translate(${-x.width/2})`)}return c.attr("transform",`translate(${-u.width/2}, ${g})`),d=h.node().getBBox(),n.attr("transform",`translate(0, ${g+f+e*2})`),d=h.node().getBBox(),l.attr("transform",`translate(0, ${g+f+(p?p+e*4:e*2)})`),d=h.node().getBBox(),{shapeSvg:h,bbox:d}}$(Js,"textHelper");async function Rt(o,t,i,a=[]){let e=o.insert("g").attr("class","label").attr("style",a.join("; ")),r=mt(),h="useHtmlLabels"in t?t.useHtmlLabels:J(r.htmlLabels)??!0,s="";"text"in t?s=t.text:s=t.label,!h&&s.startsWith("\\")&&(s=s.substring(1)),Yt(s)&&(h=!0);let c=await ht(e,Vt(xt(s)),{width:kt(s,r)+50,classes:"markdown-node-label",useHtmlLabels:h},r),n,l=1;if(h){let g=c.children[0],f=Y(c);l=g.innerHTML.split("<br>").length,g.innerHTML.includes("</math>")&&(l+=g.innerHTML.split("<mrow>").length-1);let p=g.getElementsByTagName("img");if(p){let u=s.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...p].map(y=>new Promise(m=>{function d(){if(y.style.display="flex",y.style.flexDirection="column",u){let x=r.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,M=parseInt(x,10)*5+"px";y.style.minWidth=M,y.style.maxWidth=M}else y.style.width="100%";m(y)}$(d,"setupImage"),setTimeout(()=>{y.complete&&d()}),y.addEventListener("error",d),y.addEventListener("load",d)})))}n=g.getBoundingClientRect(),f.attr("width",n.width),f.attr("height",n.height)}else{a.includes("font-weight: bolder")&&Y(c).selectAll("tspan").attr("font-weight",""),l=c.children.length;let g=c.children[0];(c.textContent===""||c.textContent.includes(">"))&&(g.textContent=s[0]+s.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),s[1]===" "&&(g.textContent=g.textContent[0]+" "+g.textContent.substring(1))),g.textContent==="undefined"&&(g.textContent=""),n=c.getBBox()}return e.attr("transform","translate(0,"+(-n.height/(2*l)+i)+")"),n.height}$(Rt,"addText");async function Ks(o,t){let i=V(),a=i.class.padding??12,e=a,r=t.useHtmlLabels??J(i.htmlLabels)??!0,h=t;h.annotations=h.annotations??[],h.members=h.members??[],h.methods=h.methods??[];let{shapeSvg:s,bbox:c}=await Js(o,t,i,r,e),{labelStyles:n,nodeStyles:l}=T(t);t.labelStyle=n,t.cssStyles=h.styles||"";let g=h.styles?.join(";")||l||"";t.cssStyles||(t.cssStyles=g.replaceAll("!important","").split(";"));let f=h.members.length===0&&h.methods.length===0&&!i.class?.hideEmptyMembersBox,p=S.svg(s),u=W(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let y=c.width,m=c.height;h.members.length===0&&h.methods.length===0?m+=e:h.members.length>0&&h.methods.length===0&&(m+=e*2);let d=-y/2,x=-m/2,b=p.rectangle(d-a,x-a-(f?a:h.members.length===0&&h.methods.length===0?-a/2:0),y+2*a,m+2*a+(f?a*2:h.members.length===0&&h.methods.length===0?-a:0),u),M=s.insert(()=>b,":first-child");M.attr("class","basic label-container");let w=M.node().getBBox();s.selectAll(".text").each((B,L,A)=>{let I=Y(A[L]),P=I.attr("transform"),C=0;if(P){let z=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(P);z&&(C=parseFloat(z[2]))}let E=C+x+a-(f?a:h.members.length===0&&h.methods.length===0?-a/2:0);r||(E-=4);let R=d;(I.attr("class").includes("label-group")||I.attr("class").includes("annotation-group"))&&(R=-I.node()?.getBBox().width/2||0,s.selectAll("text").each(function(O,z,Z){window.getComputedStyle(Z[z]).textAnchor==="middle"&&(R=0)})),I.attr("transform",`translate(${R}, ${E})`)});let k=s.select(".annotation-group").node().getBBox().height-(f?a/2:0)||0,v=s.select(".label-group").node().getBBox().height-(f?a/2:0)||0,D=s.select(".members-group").node().getBBox().height-(f?a/2:0)||0;if(h.members.length>0||h.methods.length>0||f){let B=p.line(w.x,k+v+x+a,w.x+w.width,k+v+x+a,u);s.insert(()=>B).attr("class","divider").attr("style",g)}if(f||h.members.length>0||h.methods.length>0){let B=p.line(w.x,k+v+D+x+e*2+a,w.x+w.width,k+v+D+x+a+e*2,u);s.insert(()=>B).attr("class","divider").attr("style",g)}if(h.look!=="handDrawn"&&s.selectAll("path").attr("style",g),M.select(":nth-child(2)").attr("style",g),s.selectAll(".divider").select("path").attr("style",g),t.labelStyle?s.selectAll("span").attr("style",t.labelStyle):s.selectAll("span").attr("style",g),!r){let B=RegExp(/color\s*:\s*([^;]*)/),L=B.exec(g);if(L){let A=L[0].replace("color","fill");s.selectAll("tspan").attr("style",A)}else if(n){let A=B.exec(n);if(A){let I=A[0].replace("color","fill");s.selectAll("tspan").attr("style",I)}}}return H(t,M),t.intersect=function(B){return N.rect(t,B)},s}$(Ks,"classBox");async function Us(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let e=t,r=t,h=20,s=20,c="verifyMethod"in t,n=_(t),l=o.insert("g").attr("class",n).attr("id",t.domId??t.id),g;c?g=await nt(l,`<<${e.type}>>`,0,t.labelStyle):g=await nt(l,"<<Element>>",0,t.labelStyle);let f=g,p=await nt(l,e.name,f,t.labelStyle+"; font-weight: bold;");if(f+=p+s,c){let k=await nt(l,`${e.requirementId?`ID: ${e.requirementId}`:""}`,f,t.labelStyle);f+=k;let v=await nt(l,`${e.text?`Text: ${e.text}`:""}`,f,t.labelStyle);f+=v;let D=await nt(l,`${e.risk?`Risk: ${e.risk}`:""}`,f,t.labelStyle);f+=D,await nt(l,`${e.verifyMethod?`Verification: ${e.verifyMethod}`:""}`,f,t.labelStyle)}else{let k=await nt(l,`${r.type?`Type: ${r.type}`:""}`,f,t.labelStyle);f+=k,await nt(l,`${r.docRef?`Doc Ref: ${r.docRef}`:""}`,f,t.labelStyle)}let u=(l.node()?.getBBox().width??200)+h,y=(l.node()?.getBBox().height??200)+h,m=-u/2,d=-y/2,x=S.svg(l),b=W(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let M=x.rectangle(m,d,u,y,b),w=l.insert(()=>M,":first-child");if(w.attr("class","basic label-container").attr("style",a),l.selectAll(".label").each((k,v,D)=>{let B=Y(D[v]),L=B.attr("transform"),A=0,I=0;if(L){let R=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(L);R&&(A=parseFloat(R[1]),I=parseFloat(R[2]))}let P=I-y/2,C=m+h/2;(v===0||v===1)&&(C=A),B.attr("transform",`translate(${C}, ${P+h})`)}),f>g+p+s){let k=x.line(m,d+g+p+s,m+u,d+g+p+s,b);l.insert(()=>k).attr("style",a)}return H(t,w),t.intersect=function(k){return N.rect(t,k)},l}$(Us,"requirementBox");async function nt(o,t,i,a=""){if(t==="")return 0;let e=o.insert("g").attr("class","label").attr("style",a),r=V(),h=r.htmlLabels??!0,s=await ht(e,Vt(xt(t)),{width:kt(t,r)+50,classes:"markdown-node-label",useHtmlLabels:h,style:a},r),c;if(h){let n=s.children[0],l=Y(s);c=n.getBoundingClientRect(),l.attr("width",c.width),l.attr("height",c.height)}else{let n=s.children[0];for(let l of n.children)l.textContent=l.textContent.replaceAll(">",">").replaceAll("<","<"),a&&l.setAttribute("style",a);c=s.getBBox(),c.height+=6}return e.attr("transform",`translate(${-c.width/2},${-c.height/2+i})`),c.height}$(nt,"addText");var Ha=$(o=>{switch(o){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");async function ta(o,t,{config:i}){let{labelStyles:a,nodeStyles:e}=T(t);t.labelStyle=a||"";let r=10,h=t.width;t.width=(t.width??200)-10;let{shapeSvg:s,bbox:c,label:n}=await G(o,t,_(t)),l=t.padding||10,g="",f;"ticket"in t&&t.ticket&&i?.kanban?.ticketBaseUrl&&(g=i?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),f=s.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",g).attr("target","_blank"));let p={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},u,y;f?{label:u,bbox:y}=await fe(f,"ticket"in t&&t.ticket||"",p):{label:u,bbox:y}=await fe(s,"ticket"in t&&t.ticket||"",p);let{label:m,bbox:d}=await fe(s,"assigned"in t&&t.assigned||"",p);t.width=h;let x=10,b=t?.width||0,M=Math.max(y.height,d.height)/2,w=Math.max(c.height+x*2,t?.height||0)+M,k=-b/2,v=-w/2;n.attr("transform","translate("+(l-b/2)+", "+(-M-c.height/2)+")"),u.attr("transform","translate("+(l-b/2)+", "+(-M+c.height/2)+")"),m.attr("transform","translate("+(l+b/2-d.width-2*r)+", "+(-M+c.height/2)+")");let D,{rx:B,ry:L}=t,{cssStyles:A}=t;if(t.look==="handDrawn"){let I=S.svg(s),P=W(t,{}),C=B||L?I.path(ft(k,v,b,w,B||0),P):I.rectangle(k,v,b,w,P);D=s.insert(()=>C,":first-child"),D.attr("class","basic label-container").attr("style",A||null)}else{D=s.insert("rect",":first-child"),D.attr("class","basic label-container __APA__").attr("style",e).attr("rx",B??5).attr("ry",L??5).attr("x",k).attr("y",v).attr("width",b).attr("height",w);let I="priority"in t&&t.priority;if(I){let P=s.append("line"),C=k+2,E=v+Math.floor((B??0)/2),R=v+w-Math.floor((B??0)/2);P.attr("x1",C).attr("y1",E).attr("x2",C).attr("y2",R).attr("stroke-width","4").attr("stroke",Ha(I))}}return H(t,D),t.height=w,t.intersect=function(I){return N.rect(t,I)},s}$(ta,"kanbanItem");async function ea(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,halfPadding:h,label:s}=await G(o,t,_(t)),c=r.width+10*h,n=r.height+8*h,l=.15*c,{cssStyles:g}=t,f=r.width+20,p=r.height+20,u=Math.max(c,f),y=Math.max(n,p);s.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`);let m,d=`M0 0
|
|
a${l},${l} 1 0,0 ${u*.25},${-1*y*.1}
|
|
a${l},${l} 1 0,0 ${u*.25},0
|
|
a${l},${l} 1 0,0 ${u*.25},0
|
|
a${l},${l} 1 0,0 ${u*.25},${y*.1}
|
|
|
|
a${l},${l} 1 0,0 ${u*.15},${y*.33}
|
|
a${l*.8},${l*.8} 1 0,0 0,${y*.34}
|
|
a${l},${l} 1 0,0 ${-1*u*.15},${y*.33}
|
|
|
|
a${l},${l} 1 0,0 ${-1*u*.25},${y*.15}
|
|
a${l},${l} 1 0,0 ${-1*u*.25},0
|
|
a${l},${l} 1 0,0 ${-1*u*.25},0
|
|
a${l},${l} 1 0,0 ${-1*u*.25},${-1*y*.15}
|
|
|
|
a${l},${l} 1 0,0 ${-1*u*.1},${-1*y*.33}
|
|
a${l*.8},${l*.8} 1 0,0 0,${-1*y*.34}
|
|
a${l},${l} 1 0,0 ${u*.1},${-1*y*.33}
|
|
H0 V0 Z`;if(t.look==="handDrawn"){let x=S.svg(e),b=W(t,{}),M=x.path(d,b);m=e.insert(()=>M,":first-child"),m.attr("class","basic label-container").attr("style",U(g))}else m=e.insert("path",":first-child").attr("class","basic label-container").attr("style",a).attr("d",d);return m.attr("transform",`translate(${-u/2}, ${-y/2})`),H(t,m),t.calcIntersect=function(x,b){return N.rect(x,b)},t.intersect=function(x){return F.info("Bang intersect",t,x),N.rect(t,x)},e}$(ea,"bang");async function sa(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,halfPadding:h,label:s}=await G(o,t,_(t)),c=r.width+2*h,n=r.height+2*h,l=.15*c,g=.25*c,f=.35*c,p=.2*c,{cssStyles:u}=t,y,m=`M0 0
|
|
a${l},${l} 0 0,1 ${c*.25},${-1*c*.1}
|
|
a${f},${f} 1 0,1 ${c*.4},${-1*c*.1}
|
|
a${g},${g} 1 0,1 ${c*.35},${c*.2}
|
|
|
|
a${l},${l} 1 0,1 ${c*.15},${n*.35}
|
|
a${p},${p} 1 0,1 ${-1*c*.15},${n*.65}
|
|
|
|
a${g},${l} 1 0,1 ${-1*c*.25},${c*.15}
|
|
a${f},${f} 1 0,1 ${-1*c*.5},0
|
|
a${l},${l} 1 0,1 ${-1*c*.25},${-1*c*.15}
|
|
|
|
a${l},${l} 1 0,1 ${-1*c*.1},${-1*n*.35}
|
|
a${p},${p} 1 0,1 ${c*.1},${-1*n*.65}
|
|
H0 V0 Z`;if(t.look==="handDrawn"){let d=S.svg(e),x=W(t,{}),b=d.path(m,x);y=e.insert(()=>b,":first-child"),y.attr("class","basic label-container").attr("style",U(u))}else y=e.insert("path",":first-child").attr("class","basic label-container").attr("style",a).attr("d",m);return s.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`),y.attr("transform",`translate(${-c/2}, ${-n/2})`),H(t,y),t.calcIntersect=function(d,x){return N.rect(d,x)},t.intersect=function(d){return F.info("Cloud intersect",t,d),N.rect(t,d)},e}$(sa,"cloud");async function aa(o,t){let{labelStyles:i,nodeStyles:a}=T(t);t.labelStyle=i;let{shapeSvg:e,bbox:r,halfPadding:h,label:s}=await G(o,t,_(t)),c=r.width+8*h,n=r.height+2*h,l=5,g=`
|
|
M${-c/2} ${n/2-l}
|
|
v${-n+2*l}
|
|
q0,-${l} ${l},-${l}
|
|
h${c-2*l}
|
|
q${l},0 ${l},${l}
|
|
v${n-2*l}
|
|
q0,${l} -${l},${l}
|
|
h${-c+2*l}
|
|
q-${l},0 -${l},-${l}
|
|
Z
|
|
`,f=e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("style",a).attr("d",g);return e.append("line").attr("class","node-line-").attr("x1",-c/2).attr("y1",n/2).attr("x2",c/2).attr("y2",n/2),s.attr("transform",`translate(${-r.width/2}, ${-r.height/2})`),e.append(()=>s.node()),H(t,f),t.calcIntersect=function(p,u){return N.rect(p,u)},t.intersect=function(p){return N.rect(t,p)},e}$(aa,"defaultMindmapNode");async function ra(o,t){let i={padding:t.padding??0};return me(o,t,i)}$(ra,"mindmapCircle");var Ia=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Ts},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:As},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Hs},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:_s},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:ns},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:me},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:ea},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:sa},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:Cs},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:ps},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:$s},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:Ss},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Fs},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:bs},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:ls},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Gs},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:Je},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Ls},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:Os},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Es},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:hs},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:fs},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:es},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:ss},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:as},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:Ms},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:Vs},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:gs},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:qs},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:ks},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:rs},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:is},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:Ys},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:Qs},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:cs},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:Xs},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:os},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Ws},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:Ps},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:Ds},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:Qe},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:ts},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:js},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:zs},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:Zs},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Ns},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:vs}],Ea=$(()=>{let t=[...Object.entries({state:Is,choice:Ke,note:Bs,rectWithTitle:Rs,labelRect:ws,iconSquare:ms,iconCircle:ys,icon:us,iconRounded:ds,imageSquare:xs,anchor:Ze,kanbanItem:ta,mindmapCircle:ra,defaultMindmapNode:aa,classBox:Ks,erBox:xe,requirementBox:Us}),...Ia.flatMap(i=>[i.shortName,..."aliases"in i?i.aliases:[],..."internalAliases"in i?i.internalAliases:[]].map(e=>[e,i.handler]))];return Object.fromEntries(t)},"generateShapeMap"),na=Ea();function Oa(o){return o in na}$(Oa,"isValidShape");var qt=new Map;async function _a(o,t,i){let a,e;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let r=t.shape?na[t.shape]:void 0;if(!r)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let h;i.config.securityLevel==="sandbox"?h="_top":t.linkTarget&&(h=t.linkTarget||"_blank"),a=o.insert("svg:a").attr("xlink:href",t.link).attr("target",h??null),e=await r(a,t,i)}else e=await r(o,t,i),a=e;return t.tooltip&&e.attr("title",t.tooltip),qt.set(t.id,a),t.haveCallback&&a.attr("class",a.attr("class")+" clickable"),a}$(_a,"insertNode");var pn=$((o,t)=>{qt.set(t.id,o)},"setNodeElem"),fn=$(()=>{qt.clear()},"clear"),un=$(o=>{let t=qt.get(o.id);F.trace("Transforming node",o.diff,o,"translate("+(o.x-o.width/2-5)+", "+o.width/2+")");let i=8,a=o.diff||0;return o.clusterNode?t.attr("transform","translate("+(o.x+a-o.width/2)+", "+(o.y-o.height/2-i)+")"):t.attr("transform","translate("+o.x+", "+o.y+")"),a},"positionNode");export{S as a,G as b,H as c,ue as d,Ua as e,tr as f,Oa as g,_a as h,pn as i,fn as j,un as k};
|
|
//# sourceMappingURL=chunk-IDQ2RCY2.min.js.map
|