modern-path2d 1.4.16 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +672 -524
- package/dist/index.d.cts +146 -72
- package/dist/index.d.mts +146 -72
- package/dist/index.d.ts +146 -72
- package/dist/index.js +16 -17
- package/dist/index.mjs +670 -524
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
(function(k,tt){typeof exports=="object"&&typeof module<"u"?tt(exports):typeof define=="function"&&define.amd?define(["exports"],tt):(k=typeof globalThis<"u"?globalThis:k||self,tt(k.modernPath2d={}))})(this,(function(k){"use strict";function tt(i,t,e,s={}){const{radius:r=1}=s;i.moveTo(t,e),i.arc(t,e,r,0,Math.PI*2)}const ke={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ct(i,t){const{fill:e="#000",stroke:s="none",strokeWidth:r=s==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:n="miter",strokeMiterlimit:c=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:a=0,shadowOffsetY:y=0,shadowBlur:f=0,shadowColor:p="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=s,i.lineWidth=r,i.lineCap=o,i.lineJoin=ke[n],i.miterLimit=c,i.setLineDash(h),i.lineDashOffset=l,i.shadowOffsetX=a,i.shadowOffsetY=y,i.shadowBlur=f,i.shadowColor=p}class M{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new M(1/0,1/0)}static get MIN(){return new M(-1/0,-1/0)}get array(){return[this.x,this.y]}finite(){return this.x=Number.isFinite(this.x)?this.x:0,this.y=Number.isFinite(this.y)?this.y:0,this}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}rotate(t,e={x:0,y:0}){const s=-t/180*Math.PI,r=this.x-e.x,o=-(this.y-e.y),n=Math.sin(s),c=Math.cos(s);return this.set(e.x+(r*c-o*n),e.y-(r*n+o*c)),this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(t,e=t,s={x:0,y:0}){const r=t<0?s.x-this.x+s.x:this.x,o=e<0?s.y-this.y+s.y:this.y;return this.x=r*Math.abs(t),this.y=o*Math.abs(e),this}skew(t,e=0,s={x:0,y:0}){const r=this.x-s.x,o=this.y-s.y;return this.x=s.x+(r+Math.tan(t)*o),this.y=s.y+(o+Math.tan(e)*r),this}min(...t){return this.x=Math.min(this.x,...t.map(e=>e.x)),this.y=Math.min(this.y,...t.map(e=>e.y)),this}max(...t){return this.x=Math.max(this.x,...t.map(e=>e.x)),this.y=Math.max(this.y,...t.map(e=>e.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this}divideVectors(t,e){return this.x=t.x/e.x,this.y=t.y/e.y,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,s=this.y,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6],this.y=r[1]*e+r[4]*s+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new M(this.x,this.y)}}class X{constructor(t=0,e=0,s=0,r=0){this.left=t,this.top=e,this.width=s,this.height=r}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new M((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new X;if(t.length===1)return t[0].clone();const e=t[0],s=t.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:e?.left??0,top:e?.top??0,right:e?.right??0,bottom:e?.bottom??0});return new X(s.left,s.top,s.right-s.left,s.bottom-s.top)}translate(t,e){return this.left+=t,this.top+=e,this}copy(t){return this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height,this}clone(){return new X(this.left,this.top,this.width,this.height)}}class z{elements=[];constructor(t=1,e=0,s=0,r=0,o=1,n=0,c=0,h=0,l=1){this.set(t,e,s,r,o,n,c,h,l)}set(t,e,s,r,o,n,c,h,l){const a=this.elements;return a[0]=t,a[1]=r,a[2]=c,a[3]=e,a[4]=o,a[5]=h,a[6]=s,a[7]=n,a[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,r=e.elements,o=this.elements,n=s[0],c=s[3],h=s[6],l=s[1],a=s[4],y=s[7],f=s[2],p=s[5],u=s[8],x=r[0],d=r[3],T=r[6],P=r[1],g=r[4],v=r[7],C=r[2],A=r[5],m=r[8];return o[0]=n*x+c*P+h*C,o[3]=n*d+c*g+h*A,o[6]=n*T+c*v+h*m,o[1]=l*x+a*P+y*C,o[4]=l*d+a*g+y*A,o[7]=l*T+a*v+y*m,o[2]=f*x+p*P+u*C,o[5]=f*d+p*g+u*A,o[8]=f*T+p*v+u*m,this}invert(){const t=this.elements,e=t[0],s=t[1],r=t[2],o=t[3],n=t[4],c=t[5],h=t[6],l=t[7],a=t[8],y=a*n-c*l,f=c*h-a*o,p=l*o-n*h,u=e*y+s*f+r*p;if(u===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/u;return t[0]=y*x,t[1]=(r*l-a*s)*x,t[2]=(c*s-r*n)*x,t[3]=f*x,t[4]=(a*e-r*h)*x,t[5]=(r*o-c*e)*x,t[6]=p*x,t[7]=(s*h-l*e)*x,t[8]=(n*e-s*o)*x,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(bt.makeScale(t,e)),this}rotate(t){return this.premultiply(bt.makeRotation(-t)),this}translate(t,e){return this.premultiply(bt.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const bt=new z;function zt(i,t,e,s){const r=i*e+t*s,o=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+s*s);let n=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*s-t*e<0&&(n=-n),n}function Ot(i,t,e,s,r,o,n,c){if(t===0||e===0){i.lineTo(c.x,c.y);return}s=s*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(n.x-c.x)/2,l=(n.y-c.y)/2,a=Math.cos(s)*h+Math.sin(s)*l,y=-Math.sin(s)*h+Math.cos(s)*l;let f=t*t,p=e*e;const u=a*a,x=y*y,d=u/f+x/p;if(d>1){const F=Math.sqrt(d);t=F*t,e=F*e,f=t*t,p=e*e}const T=f*x+p*u,P=(f*p-T)/T;let g=Math.sqrt(Math.max(0,P));r===o&&(g=-g);const v=g*t*y/e,C=-g*e*a/t,A=Math.cos(s)*v-Math.sin(s)*C+(n.x+c.x)/2,m=Math.sin(s)*v+Math.cos(s)*C+(n.y+c.y)/2,w=zt(1,0,(a-v)/t,(y-C)/e),V=zt((a-v)/t,(y-C)/e,(-a-v)/t,(-y-C)/e)%(Math.PI*2);i.ellipse(A,m,t,e,s,w,w+V,o===0)}const q={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function O(i,t,e=0){let c=0,h=!0,l="",a="";const y=[];function f(d,T,P){const g=new SyntaxError(`Unexpected character "${d}" at index ${T}.`);throw g.partial=P,g}function p(){l!==""&&(a===""?y.push(Number(l)):y.push(Number(l)*10**Number(a))),l="",a=""}let u;const x=i.length;for(let d=0;d<x;d++){if(u=i[d],Array.isArray(t)&&t.includes(y.length%e)&&q.FLAGS.test(u)){c=1,l=u,p();continue}if(c===0){if(q.WHITESPACE.test(u))continue;if(q.DIGIT.test(u)||q.SIGN.test(u)){c=1,l=u;continue}if(q.POINT.test(u)){c=2,l=u;continue}q.COMMA.test(u)&&(h&&f(u,d,y),h=!0)}if(c===1){if(q.DIGIT.test(u)){l+=u;continue}if(q.POINT.test(u)){l+=u,c=2;continue}if(q.EXP.test(u)){c=3;continue}q.SIGN.test(u)&&l.length===1&&q.SIGN.test(l[0])&&f(u,d,y)}if(c===2){if(q.DIGIT.test(u)){l+=u;continue}if(q.EXP.test(u)){c=3;continue}q.POINT.test(u)&&l[l.length-1]==="."&&f(u,d,y)}if(c===3){if(q.DIGIT.test(u)){a+=u;continue}if(q.SIGN.test(u)){if(a===""){a+=u;continue}a.length===1&&q.SIGN.test(a)&&f(u,d,y)}}q.WHITESPACE.test(u)?(p(),c=0,h=!1):q.COMMA.test(u)?(p(),c=0,h=!0):q.SIGN.test(u)?(p(),c=1,l=u):q.POINT.test(u)?(p(),c=2,l=u):f(u,d,y)}return p(),y}function et(i,t){return i-(t-i)}function At(i,t){const e=new M,s=new M;for(let r=0,o=i.length;r<o;r++){const n=i[r];if(n.type==="m"||n.type==="M")n.type==="m"?e.add(n):e.copy(n),t.moveTo(e.x,e.y),s.copy(e);else if(n.type==="h"||n.type==="H")n.type==="h"?e.x+=n.x:e.x=n.x,t.lineTo(e.x,e.y),s.copy(e);else if(n.type==="v"||n.type==="V")n.type==="v"?e.y+=n.y:e.y=n.y,t.lineTo(e.x,e.y),s.copy(e);else if(n.type==="l"||n.type==="L")n.type==="l"?e.add(n):e.copy(n),t.lineTo(e.x,e.y),s.copy(e);else if(n.type==="c"||n.type==="C")n.type==="c"?(t.bezierCurveTo(e.x+n.x1,e.y+n.y1,e.x+n.x2,e.y+n.y2,e.x+n.x,e.y+n.y),s.x=e.x+n.x2,s.y=e.y+n.y2,e.add(n)):(t.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y),s.x=n.x2,s.y=n.y2,e.copy(n));else if(n.type==="s"||n.type==="S")n.type==="s"?(t.bezierCurveTo(et(e.x,s.x),et(e.y,s.y),e.x+n.x2,e.y+n.y2,e.x+n.x,e.y+n.y),s.x=e.x+n.x2,s.y=e.y+n.y2,e.add(n)):(t.bezierCurveTo(et(e.x,s.x),et(e.y,s.y),n.x2,n.y2,n.x,n.y),s.x=n.x2,s.y=n.y2,e.copy(n));else if(n.type==="q"||n.type==="Q")n.type==="q"?(t.quadraticCurveTo(e.x+n.x1,e.y+n.y1,e.x+n.x,e.y+n.y),s.x=e.x+n.x1,s.y=e.y+n.y1,e.add(n)):(t.quadraticCurveTo(n.x1,n.y1,n.x,n.y),s.x=n.x1,s.y=n.y1,e.copy(n));else if(n.type==="t"||n.type==="T"){const c=et(e.x,s.x),h=et(e.y,s.y);s.x=c,s.y=h,n.type==="t"?(t.quadraticCurveTo(c,h,e.x+n.x,e.y+n.y),e.add(n)):(t.quadraticCurveTo(c,h,n.x,n.y),e.copy(n))}else if(n.type==="a"||n.type==="A"){const c=e.clone();if(n.type==="a"){if(n.x===0&&n.y===0)continue;e.add(n)}else{if(e.equals(n))continue;e.copy(n)}s.copy(e),Ot(t,n.rx,n.ry,n.angle,n.largeArcFlag,n.sweepFlag,c,e)}else n.type==="z"||n.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",n)}}function Bt(i){let t,e;const s=[];for(let r=0,o=i.length;r<o;r++){const n=i[r];switch(n.type){case"m":case"M":if(n.x.toFixed(4)===e?.x.toFixed(4)&&n.y.toFixed(4)===e?.y.toFixed(4))continue;s.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y},t={x:n.x,y:n.y};break;case"h":case"H":s.push(`${n.type} ${n.x}`),e={x:n.x,y:e?.y??0};break;case"v":case"V":s.push(`${n.type} ${n.y}`),e={x:e?.x??0,y:n.y};break;case"l":case"L":s.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"c":case"C":s.push(`${n.type} ${n.x1} ${n.y1} ${n.x2} ${n.y2} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"s":case"S":s.push(`${n.type} ${n.x2} ${n.y2} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"q":case"Q":s.push(`${n.type} ${n.x1} ${n.y1} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"t":case"T":s.push(`${n.type} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"a":case"A":s.push(`${n.type} ${n.rx} ${n.ry} ${n.angle} ${n.largeArcFlag} ${n.sweepFlag} ${n.x} ${n.y}`),e={x:n.x,y:n.y};break;case"z":case"Z":s.push(n.type),t&&(e={x:t.x,y:t.y});break}}return s.join(" ")}const Ie=/[a-df-z][^a-df-z]*/gi;function kt(i){const t=[],e=i.match(Ie);if(!e)return t;for(let s=0,r=e.length;s<r;s++){const o=e[s],n=o.charAt(0),c=o.slice(1).trim();let h;switch(n){case"m":case"M":h=O(c);for(let l=0,a=h.length;l<a;l+=2)l===0?t.push({type:n,x:h[l],y:h[l+1]}):t.push({type:n==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=O(c);for(let l=0,a=h.length;l<a;l++)t.push({type:n,x:h[l]});break;case"v":case"V":h=O(c);for(let l=0,a=h.length;l<a;l++)t.push({type:n,y:h[l]});break;case"l":case"L":h=O(c);for(let l=0,a=h.length;l<a;l+=2)t.push({type:n,x:h[l],y:h[l+1]});break;case"c":case"C":h=O(c);for(let l=0,a=h.length;l<a;l+=6)t.push({type:n,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=O(c);for(let l=0,a=h.length;l<a;l+=4)t.push({type:n,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=O(c);for(let l=0,a=h.length;l<a;l+=4)t.push({type:n,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=O(c);for(let l=0,a=h.length;l<a;l+=2)t.push({type:n,x:h[l],y:h[l+1]});break;case"a":case"A":h=O(c,[3,4],7);for(let l=0,a=h.length;l<a;l+=7)t.push({type:n,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:n});break;default:console.warn(o)}}return t}const jt="data:image/svg+xml;",Zt=`${jt}base64,`,Xt=`${jt}charset=utf8,`;function Ut(i){if(typeof i=="string"){let t;i.startsWith(Zt)?(i=i.substring(Zt.length,i.length),t=atob(i)):i.startsWith(Xt)?(i=i.substring(Xt.length,i.length),t=decodeURIComponent(i)):t=i;const e=new DOMParser().parseFromString(t,"text/xml"),s=e.querySelector("parsererror");if(s)throw new Error(`${s.textContent??"parser error"}
|
|
2
|
-
${t}`);return e.documentElement}else return i}const Se="px",_e=90,Gt=["mm","cm","in","pt","pc","px"],Wt={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function E(i){let t="px";if(typeof i=="string")for(let s=0,r=Gt.length;s<r;s++){const o=Gt[s];if(i.endsWith(o)){t=o,i=i.substring(0,i.length-o.length);break}}let e;return e=Wt[t][Se],e<0&&(e=Wt[t].in*_e),e*Number.parseFloat(i)}const Ee=new z,xt=new z,Yt=new z,Ht=new z;function Ne(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const s=Fe(i);return e.length>0&&s.premultiply(e[e.length-1]),t.copy(s),e.push(s),s}function Fe(i){const t=new z,e=Ee;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(E(i.getAttribute("x")),E(i.getAttribute("y"))),i.hasAttribute("transform")){const s=i.getAttribute("transform").split(")");for(let r=s.length-1;r>=0;r--){const o=s[r].trim();if(o==="")continue;const n=o.indexOf("("),c=o.length;if(n>0&&n<c){const h=o.slice(0,n),l=O(o.slice(n+1));switch(e.identity(),h){case"translate":if(l.length>=1){const a=l[0];let y=0;l.length>=2&&(y=l[1]),e.translate(a,y)}break;case"rotate":if(l.length>=1){let a=0,y=0,f=0;a=l[0]*Math.PI/180,l.length>=3&&(y=l[1],f=l[2]),xt.makeTranslation(-y,-f),Yt.makeRotation(a),Ht.multiplyMatrices(Yt,xt),xt.makeTranslation(y,f),e.multiplyMatrices(xt,Ht)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function $e(i){return new j().arc(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("r")||0),0,Math.PI*2)}function Le(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const s=i.sheet.cssRules[e];if(s.type!==1)continue;const r=s.selectorText.split(/,/g).filter(Boolean).map(n=>n.trim()),o={};for(let n=s.style.length,c=0;c<n;c++){const h=s.style.item(c);o[h]=s.style.getPropertyValue(h)}for(let n=0;n<r.length;n++)t[r[n]]=Object.assign(t[r[n]]||{},{...o})}}function De(i){return new j().ellipse(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("rx")||0),E(i.getAttribute("ry")||0),0,0,Math.PI*2)}function qe(i){return new j().moveTo(E(i.getAttribute("x1")||0),E(i.getAttribute("y1")||0)).lineTo(E(i.getAttribute("x2")||0),E(i.getAttribute("y2")||0))}function Ve(i){const t=new j,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Re=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ze(i){const t=new j;let e=0;return i.getAttribute("points")?.replace(Re,(s,r,o)=>{const n=E(r),c=E(o);return e===0?t.moveTo(n,c):t.lineTo(n,c),e++,s}),t.currentCurve.autoClose=!0,t}const Oe=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Be(i){const t=new j;let e=0;return i.getAttribute("points")?.replace(Oe,(s,r,o)=>{const n=E(r),c=E(o);return e===0?t.moveTo(n,c):t.lineTo(n,c),e++,s}),t.currentCurve.autoClose=!1,t}function je(i){const t=E(i.getAttribute("x")||0),e=E(i.getAttribute("y")||0),s=E(i.getAttribute("rx")||i.getAttribute("ry")||0),r=E(i.getAttribute("ry")||i.getAttribute("rx")||0),o=E(i.getAttribute("width")),n=E(i.getAttribute("height")),c=1-.551915024494,h=new j;return h.moveTo(t+s,e),h.lineTo(t+o-s,e),(s!==0||r!==0)&&h.bezierCurveTo(t+o-s*c,e,t+o,e+r*c,t+o,e+r),h.lineTo(t+o,e+n-r),(s!==0||r!==0)&&h.bezierCurveTo(t+o,e+n-r*c,t+o-s*c,e+n,t+o-s,e+n),h.lineTo(t+s,e+n),(s!==0||r!==0)&&h.bezierCurveTo(t+s*c,e+n,t,e+n-r*c,t,e+n-r),h.lineTo(t,e+r),(s!==0||r!==0)&&h.bezierCurveTo(t,e+r*c,t+s*c,e,t+s,e),h}function Z(i,t,e){t=Object.assign({},t);let s={};if(i.hasAttribute("class")){const l=i.getAttribute("class").split(/\s/).filter(Boolean).map(a=>a.trim());for(let a=0;a<l.length;a++)s=Object.assign(s,e[`.${l[a]}`])}i.hasAttribute("id")&&(s=Object.assign(s,e[`#${i.getAttribute("id")}`]));for(let l=i.style.length,a=0;a<l;a++){const y=i.style.item(a),f=i.style.getPropertyValue(y);t[y]=f,s[y]=f}function r(l,a,y=o){i.hasAttribute(l)&&(t[a]=y(i.getAttribute(l))),s[l]&&(t[a]=y(s[l]))}function o(l){return l.startsWith("url")&&console.warn("url access in attributes is not implemented."),l}function n(l){return Math.max(0,Math.min(1,E(l)))}function c(l){return Math.max(0,E(l))}function h(l){return l.split(" ").filter(a=>a!=="").map(a=>E(a))}return r("fill","fill"),r("fill-opacity","fillOpacity",n),r("fill-rule","fillRule"),r("opacity","opacity",n),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",n),r("stroke-width","strokeWidth",c),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",c),r("stroke-dasharray","strokeDasharray",h),r("stroke-dashoffset","strokeDashoffset",E),r("visibility","visibility"),t}function It(i,t,e=[],s={}){if(i.nodeType!==1)return e;let r=!1,o=null,n={...t};switch(i.nodeName){case"svg":n=Z(i,n,s);break;case"style":Le(i,s);break;case"g":n=Z(i,n,s);break;case"path":n=Z(i,n,s),i.hasAttribute("d")&&(o=Ve(i));break;case"rect":n=Z(i,n,s),o=je(i);break;case"polygon":n=Z(i,n,s),o=ze(i);break;case"polyline":n=Z(i,n,s),o=Be(i);break;case"circle":n=Z(i,n,s),o=$e(i);break;case"ellipse":n=Z(i,n,s),o=De(i);break;case"line":n=Z(i,n,s),o=qe(i);break;case"defs":r=!0;break;case"use":{n=Z(i,n,s);const f=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),p=i.viewportElement?.getElementById(f);p?It(p,n,e,s):console.warn(`'use node' references non-existent node id: ${f}`);break}default:console.warn(i);break}if(n.display==="none")return e;const c=new z,h=[],l=Ne(i,c,h);o&&(o.applyTransform(c),e.push(o),o.style={...n});const a=i.childNodes;for(let y=0,f=a.length;y<f;y++){const p=a[y];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||It(p,n,e,s)}return l&&(h.pop(),h.length>0?c.copy(h[h.length-1]):c.identity()),e}function Ze(i){const t=Ut(i);return new ve(It(t,{}),t.getAttribute("viewBox")?.trim().split(" ").map(e=>Number(e)))}function St(i,t,e,s,r){const o=(s-t)*.5,n=(r-e)*.5,c=i*i,h=i*c;return(2*e-2*s+o+n)*h+(-3*e+3*s-2*o-n)*c+o*i+e}function Xe(i,t){const e=1-i;return e*e*e*t}function Ue(i,t){const e=1-i;return 3*e*e*i*t}function Ge(i,t){return 3*(1-i)*i*i*t}function We(i,t){return i*i*i*t}function _t(i,t,e,s,r){return Xe(i,t)+Ue(i,e)+Ge(i,s)+We(i,r)}function Ye(i,t,e=2){const s=t&&t.length,r=s?t[0]*e:i.length;let o=Qt(i,0,r,e,!0);const n=[];if(!o||o.next===o.prev)return n;let c,h,l;if(s&&(o=ts(i,t,o,e)),i.length>80*e){c=i[0],h=i[1];let a=c,y=h;for(let f=e;f<r;f+=e){const p=i[f],u=i[f+1];p<c&&(c=p),u<h&&(h=u),p>a&&(a=p),u>y&&(y=u)}l=Math.max(a-c,y-h),l=l!==0?32767/l:0}return it(o,n,e,c,h,l,0),n}function Qt(i,t,e,s,r){let o;if(r===us(i,t,e,s)>0)for(let n=t;n<e;n+=s)o=ee(n/s|0,i[n],i[n+1],o);else for(let n=e-s;n>=t;n-=s)o=ee(n/s|0,i[n],i[n+1],o);return o&&st(o,o.next)&&(ct(o),o=o.next),o}function G(i,t){if(!i)return i;t||(t=i);let e=i,s;do if(s=!1,!e.steiner&&(st(e,e.next)||$(e.prev,e,e.next)===0)){if(ct(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function it(i,t,e,s,r,o,n){if(!i)return;!n&&o&&rs(i,s,r,o);let c=i;for(;i.prev!==i.next;){const h=i.prev,l=i.next;if(o?Qe(i,s,r,o):He(i)){t.push(h.i,i.i,l.i),ct(i),i=l.next,c=l.next;continue}if(i=l,i===c){n?n===1?(i=Je(G(i),t),it(i,t,e,s,r,o,2)):n===2&&Ke(i,t,e,s,r,o):it(G(i),t,e,s,r,o,1);break}}}function He(i){const t=i.prev,e=i,s=i.next;if($(t,e,s)>=0)return!1;const r=t.x,o=e.x,n=s.x,c=t.y,h=e.y,l=s.y,a=Math.min(r,o,n),y=Math.min(c,h,l),f=Math.max(r,o,n),p=Math.max(c,h,l);let u=s.next;for(;u!==t;){if(u.x>=a&&u.x<=f&&u.y>=y&&u.y<=p&&rt(r,c,o,h,n,l,u.x,u.y)&&$(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function Qe(i,t,e,s){const r=i.prev,o=i,n=i.next;if($(r,o,n)>=0)return!1;const c=r.x,h=o.x,l=n.x,a=r.y,y=o.y,f=n.y,p=Math.min(c,h,l),u=Math.min(a,y,f),x=Math.max(c,h,l),d=Math.max(a,y,f),T=Et(p,u,t,e,s),P=Et(x,d,t,e,s);let g=i.prevZ,v=i.nextZ;for(;g&&g.z>=T&&v&&v.z<=P;){if(g.x>=p&&g.x<=x&&g.y>=u&&g.y<=d&&g!==r&&g!==n&&rt(c,a,h,y,l,f,g.x,g.y)&&$(g.prev,g,g.next)>=0||(g=g.prevZ,v.x>=p&&v.x<=x&&v.y>=u&&v.y<=d&&v!==r&&v!==n&&rt(c,a,h,y,l,f,v.x,v.y)&&$(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;g&&g.z>=T;){if(g.x>=p&&g.x<=x&&g.y>=u&&g.y<=d&&g!==r&&g!==n&&rt(c,a,h,y,l,f,g.x,g.y)&&$(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;v&&v.z<=P;){if(v.x>=p&&v.x<=x&&v.y>=u&&v.y<=d&&v!==r&&v!==n&&rt(c,a,h,y,l,f,v.x,v.y)&&$(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Je(i,t){let e=i;do{const s=e.prev,r=e.next.next;!st(s,r)&&Kt(s,e,e.next,r)&&ot(s,r)&&ot(r,s)&&(t.push(s.i,e.i,r.i),ct(e),ct(e.next),e=i=r),e=e.next}while(e!==i);return G(e)}function Ke(i,t,e,s,r,o){let n=i;do{let c=n.next.next;for(;c!==n.prev;){if(n.i!==c.i&&hs(n,c)){let h=te(n,c);n=G(n,n.next),h=G(h,h.next),it(n,t,e,s,r,o,0),it(h,t,e,s,r,o,0);return}c=c.next}n=n.next}while(n!==i)}function ts(i,t,e,s){const r=[];for(let o=0,n=t.length;o<n;o++){const c=t[o]*s,h=o<n-1?t[o+1]*s:i.length,l=Qt(i,c,h,s,!1);l===l.next&&(l.steiner=!0),r.push(cs(l))}r.sort(es);for(let o=0;o<r.length;o++)e=ss(r[o],e);return e}function es(i,t){let e=i.x-t.x;if(e===0&&(e=i.y-t.y,e===0)){const s=(i.next.y-i.y)/(i.next.x-i.x),r=(t.next.y-t.y)/(t.next.x-t.x);e=s-r}return e}function ss(i,t){const e=ns(i,t);if(!e)return t;const s=te(e,i);return G(s,s.next),G(e,e.next)}function ns(i,t){let e=t;const s=i.x,r=i.y;let o=-1/0,n;if(st(i,e))return e;do{if(st(i,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const y=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(y<=s&&y>o&&(o=y,n=e.x<e.next.x?e:e.next,y===s))return n}e=e.next}while(e!==t);if(!n)return null;const c=n,h=n.x,l=n.y;let a=1/0;e=n;do{if(s>=e.x&&e.x>=h&&s!==e.x&&Jt(r<l?s:o,r,h,l,r<l?o:s,r,e.x,e.y)){const y=Math.abs(r-e.y)/(s-e.x);ot(e,i)&&(y<a||y===a&&(e.x>n.x||e.x===n.x&&is(n,e)))&&(n=e,a=y)}e=e.next}while(e!==c);return n}function is(i,t){return $(i.prev,i,t.prev)<0&&$(t.next,i,i.next)<0}function rs(i,t,e,s){let r=i;do r.z===0&&(r.z=Et(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,os(r)}function os(i){let t,e=1;do{let s=i,r;i=null;let o=null;for(t=0;s;){t++;let n=s,c=0;for(let l=0;l<e&&(c++,n=n.nextZ,!!n);l++);let h=e;for(;c>0||h>0&&n;)c!==0&&(h===0||!n||s.z<=n.z)?(r=s,s=s.nextZ,c--):(r=n,n=n.nextZ,h--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;s=n}o.nextZ=null,e*=2}while(t>1);return i}function Et(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function cs(i){let t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function Jt(i,t,e,s,r,o,n,c){return(r-n)*(t-c)>=(i-n)*(o-c)&&(i-n)*(s-c)>=(e-n)*(t-c)&&(e-n)*(o-c)>=(r-n)*(s-c)}function rt(i,t,e,s,r,o,n,c){return!(i===n&&t===c)&&Jt(i,t,e,s,r,o,n,c)}function hs(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ls(i,t)&&(ot(i,t)&&ot(t,i)&&as(i,t)&&($(i.prev,i,t.prev)||$(i,t.prev,t))||st(i,t)&&$(i.prev,i,i.next)>0&&$(t.prev,t,t.next)>0)}function $(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function st(i,t){return i.x===t.x&&i.y===t.y}function Kt(i,t,e,s){const r=gt($(i,t,e)),o=gt($(i,t,s)),n=gt($(e,s,i)),c=gt($(e,s,t));return!!(r!==o&&n!==c||r===0&&pt(i,e,t)||o===0&&pt(i,s,t)||n===0&&pt(e,i,s)||c===0&&pt(e,t,s))}function pt(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function gt(i){return i>0?1:i<0?-1:0}function ls(i,t){let e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Kt(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function ot(i,t){return $(i.prev,i,i.next)<0?$(i,t,i.next)>=0&&$(i,i.prev,t)>=0:$(i,t,i.prev)<0||$(i,i.next,t)<0}function as(i,t){let e=i,s=!1;const r=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function te(i,t){const e=Nt(i.i,i.x,i.y),s=Nt(t.i,t.x,t.y),r=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,o.next=s,s.prev=o,s}function ee(i,t,e,s){const r=Nt(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function ct(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Nt(i,t,e){return{i,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function us(i,t,e,s){let r=0;for(let o=t,n=e-s;o<e;o+=s)r+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return r}function Ft(i,t={}){let{vertices:e=[],indices:s=[],holes:r=[],verticesStride:o=2,verticesOffset:n=e.length/o,indicesOffset:c=s.length}=t;const h=Ye(i,r,2);if(h.length){for(let a=0;a<h.length;a+=3)s[c++]=h[a]+n,s[c++]=h[a+1]+n,s[c++]=h[a+2]+n;let l=n*o;for(let a=0;a<i.length;a+=2)e[l]=i[a],e[l+1]=i[a+1],l+=o}return{vertices:e,indices:s}}const fs=8,dt=11920929e-14,ys=1;function se(i,t,e,s,r,o,n,c,h=.5,l=[]){const y=Math.min(.99,Math.max(0,h));let f=(ys-y)/1;return f*=f,$t(i,t,e,s,r,o,n,c,l,f,0),l.push(n,c),l}function $t(i,t,e,s,r,o,n,c,h,l,a){if(a>fs)return;const y=(i+e)/2,f=(t+s)/2,p=(e+r)/2,u=(s+o)/2,x=(r+n)/2,d=(o+c)/2,T=(y+p)/2,P=(f+u)/2,g=(p+x)/2,v=(u+d)/2,C=(T+g)/2,A=(P+v)/2;if(a>0){let m=n-i,w=c-t;const V=Math.abs((e-n)*w-(s-c)*m),F=Math.abs((r-n)*w-(o-c)*m);if(V>dt&&F>dt){if((V+F)*(V+F)<=l*(m*m+w*w)){h.push(C,A);return}}else if(V>dt){if(V*V<=l*(m*m+w*w)){h.push(C,A);return}}else if(F>dt){if(F*F<=l*(m*m+w*w)){h.push(C,A);return}}else if(m=C-(i+n)/2,w=A-(t+c)/2,m*m+w*w<=l){h.push(C,A);return}}$t(i,t,y,f,T,P,C,A,h,l,a+1),$t(C,A,g,v,x,d,n,c,h,l,a+1)}const xs=8,ps=11920929e-14,gs=1;function ne(i,t,e,s,r,o,n=.5,c=[]){const l=Math.min(.99,Math.max(0,n));let a=(gs-l)/1;return a*=a,Lt(c,i,t,e,s,r,o,a,0),c.push(r,o),c}function Lt(i,t,e,s,r,o,n,c,h){if(h>xs)return;const l=(t+s)/2,a=(e+r)/2,y=(s+o)/2,f=(r+n)/2,p=(l+y)/2,u=(a+f)/2;let x=o-t,d=n-e;const T=Math.abs((s-o)*d-(r-n)*x);if(T>ps){if(T*T<=c*(x*x+d*d)){i.push(p,u);return}}else if(x=p-(t+o)/2,d=u-(e+n)/2,x*x+d*d<=c){i.push(p,u);return}Lt(i,t,e,l,a,p,u,c,h+1),Lt(i,p,u,y,f,o,n,c,h+1)}function ds(i){let t=0;const e=i.length;for(let s=0;s<e;s+=2){const r=i[s],o=i[s+1],n=i[(s+2)%(e-1)],c=i[(s+3)%e];t+=r*c-n*o}return t/2}function ie(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function re(i,t,e,s){const r=t.clone().sub(i),o=s.clone().sub(e),n=e.clone().sub(i),c=r.cross(o);if(c===0)return new M((i.x+e.x)/2,(i.y+e.y)/2);const h=n.cross(o)/c;return Math.abs(h)>1?new M((i.x+e.x)/2,(i.y+e.y)/2):new M(i.x+h*r.x,i.y+h*r.y)}function oe(i,t,e,s,r,o){return(e-i)*(o-t)-(s-t)*(r-i)}function ms(i,t,e){const s=e.length;let r=0;for(let o=0,n=s-2;o<s;n=o,o+=2){const c=e[o],h=e[o+1],l=e[n],a=e[n+1];h<=t?a>t&&oe(l,a,c,h,i,t)>0&&r++:a<=t&&oe(l,a,c,h,i,t)<0&&r--}return r}function Ms(i,t){const e=t[0]-i[0],s=t[1]-i[1];return Math.sqrt(e*e+s*s)}function ce(i){const t=i.map((s,r)=>({index:r})),e=i.map(s=>{const r=s.length;if(!r)return[];let o=[Number.MAX_SAFE_INTEGER,0],n=[0,Number.MAX_SAFE_INTEGER],c=[Number.MIN_SAFE_INTEGER,0],h=[0,Number.MIN_SAFE_INTEGER];for(let P=0;P<r;P+=2){const g=s[P],v=s[P+1];o[0]>g&&(o=[g,v]),n[1]>v&&(n=[g,v]),c[0]<g&&(c=[g,v]),h[1]<v&&(h=[g,v])}const l=[(o[0]+c[0])/2,(n[1]+h[1])/2];let a,y,f,p,u,x,d,T;for(let P=0;P<r;P+=2){const g=s[P],v=s[P+1],C=Math.abs(g-l[0]),A=Math.abs(v-l[1]);v<l[1]&&(!a||C<a)&&(a=C,f=[g,v]),v>l[1]&&(!y||C<y)&&(y=C,p=[g,v]),g<l[0]&&(!u||A<u)&&(u=A,d=[g,v]),g>l[0]&&(!x||A<x)&&(x=A,T=[g,v])}return[o,n,c,h,f,p,d,T].filter(Boolean)});for(let s=0,r=i.length;s<r;s++){const o=[],n=e[s];for(let c=0;c<r;c++){if(s===c)continue;const h={},l=[];for(let a=0,y=n.length;a<y;a++){const[f,p]=n[a],u=ms(f,p,i[c]);h[u]=(h[u]??0)+1,l.push(u)}l.filter(a=>a!==0).length>l.filter(a=>a===0).length&&o.push({index:s,parentIndex:c,winding:Number(Array.from(Object.entries(h)).sort((a,y)=>y[1]-a[1])?.[0]?.[0]??0),dist:Ms(e[s][0],e[c][0])})}o.reduce((c,h)=>c+h.winding,0)!==0&&(o.sort((c,h)=>c.dist-h.dist),t[s]=o[0])}return t}function ws(i,t){const e=1-i;return e*e*t}function vs(i,t){return 2*(1-i)*i*t}function Ps(i,t){return i*i*t}function Dt(i,t,e,s){return ws(i,t)+vs(i,e)+Ps(i,s)}const Ts=1e-4,he=1e-4;function le(i,t={}){const{vertices:e=[],indices:s=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:n=!0}=t,c=Ts;if(i.length===0)return{vertices:e,indices:s};const h=r;let l=h.alignment;if(r.alignment!==.5){let N=Cs(i);o&&(N*=-1),l=(l-.5)*N+.5}const a={x:i[0],y:i[1]},y={x:i[i.length-2],y:i[i.length-1]},f=n,p=Math.abs(a.x-y.x)<c&&Math.abs(a.y-y.y)<c;if(f){i=i.slice(),p&&(i.pop(),i.pop(),y.x=i[i.length-2],y.y=i[i.length-1]);const N=(a.x+y.x)*.5,U=(y.y+a.y)*.5;i.unshift(N,U),i.push(N,U)}const u=e,x=i.length/2;let d=i.length;const T=u.length/2,P=h.width/2,g=P*P,v=h.miterLimit*h.miterLimit;let C=i[0],A=i[1],m=i[2],w=i[3],V=0,F=0,I=-(A-w),S=C-m,L=0,D=0,R=Math.sqrt(I*I+S*S);I/=R,S/=R,I*=P,S*=P;const lt=l,b=(1-lt)*2,_=lt*2;f||(h.cap==="round"?d+=W(C-I*(b-_)*.5,A-S*(b-_)*.5,C-I*b,A-S*b,C+I*_,A+S*_,u,!0)+2:h.cap==="square"&&(d+=ae(C,A,I,S,b,_,!0,u))),u.push(C-I*b,A-S*b),u.push(C+I*_,A+S*_);for(let N=1;N<x-1;++N){C=i[(N-1)*2],A=i[(N-1)*2+1],m=i[N*2],w=i[N*2+1],V=i[(N+1)*2],F=i[(N+1)*2+1],I=-(A-w),S=C-m,R=Math.sqrt(I*I+S*S),I/=R,S/=R,I*=P,S*=P,L=-(w-F),D=m-V,R=Math.sqrt(L*L+D*D),L/=R,D/=R,L*=P,D*=P;const U=m-C,at=A-w,ut=m-V,ft=F-w,Te=U*ut+at*ft,vt=at*ut-ft*U,yt=vt<0;if(Math.abs(vt)<.001*Math.abs(Te)){u.push(m-I*b,w-S*b),u.push(m+I*_,w+S*_),Te>=0&&(h.join==="round"?d+=W(m,w,m-I*b,w-S*b,m-L*b,w-D*b,u,!1)+4:d+=2,u.push(m-L*_,w-D*_),u.push(m+L*b,w+D*b));continue}const Ce=(-I+C)*(-S+w)-(-I+m)*(-S+A),be=(-L+V)*(-D+w)-(-L+m)*(-D+F),Pt=(U*be-ut*Ce)/vt,Tt=(ft*Ce-at*be)/vt,Rt=(Pt-m)*(Pt-m)+(Tt-w)*(Tt-w),H=m+(Pt-m)*b,Q=w+(Tt-w)*b,J=m-(Pt-m)*_,K=w-(Tt-w)*_,$s=Math.min(U*U+at*at,ut*ut+ft*ft),Ae=yt?b:_,Ls=$s+Ae*Ae*g;Rt<=Ls?h.join==="bevel"||Rt/g>v?(yt?(u.push(H,Q),u.push(m+I*_,w+S*_),u.push(H,Q),u.push(m+L*_,w+D*_)):(u.push(m-I*b,w-S*b),u.push(J,K),u.push(m-L*b,w-D*b),u.push(J,K)),d+=2):h.join==="round"?yt?(u.push(H,Q),u.push(m+I*_,w+S*_),d+=W(m,w,m+I*_,w+S*_,m+L*_,w+D*_,u,!0)+4,u.push(H,Q),u.push(m+L*_,w+D*_)):(u.push(m-I*b,w-S*b),u.push(J,K),d+=W(m,w,m-I*b,w-S*b,m-L*b,w-D*b,u,!1)+4,u.push(m-L*b,w-D*b),u.push(J,K)):(u.push(H,Q),u.push(J,K)):(u.push(m-I*b,w-S*b),u.push(m+I*_,w+S*_),h.join==="round"?yt?d+=W(m,w,m+I*_,w+S*_,m+L*_,w+D*_,u,!0)+2:d+=W(m,w,m-I*b,w-S*b,m-L*b,w-D*b,u,!1)+2:h.join==="miter"&&Rt/g<=v&&(yt?(u.push(J,K),u.push(J,K)):(u.push(H,Q),u.push(H,Q)),d+=2),u.push(m-L*b,w-D*b),u.push(m+L*_,w+D*_),d+=2)}C=i[(x-2)*2],A=i[(x-2)*2+1],m=i[(x-1)*2],w=i[(x-1)*2+1],I=-(A-w),S=C-m,R=Math.sqrt(I*I+S*S),I/=R,S/=R,I*=P,S*=P,u.push(m-I*b,w-S*b),u.push(m+I*_,w+S*_),f||(h.cap==="round"?d+=W(m-I*(b-_)*.5,w-S*(b-_)*.5,m-I*b,w-S*b,m+I*_,w+S*_,u,!1)+2:h.cap==="square"&&(d+=ae(m,w,I,S,b,_,!1,u)));const Fs=he*he;for(let N=T;N<d+T-2;++N)C=u[N*2],A=u[N*2+1],m=u[(N+1)*2],w=u[(N+1)*2+1],V=u[(N+2)*2],F=u[(N+2)*2+1],!(Math.abs(C*(w-F)+m*(F-A)+V*(A-w))<Fs)&&s.push(N,N+1,N+2);return{vertices:e,indices:s}}function Cs(i){const t=i.length;if(t<6)return 1;let e=0;for(let s=0,r=i[t-2],o=i[t-1];s<t;s+=2){const n=i[s],c=i[s+1];e+=(n-r)*(c+o),r=n,o=c}return e<0?-1:1}function ae(i,t,e,s,r,o,n,c){const h=i-e*r,l=t-s*r,a=i+e*o,y=t+s*o;let f,p;n?(f=s,p=-e):(f=-s,p=e);const u=h+f,x=l+p,d=a+f,T=y+p;return c.push(u,x),c.push(d,T),2}function W(i,t,e,s,r,o,n,c){const h=e-i,l=s-t;let a=Math.atan2(h,l),y=Math.atan2(r-i,o-t);c&&a<y?a+=Math.PI*2:!c&&a>y&&(y+=Math.PI*2);let f=a;const p=y-a,u=Math.abs(p),x=Math.sqrt(h*h+l*l),d=(15*u*Math.sqrt(x)/Math.PI>>0)+1,T=p/d;if(f+=T,c){n.push(i,t),n.push(e,s);for(let P=1,g=f;P<d;P++,g+=T)n.push(i,t),n.push(i+Math.sin(g)*x,t+Math.cos(g)*x);n.push(i,t),n.push(r,o)}else{n.push(e,s),n.push(i,t);for(let P=1,g=f;P<d;P++,g+=T)n.push(i+Math.sin(g)*x,t+Math.cos(g)*x),n.push(i,t);n.push(r,o),n.push(i,t)}return d*2}class Y{arcLengthDivision=200;_lengths=[];getPointAt(t,e=new M){return this.getPoint(this.getUToTMapping(t),e)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(t){const e=typeof t=="function";return this.getControlPointRefs().forEach(s=>{e?t(s):s.applyMatrix3(t)}),this}getUnevenVertices(t=5,e=[]){const s=new M;for(let r=0,o=Math.max(1,t)-1;r<=o;r++)this.getPoint(r/o,s),e.push(s.x,s.y);return e}getSpacedVertices(t=5,e=[]){const s=new M;for(let r=0,o=Math.max(1,t)-1;r<=o;r++)this.getPointAt(r/o,s),e.push(s.x,s.y);return e}getAdaptiveVertices(t=[]){return this.getUnevenVertices(5,t)}_verticesToPoints(t,e=[]){for(let s=0,r=t.length;s<r;s+=2){const o=t[s],n=t[s+1];e.push(new M(o,n))}return e}getSpacedPoints(t,e=[]){const s=this.getSpacedVertices(t);return this._verticesToPoints(s,e),e}getUnevenPoints(t,e=[]){const s=this.getUnevenVertices(t);return this._verticesToPoints(s,e),e}getAdaptivePoints(t=[]){const e=this.getAdaptiveVertices();return this._verticesToPoints(e,t),t}getPoints(t,e=[]){let s;return t?s=this.getUnevenVertices(t):s=this.getAdaptiveVertices(),this._verticesToPoints(s,e),e}getLength(){const t=this.getLengths();return t[t.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){const t=this.arcLengthDivision,e=[0];for(let s=0,r=this.getPoint(0),o=1;o<=t;o++){const n=this.getPoint(o/t);s+=n.distanceTo(r),e.push(s),r=n}this._lengths=e}getUToTMapping(t,e){const s=this.getLengths(),r=s.length,o=e??t*s[r-1];if(r<2)return o/s[0];let n=0,c=0,h=r-1,l;for(;c<=h;)if(n=Math.floor(c+(h-c)/2),l=s[n]-o,l<0)c=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=Math.max(0,h),s[n]===o)return n/(r-1);const a=s[n],f=s[n+1]-a,p=Math.max(0,(o-a)/f);return(n+p)/(r-1)}getTangent(t,e=new M){const r=Math.max(0,t-1e-4),o=Math.min(1,t+1e-4);return e.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUToTMapping(t),e)}getNormal(t,e=new M){return this.getTangent(t,e),e.set(-e.y,e.x).normalize()}getNormalAt(t,e){return this.getNormal(this.getUToTMapping(t),e)}getTForPoint(t,e=.001){let s=0,r=1,o=(s+r)/2;for(;r-s>e;){o=(s+r)/2;const n=this.getPoint(o);if(n.distanceTo(t)<e)return o;n.x<t.x?s=o:r=o}return o}getMinMax(t=M.MAX,e=M.MIN){const s=this.getPoints();for(let r=0,o=s.length;r<o;r++){const n=s[r];t.min(n),e.max(n)}return{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}getFillVertices(t){return this.getAdaptiveVertices()}fillTriangulate(t){return Ft(this.getFillVertices(t),t)}strokeTriangulate(t){return le(this.getAdaptiveVertices(),t)}toCommands(){const t=[],e=this.getPoints();for(let s=0,r=e.length;s<r;s++){const o=e[s];s===0?t.push({type:"M",x:o.x,y:o.y}):t.push({type:"L",x:o.x,y:o.y})}return t}toData(){return Bt(this.toCommands())}drawTo(t){return this.toCommands().forEach(e=>{switch(e.type){case"M":t.moveTo(e.x,e.y);break;case"L":t.lineTo(e.x,e.y);break}}),this}copy(t){return this.arcLengthDivision=t.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const bs=new z,ue=new z,fe=new z,mt=new M;class qt extends Y{constructor(t=new M,e=new M,s=new M,r=0,o=0,n=Math.PI*2,c=!1){super(),this._center=t,this._radius=e,this._diff=s,this.rotate=r,this.startAngle=o,this.endAngle=n,this.clockwise=c}get cx(){return this._center.x}set cx(t){this._center.x=t}get cy(){return this._center.y}set cy(t){this._center.y=t}get rx(){return this._radius.x}set rx(t){this._radius.x=t}get ry(){return this._radius.y}set ry(t){this._radius.y=t}get dx(){return this._diff.x}set dx(t){this._diff.x=t}get dy(){return this._diff.y}set dy(t){this._diff.y=t}isClockwise(){return this.clockwise}_getDeltaAngle(){const t=Math.PI*2;let e=this.endAngle-this.startAngle;const s=Math.abs(e)<Number.EPSILON;return e=(e%t+t)%t,s?e=0:this.clockwise||(e=e===0?-t:e-t),e}getPoint(t,e=new M){const s=this._getDeltaAngle(),r=this.startAngle+t*s;let o=this.cx+this.rx*Math.cos(r),n=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){const c=Math.cos(this.rotate),h=Math.sin(this.rotate),l=o-this.cx,a=n-this.cy;o=l*c-a*h+this.cx,n=l*h+a*c+this.cy}return e.set(o,n)}toCommands(){const{cx:t,cy:e,rx:s,ry:r,startAngle:o,endAngle:n,clockwise:c,rotate:h}=this,l=t+s*Math.cos(o)*Math.cos(h)-r*Math.sin(o)*Math.sin(h),a=e+s*Math.cos(o)*Math.sin(h)+r*Math.sin(o)*Math.cos(h),y=Math.abs(o-n),f=y>Math.PI?1:0,p=c?1:0,u=h*180/Math.PI;if(y>=2*Math.PI){const x=o+Math.PI,d=t+s*Math.cos(x)*Math.cos(h)-r*Math.sin(x)*Math.sin(h),T=e+s*Math.cos(x)*Math.sin(h)+r*Math.sin(x)*Math.cos(h);return[{type:"M",x:l,y:a},{type:"A",rx:s,ry:r,angle:u,largeArcFlag:0,sweepFlag:p,x:d,y:T},{type:"A",rx:s,ry:r,angle:u,largeArcFlag:0,sweepFlag:p,x:l,y:a}]}else{const x=t+s*Math.cos(n)*Math.cos(h)-r*Math.sin(n)*Math.sin(h),d=e+s*Math.cos(n)*Math.sin(h)+r*Math.sin(n)*Math.cos(h);return[{type:"M",x:l,y:a},{type:"A",rx:s,ry:r,angle:u,largeArcFlag:f,sweepFlag:p,x,y:d}]}}drawTo(t){const{cx:e,cy:s,rx:r,ry:o,rotate:n,startAngle:c,endAngle:h,clockwise:l}=this;return t.ellipse(e,s,r,o,n,c,h,!l),this}applyTransform(t){return mt.set(this.cx,this.cy),mt.applyMatrix3(t),this.cx=mt.x,this.cy=mt.y,Is(t)?As(this,t):ks(this,t),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(t=[]){const{cx:e,cy:s,rx:r,ry:o,dx:n,dy:c,startAngle:h,endAngle:l,clockwise:a,rotate:y}=this,f=!a;let p=Math.abs(h-l);(!f&&h>l||f&&l>h)&&(p=2*Math.PI-p);const u=Math.max(12,Math.floor(12*r**(1/3)*(p/Math.PI)));let x=p/u,d=h;x*=f?-1:1;const T=Math.cos(f?y:-y),P=Math.sin(f?y:-y);for(let g=0;g<u+1;g++){const v=n+Math.cos(d)*r,C=c+Math.sin(d)*o,A=v*T-C*P,m=v*P+C*T;t.push(e+A,s+m),d+=x}return t}_getAdaptiveVerticesByCircle(t=[]){const{cx:e,cy:s,rx:r,ry:o,dx:n,dy:c,rotate:h,clockwise:l}=this;if(!(r>=0&&o>=0&&n>=0&&c>=0))return t;const a=Math.ceil(2.3*Math.sqrt(r+o)),y=a*8+(n?4:0)+(c?4:0),f=[];if(y===0)return t;{const x=f.length;if(a===0)f[x]=f[x+6]=e+n,f[x+1]=f[x+3]=s+c,f[x+2]=f[x+4]=e-n,f[x+5]=f[x+7]=s-c;else{let d=x,T=x+a*4+(n?2:0)+2,P=T,g=y,v=n+r,C=c,A=e+v,m=e-v,w=s+C;if(f[d++]=A,f[d++]=w,f[--T]=w,f[--T]=m,c){const F=s-C;f[P++]=m,f[P++]=F,f[--g]=F,f[--g]=A}for(let F=1;F<a;F++){const I=Math.PI/2*(F/a),S=n+Math.cos(I)*r,L=c+Math.sin(I)*o,D=e+S,R=e-S,lt=s+L,b=s-L;f[d++]=D,f[d++]=lt,f[--T]=lt,f[--T]=R,f[P++]=R,f[P++]=b,f[--g]=b,f[--g]=D}v=n,C=c+o,A=e+v,m=e-v,w=s+C;const V=s-C;f[d++]=A,f[d++]=w,f[--g]=V,f[--g]=A,n&&(f[d++]=m,f[d++]=w,f[--g]=V,f[--g]=m)}}const p=Math.cos(l?-h:h),u=Math.sin(l?-h:h);for(let x=0;x<f.length;x+=2){const d=f[x],T=f[x+1],P=d-e,g=T-s,v=P*p-g*u,C=P*u+g*p;t.push(e+v,s+C)}return t}getAdaptiveVertices(t=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(t):this._getAdaptiveVerticesByArc(t)}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.rx=t.rx,this.ry=t.ry,this.dx=t.dx,this.dy=t.dy,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotate=t.rotate,this}}function As(i,t){const e=i.rx,s=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),n=new M(e*r,e*o),c=new M(-s*o,s*r),h=n.applyMatrix3(t),l=c.applyMatrix3(t),a=bs.set(h.x,l.x,0,h.y,l.y,0,0,0,1),y=ue.copy(a).invert(),u=fe.copy(y).transpose().multiply(y).elements,x=Ss(u[0],u[1],u[4]),d=Math.sqrt(x.rt1),T=Math.sqrt(x.rt2);if(i.rx=1/d,i.ry=1/T,i.rotate=Math.atan2(x.sn,x.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const g=ue.set(d,0,0,0,T,0,0,0,1),v=fe.set(x.cs,x.sn,0,-x.sn,x.cs,0,0,0,1),C=g.multiply(v).multiply(a),A=m=>{const{x:w,y:V}=new M(Math.cos(m),Math.sin(m)).applyMatrix3(C);return Math.atan2(V,w)};i.startAngle=A(i.startAngle),i.endAngle=A(i.endAngle),ye(t)&&(i.clockwise=!i.clockwise)}}function ks(i,t){const e=xe(t),s=pe(t);i.rx*=e,i.ry*=s;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotate+=r,ye(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function ye(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Is(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const s=xe(i),r=pe(i);return Math.abs(e/(s*r))>Number.EPSILON}function xe(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function pe(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ss(i,t,e){let s,r,o,n,c;const h=i+e,l=i-e,a=Math.sqrt(l*l+4*t*t);return h>0?(s=.5*(h+a),c=1/s,r=i*c*e-t*c*t):h<0?r=.5*(h-a):(s=.5*a,r=-.5*a),l>0?o=l+a:o=l-a,Math.abs(o)>2*Math.abs(t)?(c=-2*t/o,n=1/Math.sqrt(1+c*c),o=c*n):Math.abs(t)===0?(o=1,n=0):(c=-.5*o/t,o=1/Math.sqrt(1+c*c),n=c*o),l>0&&(c=o,o=-n,n=c),{rt1:s,rt2:r,cs:o,sn:n}}class ge extends qt{constructor(t=0,e=0,s=1,r=0,o=Math.PI*2,n=!1){super(new M(t,e),new M(s,s),new M,0,r,o,n)}drawTo(t){const{cx:e,cy:s,rx:r,startAngle:o,endAngle:n,clockwise:c}=this;return t.arc(e,s,r,o,n,!c),this}}class B extends Y{constructor(t=new M,e=new M){super(),this.p1=t,this.p2=e}static from(t,e,s,r){return new B(new M(t,e),new M(s,r))}getPoint(t,e=new M){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new M){return this.getPoint(t,e)}getTangent(t,e=new M){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new M){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=M.MAX,e=M.MIN){const{p1:s,p2:r}=this;return t.x=Math.min(t.x,s.x,r.x),t.y=Math.min(t.y,s.y,r.y),e.x=Math.max(e.x,s.x,r.x),e.y=Math.max(e.y,s.y,r.y),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}getFillVertices(t={}){const e=Math.min(this.p1.x,this.p2.x),s=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),o=Math.max(this.p1.y,this.p2.y),n=e,c=r,h=s-e||t.style?.strokeWidth||0,l=o-r||t.style?.strokeWidth||0;return[n,c,n+h,c,n+h,c+l,n,c+l]}drawTo(t){const{p1:e,p2:s}=this;return t.lineTo(e.x,e.y),t.lineTo(s.x,s.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class nt extends Y{constructor(t=[]){super(),this.curves=t}getFlatCurves(){return this.curves.flatMap(t=>t instanceof nt?t.getFlatCurves():t)}addCurve(t){return this.curves.push(t),this}getPoint(t,e=new M){const s=t*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=s){const n=r[o]-s,c=this.curves[o],h=c.getLength();return c.getPointAt(h===0?0:1-n/h,e)}o++}return e}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){const t=[];for(let e=0,s=0,r=this.curves.length;e<r;e++)s+=this.curves[e].getLength(),t.push(s);this._lengths=t}getControlPointRefs(){return this.curves.flatMap(t=>t.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(t,e){const s=[t[e-1],t[e]],r=[t[e+1],t[e+2]];return s[0]===r[0]&&s[1]===r[1]&&t.splice(e+1,2),t}getSpacedVertices(t=5,e=[]){let s;return this.curves.forEach(r=>{r.getSpacedVertices(t,e),s&&this._removeNextPointIfEqualPrevPoint(e,s),s=e.length-1}),e}getAdaptiveVertices(t=[]){let e;return this.curves.forEach(s=>{s.getAdaptiveVertices(t),e&&this._removeNextPointIfEqualPrevPoint(t,e),e=t.length-1}),t}strokeTriangulate(t){return this.curves.length===1?this.curves[0].strokeTriangulate(t):super.strokeTriangulate(t)}getFillVertices(t){if(this.curves.length===1)return this.curves[0].getFillVertices(t);{const e=[];let s;return this.curves.forEach(r=>{let o;r instanceof B?o=r.getAdaptiveVertices():o=r.getFillVertices(t),e.push(...o),s&&this._removeNextPointIfEqualPrevPoint(e,s),s=e.length-1}),e}}applyTransform(t){return this.curves.forEach(e=>e.applyTransform(t)),this}getMinMax(t=M.MAX,e=M.MIN){return this.curves.forEach(s=>s.getMinMax(t,e)),{min:t.finite(),max:e.finite()}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new X(t.x,t.y,e.x-t.x,e.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(s=>s.drawTo(t)),this}copy(t){return super.copy(t),this.curves=t.curves.map(e=>e.clone()),this}}class Mt extends Y{constructor(t=new M,e=new M,s=new M,r=new M){super(),this.p1=t,this.cp1=e,this.cp2=s,this.p2=r}static from(t,e,s,r,o,n,c,h){return new Mt(new M(t,e),new M(s,r),new M(o,n),new M(c,h))}getPoint(t,e=new M){const{p1:s,cp1:r,cp2:o,p2:n}=this;return e.set(_t(t,s.x,r.x,o.x,n.x),_t(t,s.y,r.y,o.y,n.y))}getAdaptiveVertices(t=[]){return se(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,t)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(t,e,s){const r=e*e-4*t*s;if(r<0)return[];const o=Math.sqrt(r),n=(-e+o)/(2*t),c=(-e-o)/(2*t);return[n,c].filter(h=>h>=0&&h<=1)}getMinMax(t=M.MAX,e=M.MIN){const{p1:s,cp1:r,cp2:o,p2:n}=this,c=this._solveQuadratic(3*(r.x-s.x),6*(o.x-r.x),3*(n.x-o.x)),h=this._solveQuadratic(3*(r.y-s.y),6*(o.y-r.y),3*(n.y-o.y)),l=[0,1,...c,...h];return((y,f)=>{for(const p of y)for(let u=0;u<=f;u++){const x=u/f-.5,d=Math.min(1,Math.max(0,p+x)),T=this.getPoint(d);t.x=Math.min(t.x,T.x),t.y=Math.min(t.y,T.y),e.x=Math.max(e.x,T.x),e.y=Math.max(e.y,T.y)}})(l,10),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp1:e,cp2:s,p2:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:s.x,y2:s.y,x:r.x,y:r.y}]}drawTo(t){const{p1:e,cp1:s,cp2:r,p2:o}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(s.x,s.y,r.x,r.y,o.x,o.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp1.copy(t.cp1),this.cp2.copy(t.cp2),this.p2.copy(t.p2),this}}class de extends qt{constructor(t=0,e=0,s=1,r=1,o=0,n=0,c=Math.PI*2,h=!1){super(new M(t,e),new M(s,r),new M,o,n,c,h)}drawTo(t){return t.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Vt extends nt{}class _s extends Vt{constructor(t=0,e=0,s=1,r=3){super(),this.cx=t,this.cy=e,this.radius=s,this.sideCount=r,this.update()}update(){const{cx:t,cy:e,radius:s,sideCount:r}=this,o=[];for(let c=0;c<r;c++){const h=c*2*Math.PI/r-.5*Math.PI;o.push(new M(s*Math.cos(h),s*Math.sin(h)).add({x:t,y:e}))}const n=[];for(let c=0;c<r;c++)n.push(new B(o[c],o[(c+1)%r]));return this.curves=n,this}copy(t){return super.copy(t),this.cx=t.cx,this.cy=t.cy,this.radius=t.radius,this.sideCount=t.sideCount,this.update(),this}}class wt extends Y{constructor(t=new M,e=new M,s=new M){super(),this.p1=t,this.cp=e,this.p2=s}static from(t,e,s,r,o,n){return new wt(new M(t,e),new M(s,r),new M(o,n))}getPoint(t,e=new M){const{p1:s,cp:r,p2:o}=this;return e.set(Dt(t,s.x,r.x,o.x),Dt(t,s.y,r.y,o.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(t=[]){return ne(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=M.MAX,e=M.MIN){const{p1:s,cp:r,p2:o}=this,n=.5*(s.x+r.x),c=.5*(s.y+r.y),h=.5*(s.x+o.x),l=.5*(s.y+o.y);return t.x=Math.min(t.x,s.x,o.x,n,h),t.y=Math.min(t.y,s.y,o.y,c,l),e.x=Math.max(e.x,s.x,o.x,n,h),e.y=Math.max(e.y,s.y,o.y,c,l),{min:t.finite(),max:e.finite()}}toCommands(){const{p1:t,cp:e,p2:s}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:s.x,y:s.y}]}drawTo(t){const{p1:e,cp:s,p2:r}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(s.x,s.y,r.x,r.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.cp.copy(t.cp),this.p2.copy(t.p2),this}}class me extends Vt{constructor(t=0,e=0,s=0,r=0){super(),this.x=t,this.y=e,this.width=s,this.height=r,this.update()}update(){const{x:t,y:e,width:s,height:r}=this,o=[new M(t,e),new M(t+s,e),new M(t+s,e+r),new M(t,e+r)];return this.curves=[new B(o[0],o[1]),new B(o[1],o[2]),new B(o[2],o[3]),new B(o[3],o[0])],this}drawTo(t){return t.rect(this.x,this.y,this.width,this.height),this}getFillVertices(t={}){const{x:e,y:s,width:r,height:o}=this;return[e,s,e+r,s,e+r,s+o,e,s+o]}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.update(),this}}class Me extends qt{constructor(t=0,e=0,s=1,r=1,o=1){super(),this.x=t,this.y=e,this.width=s,this.height=r,this.radius=o,this.update()}update(){const{x:t,y:e,width:s,height:r,radius:o}=this,n=s/2,c=r/2,h=t+n,l=e+c,a=Math.max(0,Math.min(o,Math.min(n,c))),y=a;return this._center=new M(h,l),this._radius=new M(a,y),this._diff=new M(n-a,c-y),this}drawTo(t){const{x:e,y:s,width:r,height:o,radius:n}=this;return t.roundRect(e,s,r,o,n),this}copy(t){return super.copy(t),this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this.update(),this}}class we extends Y{constructor(t=[]){super(),this.points=t}getPoint(t,e=new M){const{points:s}=this,r=(s.length-1)*t,o=Math.floor(r),n=r-o,c=s[o===0?o:o-1],h=s[o],l=s[o>s.length-2?s.length-1:o+1],a=s[o>s.length-3?s.length-1:o+2];return e.set(St(n,c.x,h.x,l.x,a.x),St(n,c.y,h.y,l.y,a.y)),e}getControlPointRefs(){return this.points}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++)this.points.push(t.points[e].clone());return this}}class ht extends nt{startPoint;currentPoint;autoClose=!1;constructor(t){super(),t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,s=t.length;e<s;e++){const{x:r,y:o}=t[e];this.lineTo(r,o)}return this}addCommands(t){return At(t,this),this}addData(t){return this.addCommands(kt(t)),this}_closeVertices(t){return this.autoClose&&t.length>=4&&t[0]!==t[t.length-2]&&t[1]!==t[t.length-1]&&t.push(t[0],t[1]),t}getUnevenVertices(t=40,e=[]){return this._closeVertices(super.getUnevenVertices(t,e))}getSpacedVertices(t=40,e=[]){return this._closeVertices(super.getSpacedVertices(t,e))}getAdaptiveVertices(t=[]){return this._closeVertices(super.getAdaptiveVertices(t))}getFillVertices(t){return this._closeVertices(super.getFillVertices(t))}_setCurrentPoint(t){return this.currentPoint=new M(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const e=t.getPoint(0);(!this.currentPoint||!e.equals(this.currentPoint))&&this.lineTo(e.x,e.y)}return this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;e&&!t.equals(e)&&(this.curves.push(new B(e.clone(),t.clone())),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new M(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const s=this.currentPoint;return s?.equals({x:t,y:e})||this.curves.push(B.from(s?.x??0,s?.y??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,s,r,o,n){const c=this.currentPoint;return c?.equals({x:o,y:n})||this.curves.push(Mt.from(c?.x??0,c?.y??0,t,e,s,r,o,n)),this._setCurrentPoint({x:o,y:n}),this}quadraticCurveTo(t,e,s,r){const o=this.currentPoint;return o?.equals({x:s,y:r})||this.curves.push(wt.from(o?.x??0,o?.y??0,t,e,s,r)),this._setCurrentPoint({x:s,y:r}),this}arc(t,e,s,r,o,n){const c=new ge(t,e,s,r,o,!n);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeArc(t,e,s,r,o,n){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.arc(t,e,s,r,o,n),this}arcTo(t,e,s,r,o){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,s,r,o,n,c,h=!0){const l=new de(t,e,s,r,o,n,c,!h);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,s,r,o,n,c,h){return t+=this.currentPoint?.x??0,e+=this.currentPoint?.y??0,this.ellipse(t,e,s,r,o,n,c,h),this}rect(t,e,s,r){const o=new me(t,e,s,r);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint({x:t,y:e}),this}roundRect(t,e,s,r,o){const n=new Me(t,e,s,r,o);return this._connetLineTo(n),this.curves.push(n),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new M;return this.curves.push(new we([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){const e=this.curves[0]?.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(s=>s.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=t.currentPoint?.clone(),this}}class j extends nt{_meta;currentCurve=new ht;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}constructor(t,e={}){super(),this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof j?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(t){return this._meta=t,this}addPath(t){const e=t instanceof j?t.curves:[t];if(e.filter(s=>s.curves.length).length===0)return this;if(!this.currentCurve.curves.length){const s=this.curves.findIndex(r=>r===this.currentCurve);s>-1&&this.curves.splice(s,1)}return this.curves.push(...e.map(s=>s.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){const t=this.startPoint;return t&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new ht().moveTo(t.x,t.y),this.curves.push(this.currentCurve)),this}moveTo(t,e){return this.currentCurve.currentPoint?.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new ht,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,s,r,o,n){return this.currentCurve.bezierCurveTo(t,e,s,r,o,n),this}quadraticCurveTo(t,e,s,r){return this.currentCurve.quadraticCurveTo(t,e,s,r),this}arc(t,e,s,r,o,n){return this.currentCurve.arc(t,e,s,r,o,n),this}arcTo(t,e,s,r,o){return this.currentCurve.arcTo(t,e,s,r,o),this}ellipse(t,e,s,r,o,n,c,h){return this.currentCurve.ellipse(t,e,s,r,o,n,c,h),this}rect(t,e,s,r){return this.currentCurve.rect(t,e,s,r),this}roundRect(t,e,s,r,o){return this.currentCurve.roundRect(t,e,s,r,o),this}reset(){return this.currentCurve=new ht,this.curves=[this.currentCurve],this.style={},this}addCommands(t){return At(t,this),this}addData(t){return this.addCommands(kt(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,s={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(t,e,s)}),this}skew(t,e=0,s={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(t,e,s)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(s=>{s.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.getFlatCurves(),s=[],r=[],o=[];e.forEach((c,h)=>{const l=c.getControlPointRefs(),a=c.isClockwise();o[h]=l,r[h]=a;const y=l[0],f=l[l.length-1]??y;s.push({start:a?f:y,end:a?y:f,index:h})});const n=[];return s.forEach((c,h)=>{n[h]=[],s.forEach((l,a)=>{l.start&&c.end&&a!==h&&l.start?.equals(c.end)&&n[h].push(l.index)})}),e.forEach((c,h)=>{const l=r[h];o[h].forEach(a=>{a.add(c.getNormal(c.getTForPoint(a)).scale(l?t:-t))})}),n.forEach((c,h)=>{const l=o[h];c.forEach(a=>{const y=o[a],f=re(l[l.length-1],l[l.length-2]??l[l.length-1],y[0],y[1]??y[0]);f&&(l[l.length-1].copy(f),y[0].copy(f))})}),this}getMinMax(t=M.MAX,e=M.MIN,s=!0){const r=this.strokeWidth;return this.curves.forEach(o=>{if(o.getMinMax(t,e),s&&r>1){const n=r/2,c=o.isClockwise(),h=[];for(let l=0;l<=1;l+=1/o.arcLengthDivision){const a=o.getPoint(l),y=o.getNormal(l),f=y.clone().scale(c?n:-n),p=y.clone().scale(c?-n:n);h.push(a.clone().add(f),a.clone().add(p),a.clone().add({x:n,y:0}),a.clone().add({x:-n,y:0}),a.clone().add({x:0,y:n}),a.clone().add({x:0,y:-n}),a.clone().add({x:n,y:n}),a.clone().add({x:-n,y:-n}))}t.min(...h),e.max(...h)}}),{min:t.finite(),max:e.finite()}}strokeTriangulate(t){const e=t?.indices??[],s=t?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...t,indices:e,vertices:s,style:{...this.style}})}),{indices:e,vertices:s}}fillTriangulate(t){const e={...t,style:{...this.style,...t?.style}},s=e.indices??[],r=e.vertices??[];if((e.style.fillRule??"nonzero")==="nonzero"){const n=this.curves.map(l=>l.getFillVertices(e)),c=ce(n),h=c.length;for(let l=0;l<h;l++){const a=c[l],y=n[l];if(a.winding||!y.length)continue;const f=y.slice(),p=[];for(let u=0;u<h;u++){const x=c[u];x.parentIndex===l&&(p.push(f.length/2),f.push(...n[x.index]))}Ft(f,{...t,indices:s,vertices:r,holes:p,style:{...this.style}})}}else this.curves.forEach(n=>{n.fillTriangulate({...t,indices:s,vertices:r,style:{...this.style}})});return{indices:s,vertices:r}}getBoundingBox(t=!0){const{min:e,max:s}=this.getMinMax(void 0,void 0,t);return new X(e.x,e.y,s.x-e.x,s.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:s="#000",stroke:r="none"}=e;return t.beginPath(),t.save(),Ct(t,e),this.curves.forEach(o=>{o.drawTo(t)}),s!=="none"&&t.fill(),r!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:s="#000",stroke:r="none"}=e;return t.beginPath(),t.save(),Ct(t,e),this.getControlPointRefs().forEach(o=>{tt(t,o.x,o.y,{radius:4})}),s!=="none"&&t.fill(),r!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSvgPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const r in t)t[r]!==void 0&&(e[ie(r)]=t[r]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let s="";for(const r in e)e[r]!==void 0&&(s+=`${r}:${e[r]};`);return`<path d="${this.toData()}" style="${s}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class ve{constructor(t=[],e){this.paths=t,this.viewBox=e}getBoundingBox(t=!0){if(!this.paths.length)return;const e=M.MAX,s=M.MIN;return this.paths.forEach(r=>r.getMinMax(e,s,t)),new X(e.x,e.y,s.x-e.x,s.y-e.y)}toTriangulatedSvgString(t=this.paths.map(s=>s.fillTriangulate()),e=0){let s="",r="";const o={x:-e,y:-e},n={x:e,y:e};(Array.isArray(t)?t:[t]).forEach(({vertices:a,indices:y,points:f=[]})=>{const p=u=>{const x=a[u*2],d=a[u*2+1];return o.x=Math.min(o.x,x+e),n.x=Math.max(n.x,x+e),o.y=Math.min(o.y,d+e),n.y=Math.max(n.y,d+e),[x,d]};for(let u=0,x=y.length;u<x;u+=3){const d=p(y[u]),T=p(y[u+1]),P=p(y[u+2]);s+=`<polygon
|
|
3
|
-
points="${d.join(",")} ${T.join(",")} ${P.join(",")}"
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernPath2d={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var n={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function r(e,t){let{fill:r=`#000`,stroke:i=`none`,strokeWidth:a=i===`none`?0:1,strokeLinecap:o=`round`,strokeLinejoin:s=`miter`,strokeMiterlimit:c=0,strokeDasharray:l=[],strokeDashoffset:u=0,shadowOffsetX:d=0,shadowOffsetY:f=0,shadowBlur:p=0,shadowColor:m=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=r,e.strokeStyle=i,e.lineWidth=a,e.lineCap=o,e.lineJoin=n[s],e.miterLimit=c,e.setLineDash(l),e.lineDashOffset=u,e.shadowOffsetX=d,e.shadowOffsetY=f,e.shadowBlur=p,e.shadowColor=m}var i=class e{static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(this._x/e,this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){let r=e<0?n.x-this._x+n.x:this._x,i=t<0?n.y-this._y+n.y:this._y;return this.set(r*Math.abs(e),i*Math.abs(t))}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},a=class e{get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new i((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function o(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function s(e,t,n,r,i,a,s,c){if(t===0||n===0){e.lineTo(c.x,c.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let l=(s.x-c.x)/2,u=(s.y-c.y)/2,d=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(s.x+c.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(s.y+c.y)/2,T=o(1,0,(d-x)/t,(f-S)/n),E=o((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.ellipse(C,w,t,n,r,T,T+E,a===0)}var c={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function l(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function l(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function u(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let d,f=e.length;for(let p=0;p<f;p++){if(d=e[p],Array.isArray(t)&&t.includes(s.length%n)&&c.FLAGS.test(d)){r=1,a=d,u();continue}if(r===0){if(c.WHITESPACE.test(d))continue;if(c.DIGIT.test(d)||c.SIGN.test(d)){r=1,a=d;continue}if(c.POINT.test(d)){r=2,a=d;continue}c.COMMA.test(d)&&(i&&l(d,p,s),i=!0)}if(r===1){if(c.DIGIT.test(d)){a+=d;continue}if(c.POINT.test(d)){a+=d,r=2;continue}if(c.EXP.test(d)){r=3;continue}c.SIGN.test(d)&&a.length===1&&c.SIGN.test(a[0])&&l(d,p,s)}if(r===2){if(c.DIGIT.test(d)){a+=d;continue}if(c.EXP.test(d)){r=3;continue}c.POINT.test(d)&&a[a.length-1]===`.`&&l(d,p,s)}if(r===3){if(c.DIGIT.test(d)){o+=d;continue}if(c.SIGN.test(d)){if(o===``){o+=d;continue}o.length===1&&c.SIGN.test(o)&&l(d,p,s)}}c.WHITESPACE.test(d)?(u(),r=0,i=!1):c.COMMA.test(d)?(u(),r=0,i=!0):c.SIGN.test(d)?(u(),r=1,a=d):c.POINT.test(d)?(u(),r=2,a=d):l(d,p,s)}return u(),s}function u(e,t){return e-(t-e)}function d(e,t){let n=new i,r=new i;for(let i=0,a=e.length;i<a;i++){let a=e[i];if(a.type===`m`||a.type===`M`)a.type===`m`?n.add(a):n.copyFrom(a),t.moveTo(n.x,n.y),r.copyFrom(n);else if(a.type===`h`||a.type===`H`)a.type===`h`?n.x+=a.x:n.x=a.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`v`||a.type===`V`)a.type===`v`?n.y+=a.y:n.y=a.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`l`||a.type===`L`)a.type===`l`?n.add(a):n.copyFrom(a),t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`c`||a.type===`C`)a.type===`c`?(t.bezierCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`s`||a.type===`S`)a.type===`s`?(t.bezierCurveTo(u(n.x,r.x),u(n.y,r.y),n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(u(n.x,r.x),u(n.y,r.y),a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`q`||a.type===`Q`)a.type===`q`?(t.quadraticCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x,n.y+a.y),r.x=n.x+a.x1,r.y=n.y+a.y1,n.add(a)):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),r.x=a.x1,r.y=a.y1,n.copyFrom(a));else if(a.type===`t`||a.type===`T`){let e=u(n.x,r.x),i=u(n.y,r.y);r.x=e,r.y=i,a.type===`t`?(t.quadraticCurveTo(e,i,n.x+a.x,n.y+a.y),n.add(a)):(t.quadraticCurveTo(e,i,a.x,a.y),n.copyFrom(a))}else if(a.type===`a`||a.type===`A`){let e=n.clone();if(a.type===`a`){if(a.x===0&&a.y===0)continue;n.add(a)}else{if(n.equals(a))continue;n.copyFrom(a)}r.copyFrom(n),s(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,e,n)}else a.type===`z`||a.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,a)}}function f(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break;default:break}}return r.join(` `)}var p=/[a-df-z][^a-df-z]*/gi;function m(e){let t=[],n=e.match(p);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=l(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=l(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=l(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=l(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=l(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=l(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=l(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=l(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=l(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var h=`data:image/svg+xml;`,g=`${h}base64,`,_=`${h}charset=utf8,`;function v(e){if(typeof e==`string`){let t;e.startsWith(g)?(e=e.substring(g.length,e.length),t=atob(e)):e.startsWith(_)?(e=e.substring(_.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}\n${t}`);return n.documentElement}else return e}var y=`px`,b=90,x=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],S={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function C(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=x.length;n<r;n++){let r=x[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return t===`px`&&y!==`px`?n=S.in[y]/b:(n=S[t][y],n<0&&(n=S[t].in*b)),n*Number.parseFloat(e)}function w(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=T(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function T(e){let t=new R;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(C(e.getAttribute(`x`)),C(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.appendCssTransform(e.getAttribute(`transform`)),t}function E(e){return new $().arc(C(e.getAttribute(`cx`)||0),C(e.getAttribute(`cy`)||0),C(e.getAttribute(`r`)||0),0,Math.PI*2)}function D(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function O(e){return new $().ellipse(C(e.getAttribute(`cx`)||0),C(e.getAttribute(`cy`)||0),C(e.getAttribute(`rx`)||0),C(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function k(e){return new $().moveTo(C(e.getAttribute(`x1`)||0),C(e.getAttribute(`y1`)||0)).lineTo(C(e.getAttribute(`x2`)||0),C(e.getAttribute(`y2`)||0))}function A(e){let t=new $,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var j=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function M(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(j,(e,r,i)=>{let a=C(r),o=C(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var N=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function P(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(N,(e,r,i)=>{let a=C(r),o=C(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function F(e){let t=C(e.getAttribute(`x`)||0),n=C(e.getAttribute(`y`)||0),r=C(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=C(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=C(e.getAttribute(`width`)),o=C(e.getAttribute(`height`)),s=.448084975506,c=new $;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function I(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,C(e)))}function s(e){return Math.max(0,C(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>C(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,C),i(`visibility`,`visibility`),t}function L(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=I(e,o,r);break;case`style`:D(e,r);break;case`g`:o=I(e,o,r);break;case`path`:o=I(e,o,r),e.hasAttribute(`d`)&&(a=A(e));break;case`rect`:o=I(e,o,r),a=F(e);break;case`polygon`:o=I(e,o,r),a=M(e);break;case`polyline`:o=I(e,o,r),a=P(e);break;case`circle`:o=I(e,o,r),a=E(e);break;case`ellipse`:o=I(e,o,r),a=O(e);break;case`line`:o=I(e,o,r),a=k(e);break;case`defs`:i=!0;break;case`use`:{o=I(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?L(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new R,c=[],l=w(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||L(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function ee(e){let t=v(e);return new At(L(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var te=Math.PI,ne=te*2,R=class e{_array;constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}_skewX;_skewY;_skewXTan=1;_skewYTan=1;skewX(e){return this.skew(e,0)}skewY(e){return this.skew(0,e)}skew(e,t){return e!==this._skewX&&(this._skewX=e,this._skewXTan=Math.tan(e)),t!==this._skewY&&(this._skewY=t,this._skewYTan=Math.tan(t)),this.b*=this._skewXTan,this.c*=this._skewYTan,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/ne;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=-Math.atan2(-i,a),l=Math.atan2(r,n),u=Math.abs(c+l);return u<1e-5||Math.abs(ne-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=l),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new i;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new i;let{a:n,b:r,c:a,d:o,tx:s,ty:c}=this,l=1/(n*o+a*-r),u=e.x,d=e.y;return t.x=o*l*u+-a*l*d+(c*a-s*o)*l,t.y=n*l*d+-r*l*u+(-c*n+s*r)*l,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}appendCssTransform(t){let n=t.split(`)`),r=new e;for(let e=n.length-1;e>=0;e--){let t=n[e].trim();if(t===``)continue;let i=t.indexOf(`(`),a=t.length;if(i>0&&i<a){let e=t.slice(0,i),n=l(t.slice(i+1));switch(r.identity(),e){case`translateX`:r.translateX(n[0]);break;case`translateY`:r.translateY(n[0]);break;case`translateZ`:r.translateZ(n[0]);break;case`translate`:r.translate(n[0],n[1]??n[0]);break;case`translate3d`:r.translate3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`scaleX`:r.scaleX(n[0]);break;case`scaleY`:r.scaleY(n[0]);break;case`scale`:r.scale(n[0],n[1]??n[0]);break;case`scale3d`:r.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotate`:{let e=n[0]*Math.PI/180;if(n.length>=3){let t=n[1],i=n[2];r.translate(-t,-i).rotate(e).translate(t,i)}else r.rotate(e);break}case`rotateX`:r.rotateX(n[0]*Math.PI/180);break;case`rotateY`:r.rotateY(n[0]*Math.PI/180);break;case`rotateZ`:r.rotateZ(n[0]*Math.PI/180);break;case`rotate3d`:r.rotate3d(n[0]*Math.PI/180,(n[1]??n[0])*Math.PI/180,(n[2]??n[1]??n[0])*Math.PI/180,(n[3]??n[2]??n[1]??n[0])*Math.PI/180);break;case`skewX`:r.set(1,0,Math.tan(n[0]*Math.PI/180),1,0,0);break;case`skewY`:r.set(1,Math.tan(n[0]*Math.PI/180),0,1,0,0);break;case`skew`:{let e=n[0],t=n[1]??0;r.set(1,Math.tan(t*Math.PI/180),Math.tan(e*Math.PI/180),1,0,0);break}case`matrix`:r.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}this.prepend(r)}return this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}destroy(){this._array=void 0}};function re(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function ie(e,t){let n=1-e;return n*n*n*t}function ae(e,t){let n=1-e;return 3*n*n*e*t}function oe(e,t){return 3*(1-e)*e*e*t}function se(e,t){return e*e*e*t}function ce(e,t,n,r,i){return ie(e,t)+ae(e,n)+oe(e,r)+se(e,i)}function le(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=ue(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=he(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return B(a,o,n,s,c,l,0),o}function ue(e,t,n,r,i){let a;if(i===Pe(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Me(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Me(i/r|0,e[i],e[i+1],a);return a&&U(a,a.next)&&(G(a),a=a.next),a}function z(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(U(n,n.next)||H(n.prev,n,n.next)===0)){if(G(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function B(e,t,n,r,i,a,o){if(!e)return;!o&&a&&be(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?fe(e,r,i,a):de(e)){t.push(c.i,e.i,l.i),G(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=pe(z(e),t),B(e,t,n,r,i,a,2)):o===2&&me(e,t,n,r,i,a):B(z(e),t,n,r,i,a,1);break}}}function de(e){let t=e.prev,n=e,r=e.next;if(H(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&V(i,s,a,c,o,l,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function fe(e,t,n,r){let i=e.prev,a=e,o=e.next;if(H(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Se(p,m,t,n,r),v=Se(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&V(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&V(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&V(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&V(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function pe(e,t){let n=e;do{let r=n.prev,i=n.next.next;!U(r,i)&&Ee(r,n,n.next,i)&&W(r,i)&&W(i,r)&&(t.push(r.i,n.i,i.i),G(n),G(n.next),n=e=i),n=n.next}while(n!==e);return z(n)}function me(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Te(o,e)){let s=je(o,e);o=z(o,o.next),s=z(s,s.next),B(o,t,n,r,i,a,0),B(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function he(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=ue(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Ce(o))}i.sort(ge);for(let e=0;e<i.length;e++)n=_e(i[e],n);return n}function ge(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function _e(e,t){let n=ve(e,t);if(!n)return t;let r=je(n,e);return z(r,r.next),z(n,n.next)}function ve(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(U(e,n))return n;do{if(U(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&we(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);W(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&ye(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ye(e,t){return H(e.prev,e,t.prev)<0&&H(t.next,e,e.next)<0}function be(e,t,n,r){let i=e;do i.z===0&&(i.z=Se(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,xe(i)}function xe(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function Se(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Ce(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function we(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function V(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&we(e,t,n,r,i,a,o,s)}function Te(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ke(e,t)&&(W(e,t)&&W(t,e)&&Ae(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||U(e,t)&&H(e.prev,e,e.next)>0&&H(t.prev,t,t.next)>0)}function H(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function U(e,t){return e.x===t.x&&e.y===t.y}function Ee(e,t,n,r){let i=Oe(H(e,t,n)),a=Oe(H(e,t,r)),o=Oe(H(n,r,e)),s=Oe(H(n,r,t));return!!(i!==a&&o!==s||i===0&&De(e,n,t)||a===0&&De(e,r,t)||o===0&&De(n,e,r)||s===0&&De(n,t,r))}function De(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Oe(e){return e>0?1:e<0?-1:0}function ke(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ee(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function W(e,t){return H(e.prev,e,e.next)<0?H(e,t,e.next)>=0&&H(e,e.prev,t)>=0:H(e,t,e.prev)<0||H(e,e.next,t)<0}function Ae(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function je(e,t){let n=Ne(e.i,e.x,e.y),r=Ne(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Me(e,t,n,r){let i=Ne(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function G(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ne(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pe(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Fe(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=le(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var Ie=8,Le=1.1920929e-7,Re=1,ze=.01,K=0,q=0;function Be(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(Re-Math.min(.99,Math.max(0,c)))/1;return u*=u,Ve(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function Ve(e,t,n,r,i,a,o,s,c,l,u){if(u>Ie)return;let d=Math.PI,f=(e+n)/2,p=(t+r)/2,m=(n+i)/2,h=(r+a)/2,g=(i+o)/2,_=(a+s)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(h+_)/2,S=(v+b)/2,C=(y+x)/2;if(u>0){let u=o-e,f=s-t,p=Math.abs((n-o)*f-(r-s)*u),m=Math.abs((i-o)*f-(a-s)*u),h,g;if(p>Le&&m>Le){if((p+m)*(p+m)<=l*(u*u+f*f)){if(K<ze){c.push(S,C);return}let l=Math.atan2(a-r,i-n);if(h=Math.abs(l-Math.atan2(r-t,n-e)),g=Math.abs(Math.atan2(s-a,o-i)-l),h>=d&&(h=2*d-h),g>=d&&(g=2*d-g),h+g<K){c.push(S,C);return}if(q!==0){if(h>q){c.push(n,r);return}if(g>q){c.push(i,a);return}}}}else if(p>Le){if(p*p<=l*(u*u+f*f)){if(K<ze){c.push(S,C);return}if(h=Math.abs(Math.atan2(a-r,i-n)-Math.atan2(r-t,n-e)),h>=d&&(h=2*d-h),h<K){c.push(n,r),c.push(i,a);return}if(q!==0&&h>q){c.push(n,r);return}}}else if(m>Le){if(m*m<=l*(u*u+f*f)){if(K<ze){c.push(S,C);return}if(h=Math.abs(Math.atan2(s-a,o-i)-Math.atan2(a-r,i-n)),h>=d&&(h=2*d-h),h<K){c.push(n,r),c.push(i,a);return}if(q!==0&&h>q){c.push(i,a);return}}}else if(u=S-(e+o)/2,f=C-(t+s)/2,u*u+f*f<=l){c.push(S,C);return}}Ve(e,t,f,p,v,y,S,C,c,l,u+1),Ve(S,C,b,x,g,_,o,s,c,l,u+1)}var He=8,Ue=1.1920929e-7,We=1,Ge=.01,Ke=0;function qe(e,t,n,r,i,a,o=.5,s=[]){let c=(We-Math.min(.99,Math.max(0,o)))/1;return c*=c,Je(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function Je(e,t,n,r,i,a,o,s,c){if(c>He)return;let l=Math.PI,u=(t+r)/2,d=(n+i)/2,f=(r+a)/2,p=(i+o)/2,m=(u+f)/2,h=(d+p)/2,g=a-t,_=o-n,v=Math.abs((r-a)*_-(i-o)*g);if(v>Ue){if(v*v<=s*(g*g+_*_)){if(Ke<Ge){e.push(m,h);return}let s=Math.abs(Math.atan2(o-i,a-r)-Math.atan2(i-n,r-t));if(s>=l&&(s=2*l-s),s<Ke){e.push(m,h);return}}}else if(g=m-(t+a)/2,_=h-(n+o)/2,g*g+_*_<=s){e.push(m,h);return}Je(e,t,n,u,d,m,h,s,c+1),Je(e,m,h,f,p,a,o,s,c+1)}function Ye(e){let t=0,n=e.length;for(let r=0;r<n;r+=2){let i=e[r],a=e[r+1],o=e[(r+2)%(n-1)],s=e[(r+3)%n];t+=i*s-o*a}return t/2}function Xe(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function Ze(e,t,n,r){let a=t.clone().sub(e),o=r.clone().sub(n),s=n.clone().sub(e),c=a.cross(o);if(c===0)return new i((e.x+n.x)/2,(e.y+n.y)/2);let l=s.cross(o)/c;return Math.abs(l)>1?new i((e.x+n.x)/2,(e.y+n.y)/2):new i(e.x+l*a.x,e.y+l*a.y)}function Qe(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function $e(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&Qe(c,l,r,s,e,t)>0&&i++:l<=t&&Qe(c,l,r,s,e,t)<0&&i--}return i}function et(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function tt(e){let t=e.map((e,t)=>({index:t})),n=e.map(e=>{let t=e.length;if(!t)return[];let n=[2**53-1,0],r=[0,2**53-1],i=[-(2**53-1),0],a=[0,-(2**53-1)];for(let o=0;o<t;o+=2){let t=e[o],s=e[o+1];n[0]>t&&(n=[t,s]),r[1]>s&&(r=[t,s]),i[0]<t&&(i=[t,s]),a[1]<s&&(a=[t,s])}let o=[(n[0]+i[0])/2,(r[1]+a[1])/2],s,c,l,u,d,f,p,m;for(let n=0;n<t;n+=2){let t=e[n],r=e[n+1],i=Math.abs(t-o[0]),a=Math.abs(r-o[1]);r<o[1]&&(!s||i<s)&&(s=i,l=[t,r]),r>o[1]&&(!c||i<c)&&(c=i,u=[t,r]),t<o[0]&&(!d||a<d)&&(d=a,p=[t,r]),t>o[0]&&(!f||a<f)&&(f=a,m=[t,r])}return[n,r,i,a,l,u,p,m].filter(Boolean)});for(let r=0,i=e.length;r<i;r++){let a=[],o=n[r];for(let t=0;t<i;t++){if(r===t)continue;let i={},s=[];for(let n=0,r=o.length;n<r;n++){let[r,a]=o[n],c=$e(r,a,e[t]);i[c]=(i[c]??0)+1,s.push(c)}s.filter(e=>e!==0).length>s.filter(e=>e===0).length&&a.push({index:r,parentIndex:t,winding:Number(Array.from(Object.entries(i)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:et(n[r][0],n[t][0])})}a.reduce((e,t)=>e+t.winding,0)!==0&&(a.sort((e,t)=>e.dist-t.dist),t[r]=a[0])}return t}function nt(e,t){let n=1-e;return n*n*t}function rt(e,t){return 2*(1-e)*e*t}function it(e,t){return e*e*t}function at(e,t,n,r){return nt(e,t)+rt(e,n)+it(e,r)}var ot=1e-4,st=1e-4;function ct(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=ot;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=lt(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=J(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=ut(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=J(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,L=Math.min(n*n+r*r,i*i+a*a),ee=l?N:P;h<=L+ee*ee*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=J(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=J(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=J(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=J(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=J(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=ut(C,w,D,O,N,P,!1,m)));let F=st*st;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function lt(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function ut(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function J(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var Y=class{arcLengthDivision=200;_lengths=[];getPointAt(e,t=new i){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this}getUnevenVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],a=e[n+1];t.push(new i(r,a))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new i){let n=1e-4,r=Math.max(0,e-n),a=Math.min(1,e+n);return t.copyFrom(this.getPoint(a).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new i){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=i.MAX,t=i.MIN){let n=this.getPoints();for(let r=0,i=n.length;r<i;r++){let i=n[r];e.clampMin(i),t.clampMax(i)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return Fe(this.getFillVertices(e),e)}strokeTriangulate(e){return ct(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return f(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},dt=new R,ft=new R,pt=new R,X=new i,mt=class extends Y{get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}constructor(e=new i,t=new i,n=new i,r=0,a=0,o=Math.PI*2,s=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=a,this.endAngle=o,this.clockwise=s}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new i){let n=this._getDeltaAngle(),r=this.startAngle+e*n,a=this.cx+this.rx*Math.cos(r),o=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=a-this.cx,r=o-this.cy;a=n*e-r*t+this.cx,o=n*t+r*e+this.cy}return t.set(a,o)}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return X.set(this.cx,this.cy),e.apply(X,X),this.cx=X.x,this.cy=X.y,vt(e)?ht(this,e):gt(this,e),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function ht(e,t){let n=e.rx,r=e.ry,a=Math.cos(e.rotate),o=Math.sin(e.rotate),s=new i(n*a,n*o),c=new i(-r*o,r*a),l=t.a*s.x+t.c*s.y,u=t.b*s.x+t.d*s.y,d=t.a*c.x+t.c*c.y,f=t.b*c.x+t.d*c.y,p=dt.set(l,u,d,f,0,0),{a:m,b:h,c:g,d:_}=ft.copyFrom(p).affineInvert(),v=yt(m*m+h*h,g*m+_*h,g*g+_*_),y=Math.sqrt(v.rt1),b=Math.sqrt(v.rt2);if(e.rx=1/y,e.ry=1/b,e.rotate=Math.atan2(v.sn,v.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=ft.set(y,0,0,b,0,0),r=pt.set(v.cs,v.sn,-v.sn,v.cs,0,0),i=n.append(r).append(p),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),_t(t)&&(e.clockwise=!e.clockwise)}}function gt(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,_t(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function _t(e){return e.a*e.d-e.c*e.b<0}function vt(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function yt(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var bt=class extends mt{constructor(e=0,t=0,n=1,r=0,a=Math.PI*2,o=!1){super(new i(e,t),new i(n,n),new i,0,r,a,o)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},Z=class e extends Y{static from(t,n,r,a){return new e(new i(t,n),new i(r,a))}constructor(e=new i,t=new i){super(),this.p1=e,this.p2=t}getPoint(e,t=new i){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new i){return this.getPoint(e,t)}getTangent(e,t=new i){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new i){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},xt=class e extends Y{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new i){let n=e*this.getLength(),r=this.getLengths(),a=0;for(;a<r.length;){if(r[a]>=n){let e=r[a]-n,i=this.curves[a],o=i.getLength();return i.getPointAt(o===0?0:1-e/o,t)}a++}return t}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof Z?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=i.MAX,t=i.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},St=class e extends Y{static from(t,n,r,a,o,s,c,l){return new e(new i(t,n),new i(r,a),new i(o,s),new i(c,l))}constructor(e=new i,t=new i,n=new i,r=new i){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}getPoint(e,t=new i){let{p1:n,cp1:r,cp2:a,p2:o}=this;return t.set(ce(e,n.x,r.x,a.x,o.x),ce(e,n.y,r.y,a.y,o.y))}getAdaptiveVertices(e=[]){return Be(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp1:r,cp2:a,p2:o}=this,s=this._solveQuadratic(3*(r.x-n.x),6*(a.x-r.x),3*(o.x-a.x)),c=this._solveQuadratic(3*(r.y-n.y),6*(a.y-r.y),3*(o.y-a.y));return((n,r)=>{for(let i of n)for(let n=0;n<=r;n++){let a=n/r-.5,o=Math.min(1,Math.max(0,i+a)),s=this.getPoint(o);e.x=Math.min(e.x,s.x),e.y=Math.min(e.y,s.y),t.x=Math.max(t.x,s.x),t.y=Math.max(t.y,s.y)}})([0,1,...s,...c],10),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Ct=class extends mt{constructor(e=0,t=0,n=1,r=1,a=0,o=0,s=Math.PI*2,c=!1){super(new i(e,t),new i(n,r),new i,a,o,s,c)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},wt=class extends xt{},Tt=class extends wt{constructor(e=0,t=0,n=1,r=3){super(),this.cx=e,this.cy=t,this.radius=n,this.sideCount=r,this.update()}update(){let{cx:e,cy:t,radius:n,sideCount:r}=this,a=[];for(let o=0;o<r;o++){let s=o*2*Math.PI/r-.5*Math.PI;a.push(new i(n*Math.cos(s),n*Math.sin(s)).add({x:e,y:t}))}let o=[];for(let e=0;e<r;e++)o.push(new Z(a[e],a[(e+1)%r]));return this.curves=o,this}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.radius=e.radius,this.sideCount=e.sideCount,this.update(),this}},Et=class e extends Y{static from(t,n,r,a,o,s){return new e(new i(t,n),new i(r,a),new i(o,s))}constructor(e=new i,t=new i,n=new i){super(),this.p1=e,this.cp=t,this.p2=n}getPoint(e,t=new i){let{p1:n,cp:r,p2:a}=this;return t.set(at(e,n.x,r.x,a.x),at(e,n.y,r.y,a.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return qe(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp:r,p2:a}=this,o=.5*(n.x+r.x),s=.5*(n.y+r.y),c=.5*(n.x+a.x),l=.5*(n.y+a.y);return e.x=Math.min(e.x,n.x,a.x,o,c),e.y=Math.min(e.y,n.y,a.y,s,l),t.x=Math.max(t.x,n.x,a.x,o,c),t.y=Math.max(t.y,n.y,a.y,s,l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Dt=class extends wt{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,a=[new i(e,t),new i(e+n,t),new i(e+n,t+r),new i(e,t+r)];return this.curves=[new Z(a[0],a[1]),new Z(a[1],a[2]),new Z(a[2],a[3]),new Z(a[3],a[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},Ot=class extends mt{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r,radius:a}=this,o=n/2,s=r/2,c=e+o,l=t+s,u=Math.max(0,Math.min(a,Math.min(o,s))),d=u;return this._center=new i(c,l),this._radius=new i(u,d),this._diff=new i(o-u,s-d),this}drawTo(e){let{x:t,y:n,width:r,height:i,radius:a}=this;return e.roundRect(t,n,r,i,a),this}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},kt=class extends Y{constructor(e=[]){super(),this.points=e}getPoint(e,t=new i){let{points:n}=this,r=(n.length-1)*e,a=Math.floor(r),o=r-a,s=n[a===0?a:a-1],c=n[a],l=n[a>n.length-2?n.length-1:a+1],u=n[a>n.length-3?n.length-1:a+2];return t.set(re(o,s.x,c.x,l.x,u.x),re(o,s.y,c.y,l.y,u.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},Q=class extends xt{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return d(e,this),this}addData(e){return this.addCommands(m(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}_setCurrentPoint(e){return this.currentPoint=new i(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new Z(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new i(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(Z.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(St.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(Et.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new bt(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Ct(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Dt(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new Ot(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new i;return this.curves.push(new kt([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},$=class e extends xt{_meta;currentCurve=new Q;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new Q().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.currentPoint?.equals({x:e,y:t})||(this.currentCurve.curves.length&&(this.currentCurve=new Q,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t)),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new Q,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return d(e,this),this}addData(e){return this.addCommands(m(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(e,t)}),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=Ze(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this}getMinMax(e=i.MAX,t=i.MIN,n=!0){let r=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(e,t),n&&r>1){let n=r/2,a=i.isClockwise(),o=[];for(let e=0;e<=1;e+=1/i.arcLengthDivision){let t=i.getPoint(e),r=i.getNormal(e),s=r.clone().scale(a?n:-n),c=r.clone().scale(a?-n:n);o.push(t.clone().add(s),t.clone().add(c),t.clone().add({x:n,y:0}),t.clone().add({x:-n,y:0}),t.clone().add({x:0,y:n}),t.clone().add({x:0,y:-n}),t.clone().add({x:n,y:n}),t.clone().add({x:-n,y:-n}))}e.clampMin(...o),t.clampMax(...o)}}),{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=tt(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}Fe(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new a(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:i=`none`}=t;return e.beginPath(),e.save(),r(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),i!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,n={}){n={...this.style,...n};let{fill:i=`#000`,stroke:a=`none`}=n;return e.beginPath(),e.save(),r(e,n),this.getControlPointRefs().forEach(n=>{t(e,n.x,n.y,{radius:4})}),i!==`none`&&e.fill(),a!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[Xe(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},At=class{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;let t=i.MAX,n=i.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new a(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
|
|
2
|
+
points="${t.join(`,`)} ${r.join(`,`)} ${i.join(`,`)}"
|
|
4
3
|
stroke="#28a745"
|
|
5
4
|
stroke-width="#stroke-width"
|
|
6
5
|
fill="rgba(40, 167, 69, 0.15)"
|
|
7
6
|
onmouseover="this.style.fill='rgba(40, 167, 69, 0.5)'"
|
|
8
7
|
onmouseout="this.style.fill='rgba(40, 167, 69, 0.15)'"
|
|
9
|
-
/>`}for(let
|
|
10
|
-
cx="${
|
|
11
|
-
cy="${
|
|
8
|
+
/>`}for(let e=0,t=s.length;e<t;e+=2)r+=`<circle
|
|
9
|
+
cx="${s[e]}"
|
|
10
|
+
cy="${s[e+1]}"
|
|
12
11
|
r="#r"
|
|
13
12
|
fill="#dc3545"
|
|
14
|
-
/>`});
|
|
15
|
-
width="${
|
|
16
|
-
height="${
|
|
17
|
-
viewBox="${
|
|
13
|
+
/>`});let o=[i.x,i.y,a.x-i.x,a.y-i.y],s=Math.max(o[2],o[3])*.001;return`<svg
|
|
14
|
+
width="${o[2]}"
|
|
15
|
+
height="${o[3]}"
|
|
16
|
+
viewBox="${o.join(` `)}"
|
|
18
17
|
xmlns="http://www.w3.org/2000/svg"
|
|
19
18
|
>
|
|
20
|
-
${
|
|
21
|
-
${r.replace(/#r/g,String(
|
|
22
|
-
</svg>`}toTriangulatedSvg(t
|
|
23
|
-
viewBox="${
|
|
24
|
-
width="${
|
|
19
|
+
${n.replace(/#stroke-width/g,String(s))}
|
|
20
|
+
${r.replace(/#r/g,String(s))}
|
|
21
|
+
</svg>`}toTriangulatedSvg(e,t){return new DOMParser().parseFromString(this.toTriangulatedSvgString(e,t),`image/svg+xml`).documentElement}toSvgString(){let{x:e,y:t,width:n,height:r}=this.getBoundingBox();return`<svg
|
|
22
|
+
viewBox="${e} ${t} ${n} ${r}"
|
|
23
|
+
width="${n}px"
|
|
25
24
|
height="${r}px"
|
|
26
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
27
26
|
>
|
|
28
|
-
${
|
|
29
|
-
</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString()
|
|
27
|
+
${this.paths.map(e=>e.toSvgPathString()).join(``)}
|
|
28
|
+
</svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),`image/svg+xml`).documentElement}toCanvas(e={}){let{pixelRatio:t=2,...n}=e,{left:r,top:i,width:a,height:o}=this.getBoundingBox(),s=document.createElement(`canvas`);s.width=a*t,s.height=o*t,s.style.width=`${a}px`,s.style.height=`${o}px`;let c=s.getContext(`2d`);return c&&(c.scale(t,t),c.translate(-r,-i),this.paths.forEach(e=>{e.drawTo(c,n)})),s}},jt=class{controlPoints=[];constructor(e,t,n=1,r=1){this.rows=e,this.cols=t,this.width=n,this.height=r;for(let i=0;i<e;i++){this.controlPoints[i]=[];for(let a=0;a<t;a++)this.controlPoints[i][a]={x:a/(t-1)*n,y:i/(e-1)*r}}}moveControlPoint(e,t,n,r){return this.controlPoints[e][t].x+=n,this.controlPoints[e][t].y+=r,this}};function Mt(e){let t=[];return t[0]=(1-e)**3/6,t[1]=(3*e**3-6*e**2+4)/6,t[2]=(-3*e**3+3*e**2+3*e+1)/6,t[3]=e**3/6,t}function Nt(e,t,n=t.width,r=t.height){let i=e.x/n*(t.cols-1),a=e.y/r*(t.rows-1),o=Math.floor(i),s=Math.floor(a),c=i-o,l=a-s,u=Mt(c),d=Mt(l),f=0,p=0;for(let e=0;e<4;e++)for(let n=0;n<4;n++){let r=Math.min(Math.max(s-1+e,0),t.rows-1),i=Math.min(Math.max(o-1+n,0),t.cols-1),a=t.controlPoints[r][i],c=u[n]*d[e];f+=a.x*c,p+=a.y*c}e.set(f,p)}e.ArcCurve=bt,e.BoundingBox=a,e.CompositeCurve=xt,e.CubicBezierCurve=St,e.Curve=Y,e.CurvePath=Q,e.EllipseCurve=Ct,e.EquilateralPloygonCurve=Tt,e.FFDControlGrid=jt,e.LineCurve=Z,e.PI=te,e.PI_2=ne,e.Path2D=$,e.Path2DSet=At,e.PloygonCurve=wt,e.QuadraticBezierCurve=Et,e.RectangleCurve=Dt,e.RoundRectangleCurve=Ot,e.SplineCurve=kt,e.Transform2D=R,e.Vector2=i,e.applyFFD=Nt,e.catmullRom=re,e.cubicBezier=ce,e.drawPoint=t,e.fillTriangulate=Fe,e.getAdaptiveCubicBezierCurvePoints=Be,e.getAdaptiveQuadraticBezierCurvePoints=qe,e.getDirectedArea=Ye,e.getIntersectionPoint=Ze,e.nonzeroFillRule=tt,e.parseArcCommand=s,e.parsePathDataArgs=l,e.quadraticBezier=at,e.setCanvasContext=r,e.strokeTriangulate=ct,e.svgPathCommandsAddToPath2D=d,e.svgPathCommandsToData=f,e.svgPathDataToCommands=m,e.svgToDom=v,e.svgToPath2DSet=ee,e.toKebabCase=Xe});
|