modern-path2d 1.0.0 → 1.1.0
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/README.md +6 -4
- package/dist/index.cjs +1517 -900
- package/dist/index.d.cts +253 -254
- package/dist/index.d.mts +253 -254
- package/dist/index.d.ts +253 -254
- package/dist/index.js +2 -2
- package/dist/index.mjs +1499 -890
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(p,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(p=typeof globalThis<"u"?globalThis:p||self,C(p.modernPath2d={}))})(this,function(p){"use strict";var ie=Object.defineProperty;var re=(p,C,q)=>C in p?ie(p,C,{enumerable:!0,configurable:!0,writable:!0,value:q}):p[C]=q;var T=(p,C,q)=>re(p,typeof C!="symbol"?C+"":C,q);const C={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function q(o,e){const{fill:t="#000",stroke:s="none",strokeWidth:i=s==="none"?0:1,strokeLinecap:r="round",strokeLinejoin:n="miter",strokeMiterlimit:c=0,strokeDasharray:a=[],strokeDashoffset:h=0,shadowOffsetX:l=0,shadowOffsetY:y=0,shadowBlur:f=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;o.fillStyle=t,o.strokeStyle=s,o.lineWidth=i,o.lineCap=r,o.lineJoin=C[n],o.miterLimit=c,o.setLineDash(a),o.lineDashOffset=h,o.shadowOffsetX=l,o.shadowOffsetY=y,o.shadowBlur=f,o.shadowColor=d}class u{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new u(1/0,1/0)}static get MIN(){return new u(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const s=-e/180*Math.PI,i=this.x-t.x,r=-(this.y-t.y),n=Math.sin(s),c=Math.cos(s);return this.set(t.x+(i*c-r*n),t.y-(i*n+r*c)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,s={x:0,y:0}){const i=e<0?s.x-this.x+s.x:this.x,r=t<0?s.y-this.y+s.y:this.y;return this.x=i*Math.abs(e),this.y=r*Math.abs(t),this}skew(e,t=0,s={x:0,y:0}){const i=this.x-s.x,r=this.y-s.y;return this.x=s.x+(i+Math.tan(e)*r),this.y=s.y+(r+Math.tan(t)*i),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,s=this.y,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6],this.y=i[1]*t+i[4]*s+i[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new u(this.x,this.y)}}class L{constructor(e=0,t=0,s=0,i=0){this.left=e,this.top=t,this.width=s,this.height=i}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 u((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new L;if(e.length===1)return e[0].clone();const t=e[0],s=e.slice(1).reduce((i,r)=>(i.left=Math.min(i.left,r.left),i.top=Math.min(i.top,r.top),i.right=Math.max(i.right,r.right),i.bottom=Math.max(i.bottom,r.bottom),i),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new L(s.left,s.top,s.right-s.left,s.bottom-s.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 L(this.left,this.top,this.width,this.height)}}class v{constructor(e=1,t=0,s=0,i=0,r=1,n=0,c=0,a=0,h=1){T(this,"elements",[]);this.set(e,t,s,i,r,n,c,a,h)}set(e,t,s,i,r,n,c,a,h){const l=this.elements;return l[0]=e,l[1]=i,l[2]=c,l[3]=t,l[4]=r,l[5]=a,l[6]=s,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,i=t.elements,r=this.elements,n=s[0],c=s[3],a=s[6],h=s[1],l=s[4],y=s[7],f=s[2],d=s[5],g=s[8],x=i[0],m=i[3],w=i[6],E=i[1],b=i[4],S=i[7],$=i[2],z=i[5],D=i[8];return r[0]=n*x+c*E+a*$,r[3]=n*m+c*b+a*z,r[6]=n*w+c*S+a*D,r[1]=h*x+l*E+y*$,r[4]=h*m+l*b+y*z,r[7]=h*w+l*S+y*D,r[2]=f*x+d*E+g*$,r[5]=f*m+d*b+g*z,r[8]=f*w+d*S+g*D,this}invert(){const e=this.elements,t=e[0],s=e[1],i=e[2],r=e[3],n=e[4],c=e[5],a=e[6],h=e[7],l=e[8],y=l*n-c*h,f=c*a-l*r,d=h*r-n*a,g=t*y+s*f+i*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/g;return e[0]=y*x,e[1]=(i*h-l*s)*x,e[2]=(c*s-i*n)*x,e[3]=f*x,e[4]=(l*t-i*a)*x,e[5]=(i*r-c*t)*x,e[6]=d*x,e[7]=(s*a-h*t)*x,e[8]=(n*t-s*r)*x,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(B.makeScale(e,t)),this}rotate(e){return this.premultiply(B.makeRotation(-e)),this}translate(e,t){return this.premultiply(B.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const B=new v;function Z(o,e,t,s){const i=o*t+e*s,r=Math.sqrt(o*o+e*e)*Math.sqrt(t*t+s*s);let n=Math.acos(Math.max(-1,Math.min(1,i/r)));return o*s-e*t<0&&(n=-n),n}function J(o,e,t,s,i,r,n,c){if(e===0||t===0){o.lineTo(c.x,c.y);return}s=s*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const a=(n.x-c.x)/2,h=(n.y-c.y)/2,l=Math.cos(s)*a+Math.sin(s)*h,y=-Math.sin(s)*a+Math.cos(s)*h;let f=e*e,d=t*t;const g=l*l,x=y*y,m=g/f+x/d;if(m>1){const wt=Math.sqrt(m);e=wt*e,t=wt*t,f=e*e,d=t*t}const w=f*x+d*g,E=(f*d-w)/w;let b=Math.sqrt(Math.max(0,E));i===r&&(b=-b);const S=b*e*y/t,$=-b*t*l/e,z=Math.cos(s)*S-Math.sin(s)*$+(n.x+c.x)/2,D=Math.sin(s)*S+Math.cos(s)*$+(n.y+c.y)/2,_=Z(1,0,(l-S)/e,(y-$)/t),H=Z((l-S)/e,(y-$)/t,(-l-S)/e,(-y-$)/t)%(Math.PI*2);o.ellipse(z,D,e,t,s,_,_+H,r===0)}function X(o,e){return o-(e-o)}function U(o,e){const t=new u,s=new u;for(let i=0,r=o.length;i<r;i++){const n=o[i];if(n.type==="m"||n.type==="M")n.type==="m"?t.add(n):t.copy(n),e.moveTo(t.x,t.y),s.copy(t);else if(n.type==="h"||n.type==="H")n.type==="h"?t.x+=n.x:t.x=n.x,e.lineTo(t.x,t.y),s.copy(t);else if(n.type==="v"||n.type==="V")n.type==="v"?t.y+=n.y:t.y=n.y,e.lineTo(t.x,t.y),s.copy(t);else if(n.type==="l"||n.type==="L")n.type==="l"?t.add(n):t.copy(n),e.lineTo(t.x,t.y),s.copy(t);else if(n.type==="c"||n.type==="C")n.type==="c"?(e.bezierCurveTo(t.x+n.x1,t.y+n.y1,t.x+n.x2,t.y+n.y2,t.x+n.x,t.y+n.y),s.x=t.x+n.x2,s.y=t.y+n.y2,t.add(n)):(e.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y),s.x=n.x2,s.y=n.y2,t.copy(n));else if(n.type==="s"||n.type==="S")n.type==="s"?(e.bezierCurveTo(X(t.x,s.x),X(t.y,s.y),t.x+n.x2,t.y+n.y2,t.x+n.x,t.y+n.y),s.x=t.x+n.x2,s.y=t.y+n.y2,t.add(n)):(e.bezierCurveTo(X(t.x,s.x),X(t.y,s.y),n.x2,n.y2,n.x,n.y),s.x=n.x2,s.y=n.y2,t.copy(n));else if(n.type==="q"||n.type==="Q")n.type==="q"?(e.quadraticCurveTo(t.x+n.x1,t.y+n.y1,t.x+n.x,t.y+n.y),s.x=t.x+n.x1,s.y=t.y+n.y1,t.add(n)):(e.quadraticCurveTo(n.x1,n.y1,n.x,n.y),s.x=n.x1,s.y=n.y1,t.copy(n));else if(n.type==="t"||n.type==="T"){const c=X(t.x,s.x),a=X(t.y,s.y);s.x=c,s.y=a,n.type==="t"?(e.quadraticCurveTo(c,a,t.x+n.x,t.y+n.y),t.add(n)):(e.quadraticCurveTo(c,a,n.x,n.y),t.copy(n))}else if(n.type==="a"||n.type==="A"){const c=t.clone();if(n.type==="a"){if(n.x===0&&n.y===0)continue;t.add(n)}else{if(t.equals(n))continue;t.copy(n)}s.copy(t),J(e,n.rx,n.ry,n.angle,n.largeArcFlag,n.sweepFlag,c,t)}else n.type==="z"||n.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",n)}}const P={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function A(o,e,t=0){let c=0,a=!0,h="",l="";const y=[];function f(m,w,E){const b=new SyntaxError(`Unexpected character "${m}" at index ${w}.`);throw b.partial=E,b}function d(){h!==""&&(l===""?y.push(Number(h)):y.push(Number(h)*10**Number(l))),h="",l=""}let g;const x=o.length;for(let m=0;m<x;m++){if(g=o[m],Array.isArray(e)&&e.includes(y.length%t)&&P.FLAGS.test(g)){c=1,h=g,d();continue}if(c===0){if(P.WHITESPACE.test(g))continue;if(P.DIGIT.test(g)||P.SIGN.test(g)){c=1,h=g;continue}if(P.POINT.test(g)){c=2,h=g;continue}P.COMMA.test(g)&&(a&&f(g,m,y),a=!0)}if(c===1){if(P.DIGIT.test(g)){h+=g;continue}if(P.POINT.test(g)){h+=g,c=2;continue}if(P.EXP.test(g)){c=3;continue}P.SIGN.test(g)&&h.length===1&&P.SIGN.test(h[0])&&f(g,m,y)}if(c===2){if(P.DIGIT.test(g)){h+=g;continue}if(P.EXP.test(g)){c=3;continue}P.POINT.test(g)&&h[h.length-1]==="."&&f(g,m,y)}if(c===3){if(P.DIGIT.test(g)){l+=g;continue}if(P.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&P.SIGN.test(l)&&f(g,m,y)}}P.WHITESPACE.test(g)?(d(),c=0,a=!1):P.COMMA.test(g)?(d(),c=0,a=!0):P.SIGN.test(g)?(d(),c=1,h=g):P.POINT.test(g)?(d(),c=2,h=g):f(g,m,y)}return d(),y}function K(o){let e,t;const s=[];for(let i=0,r=o.length;i<r;i++){const n=o[i];switch(n.type){case"m":case"M":if(n.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&n.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;s.push(`${n.type} ${n.x} ${n.y}`),t={x:n.x,y:n.y},e={x:n.x,y:n.y};break;case"h":case"H":s.push(`${n.type} ${n.x}`),t={x:n.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":s.push(`${n.type} ${n.y}`),t={x:(t==null?void 0:t.x)??0,y:n.y};break;case"l":case"L":s.push(`${n.type} ${n.x} ${n.y}`),t={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}`),t={x:n.x,y:n.y};break;case"s":case"S":s.push(`${n.type} ${n.x2} ${n.y2} ${n.x} ${n.y}`),t={x:n.x,y:n.y};break;case"q":case"Q":s.push(`${n.type} ${n.x1} ${n.y1} ${n.x} ${n.y}`),t={x:n.x,y:n.y};break;case"t":case"T":s.push(`${n.type} ${n.x} ${n.y}`),t={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}`),t={x:n.x,y:n.y};break;case"z":case"Z":s.push(n.type),e&&(t={x:e.x,y:e.y});break}}return s.join(" ")}const Tt=/[a-df-z][^a-df-z]*/gi;function W(o){const e=[],t=o.match(Tt);if(!t)return e;for(let s=0,i=t.length;s<i;s++){const r=t[s],n=r.charAt(0),c=r.slice(1).trim();let a;switch(n){case"m":case"M":a=A(c);for(let h=0,l=a.length;h<l;h+=2)h===0?e.push({type:n,x:a[h],y:a[h+1]}):e.push({type:n==="m"?"l":"L",x:a[h],y:a[h+1]});break;case"h":case"H":a=A(c);for(let h=0,l=a.length;h<l;h++)e.push({type:n,x:a[h]});break;case"v":case"V":a=A(c);for(let h=0,l=a.length;h<l;h++)e.push({type:n,y:a[h]});break;case"l":case"L":a=A(c);for(let h=0,l=a.length;h<l;h+=2)e.push({type:n,x:a[h],y:a[h+1]});break;case"c":case"C":a=A(c);for(let h=0,l=a.length;h<l;h+=6)e.push({type:n,x1:a[h],y1:a[h+1],x2:a[h+2],y2:a[h+3],x:a[h+4],y:a[h+5]});break;case"s":case"S":a=A(c);for(let h=0,l=a.length;h<l;h+=4)e.push({type:n,x2:a[h],y2:a[h+1],x:a[h+2],y:a[h+3]});break;case"q":case"Q":a=A(c);for(let h=0,l=a.length;h<l;h+=4)e.push({type:n,x1:a[h],y1:a[h+1],x:a[h+2],y:a[h+3]});break;case"t":case"T":a=A(c);for(let h=0,l=a.length;h<l;h+=2)e.push({type:n,x:a[h],y:a[h+1]});break;case"a":case"A":a=A(c,[3,4],7);for(let h=0,l=a.length;h<l;h+=7)e.push({type:n,rx:a[h],ry:a[h+1],angle:a[h+2],largeArcFlag:a[h+3],sweepFlag:a[h+4],x:a[h+5],y:a[h+6]});break;case"z":case"Z":e.push({type:n});break;default:console.warn(r)}}return e}class k{constructor(){T(this,"arcLengthDivisions",200);T(this,"_cacheArcLengths");T(this,"_needsUpdate",!1)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),s=this.getPoint(1);return(t.x-e.x)*(s.y-t.y)-(t.y-e.y)*(s.x-t.x)<0}getPointAt(e,t=new u){return this.getPoint(this.getUToTMapping(e),t)}getPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}forEachControlPoints(e){return this.getControlPoints().forEach(e),this}getSpacedPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPointAt(s/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const t=[];let s,i=this.getPoint(0),r=0;t.push(0);for(let n=1;n<=e;n++)s=this.getPoint(n/e),r+=s.distanceTo(i),t.push(r),i=s;return this._cacheArcLengths=t,t}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUToTMapping(e,t){const s=this.getLengths();let i=0;const r=s.length;let n;t?n=t:n=e*s[r-1];let c=0,a=r-1,h;for(;c<=a;)if(i=Math.floor(c+(a-c)/2),h=s[i]-n,h<0)c=i+1;else if(h>0)a=i-1;else{a=i;break}if(i=a,s[i]===n)return i/(r-1);const l=s[i],f=s[i+1]-l,d=(n-l)/f;return(i+d)/(r-1)}getTangent(e,t=new u){const i=Math.max(0,e-1e-4),r=Math.min(1,e+1e-4);return t.copy(this.getPoint(r).sub(this.getPoint(i)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new u){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 s=0,i=1,r=(s+i)/2;for(;i-s>t;){r=(s+i)/2;const n=this.getPoint(r);if(n.distanceTo(e)<t)return r;n.x<e.x?s=r:i=r}return r}matrix(e){return this.forEachControlPoints(t=>t.applyMatrix3(e)),this}getMinMax(e=u.MAX,t=u.MIN){return this.getPoints().forEach(s=>{e.min(s),t.max(s)}),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new L(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.getPoints().map((e,t)=>t===0?{type:"M",x:e.x,y:e.y}:{type:"L",x:e.x,y:e.y})}toData(){return K(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}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}class R extends k{constructor(e,t,s=0,i=Math.PI*2){super(),this.center=e,this.radius=t,this.start=s,this.end=i}getPoint(e){const{radius:t,center:s}=this;return s.clone().add(this.getNormal(e).clone().scale(t))}getTangent(e,t=new u){const{x:s,y:i}=this.getNormal(e);return t.set(-i,s)}getNormal(e,t=new u){const{start:s,end:i}=this,r=e*(i-s)+s-.5*Math.PI;return t.set(Math.cos(r),Math.sin(r))}getControlPoints(){return[this.center]}getMinMax(e=u.MAX,t=u.MIN){return e.x=Math.min(e.x,this.center.x-this.radius),e.y=Math.min(e.y,this.center.y-this.radius),t.x=Math.max(t.x,this.center.x+this.radius),t.y=Math.max(t.y,this.center.y+this.radius),{min:e,max:t}}}function tt(o,e,t,s,i){const r=(s-e)*.5,n=(i-t)*.5,c=o*o,a=o*c;return(2*t-2*s+r+n)*a+(-3*t+3*s-2*r-n)*c+r*o+t}function Ct(o,e){const t=1-o;return t*t*e}function bt(o,e){return 2*(1-o)*o*e}function vt(o,e){return o*o*e}function et(o,e,t,s){return Ct(o,e)+bt(o,t)+vt(o,s)}function At(o,e){const t=1-o;return t*t*t*e}function kt(o,e){const t=1-o;return 3*t*t*o*e}function It(o,e){return 3*(1-o)*o*o*e}function St(o,e){return o*o*o*e}function st(o,e,t,s,i){return At(o,e)+kt(o,t)+It(o,s)+St(o,i)}class nt extends k{constructor(e=new u,t=new u,s=new u,i=new u){super(),this.start=e,this.startControl=t,this.endControl=s,this.end=i}getPoint(e,t=new u){const{start:s,startControl:i,endControl:r,end:n}=this;return t.set(st(e,s.x,i.x,r.x,n.x),st(e,s.y,i.y,r.y,n.y))}getControlPoints(){return[this.start,this.startControl,this.endControl,this.end]}_solveQuadratic(e,t,s){const i=t*t-4*e*s;if(i<0)return[];const r=Math.sqrt(i),n=(-t+r)/(2*e),c=(-t-r)/(2*e);return[n,c].filter(a=>a>=0&&a<=1)}getMinMax(e=u.MAX,t=u.MIN){const s=this.start,i=this.startControl,r=this.endControl,n=this.end,c=this._solveQuadratic(3*(i.x-s.x),6*(r.x-i.x),3*(n.x-r.x)),a=this._solveQuadratic(3*(i.y-s.y),6*(r.y-i.y),3*(n.y-r.y)),h=[0,1,...c,...a];return((y,f)=>{for(const d of y)for(let g=0;g<=f;g++){const x=g/f-.5,m=Math.min(1,Math.max(0,d+x)),w=this.getPoint(m);e.x=Math.min(e.x,w.x),e.y=Math.min(e.y,w.y),t.x=Math.max(t.x,w.x),t.y=Math.max(t.y,w.y)}})(h,10),{min:e,max:t}}toCommands(){const{start:e,startControl:t,endControl:s,end:i}=this;return[{type:"M",x:e.x,y:e.y},{type:"C",x1:t.x,y1:t.y,x2:s.x,y2:s.y,x:i.x,y:i.y}]}drawTo(e){const{start:t,startControl:s,endControl:i,end:r}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(s.x,s.y,i.x,i.y,r.x,r.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.startControl.copy(e.startControl),this.endControl.copy(e.endControl),this.end.copy(e.end),this}}const $t=new v,it=new v,rt=new v,G=new u;class ot extends k{constructor(e=new u,t=1,s=1,i=0,r=0,n=Math.PI*2,c=!1){super(),this.center=e,this.radiusX=t,this.radiusY=s,this.rotation=i,this.startAngle=r,this.endAngle=n,this.clockwise=c}isClockwise(){return this.clockwise}getPoint(e,t=new u){const s=Math.PI*2;let i=this.endAngle-this.startAngle;const r=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=s;for(;i>s;)i-=s;i<Number.EPSILON&&(r?i=0:i=s),this.clockwise&&!r&&(i===s?i=-s:i=i-s);const n=this.startAngle+e*i;let c=this.center.x+this.radiusX*Math.cos(n),a=this.center.y+this.radiusY*Math.sin(n);if(this.rotation!==0){const h=Math.cos(this.rotation),l=Math.sin(this.rotation),y=c-this.center.x,f=a-this.center.y;c=y*h-f*l+this.center.x,a=y*l+f*h+this.center.y}return t.set(c,a)}toCommands(){const{center:e,radiusX:t,radiusY:s,startAngle:i,endAngle:r,clockwise:n,rotation:c}=this,{x:a,y:h}=e,l=a+t*Math.cos(i)*Math.cos(c)-s*Math.sin(i)*Math.sin(c),y=h+t*Math.cos(i)*Math.sin(c)+s*Math.sin(i)*Math.cos(c),f=Math.abs(i-r),d=f>Math.PI?1:0,g=n?1:0,x=c*180/Math.PI;if(f>=2*Math.PI){const m=i+Math.PI,w=a+t*Math.cos(m)*Math.cos(c)-s*Math.sin(m)*Math.sin(c),E=h+t*Math.cos(m)*Math.sin(c)+s*Math.sin(m)*Math.cos(c);return[{type:"M",x:l,y},{type:"A",rx:t,ry:s,angle:x,largeArcFlag:0,sweepFlag:g,x:w,y:E},{type:"A",rx:t,ry:s,angle:x,largeArcFlag:0,sweepFlag:g,x:l,y}]}else{const m=a+t*Math.cos(r)*Math.cos(c)-s*Math.sin(r)*Math.sin(c),w=h+t*Math.cos(r)*Math.sin(c)+s*Math.sin(r)*Math.cos(c);return[{type:"M",x:l,y},{type:"A",rx:t,ry:s,angle:x,largeArcFlag:d,sweepFlag:g,x:m,y:w}]}}drawTo(e){const{center:t,radiusX:s,radiusY:i,rotation:r,startAngle:n,endAngle:c,clockwise:a}=this;return e.ellipse(t.x,t.y,s,i,r,n,c,!a),this}matrix(e){return G.set(this.center.x,this.center.y),G.applyMatrix3(e),this.center.x=G.x,this.center.y=G.y,Lt(e)?Nt(this,e):Et(this,e),this}getControlPoints(){return[this.center]}getMinMax(e=u.MAX,t=u.MIN){const{center:s,radiusX:i,radiusY:r,rotation:n}=this,{x:c,y:a}=s,h=Math.cos(n),l=Math.sin(n),y=Math.sqrt(i*i*h*h+r*r*l*l),f=Math.sqrt(i*i*l*l+r*r*h*h);return e.x=Math.min(e.x,c-y),e.y=Math.min(e.y,a-f),t.x=Math.max(t.x,c+y),t.y=Math.max(t.y,a+f),{min:e,max:t}}copy(e){return super.copy(e),this.center.x=e.center.x,this.center.y=e.center.y,this.radiusX=e.radiusX,this.radiusY=e.radiusY,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}}function Nt(o,e){const t=o.radiusX,s=o.radiusY,i=Math.cos(o.rotation),r=Math.sin(o.rotation),n=new u(t*i,t*r),c=new u(-s*r,s*i),a=n.applyMatrix3(e),h=c.applyMatrix3(e),l=$t.set(a.x,h.x,0,a.y,h.y,0,0,0,1),y=it.copy(l).invert(),g=rt.copy(y).transpose().multiply(y).elements,x=qt(g[0],g[1],g[4]),m=Math.sqrt(x.rt1),w=Math.sqrt(x.rt2);if(o.radiusX=1/m,o.radiusY=1/w,o.rotation=Math.atan2(x.sn,x.cs),!((o.endAngle-o.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=it.set(m,0,0,0,w,0,0,0,1),S=rt.set(x.cs,x.sn,0,-x.sn,x.cs,0,0,0,1),$=b.multiply(S).multiply(l),z=D=>{const{x:_,y:H}=new u(Math.cos(D),Math.sin(D)).applyMatrix3($);return Math.atan2(H,_)};o.startAngle=z(o.startAngle),o.endAngle=z(o.endAngle),ht(e)&&(o.clockwise=!o.clockwise)}}function Et(o,e){const t=at(e),s=ct(e);o.radiusX*=t,o.radiusY*=s;const i=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);o.rotation+=i,ht(e)&&(o.startAngle*=-1,o.endAngle*=-1,o.clockwise=!o.clockwise)}function ht(o){const e=o.elements;return e[0]*e[4]-e[1]*e[3]<0}function Lt(o){const e=o.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const s=at(o),i=ct(o);return Math.abs(t/(s*i))>Number.EPSILON}function at(o){const e=o.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ct(o){const e=o.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function qt(o,e,t){let s,i,r,n,c;const a=o+t,h=o-t,l=Math.sqrt(h*h+4*e*e);return a>0?(s=.5*(a+l),c=1/s,i=o*c*t-e*c*e):a<0?i=.5*(a-l):(s=.5*l,i=-.5*l),h>0?r=h+l:r=h-l,Math.abs(r)>2*Math.abs(e)?(c=-2*e/r,n=1/Math.sqrt(1+c*c),r=c*n):Math.abs(e)===0?(r=1,n=0):(c=-.5*r/e,r=1/Math.sqrt(1+c*c),n=c*r),h>0&&(c=r,r=-n,n=c),{rt1:s,rt2:i,cs:r,sn:n}}class O extends k{constructor(e=new u,t=new u){super(),this.start=e,this.end=t}getPoint(e,t=new u){return e===1?t.copy(this.end):t.copy(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new u){return this.getPoint(e,t)}getTangent(e,t=new u){return t.subVectors(this.end,this.start).normalize()}getTangentAt(e,t=new u){return this.getTangent(e,t)}getControlPoints(){return[this.start,this.end]}getMinMax(e=u.MAX,t=u.MIN){const{start:s,end:i}=this;return e.x=Math.min(e.x,s.x,i.x),e.y=Math.min(e.y,s.y,i.y),t.x=Math.max(t.x,s.x,i.x),t.y=Math.max(t.y,s.y,i.y),{min:e,max:t}}toCommands(){const{start:e,end:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{start:t,end:s}=this;return e.lineTo(t.x,t.y),e.lineTo(s.x,s.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.end.copy(e.end),this}}class zt extends k{constructor(t,s,i=0,r=1){super();T(this,"curveT",0);this.center=t,this.size=s,this.start=i,this.end=r,this.update()}update(){const{x:t,y:s}=this.center,i=new u(t+.5*this.size,s-.5*this.size),r=new u(t-.5*this.size,s-.5*this.size),n=new u(t,s+.5*this.size),c=new R(i,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),a=new R(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),h=new R(n,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),l=new u(t,s+this.size),y=new u(t+this.size,s),f=new u().lerpVectors(y,l,.75),d=new u(t-this.size,s),g=new u().lerpVectors(d,l,.75),x=new O(y,f),m=new O(g,d);return this.curves=[c,x,h,m,a],this}getPoint(t){return this.getCurve(t).getPoint(this.curveT)}getPointAt(t){return this.getPoint(t)}getCurve(t){let s=(t*(this.end-this.start)+this.start)%1;s<0&&(s+=1),s*=9*Math.PI/8+1.5;let i;const r=.5*Math.PI;return s<r?(i=0,this.curveT=s/r):s<r+.75?(i=1,this.curveT=(s-r)/.75):s<5*Math.PI/8+.75?(i=2,this.curveT=(s-r-.75)/(Math.PI/8)):s<5*Math.PI/8+1.5?(i=3,this.curveT=(s-5*Math.PI/8-.75)/.75):(i=4,this.curveT=(s-5*Math.PI/8-1.5)/r),this.curves[i]}getTangent(t,s){return this.getCurve(t).getTangent(this.curveT,s)}getNormal(t,s){return this.getCurve(t).getNormal(this.curveT,s)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=u.MAX,s=u.MIN){return this.curves.forEach(i=>i.getMinMax(t,s)),{min:t,max:s}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(s=>s.drawTo(t)),this}}class Dt extends k{constructor(t,s=0,i=0,r=0,n=1){super();T(this,"curves",[]);T(this,"curveT",0);T(this,"points",[]);this.center=t,this.radius=s,this.number=i,this.start=r,this.end=n,this.update()}update(){for(let t=0;t<this.number;t++){let s=t*2*Math.PI/this.number;s-=.5*Math.PI,this.points.push(new u(this.radius*Math.cos(s),this.radius*Math.sin(s)).add(this.center))}for(let t=0;t<this.number;t++)this.curves.push(new O(this.points[t],this.points[(t+1)%this.number]));return this}getCurve(t){let s=(t*(this.end-this.start)+this.start)%1;s<0&&(s+=1);const i=s*this.number,r=Math.floor(i);return this.curveT=i-r,this.curves[r]}getPoint(t,s){return this.getCurve(t).getPoint(this.curveT,s)}getPointAt(t,s){return this.getPoint(t,s)}getTangent(t,s){return this.getCurve(t).getTangent(this.curveT,s)}getNormal(t,s){return this.getCurve(t).getNormal(this.curveT,s)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=u.MAX,s=u.MIN){return this.curves.forEach(i=>i.getMinMax(t,s)),{min:t,max:s}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(s=>s.drawTo(t)),this}}class lt extends k{constructor(e=new u,t=new u,s=new u){super(),this.start=e,this.control=t,this.end=s}getPoint(e,t=new u){const{start:s,control:i,end:r}=this;return t.set(et(e,s.x,i.x,r.x),et(e,s.y,i.y,r.y)),t}getControlPoints(){return[this.start,this.control,this.end]}getMinMax(e=u.MAX,t=u.MIN){const{start:s,control:i,end:r}=this,n=.5*(s.x+i.x),c=.5*(s.y+i.y),a=.5*(s.x+r.x),h=.5*(s.y+r.y);return e.x=Math.min(e.x,s.x,r.x,n,a),e.y=Math.min(e.y,s.y,r.y,c,h),t.x=Math.max(t.x,s.x,r.x,n,a),t.y=Math.max(t.y,s.y,r.y,c,h),{min:e,max:t}}toCommands(){const{start:e,control:t,end:s}=this;return[{type:"M",x:e.x,y:e.y},{type:"Q",x1:t.x,y1:t.y,x:s.x,y:s.y}]}drawTo(e){const{start:t,control:s,end:i}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(s.x,s.y,i.x,i.y),this}copy(e){return super.copy(e),this.start.copy(e.start),this.control.copy(e.control),this.end.copy(e.end),this}}class ut extends k{constructor(t,s,i=1,r=0,n=1){super();T(this,"curves",[]);T(this,"curveT",0);this.center=t,this.rx=s,this.aspectRatio=i,this.start=r,this.end=n,this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:s}=this.center,i=this.rx,r=this.rx/this.aspectRatio,n=[new u(t-i,s-r),new u(t+i,s-r),new u(t+i,s+r),new u(t-i,s+r)];for(let c=0;c<4;c++)this.curves.push(new O(n[c].clone(),n[(c+1)%4].clone()));return this}getCurve(t){let s=(t*(this.end-this.start)+this.start)%1;s<0&&(s+=1),s*=(1+this.aspectRatio)*2;let i;return s<this.aspectRatio?(i=0,this.curveT=s/this.aspectRatio):s<this.aspectRatio+1?(i=1,this.curveT=(s-this.aspectRatio)/1):s<2*this.aspectRatio+1?(i=2,this.curveT=(s-this.aspectRatio-1)/this.aspectRatio):(i=3,this.curveT=(s-2*this.aspectRatio-1)/1),this.curves[i]}getPoint(t,s){return this.getCurve(t).getPoint(this.curveT,s)}getPointAt(t,s){return this.getPoint(t,s)}getTangent(t,s){return this.getCurve(t).getTangent(this.curveT,s)}getNormal(t,s){return this.getCurve(t).getNormal(this.curveT,s)}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getMinMax(t=u.MAX,s=u.MIN){return this.curves.forEach(i=>i.getMinMax(t,s)),{min:t,max:s}}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){return this.curves.forEach(s=>s.drawTo(t)),this}}class yt extends k{constructor(e=[]){super(),this.points=e}getPoint(e,t=new u){const{points:s}=this,i=(s.length-1)*e,r=Math.floor(i),n=i-r,c=s[r===0?r:r-1],a=s[r],h=s[r>s.length-2?s.length-1:r+1],l=s[r>s.length-3?s.length-1:r+2];return t.set(tt(n,c.x,a.x,h.x,l.x),tt(n,c.y,a.y,h.y,l.y)),t}getControlPoints(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,s=e.points.length;t<s;t++)this.points.push(e.points[t].clone());return this}}class F extends k{constructor(t){super();T(this,"curves",[]);T(this,"startPoint");T(this,"currentPoint");T(this,"autoClose",!1);T(this,"_cacheLengths",[]);t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let s=1,i=t.length;s<i;s++){const{x:r,y:n}=t[s];this.lineTo(r,n)}return this}addCommands(t){return U(t,this),this}addData(t){return this.addCommands(W(t)),this}getPoint(t,s=new u){const i=t*this.getLength(),r=this.getCurveLengths();let n=0;for(;n<r.length;){if(r[n]>=i){const c=r[n]-i,a=this.curves[n],h=a.getLength();return a.getPointAt(h===0?0:1-c/h,s)}n++}return s}getControlPoints(){return this.curves.flatMap(t=>t.getControlPoints())}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let s=0;for(let i=0,r=this.curves.length;i<r;i++)s+=this.curves[i].getLength(),t.push(s);return this._cacheLengths=t,t}getSpacedPoints(t=40){const s=[];for(let i=0;i<=t;i++)s.push(this.getPoint(i/t));return this.autoClose&&s.push(s[0]),s}getPoints(t=12){const s=[],i=this.curves;let r;for(let n=0,c=i.length;n<c;n++){const h=i[n].getPoints(t);for(let l=0;l<h.length;l++){const y=h[l];r!=null&&r.equals(y)||(s.push(y),r=y)}}return this.autoClose&&s.length>1&&!s[s.length-1].equals(s[0])&&s.push(s[0]),s}_setCurrentPoint(t){return this.currentPoint=new u(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const s=this.currentPoint;s&&!t.equals(s)&&(this.curves.push(new O(s.clone(),t)),s.copy(t)),this.startPoint=void 0}return this}moveTo(t,s){return this.currentPoint=new u(t,s),this.startPoint=this.currentPoint.clone(),this}lineTo(t,s){const i=this.currentPoint;return i!=null&&i.equals({x:t,y:s})||this.curves.push(new O((i==null?void 0:i.clone())??new u,new u(t,s))),this._setCurrentPoint({x:t,y:s}),this}bezierCurveTo(t,s,i,r,n,c){const a=this.currentPoint;return a!=null&&a.equals({x:n,y:c})||this.curves.push(new nt((a==null?void 0:a.clone())??new u,new u(t,s),new u(i,r),new u(n,c))),this._setCurrentPoint({x:n,y:c}),this}quadraticCurveTo(t,s,i,r){const n=this.currentPoint;return n!=null&&n.equals({x:i,y:r})||this.curves.push(new lt((n==null?void 0:n.clone())??new u,new u(t,s),new u(i,r))),this._setCurrentPoint({x:i,y:r}),this}arc(t,s,i,r,n,c){return this.ellipse(t,s,i,i,0,r,n,c),this}relativeArc(t,s,i,r,n,c){const a=this.currentPoint??new u;return this.arc(t+a.x,s+a.y,i,r,n,c),this}arcTo(t,s,i,r,n){return console.warn("Method arcTo not supported yet"),this}ellipse(t,s,i,r,n,c,a,h=!0){const l=new ot(new u(t,s),i,r,n,c,a,!h);if(this.curves.length>0){const y=l.getPoint(0);(!this.currentPoint||!y.equals(this.currentPoint))&&this.lineTo(y.x,y.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,s,i,r,n,c,a,h){const l=this.currentPoint??new u;return this.ellipse(t+l.x,s+l.y,i,r,n,c,a,h),this}rect(t,s,i,r){return this.curves.push(new ut(new u(t+i/2,s+r/2),i/2,i/r)),this._setCurrentPoint({x:t,y:s}),this}splineThru(t){const s=this.currentPoint??new u;return this.curves.push(new yt([s].concat(t))),this._setCurrentPoint(t[t.length-1]),this}getMinMax(t=u.MAX,s=u.MIN){return this.curves.forEach(i=>i.getMinMax(t,s)),{min:t,max:s}}getBoundingBox(){const{min:t,max:s}=this.getMinMax();return new L(t.x,t.y,s.x-t.x,s.y-t.y)}toCommands(){return this.curves.flatMap(t=>t.toCommands())}drawTo(t){var i;const s=(i=this.curves[0])==null?void 0:i.getPoint(0);return s&&t.moveTo(s.x,s.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var s;super.copy(t),this.curves=[];for(let i=0,r=t.curves.length;i<r;i++)this.curves.push(t.curves[i].clone());return this.autoClose=t.autoClose,this.currentPoint=(s=t.currentPoint)==null?void 0:s.clone(),this}}function Ot(o){return o.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Xt(o,e,t,s){const i=e.clone().sub(o),r=s.clone().sub(t),n=t.clone().sub(o),c=i.cross(r);if(c===0)return new u((o.x+t.x)/2,(o.y+t.y)/2);const a=n.cross(r)/c;return Math.abs(a)>1?new u((o.x+t.x)/2,(o.y+t.y)/2):new u(o.x+a*i.x,o.y+a*i.y)}class I{constructor(e,t={}){T(this,"currentPath",new F);T(this,"paths",[this.currentPath]);T(this,"style");e&&(e instanceof I?this.addPath(e):Array.isArray(e)?this.addCommands(e):this.addData(e)),this.style=t}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(e){return e instanceof I?this.paths.push(...e.paths.map(t=>t.clone())):this.paths.push(e),this}closePath(){const e=this.startPoint;return e&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new F().moveTo(e.x,e.y),this.paths.push(this.currentPath))),this}moveTo(e,t){const{currentPoint:s,curves:i}=this.currentPath;return s!=null&&s.equals({x:e,y:t})||(i.length?(this.currentPath=new F().moveTo(e,t),this.paths.push(this.currentPath)):this.currentPath.moveTo(e,t)),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}bezierCurveTo(e,t,s,i,r,n){return this.currentPath.bezierCurveTo(e,t,s,i,r,n),this}quadraticCurveTo(e,t,s,i){return this.currentPath.quadraticCurveTo(e,t,s,i),this}arc(e,t,s,i,r,n){return this.currentPath.arc(e,t,s,i,r,n),this}arcTo(e,t,s,i,r){return this.currentPath.arcTo(e,t,s,i,r),this}ellipse(e,t,s,i,r,n,c,a){return this.currentPath.ellipse(e,t,s,i,r,n,c,a),this}rect(e,t,s,i){return this.currentPath.rect(e,t,s,i),this}addCommands(e){return U(e,this),this}addData(e){return this.addCommands(W(e)),this}splineThru(e){return this.currentPath.splineThru(e),this}getControlPoints(){return this.paths.flatMap(e=>e.getControlPoints())}getCurves(){return this.paths.flatMap(e=>e.curves)}scale(e,t=e,s={x:0,y:0}){return this.getControlPoints().forEach(i=>{i.scale(e,t,s)}),this}skew(e,t=0,s={x:0,y:0}){return this.getControlPoints().forEach(i=>{i.skew(e,t,s)}),this}rotate(e,t={x:0,y:0}){return this.getControlPoints().forEach(s=>{s.rotate(e,t)}),this}bold(e){if(e===0)return this;const t=this.getCurves(),s=[],i=[],r=[];t.forEach((c,a)=>{const h=c.getControlPoints(),l=c.isClockwise();r[a]=h,i[a]=l;const y=h[0],f=h[h.length-1]??y;s.push({start:l?f:y,end:l?y:f,index:a})});const n=[];return s.forEach((c,a)=>{n[a]=[],s.forEach((h,l)=>{l!==a&&h.start.equals(c.end)&&n[a].push(h.index)})}),t.forEach((c,a)=>{const h=i[a];r[a].forEach(y=>{const f=c.getTForPoint(y),d=c.getNormal(f).scale(h?e:-e);y.add(d)})}),n.forEach((c,a)=>{const h=r[a];c.forEach(l=>{const y=r[l],f=Xt(h[h.length-1],h[h.length-2]??h[h.length-1],y[0],y[1]??y[0]);f&&(h[h.length-1].copy(f),y[0].copy(f))})}),this}matrix(e){return this.getCurves().forEach(t=>t.matrix(e)),this}getMinMax(e=u.MAX,t=u.MIN,s=!0){const i=this.strokeWidth;return this.getCurves().forEach(r=>{if(r.getMinMax(e,t),s&&i>1){const n=i/2,c=r.isClockwise(),a=[];for(let h=0;h<=1;h+=1/r.arcLengthDivisions){const l=r.getPoint(h),y=r.getNormal(h),f=y.clone().scale(c?n:-n),d=y.clone().scale(c?-n:n);a.push(l.clone().add(f),l.clone().add(d),l.clone().add({x:n,y:0}),l.clone().add({x:-n,y:0}),l.clone().add({x:0,y:n}),l.clone().add({x:0,y:-n}),l.clone().add({x:n,y:n}),l.clone().add({x:-n,y:-n}))}e.min(...a),t.max(...a)}}),{min:e,max:t}}getBoundingBox(e=!0){const{min:t,max:s}=this.getMinMax(void 0,void 0,e);return new L(t.x,t.y,s.x-t.x,s.y-t.y)}drawTo(e,t={}){t={...this.style,...t};const{fill:s="#000",stroke:i="none"}=t;return e.beginPath(),e.save(),q(e,t),this.paths.forEach(r=>{r.drawTo(e)}),s!=="none"&&e.fill(),i!=="none"&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};const{fill:s="#000",stroke:i="none"}=t;return e.beginPath(),e.save(),q(e,t),this.getControlPoints().forEach(r=>{e.moveTo(r.x,r.y),e.arc(r.x,r.y,4,0,Math.PI*2)}),s!=="none"&&e.fill(),i!=="none"&&e.stroke(),e.restore(),this}toCommands(){return this.paths.flatMap(e=>e.toCommands())}toData(){return this.paths.map(e=>e.toData()).join(" ")}toSVGPathString(){const e={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},t={};for(const i in e)e[i]!==void 0&&(t[Ot(i)]=e[i]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let s="";for(const i in t)t[i]!==void 0&&(s+=`${i}:${t[i]};`);return`<path d="${this.toData()}" style="${s}"></path>`}toSVGString(){const{x:e,y:t,width:s,height:i}=this.getBoundingBox(),r=this.toSVGPathString();return`<svg viewBox="${e} ${t} ${s} ${i}" width="${s}px" height="${i}px" xmlns="http://www.w3.org/2000/svg">${r}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...s}=e,{left:i,top:r,width:n,height:c}=this.getBoundingBox(),a=document.createElement("canvas");a.width=n*t,a.height=c*t,a.style.width=`${n}px`,a.style.height=`${c}px`;const h=a.getContext("2d");return h&&(h.scale(t,t),h.translate(-i,-r),this.drawTo(h,s)),a}copy(e){return this.currentPath=e.currentPath.clone(),this.paths=e.paths.map(t=>t.clone()),this.style={...e.style},this}clone(){return new this.constructor().copy(this)}}const Ft="px",Rt=90,gt=["mm","cm","in","pt","pc","px"],ft={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 M(o){let e="px";if(typeof o=="string"||o instanceof String)for(let s=0,i=gt.length;s<i;s++){const r=gt[s];if(o.endsWith(r)){e=r,o=o.substring(0,o.length-r.length);break}}let t;return t=ft[e][Ft],t<0&&(t=ft[e].in*Rt),t*Number.parseFloat(o)}const Gt=new v,V=new v,pt=new v,dt=new v;function Vt(o,e,t){if(!(o.hasAttribute("transform")||o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))))return null;const s=_t(o);return t.length>0&&s.premultiply(t[t.length-1]),e.copy(s),t.push(s),s}function _t(o){const e=new v,t=Gt;if(o.nodeName==="use"&&(o.hasAttribute("x")||o.hasAttribute("y"))&&e.translate(M(o.getAttribute("x")),M(o.getAttribute("y"))),o.hasAttribute("transform")){const s=o.getAttribute("transform").split(")");for(let i=s.length-1;i>=0;i--){const r=s[i].trim();if(r==="")continue;const n=r.indexOf("("),c=r.length;if(n>0&&n<c){const a=r.slice(0,n),h=A(r.slice(n+1));switch(t.identity(),a){case"translate":if(h.length>=1){const l=h[0];let y=0;h.length>=2&&(y=h[1]),t.translate(l,y)}break;case"rotate":if(h.length>=1){let l=0,y=0,f=0;l=h[0]*Math.PI/180,h.length>=3&&(y=h[1],f=h[2]),V.makeTranslation(-y,-f),pt.makeRotation(l),dt.multiplyMatrices(pt,V),V.makeTranslation(y,f),t.multiplyMatrices(V,dt)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Bt(o){return new I().addPath(new F().arc(M(o.getAttribute("cx")||0),M(o.getAttribute("cy")||0),M(o.getAttribute("r")||0),0,Math.PI*2))}function Ut(o,e){if(!(!o.sheet||!o.sheet.cssRules||!o.sheet.cssRules.length))for(let t=0;t<o.sheet.cssRules.length;t++){const s=o.sheet.cssRules[t];if(s.type!==1)continue;const i=s.selectorText.split(/,/g).filter(Boolean).map(n=>n.trim()),r={};for(let n=s.style.length,c=0;c<n;c++){const a=s.style.item(c);r[a]=s.style.getPropertyValue(a)}for(let n=0;n<i.length;n++)e[i[n]]=Object.assign(e[i[n]]||{},{...r})}}function Wt(o){return new I().addPath(new F().ellipse(M(o.getAttribute("cx")||0),M(o.getAttribute("cy")||0),M(o.getAttribute("rx")||0),M(o.getAttribute("ry")||0),0,0,Math.PI*2))}function Yt(o){return new I().moveTo(M(o.getAttribute("x1")||0),M(o.getAttribute("y1")||0)).lineTo(M(o.getAttribute("x2")||0),M(o.getAttribute("y2")||0))}function Qt(o){const e=new I,t=o.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const jt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ht(o){var s;const e=new I;let t=0;return(s=o.getAttribute("points"))==null||s.replace(jt,(i,r,n)=>{const c=M(r),a=M(n);return t===0?e.moveTo(c,a):e.lineTo(c,a),t++,i}),e.currentPath.autoClose=!0,e}const Zt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Jt(o){var s;const e=new I;let t=0;return(s=o.getAttribute("points"))==null||s.replace(Zt,(i,r,n)=>{const c=M(r),a=M(n);return t===0?e.moveTo(c,a):e.lineTo(c,a),t++,i}),e.currentPath.autoClose=!1,e}function Kt(o){const e=M(o.getAttribute("x")||0),t=M(o.getAttribute("y")||0),s=M(o.getAttribute("rx")||o.getAttribute("ry")||0),i=M(o.getAttribute("ry")||o.getAttribute("rx")||0),r=M(o.getAttribute("width")),n=M(o.getAttribute("height")),c=1-.551915024494,a=new I;return a.moveTo(e+s,t),a.lineTo(e+r-s,t),(s!==0||i!==0)&&a.bezierCurveTo(e+r-s*c,t,e+r,t+i*c,e+r,t+i),a.lineTo(e+r,t+n-i),(s!==0||i!==0)&&a.bezierCurveTo(e+r,t+n-i*c,e+r-s*c,t+n,e+r-s,t+n),a.lineTo(e+s,t+n),(s!==0||i!==0)&&a.bezierCurveTo(e+s*c,t+n,e,t+n-i*c,e,t+n-i),a.lineTo(e,t+i),(s!==0||i!==0)&&a.bezierCurveTo(e,t+i*c,e+s*c,t,e+s,t),a}function N(o,e,t){e=Object.assign({},e);let s={};if(o.hasAttribute("class")){const h=o.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)s=Object.assign(s,t[`.${h[l]}`])}o.hasAttribute("id")&&(s=Object.assign(s,t[`#${o.getAttribute("id")}`]));for(let h=o.style.length,l=0;l<h;l++){const y=o.style.item(l),f=o.style.getPropertyValue(y);e[y]=f,s[y]=f}function i(h,l,y=r){o.hasAttribute(h)&&(e[l]=y(o.getAttribute(h))),s[h]&&(e[l]=y(s[h]))}function r(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function n(h){return Math.max(0,Math.min(1,M(h)))}function c(h){return Math.max(0,M(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>M(l))}return i("fill","fill"),i("fill-opacity","fillOpacity",n),i("fill-rule","fillRule"),i("opacity","opacity",n),i("stroke","stroke"),i("stroke-opacity","strokeOpacity",n),i("stroke-width","strokeWidth",c),i("stroke-linecap","strokeLinecap"),i("stroke-linejoin","strokeLinejoin"),i("stroke-miterlimit","strokeMiterlimit",c),i("stroke-dasharray","strokeDasharray",a),i("stroke-dashoffset","strokeDashoffset",M),i("visibility","visibility"),e}function Y(o,e,t=[],s={}){var y;if(o.nodeType!==1)return t;let i=!1,r=null,n={...e};switch(o.nodeName){case"svg":n=N(o,n,s);break;case"style":Ut(o,s);break;case"g":n=N(o,n,s);break;case"path":n=N(o,n,s),o.hasAttribute("d")&&(r=Qt(o));break;case"rect":n=N(o,n,s),r=Kt(o);break;case"polygon":n=N(o,n,s),r=Ht(o);break;case"polyline":n=N(o,n,s),r=Jt(o);break;case"circle":n=N(o,n,s),r=Bt(o);break;case"ellipse":n=N(o,n,s),r=Wt(o);break;case"line":n=N(o,n,s),r=Yt(o);break;case"defs":i=!0;break;case"use":{n=N(o,n,s);const d=(o.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(y=o.viewportElement)==null?void 0:y.getElementById(d);g?Y(g,n,t,s):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(o);break}if(n.display==="none")return t;Object.assign(e,n);const c=new v,a=[],h=Vt(o,c,a);r&&(r.matrix(c),t.push(r),r.style=e);const l=o.childNodes;for(let f=0,d=l.length;f<d;f++){const g=l[f];i&&g.nodeName!=="style"&&g.nodeName!=="defs"||Y(g,e,t,s)}return h&&(a.pop(),a.length>0?c.copy(a[a.length-1]):c.identity()),t}const xt="data:image/svg+xml;",mt=`${xt}base64,`,Mt=`${xt}charset=utf8,`;function Pt(o){if(typeof o=="string"){let e;o.startsWith(mt)?(o=o.substring(mt.length,o.length),e=atob(o)):o.startsWith(Mt)?(o=o.substring(Mt.length,o.length),e=decodeURIComponent(o)):e=o;const t=new DOMParser().parseFromString(e,"text/xml"),s=t.querySelector("parsererror");if(s)throw new Error(`${s.textContent??"parser error"}
|
|
2
|
-
${
|
|
1
|
+
(function(A,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(A=typeof globalThis<"u"?globalThis:A||self,Z(A.modernPath2d={}))})(this,function(A){"use strict";var kn=Object.defineProperty;var In=(A,Z,nt)=>Z in A?kn(A,Z,{enumerable:!0,configurable:!0,writable:!0,value:nt}):A[Z]=nt;var O=(A,Z,nt)=>In(A,typeof Z!="symbol"?Z+"":Z,nt);function Z(i,n,t,e={}){const{radius:r=1}=e;i.moveTo(n,t),i.arc(n,t,r,0,Math.PI*2)}const nt={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function At(i,n){const{fill:t="#000",stroke:e="none",strokeWidth:r=e==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:c=0,strokeDasharray:h=[],strokeDashoffset:a=0,shadowOffsetX:l=0,shadowOffsetY:f=0,shadowBlur:y=0,shadowColor:x="rgba(0, 0, 0, 0)"}=n;i.fillStyle=t,i.strokeStyle=e,i.lineWidth=r,i.lineCap=o,i.lineJoin=nt[s],i.miterLimit=c,i.setLineDash(h),i.lineDashOffset=a,i.shadowOffsetX=l,i.shadowOffsetY=f,i.shadowBlur=y,i.shadowColor=x}class P{constructor(n=0,t=0){this.x=n,this.y=t}static get MAX(){return new P(1/0,1/0)}static get MIN(){return new P(-1/0,-1/0)}get array(){return[this.x,this.y]}set(n,t){return this.x=n,this.y=t,this}add(n){return this.x+=n.x,this.y+=n.y,this}sub(n){return this.x-=n.x,this.y-=n.y,this}multiply(n){return this.x*=n.x,this.y*=n.y,this}divide(n){return this.x/=n.x,this.y/=n.y,this}dot(n){return this.x*n.x+this.y*n.y}cross(n){return this.x*n.y-this.y*n.x}rotate(n,t={x:0,y:0}){const e=-n/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(e),c=Math.cos(e);return this.set(t.x+(r*c-o*s),t.y-(r*s+o*c)),this}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const t=this.x-n.x,e=this.y-n.y;return t*t+e*e}lengthSquared(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.lengthSquared())}scale(n,t=n,e={x:0,y:0}){const r=n<0?e.x-this.x+e.x:this.x,o=t<0?e.y-this.y+e.y:this.y;return this.x=r*Math.abs(n),this.y=o*Math.abs(t),this}skew(n,t=0,e={x:0,y:0}){const r=this.x-e.x,o=this.y-e.y;return this.x=e.x+(r+Math.tan(n)*o),this.y=e.y+(o+Math.tan(t)*r),this}min(...n){return this.x=Math.min(this.x,...n.map(t=>t.x)),this.y=Math.min(this.y,...n.map(t=>t.y)),this}max(...n){return this.x=Math.max(this.x,...n.map(t=>t.x)),this.y=Math.max(this.y,...n.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(n,t){return this.x=n.x+t.x,this.y=n.y+t.y,this}subVectors(n,t){return this.x=n.x-t.x,this.y=n.y-t.y,this}multiplyVectors(n,t){return this.x=n.x*t.x,this.y=n.y*t.y,this}divideVectors(n,t){return this.x=n.x/t.x,this.y=n.y/t.y,this}lerpVectors(n,t,e){return this.x=n.x+(t.x-n.x)*e,this.y=n.y+(t.y-n.y)*e,this}equals(n){return this.x===n.x&&this.y===n.y}applyMatrix3(n){const t=this.x,e=this.y,r=n.elements;return this.x=r[0]*t+r[3]*e+r[6],this.y=r[1]*t+r[4]*e+r[7],this}copy(n){return this.x=n.x,this.y=n.y,this}clone(){return new P(this.x,this.y)}}class B{constructor(n=0,t=0,e=0,r=0){this.left=n,this.top=t,this.width=e,this.height=r}get x(){return this.left}set x(n){this.left=n}get y(){return this.top}set y(n){this.top=n}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new P((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...n){if(n.length===0)return new B;if(n.length===1)return n[0].clone();const t=n[0],e=n.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:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new B(e.left,e.top,e.right-e.left,e.bottom-e.top)}translate(n,t){return this.left+=n,this.top+=t,this}copy(n){return this.left=n.left,this.top=n.top,this.width=n.width,this.height=n.height,this}clone(){return new B(this.left,this.top,this.width,this.height)}}class _{constructor(n=1,t=0,e=0,r=0,o=1,s=0,c=0,h=0,a=1){O(this,"elements",[]);this.set(n,t,e,r,o,s,c,h,a)}set(n,t,e,r,o,s,c,h,a){const l=this.elements;return l[0]=n,l[1]=r,l[2]=c,l[3]=t,l[4]=o,l[5]=h,l[6]=e,l[7]=s,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(n){const t=this.elements,e=n.elements;return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],this}multiply(n){return this.multiplyMatrices(this,n)}premultiply(n){return this.multiplyMatrices(n,this)}multiplyMatrices(n,t){const e=n.elements,r=t.elements,o=this.elements,s=e[0],c=e[3],h=e[6],a=e[1],l=e[4],f=e[7],y=e[2],x=e[5],u=e[8],m=r[0],d=r[3],k=r[6],v=r[1],M=r[4],w=r[7],S=r[2],L=r[5],p=r[8];return o[0]=s*m+c*v+h*S,o[3]=s*d+c*M+h*L,o[6]=s*k+c*w+h*p,o[1]=a*m+l*v+f*S,o[4]=a*d+l*M+f*L,o[7]=a*k+l*w+f*p,o[2]=y*m+x*v+u*S,o[5]=y*d+x*M+u*L,o[8]=y*k+x*w+u*p,this}invert(){const n=this.elements,t=n[0],e=n[1],r=n[2],o=n[3],s=n[4],c=n[5],h=n[6],a=n[7],l=n[8],f=l*s-c*a,y=c*h-l*o,x=a*o-s*h,u=t*f+e*y+r*x;if(u===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/u;return n[0]=f*m,n[1]=(r*a-l*e)*m,n[2]=(c*e-r*s)*m,n[3]=y*m,n[4]=(l*t-r*h)*m,n[5]=(r*o-c*t)*m,n[6]=x*m,n[7]=(e*h-a*t)*m,n[8]=(s*t-e*o)*m,this}transpose(){let n;const t=this.elements;return n=t[1],t[1]=t[3],t[3]=n,n=t[2],t[2]=t[6],t[6]=n,n=t[5],t[5]=t[7],t[7]=n,this}scale(n,t){return this.premultiply(kt.makeScale(n,t)),this}rotate(n){return this.premultiply(kt.makeRotation(-n)),this}translate(n,t){return this.premultiply(kt.makeTranslation(n,t)),this}makeTranslation(n,t){return this.set(1,0,n,0,1,t,0,0,1),this}makeRotation(n){const t=Math.cos(n),e=Math.sin(n);return this.set(t,-e,0,e,t,0,0,0,1),this}makeScale(n,t){return this.set(n,0,0,0,t,0,0,0,1),this}fromArray(n,t=0){for(let e=0;e<9;e++)this.elements[e]=n[e+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const kt=new _;function Zt(i,n,t,e){const r=i*t+n*e,o=Math.sqrt(i*i+n*n)*Math.sqrt(t*t+e*e);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*e-n*t<0&&(s=-s),s}function _t(i,n,t,e,r,o,s,c){if(n===0||t===0){i.lineTo(c.x,c.y);return}e=e*Math.PI/180,n=Math.abs(n),t=Math.abs(t);const h=(s.x-c.x)/2,a=(s.y-c.y)/2,l=Math.cos(e)*h+Math.sin(e)*a,f=-Math.sin(e)*h+Math.cos(e)*a;let y=n*n,x=t*t;const u=l*l,m=f*f,d=u/y+m/x;if(d>1){const z=Math.sqrt(d);n=z*n,t=z*t,y=n*n,x=t*t}const k=y*m+x*u,v=(y*x-k)/k;let M=Math.sqrt(Math.max(0,v));r===o&&(M=-M);const w=M*n*f/t,S=-M*t*l/n,L=Math.cos(e)*w-Math.sin(e)*S+(s.x+c.x)/2,p=Math.sin(e)*w+Math.cos(e)*S+(s.y+c.y)/2,g=Zt(1,0,(l-w)/n,(f-S)/t),F=Zt((l-w)/n,(f-S)/t,(-l-w)/n,(-f-S)/t)%(Math.PI*2);i.ellipse(L,p,n,t,e,g,g+F,o===0)}const q={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function G(i,n,t=0){let c=0,h=!0,a="",l="";const f=[];function y(d,k,v){const M=new SyntaxError(`Unexpected character "${d}" at index ${k}.`);throw M.partial=v,M}function x(){a!==""&&(l===""?f.push(Number(a)):f.push(Number(a)*10**Number(l))),a="",l=""}let u;const m=i.length;for(let d=0;d<m;d++){if(u=i[d],Array.isArray(n)&&n.includes(f.length%t)&&q.FLAGS.test(u)){c=1,a=u,x();continue}if(c===0){if(q.WHITESPACE.test(u))continue;if(q.DIGIT.test(u)||q.SIGN.test(u)){c=1,a=u;continue}if(q.POINT.test(u)){c=2,a=u;continue}q.COMMA.test(u)&&(h&&y(u,d,f),h=!0)}if(c===1){if(q.DIGIT.test(u)){a+=u;continue}if(q.POINT.test(u)){a+=u,c=2;continue}if(q.EXP.test(u)){c=3;continue}q.SIGN.test(u)&&a.length===1&&q.SIGN.test(a[0])&&y(u,d,f)}if(c===2){if(q.DIGIT.test(u)){a+=u;continue}if(q.EXP.test(u)){c=3;continue}q.POINT.test(u)&&a[a.length-1]==="."&&y(u,d,f)}if(c===3){if(q.DIGIT.test(u)){l+=u;continue}if(q.SIGN.test(u)){if(l===""){l+=u;continue}l.length===1&&q.SIGN.test(l)&&y(u,d,f)}}q.WHITESPACE.test(u)?(x(),c=0,h=!1):q.COMMA.test(u)?(x(),c=0,h=!0):q.SIGN.test(u)?(x(),c=1,a=u):q.POINT.test(u)?(x(),c=2,a=u):y(u,d,f)}return x(),f}function st(i,n){return i-(n-i)}function It(i,n){const t=new P,e=new P;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),n.moveTo(t.x,t.y),e.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,n.lineTo(t.x,t.y),e.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,n.lineTo(t.x,t.y),e.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),n.lineTo(t.x,t.y),e.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(n.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),e.x=t.x+s.x2,e.y=t.y+s.y2,t.add(s)):(n.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),e.x=s.x2,e.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(n.bezierCurveTo(st(t.x,e.x),st(t.y,e.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),e.x=t.x+s.x2,e.y=t.y+s.y2,t.add(s)):(n.bezierCurveTo(st(t.x,e.x),st(t.y,e.y),s.x2,s.y2,s.x,s.y),e.x=s.x2,e.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(n.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),e.x=t.x+s.x1,e.y=t.y+s.y1,t.add(s)):(n.quadraticCurveTo(s.x1,s.y1,s.x,s.y),e.x=s.x1,e.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const c=st(t.x,e.x),h=st(t.y,e.y);e.x=c,e.y=h,s.type==="t"?(n.quadraticCurveTo(c,h,t.x+s.x,t.y+s.y),t.add(s)):(n.quadraticCurveTo(c,h,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const c=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}e.copy(t),_t(n,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,c,t)}else s.type==="z"||s.type==="Z"?(n.startPoint&&t.copy(n.startPoint),n.closePath()):console.warn("Unsupported commands",s)}}function Gt(i){let n,t;const e=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;e.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},n={x:s.x,y:s.y};break;case"h":case"H":e.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":e.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":e.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":e.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":e.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":e.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":e.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":e.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":e.push(s.type),n&&(t={x:n.x,y:n.y});break}}return e.join(" ")}const ve=/[a-df-z][^a-df-z]*/gi;function St(i){const n=[],t=i.match(ve);if(!t)return n;for(let e=0,r=t.length;e<r;e++){const o=t[e],s=o.charAt(0),c=o.slice(1).trim();let h;switch(s){case"m":case"M":h=G(c);for(let a=0,l=h.length;a<l;a+=2)a===0?n.push({type:s,x:h[a],y:h[a+1]}):n.push({type:s==="m"?"l":"L",x:h[a],y:h[a+1]});break;case"h":case"H":h=G(c);for(let a=0,l=h.length;a<l;a++)n.push({type:s,x:h[a]});break;case"v":case"V":h=G(c);for(let a=0,l=h.length;a<l;a++)n.push({type:s,y:h[a]});break;case"l":case"L":h=G(c);for(let a=0,l=h.length;a<l;a+=2)n.push({type:s,x:h[a],y:h[a+1]});break;case"c":case"C":h=G(c);for(let a=0,l=h.length;a<l;a+=6)n.push({type:s,x1:h[a],y1:h[a+1],x2:h[a+2],y2:h[a+3],x:h[a+4],y:h[a+5]});break;case"s":case"S":h=G(c);for(let a=0,l=h.length;a<l;a+=4)n.push({type:s,x2:h[a],y2:h[a+1],x:h[a+2],y:h[a+3]});break;case"q":case"Q":h=G(c);for(let a=0,l=h.length;a<l;a+=4)n.push({type:s,x1:h[a],y1:h[a+1],x:h[a+2],y:h[a+3]});break;case"t":case"T":h=G(c);for(let a=0,l=h.length;a<l;a+=2)n.push({type:s,x:h[a],y:h[a+1]});break;case"a":case"A":h=G(c,[3,4],7);for(let a=0,l=h.length;a<l;a+=7)n.push({type:s,rx:h[a],ry:h[a+1],angle:h[a+2],largeArcFlag:h[a+3],sweepFlag:h[a+4],x:h[a+5],y:h[a+6]});break;case"z":case"Z":n.push({type:s});break;default:console.warn(o)}}return n}function Lt(i,n,t,e,r){const o=(e-n)*.5,s=(r-t)*.5,c=i*i,h=i*c;return(2*t-2*e+o+s)*h+(-3*t+3*e-2*o-s)*c+o*i+t}function Te(i,n){const t=1-i;return t*t*t*n}function be(i,n){const t=1-i;return 3*t*t*i*n}function Ce(i,n){return 3*(1-i)*i*i*n}function Ae(i,n){return i*i*i*n}function Et(i,n,t,e,r){return Te(i,n)+be(i,t)+Ce(i,e)+Ae(i,r)}function ke(i,n,t=2){const e=n&&n.length,r=e?n[0]*t:i.length;let o=jt(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let c,h,a;if(e&&(o=$e(i,n,o,t)),i.length>80*t){c=1/0,h=1/0;let l=-1/0,f=-1/0;for(let y=t;y<r;y+=t){const x=i[y],u=i[y+1];x<c&&(c=x),u<h&&(h=u),x>l&&(l=x),u>f&&(f=u)}a=Math.max(l-c,f-h),a=a!==0?32767/a:0}return ot(o,s,t,c,h,a,0),s}function jt(i,n,t,e,r){let o;if(r===je(i,n,t,e)>0)for(let s=n;s<t;s+=e)o=Bt(s/e|0,i[s],i[s+1],o);else for(let s=t-e;s>=n;s-=e)o=Bt(s/e|0,i[s],i[s+1],o);return o&&it(o,o.next)&&(at(o),o=o.next),o}function H(i,n){if(!i)return i;n||(n=i);let t=i,e;do if(e=!1,!t.steiner&&(it(t,t.next)||N(t.prev,t,t.next)===0)){if(at(t),t=n=t.prev,t===t.next)break;e=!0}else t=t.next;while(e||t!==n);return n}function ot(i,n,t,e,r,o,s){if(!i)return;!s&&o&&Fe(i,e,r,o);let c=i;for(;i.prev!==i.next;){const h=i.prev,a=i.next;if(o?Se(i,e,r,o):Ie(i)){n.push(h.i,i.i,a.i),at(i),i=a.next,c=a.next;continue}if(i=a,i===c){s?s===1?(i=Le(H(i),n),ot(i,n,t,e,r,o,2)):s===2&&Ee(i,n,t,e,r,o):ot(H(i),n,t,e,r,o,1);break}}}function Ie(i){const n=i.prev,t=i,e=i.next;if(N(n,t,e)>=0)return!1;const r=n.x,o=t.x,s=e.x,c=n.y,h=t.y,a=e.y,l=Math.min(r,o,s),f=Math.min(c,h,a),y=Math.max(r,o,s),x=Math.max(c,h,a);let u=e.next;for(;u!==n;){if(u.x>=l&&u.x<=y&&u.y>=f&&u.y<=x&&ct(r,c,o,h,s,a,u.x,u.y)&&N(u.prev,u,u.next)>=0)return!1;u=u.next}return!0}function Se(i,n,t,e){const r=i.prev,o=i,s=i.next;if(N(r,o,s)>=0)return!1;const c=r.x,h=o.x,a=s.x,l=r.y,f=o.y,y=s.y,x=Math.min(c,h,a),u=Math.min(l,f,y),m=Math.max(c,h,a),d=Math.max(l,f,y),k=$t(x,u,n,t,e),v=$t(m,d,n,t,e);let M=i.prevZ,w=i.nextZ;for(;M&&M.z>=k&&w&&w.z<=v;){if(M.x>=x&&M.x<=m&&M.y>=u&&M.y<=d&&M!==r&&M!==s&&ct(c,l,h,f,a,y,M.x,M.y)&&N(M.prev,M,M.next)>=0||(M=M.prevZ,w.x>=x&&w.x<=m&&w.y>=u&&w.y<=d&&w!==r&&w!==s&&ct(c,l,h,f,a,y,w.x,w.y)&&N(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;M&&M.z>=k;){if(M.x>=x&&M.x<=m&&M.y>=u&&M.y<=d&&M!==r&&M!==s&&ct(c,l,h,f,a,y,M.x,M.y)&&N(M.prev,M,M.next)>=0)return!1;M=M.prevZ}for(;w&&w.z<=v;){if(w.x>=x&&w.x<=m&&w.y>=u&&w.y<=d&&w!==r&&w!==s&&ct(c,l,h,f,a,y,w.x,w.y)&&N(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Le(i,n){let t=i;do{const e=t.prev,r=t.next.next;!it(e,r)&&Ut(e,t,t.next,r)&&ht(e,r)&&ht(r,e)&&(n.push(e.i,t.i,r.i),at(t),at(t.next),t=i=r),t=t.next}while(t!==i);return H(t)}function Ee(i,n,t,e,r,o){let s=i;do{let c=s.next.next;for(;c!==s.prev;){if(s.i!==c.i&&Ze(s,c)){let h=Xt(s,c);s=H(s,s.next),h=H(h,h.next),ot(s,n,t,e,r,o,0),ot(h,n,t,e,r,o,0);return}c=c.next}s=s.next}while(s!==i)}function $e(i,n,t,e){const r=[];for(let o=0,s=n.length;o<s;o++){const c=n[o]*e,h=o<s-1?n[o+1]*e:i.length,a=jt(i,c,h,e,!1);a===a.next&&(a.steiner=!0),r.push(Re(a))}r.sort(Ne);for(let o=0;o<r.length;o++)t=De(r[o],t);return t}function Ne(i,n){let t=i.x-n.x;if(t===0&&(t=i.y-n.y,t===0)){const e=(i.next.y-i.y)/(i.next.x-i.x),r=(n.next.y-n.y)/(n.next.x-n.x);t=e-r}return t}function De(i,n){const t=Oe(i,n);if(!t)return n;const e=Xt(t,i);return H(e,e.next),H(t,t.next)}function Oe(i,n){let t=n;const e=i.x,r=i.y;let o=-1/0,s;if(it(i,t))return t;do{if(it(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=e&&f>o&&(o=f,s=t.x<t.next.x?t:t.next,f===e))return s}t=t.next}while(t!==n);if(!s)return null;const c=s,h=s.x,a=s.y;let l=1/0;t=s;do{if(e>=t.x&&t.x>=h&&e!==t.x&&Vt(r<a?e:o,r,h,a,r<a?o:e,r,t.x,t.y)){const f=Math.abs(r-t.y)/(e-t.x);ht(t,i)&&(f<l||f===l&&(t.x>s.x||t.x===s.x&&qe(s,t)))&&(s=t,l=f)}t=t.next}while(t!==c);return s}function qe(i,n){return N(i.prev,i,n.prev)<0&&N(n.next,i,i.next)<0}function Fe(i,n,t,e){let r=i;do r.z===0&&(r.z=$t(r.x,r.y,n,t,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,ze(r)}function ze(i){let n,t=1;do{let e=i,r;i=null;let o=null;for(n=0;e;){n++;let s=e,c=0;for(let a=0;a<t&&(c++,s=s.nextZ,!!s);a++);let h=t;for(;c>0||h>0&&s;)c!==0&&(h===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,c--):(r=s,s=s.nextZ,h--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;e=s}o.nextZ=null,t*=2}while(n>1);return i}function $t(i,n,t,e,r){return i=(i-t)*r|0,n=(n-e)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,i|n<<1}function Re(i){let n=i,t=i;do(n.x<t.x||n.x===t.x&&n.y<t.y)&&(t=n),n=n.next;while(n!==i);return t}function Vt(i,n,t,e,r,o,s,c){return(r-s)*(n-c)>=(i-s)*(o-c)&&(i-s)*(e-c)>=(t-s)*(n-c)&&(t-s)*(o-c)>=(r-s)*(e-c)}function ct(i,n,t,e,r,o,s,c){return!(i===s&&n===c)&&Vt(i,n,t,e,r,o,s,c)}function Ze(i,n){return i.next.i!==n.i&&i.prev.i!==n.i&&!_e(i,n)&&(ht(i,n)&&ht(n,i)&&Ge(i,n)&&(N(i.prev,i,n.prev)||N(i,n.prev,n))||it(i,n)&&N(i.prev,i,i.next)>0&&N(n.prev,n,n.next)>0)}function N(i,n,t){return(n.y-i.y)*(t.x-n.x)-(n.x-i.x)*(t.y-n.y)}function it(i,n){return i.x===n.x&&i.y===n.y}function Ut(i,n,t,e){const r=pt(N(i,n,t)),o=pt(N(i,n,e)),s=pt(N(t,e,i)),c=pt(N(t,e,n));return!!(r!==o&&s!==c||r===0&&xt(i,t,n)||o===0&&xt(i,e,n)||s===0&&xt(t,i,e)||c===0&&xt(t,n,e))}function xt(i,n,t){return n.x<=Math.max(i.x,t.x)&&n.x>=Math.min(i.x,t.x)&&n.y<=Math.max(i.y,t.y)&&n.y>=Math.min(i.y,t.y)}function pt(i){return i>0?1:i<0?-1:0}function _e(i,n){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==n.i&&t.next.i!==n.i&&Ut(t,t.next,i,n))return!0;t=t.next}while(t!==i);return!1}function ht(i,n){return N(i.prev,i,i.next)<0?N(i,n,i.next)>=0&&N(i,i.prev,n)>=0:N(i,n,i.prev)<0||N(i,i.next,n)<0}function Ge(i,n){let t=i,e=!1;const r=(i.x+n.x)/2,o=(i.y+n.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(e=!e),t=t.next;while(t!==i);return e}function Xt(i,n){const t=Nt(i.i,i.x,i.y),e=Nt(n.i,n.x,n.y),r=i.next,o=n.prev;return i.next=n,n.prev=i,t.next=r,r.prev=t,e.next=t,t.prev=e,o.next=e,e.prev=o,e}function Bt(i,n,t,e){const r=Nt(i,n,t);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function at(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,n,t){return{i,x:n,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function je(i,n,t,e){let r=0;for(let o=n,s=t-e;o<t;o+=e)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function Wt(i,n={}){let{vertices:t=[],indices:e=[],holes:r=[],verticesStride:o=2,verticesOffset:s=0,indicesOffset:c=0}=n;const h=ke(i,r,2);if(h){for(let l=0;l<h.length;l+=3)e[c++]=h[l]+s,e[c++]=h[l+1]+s,e[c++]=h[l+2]+s;let a=s*o;for(let l=0;l<i.length;l+=2)t[a]=i[l],t[a+1]=i[l+1],a+=o}return{vertices:t,indices:e}}const Ve=8,gt=11920929e-14,Ue=1;function Ht(i,n,t,e,r,o,s,c,h=.5,a){const f=Math.min(.99,Math.max(0,h));let y=(Ue-f)/1;return y*=y,Dt(i,n,t,e,r,o,s,c,a,y,0),a.push(s,c),a}function Dt(i,n,t,e,r,o,s,c,h,a,l){if(l>Ve)return;const f=(i+t)/2,y=(n+e)/2,x=(t+r)/2,u=(e+o)/2,m=(r+s)/2,d=(o+c)/2,k=(f+x)/2,v=(y+u)/2,M=(x+m)/2,w=(u+d)/2,S=(k+M)/2,L=(v+w)/2;if(l>0){let p=s-i,g=c-n;const F=Math.abs((t-s)*g-(e-c)*p),z=Math.abs((r-s)*g-(o-c)*p);if(F>gt&&z>gt){if((F+z)*(F+z)<=a*(p*p+g*g)){h.push(S,L);return}}else if(F>gt){if(F*F<=a*(p*p+g*g)){h.push(S,L);return}}else if(z>gt){if(z*z<=a*(p*p+g*g)){h.push(S,L);return}}else if(p=S-(i+s)/2,g=L-(n+c)/2,p*p+g*g<=a){h.push(S,L);return}}Dt(i,n,f,y,k,v,S,L,h,a,l+1),Dt(S,L,M,w,m,d,s,c,h,a,l+1)}const Xe=8,Be=11920929e-14,We=1;function Qt(i,n,t,e,r,o,s=.5,c){const a=Math.min(.99,Math.max(0,s));let l=(We-a)/1;return l*=l,Ot(c,i,n,t,e,r,o,l,0),c.push(r,o),c}function Ot(i,n,t,e,r,o,s,c,h){if(h>Xe)return;const a=(n+e)/2,l=(t+r)/2,f=(e+o)/2,y=(r+s)/2,x=(a+f)/2,u=(l+y)/2;let m=o-n,d=s-t;const k=Math.abs((e-o)*d-(r-s)*m);if(k>Be){if(k*k<=c*(m*m+d*d)){i.push(x,u);return}}else if(m=x-(n+o)/2,d=u-(t+s)/2,m*m+d*d<=c){i.push(x,u);return}Ot(i,n,t,a,l,x,u,c,h+1),Ot(i,x,u,f,y,o,s,c,h+1)}function He(i,n){const t=1-i;return t*t*n}function Qe(i,n){return 2*(1-i)*i*n}function Ye(i,n){return i*i*n}function qt(i,n,t,e){return He(i,n)+Qe(i,t)+Ye(i,e)}const Je=1e-4,Yt=1e-4;function Jt(i,n={}){const{vertices:t=[],indices:e=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=n,c=Je;if(i.length===0)return{vertices:t,indices:e};const h=r;let a=h.alignment;if(r.alignment!==.5){let $=Ke(i);o&&($*=-1),a=(a-.5)*$+.5}const l={x:i[0],y:i[1]},f={x:i[i.length-2],y:i[i.length-1]},y=s,x=Math.abs(l.x-f.x)<c&&Math.abs(l.y-f.y)<c;if(y){i=i.slice(),x&&(i.pop(),i.pop(),f.x=i[i.length-2],f.y=i[i.length-1]);const $=(l.x+f.x)*.5,W=(f.y+l.y)*.5;i.unshift($,W),i.push($,W)}const u=t,m=i.length/2;let d=i.length;const k=u.length/2,v=h.width/2,M=v*v,w=h.miterLimit*h.miterLimit;let S=i[0],L=i[1],p=i[2],g=i[3],F=0,z=0,b=-(L-g),C=S-p,D=0,R=0,V=Math.sqrt(b*b+C*C);b/=V,C/=V,b*=v,C*=v;const de=a,T=(1-de)*2,I=de*2;y||(h.cap==="round"?d+=Q(S-b*(T-I)*.5,L-C*(T-I)*.5,S-b*T,L-C*T,S+b*I,L+C*I,u,!0)+2:h.cap==="square"&&(d+=Kt(S,L,b,C,T,I,!0,u))),u.push(S-b*T,L-C*T),u.push(S+b*I,L+C*I);for(let $=1;$<m-1;++$){S=i[($-1)*2],L=i[($-1)*2+1],p=i[$*2],g=i[$*2+1],F=i[($+1)*2],z=i[($+1)*2+1],b=-(L-g),C=S-p,V=Math.sqrt(b*b+C*C),b/=V,C/=V,b*=v,C*=v,D=-(g-z),R=p-F,V=Math.sqrt(D*D+R*R),D/=V,R/=V,D*=v,R*=v;const W=p-S,lt=L-g,ut=p-F,ft=z-g,me=W*ut+lt*ft,Tt=lt*ut-ft*W,yt=Tt<0;if(Math.abs(Tt)<.001*Math.abs(me)){u.push(p-b*T,g-C*T),u.push(p+b*I,g+C*I),me>=0&&(h.join==="round"?d+=Q(p,g,p-b*T,g-C*T,p-D*T,g-R*T,u,!1)+4:d+=2,u.push(p-D*I,g-R*I),u.push(p+D*T,g+R*T));continue}const Me=(-b+S)*(-C+g)-(-b+p)*(-C+L),Pe=(-D+F)*(-R+g)-(-D+p)*(-R+z),bt=(W*Pe-ut*Me)/Tt,Ct=(ft*Me-lt*Pe)/Tt,Rt=(bt-p)*(bt-p)+(Ct-g)*(Ct-g),J=p+(bt-p)*T,K=g+(Ct-g)*T,tt=p-(bt-p)*I,et=g-(Ct-g)*I,Cn=Math.min(W*W+lt*lt,ut*ut+ft*ft),we=yt?T:I,An=Cn+we*we*M;Rt<=An?h.join==="bevel"||Rt/M>w?(yt?(u.push(J,K),u.push(p+b*I,g+C*I),u.push(J,K),u.push(p+D*I,g+R*I)):(u.push(p-b*T,g-C*T),u.push(tt,et),u.push(p-D*T,g-R*T),u.push(tt,et)),d+=2):h.join==="round"?yt?(u.push(J,K),u.push(p+b*I,g+C*I),d+=Q(p,g,p+b*I,g+C*I,p+D*I,g+R*I,u,!0)+4,u.push(J,K),u.push(p+D*I,g+R*I)):(u.push(p-b*T,g-C*T),u.push(tt,et),d+=Q(p,g,p-b*T,g-C*T,p-D*T,g-R*T,u,!1)+4,u.push(p-D*T,g-R*T),u.push(tt,et)):(u.push(J,K),u.push(tt,et)):(u.push(p-b*T,g-C*T),u.push(p+b*I,g+C*I),h.join==="round"?yt?d+=Q(p,g,p+b*I,g+C*I,p+D*I,g+R*I,u,!0)+2:d+=Q(p,g,p-b*T,g-C*T,p-D*T,g-R*T,u,!1)+2:h.join==="miter"&&Rt/M<=w&&(yt?(u.push(tt,et),u.push(tt,et)):(u.push(J,K),u.push(J,K)),d+=2),u.push(p-D*T,g-R*T),u.push(p+D*I,g+R*I),d+=2)}S=i[(m-2)*2],L=i[(m-2)*2+1],p=i[(m-1)*2],g=i[(m-1)*2+1],b=-(L-g),C=S-p,V=Math.sqrt(b*b+C*C),b/=V,C/=V,b*=v,C*=v,u.push(p-b*T,g-C*T),u.push(p+b*I,g+C*I),y||(h.cap==="round"?d+=Q(p-b*(T-I)*.5,g-C*(T-I)*.5,p-b*T,g-C*T,p+b*I,g+C*I,u,!1)+2:h.cap==="square"&&(d+=Kt(p,g,b,C,T,I,!1,u)));const bn=Yt*Yt;for(let $=k;$<d+k-2;++$)S=u[$*2],L=u[$*2+1],p=u[($+1)*2],g=u[($+1)*2+1],F=u[($+2)*2],z=u[($+2)*2+1],!(Math.abs(S*(g-z)+p*(z-L)+F*(L-g))<bn)&&e.push($,$+1,$+2);return{vertices:t,indices:e}}function Ke(i){const n=i.length;if(n<6)return 1;let t=0;for(let e=0,r=i[n-2],o=i[n-1];e<n;e+=2){const s=i[e],c=i[e+1];t+=(s-r)*(c+o),r=s,o=c}return t<0?-1:1}function Kt(i,n,t,e,r,o,s,c){const h=i-t*r,a=n-e*r,l=i+t*o,f=n+e*o;let y,x;s?(y=e,x=-t):(y=-e,x=t);const u=h+y,m=a+x,d=l+y,k=f+x;return c.push(u,m),c.push(d,k),2}function Q(i,n,t,e,r,o,s,c){const h=t-i,a=e-n;let l=Math.atan2(h,a),f=Math.atan2(r-i,o-n);c&&l<f?l+=Math.PI*2:!c&&l>f&&(f+=Math.PI*2);let y=l;const x=f-l,u=Math.abs(x),m=Math.sqrt(h*h+a*a),d=(15*u*Math.sqrt(m)/Math.PI>>0)+1,k=x/d;if(y+=k,c){s.push(i,n),s.push(t,e);for(let v=1,M=y;v<d;v++,M+=k)s.push(i,n),s.push(i+Math.sin(M)*m,n+Math.cos(M)*m);s.push(i,n),s.push(r,o)}else{s.push(t,e),s.push(i,n);for(let v=1,M=y;v<d;v++,M+=k)s.push(i+Math.sin(M)*m,n+Math.cos(M)*m),s.push(i,n);s.push(r,o),s.push(i,n)}return d*2}class Y{constructor(){O(this,"startT",0);O(this,"endT",1);O(this,"arcLengthDivision",200);O(this,"_arcLengths")}getPointAt(n,t=new P){return this.getPoint(this.getUToTMapping(n),t)}isClockwise(){const n=this.getPoint(1),t=this.getPoint(.5),e=this.getPoint(1);return(t.x-n.x)*(e.y-t.y)-(t.y-n.y)*(e.x-t.x)<0}getControlPointRefs(){return[]}getUnevenPointArray(n=5,t=[]){const e=new P;for(let r=0,o=Math.max(1,n)-1;r<=o;r++)this.getPoint(r/o,e),t.push(e.x,e.y);return t}getSpacedPointArray(n=5,t=[]){const e=new P;for(let r=0,o=Math.max(1,n)-1;r<=o;r++)this.getPointAt(r/o,e),t.push(e.x,e.y);return t}getAdaptivePointArray(n=[]){return this.getUnevenPointArray(5,n)}_pointArrayToPoint(n,t=[]){for(let e=0,r=n.length;e<r;e+=2){const o=n[e],s=n[e+1];t.push(new P(o,s))}return t}getSpacedPoints(n,t=[]){const e=this.getSpacedPointArray(n);return this._pointArrayToPoint(e,t),t}getUnevenPoints(n,t=[]){const e=this.getUnevenPointArray(n);return this._pointArrayToPoint(e,t),t}getAdaptivePoints(n=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,n),n}getPoints(n,t=[]){let e;return n?e=this.getUnevenPointArray(n):e=this.getAdaptivePointArray(),this._pointArrayToPoint(e,t),t}getLength(){const n=this.getLengths();return n[n.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const n=this.arcLengthDivision,t=[0];for(let e=0,r=this.getPoint(0),o=1;o<=n;o++){const s=this.getPoint(o/n);e+=s.distanceTo(r),t.push(e),r=s}this._arcLengths=t}getUToTMapping(n,t){const e=this.getLengths(),r=e.length,o=t??n*e[r-1];if(r<2)return o/e[0];let s=0,c=0,h=r-1,a;for(;c<=h;)if(s=Math.floor(c+(h-c)/2),a=e[s]-o,a<0)c=s+1;else if(a>0)h=s-1;else{h=s;break}if(s=h,e[s]===o)return s/(r-1);const l=e[s],y=e[s+1]-l,x=(o-l)/y;return(s+x)/(r-1)}getTangent(n,t=new P){const r=Math.max(0,n-1e-4),o=Math.min(1,n+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(n,t){return this.getTangent(this.getUToTMapping(n),t)}getNormal(n,t=new P){return this.getTangent(n,t),t.set(-t.y,t.x).normalize()}getNormalAt(n,t){return this.getNormal(this.getUToTMapping(n),t)}getTForPoint(n,t=.001){let e=0,r=1,o=(e+r)/2;for(;r-e>t;){o=(e+r)/2;const s=this.getPoint(o);if(s.distanceTo(n)<t)return o;s.x<n.x?e=o:r=o}return o}matrix(n){return this.getControlPointRefs().forEach(t=>t.applyMatrix3(n)),this}getMinMax(n=P.MAX,t=P.MIN){const e=this.getPoints();for(let r=0,o=e.length;r<o;r++){const s=e[r];n.min(s),t.max(s)}return{min:n,max:t}}getBoundingBox(){const{min:n,max:t}=this.getMinMax();return new B(n.x,n.y,t.x-n.x,t.y-n.y)}fillTriangulate(n){return Wt(this.getPoints().reduce((t,e)=>(t.push(e.x,e.y),t),[]),n)}strokeTriangulate(n){return Jt(this.getPoints().reduce((t,e)=>(t.push(e.x,e.y),t),[]),n)}toCommands(){const n=[],t=this.getPoints();for(let e=0,r=t.length;e<r;e++){const o=t[e];e===0?n.push({type:"M",x:o.x,y:o.y}):n.push({type:"L",x:o.x,y:o.y})}return n}toData(){return Gt(this.toCommands())}drawTo(n){return this.toCommands().forEach(t=>{switch(t.type){case"M":n.moveTo(t.x,t.y);break;case"L":n.lineTo(t.x,t.y);break}}),this}copy(n){return this.arcLengthDivision=n.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const tn=new _,te=new _,ee=new _,dt=new P;class Ft extends Y{constructor(t=0,e=0,r=1,o=1,s=0,c=0,h=Math.PI*2,a=!1){super();O(this,"center");O(this,"radius");this.rotation=s,this.startAngle=c,this.endAngle=h,this.clockwise=a,this.center=new P(t,e),this.radius=new P(r,o)}isClockwise(){return this.clockwise}getPoint(t,e=new P){const r=Math.PI*2;let o=this.endAngle-this.startAngle;const s=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=r;for(;o>r;)o-=r;o<Number.EPSILON&&(s?o=0:o=r),this.clockwise&&!s&&(o===r?o=-r:o=o-r);const c=this.startAngle+t*o;let h=this.center.x+this.radius.x*Math.cos(c),a=this.center.y+this.radius.y*Math.sin(c);if(this.rotation!==0){const l=Math.cos(this.rotation),f=Math.sin(this.rotation),y=h-this.center.x,x=a-this.center.y;h=y*l-x*f+this.center.x,a=y*f+x*l+this.center.y}return e.set(h,a)}toCommands(){const{center:t,radius:e,startAngle:r,endAngle:o,clockwise:s,rotation:c}=this,{x:h,y:a}=t,{x:l,y:f}=e,y=h+l*Math.cos(r)*Math.cos(c)-f*Math.sin(r)*Math.sin(c),x=a+l*Math.cos(r)*Math.sin(c)+f*Math.sin(r)*Math.cos(c),u=Math.abs(r-o),m=u>Math.PI?1:0,d=s?1:0,k=c*180/Math.PI;if(u>=2*Math.PI){const v=r+Math.PI,M=h+l*Math.cos(v)*Math.cos(c)-f*Math.sin(v)*Math.sin(c),w=a+l*Math.cos(v)*Math.sin(c)+f*Math.sin(v)*Math.cos(c);return[{type:"M",x:y,y:x},{type:"A",rx:l,ry:f,angle:k,largeArcFlag:0,sweepFlag:d,x:M,y:w},{type:"A",rx:l,ry:f,angle:k,largeArcFlag:0,sweepFlag:d,x:y,y:x}]}else{const v=h+l*Math.cos(o)*Math.cos(c)-f*Math.sin(o)*Math.sin(c),M=a+l*Math.cos(o)*Math.sin(c)+f*Math.sin(o)*Math.cos(c);return[{type:"M",x:y,y:x},{type:"A",rx:l,ry:f,angle:k,largeArcFlag:m,sweepFlag:d,x:v,y:M}]}}drawTo(t){const{center:e,radius:r,rotation:o,startAngle:s,endAngle:c,clockwise:h}=this;return t.ellipse(e.x,e.y,r.x,r.y,o,s,c,!h),this}matrix(t){return dt.set(this.center.x,this.center.y),dt.applyMatrix3(t),this.center.x=dt.x,this.center.y=dt.y,sn(t)?en(this,t):nn(this,t),this}getControlPointRefs(){return[this.center]}getAdaptivePointArray(t=[]){const e=t.length-1,r=this.center.x,o=this.center.y,s=this.radius.x,c=this.radius.y,h=0,a=0;if(!(s>=0&&c>=0&&h>=0&&a>=0))return t;const l=Math.ceil(2.3*Math.sqrt(s+c)),f=l*8+0+0;if(f===0)return t;if(l===0)return t[e]=t[e+6]=r+h,t[e+1]=t[e+3]=o+a,t[e+2]=t[e+4]=r-h,t[e+5]=t[e+7]=o-a,t;let y=e,x=l*4+0+2+e,u=x,m=f+e,d=h+s,k=a,v=r+d,M=r-d,w=o+k;t[y++]=v,t[y++]=w,t[--x]=w,t[--x]=M;for(let L=1;L<l;L++){const p=Math.PI/2*(L/l),g=h+Math.cos(p)*s,F=a+Math.sin(p)*c,z=r+g,b=r-g,C=o+F,D=o-F;t[y++]=z,t[y++]=C,t[--x]=C,t[--x]=b,t[u++]=b,t[u++]=D,t[--m]=D,t[--m]=z}d=h,k=a+c,v=r+d,M=r-d,w=o+k;const S=o-k;return t[y++]=v,t[y++]=w,t[--m]=S,t[--m]=v,t}fillTriangulate(t={}){let{vertices:e=[],indices:r=[],verticesStride:o=2,verticesOffset:s=0,indicesOffset:c=0}=t;const h=this.getAdaptivePointArray();if(h.length===0)return{vertices:e,indices:r};let a=0,l=0;for(let x=0;x<h.length;x+=2)a+=h[x],l+=h[x+1];a/=h.length/2,l/=h.length/2;let f=s;e[f*o]=a,e[f*o+1]=l;const y=f++;for(let x=0;x<h.length;x+=2)e[f*o]=h[x],e[f*o+1]=h[x+1],x>0&&(r[c++]=f,r[c++]=y,r[c++]=f-1),f++;return r[c++]=y+1,r[c++]=y,r[c++]=f-1,{vertices:e,indices:r}}getMinMax(t=P.MAX,e=P.MIN){const{center:r,radius:o,rotation:s}=this,{x:c,y:h}=o,{x:a,y:l}=r,f=Math.cos(s),y=Math.sin(s),x=Math.sqrt(c*c*f*f+h*h*y*y),u=Math.sqrt(c*c*y*y+h*h*f*f);return t.x=Math.min(t.x,a-x),t.y=Math.min(t.y,l-u),e.x=Math.max(e.x,a+x),e.y=Math.max(e.y,l+u),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radius.x=t.radius.x,this.radius.y=t.radius.y,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function en(i,n){const t=i.radius.x,e=i.radius.y,r=Math.cos(i.rotation),o=Math.sin(i.rotation),s=new P(t*r,t*o),c=new P(-e*o,e*r),h=s.applyMatrix3(n),a=c.applyMatrix3(n),l=tn.set(h.x,a.x,0,h.y,a.y,0,0,0,1),f=te.copy(l).invert(),u=ee.copy(f).transpose().multiply(f).elements,m=rn(u[0],u[1],u[4]),d=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(i.radius.x=1/d,i.radius.y=1/k,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const M=te.set(d,0,0,0,k,0,0,0,1),w=ee.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),S=M.multiply(w).multiply(l),L=p=>{const{x:g,y:F}=new P(Math.cos(p),Math.sin(p)).applyMatrix3(S);return Math.atan2(F,g)};i.startAngle=L(i.startAngle),i.endAngle=L(i.endAngle),ne(n)&&(i.clockwise=!i.clockwise)}}function nn(i,n){const t=se(n),e=ie(n);i.radius.x*=t,i.radius.y*=e;const r=t>Number.EPSILON?Math.atan2(n.elements[1],n.elements[0]):Math.atan2(-n.elements[3],n.elements[4]);i.rotation+=r,ne(n)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function ne(i){const n=i.elements;return n[0]*n[4]-n[1]*n[3]<0}function sn(i){const n=i.elements,t=n[0]*n[3]+n[1]*n[4];if(t===0)return!1;const e=se(i),r=ie(i);return Math.abs(t/(e*r))>Number.EPSILON}function se(i){const n=i.elements;return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function ie(i){const n=i.elements;return Math.sqrt(n[3]*n[3]+n[4]*n[4])}function rn(i,n,t){let e,r,o,s,c;const h=i+t,a=i-t,l=Math.sqrt(a*a+4*n*n);return h>0?(e=.5*(h+l),c=1/e,r=i*c*t-n*c*n):h<0?r=.5*(h-l):(e=.5*l,r=-.5*l),a>0?o=a+l:o=a-l,Math.abs(o)>2*Math.abs(n)?(c=-2*n/o,s=1/Math.sqrt(1+c*c),o=c*s):Math.abs(n)===0?(o=1,s=0):(c=-.5*o/n,o=1/Math.sqrt(1+c*c),s=c*o),a>0&&(c=o,o=-s,s=c),{rt1:e,rt2:r,cs:o,sn:s}}class re extends Ft{constructor(n=0,t=0,e=1,r=0,o=Math.PI*2,s=!1){super(n,t,e,e,0,r,o,s)}getAdaptivePointArray(n=[]){const r=this.center.x,o=this.center.y,s=this.clockwise,c=this.radius.x;let h=Math.abs(-1);s&&(h=2*Math.PI-h);let a=Math.max(6,Math.floor(6*c**(1/3)*(h/Math.PI)));a=Math.max(a,3);let l=h/a,f=0;l*=s?-1:1;for(let y=0;y<a+1;y++){const x=Math.cos(f),u=Math.sin(f),m=r+x*c,d=o+u*c;n.push(m,d),f+=l}return n}}class mt extends Y{constructor(n=[]){super(),this.curves=n}addCurve(n){return this.curves.push(n),this}getPoint(n,t=new P){const e=n*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=e){const s=r[o]-e,c=this.curves[o],h=c.getLength();return c.getPointAt(h===0?0:1-s/h,t)}o++}return t}updateLengths(){const n=[];for(let t=0,e=0,r=this.curves.length;t<r;t++)e+=this.curves[t].getLength(),n.push(e);this._arcLengths=n}getControlPointRefs(){return this.curves.flatMap(n=>n.getControlPointRefs())}getAdaptivePointArray(n=[]){let t;return this.curves.forEach(e=>{e.getAdaptivePointArray(n),t&&n[t-1]===n[t+1]&&n[t]===n[t+2]&&n.splice(t+1,2),t=n.length-1}),n}getMinMax(n=P.MAX,t=P.MIN){return this.curves.forEach(e=>e.getMinMax(n,t)),{min:n,max:t}}getBoundingBox(){const{min:n,max:t}=this.getMinMax();return new B(n.x,n.y,t.x-n.x,t.y-n.y)}toCommands(){return this.curves.flatMap(n=>n.toCommands())}drawTo(n){var e;const t=(e=this.curves[0])==null?void 0:e.getPoint(0);return t&&n.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(n)),this}}class Mt extends Y{constructor(t,e,r,o,s,c,h,a){super();O(this,"p1");O(this,"cp1");O(this,"cp2");O(this,"p2");this.p1=new P(t,e),this.cp1=new P(r,o),this.cp2=new P(s,c),this.p2=new P(h,a)}static from(t,e,r,o){return new Mt(t.x,t.y,e.x,e.y,r.x,r.y,o.x,o.y)}getPoint(t,e=new P){const{p1:r,cp1:o,cp2:s,p2:c}=this;return e.set(Et(t,r.x,o.x,s.x,c.x),Et(t,r.y,o.y,s.y,c.y))}getAdaptivePointArray(t=[]){return Ht(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,r){const o=e*e-4*t*r;if(o<0)return[];const s=Math.sqrt(o),c=(-e+s)/(2*t),h=(-e-s)/(2*t);return[c,h].filter(a=>a>=0&&a<=1)}getMinMax(t=P.MAX,e=P.MIN){const{p1:r,cp1:o,cp2:s,p2:c}=this,h=this._solveQuadratic(3*(o.x-r.x),6*(s.x-o.x),3*(c.x-s.x)),a=this._solveQuadratic(3*(o.y-r.y),6*(s.y-o.y),3*(c.y-s.y)),l=[0,1,...h,...a];return((y,x)=>{for(const u of y)for(let m=0;m<=x;m++){const d=m/x-.5,k=Math.min(1,Math.max(0,u+d)),v=this.getPoint(k);t.x=Math.min(t.x,v.x),t.y=Math.min(t.y,v.y),e.x=Math.max(e.x,v.x),e.y=Math.max(e.y,v.y)}})(l,10),{min:t,max:e}}toCommands(){const{p1:t,cp1:e,cp2:r,p2:o}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:o.x,y:o.y}]}drawTo(t){const{p1:e,cp1:r,cp2:o,p2:s}=this;return t.lineTo(e.x,e.y),t.bezierCurveTo(r.x,r.y,o.x,o.y,s.x,s.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 U extends Y{constructor(t,e,r,o){super();O(this,"p1");O(this,"p2");this.p1=new P(t,e),this.p2=new P(r,o)}static from(t,e){return new U(t.x,t.y,e.x,e.y)}getPoint(t,e=new P){return t===1?e.copy(this.p2):e.copy(this.p2).sub(this.p1).scale(t).add(this.p1),e}getPointAt(t,e=new P){return this.getPoint(t,e)}getTangent(t,e=new P){return e.subVectors(this.p2,this.p1).normalize()}getTangentAt(t,e=new P){return this.getTangent(t,e)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(t=[]){return t.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),t}getMinMax(t=P.MAX,e=P.MIN){const{p1:r,p2:o}=this;return t.x=Math.min(t.x,r.x,o.x),t.y=Math.min(t.y,r.y,o.y),e.x=Math.max(e.x,r.x,o.x),e.y=Math.max(e.y,r.y,o.y),{min:t,max:e}}toCommands(){const{p1:t,p2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{p1:e,p2:r}=this;return t.lineTo(e.x,e.y),t.lineTo(r.x,r.y),this}copy(t){return super.copy(t),this.p1.copy(t.p1),this.p2.copy(t.p2),this}}class Pt extends mt{static equilateral(n=0,t=0,e=1,r=3){const o=new Pt,s=[];for(let c=0;c<r;c++){const h=c*2*Math.PI/r-.5*Math.PI;s.push(new P(e*Math.cos(h),e*Math.sin(h)).add({x:n,y:t}))}for(let c=0;c<r;c++)o.curves.push(U.from(s[c],s[(c+1)%r]));return o}}class wt extends Y{constructor(t,e,r,o,s,c){super();O(this,"p1");O(this,"cp");O(this,"p2");this.p1=new P(t,e),this.cp=new P(r,o),this.p2=new P(s,c)}static from(t,e,r){return new wt(t.x,t.y,e.x,e.y,r.x,r.y)}getPoint(t,e=new P){const{p1:r,cp:o,p2:s}=this;return e.set(qt(t,r.x,o.x,s.x),qt(t,r.y,o.y,s.y)),e}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(t=[]){return Qt(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,t)}getMinMax(t=P.MAX,e=P.MIN){const{p1:r,cp:o,p2:s}=this,c=.5*(r.x+o.x),h=.5*(r.y+o.y),a=.5*(r.x+s.x),l=.5*(r.y+s.y);return t.x=Math.min(t.x,r.x,s.x,c,a),t.y=Math.min(t.y,r.y,s.y,h,l),e.x=Math.max(e.x,r.x,s.x,c,a),e.y=Math.max(e.y,r.y,s.y,h,l),{min:t,max:e}}toCommands(){const{p1:t,cp:e,p2:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{p1:e,cp:r,p2:o}=this;return t.lineTo(e.x,e.y),t.quadraticCurveTo(r.x,r.y,o.x,o.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 oe extends Pt{constructor(n=0,t=0,e=0,r=0){const o=[new P(n,t),new P(n+e,t),new P(n+e,t+r),new P(n,t+r)];super([U.from(o[0],o[1]),U.from(o[1],o[2]),U.from(o[2],o[3]),U.from(o[3],o[0])]),this.x=n,this.y=t,this.width=e,this.height=r}fillTriangulate(n={}){let{vertices:t=[],indices:e=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=n;const{x:c,y:h,width:a,height:l}=this,f=[c,h,c+a,h,c+a,h+l,c,h+l];let y=0;o*=r,t[o+y]=f[0],t[o+y+1]=f[1],y+=r,t[o+y]=f[2],t[o+y+1]=f[3],y+=r,t[o+y]=f[6],t[o+y+1]=f[7],y+=r,t[o+y]=f[4],t[o+y+1]=f[5],y+=r;const x=o/r;return e[s++]=x,e[s++]=x+1,e[s++]=x+2,e[s++]=x+1,e[s++]=x+3,e[s++]=x+2,{vertices:t,indices:e}}}class ce extends Y{constructor(n=[]){super(),this.points=n}getPoint(n,t=new P){const{points:e}=this,r=(e.length-1)*n,o=Math.floor(r),s=r-o,c=e[o===0?o:o-1],h=e[o],a=e[o>e.length-2?e.length-1:o+1],l=e[o>e.length-3?e.length-1:o+2];return t.set(Lt(s,c.x,h.x,a.x,l.x),Lt(s,c.y,h.y,a.y,l.y)),t}getControlPointRefs(){return this.points}copy(n){super.copy(n),this.points=[];for(let t=0,e=n.points.length;t<e;t++)this.points.push(n.points[t].clone());return this}}class rt extends mt{constructor(t){super();O(this,"startPoint");O(this,"currentPoint");O(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:o,y:s}=t[e];this.lineTo(o,s)}return this}addCommands(t){return It(t,this),this}addData(t){return this.addCommands(St(t)),this}getUnevenPointArray(t=40,e=[]){return super.getUnevenPointArray(t,e),this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getSpacedPointArray(t=40,e=[]){return super.getSpacedPointArray(t,e),this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}_setCurrentPoint(t){return this.currentPoint=new P(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(U.from(e,t)),e.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint=new P(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:e})||this.curves.push(new U((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,e)),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,o,s,c){const h=this.currentPoint;return h!=null&&h.equals({x:s,y:c})||this.curves.push(new Mt((h==null?void 0:h.x)??0,(h==null?void 0:h.y)??0,t,e,r,o,s,c)),this._setCurrentPoint({x:s,y:c}),this}quadraticCurveTo(t,e,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(new wt((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,e,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,e,r,o,s,c){const h=new re(t,e,r,o,s,!c);return this._connetLineTo(h),this.curves.push(h),this._setCurrentPoint(h.getPoint(1)),this}relativeArc(t,e,r,o,s,c){var h,a;return t+=((h=this.currentPoint)==null?void 0:h.x)??0,e+=((a=this.currentPoint)==null?void 0:a.y)??0,this.arc(t,e,r,o,s,c),this}arcTo(t,e,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,o,s,c,h,a=!0){const l=new Ft(t,e,r,o,s,c,h,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,o,s,c,h,a){var l,f;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,e+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,e,r,o,s,c,h,a),this}rect(t,e,r,o){const s=new oe(t,e,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){const e=this.currentPoint??new P;return this.curves.push(new ce([e].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var e;super.copy(t),this.curves=[];for(let r=0,o=t.curves.length;r<o;r++)this.curves.push(t.curves[r].clone());return this.autoClose=t.autoClose,this.currentPoint=(e=t.currentPoint)==null?void 0:e.clone(),this}}function on(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function cn(i,n,t,e){const r=n.clone().sub(i),o=e.clone().sub(t),s=t.clone().sub(i),c=r.cross(o);if(c===0)return new P((i.x+t.x)/2,(i.y+t.y)/2);const h=s.cross(o)/c;return Math.abs(h)>1?new P((i.x+t.x)/2,(i.y+t.y)/2):new P(i.x+h*r.x,i.y+h*r.y)}class j extends mt{constructor(t,e={}){super();O(this,"currentCurve",new rt);O(this,"style");this.curves.push(this.currentCurve),this.style=e,t&&(t instanceof j?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}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)}addPath(t){return t instanceof j?this.curves.push(...t.curves.map(e=>e.clone())):this.curves.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length>0&&(this.currentCurve=new rt().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,e){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:e})||(this.currentCurve.curves.length&&(this.currentCurve=new rt,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,e)),this}lineTo(t,e){return this.currentCurve.lineTo(t,e),this}bezierCurveTo(t,e,r,o,s,c){return this.currentCurve.bezierCurveTo(t,e,r,o,s,c),this}quadraticCurveTo(t,e,r,o){return this.currentCurve.quadraticCurveTo(t,e,r,o),this}arc(t,e,r,o,s,c){return this.currentCurve.arc(t,e,r,o,s,c),this}arcTo(t,e,r,o,s){return this.currentCurve.arcTo(t,e,r,o,s),this}ellipse(t,e,r,o,s,c,h,a){return this.currentCurve.ellipse(t,e,r,o,s,c,h,a),this}rect(t,e,r,o){return this.currentCurve.rect(t,e,r,o),this}addCommands(t){return It(t,this),this}addData(t){return this.addCommands(St(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,e=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,e,r)}),this}skew(t,e=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,e,r)}),this}rotate(t,e={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,e)}),this}bold(t){if(t===0)return this;const e=this.curves,r=[],o=[],s=[];e.forEach((h,a)=>{if(!h.getLength())return;const l=h.getControlPointRefs(),f=h.isClockwise();s[a]=l,o[a]=f;const y=l[0],x=l[l.length-1]??y;r.push({start:f?x:y,end:f?y:x,index:a})});const c=[];return r.forEach((h,a)=>{c[a]=[],r.forEach((l,f)=>{f!==a&&l.start.equals(h.end)&&c[a].push(l.index)})}),e.forEach((h,a)=>{if(!h.getLength())return;const l=o[a];s[a].forEach(y=>{const x=h.getTForPoint(y),u=h.getNormal(x).scale(l?t:-t);y.add(u)})}),c.forEach((h,a)=>{const l=s[a];h.forEach(f=>{const y=s[f],x=cn(l[l.length-1],l[l.length-2]??l[l.length-1],y[0],y[1]??y[0]);x&&(l[l.length-1].copy(x),y[0].copy(x))})}),this}matrix(t){return this.curves.forEach(e=>e.matrix(t)),this}getMinMax(t=P.MAX,e=P.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,e),r&&o>1){const c=o/2,h=s.isClockwise(),a=[];for(let l=0;l<=1;l+=1/s.arcLengthDivision){const f=s.getPoint(l),y=s.getNormal(l),x=y.clone().scale(h?c:-c),u=y.clone().scale(h?-c:c);a.push(f.clone().add(x),f.clone().add(u),f.clone().add({x:c,y:0}),f.clone().add({x:-c,y:0}),f.clone().add({x:0,y:c}),f.clone().add({x:0,y:-c}),f.clone().add({x:c,y:c}),f.clone().add({x:-c,y:-c}))}t.min(...a),e.max(...a)}}),{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new B(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:o="none"}=e;return t.beginPath(),t.save(),At(t,e),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:o="none"}=e;return t.beginPath(),t.save(),At(t,e),this.getControlPointRefs().forEach(s=>{Z(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="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 o in t)t[o]!==void 0&&(e[on(o)]=t[o]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in e)e[o]!==void 0&&(r+=`${o}:${e[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return this.currentCurve=t.currentCurve.clone(),this.curves=t.curves.map(e=>e.clone()),this.style={...t.style},this}clone(){return new this.constructor().copy(this)}}class he{constructor(n=[]){this.paths=n}getBoundingBox(n=!0){if(!this.paths.length)return;const t=P.MAX,e=P.MIN;return this.paths.forEach(r=>r.getMinMax(t,e,n)),new B(t.x,t.y,e.x-t.x,e.y-t.y)}toSVGString(){const{x:n,y:t,width:e,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${n} ${t} ${e} ${r}" width="${e}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(n={}){const{pixelRatio:t=2,...e}=n,{left:r,top:o,width:s,height:c}=this.getBoundingBox(),h=document.createElement("canvas");h.width=s*t,h.height=c*t,h.style.width=`${s}px`,h.style.height=`${c}px`;const a=h.getContext("2d");return a&&(a.scale(t,t),a.translate(-r,-o),this.paths.forEach(l=>{l.drawTo(a,e)})),h}}const hn="px",an=90,ae=["mm","cm","in","pt","pc","px"],le={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 n="px";if(typeof i=="string"||i instanceof String)for(let e=0,r=ae.length;e<r;e++){const o=ae[e];if(i.endsWith(o)){n=o,i=i.substring(0,i.length-o.length);break}}let t;return t=le[n][hn],t<0&&(t=le[n].in*an),t*Number.parseFloat(i)}const ln=new _,vt=new _,ue=new _,fe=new _;function un(i,n,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const e=fn(i);return t.length>0&&e.premultiply(t[t.length-1]),n.copy(e),t.push(e),e}function fn(i){const n=new _,t=ln;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&n.translate(E(i.getAttribute("x")),E(i.getAttribute("y"))),i.hasAttribute("transform")){const e=i.getAttribute("transform").split(")");for(let r=e.length-1;r>=0;r--){const o=e[r].trim();if(o==="")continue;const s=o.indexOf("("),c=o.length;if(s>0&&s<c){const h=o.slice(0,s),a=G(o.slice(s+1));switch(t.identity(),h){case"translate":if(a.length>=1){const l=a[0];let f=0;a.length>=2&&(f=a[1]),t.translate(l,f)}break;case"rotate":if(a.length>=1){let l=0,f=0,y=0;l=a[0]*Math.PI/180,a.length>=3&&(f=a[1],y=a[2]),vt.makeTranslation(-f,-y),ue.makeRotation(l),fe.multiplyMatrices(ue,vt),vt.makeTranslation(f,y),t.multiplyMatrices(vt,fe)}break;case"scale":a.length>=1&&t.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&t.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&t.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&t.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}n.premultiply(t)}}return n}function yn(i){return new j().addPath(new rt().arc(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("r")||0),0,Math.PI*2))}function xn(i,n){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const e=i.sheet.cssRules[t];if(e.type!==1)continue;const r=e.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=e.style.length,c=0;c<s;c++){const h=e.style.item(c);o[h]=e.style.getPropertyValue(h)}for(let s=0;s<r.length;s++)n[r[s]]=Object.assign(n[r[s]]||{},{...o})}}function pn(i){return new j().addPath(new rt().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 gn(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 dn(i){const n=new j,t=i.getAttribute("d");return!t||t==="none"?null:(n.addData(t),n)}const mn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Mn(i){var e;const n=new j;let t=0;return(e=i.getAttribute("points"))==null||e.replace(mn,(r,o,s)=>{const c=E(o),h=E(s);return t===0?n.moveTo(c,h):n.lineTo(c,h),t++,r}),n.currentPath.autoClose=!0,n}const Pn=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function wn(i){var e;const n=new j;let t=0;return(e=i.getAttribute("points"))==null||e.replace(Pn,(r,o,s)=>{const c=E(o),h=E(s);return t===0?n.moveTo(c,h):n.lineTo(c,h),t++,r}),n.currentPath.autoClose=!1,n}function vn(i){const n=E(i.getAttribute("x")||0),t=E(i.getAttribute("y")||0),e=E(i.getAttribute("rx")||i.getAttribute("ry")||0),r=E(i.getAttribute("ry")||i.getAttribute("rx")||0),o=E(i.getAttribute("width")),s=E(i.getAttribute("height")),c=1-.551915024494,h=new j;return h.moveTo(n+e,t),h.lineTo(n+o-e,t),(e!==0||r!==0)&&h.bezierCurveTo(n+o-e*c,t,n+o,t+r*c,n+o,t+r),h.lineTo(n+o,t+s-r),(e!==0||r!==0)&&h.bezierCurveTo(n+o,t+s-r*c,n+o-e*c,t+s,n+o-e,t+s),h.lineTo(n+e,t+s),(e!==0||r!==0)&&h.bezierCurveTo(n+e*c,t+s,n,t+s-r*c,n,t+s-r),h.lineTo(n,t+r),(e!==0||r!==0)&&h.bezierCurveTo(n,t+r*c,n+e*c,t,n+e,t),h}function X(i,n,t){n=Object.assign({},n);let e={};if(i.hasAttribute("class")){const a=i.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<a.length;l++)e=Object.assign(e,t[`.${a[l]}`])}i.hasAttribute("id")&&(e=Object.assign(e,t[`#${i.getAttribute("id")}`]));for(let a=i.style.length,l=0;l<a;l++){const f=i.style.item(l),y=i.style.getPropertyValue(f);n[f]=y,e[f]=y}function r(a,l,f=o){i.hasAttribute(a)&&(n[l]=f(i.getAttribute(a))),e[a]&&(n[l]=f(e[a]))}function o(a){return a.startsWith("url")&&console.warn("url access in attributes is not implemented."),a}function s(a){return Math.max(0,Math.min(1,E(a)))}function c(a){return Math.max(0,E(a))}function h(a){return a.split(" ").filter(l=>l!=="").map(l=>E(l))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),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"),n}function zt(i,n,t=[],e={}){var f;if(i.nodeType!==1)return t;let r=!1,o=null,s={...n};switch(i.nodeName){case"svg":s=X(i,s,e);break;case"style":xn(i,e);break;case"g":s=X(i,s,e);break;case"path":s=X(i,s,e),i.hasAttribute("d")&&(o=dn(i));break;case"rect":s=X(i,s,e),o=vn(i);break;case"polygon":s=X(i,s,e),o=Mn(i);break;case"polyline":s=X(i,s,e),o=wn(i);break;case"circle":s=X(i,s,e),o=yn(i);break;case"ellipse":s=X(i,s,e),o=pn(i);break;case"line":s=X(i,s,e),o=gn(i);break;case"defs":r=!0;break;case"use":{s=X(i,s,e);const x=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),u=(f=i.viewportElement)==null?void 0:f.getElementById(x);u?zt(u,s,t,e):console.warn(`'use node' references non-existent node id: ${x}`);break}default:console.warn(i);break}if(s.display==="none")return t;Object.assign(n,s);const c=new _,h=[],a=un(i,c,h);o&&(o.matrix(c),t.push(o),o.style=n);const l=i.childNodes;for(let y=0,x=l.length;y<x;y++){const u=l[y];r&&u.nodeName!=="style"&&u.nodeName!=="defs"||zt(u,n,t,e)}return a&&(h.pop(),h.length>0?c.copy(h[h.length-1]):c.identity()),t}const ye="data:image/svg+xml;",xe=`${ye}base64,`,pe=`${ye}charset=utf8,`;function ge(i){if(typeof i=="string"){let n;i.startsWith(xe)?(i=i.substring(xe.length,i.length),n=atob(i)):i.startsWith(pe)?(i=i.substring(pe.length,i.length),n=decodeURIComponent(i)):n=i;const t=new DOMParser().parseFromString(n,"text/xml"),e=t.querySelector("parsererror");if(e)throw new Error(`${e.textContent??"parser error"}
|
|
2
|
+
${n}`);return t.documentElement}else return i}function Tn(i){return new he(zt(ge(i),{}))}A.ArcCurve=re,A.BoundingBox=B,A.CompositeCurve=mt,A.CubicBezierCurve=Mt,A.Curve=Y,A.CurvePath=rt,A.EllipseCurve=Ft,A.LineCurve=U,A.Matrix3=_,A.Path2D=j,A.Path2DSet=he,A.PloygonCurve=Pt,A.QuadraticBezierCurve=wt,A.RectangleCurve=oe,A.SplineCurve=ce,A.Vector2=P,A.catmullRom=Lt,A.cubicBezier=Et,A.drawPoint=Z,A.fillTriangulate=Wt,A.getAdaptiveCubicBezierCurvePoints=Ht,A.getAdaptiveQuadraticBezierCurvePoints=Qt,A.parseArcCommand=_t,A.parsePathDataArgs=G,A.parseSVG=Tn,A.parseSVGToDOM=ge,A.quadraticBezier=qt,A.setCanvasContext=At,A.strokeTriangulate=Jt,A.svgPathCommandsAddToPath2D=It,A.svgPathCommandsToData=Gt,A.svgPathDataToCommands=St,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|