modern-path2d 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4113,9 +4113,10 @@ class Path2D extends CompositeCurve {
4113
4113
  });
4114
4114
  return this;
4115
4115
  }
4116
- rotate(a, target = { x: 0, y: 0 }) {
4116
+ rotate(angle, target = { x: 0, y: 0 }) {
4117
+ const rad = -angle / 180 * Math.PI;
4117
4118
  this.getControlPointRefs().forEach((point) => {
4118
- point.rotate(a, target);
4119
+ point.rotate(rad, target);
4119
4120
  });
4120
4121
  return this;
4121
4122
  }
package/dist/index.d.cts CHANGED
@@ -615,7 +615,7 @@ declare class Path2D<T = any> extends CompositeCurve<CurvePath> {
615
615
  splineThru(points: Vector2[]): this;
616
616
  scale(sx: number, sy?: number, target?: Vector2Like): this;
617
617
  skew(ax: number, ay?: number, target?: Vector2Like): this;
618
- rotate(a: number, target?: Vector2Like): this;
618
+ rotate(angle: number, target?: Vector2Like): this;
619
619
  bold(b: number): this;
620
620
  getMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
621
621
  min: Vector2;
package/dist/index.d.mts CHANGED
@@ -615,7 +615,7 @@ declare class Path2D<T = any> extends CompositeCurve<CurvePath> {
615
615
  splineThru(points: Vector2[]): this;
616
616
  scale(sx: number, sy?: number, target?: Vector2Like): this;
617
617
  skew(ax: number, ay?: number, target?: Vector2Like): this;
618
- rotate(a: number, target?: Vector2Like): this;
618
+ rotate(angle: number, target?: Vector2Like): this;
619
619
  bold(b: number): this;
620
620
  getMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
621
621
  min: Vector2;
package/dist/index.d.ts CHANGED
@@ -615,7 +615,7 @@ declare class Path2D<T = any> extends CompositeCurve<CurvePath> {
615
615
  splineThru(points: Vector2[]): this;
616
616
  scale(sx: number, sy?: number, target?: Vector2Like): this;
617
617
  skew(ax: number, ay?: number, target?: Vector2Like): this;
618
- rotate(a: number, target?: Vector2Like): this;
618
+ rotate(angle: number, target?: Vector2Like): this;
619
619
  bold(b: number): this;
620
620
  getMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
621
621
  min: Vector2;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernPath2d={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var n={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function r(e,t){let{fill:r=`#000`,stroke:i=`none`,strokeWidth:a=i===`none`?0:1,strokeLinecap:o=`round`,strokeLinejoin:s=`miter`,strokeMiterlimit:c=0,strokeDasharray:l=[],strokeDashoffset:u=0,shadowOffsetX:d=0,shadowOffsetY:f=0,shadowBlur:p=0,shadowColor:m=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=r,e.strokeStyle=i,e.lineWidth=a,e.lineCap=o,e.lineJoin=n[s],e.miterLimit=c,e.setLineDash(l),e.lineDashOffset=u,e.shadowOffsetX=d,e.shadowOffsetY=f,e.shadowBlur=p,e.shadowColor=m}var i=class e{static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(this._x/e,this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){let r=e<0?n.x-this._x+n.x:this._x,i=t<0?n.y-this._y+n.y:this._y;return this.set(r*Math.abs(e),i*Math.abs(t))}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},a=class e{get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new i((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function o(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}var s=Math.PI,c=s*2;function l(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function u(e,t,n,r){let a=t.clone().sub(e),o=r.clone().sub(n),s=n.clone().sub(e),c=a.cross(o);if(c===0)return new i((e.x+n.x)/2,(e.y+n.y)/2);let l=s.cross(o)/c;return Math.abs(l)>1?new i((e.x+n.x)/2,(e.y+n.y)/2):new i(e.x+l*a.x,e.y+l*a.y)}var d=/([\w-]+)\((.+?)\)/g,f=/[^,]+/g,p=/([-e.\d]+)(.*)/;function m(e,t={}){let n=[],r;for(;(r=d.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:h(e,i,t)})}return n}function h(e,t,n={}){let r=[],i,a=0;for(;(i=f.exec(t))!==null;)r.push(g(e,i[0],{...n,index:a++}));return r}function g(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(p),s={unit:o?.[2]??null,value:t,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(e){case`scale`:case`scaleX`:case`scaleY`:case`scale3d`:s.normalizedDefaultIntValue=1;break}switch(s.unit){case`%`:s.normalizedIntValue=s.intValue/100;break;case`rad`:s.normalizedIntValue=s.intValue/c;break;case`deg`:s.normalizedIntValue=s.intValue/360;break;case`px`:switch(a){case 0:s.normalizedIntValue=s.intValue/r;break;case 1:s.normalizedIntValue=s.intValue/i;break}break;default:s.normalizedIntValue=s.intValue;break}return s}function _(e,t){let n=1-e;return n*n*n*t}function v(e,t){let n=1-e;return 3*n*n*e*t}function y(e,t){return 3*(1-e)*e*e*t}function b(e,t){return e*e*e*t}function x(e,t,n,r,i){return _(e,t)+v(e,n)+y(e,r)+b(e,i)}function S(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=C(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=A(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return T(a,o,n,s,c,l,0),o}function C(e,t,n,r,i){let a;if(i===pe(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=de(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=de(i/r|0,e[i],e[i+1],a);return a&&R(a,a.next)&&(B(a),a=a.next),a}function w(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(R(n,n.next)||L(n.prev,n,n.next)===0)){if(B(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function T(e,t,n,r,i,a,o){if(!e)return;!o&&a&&F(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?D(e,r,i,a):E(e)){t.push(c.i,e.i,l.i),B(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=O(w(e),t),T(e,t,n,r,i,a,2)):o===2&&k(e,t,n,r,i,a):T(w(e),t,n,r,i,a,1);break}}}function E(e){let t=e.prev,n=e,r=e.next;if(L(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&re(i,s,a,c,o,l,m.x,m.y)&&L(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function D(e,t,n,r){let i=e.prev,a=e,o=e.next;if(L(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=ee(p,m,t,n,r),v=ee(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&re(s,u,c,d,l,f,y.x,y.y)&&L(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&re(s,u,c,d,l,f,b.x,b.y)&&L(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&re(s,u,c,d,l,f,y.x,y.y)&&L(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&re(s,u,c,d,l,f,b.x,b.y)&&L(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function O(e,t){let n=e;do{let r=n.prev,i=n.next.next;!R(r,i)&&ae(r,n,n.next,i)&&z(r,i)&&z(i,r)&&(t.push(r.i,n.i,i.i),B(n),B(n.next),n=e=i),n=n.next}while(n!==e);return w(n)}function k(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&ie(o,e)){let s=ue(o,e);o=w(o,o.next),s=w(s,s.next),T(o,t,n,r,i,a,0),T(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function A(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=C(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(te(o))}i.sort(j);for(let e=0;e<i.length;e++)n=M(i[e],n);return n}function j(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function M(e,t){let n=N(e,t);if(!n)return t;let r=ue(n,e);return w(r,r.next),w(n,n.next)}function N(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(R(e,n))return n;do{if(R(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&ne(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);z(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&P(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function P(e,t){return L(e.prev,e,t.prev)<0&&L(t.next,e,e.next)<0}function F(e,t,n,r){let i=e;do i.z===0&&(i.z=ee(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,I(i)}function I(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function ee(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function te(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ne(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function re(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&ne(e,t,n,r,i,a,o,s)}function ie(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ce(e,t)&&(z(e,t)&&z(t,e)&&le(e,t)&&(L(e.prev,e,t.prev)||L(e,t.prev,t))||R(e,t)&&L(e.prev,e,e.next)>0&&L(t.prev,t,t.next)>0)}function L(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function R(e,t){return e.x===t.x&&e.y===t.y}function ae(e,t,n,r){let i=se(L(e,t,n)),a=se(L(e,t,r)),o=se(L(n,r,e)),s=se(L(n,r,t));return!!(i!==a&&o!==s||i===0&&oe(e,n,t)||a===0&&oe(e,r,t)||o===0&&oe(n,e,r)||s===0&&oe(n,t,r))}function oe(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function se(e){return e>0?1:e<0?-1:0}function ce(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ae(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function z(e,t){return L(e.prev,e,e.next)<0?L(e,t,e.next)>=0&&L(e,e.prev,t)>=0:L(e,t,e.prev)<0||L(e,e.next,t)<0}function le(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function ue(e,t){let n=fe(e.i,e.x,e.y),r=fe(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function de(e,t,n,r){let i=fe(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fe(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pe(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function me(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=S(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var he=8,ge=1.1920929e-7,_e=1,ve=.01,V=0,H=0;function ye(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(_e-Math.min(.99,Math.max(0,c)))/1;return u*=u,be(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function be(e,t,n,r,i,a,o,s,c,l,u){if(u>he)return;let d=Math.PI,f=(e+n)/2,p=(t+r)/2,m=(n+i)/2,h=(r+a)/2,g=(i+o)/2,_=(a+s)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(h+_)/2,S=(v+b)/2,C=(y+x)/2;if(u>0){let u=o-e,f=s-t,p=Math.abs((n-o)*f-(r-s)*u),m=Math.abs((i-o)*f-(a-s)*u),h,g;if(p>ge&&m>ge){if((p+m)*(p+m)<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}let l=Math.atan2(a-r,i-n);if(h=Math.abs(l-Math.atan2(r-t,n-e)),g=Math.abs(Math.atan2(s-a,o-i)-l),h>=d&&(h=2*d-h),g>=d&&(g=2*d-g),h+g<V){c.push(S,C);return}if(H!==0){if(h>H){c.push(n,r);return}if(g>H){c.push(i,a);return}}}}else if(p>ge){if(p*p<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}if(h=Math.abs(Math.atan2(a-r,i-n)-Math.atan2(r-t,n-e)),h>=d&&(h=2*d-h),h<V){c.push(n,r),c.push(i,a);return}if(H!==0&&h>H){c.push(n,r);return}}}else if(m>ge){if(m*m<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}if(h=Math.abs(Math.atan2(s-a,o-i)-Math.atan2(a-r,i-n)),h>=d&&(h=2*d-h),h<V){c.push(n,r),c.push(i,a);return}if(H!==0&&h>H){c.push(i,a);return}}}else if(u=S-(e+o)/2,f=C-(t+s)/2,u*u+f*f<=l){c.push(S,C);return}}be(e,t,f,p,v,y,S,C,c,l,u+1),be(S,C,b,x,g,_,o,s,c,l,u+1)}var xe=8,Se=1.1920929e-7,Ce=1,we=.01,Te=0;function Ee(e,t,n,r,i,a,o=.5,s=[]){let c=(Ce-Math.min(.99,Math.max(0,o)))/1;return c*=c,De(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function De(e,t,n,r,i,a,o,s,c){if(c>xe)return;let l=Math.PI,u=(t+r)/2,d=(n+i)/2,f=(r+a)/2,p=(i+o)/2,m=(u+f)/2,h=(d+p)/2,g=a-t,_=o-n,v=Math.abs((r-a)*_-(i-o)*g);if(v>Se){if(v*v<=s*(g*g+_*_)){if(Te<we){e.push(m,h);return}let s=Math.abs(Math.atan2(o-i,a-r)-Math.atan2(i-n,r-t));if(s>=l&&(s=2*l-s),s<Te){e.push(m,h);return}}}else if(g=m-(t+a)/2,_=h-(n+o)/2,g*g+_*_<=s){e.push(m,h);return}De(e,t,n,u,d,m,h,s,c+1),De(e,m,h,f,p,a,o,s,c+1)}function Oe(e){let t=0,n=e.length;for(let r=0;r<n;r+=2){let i=e[r],a=e[r+1],o=e[(r+2)%(n-1)],s=e[(r+3)%n];t+=i*s-o*a}return t/2}function ke(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function Ae(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&ke(c,l,r,s,e,t)>0&&i++:l<=t&&ke(c,l,r,s,e,t)<0&&i--}return i}function je(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function Me(e){let t=e.map((e,t)=>({index:t})),n=e.map(e=>{let t=e.length;if(!t)return[];let n=[2**53-1,0],r=[0,2**53-1],i=[-(2**53-1),0],a=[0,-(2**53-1)];for(let o=0;o<t;o+=2){let t=e[o],s=e[o+1];n[0]>t&&(n=[t,s]),r[1]>s&&(r=[t,s]),i[0]<t&&(i=[t,s]),a[1]<s&&(a=[t,s])}let o=[(n[0]+i[0])/2,(r[1]+a[1])/2],s,c,l,u,d,f,p,m;for(let n=0;n<t;n+=2){let t=e[n],r=e[n+1],i=Math.abs(t-o[0]),a=Math.abs(r-o[1]);r<o[1]&&(!s||i<s)&&(s=i,l=[t,r]),r>o[1]&&(!c||i<c)&&(c=i,u=[t,r]),t<o[0]&&(!d||a<d)&&(d=a,p=[t,r]),t>o[0]&&(!f||a<f)&&(f=a,m=[t,r])}return[n,r,i,a,l,u,p,m].filter(Boolean)});for(let r=0,i=e.length;r<i;r++){let a=[],o=n[r];for(let t=0;t<i;t++){if(r===t)continue;let i={},s=[];for(let n=0,r=o.length;n<r;n++){let[r,a]=o[n],c=Ae(r,a,e[t]);i[c]=(i[c]??0)+1,s.push(c)}s.filter(e=>e!==0).length>s.filter(e=>e===0).length&&a.push({index:r,parentIndex:t,winding:Number(Array.from(Object.entries(i)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:je(n[r][0],n[t][0])})}a.reduce((e,t)=>e+t.winding,0)!==0&&(a.sort((e,t)=>e.dist-t.dist),t[r]=a[0])}return t}function Ne(e,t){let n=1-e;return n*n*t}function Pe(e,t){return 2*(1-e)*e*t}function Fe(e,t){return e*e*t}function Ie(e,t,n,r){return Ne(e,t)+Pe(e,n)+Fe(e,r)}var Le=1e-4,Re=1e-4;function ze(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=Le;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=Be(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=U(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=Ve(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,ee=Math.min(n*n+r*r,i*i+a*a),te=l?N:P;h<=ee+te*te*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=U(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=U(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=U(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=Ve(C,w,D,O,N,P,!1,m)));let F=Re*Re;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function Be(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function Ve(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function U(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var W=class e{_array;constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}skewX(e){let t=Math.tan(e);return this.a+=t*this.b,this.c+=t*this.d,this.tx+=t*this.ty,this}skewY(e){let t=Math.tan(e);return this.b+=t*this.a,this.d+=t*this.c,this.ty+=t*this.tx,this}skew(e,t){let n=Math.tan(e),r=Math.tan(t),i=this.a,a=this.b,o=this.c,s=this.d,c=this.tx,l=this.ty;return this.a=i+n*a,this.b=r*i+a,this.c=o+n*s,this.d=r*o+s,this.tx=c+n*l,this.ty=r*c+l,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/c;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,l=-Math.atan2(-i,a),u=Math.atan2(r,n),d=Math.abs(l+u);return d<1e-5||Math.abs(c-d)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=l,t.skew.y=u),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new i;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new i;let{a:n,b:r,c:a,d:o,tx:s,ty:c}=this,l=1/(n*o+a*-r),u=e.x,d=e.y;return t.x=o*l*u+-a*l*d+(c*a-s*o)*l,t.y=n*l*d+-r*l*u+(-c*n+s*r)*l,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}appendCssTransform(t,n={}){let{width:r=1,height:i=1}=n,a=new e;return m(t,{width:r,height:i}).reverse().forEach(({name:e,args:t})=>{let n=t.map(e=>e.normalizedIntValue);switch(e){case`translate`:a.translate(n[0]*r,(n[1]??n[0])*i);break;case`translateX`:a.translateX(n[0]*r);break;case`translateY`:a.translateY(n[0]*i);break;case`translateZ`:a.translateZ(n[0]);break;case`translate3d`:a.translate3d(n[0]*r,(n[1]??n[0])*i,n[2]??n[1]??n[0]);break;case`scale`:a.scale(n[0],n[1]??n[0]);break;case`scaleX`:a.scaleX(n[0]);break;case`scaleY`:a.scaleY(n[0]);break;case`scale3d`:a.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotate`:a.rotate(n[0]*c);break;case`rotateX`:a.rotateX(n[0]*c);break;case`rotateY`:a.rotateY(n[0]*c);break;case`rotateZ`:a.rotateZ(n[0]*c);break;case`rotate3d`:a.rotate3d(n[0]*c,(n[1]??n[0])*c,(n[2]??n[1]??n[0])*c,(n[3]??n[2]??n[1]??n[0])*c);break;case`skew`:a.skew(n[0],n[0]??n[1]);break;case`skewX`:a.skewX(n[0]);break;case`skewY`:a.skewY(n[0]);break;case`matrix`:a.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}),this.prepend(a),this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}toJSON(){return{a:this.a,b:this.b,c:this.c,d:this.d,tx:this.tx,ty:this.ty}}destroy(){this._array=void 0}};function He(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function Ue(e,t,n,r,i,a,o,s){if(t===0||n===0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,l=(o.y-s.y)/2,u=Math.cos(r)*c+Math.sin(r)*l,d=-Math.sin(r)*c+Math.cos(r)*l,f=t*t,p=n*n,m=u*u,h=d*d,g=m/f+h/p;if(g>1){let e=Math.sqrt(g);t=e*t,n=e*n,f=t*t,p=n*n}let _=f*h+p*m,v=(f*p-_)/_,y=Math.sqrt(Math.max(0,v));i===a&&(y=-y);let b=y*t*d/n,x=-y*n*u/t,S=Math.cos(r)*b-Math.sin(r)*x+(o.x+s.x)/2,C=Math.sin(r)*b+Math.cos(r)*x+(o.y+s.y)/2,w=He(1,0,(u-b)/t,(d-x)/n),T=He((u-b)/t,(d-x)/n,(-u-b)/t,(-d-x)/n)%(Math.PI*2);e.ellipse(S,C,t,n,r,w,w+T,a===0)}var G={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function K(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function c(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function l(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let u,d=e.length;for(let f=0;f<d;f++){if(u=e[f],Array.isArray(t)&&t.includes(s.length%n)&&G.FLAGS.test(u)){r=1,a=u,l();continue}if(r===0){if(G.WHITESPACE.test(u))continue;if(G.DIGIT.test(u)||G.SIGN.test(u)){r=1,a=u;continue}if(G.POINT.test(u)){r=2,a=u;continue}G.COMMA.test(u)&&(i&&c(u,f,s),i=!0)}if(r===1){if(G.DIGIT.test(u)){a+=u;continue}if(G.POINT.test(u)){a+=u,r=2;continue}if(G.EXP.test(u)){r=3;continue}G.SIGN.test(u)&&a.length===1&&G.SIGN.test(a[0])&&c(u,f,s)}if(r===2){if(G.DIGIT.test(u)){a+=u;continue}if(G.EXP.test(u)){r=3;continue}G.POINT.test(u)&&a[a.length-1]===`.`&&c(u,f,s)}if(r===3){if(G.DIGIT.test(u)){o+=u;continue}if(G.SIGN.test(u)){if(o===``){o+=u;continue}o.length===1&&G.SIGN.test(o)&&c(u,f,s)}}G.WHITESPACE.test(u)?(l(),r=0,i=!1):G.COMMA.test(u)?(l(),r=0,i=!0):G.SIGN.test(u)?(l(),r=1,a=u):G.POINT.test(u)?(l(),r=2,a=u):c(u,f,s)}return l(),s}function q(e,t){return e-(t-e)}function We(e,t){let n=new i,r=new i;for(let i=0,a=e.length;i<a;i++){let a=e[i];if(a.type===`m`||a.type===`M`)a.type===`m`?n.add(a):n.copyFrom(a),t.moveTo(n.x,n.y),r.copyFrom(n);else if(a.type===`h`||a.type===`H`)a.type===`h`?n.x+=a.x:n.x=a.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`v`||a.type===`V`)a.type===`v`?n.y+=a.y:n.y=a.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`l`||a.type===`L`)a.type===`l`?n.add(a):n.copyFrom(a),t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`c`||a.type===`C`)a.type===`c`?(t.bezierCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`s`||a.type===`S`)a.type===`s`?(t.bezierCurveTo(q(n.x,r.x),q(n.y,r.y),n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(q(n.x,r.x),q(n.y,r.y),a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`q`||a.type===`Q`)a.type===`q`?(t.quadraticCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x,n.y+a.y),r.x=n.x+a.x1,r.y=n.y+a.y1,n.add(a)):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),r.x=a.x1,r.y=a.y1,n.copyFrom(a));else if(a.type===`t`||a.type===`T`){let e=q(n.x,r.x),i=q(n.y,r.y);r.x=e,r.y=i,a.type===`t`?(t.quadraticCurveTo(e,i,n.x+a.x,n.y+a.y),n.add(a)):(t.quadraticCurveTo(e,i,a.x,a.y),n.copyFrom(a))}else if(a.type===`a`||a.type===`A`){let e=n.clone();if(a.type===`a`){if(a.x===0&&a.y===0)continue;n.add(a)}else{if(n.equals(a))continue;n.copyFrom(a)}r.copyFrom(n),Ue(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,e,n)}else a.type===`z`||a.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,a)}}function Ge(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break;default:break}}return r.join(` `)}var Ke=/[a-df-z][^a-df-z]*/gi;function qe(e){let t=[],n=e.match(Ke);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=K(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=K(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=K(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=K(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=K(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=K(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var Je=`data:image/svg+xml;`,Ye=`${Je}base64,`,Xe=`${Je}charset=utf8,`;function Ze(e){if(typeof e==`string`){let t;e.startsWith(Ye)?(e=e.substring(Ye.length,e.length),t=atob(e)):e.startsWith(Xe)?(e=e.substring(Xe.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}\n${t}`);return n.documentElement}else return e}var Qe=`px`,$e=90,et=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],tt={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 J(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=et.length;n<r;n++){let r=et[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return t===`px`&&Qe!==`px`?n=tt.in[Qe]/$e:(n=tt[t][Qe],n<0&&(n=tt[t].in*$e)),n*Number.parseFloat(e)}function nt(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=rt(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function rt(e){let t=new W;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(J(e.getAttribute(`x`)),J(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.appendCssTransform(e.getAttribute(`transform`)),t}function it(e){return new $().arc(J(e.getAttribute(`cx`)||0),J(e.getAttribute(`cy`)||0),J(e.getAttribute(`r`)||0),0,Math.PI*2)}function at(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function ot(e){return new $().ellipse(J(e.getAttribute(`cx`)||0),J(e.getAttribute(`cy`)||0),J(e.getAttribute(`rx`)||0),J(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function st(e){return new $().moveTo(J(e.getAttribute(`x1`)||0),J(e.getAttribute(`y1`)||0)).lineTo(J(e.getAttribute(`x2`)||0),J(e.getAttribute(`y2`)||0))}function ct(e){let t=new $,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var lt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ut(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(lt,(e,r,i)=>{let a=J(r),o=J(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var dt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ft(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(dt,(e,r,i)=>{let a=J(r),o=J(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function pt(e){let t=J(e.getAttribute(`x`)||0),n=J(e.getAttribute(`y`)||0),r=J(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=J(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=J(e.getAttribute(`width`)),o=J(e.getAttribute(`height`)),s=.448084975506,c=new $;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function Y(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,J(e)))}function s(e){return Math.max(0,J(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>J(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,J),i(`visibility`,`visibility`),t}function mt(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=Y(e,o,r);break;case`style`:at(e,r);break;case`g`:o=Y(e,o,r);break;case`path`:o=Y(e,o,r),e.hasAttribute(`d`)&&(a=ct(e));break;case`rect`:o=Y(e,o,r),a=pt(e);break;case`polygon`:o=Y(e,o,r),a=ut(e);break;case`polyline`:o=Y(e,o,r),a=ft(e);break;case`circle`:o=Y(e,o,r),a=it(e);break;case`ellipse`:o=Y(e,o,r),a=ot(e);break;case`line`:o=Y(e,o,r),a=st(e);break;case`defs`:i=!0;break;case`use`:{o=Y(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?mt(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new W,c=[],l=nt(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||mt(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function ht(e){let t=Ze(e);return new It(mt(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var X=class{arcLengthDivision=200;_lengths=[];getPointAt(e,t=new i){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this}getUnevenVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],a=e[n+1];t.push(new i(r,a))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new i){let n=1e-4,r=Math.max(0,e-n),a=Math.min(1,e+n);return t.copyFrom(this.getPoint(a).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new i){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=i.MAX,t=i.MIN){let n=this.getPoints();for(let r=0,i=n.length;r<i;r++){let i=n[r];e.clampMin(i),t.clampMax(i)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return me(this.getFillVertices(e),e)}strokeTriangulate(e){return ze(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return Ge(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},gt=new W,_t=new W,vt=new W,Z=new i,yt=class extends X{get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}constructor(e=new i,t=new i,n=new i,r=0,a=0,o=Math.PI*2,s=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=a,this.endAngle=o,this.clockwise=s}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new i){let n=this._getDeltaAngle(),r=this.startAngle+e*n,a=this.cx+this.rx*Math.cos(r),o=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=a-this.cx,r=o-this.cy;a=n*e-r*t+this.cx,o=n*t+r*e+this.cy}return t.set(a,o)}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return Z.set(this.cx,this.cy),e.apply(Z,Z),this.cx=Z.x,this.cy=Z.y,Ct(e)?bt(this,e):xt(this,e),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function bt(e,t){let n=e.rx,r=e.ry,a=Math.cos(e.rotate),o=Math.sin(e.rotate),s=new i(n*a,n*o),c=new i(-r*o,r*a),l=t.a*s.x+t.c*s.y,u=t.b*s.x+t.d*s.y,d=t.a*c.x+t.c*c.y,f=t.b*c.x+t.d*c.y,p=gt.set(l,u,d,f,0,0),{a:m,b:h,c:g,d:_}=_t.copyFrom(p).affineInvert(),v=wt(m*m+h*h,g*m+_*h,g*g+_*_),y=Math.sqrt(v.rt1),b=Math.sqrt(v.rt2);if(e.rx=1/y,e.ry=1/b,e.rotate=Math.atan2(v.sn,v.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=_t.set(y,0,0,b,0,0),r=vt.set(v.cs,v.sn,-v.sn,v.cs,0,0),i=n.append(r).append(p),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),St(t)&&(e.clockwise=!e.clockwise)}}function xt(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,St(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function St(e){return e.a*e.d-e.c*e.b<0}function Ct(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function wt(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var Tt=class extends yt{constructor(e=0,t=0,n=1,r=0,a=Math.PI*2,o=!1){super(new i(e,t),new i(n,n),new i,0,r,a,o)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},Q=class e extends X{static from(t,n,r,a){return new e(new i(t,n),new i(r,a))}constructor(e=new i,t=new i){super(),this.p1=e,this.p2=t}getPoint(e,t=new i){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new i){return this.getPoint(e,t)}getTangent(e,t=new i){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new i){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},Et=class e extends X{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new i){let n=e*this.getLength(),r=this.getLengths(),a=0;for(;a<r.length;){if(r[a]>=n){let e=r[a]-n,i=this.curves[a],o=i.getLength();return i.getPointAt(o===0?0:1-e/o,t)}a++}return t}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof Q?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=i.MAX,t=i.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},Dt=class e extends X{static from(t,n,r,a,o,s,c,l){return new e(new i(t,n),new i(r,a),new i(o,s),new i(c,l))}constructor(e=new i,t=new i,n=new i,r=new i){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}getPoint(e,t=new i){let{p1:n,cp1:r,cp2:a,p2:o}=this;return t.set(x(e,n.x,r.x,a.x,o.x),x(e,n.y,r.y,a.y,o.y))}getAdaptiveVertices(e=[]){return ye(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp1:r,cp2:a,p2:o}=this,s=this._solveQuadratic(3*(r.x-n.x),6*(a.x-r.x),3*(o.x-a.x)),c=this._solveQuadratic(3*(r.y-n.y),6*(a.y-r.y),3*(o.y-a.y));return((n,r)=>{for(let i of n)for(let n=0;n<=r;n++){let a=n/r-.5,o=Math.min(1,Math.max(0,i+a)),s=this.getPoint(o);e.x=Math.min(e.x,s.x),e.y=Math.min(e.y,s.y),t.x=Math.max(t.x,s.x),t.y=Math.max(t.y,s.y)}})([0,1,...s,...c],10),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Ot=class extends yt{constructor(e=0,t=0,n=1,r=1,a=0,o=0,s=Math.PI*2,c=!1){super(new i(e,t),new i(n,r),new i,a,o,s,c)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},kt=class extends Et{},At=class extends kt{constructor(e=0,t=0,n=1,r=3){super(),this.cx=e,this.cy=t,this.radius=n,this.sideCount=r,this.update()}update(){let{cx:e,cy:t,radius:n,sideCount:r}=this,a=[];for(let o=0;o<r;o++){let s=o*2*Math.PI/r-.5*Math.PI;a.push(new i(n*Math.cos(s),n*Math.sin(s)).add({x:e,y:t}))}let o=[];for(let e=0;e<r;e++)o.push(new Q(a[e],a[(e+1)%r]));return this.curves=o,this}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.radius=e.radius,this.sideCount=e.sideCount,this.update(),this}},jt=class e extends X{static from(t,n,r,a,o,s){return new e(new i(t,n),new i(r,a),new i(o,s))}constructor(e=new i,t=new i,n=new i){super(),this.p1=e,this.cp=t,this.p2=n}getPoint(e,t=new i){let{p1:n,cp:r,p2:a}=this;return t.set(Ie(e,n.x,r.x,a.x),Ie(e,n.y,r.y,a.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return Ee(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp:r,p2:a}=this,o=.5*(n.x+r.x),s=.5*(n.y+r.y),c=.5*(n.x+a.x),l=.5*(n.y+a.y);return e.x=Math.min(e.x,n.x,a.x,o,c),e.y=Math.min(e.y,n.y,a.y,s,l),t.x=Math.max(t.x,n.x,a.x,o,c),t.y=Math.max(t.y,n.y,a.y,s,l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Mt=class extends kt{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,a=[new i(e,t),new i(e+n,t),new i(e+n,t+r),new i(e,t+r)];return this.curves=[new Q(a[0],a[1]),new Q(a[1],a[2]),new Q(a[2],a[3]),new Q(a[3],a[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},Nt=class extends yt{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r,radius:a}=this,o=n/2,s=r/2,c=e+o,l=t+s,u=Math.max(0,Math.min(a,Math.min(o,s))),d=u;return this._center=new i(c,l),this._radius=new i(u,d),this._diff=new i(o-u,s-d),this}drawTo(e){let{x:t,y:n,width:r,height:i,radius:a}=this;return e.roundRect(t,n,r,i,a),this}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},Pt=class extends X{constructor(e=[]){super(),this.points=e}getPoint(e,t=new i){let{points:n}=this,r=(n.length-1)*e,a=Math.floor(r),s=r-a,c=n[a===0?a:a-1],l=n[a],u=n[a>n.length-2?n.length-1:a+1],d=n[a>n.length-3?n.length-1:a+2];return t.set(o(s,c.x,l.x,u.x,d.x),o(s,c.y,l.y,u.y,d.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},Ft=class extends Et{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return We(e,this),this}addData(e){return this.addCommands(qe(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}_setCurrentPoint(e){return this.currentPoint=new i(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new Q(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new i(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(Q.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(Dt.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(jt.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new Tt(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Ot(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Mt(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new Nt(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new i;return this.curves.push(new Pt([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},$=class e extends Et{_meta;currentCurve=new Ft;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new Ft().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.currentPoint?.equals({x:e,y:t})||(this.currentCurve.curves.length&&(this.currentCurve=new Ft,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t)),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new Ft,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return We(e,this),this}addData(e){return this.addCommands(qe(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(e,t)}),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=u(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this}getMinMax(e=i.MAX,t=i.MIN,n=!0){let r=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(e,t),n&&r>1){let n=r/2,a=i.isClockwise(),o=[];for(let e=0;e<=1;e+=1/i.arcLengthDivision){let t=i.getPoint(e),r=i.getNormal(e),s=r.clone().scale(a?n:-n),c=r.clone().scale(a?-n:n);o.push(t.clone().add(s),t.clone().add(c),t.clone().add({x:n,y:0}),t.clone().add({x:-n,y:0}),t.clone().add({x:0,y:n}),t.clone().add({x:0,y:-n}),t.clone().add({x:n,y:n}),t.clone().add({x:-n,y:-n}))}e.clampMin(...o),t.clampMax(...o)}}),{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=Me(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}me(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new a(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:i=`none`}=t;return e.beginPath(),e.save(),r(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),i!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,n={}){n={...this.style,...n};let{fill:i=`#000`,stroke:a=`none`}=n;return e.beginPath(),e.save(),r(e,n),this.getControlPointRefs().forEach(n=>{t(e,n.x,n.y,{radius:4})}),i!==`none`&&e.fill(),a!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[l(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},It=class{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;let t=i.MAX,n=i.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new a(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernPath2d={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var n={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function r(e,t){let{fill:r=`#000`,stroke:i=`none`,strokeWidth:a=i===`none`?0:1,strokeLinecap:o=`round`,strokeLinejoin:s=`miter`,strokeMiterlimit:c=0,strokeDasharray:l=[],strokeDashoffset:u=0,shadowOffsetX:d=0,shadowOffsetY:f=0,shadowBlur:p=0,shadowColor:m=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=r,e.strokeStyle=i,e.lineWidth=a,e.lineCap=o,e.lineJoin=n[s],e.miterLimit=c,e.setLineDash(l),e.lineDashOffset=u,e.shadowOffsetX=d,e.shadowOffsetY=f,e.shadowBlur=p,e.shadowColor=m}var i=class e{static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(this._x/e,this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){let r=e<0?n.x-this._x+n.x:this._x,i=t<0?n.y-this._y+n.y:this._y;return this.set(r*Math.abs(e),i*Math.abs(t))}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},a=class e{get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new i((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function o(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}var s=Math.PI,c=s*2;function l(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function u(e,t,n,r){let a=t.clone().sub(e),o=r.clone().sub(n),s=n.clone().sub(e),c=a.cross(o);if(c===0)return new i((e.x+n.x)/2,(e.y+n.y)/2);let l=s.cross(o)/c;return Math.abs(l)>1?new i((e.x+n.x)/2,(e.y+n.y)/2):new i(e.x+l*a.x,e.y+l*a.y)}var d=/([\w-]+)\((.+?)\)/g,f=/[^,]+/g,p=/([-e.\d]+)(.*)/;function m(e,t={}){let n=[],r;for(;(r=d.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:h(e,i,t)})}return n}function h(e,t,n={}){let r=[],i,a=0;for(;(i=f.exec(t))!==null;)r.push(g(e,i[0],{...n,index:a++}));return r}function g(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(p),s={unit:o?.[2]??null,value:t,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(e){case`scale`:case`scaleX`:case`scaleY`:case`scale3d`:s.normalizedDefaultIntValue=1;break}switch(s.unit){case`%`:s.normalizedIntValue=s.intValue/100;break;case`rad`:s.normalizedIntValue=s.intValue/c;break;case`deg`:s.normalizedIntValue=s.intValue/360;break;case`px`:switch(a){case 0:s.normalizedIntValue=s.intValue/r;break;case 1:s.normalizedIntValue=s.intValue/i;break}break;default:s.normalizedIntValue=s.intValue;break}return s}function _(e,t){let n=1-e;return n*n*n*t}function v(e,t){let n=1-e;return 3*n*n*e*t}function y(e,t){return 3*(1-e)*e*e*t}function b(e,t){return e*e*e*t}function x(e,t,n,r,i){return _(e,t)+v(e,n)+y(e,r)+b(e,i)}function S(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=C(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=A(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return T(a,o,n,s,c,l,0),o}function C(e,t,n,r,i){let a;if(i===pe(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=de(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=de(i/r|0,e[i],e[i+1],a);return a&&R(a,a.next)&&(B(a),a=a.next),a}function w(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(R(n,n.next)||L(n.prev,n,n.next)===0)){if(B(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function T(e,t,n,r,i,a,o){if(!e)return;!o&&a&&F(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?D(e,r,i,a):E(e)){t.push(c.i,e.i,l.i),B(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=O(w(e),t),T(e,t,n,r,i,a,2)):o===2&&k(e,t,n,r,i,a):T(w(e),t,n,r,i,a,1);break}}}function E(e){let t=e.prev,n=e,r=e.next;if(L(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&re(i,s,a,c,o,l,m.x,m.y)&&L(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function D(e,t,n,r){let i=e.prev,a=e,o=e.next;if(L(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=ee(p,m,t,n,r),v=ee(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&re(s,u,c,d,l,f,y.x,y.y)&&L(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&re(s,u,c,d,l,f,b.x,b.y)&&L(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&re(s,u,c,d,l,f,y.x,y.y)&&L(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&re(s,u,c,d,l,f,b.x,b.y)&&L(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function O(e,t){let n=e;do{let r=n.prev,i=n.next.next;!R(r,i)&&ae(r,n,n.next,i)&&z(r,i)&&z(i,r)&&(t.push(r.i,n.i,i.i),B(n),B(n.next),n=e=i),n=n.next}while(n!==e);return w(n)}function k(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&ie(o,e)){let s=ue(o,e);o=w(o,o.next),s=w(s,s.next),T(o,t,n,r,i,a,0),T(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function A(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=C(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(te(o))}i.sort(j);for(let e=0;e<i.length;e++)n=M(i[e],n);return n}function j(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function M(e,t){let n=N(e,t);if(!n)return t;let r=ue(n,e);return w(r,r.next),w(n,n.next)}function N(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(R(e,n))return n;do{if(R(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&ne(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);z(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&P(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function P(e,t){return L(e.prev,e,t.prev)<0&&L(t.next,e,e.next)<0}function F(e,t,n,r){let i=e;do i.z===0&&(i.z=ee(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,I(i)}function I(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function ee(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function te(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ne(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function re(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&ne(e,t,n,r,i,a,o,s)}function ie(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ce(e,t)&&(z(e,t)&&z(t,e)&&le(e,t)&&(L(e.prev,e,t.prev)||L(e,t.prev,t))||R(e,t)&&L(e.prev,e,e.next)>0&&L(t.prev,t,t.next)>0)}function L(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function R(e,t){return e.x===t.x&&e.y===t.y}function ae(e,t,n,r){let i=se(L(e,t,n)),a=se(L(e,t,r)),o=se(L(n,r,e)),s=se(L(n,r,t));return!!(i!==a&&o!==s||i===0&&oe(e,n,t)||a===0&&oe(e,r,t)||o===0&&oe(n,e,r)||s===0&&oe(n,t,r))}function oe(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function se(e){return e>0?1:e<0?-1:0}function ce(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ae(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function z(e,t){return L(e.prev,e,e.next)<0?L(e,t,e.next)>=0&&L(e,e.prev,t)>=0:L(e,t,e.prev)<0||L(e,e.next,t)<0}function le(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function ue(e,t){let n=fe(e.i,e.x,e.y),r=fe(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function de(e,t,n,r){let i=fe(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fe(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pe(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function me(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=S(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var he=8,ge=1.1920929e-7,_e=1,ve=.01,V=0,H=0;function ye(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(_e-Math.min(.99,Math.max(0,c)))/1;return u*=u,be(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function be(e,t,n,r,i,a,o,s,c,l,u){if(u>he)return;let d=Math.PI,f=(e+n)/2,p=(t+r)/2,m=(n+i)/2,h=(r+a)/2,g=(i+o)/2,_=(a+s)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(h+_)/2,S=(v+b)/2,C=(y+x)/2;if(u>0){let u=o-e,f=s-t,p=Math.abs((n-o)*f-(r-s)*u),m=Math.abs((i-o)*f-(a-s)*u),h,g;if(p>ge&&m>ge){if((p+m)*(p+m)<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}let l=Math.atan2(a-r,i-n);if(h=Math.abs(l-Math.atan2(r-t,n-e)),g=Math.abs(Math.atan2(s-a,o-i)-l),h>=d&&(h=2*d-h),g>=d&&(g=2*d-g),h+g<V){c.push(S,C);return}if(H!==0){if(h>H){c.push(n,r);return}if(g>H){c.push(i,a);return}}}}else if(p>ge){if(p*p<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}if(h=Math.abs(Math.atan2(a-r,i-n)-Math.atan2(r-t,n-e)),h>=d&&(h=2*d-h),h<V){c.push(n,r),c.push(i,a);return}if(H!==0&&h>H){c.push(n,r);return}}}else if(m>ge){if(m*m<=l*(u*u+f*f)){if(V<ve){c.push(S,C);return}if(h=Math.abs(Math.atan2(s-a,o-i)-Math.atan2(a-r,i-n)),h>=d&&(h=2*d-h),h<V){c.push(n,r),c.push(i,a);return}if(H!==0&&h>H){c.push(i,a);return}}}else if(u=S-(e+o)/2,f=C-(t+s)/2,u*u+f*f<=l){c.push(S,C);return}}be(e,t,f,p,v,y,S,C,c,l,u+1),be(S,C,b,x,g,_,o,s,c,l,u+1)}var xe=8,Se=1.1920929e-7,Ce=1,we=.01,Te=0;function Ee(e,t,n,r,i,a,o=.5,s=[]){let c=(Ce-Math.min(.99,Math.max(0,o)))/1;return c*=c,De(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function De(e,t,n,r,i,a,o,s,c){if(c>xe)return;let l=Math.PI,u=(t+r)/2,d=(n+i)/2,f=(r+a)/2,p=(i+o)/2,m=(u+f)/2,h=(d+p)/2,g=a-t,_=o-n,v=Math.abs((r-a)*_-(i-o)*g);if(v>Se){if(v*v<=s*(g*g+_*_)){if(Te<we){e.push(m,h);return}let s=Math.abs(Math.atan2(o-i,a-r)-Math.atan2(i-n,r-t));if(s>=l&&(s=2*l-s),s<Te){e.push(m,h);return}}}else if(g=m-(t+a)/2,_=h-(n+o)/2,g*g+_*_<=s){e.push(m,h);return}De(e,t,n,u,d,m,h,s,c+1),De(e,m,h,f,p,a,o,s,c+1)}function Oe(e){let t=0,n=e.length;for(let r=0;r<n;r+=2){let i=e[r],a=e[r+1],o=e[(r+2)%(n-1)],s=e[(r+3)%n];t+=i*s-o*a}return t/2}function ke(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function Ae(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&ke(c,l,r,s,e,t)>0&&i++:l<=t&&ke(c,l,r,s,e,t)<0&&i--}return i}function je(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function Me(e){let t=e.map((e,t)=>({index:t})),n=e.map(e=>{let t=e.length;if(!t)return[];let n=[2**53-1,0],r=[0,2**53-1],i=[-(2**53-1),0],a=[0,-(2**53-1)];for(let o=0;o<t;o+=2){let t=e[o],s=e[o+1];n[0]>t&&(n=[t,s]),r[1]>s&&(r=[t,s]),i[0]<t&&(i=[t,s]),a[1]<s&&(a=[t,s])}let o=[(n[0]+i[0])/2,(r[1]+a[1])/2],s,c,l,u,d,f,p,m;for(let n=0;n<t;n+=2){let t=e[n],r=e[n+1],i=Math.abs(t-o[0]),a=Math.abs(r-o[1]);r<o[1]&&(!s||i<s)&&(s=i,l=[t,r]),r>o[1]&&(!c||i<c)&&(c=i,u=[t,r]),t<o[0]&&(!d||a<d)&&(d=a,p=[t,r]),t>o[0]&&(!f||a<f)&&(f=a,m=[t,r])}return[n,r,i,a,l,u,p,m].filter(Boolean)});for(let r=0,i=e.length;r<i;r++){let a=[],o=n[r];for(let t=0;t<i;t++){if(r===t)continue;let i={},s=[];for(let n=0,r=o.length;n<r;n++){let[r,a]=o[n],c=Ae(r,a,e[t]);i[c]=(i[c]??0)+1,s.push(c)}s.filter(e=>e!==0).length>s.filter(e=>e===0).length&&a.push({index:r,parentIndex:t,winding:Number(Array.from(Object.entries(i)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:je(n[r][0],n[t][0])})}a.reduce((e,t)=>e+t.winding,0)!==0&&(a.sort((e,t)=>e.dist-t.dist),t[r]=a[0])}return t}function Ne(e,t){let n=1-e;return n*n*t}function Pe(e,t){return 2*(1-e)*e*t}function Fe(e,t){return e*e*t}function Ie(e,t,n,r){return Ne(e,t)+Pe(e,n)+Fe(e,r)}var Le=1e-4,Re=1e-4;function ze(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=Le;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=Be(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=U(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=Ve(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,ee=Math.min(n*n+r*r,i*i+a*a),te=l?N:P;h<=ee+te*te*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=U(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=U(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=U(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=U(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=Ve(C,w,D,O,N,P,!1,m)));let F=Re*Re;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function Be(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function Ve(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function U(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var W=class e{_array;constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}skewX(e){let t=Math.tan(e);return this.a+=t*this.b,this.c+=t*this.d,this.tx+=t*this.ty,this}skewY(e){let t=Math.tan(e);return this.b+=t*this.a,this.d+=t*this.c,this.ty+=t*this.tx,this}skew(e,t){let n=Math.tan(e),r=Math.tan(t),i=this.a,a=this.b,o=this.c,s=this.d,c=this.tx,l=this.ty;return this.a=i+n*a,this.b=r*i+a,this.c=o+n*s,this.d=r*o+s,this.tx=c+n*l,this.ty=r*c+l,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/c;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,l=-Math.atan2(-i,a),u=Math.atan2(r,n),d=Math.abs(l+u);return d<1e-5||Math.abs(c-d)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=l,t.skew.y=u),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new i;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new i;let{a:n,b:r,c:a,d:o,tx:s,ty:c}=this,l=1/(n*o+a*-r),u=e.x,d=e.y;return t.x=o*l*u+-a*l*d+(c*a-s*o)*l,t.y=n*l*d+-r*l*u+(-c*n+s*r)*l,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}appendCssTransform(t,n={}){let{width:r=1,height:i=1}=n,a=new e;return m(t,{width:r,height:i}).reverse().forEach(({name:e,args:t})=>{let n=t.map(e=>e.normalizedIntValue);switch(e){case`translate`:a.translate(n[0]*r,(n[1]??n[0])*i);break;case`translateX`:a.translateX(n[0]*r);break;case`translateY`:a.translateY(n[0]*i);break;case`translateZ`:a.translateZ(n[0]);break;case`translate3d`:a.translate3d(n[0]*r,(n[1]??n[0])*i,n[2]??n[1]??n[0]);break;case`scale`:a.scale(n[0],n[1]??n[0]);break;case`scaleX`:a.scaleX(n[0]);break;case`scaleY`:a.scaleY(n[0]);break;case`scale3d`:a.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotate`:a.rotate(n[0]*c);break;case`rotateX`:a.rotateX(n[0]*c);break;case`rotateY`:a.rotateY(n[0]*c);break;case`rotateZ`:a.rotateZ(n[0]*c);break;case`rotate3d`:a.rotate3d(n[0]*c,(n[1]??n[0])*c,(n[2]??n[1]??n[0])*c,(n[3]??n[2]??n[1]??n[0])*c);break;case`skew`:a.skew(n[0],n[0]??n[1]);break;case`skewX`:a.skewX(n[0]);break;case`skewY`:a.skewY(n[0]);break;case`matrix`:a.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}),this.prepend(a),this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}toJSON(){return{a:this.a,b:this.b,c:this.c,d:this.d,tx:this.tx,ty:this.ty}}destroy(){this._array=void 0}};function He(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function Ue(e,t,n,r,i,a,o,s){if(t===0||n===0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,l=(o.y-s.y)/2,u=Math.cos(r)*c+Math.sin(r)*l,d=-Math.sin(r)*c+Math.cos(r)*l,f=t*t,p=n*n,m=u*u,h=d*d,g=m/f+h/p;if(g>1){let e=Math.sqrt(g);t=e*t,n=e*n,f=t*t,p=n*n}let _=f*h+p*m,v=(f*p-_)/_,y=Math.sqrt(Math.max(0,v));i===a&&(y=-y);let b=y*t*d/n,x=-y*n*u/t,S=Math.cos(r)*b-Math.sin(r)*x+(o.x+s.x)/2,C=Math.sin(r)*b+Math.cos(r)*x+(o.y+s.y)/2,w=He(1,0,(u-b)/t,(d-x)/n),T=He((u-b)/t,(d-x)/n,(-u-b)/t,(-d-x)/n)%(Math.PI*2);e.ellipse(S,C,t,n,r,w,w+T,a===0)}var G={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function K(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function c(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function l(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let u,d=e.length;for(let f=0;f<d;f++){if(u=e[f],Array.isArray(t)&&t.includes(s.length%n)&&G.FLAGS.test(u)){r=1,a=u,l();continue}if(r===0){if(G.WHITESPACE.test(u))continue;if(G.DIGIT.test(u)||G.SIGN.test(u)){r=1,a=u;continue}if(G.POINT.test(u)){r=2,a=u;continue}G.COMMA.test(u)&&(i&&c(u,f,s),i=!0)}if(r===1){if(G.DIGIT.test(u)){a+=u;continue}if(G.POINT.test(u)){a+=u,r=2;continue}if(G.EXP.test(u)){r=3;continue}G.SIGN.test(u)&&a.length===1&&G.SIGN.test(a[0])&&c(u,f,s)}if(r===2){if(G.DIGIT.test(u)){a+=u;continue}if(G.EXP.test(u)){r=3;continue}G.POINT.test(u)&&a[a.length-1]===`.`&&c(u,f,s)}if(r===3){if(G.DIGIT.test(u)){o+=u;continue}if(G.SIGN.test(u)){if(o===``){o+=u;continue}o.length===1&&G.SIGN.test(o)&&c(u,f,s)}}G.WHITESPACE.test(u)?(l(),r=0,i=!1):G.COMMA.test(u)?(l(),r=0,i=!0):G.SIGN.test(u)?(l(),r=1,a=u):G.POINT.test(u)?(l(),r=2,a=u):c(u,f,s)}return l(),s}function q(e,t){return e-(t-e)}function We(e,t){let n=new i,r=new i;for(let i=0,a=e.length;i<a;i++){let a=e[i];if(a.type===`m`||a.type===`M`)a.type===`m`?n.add(a):n.copyFrom(a),t.moveTo(n.x,n.y),r.copyFrom(n);else if(a.type===`h`||a.type===`H`)a.type===`h`?n.x+=a.x:n.x=a.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`v`||a.type===`V`)a.type===`v`?n.y+=a.y:n.y=a.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`l`||a.type===`L`)a.type===`l`?n.add(a):n.copyFrom(a),t.lineTo(n.x,n.y),r.copyFrom(n);else if(a.type===`c`||a.type===`C`)a.type===`c`?(t.bezierCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`s`||a.type===`S`)a.type===`s`?(t.bezierCurveTo(q(n.x,r.x),q(n.y,r.y),n.x+a.x2,n.y+a.y2,n.x+a.x,n.y+a.y),r.x=n.x+a.x2,r.y=n.y+a.y2,n.add(a)):(t.bezierCurveTo(q(n.x,r.x),q(n.y,r.y),a.x2,a.y2,a.x,a.y),r.x=a.x2,r.y=a.y2,n.copyFrom(a));else if(a.type===`q`||a.type===`Q`)a.type===`q`?(t.quadraticCurveTo(n.x+a.x1,n.y+a.y1,n.x+a.x,n.y+a.y),r.x=n.x+a.x1,r.y=n.y+a.y1,n.add(a)):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),r.x=a.x1,r.y=a.y1,n.copyFrom(a));else if(a.type===`t`||a.type===`T`){let e=q(n.x,r.x),i=q(n.y,r.y);r.x=e,r.y=i,a.type===`t`?(t.quadraticCurveTo(e,i,n.x+a.x,n.y+a.y),n.add(a)):(t.quadraticCurveTo(e,i,a.x,a.y),n.copyFrom(a))}else if(a.type===`a`||a.type===`A`){let e=n.clone();if(a.type===`a`){if(a.x===0&&a.y===0)continue;n.add(a)}else{if(n.equals(a))continue;n.copyFrom(a)}r.copyFrom(n),Ue(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,e,n)}else a.type===`z`||a.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,a)}}function Ge(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break;default:break}}return r.join(` `)}var Ke=/[a-df-z][^a-df-z]*/gi;function qe(e){let t=[],n=e.match(Ke);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=K(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=K(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=K(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=K(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=K(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=K(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=K(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var Je=`data:image/svg+xml;`,Ye=`${Je}base64,`,Xe=`${Je}charset=utf8,`;function Ze(e){if(typeof e==`string`){let t;e.startsWith(Ye)?(e=e.substring(Ye.length,e.length),t=atob(e)):e.startsWith(Xe)?(e=e.substring(Xe.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}\n${t}`);return n.documentElement}else return e}var Qe=`px`,$e=90,et=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],tt={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 J(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=et.length;n<r;n++){let r=et[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return t===`px`&&Qe!==`px`?n=tt.in[Qe]/$e:(n=tt[t][Qe],n<0&&(n=tt[t].in*$e)),n*Number.parseFloat(e)}function nt(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=rt(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function rt(e){let t=new W;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(J(e.getAttribute(`x`)),J(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.appendCssTransform(e.getAttribute(`transform`)),t}function it(e){return new $().arc(J(e.getAttribute(`cx`)||0),J(e.getAttribute(`cy`)||0),J(e.getAttribute(`r`)||0),0,Math.PI*2)}function at(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function ot(e){return new $().ellipse(J(e.getAttribute(`cx`)||0),J(e.getAttribute(`cy`)||0),J(e.getAttribute(`rx`)||0),J(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function st(e){return new $().moveTo(J(e.getAttribute(`x1`)||0),J(e.getAttribute(`y1`)||0)).lineTo(J(e.getAttribute(`x2`)||0),J(e.getAttribute(`y2`)||0))}function ct(e){let t=new $,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var lt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ut(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(lt,(e,r,i)=>{let a=J(r),o=J(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var dt=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ft(e){let t=new $,n=0;return e.getAttribute(`points`)?.replace(dt,(e,r,i)=>{let a=J(r),o=J(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function pt(e){let t=J(e.getAttribute(`x`)||0),n=J(e.getAttribute(`y`)||0),r=J(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=J(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=J(e.getAttribute(`width`)),o=J(e.getAttribute(`height`)),s=.448084975506,c=new $;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function Y(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,J(e)))}function s(e){return Math.max(0,J(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>J(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,J),i(`visibility`,`visibility`),t}function mt(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=Y(e,o,r);break;case`style`:at(e,r);break;case`g`:o=Y(e,o,r);break;case`path`:o=Y(e,o,r),e.hasAttribute(`d`)&&(a=ct(e));break;case`rect`:o=Y(e,o,r),a=pt(e);break;case`polygon`:o=Y(e,o,r),a=ut(e);break;case`polyline`:o=Y(e,o,r),a=ft(e);break;case`circle`:o=Y(e,o,r),a=it(e);break;case`ellipse`:o=Y(e,o,r),a=ot(e);break;case`line`:o=Y(e,o,r),a=st(e);break;case`defs`:i=!0;break;case`use`:{o=Y(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?mt(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new W,c=[],l=nt(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||mt(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function ht(e){let t=Ze(e);return new It(mt(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var X=class{arcLengthDivision=200;_lengths=[];getPointAt(e,t=new i){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this}getUnevenVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new i;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],a=e[n+1];t.push(new i(r,a))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new i){let n=1e-4,r=Math.max(0,e-n),a=Math.min(1,e+n);return t.copyFrom(this.getPoint(a).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new i){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=i.MAX,t=i.MIN){let n=this.getPoints();for(let r=0,i=n.length;r<i;r++){let i=n[r];e.clampMin(i),t.clampMax(i)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return me(this.getFillVertices(e),e)}strokeTriangulate(e){return ze(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return Ge(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},gt=new W,_t=new W,vt=new W,Z=new i,yt=class extends X{get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}constructor(e=new i,t=new i,n=new i,r=0,a=0,o=Math.PI*2,s=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=a,this.endAngle=o,this.clockwise=s}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new i){let n=this._getDeltaAngle(),r=this.startAngle+e*n,a=this.cx+this.rx*Math.cos(r),o=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=a-this.cx,r=o-this.cy;a=n*e-r*t+this.cx,o=n*t+r*e+this.cy}return t.set(a,o)}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return Z.set(this.cx,this.cy),e.apply(Z,Z),this.cx=Z.x,this.cy=Z.y,Ct(e)?bt(this,e):xt(this,e),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function bt(e,t){let n=e.rx,r=e.ry,a=Math.cos(e.rotate),o=Math.sin(e.rotate),s=new i(n*a,n*o),c=new i(-r*o,r*a),l=t.a*s.x+t.c*s.y,u=t.b*s.x+t.d*s.y,d=t.a*c.x+t.c*c.y,f=t.b*c.x+t.d*c.y,p=gt.set(l,u,d,f,0,0),{a:m,b:h,c:g,d:_}=_t.copyFrom(p).affineInvert(),v=wt(m*m+h*h,g*m+_*h,g*g+_*_),y=Math.sqrt(v.rt1),b=Math.sqrt(v.rt2);if(e.rx=1/y,e.ry=1/b,e.rotate=Math.atan2(v.sn,v.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=_t.set(y,0,0,b,0,0),r=vt.set(v.cs,v.sn,-v.sn,v.cs,0,0),i=n.append(r).append(p),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),St(t)&&(e.clockwise=!e.clockwise)}}function xt(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,St(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function St(e){return e.a*e.d-e.c*e.b<0}function Ct(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function wt(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var Tt=class extends yt{constructor(e=0,t=0,n=1,r=0,a=Math.PI*2,o=!1){super(new i(e,t),new i(n,n),new i,0,r,a,o)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},Q=class e extends X{static from(t,n,r,a){return new e(new i(t,n),new i(r,a))}constructor(e=new i,t=new i){super(),this.p1=e,this.p2=t}getPoint(e,t=new i){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new i){return this.getPoint(e,t)}getTangent(e,t=new i){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new i){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},Et=class e extends X{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new i){let n=e*this.getLength(),r=this.getLengths(),a=0;for(;a<r.length;){if(r[a]>=n){let e=r[a]-n,i=this.curves[a],o=i.getLength();return i.getPointAt(o===0?0:1-e/o,t)}a++}return t}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof Q?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=i.MAX,t=i.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new a(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},Dt=class e extends X{static from(t,n,r,a,o,s,c,l){return new e(new i(t,n),new i(r,a),new i(o,s),new i(c,l))}constructor(e=new i,t=new i,n=new i,r=new i){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}getPoint(e,t=new i){let{p1:n,cp1:r,cp2:a,p2:o}=this;return t.set(x(e,n.x,r.x,a.x,o.x),x(e,n.y,r.y,a.y,o.y))}getAdaptiveVertices(e=[]){return ye(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp1:r,cp2:a,p2:o}=this,s=this._solveQuadratic(3*(r.x-n.x),6*(a.x-r.x),3*(o.x-a.x)),c=this._solveQuadratic(3*(r.y-n.y),6*(a.y-r.y),3*(o.y-a.y));return((n,r)=>{for(let i of n)for(let n=0;n<=r;n++){let a=n/r-.5,o=Math.min(1,Math.max(0,i+a)),s=this.getPoint(o);e.x=Math.min(e.x,s.x),e.y=Math.min(e.y,s.y),t.x=Math.max(t.x,s.x),t.y=Math.max(t.y,s.y)}})([0,1,...s,...c],10),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Ot=class extends yt{constructor(e=0,t=0,n=1,r=1,a=0,o=0,s=Math.PI*2,c=!1){super(new i(e,t),new i(n,r),new i,a,o,s,c)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},kt=class extends Et{},At=class extends kt{constructor(e=0,t=0,n=1,r=3){super(),this.cx=e,this.cy=t,this.radius=n,this.sideCount=r,this.update()}update(){let{cx:e,cy:t,radius:n,sideCount:r}=this,a=[];for(let o=0;o<r;o++){let s=o*2*Math.PI/r-.5*Math.PI;a.push(new i(n*Math.cos(s),n*Math.sin(s)).add({x:e,y:t}))}let o=[];for(let e=0;e<r;e++)o.push(new Q(a[e],a[(e+1)%r]));return this.curves=o,this}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.radius=e.radius,this.sideCount=e.sideCount,this.update(),this}},jt=class e extends X{static from(t,n,r,a,o,s){return new e(new i(t,n),new i(r,a),new i(o,s))}constructor(e=new i,t=new i,n=new i){super(),this.p1=e,this.cp=t,this.p2=n}getPoint(e,t=new i){let{p1:n,cp:r,p2:a}=this;return t.set(Ie(e,n.x,r.x,a.x),Ie(e,n.y,r.y,a.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return Ee(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=i.MAX,t=i.MIN){let{p1:n,cp:r,p2:a}=this,o=.5*(n.x+r.x),s=.5*(n.y+r.y),c=.5*(n.x+a.x),l=.5*(n.y+a.y);return e.x=Math.min(e.x,n.x,a.x,o,c),e.y=Math.min(e.y,n.y,a.y,s,l),t.x=Math.max(t.x,n.x,a.x,o,c),t.y=Math.max(t.y,n.y,a.y,s,l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Mt=class extends kt{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,a=[new i(e,t),new i(e+n,t),new i(e+n,t+r),new i(e,t+r)];return this.curves=[new Q(a[0],a[1]),new Q(a[1],a[2]),new Q(a[2],a[3]),new Q(a[3],a[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},Nt=class extends yt{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r,radius:a}=this,o=n/2,s=r/2,c=e+o,l=t+s,u=Math.max(0,Math.min(a,Math.min(o,s))),d=u;return this._center=new i(c,l),this._radius=new i(u,d),this._diff=new i(o-u,s-d),this}drawTo(e){let{x:t,y:n,width:r,height:i,radius:a}=this;return e.roundRect(t,n,r,i,a),this}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},Pt=class extends X{constructor(e=[]){super(),this.points=e}getPoint(e,t=new i){let{points:n}=this,r=(n.length-1)*e,a=Math.floor(r),s=r-a,c=n[a===0?a:a-1],l=n[a],u=n[a>n.length-2?n.length-1:a+1],d=n[a>n.length-3?n.length-1:a+2];return t.set(o(s,c.x,l.x,u.x,d.x),o(s,c.y,l.y,u.y,d.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},Ft=class extends Et{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return We(e,this),this}addData(e){return this.addCommands(qe(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}_setCurrentPoint(e){return this.currentPoint=new i(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new Q(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new i(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(Q.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(Dt.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(jt.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new Tt(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Ot(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Mt(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new Nt(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new i;return this.curves.push(new Pt([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},$=class e extends Et{_meta;currentCurve=new Ft;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new Ft().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.currentPoint?.equals({x:e,y:t})||(this.currentCurve.curves.length&&(this.currentCurve=new Ft,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t)),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new Ft,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return We(e,this),this}addData(e){return this.addCommands(qe(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this}rotate(e,t={x:0,y:0}){let n=-e/180*Math.PI;return this.getControlPointRefs().forEach(e=>{e.rotate(n,t)}),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=u(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this}getMinMax(e=i.MAX,t=i.MIN,n=!0){let r=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(e,t),n&&r>1){let n=r/2,a=i.isClockwise(),o=[];for(let e=0;e<=1;e+=1/i.arcLengthDivision){let t=i.getPoint(e),r=i.getNormal(e),s=r.clone().scale(a?n:-n),c=r.clone().scale(a?-n:n);o.push(t.clone().add(s),t.clone().add(c),t.clone().add({x:n,y:0}),t.clone().add({x:-n,y:0}),t.clone().add({x:0,y:n}),t.clone().add({x:0,y:-n}),t.clone().add({x:n,y:n}),t.clone().add({x:-n,y:-n}))}e.clampMin(...o),t.clampMax(...o)}}),{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=Me(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}me(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new a(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:i=`none`}=t;return e.beginPath(),e.save(),r(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),i!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,n={}){n={...this.style,...n};let{fill:i=`#000`,stroke:a=`none`}=n;return e.beginPath(),e.save(),r(e,n),this.getControlPointRefs().forEach(n=>{t(e,n.x,n.y,{radius:4})}),i!==`none`&&e.fill(),a!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[l(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},It=class{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;let t=i.MAX,n=i.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new a(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
2
2
  points="${t.join(`,`)} ${r.join(`,`)} ${i.join(`,`)}"
3
3
  stroke="#28a745"
4
4
  stroke-width="#stroke-width"
package/dist/index.mjs CHANGED
@@ -4107,9 +4107,10 @@ class Path2D extends CompositeCurve {
4107
4107
  });
4108
4108
  return this;
4109
4109
  }
4110
- rotate(a, target = { x: 0, y: 0 }) {
4110
+ rotate(angle, target = { x: 0, y: 0 }) {
4111
+ const rad = -angle / 180 * Math.PI;
4111
4112
  this.getControlPointRefs().forEach((point) => {
4112
- point.rotate(a, target);
4113
+ point.rotate(rad, target);
4113
4114
  });
4114
4115
  return this;
4115
4116
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-path2d",
3
3
  "type": "module",
4
- "version": "1.5.3",
4
+ "version": "1.5.4",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A Path2D library, fully compatible with Web Path2D, with additional support for triangulate、animation、deformation etc.",
7
7
  "author": "wxm",
@@ -52,8 +52,7 @@
52
52
  "release": "bumpp package.json --commit \"release: v%s\" --push --all --tag",
53
53
  "start": "esno src/index.ts",
54
54
  "test": "vitest",
55
- "typecheck": "tsc --noEmit",
56
- "prepare": "simple-git-hooks"
55
+ "typecheck": "tsc --noEmit"
57
56
  },
58
57
  "dependencies": {
59
58
  "earcut": "^3.0.2"
@@ -65,17 +64,9 @@
65
64
  "bumpp": "^11.0.1",
66
65
  "conventional-changelog-cli": "^5.0.0",
67
66
  "eslint": "^10.3.0",
68
- "lint-staged": "^16.4.0",
69
- "simple-git-hooks": "^2.13.1",
70
67
  "typescript": "^6.0.3",
71
68
  "unbuild": "^3.6.1",
72
- "vite": "^8.0.10",
69
+ "vite": "^8.0.11",
73
70
  "vitest": "^4.1.5"
74
- },
75
- "simple-git-hooks": {
76
- "pre-commit": "pnpm lint-staged"
77
- },
78
- "lint-staged": {
79
- "*": "eslint src --fix"
80
71
  }
81
72
  }