rdesign/frontend/node_modules/mermaid/dist/chunks/mermaid.esm.min/chunk-IWDTEBJL.mjs

2 lines
28 KiB
JavaScript

import{a as g}from"./chunk-VELTKBKT.mjs";function tt(a,t,s){if(a&&a.length){let[e,n]=t,o=Math.PI/180*s,r=Math.cos(o),h=Math.sin(o);for(let i of a){let[l,c]=i;i[0]=(l-e)*r-(c-n)*h+e,i[1]=(l-e)*h+(c-n)*r+n}}}g(tt,"t");function Wt(a,t){return a[0]===t[0]&&a[1]===t[1]}g(Wt,"e");function Et(a,t,s,e=1){let n=s,o=Math.max(t,.1),r=a[0]&&a[0][0]&&typeof a[0][0]=="number"?[a]:a,h=[0,0];if(n)for(let l of r)tt(l,h,n);let i=(function(l,c,d){let p=[];for(let k of l){let w=[...k];Wt(w[0],w[w.length-1])||w.push([w[0][0],w[0][1]]),w.length>2&&p.push(w)}let u=[];c=Math.max(c,.1);let f=[];for(let k of p)for(let w=0;w<k.length-1;w++){let v=k[w],P=k[w+1];if(v[1]!==P[1]){let x=Math.min(v[1],P[1]);f.push({ymin:x,ymax:Math.max(v[1],P[1]),x:x===v[1]?v[0]:P[0],islope:(P[0]-v[0])/(P[1]-v[1])})}}if(f.sort(((k,w)=>k.ymin<w.ymin?-1:k.ymin>w.ymin?1:k.x<w.x?-1:k.x>w.x?1:k.ymax===w.ymax?0:(k.ymax-w.ymax)/Math.abs(k.ymax-w.ymax))),!f.length)return u;let M=[],b=f[0].ymin,y=0;for(;M.length||f.length;){if(f.length){let k=-1;for(let w=0;w<f.length&&!(f[w].ymin>b);w++)k=w;f.splice(0,k+1).forEach((w=>{M.push({s:b,edge:w})}))}if(M=M.filter((k=>!(k.edge.ymax<=b))),M.sort(((k,w)=>k.edge.x===w.edge.x?0:(k.edge.x-w.edge.x)/Math.abs(k.edge.x-w.edge.x))),(d!==1||y%c==0)&&M.length>1)for(let k=0;k<M.length;k+=2){let w=k+1;if(w>=M.length)break;let v=M[k].edge,P=M[w].edge;u.push([[Math.round(v.x),b],[Math.round(P.x),b]])}b+=d,M.forEach((k=>{k.edge.x=k.edge.x+d*k.edge.islope})),y++}return u})(r,o,e);if(n){for(let l of r)tt(l,h,-n);(function(l,c,d){let p=[];l.forEach((u=>p.push(...u))),tt(p,c,d)})(i,h,-n)}return i}g(Et,"s");function V(a,t){var s;let e=t.hachureAngle+90,n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.round(Math.max(n,.1));let o=1;return t.roughness>=1&&(((s=t.randomizer)===null||s===void 0?void 0:s.next())||Math.random())>.7&&(o=n),Et(a,n,e,o||1)}g(V,"n");var F=class{static{g(this,"o")}constructor(t){this.helper=t}fillPolygons(t,s){return this._fillPolygons(t,s)}_fillPolygons(t,s){let e=V(t,s);return{type:"fillSketch",ops:this.renderLines(e,s)}}renderLines(t,s){let e=[];for(let n of t)e.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],s));return e}};function Y(a){let t=a[0],s=a[1];return Math.sqrt(Math.pow(t[0]-s[0],2)+Math.pow(t[1]-s[1],2))}g(Y,"a");var ot=class extends F{static{g(this,"h")}fillPolygons(t,s){let e=s.hachureGap;e<0&&(e=4*s.strokeWidth),e=Math.max(e,.1);let n=V(t,Object.assign({},s,{hachureGap:e})),o=Math.PI/180*s.hachureAngle,r=[],h=.5*e*Math.cos(o),i=.5*e*Math.sin(o);for(let[l,c]of n)Y([l,c])&&r.push([[l[0]-h,l[1]+i],[...c]],[[l[0]+h,l[1]-i],[...c]]);return{type:"fillSketch",ops:this.renderLines(r,s)}}},ht=class extends F{static{g(this,"r")}fillPolygons(t,s){let e=this._fillPolygons(t,s),n=Object.assign({},s,{hachureAngle:s.hachureAngle+90}),o=this._fillPolygons(t,n);return e.ops=e.ops.concat(o.ops),e}},rt=class{static{g(this,"i")}constructor(t){this.helper=t}fillPolygons(t,s){let e=V(t,s=Object.assign({},s,{hachureAngle:0}));return this.dotsOnLines(e,s)}dotsOnLines(t,s){let e=[],n=s.hachureGap;n<0&&(n=4*s.strokeWidth),n=Math.max(n,.1);let o=s.fillWeight;o<0&&(o=s.strokeWidth/2);let r=n/4;for(let h of t){let i=Y(h),l=i/n,c=Math.ceil(l)-1,d=i-c*n,p=(h[0][0]+h[1][0])/2-n/4,u=Math.min(h[0][1],h[1][1]);for(let f=0;f<c;f++){let M=u+d+f*n,b=p-r+2*Math.random()*r,y=M-r+2*Math.random()*r,k=this.helper.ellipse(b,y,o,o,s);e.push(...k.ops)}}return{type:"fillSketch",ops:e}}},it=class{static{g(this,"c")}constructor(t){this.helper=t}fillPolygons(t,s){let e=V(t,s);return{type:"fillSketch",ops:this.dashedLine(e,s)}}dashedLine(t,s){let e=s.dashOffset<0?s.hachureGap<0?4*s.strokeWidth:s.hachureGap:s.dashOffset,n=s.dashGap<0?s.hachureGap<0?4*s.strokeWidth:s.hachureGap:s.dashGap,o=[];return t.forEach((r=>{let h=Y(r),i=Math.floor(h/(e+n)),l=(h+n-i*(e+n))/2,c=r[0],d=r[1];c[0]>d[0]&&(c=r[1],d=r[0]);let p=Math.atan((d[1]-c[1])/(d[0]-c[0]));for(let u=0;u<i;u++){let f=u*(e+n),M=f+e,b=[c[0]+f*Math.cos(p)+l*Math.cos(p),c[1]+f*Math.sin(p)+l*Math.sin(p)],y=[c[0]+M*Math.cos(p)+l*Math.cos(p),c[1]+M*Math.sin(p)+l*Math.sin(p)];o.push(...this.helper.doubleLineOps(b[0],b[1],y[0],y[1],s))}})),o}},ct=class{static{g(this,"l")}constructor(t){this.helper=t}fillPolygons(t,s){let e=s.hachureGap<0?4*s.strokeWidth:s.hachureGap,n=s.zigzagOffset<0?e:s.zigzagOffset,o=V(t,s=Object.assign({},s,{hachureGap:e+n}));return{type:"fillSketch",ops:this.zigzagLines(o,n,s)}}zigzagLines(t,s,e){let n=[];return t.forEach((o=>{let r=Y(o),h=Math.round(r/(2*s)),i=o[0],l=o[1];i[0]>l[0]&&(i=o[1],l=o[0]);let c=Math.atan((l[1]-i[1])/(l[0]-i[0]));for(let d=0;d<h;d++){let p=2*d*s,u=2*(d+1)*s,f=Math.sqrt(2*Math.pow(s,2)),M=[i[0]+p*Math.cos(c),i[1]+p*Math.sin(c)],b=[i[0]+u*Math.cos(c),i[1]+u*Math.sin(c)],y=[M[0]+f*Math.cos(c+Math.PI/4),M[1]+f*Math.sin(c+Math.PI/4)];n.push(...this.helper.doubleLineOps(M[0],M[1],y[0],y[1],e),...this.helper.doubleLineOps(y[0],y[1],b[0],b[1],e))}})),n}},O={},lt=class{static{g(this,"p")}constructor(t){this.seed=t}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}},Gt=0,et=1,yt=2,Q={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 st(a,t){return a.type===t}g(st,"k");function Mt(a){let t=[],s=(function(r){let h=new Array;for(;r!=="";)if(r.match(/^([ \t\r\n,]+)/))r=r.substr(RegExp.$1.length);else if(r.match(/^([aAcChHlLmMqQsStTvVzZ])/))h[h.length]={type:Gt,text:RegExp.$1},r=r.substr(RegExp.$1.length);else{if(!r.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];h[h.length]={type:et,text:`${parseFloat(RegExp.$1)}`},r=r.substr(RegExp.$1.length)}return h[h.length]={type:yt,text:""},h})(a),e="BOD",n=0,o=s[n];for(;!st(o,yt);){let r=0,h=[];if(e==="BOD"){if(o.text!=="M"&&o.text!=="m")return Mt("M0,0"+a);n++,r=Q[o.text],e=o.text}else st(o,et)?r=Q[e]:(n++,r=Q[o.text],e=o.text);if(!(n+r<s.length))throw new Error("Path data ended short");for(let i=n;i<n+r;i++){let l=s[i];if(!st(l,et))throw new Error("Param not a number: "+e+","+l.text);h[h.length]=+l.text}if(typeof Q[e]!="number")throw new Error("Bad segment: "+e);{let i={key:e,data:h};t.push(i),n+=r,o=s[n],e==="M"&&(e="L"),e==="m"&&(e="l")}}return t}g(Mt,"b");function Lt(a){let t=0,s=0,e=0,n=0,o=[];for(let{key:r,data:h}of a)switch(r){case"M":o.push({key:"M",data:[...h]}),[t,s]=h,[e,n]=h;break;case"m":t+=h[0],s+=h[1],o.push({key:"M",data:[t,s]}),e=t,n=s;break;case"L":o.push({key:"L",data:[...h]}),[t,s]=h;break;case"l":t+=h[0],s+=h[1],o.push({key:"L",data:[t,s]});break;case"C":o.push({key:"C",data:[...h]}),t=h[4],s=h[5];break;case"c":{let i=h.map(((l,c)=>c%2?l+s:l+t));o.push({key:"C",data:i}),t=i[4],s=i[5];break}case"Q":o.push({key:"Q",data:[...h]}),t=h[2],s=h[3];break;case"q":{let i=h.map(((l,c)=>c%2?l+s:l+t));o.push({key:"Q",data:i}),t=i[2],s=i[3];break}case"A":o.push({key:"A",data:[...h]}),t=h[5],s=h[6];break;case"a":t+=h[5],s+=h[6],o.push({key:"A",data:[h[0],h[1],h[2],h[3],h[4],t,s]});break;case"H":o.push({key:"H",data:[...h]}),t=h[0];break;case"h":t+=h[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...h]}),s=h[0];break;case"v":s+=h[0],o.push({key:"V",data:[s]});break;case"S":o.push({key:"S",data:[...h]}),t=h[2],s=h[3];break;case"s":{let i=h.map(((l,c)=>c%2?l+s:l+t));o.push({key:"S",data:i}),t=i[2],s=i[3];break}case"T":o.push({key:"T",data:[...h]}),t=h[0],s=h[1];break;case"t":t+=h[0],s+=h[1],o.push({key:"T",data:[t,s]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=e,s=n}return o}g(Lt,"y");function Tt(a){let t=[],s="",e=0,n=0,o=0,r=0,h=0,i=0;for(let{key:l,data:c}of a){switch(l){case"M":t.push({key:"M",data:[...c]}),[e,n]=c,[o,r]=c;break;case"C":t.push({key:"C",data:[...c]}),e=c[4],n=c[5],h=c[2],i=c[3];break;case"L":t.push({key:"L",data:[...c]}),[e,n]=c;break;case"H":e=c[0],t.push({key:"L",data:[e,n]});break;case"V":n=c[0],t.push({key:"L",data:[e,n]});break;case"S":{let d=0,p=0;s==="C"||s==="S"?(d=e+(e-h),p=n+(n-i)):(d=e,p=n),t.push({key:"C",data:[d,p,...c]}),h=c[0],i=c[1],e=c[2],n=c[3];break}case"T":{let[d,p]=c,u=0,f=0;s==="Q"||s==="T"?(u=e+(e-h),f=n+(n-i)):(u=e,f=n);let M=e+2*(u-e)/3,b=n+2*(f-n)/3,y=d+2*(u-d)/3,k=p+2*(f-p)/3;t.push({key:"C",data:[M,b,y,k,d,p]}),h=u,i=f,e=d,n=p;break}case"Q":{let[d,p,u,f]=c,M=e+2*(d-e)/3,b=n+2*(p-n)/3,y=u+2*(d-u)/3,k=f+2*(p-f)/3;t.push({key:"C",data:[M,b,y,k,u,f]}),h=d,i=p,e=u,n=f;break}case"A":{let d=Math.abs(c[0]),p=Math.abs(c[1]),u=c[2],f=c[3],M=c[4],b=c[5],y=c[6];d===0||p===0?(t.push({key:"C",data:[e,n,b,y,b,y]}),e=b,n=y):(e!==b||n!==y)&&(Dt(e,n,b,y,d,p,u,f,M).forEach((function(k){t.push({key:"C",data:k})})),e=b,n=y);break}case"Z":t.push({key:"Z",data:[]}),e=o,n=r}s=l}return t}g(Tt,"m");function j(a,t,s){return[a*Math.cos(s)-t*Math.sin(s),a*Math.sin(s)+t*Math.cos(s)]}g(j,"w");function Dt(a,t,s,e,n,o,r,h,i,l){let c=(d=r,Math.PI*d/180);var d;let p=[],u=0,f=0,M=0,b=0;if(l)[u,f,M,b]=l;else{[a,t]=j(a,t,-c),[s,e]=j(s,e,-c);let D=(a-s)/2,S=(t-e)/2,I=D*D/(n*n)+S*S/(o*o);I>1&&(I=Math.sqrt(I),n*=I,o*=I);let E=n*n,G=o*o,Ct=E*G-E*S*S-G*D*D,zt=E*S*S+G*D*D,bt=(h===i?-1:1)*Math.sqrt(Math.abs(Ct/zt));M=bt*n*S/o+(a+s)/2,b=bt*-o*D/n+(t+e)/2,u=Math.asin(parseFloat(((t-b)/o).toFixed(9))),f=Math.asin(parseFloat(((e-b)/o).toFixed(9))),a<M&&(u=Math.PI-u),s<M&&(f=Math.PI-f),u<0&&(u=2*Math.PI+u),f<0&&(f=2*Math.PI+f),i&&u>f&&(u-=2*Math.PI),!i&&f>u&&(f-=2*Math.PI)}let y=f-u;if(Math.abs(y)>120*Math.PI/180){let D=f,S=s,I=e;f=i&&f>u?u+120*Math.PI/180*1:u+120*Math.PI/180*-1,p=Dt(s=M+n*Math.cos(f),e=b+o*Math.sin(f),S,I,n,o,r,0,i,[f,D,M,b])}y=f-u;let k=Math.cos(u),w=Math.sin(u),v=Math.cos(f),P=Math.sin(f),x=Math.tan(y/4),T=4/3*n*x,_=4/3*o*x,Z=[a,t],A=[a+T*w,t-_*k],z=[s+T*P,e-_*v],kt=[s,e];if(A[0]=2*Z[0]-A[0],A[1]=2*Z[1]-A[1],l)return[A,z,kt].concat(p);{p=[A,z,kt].concat(p);let D=[];for(let S=0;S<p.length;S+=3){let I=j(p[S][0],p[S][1],c),E=j(p[S+1][0],p[S+1][1],c),G=j(p[S+2][0],p[S+2][1],c);D.push([I[0],I[1],E[0],E[1],G[0],G[1]])}return D}}g(Dt,"x");var $t={randOffset:g(function(a,t){return m(a,t)},"randOffset"),randOffsetWithRange:g(function(a,t,s){return K(a,t,s)},"randOffsetWithRange"),ellipse:g(function(a,t,s,e,n){let o=_t(s,e,n);return ut(a,t,n,o).opset},"ellipse"),doubleLineOps:g(function(a,t,s,e,n){return C(a,t,s,e,n,!0)},"doubleLineOps")};function At(a,t,s,e,n){return{type:"path",ops:C(a,t,s,e,n)}}g(At,"v");function B(a,t,s){let e=(a||[]).length;if(e>2){let n=[];for(let o=0;o<e-1;o++)n.push(...C(a[o][0],a[o][1],a[o+1][0],a[o+1][1],s));return t&&n.push(...C(a[e-1][0],a[e-1][1],a[0][0],a[0][1],s)),{type:"path",ops:n}}return e===2?At(a[0][0],a[0][1],a[1][0],a[1][1],s):{type:"path",ops:[]}}g(B,"S");function Rt(a,t,s,e,n){return(function(o,r){return B(o,!0,r)})([[a,t],[a+s,t],[a+s,t+e],[a,t+e]],n)}g(Rt,"O");function mt(a,t){if(a.length){let s=typeof a[0][0]=="number"?[a]:a,e=H(s[0],1*(1+.2*t.roughness),t),n=t.disableMultiStroke?[]:H(s[0],1.5*(1+.22*t.roughness),Pt(t));for(let o=1;o<s.length;o++){let r=s[o];if(r.length){let h=H(r,1*(1+.2*t.roughness),t),i=t.disableMultiStroke?[]:H(r,1.5*(1+.22*t.roughness),Pt(t));for(let l of h)l.op!=="move"&&e.push(l);for(let l of i)l.op!=="move"&&n.push(l)}}return{type:"path",ops:e.concat(n)}}return{type:"path",ops:[]}}g(mt,"L");function _t(a,t,s){let e=Math.sqrt(2*Math.PI*Math.sqrt((Math.pow(a/2,2)+Math.pow(t/2,2))/2)),n=Math.ceil(Math.max(s.curveStepCount,s.curveStepCount/Math.sqrt(200)*e)),o=2*Math.PI/n,r=Math.abs(a/2),h=Math.abs(t/2),i=1-s.curveFitting;return r+=m(r*i,s),h+=m(h*i,s),{increment:o,rx:r,ry:h}}g(_t,"T");function ut(a,t,s,e){let[n,o]=vt(e.increment,a,t,e.rx,e.ry,1,e.increment*K(.1,K(.4,1,s),s),s),r=U(n,null,s);if(!s.disableMultiStroke&&s.roughness!==0){let[h]=vt(e.increment,a,t,e.rx,e.ry,1.5,0,s),i=U(h,null,s);r=r.concat(i)}return{estimatedPoints:o,opset:{type:"path",ops:r}}}g(ut,"D");function wt(a,t,s,e,n,o,r,h,i){let l=a,c=t,d=Math.abs(s/2),p=Math.abs(e/2);d+=m(.01*d,i),p+=m(.01*p,i);let u=n,f=o;for(;u<0;)u+=2*Math.PI,f+=2*Math.PI;f-u>2*Math.PI&&(u=0,f=2*Math.PI);let M=2*Math.PI/i.curveStepCount,b=Math.min(M/2,(f-u)/2),y=St(b,l,c,d,p,u,f,1,i);if(!i.disableMultiStroke){let k=St(b,l,c,d,p,u,f,1.5,i);y.push(...k)}return r&&(h?y.push(...C(l,c,l+d*Math.cos(u),c+p*Math.sin(u),i),...C(l,c,l+d*Math.cos(f),c+p*Math.sin(f),i)):y.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+d*Math.cos(u),c+p*Math.sin(u)]})),{type:"path",ops:y}}g(wt,"A");function xt(a,t){let s=Tt(Lt(Mt(a))),e=[],n=[0,0],o=[0,0];for(let{key:r,data:h}of s)switch(r){case"M":o=[h[0],h[1]],n=[h[0],h[1]];break;case"L":e.push(...C(o[0],o[1],h[0],h[1],t)),o=[h[0],h[1]];break;case"C":{let[i,l,c,d,p,u]=h;e.push(...jt(i,l,c,d,p,u,o,t)),o=[p,u];break}case"Z":e.push(...C(o[0],o[1],n[0],n[1],t)),o=[n[0],n[1]]}return{type:"path",ops:e}}g(xt,"_");function nt(a,t){let s=[];for(let e of a)if(e.length){let n=t.maxRandomnessOffset||0,o=e.length;if(o>2){s.push({op:"move",data:[e[0][0]+m(n,t),e[0][1]+m(n,t)]});for(let r=1;r<o;r++)s.push({op:"lineTo",data:[e[r][0]+m(n,t),e[r][1]+m(n,t)]})}}return{type:"fillPath",ops:s}}g(nt,"I");function $(a,t){return(function(s,e){let n=s.fillStyle||"hachure";if(!O[n])switch(n){case"zigzag":O[n]||(O[n]=new ot(e));break;case"cross-hatch":O[n]||(O[n]=new ht(e));break;case"dots":O[n]||(O[n]=new rt(e));break;case"dashed":O[n]||(O[n]=new it(e));break;case"zigzag-line":O[n]||(O[n]=new ct(e));break;default:n="hachure",O[n]||(O[n]=new F(e))}return O[n]})(t,$t).fillPolygons(a,t)}g($,"C");function Pt(a){let t=Object.assign({},a);return t.randomizer=void 0,a.seed&&(t.seed=a.seed+1),t}g(Pt,"z");function It(a){return a.randomizer||(a.randomizer=new lt(a.seed||0)),a.randomizer.next()}g(It,"W");function K(a,t,s,e=1){return s.roughness*e*(It(s)*(t-a)+a)}g(K,"E");function m(a,t,s=1){return K(-a,a,t,s)}g(m,"G");function C(a,t,s,e,n,o=!1){let r=o?n.disableMultiStrokeFill:n.disableMultiStroke,h=pt(a,t,s,e,n,!0,!1);if(r)return h;let i=pt(a,t,s,e,n,!0,!0);return h.concat(i)}g(C,"$");function pt(a,t,s,e,n,o,r){let h=Math.pow(a-s,2)+Math.pow(t-e,2),i=Math.sqrt(h),l=1;l=i<200?1:i>500?.4:-.0016668*i+1.233334;let c=n.maxRandomnessOffset||0;c*c*100>h&&(c=i/10);let d=c/2,p=.2+.2*It(n),u=n.bowing*n.maxRandomnessOffset*(e-t)/200,f=n.bowing*n.maxRandomnessOffset*(a-s)/200;u=m(u,n,l),f=m(f,n,l);let M=[],b=g(()=>m(d,n,l),"M"),y=g(()=>m(c,n,l),"k"),k=n.preserveVertices;return o&&(r?M.push({op:"move",data:[a+(k?0:b()),t+(k?0:b())]}):M.push({op:"move",data:[a+(k?0:m(c,n,l)),t+(k?0:m(c,n,l))]})),r?M.push({op:"bcurveTo",data:[u+a+(s-a)*p+b(),f+t+(e-t)*p+b(),u+a+2*(s-a)*p+b(),f+t+2*(e-t)*p+b(),s+(k?0:b()),e+(k?0:b())]}):M.push({op:"bcurveTo",data:[u+a+(s-a)*p+y(),f+t+(e-t)*p+y(),u+a+2*(s-a)*p+y(),f+t+2*(e-t)*p+y(),s+(k?0:y()),e+(k?0:y())]}),M}g(pt,"R");function H(a,t,s){if(!a.length)return[];let e=[];e.push([a[0][0]+m(t,s),a[0][1]+m(t,s)]),e.push([a[0][0]+m(t,s),a[0][1]+m(t,s)]);for(let n=1;n<a.length;n++)e.push([a[n][0]+m(t,s),a[n][1]+m(t,s)]),n===a.length-1&&e.push([a[n][0]+m(t,s),a[n][1]+m(t,s)]);return U(e,null,s)}g(H,"j");function U(a,t,s){let e=a.length,n=[];if(e>3){let o=[],r=1-s.curveTightness;n.push({op:"move",data:[a[1][0],a[1][1]]});for(let h=1;h+2<e;h++){let i=a[h];o[0]=[i[0],i[1]],o[1]=[i[0]+(r*a[h+1][0]-r*a[h-1][0])/6,i[1]+(r*a[h+1][1]-r*a[h-1][1])/6],o[2]=[a[h+1][0]+(r*a[h][0]-r*a[h+2][0])/6,a[h+1][1]+(r*a[h][1]-r*a[h+2][1])/6],o[3]=[a[h+1][0],a[h+1][1]],n.push({op:"bcurveTo",data:[o[1][0],o[1][1],o[2][0],o[2][1],o[3][0],o[3][1]]})}if(t&&t.length===2){let h=s.maxRandomnessOffset;n.push({op:"lineTo",data:[t[0]+m(h,s),t[1]+m(h,s)]})}}else e===3?(n.push({op:"move",data:[a[1][0],a[1][1]]}),n.push({op:"bcurveTo",data:[a[1][0],a[1][1],a[2][0],a[2][1],a[2][0],a[2][1]]})):e===2&&n.push(...pt(a[0][0],a[0][1],a[1][0],a[1][1],s,!0,!0));return n}g(U,"q");function vt(a,t,s,e,n,o,r,h){let i=[],l=[];if(h.roughness===0){a/=4,l.push([t+e*Math.cos(-a),s+n*Math.sin(-a)]);for(let c=0;c<=2*Math.PI;c+=a){let d=[t+e*Math.cos(c),s+n*Math.sin(c)];i.push(d),l.push(d)}l.push([t+e*Math.cos(0),s+n*Math.sin(0)]),l.push([t+e*Math.cos(a),s+n*Math.sin(a)])}else{let c=m(.5,h)-Math.PI/2;l.push([m(o,h)+t+.9*e*Math.cos(c-a),m(o,h)+s+.9*n*Math.sin(c-a)]);let d=2*Math.PI+c-.01;for(let p=c;p<d;p+=a){let u=[m(o,h)+t+e*Math.cos(p),m(o,h)+s+n*Math.sin(p)];i.push(u),l.push(u)}l.push([m(o,h)+t+e*Math.cos(c+2*Math.PI+.5*r),m(o,h)+s+n*Math.sin(c+2*Math.PI+.5*r)]),l.push([m(o,h)+t+.98*e*Math.cos(c+r),m(o,h)+s+.98*n*Math.sin(c+r)]),l.push([m(o,h)+t+.9*e*Math.cos(c+.5*r),m(o,h)+s+.9*n*Math.sin(c+.5*r)])}return[l,i]}g(vt,"F");function St(a,t,s,e,n,o,r,h,i){let l=o+m(.1,i),c=[];c.push([m(h,i)+t+.9*e*Math.cos(l-a),m(h,i)+s+.9*n*Math.sin(l-a)]);for(let d=l;d<=r;d+=a)c.push([m(h,i)+t+e*Math.cos(d),m(h,i)+s+n*Math.sin(d)]);return c.push([t+e*Math.cos(r),s+n*Math.sin(r)]),c.push([t+e*Math.cos(r),s+n*Math.sin(r)]),U(c,null,i)}g(St,"V");function jt(a,t,s,e,n,o,r,h){let i=[],l=[h.maxRandomnessOffset||1,(h.maxRandomnessOffset||1)+.3],c=[0,0],d=h.disableMultiStroke?1:2,p=h.preserveVertices;for(let u=0;u<d;u++)u===0?i.push({op:"move",data:[r[0],r[1]]}):i.push({op:"move",data:[r[0]+(p?0:m(l[0],h)),r[1]+(p?0:m(l[0],h))]}),c=p?[n,o]:[n+m(l[u],h),o+m(l[u],h)],i.push({op:"bcurveTo",data:[a+m(l[u],h),t+m(l[u],h),s+m(l[u],h),e+m(l[u],h),c[0],c[1]]});return i}g(jt,"Z");function q(a){return[...a]}g(q,"Q");function Ot(a,t=0){let s=a.length;if(s<3)throw new Error("A curve must have at least three points.");let e=[];if(s===3)e.push(q(a[0]),q(a[1]),q(a[2]),q(a[2]));else{let n=[];n.push(a[0],a[0]);for(let h=1;h<a.length;h++)n.push(a[h]),h===a.length-1&&n.push(a[h]);let o=[],r=1-t;e.push(q(n[0]));for(let h=1;h+2<n.length;h++){let i=n[h];o[0]=[i[0],i[1]],o[1]=[i[0]+(r*n[h+1][0]-r*n[h-1][0])/6,i[1]+(r*n[h+1][1]-r*n[h-1][1])/6],o[2]=[n[h+1][0]+(r*n[h][0]-r*n[h+2][0])/6,n[h+1][1]+(r*n[h][1]-r*n[h+2][1])/6],o[3]=[n[h+1][0],n[h+1][1]],e.push(o[1],o[2],o[3])}}return e}g(Ot,"H");function J(a,t){return Math.pow(a[0]-t[0],2)+Math.pow(a[1]-t[1],2)}g(J,"N");function qt(a,t,s){let e=J(t,s);if(e===0)return J(a,t);let n=((a[0]-t[0])*(s[0]-t[0])+(a[1]-t[1])*(s[1]-t[1]))/e;return n=Math.max(0,Math.min(1,n)),J(a,W(t,s,n))}g(qt,"B");function W(a,t,s){return[a[0]+(t[0]-a[0])*s,a[1]+(t[1]-a[1])*s]}g(W,"J");function ft(a,t,s,e){let n=e||[];if((function(h,i){let l=h[i+0],c=h[i+1],d=h[i+2],p=h[i+3],u=3*c[0]-2*l[0]-p[0];u*=u;let f=3*c[1]-2*l[1]-p[1];f*=f;let M=3*d[0]-2*p[0]-l[0];M*=M;let b=3*d[1]-2*p[1]-l[1];return b*=b,u<M&&(u=M),f<b&&(f=b),u+f})(a,t)<s){let h=a[t+0];n.length?(o=n[n.length-1],r=h,Math.sqrt(J(o,r))>1&&n.push(h)):n.push(h),n.push(a[t+3])}else{let i=a[t+0],l=a[t+1],c=a[t+2],d=a[t+3],p=W(i,l,.5),u=W(l,c,.5),f=W(c,d,.5),M=W(p,u,.5),b=W(u,f,.5),y=W(M,b,.5);ft([i,p,M,y],0,s,n),ft([y,b,f,d],0,s,n)}var o,r;return n}g(ft,"K");function Ft(a,t){return X(a,0,a.length,t)}g(Ft,"U");function X(a,t,s,e,n){let o=n||[],r=a[t],h=a[s-1],i=0,l=1;for(let c=t+1;c<s-1;++c){let d=qt(a[c],r,h);d>i&&(i=d,l=c)}return Math.sqrt(i)>e?(X(a,t,l+1,e,o),X(a,l,s,e,o)):(o.length||o.push(r),o.push(h)),o}g(X,"X");function at(a,t=.15,s){let e=[],n=(a.length-1)/3;for(let o=0;o<n;o++)ft(a,3*o,t,e);return s&&s>0?X(e,0,e.length,s):e}g(at,"Y");var L="none",R=class{static{g(this,"et")}constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,s,e){return{shape:t,sets:s||[],options:e||this.defaultOptions}}line(t,s,e,n,o){let r=this._o(o);return this._d("line",[At(t,s,e,n,r)],r)}rectangle(t,s,e,n,o){let r=this._o(o),h=[],i=Rt(t,s,e,n,r);if(r.fill){let l=[[t,s],[t+e,s],[t+e,s+n],[t,s+n]];r.fillStyle==="solid"?h.push(nt([l],r)):h.push($([l],r))}return r.stroke!==L&&h.push(i),this._d("rectangle",h,r)}ellipse(t,s,e,n,o){let r=this._o(o),h=[],i=_t(e,n,r),l=ut(t,s,r,i);if(r.fill)if(r.fillStyle==="solid"){let c=ut(t,s,r,i).opset;c.type="fillPath",h.push(c)}else h.push($([l.estimatedPoints],r));return r.stroke!==L&&h.push(l.opset),this._d("ellipse",h,r)}circle(t,s,e,n){let o=this.ellipse(t,s,e,e,n);return o.shape="circle",o}linearPath(t,s){let e=this._o(s);return this._d("linearPath",[B(t,!1,e)],e)}arc(t,s,e,n,o,r,h=!1,i){let l=this._o(i),c=[],d=wt(t,s,e,n,o,r,h,!0,l);if(h&&l.fill)if(l.fillStyle==="solid"){let p=Object.assign({},l);p.disableMultiStroke=!0;let u=wt(t,s,e,n,o,r,!0,!1,p);u.type="fillPath",c.push(u)}else c.push((function(p,u,f,M,b,y,k){let w=p,v=u,P=Math.abs(f/2),x=Math.abs(M/2);P+=m(.01*P,k),x+=m(.01*x,k);let T=b,_=y;for(;T<0;)T+=2*Math.PI,_+=2*Math.PI;_-T>2*Math.PI&&(T=0,_=2*Math.PI);let Z=(_-T)/k.curveStepCount,A=[];for(let z=T;z<=_;z+=Z)A.push([w+P*Math.cos(z),v+x*Math.sin(z)]);return A.push([w+P*Math.cos(_),v+x*Math.sin(_)]),A.push([w,v]),$([A],k)})(t,s,e,n,o,r,l));return l.stroke!==L&&c.push(d),this._d("arc",c,l)}curve(t,s){let e=this._o(s),n=[],o=mt(t,e);if(e.fill&&e.fill!==L)if(e.fillStyle==="solid"){let r=mt(t,Object.assign(Object.assign({},e),{disableMultiStroke:!0,roughness:e.roughness?e.roughness+e.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(r.ops)})}else{let r=[],h=t;if(h.length){let i=typeof h[0][0]=="number"?[h]:h;for(let l of i)l.length<3?r.push(...l):l.length===3?r.push(...at(Ot([l[0],l[0],l[1],l[2]]),10,(1+e.roughness)/2)):r.push(...at(Ot(l),10,(1+e.roughness)/2))}r.length&&n.push($([r],e))}return e.stroke!==L&&n.push(o),this._d("curve",n,e)}polygon(t,s){let e=this._o(s),n=[],o=B(t,!0,e);return e.fill&&(e.fillStyle==="solid"?n.push(nt([t],e)):n.push($([t],e))),e.stroke!==L&&n.push(o),this._d("polygon",n,e)}path(t,s){let e=this._o(s),n=[];if(!t)return this._d("path",n,e);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=e.fill&&e.fill!=="transparent"&&e.fill!==L,r=e.stroke!==L,h=!!(e.simplification&&e.simplification<1),i=(function(c,d,p){let u=Tt(Lt(Mt(c))),f=[],M=[],b=[0,0],y=[],k=g(()=>{y.length>=4&&M.push(...at(y,d)),y=[]},"i"),w=g(()=>{k(),M.length&&(f.push(M),M=[])},"c");for(let{key:P,data:x}of u)switch(P){case"M":w(),b=[x[0],x[1]],M.push(b);break;case"L":k(),M.push([x[0],x[1]]);break;case"C":if(!y.length){let T=M.length?M[M.length-1]:b;y.push([T[0],T[1]])}y.push([x[0],x[1]]),y.push([x[2],x[3]]),y.push([x[4],x[5]]);break;case"Z":k(),M.push([b[0],b[1]])}if(w(),!p)return f;let v=[];for(let P of f){let x=Ft(P,p);x.length&&v.push(x)}return v})(t,1,h?4-4*(e.simplification||1):(1+e.roughness)/2),l=xt(t,e);if(o)if(e.fillStyle==="solid")if(i.length===1){let c=xt(t,Object.assign(Object.assign({},e),{disableMultiStroke:!0,roughness:e.roughness?e.roughness+e.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else n.push(nt(i,e));else n.push($(i,e));return r&&(h?i.forEach((c=>{n.push(B(c,!1,e))})):n.push(l)),this._d("path",n,e)}opsToPath(t,s){let e="";for(let n of t.ops){let o=typeof s=="number"&&s>=0?n.data.map((r=>+r.toFixed(s))):n.data;switch(n.op){case"move":e+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":e+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":e+=`L${o[0]} ${o[1]} `}}return e.trim()}toPaths(t){let s=t.sets||[],e=t.options||this.defaultOptions,n=[];for(let o of s){let r=null;switch(o.type){case"path":r={d:this.opsToPath(o),stroke:e.stroke,strokeWidth:e.strokeWidth,fill:L};break;case"fillPath":r={d:this.opsToPath(o),stroke:L,strokeWidth:0,fill:e.fill||L};break;case"fillSketch":r=this.fillSketch(o,e)}r&&n.push(r)}return n}fillSketch(t,s){let e=s.fillWeight;return e<0&&(e=s.strokeWidth/2),{d:this.opsToPath(t),stroke:s.fill||L,strokeWidth:e,fill:L}}_mergedShape(t){return t.filter(((s,e)=>e===0||s.op!=="move"))}},dt=class{static{g(this,"st")}constructor(t,s){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new R(s)}draw(t){let s=t.sets||[],e=t.options||this.getDefaultOptions(),n=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let r of s)switch(r.type){case"path":n.save(),n.strokeStyle=e.stroke==="none"?"transparent":e.stroke,n.lineWidth=e.strokeWidth,e.strokeLineDash&&n.setLineDash(e.strokeLineDash),e.strokeLineDashOffset&&(n.lineDashOffset=e.strokeLineDashOffset),this._drawToContext(n,r,o),n.restore();break;case"fillPath":{n.save(),n.fillStyle=e.fill||"";let h=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,r,o,h),n.restore();break}case"fillSketch":this.fillSketch(n,r,e)}}fillSketch(t,s,e){let n=e.fillWeight;n<0&&(n=e.strokeWidth/2),t.save(),e.fillLineDash&&t.setLineDash(e.fillLineDash),e.fillLineDashOffset&&(t.lineDashOffset=e.fillLineDashOffset),t.strokeStyle=e.fill||"",t.lineWidth=n,this._drawToContext(t,s,e.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,s,e,n="nonzero"){t.beginPath();for(let o of s.ops){let r=typeof e=="number"&&e>=0?o.data.map((h=>+h.toFixed(e))):o.data;switch(o.op){case"move":t.moveTo(r[0],r[1]);break;case"bcurveTo":t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"lineTo":t.lineTo(r[0],r[1])}}s.type==="fillPath"?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,s,e,n,o){let r=this.gen.line(t,s,e,n,o);return this.draw(r),r}rectangle(t,s,e,n,o){let r=this.gen.rectangle(t,s,e,n,o);return this.draw(r),r}ellipse(t,s,e,n,o){let r=this.gen.ellipse(t,s,e,n,o);return this.draw(r),r}circle(t,s,e,n){let o=this.gen.circle(t,s,e,n);return this.draw(o),o}linearPath(t,s){let e=this.gen.linearPath(t,s);return this.draw(e),e}polygon(t,s){let e=this.gen.polygon(t,s);return this.draw(e),e}arc(t,s,e,n,o,r,h=!1,i){let l=this.gen.arc(t,s,e,n,o,r,h,i);return this.draw(l),l}curve(t,s){let e=this.gen.curve(t,s);return this.draw(e),e}path(t,s){let e=this.gen.path(t,s);return this.draw(e),e}},N="http://www.w3.org/2000/svg",gt=class{static{g(this,"ot")}constructor(t,s){this.svg=t,this.gen=new R(s)}draw(t){let s=t.sets||[],e=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,o=n.createElementNS(N,"g"),r=t.options.fixedDecimalPlaceDigits;for(let h of s){let i=null;switch(h.type){case"path":i=n.createElementNS(N,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke",e.stroke),i.setAttribute("stroke-width",e.strokeWidth+""),i.setAttribute("fill","none"),e.strokeLineDash&&i.setAttribute("stroke-dasharray",e.strokeLineDash.join(" ").trim()),e.strokeLineDashOffset&&i.setAttribute("stroke-dashoffset",`${e.strokeLineDashOffset}`);break;case"fillPath":i=n.createElementNS(N,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke","none"),i.setAttribute("stroke-width","0"),i.setAttribute("fill",e.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||i.setAttribute("fill-rule","evenodd");break;case"fillSketch":i=this.fillSketch(n,h,e)}i&&o.appendChild(i)}return o}fillSketch(t,s,e){let n=e.fillWeight;n<0&&(n=e.strokeWidth/2);let o=t.createElementNS(N,"path");return o.setAttribute("d",this.opsToPath(s,e.fixedDecimalPlaceDigits)),o.setAttribute("stroke",e.fill||""),o.setAttribute("stroke-width",n+""),o.setAttribute("fill","none"),e.fillLineDash&&o.setAttribute("stroke-dasharray",e.fillLineDash.join(" ").trim()),e.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${e.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,s){return this.gen.opsToPath(t,s)}line(t,s,e,n,o){let r=this.gen.line(t,s,e,n,o);return this.draw(r)}rectangle(t,s,e,n,o){let r=this.gen.rectangle(t,s,e,n,o);return this.draw(r)}ellipse(t,s,e,n,o){let r=this.gen.ellipse(t,s,e,n,o);return this.draw(r)}circle(t,s,e,n){let o=this.gen.circle(t,s,e,n);return this.draw(o)}linearPath(t,s){let e=this.gen.linearPath(t,s);return this.draw(e)}polygon(t,s){let e=this.gen.polygon(t,s);return this.draw(e)}arc(t,s,e,n,o,r,h=!1,i){let l=this.gen.arc(t,s,e,n,o,r,h,i);return this.draw(l)}curve(t,s){let e=this.gen.curve(t,s);return this.draw(e)}path(t,s){let e=this.gen.path(t,s);return this.draw(e)}},Vt={canvas:g((a,t)=>new dt(a,t),"canvas"),svg:g((a,t)=>new gt(a,t),"svg"),generator:g(a=>new R(a),"generator"),newSeed:g(()=>R.newSeed(),"newSeed")};export{Vt as a};