modern-text 1.2.1 → 1.2.2
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 +4 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -181,13 +181,13 @@ class Character {
|
|
|
181
181
|
get fontHeight() {
|
|
182
182
|
return this.fontSize * this.computedStyle.lineHeight;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
_getFontSFNT(fonts) {
|
|
185
185
|
const fontFamily = this.computedStyle.fontFamily;
|
|
186
186
|
const _fonts = fonts ?? modernFont.fonts;
|
|
187
187
|
const font = fontFamily ? _fonts.get(fontFamily) : _fonts.fallbackFont;
|
|
188
|
-
return font?.
|
|
188
|
+
return font?.getSFNT();
|
|
189
189
|
}
|
|
190
|
-
updateGlyph(sfnt = this.
|
|
190
|
+
updateGlyph(sfnt = this._getFontSFNT()) {
|
|
191
191
|
if (!sfnt) {
|
|
192
192
|
return this;
|
|
193
193
|
}
|
|
@@ -224,7 +224,7 @@ class Character {
|
|
|
224
224
|
return this;
|
|
225
225
|
}
|
|
226
226
|
update(fonts) {
|
|
227
|
-
const sfnt = this.
|
|
227
|
+
const sfnt = this._getFontSFNT(fonts);
|
|
228
228
|
if (!sfnt) {
|
|
229
229
|
return this;
|
|
230
230
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
|
-
import { Fonts,
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
6
6
|
declare function uploadColor(style: Partial<IDOCStyleDeclaration>, box: BoundingBox, ctx: CanvasRenderingContext2D): void;
|
|
@@ -70,8 +70,8 @@ declare class Character {
|
|
|
70
70
|
get fontSize(): number;
|
|
71
71
|
get fontHeight(): number;
|
|
72
72
|
constructor(content: string, index: number, parent: Fragment);
|
|
73
|
-
protected
|
|
74
|
-
updateGlyph(sfnt?:
|
|
73
|
+
protected _getFontSFNT(fonts?: Fonts): SFNT | undefined;
|
|
74
|
+
updateGlyph(sfnt?: SFNT | undefined): this;
|
|
75
75
|
update(fonts?: Fonts): this;
|
|
76
76
|
protected _italic(path: Path2D, startPoint?: VectorLike): void;
|
|
77
77
|
getGlyphMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
|
-
import { Fonts,
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
6
6
|
declare function uploadColor(style: Partial<IDOCStyleDeclaration>, box: BoundingBox, ctx: CanvasRenderingContext2D): void;
|
|
@@ -70,8 +70,8 @@ declare class Character {
|
|
|
70
70
|
get fontSize(): number;
|
|
71
71
|
get fontHeight(): number;
|
|
72
72
|
constructor(content: string, index: number, parent: Fragment);
|
|
73
|
-
protected
|
|
74
|
-
updateGlyph(sfnt?:
|
|
73
|
+
protected _getFontSFNT(fonts?: Fonts): SFNT | undefined;
|
|
74
|
+
updateGlyph(sfnt?: SFNT | undefined): this;
|
|
75
75
|
update(fonts?: Fonts): this;
|
|
76
76
|
protected _italic(path: Path2D, startPoint?: VectorLike): void;
|
|
77
77
|
getGlyphMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDOCStyleDeclaration, IDOCTextContent, IDOCHighlightDeclaration } from 'modern-idoc';
|
|
2
2
|
import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
|
|
3
|
-
import { Fonts,
|
|
3
|
+
import { Fonts, SFNT } from 'modern-font';
|
|
4
4
|
|
|
5
5
|
declare function parseColor(ctx: CanvasRenderingContext2D, source: string | CanvasGradient | CanvasPattern, box: BoundingBox): string | CanvasGradient | CanvasPattern;
|
|
6
6
|
declare function uploadColor(style: Partial<IDOCStyleDeclaration>, box: BoundingBox, ctx: CanvasRenderingContext2D): void;
|
|
@@ -70,8 +70,8 @@ declare class Character {
|
|
|
70
70
|
get fontSize(): number;
|
|
71
71
|
get fontHeight(): number;
|
|
72
72
|
constructor(content: string, index: number, parent: Fragment);
|
|
73
|
-
protected
|
|
74
|
-
updateGlyph(sfnt?:
|
|
73
|
+
protected _getFontSFNT(fonts?: Fonts): SFNT | undefined;
|
|
74
|
+
updateGlyph(sfnt?: SFNT | undefined): this;
|
|
75
75
|
update(fonts?: Fonts): this;
|
|
76
76
|
protected _italic(path: Path2D, startPoint?: VectorLike): void;
|
|
77
77
|
getGlyphMinMax(min?: Vector2, max?: Vector2, withStyle?: boolean): {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(R,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(R=typeof globalThis<"u"?globalThis:R||self,ct(R.modernText={}))})(this,function(R){"use strict";var va=Object.defineProperty;var ba=(R,ct,jt)=>ct in R?va(R,ct,{enumerable:!0,configurable:!0,writable:!0,value:jt}):R[ct]=jt;var M=(R,ct,jt)=>ba(R,typeof ct!="symbol"?ct+"":ct,jt);var ee;function ct(i,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:o,y1:s,stops:a}=fs(e,t.left,t.top,t.width,t.height),l=i.createLinearGradient(n,r,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function jt(i,e,t){i!=null&&i.color&&(i.color=ct(t,i.color,e)),i!=null&&i.backgroundColor&&(i.backgroundColor=ct(t,i.backgroundColor,e)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=ct(t,i.textStrokeColor,e))}function fs(i,e,t,n,r){var d;const o=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(p=>{let m=p[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(p[3].replace("%",""))/100,color:m}})}}function le(i){const{ctx:e,path:t,fontSize:n,clipRect:r}=i;e.save(),e.beginPath();const o=t.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Yn(i,e,t){const{left:n,top:r,width:o,height:s}=t,a=i.canvas;a.dataset.viewBox=`${n} ${r} ${o} ${s}`,a.dataset.pixelRatio=String(e);const l=o,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,i.clearRect(0,0,a.width,a.height),i.scale(e,e),i.translate(-n,-r)}function Kn(i,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;jt(n,r,i),t.forEach(o=>{jt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{jt(s.computedStyle,s.inlineBox,i)})})}var ft=Uint8Array,_t=Uint16Array,pn=Int32Array,ze=new ft([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),je=new ft([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dn=new ft([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qn=function(i,e){for(var t=new _t(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new pn(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},Jn=Qn(ze,2),tr=Jn.b,yn=Jn.r;tr[28]=258,yn[258]=28;for(var er=Qn(je,0),us=er.b,nr=er.r,gn=new _t(32768),Q=0;Q<32768;++Q){var Ht=(Q&43690)>>1|(Q&21845)<<1;Ht=(Ht&52428)>>2|(Ht&13107)<<2,Ht=(Ht&61680)>>4|(Ht&3855)<<4,gn[Q]=((Ht&65280)>>8|(Ht&255)<<8)>>1}for(var Nt=function(i,e,t){for(var n=i.length,r=0,o=new _t(e);r<n;++r)i[r]&&++o[i[r]-1];var s=new _t(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new _t(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],c=e-i[r],f=s[i[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[gn[f]>>l]=h}else for(a=new _t(n),r=0;r<n;++r)i[r]&&(a[r]=gn[s[i[r]-1]++]>>15-i[r]);return a},Zt=new ft(288),Q=0;Q<144;++Q)Zt[Q]=8;for(var Q=144;Q<256;++Q)Zt[Q]=9;for(var Q=256;Q<280;++Q)Zt[Q]=7;for(var Q=280;Q<288;++Q)Zt[Q]=8;for(var be=new ft(32),Q=0;Q<32;++Q)be[Q]=5;var ps=Nt(Zt,9,0),ds=Nt(Zt,9,1),ys=Nt(be,5,0),gs=Nt(be,5,1),mn=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Dt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},xn=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},wn=function(i){return(i+7)/8|0},rr=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ft(i.subarray(e,t))},ms=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(i,e,t){var n=new Error(e||ms[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},xs=function(i,e,t,n){var r=i.length,o=0;if(!r||e.f&&!e.l)return t||new ft(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ft(r*3));var h=function(Ct){var At=t.length;if(Ct>At){var ht=new ft(Math.max(At*2,Ct));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,d=e.l,p=e.d,m=e.m,y=e.n,k=r*8;do{if(!d){c=Dt(i,f,1);var P=Dt(i,f+1,3);if(f+=3,P)if(P==1)d=ds,p=gs,m=9,y=5;else if(P==2){var b=Dt(i,f,31)+257,S=Dt(i,f+10,15)+4,w=b+Dt(i,f+5,31)+1;f+=14;for(var I=new ft(w),F=new ft(19),E=0;E<S;++E)F[dn[E]]=Dt(i,f+E*3,7);f+=S*3;for(var _=mn(F),j=(1<<_)-1,T=Nt(F,_,1),E=0;E<w;){var U=T[Dt(i,f,j)];f+=U&15;var v=U>>4;if(v<16)I[E++]=v;else{var V=0,B=0;for(v==16?(B=3+Dt(i,f,3),f+=2,V=I[E-1]):v==17?(B=3+Dt(i,f,7),f+=3):v==18&&(B=11+Dt(i,f,127),f+=7);B--;)I[E++]=V}}var O=I.subarray(0,b),q=I.subarray(b);m=mn(O),y=mn(q),d=Nt(O,m,1),p=Nt(q,y,1)}else Ut(1);else{var v=wn(f)+4,C=i[v-4]|i[v-3]<<8,x=v+C;if(x>r){l&&Ut(0);break}a&&h(u+C),t.set(i.subarray(v,x),u),e.b=u+=C,e.p=f=x*8,e.f=c;continue}if(f>k){l&&Ut(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,D=(1<<y)-1,Z=f;;Z=f){var V=d[xn(i,f)&L],W=V>>4;if(f+=V&15,f>k){l&&Ut(0);break}if(V||Ut(2),W<256)t[u++]=W;else if(W==256){Z=f,d=null;break}else{var G=W-254;if(W>264){var E=W-257,N=ze[E];G=Dt(i,f,(1<<N)-1)+tr[E],f+=N}var K=p[xn(i,f)&D],X=K>>4;K||Ut(3),f+=K&15;var q=us[X];if(X>3){var N=je[X];q+=xn(i,f)&(1<<N)-1,f+=N}if(f>k){l&&Ut(0);break}a&&h(u+131072);var nt=u+G;if(u<q){var Wt=o-q,Bt=Math.min(q,nt);for(Wt+u<0&&Ut(3);u<Bt;++u)t[u]=n[Wt+u]}for(;u<nt;++u)t[u]=t[u-q]}}e.l=d,e.p=Z,e.b=u,e.f=c,d&&(c=1,e.m=m,e.d=p,e.n=y)}while(!c);return u!=t.length&&s?rr(t,0,u):t.subarray(0,u)},Vt=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},Se=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},vn=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,o=t.slice();if(!r)return{t:ar,l:0};if(r==1){var s=new ft(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(x,b){return x.f-b.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=o[0].s,n=1;n<r;++n)o[n].s>u&&(u=o[n].s);var d=new _t(u+1),p=bn(t[c-1],d,0);if(p>e){var n=0,m=0,y=p-e,k=1<<y;for(o.sort(function(b,S){return d[S.s]-d[b.s]||b.f-S.f});n<r;++n){var P=o[n].s;if(d[P]>e)m+=k-(1<<p-d[P]),d[P]=e;else break}for(m>>=y;m>0;){var v=o[n].s;d[v]<e?m-=1<<e-d[v]++-1:++n}for(;n>=0&&m;--n){var C=o[n].s;d[C]==e&&(--d[C],++m)}p=e}return{t:new ft(d),l:p}},bn=function(i,e,t){return i.s==-1?Math.max(bn(i.l,e,t+1),bn(i.r,e,t+1)):e[i.s]=t},sr=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new _t(++e),n=0,r=i[0],o=1,s=function(l){t[n++]=l},a=1;a<=e;++a)if(i[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=i[a]}return{c:t.subarray(0,n),n:e}},Ce=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},ir=function(i,e,t){var n=t.length,r=wn(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},or=function(i,e,t,n,r,o,s,a,l,h,c){Vt(e,c++,t),++r[256];for(var f=vn(r,15),u=f.t,d=f.l,p=vn(o,15),m=p.t,y=p.l,k=sr(u),P=k.c,v=k.n,C=sr(m),x=C.c,b=C.n,S=new _t(19),w=0;w<P.length;++w)++S[P[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var I=vn(S,7),F=I.t,E=I.l,_=19;_>4&&!F[dn[_-1]];--_);var j=h+5<<3,T=Ce(r,Zt)+Ce(o,be)+s,U=Ce(r,u)+Ce(o,m)+s+14+3*_+Ce(S,F)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&j<=T&&j<=U)return ir(e,c,i.subarray(l,l+h));var V,B,O,q;if(Vt(e,c,1+(U<T)),c+=2,U<T){V=Nt(u,d,0),B=u,O=Nt(m,y,0),q=m;var L=Nt(F,E,0);Vt(e,c,v-257),Vt(e,c+5,b-1),Vt(e,c+10,_-4),c+=14;for(var w=0;w<_;++w)Vt(e,c+3*w,F[dn[w]]);c+=3*_;for(var D=[P,x],Z=0;Z<2;++Z)for(var W=D[Z],w=0;w<W.length;++w){var G=W[w]&31;Vt(e,c,L[G]),c+=F[G],G>15&&(Vt(e,c,W[w]>>5&127),c+=W[w]>>12)}}else V=ps,B=Zt,O=ys,q=be;for(var w=0;w<a;++w){var N=n[w];if(N>255){var G=N>>18&31;Se(e,c,V[G+257]),c+=B[G+257],G>7&&(Vt(e,c,N>>23&31),c+=ze[G]);var K=N&31;Se(e,c,O[K]),c+=q[K],K>3&&(Se(e,c,N>>5&8191),c+=je[K])}else Se(e,c,V[N]),c+=B[N]}return Se(e,c,V[256]),c+B[256]},ws=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ar=new ft(0),vs=function(i,e,t,n,r,o){var s=o.z||i.length,a=new ft(n+s+5*(1+Math.ceil(s/7e3))+r),l=a.subarray(n,a.length-r),h=o.l,c=(o.r||0)&7;if(e){c&&(l[0]=o.r>>3);for(var f=ws[e-1],u=f>>13,d=f&8191,p=(1<<t)-1,m=o.p||new _t(32768),y=o.h||new _t(p+1),k=Math.ceil(t/3),P=2*k,v=function(kt){return(i[kt]^i[kt+1]<<k^i[kt+2]<<P)&p},C=new pn(25e3),x=new _t(288),b=new _t(32),S=0,w=0,I=o.i||0,F=0,E=o.w||0,_=0;I+2<s;++I){var j=v(I),T=I&32767,U=y[j];if(m[T]=U,y[j]=T,E<=I){var V=s-I;if((S>7e3||F>24576)&&(V>423||!h)){c=or(i,l,0,C,x,b,w,F,_,I-_,c),F=S=w=0,_=I;for(var B=0;B<286;++B)x[B]=0;for(var B=0;B<30;++B)b[B]=0}var O=2,q=0,L=d,D=T-U&32767;if(V>2&&j==v(I-D))for(var Z=Math.min(u,V)-1,W=Math.min(32767,I),G=Math.min(258,V);D<=W&&--L&&T!=U;){if(i[I+O]==i[I+O-D]){for(var N=0;N<G&&i[I+N]==i[I+N-D];++N);if(N>O){if(O=N,q=D,N>Z)break;for(var K=Math.min(D,N-2),X=0,B=0;B<K;++B){var nt=I-D+B&32767,Wt=m[nt],Bt=nt-Wt&32767;Bt>X&&(X=Bt,U=nt)}}}T=U,U=m[T],D+=T-U&32767}if(q){C[F++]=268435456|yn[O]<<18|nr[q];var Ct=yn[O]&31,At=nr[q]&31;w+=ze[Ct]+je[At],++x[257+Ct],++b[At],E=I+O,++S}else C[F++]=i[I],++x[i[I]]}}for(I=Math.max(I,E);I<s;++I)C[F++]=i[I],++x[i[I]];c=or(i,l,h,C,x,b,w,F,_,I-_,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=y,o.p=m,o.i=I,o.w=E)}else{for(var I=o.w||0;I<s+h;I+=65535){var ht=I+65535;ht>=s&&(l[c/8|0]=h,ht=s),c=ir(l,c+1,i.subarray(I,ht))}o.i=s}return rr(a,0,n+wn(c)+r)},lr=function(){var i=1,e=0;return{p:function(t){for(var n=i,r=e,o=t.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=n+=t[s];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,e=r},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},bs=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new ft(o.length+i.length);s.set(o),s.set(i,o.length),i=s,r.w=o.length}return vs(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},hr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},Ss=function(i,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=n<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var r=lr();r.p(e.dictionary),hr(i,2,r.d())}},Cs=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Ut(6,"invalid zlib data"),(i[1]>>5&1)==1&&Ut(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ms(i,e){e||(e={});var t=lr();t.p(i);var n=bs(i,e,e.dictionary?6:2,4);return Ss(n,e),hr(n,n.length-4,t.d()),n}function Ps(i,e){return xs(i.subarray(Cs(i),-4),{i:2},e,e)}var Ts=typeof TextDecoder<"u"&&new TextDecoder,As=0;try{Ts.decode(ar,{stream:!0}),As=1}catch{}const ks="modern-font";function Me(i,e){if(!i)throw new Error(`[${ks}] ${e}`)}function _s(i){if("buffer"in i){const e=i.buffer;return i.byteOffset>0||i.byteLength<i.buffer.byteLength?e.slice(i.byteOffset,i.byteOffset+i.byteLength):e}else return i}function he(i){return"buffer"in i?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}function Is(i){let e="";for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function Ne(i){i=Is(i);const e=[];for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Os(i){let e="";for(let t=0,n=i.length;t<n;t++)i[t]<127?e+=String.fromCharCode(i[t]):e+=`%${(256+i[t]).toString(16).slice(1)}`;return unescape(e)}function Bs(i){let e="";for(let t=0,n=i.length;t<n;t+=2)e+=String.fromCharCode((i[t]<<8)+i[t+1]);return e}var Es=Object.defineProperty,ut=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Es(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(i,e){Object.defineProperty(i.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,o){super(_s(t),n,r);M(this,"cursor",0);this.littleEndian=o}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,o)=>this.read(t.type,t.offset+o));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,o)=>{this.write(t.type,n[o],t.offset+o)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const o=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[o])==null?void 0:h.bind(s),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,o]=this.readBytes(t,3);return(n<<16)+(r<<8)+o}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let o=0;o<n;++o)r.push(this.getUint8(t+o));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let o="";for(let s=0,a=r.length;s<a;s++)o+=String.fromCharCode(r[s]);return o}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),o=new Date;return o.setTime(r*1e3+-20775456e5),o}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,o=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const s=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,o);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let o=0,s=t.length,a;o<s;++o)a=t.charCodeAt(o)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const o=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(o,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let o=0;o<r;++o)this.setUint8(n+o,t[o])}else{const o=he(t);r=o.byteLength;for(let s=0;s<r;++s)this.setUint8(n+s,o.getUint8(s))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ut([pt()],at.prototype,"readInt8"),ut([pt()],at.prototype,"readInt16"),ut([pt()],at.prototype,"readInt32"),ut([pt()],at.prototype,"readUint8"),ut([pt()],at.prototype,"readUint16"),ut([pt()],at.prototype,"readUint32"),ut([pt()],at.prototype,"readFloat32"),ut([pt()],at.prototype,"readFloat64"),ut([pt()],at.prototype,"writeInt8"),ut([pt()],at.prototype,"writeInt16"),ut([pt()],at.prototype,"writeInt32"),ut([pt()],at.prototype,"writeUint8"),ut([pt()],at.prototype,"writeUint16"),ut([pt()],at.prototype,"writeUint32"),ut([pt()],at.prototype,"writeFloat32"),ut([pt()],at.prototype,"writeFloat64");const cr=new WeakMap;function g(i){const e=typeof i=="object"?i:{type:i},{size:t=1,type:n}=e;return(r,o)=>{if(typeof o!="string")return;let s=cr.get(r);s||(s={columns:[],byteLength:0},cr.set(r,s));const a={...e,name:o,byteLength:t*Re[n],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class Sn extends Ot{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Ds=Object.defineProperty,wt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ds(e,t,r),r};const vt=class as extends Sn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,o=n.name.names,s=Ne(o.fontFamily||""),a=s.length,l=Ne(o.fontStyle||""),h=l.length,c=Ne(o.version||""),f=c.length,u=Ne(o.fullName||""),d=u.length,p=86+a+4+h+4+f+4+d+2+t.view.byteLength,m=new as(new ArrayBuffer(p),0,p,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(s),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(d),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var Us=Object.defineProperty,qe=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Us(e,t,r),r};class Pe extends Ot{constructor(e,t){super(e,t,16)}}qe([g({type:"char",size:4})],Pe.prototype,"tag"),qe([g("uint32")],Pe.prototype,"checkSum"),qe([g("uint32")],Pe.prototype,"offset"),qe([g("uint32")],Pe.prototype,"length");const Cn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Ls=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class fr{constructor(e){M(this,"index");M(this,"name");M(this,"isComposite",!1);M(this,"components",[]);M(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*n,{xScale:a=s,yScale:l=s}=r,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const d=h[f];d.type==="M"?c.push({type:"M",x:e+d.x*a,y:t+-d.y*l}):d.type==="L"?c.push({type:"L",x:e+d.x*a,y:t+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:e+d.x1*a,y1:t+-d.y1*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="C"?c.push({type:"C",x1:e+d.x1*a,y1:t+-d.y1*l,x2:e+d.x2*a,y2:t+-d.y2*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class $s extends fr{parse(e,t,n){const r=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,d,p;const m=[],y=[];let k=0,P=!1,v=!1,C=s,x=0,b=0;function S(T,U){m.push({type:"L",x:T,y:U})}function w(T,U,V,B,O,q){m.push({type:"C",x1:T,y1:U,x2:V,y2:B,x:O,y:q})}function I(T,U){v&&h!==2&&F(),v=!0,m.push({type:"M",x:T,y:U})}function F(){m.push({type:"Z"})}function E(T){m.push(...T)}function _(){y.length%2!==0&&!P&&(C=y.shift()+o),k+=y.length>>1,y.length=0,P=!0}function j(T){let U,V,B,O,q,L,D,Z,W,G,N,K,X=0;for(;X<T.length;){let nt=T[X++];switch(nt){case 1:_();break;case 3:_();break;case 4:y.length>1&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),I(x,b);break;case 5:for(;y.length>0;)x+=y.shift(),b+=y.shift(),S(x,b);break;case 6:for(;y.length>0&&(x+=y.shift(),S(x,b),y.length!==0);)b+=y.shift(),S(x,b);break;case 7:for(;y.length>0&&(b+=y.shift(),S(x,b),y.length!==0);)x+=y.shift(),S(x,b);break;case 8:for(;y.length>0;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 10:q=y.pop()+l,L=e.subrs[q],L&&j(L);break;case 11:return;case 12:switch(nt=T[X],X+=1,nt){case 35:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),N=W+y.shift(),K=G+y.shift(),x=N+y.shift(),b=K+y.shift(),y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 34:f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,N=W+y.shift(),K=b,x=N+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 36:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,N=W+y.shift(),K=G+y.shift(),x=N+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;case 37:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),N=W+y.shift(),K=G+y.shift(),Math.abs(N-x)>Math.abs(K-b)?x=N+y.shift():b=K+y.shift(),w(f,u,d,p,D,Z),w(W,G,N,K,x,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Wt=Cn[y.pop()],Bt=Cn[y.pop()],Ct=y.pop(),At=y.pop();if(Wt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),kt=e.charset.indexOf(Bt);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Ct}),E(n.get(kt).pathCommands);const Ft=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let zt=0;zt<Ft.length;zt+=1){const Et=Ft[zt];Et.type!=="Z"&&(Et.x+=At,Et.y+=Ct),(Et.type==="Q"||Et.type==="C")&&(Et.x1+=At,Et.y1+=Ct),Et.type==="C"&&(Et.x2+=At,Et.y2+=Ct)}E(Ft)}}else y.length>0&&!P&&(C=y.shift()+o,P=!0);v&&h!==2&&(F(),v=!1);break;case 18:_();break;case 19:case 20:_(),X+=k+7>>3;break;case 21:y.length>2&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),x+=y.pop(),I(x,b);break;case 22:y.length>1&&!P&&(C=y.shift()+o,P=!0),x+=y.pop(),I(x,b);break;case 23:_();break;case 24:for(;y.length>2;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);x+=y.shift(),b+=y.shift(),S(x,b);break;case 25:for(;y.length>6;)x+=y.shift(),b+=y.shift(),S(x,b);f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 26:for(y.length%2&&(x+=y.shift());y.length>0;)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d,b=p+y.shift(),w(f,u,d,p,x,b);break;case 27:for(y.length%2&&(b+=y.shift());y.length>0;)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p,w(f,u,d,p,x,b);break;case 28:U=T[X],V=T[X+1],y.push((U<<24|V<<16)>>16),X+=2;break;case 29:q=y.pop()+a,L=e.gsubrs[q],L&&j(L);break;case 30:for(;y.length>0&&(f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b);break;case 31:for(;y.length>0&&(f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,b);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?y.push(nt-139):nt<251?(U=T[X],X+=1,y.push((nt-247)*256+U+108)):nt<255?(U=T[X],X+=1,y.push(-(nt-251)*256-U-108)):(U=T[X],V=T[X+1],B=T[X+2],O=T[X+3],X+=4,y.push((U<<24|V<<16|B<<8|O)/65536))}}}j(t),this.pathCommands=m,P&&(this.advanceWidth=C)}}class ur{constructor(e){M(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);o&&(n.unicode??(n.unicode=o[0]),n.unicodes??(n.unicodes=o)),this._items[e]=n}return n}}class Fs extends ur{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new $s({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var zs=Object.defineProperty,pr=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zs(e,t,r),r};class Ge extends Ot{constructor(t,n,r,o){super(t,n,r,o);M(this,"_offsets");M(this,"_objects");this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const o=[];for(let s=0,a=n+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();o.push(h)}return o}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,o=r+n[t],a=r+n[t+1]-o;return this._isString?this.view.readString(o,a):this.view.readBytes(o,a)}}pr([g("uint16")],Ge.prototype,"count"),pr([g("uint8")],Ge.prototype,"offsetSize");class We extends Ge{constructor(){super(...arguments);M(this,"_isString",!1)}}class dr extends Ge{constructor(){super(...arguments);M(this,"_isString",!0)}}const js=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Ns=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Rs=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],qs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function Ve(i,e){return e<=390?js[e]:i[e-391]}function J(i,e="number",t){return(n,r)=>{if(typeof r!="string")return;const o={type:e,operator:i,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class yr extends Ot{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,o=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===r||(n+=o[a],l===r))break;n+=o[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,o,s,a;if(t===28)return r=n.readUint8(),o=n.readUint8(),r<<8|o;if(t===29)return r=n.readUint8(),o=n.readUint8(),s=n.readUint8(),a=n.readUint8(),r<<24|o<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,o={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),o[s]=n,n=[]):n.push(this._readOperand(s))}return o}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return Ve(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Gs=Object.defineProperty,Mn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Gs(e,t,r),r};class Xe extends yr{}Mn([J(19)],Xe.prototype,"subrs"),Mn([J(20)],Xe.prototype,"defaultWidthX"),Mn([J(21)],Xe.prototype,"nominalWidthX");var Ws=Object.defineProperty,rt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ws(e,t,r),r};class et extends yr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(i,e=i){return t=>{ce.tableDefinitions.set(i,{tag:i,prop:e,class:t}),Object.defineProperty(ce.prototype,e,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const ae=class ae{constructor(e){M(this,"tables",new Map);M(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,o=Array.from({length:r}),s=t.get(0);for(let a=0;a<r;a+=1)o[a]=t.get(n[a])||s;return o}getPathCommands(e,t,n,r,o){const s=[];return this.forEachGlyph(e,t,n,r,o,(a,l,h,c,f)=>{s.push(...a.getPathCommands(l,h,c,f,this))}),s}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,o={},s){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,n,r,o),c.advanceWidth&&(t+=c.advanceWidth*a),o.letterSpacing?t+=o.letterSpacing*r:o.tracking&&(t+=o.tracking/1e3*r)}return t}clone(){return new ae(this.tableViews)}delete(e){const t=ae.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=ae.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=ae.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const o=this.tableViews.get(e);if(!o)return;n=new r(o.buffer,o.byteOffset,o.byteLength).setSfnt(this),this.tables.set(t.prop,n)}}return n}};M(ae,"tableDefinitions",new Map);let ce=ae;class yt extends Ot{setSfnt(e){return this._sfnt=e,this}getSfnt(){return this._sfnt}}var Vs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Te=(i,e,t,n)=>{for(var r=n>1?void 0:n?Xs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Vs(e,t,r),r};let fe=class extends yt{constructor(e,t,n,r){super(e,t,n,r);M(this,"_glyphs");M(this,"privateDict");M(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Fs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new dr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new dr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Xe(t,n+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ns:this.topDict.charset===1?this.charset=Rs:this.topDict.charset===2?this.charset=qs:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Cn:this.topDict.encoding===1?this.encoding=Ls:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let o,s,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(o=0;o<t;o+=1)s=r.readUint16(),l.push(Ve(n,s));else if(h===1)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint8(),o=0;o<=a;o+=1)l.push(Ve(n,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint16(),o=0;o<=a;o+=1)l.push(Ve(n,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const o={},s=t.readUint8();if(s===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),o[r]=n}else if(s===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)o[c]=r,r+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Te([g("uint8")],fe.prototype,"majorVersion",2),Te([g("uint8")],fe.prototype,"minorVersion",2),Te([g("uint8")],fe.prototype,"headerSize",2),Te([g("uint8")],fe.prototype,"offsetSize",2),fe=Te([dt("CFF ","cff")],fe);var Hs=Object.defineProperty,He=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Hs(e,t,r),r};const Ae=class ls extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new ls;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};He([g("uint16")],Ae.prototype,"format"),He([g("uint16")],Ae.prototype,"length"),He([g("uint16")],Ae.prototype,"language"),He([g({type:"uint8",size:256})],Ae.prototype,"glyphIndexArray");let gr=Ae;var Zs=Object.defineProperty,Pn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Zs(e,t,r),r};class Ze extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=o[c].entryCount;f<u;f++)if(o[c].idRangeOffset+f>=s.length?l=0:(l=s[o[c].idRangeOffset+f],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<e){const d=(h<<8|f+o[c].firstCode)%65535;t.set(d,l)}}return t}}Pn([g("uint16")],Ze.prototype,"format"),Pn([g("uint16")],Ze.prototype,"length"),Pn([g("uint16")],Ze.prototype,"language");function mr(i){return i>32767?i-65536:i<-32767?i+65536:i}function xr(i,e){let t;const n=[];let r={};return i.forEach((o,s)=>{e&&s>e||((!t||s!==t.unicode+1||o!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:s,startId:o,delta:mr(o-s)}):(r.start=Number(s),r.startId=o,r.delta=mr(o-s))),t={unicode:s,glyphIndex:o})}),t&&(r.end=t.unicode,n.push(r)),n}var Ys=Object.defineProperty,ne=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ys(e,t,r),r};const Yt=class hs extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=xr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),o=2*2**r,s=new hs(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=r,s.rangeShift=2*n-o,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=o[h];c<=f;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+s[h]/2+(c-r[h])-n,d=l[u];d!==0?e.set(c,(d+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};ne([g("uint16")],Yt.prototype,"format"),ne([g("uint16")],Yt.prototype,"length"),ne([g("uint16")],Yt.prototype,"language"),ne([g("uint16")],Yt.prototype,"segCountX2"),ne([g("uint16")],Yt.prototype,"searchRange"),ne([g("uint16")],Yt.prototype,"entrySelector"),ne([g("uint16")],Yt.prototype,"rangeShift");let wr=Yt;var Ks=Object.defineProperty,ke=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ks(e,t,r),r};class ue extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}ke([g("uint16")],ue.prototype,"format"),ke([g("uint16")],ue.prototype,"length"),ke([g("uint16")],ue.prototype,"language"),ke([g("uint16")],ue.prototype,"firstCode"),ke([g("uint16")],ue.prototype,"entryCount");var Qs=Object.defineProperty,_e=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Qs(e,t,r),r};const pe=class cs extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=xr(e),n=new cs(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const o=t[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};_e([g("uint16")],pe.prototype,"format"),_e([g("uint16")],pe.prototype,"reserved"),_e([g("uint32")],pe.prototype,"length"),_e([g("uint32")],pe.prototype,"language"),_e([g("uint32")],pe.prototype,"nGroups");let vr=pe;var Js=Object.defineProperty,Tn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Js(e,t,r),r};class Ye extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:o}=t[n];o.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}Tn([g("uint16")],Ye.prototype,"format"),Tn([g("uint32")],Ye.prototype,"length"),Tn([g("uint32")],Ye.prototype,"numVarSelectorRecords");var ti=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,An=(i,e,t,n)=>{for(var r=n>1?void 0:n?ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ti(e,t,r),r};let Ie=class extends yt{constructor(){super(...arguments);M(this,"_unicodeToGlyphIndexMap");M(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),n=wr.from(e),r=gr.from(e),o=t?vr.from(e):void 0,s=4+(o?32:24),a=s+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Ie(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(n.view,s),c.view.writeBytes(r.view,a),o&&c.view.writeBytes(o.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,o=n.length;r<o;r++){const s=n[r],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new gr(this.view.buffer,t.offset);break;case 2:r=new Ze(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new wr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ue(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new vr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ye(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,n=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,r=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,o=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,s=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};An([g("uint16")],Ie.prototype,"version",2),An([g("uint16")],Ie.prototype,"numberSubtables",2),Ie=An([dt("cmap")],Ie);class ni extends fr{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const o=e[r];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return Me(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const o=e[r],s={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,r,o){let s;return(t&r)>0?(s=e.view.readUint8(),t&o||(s=-s),s=n+s):(t&o)>0?s=n:s=n+e.view.readInt16(),s}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Me(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;Me(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let d,p=0;for(;p<f;)if(d=e.view.readUint8(),u.push(d),p++,d&8&&p<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(d),p++}if(Me(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let y;if(f>0){for(let v=0;v<f;v+=1)d=u[v],y={},y.onCurve=!!(d&1),y.lastPointOfContour=a.includes(v),m.push(y);let k=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.x=this._parseGlyphCoordinate(e,d,k,2,16),k=y.x;let P=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.y=this._parseGlyphCoordinate(e,d,P,4,32),P=y.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Me(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],d)[0],d.dx=f.x-u.x,d.dy=f.y-u.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],f=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):f.onCurve?o.push({type:"M",x:f.x,y:f.y}):o.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,d=h.length;u<d;++u)if(c=f,f=h[(u+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let p=f;f.onCurve||(p={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class ri extends ur{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new ni({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi=(i,e,t,n)=>{for(var r=n>1?void 0:n?ii(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&si(e,t,r),r};let kn=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,o)=>r+o.byteLength,0),n=new kn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new ri(this._sfnt))}};kn=oi([dt("glyf")],kn);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(i,e,t,n)=>{for(var r=n>1?void 0:n?li(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ai(e,t,r),r};let br=class extends yt{};br=hi([dt("GPOS","gpos")],br);var ci=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,re=(i,e,t,n)=>{for(var r=n>1?void 0:n?fi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ci(e,t,r),r};let Kt=class extends yt{};re([g("uint16")],Kt.prototype,"majorVersion",2),re([g("uint16")],Kt.prototype,"minorVersion",2),re([g("uint16")],Kt.prototype,"scriptListOffset",2),re([g("uint16")],Kt.prototype,"featureListOffset",2),re([g("uint16")],Kt.prototype,"lookupListOffset",2),re([g("uint16")],Kt.prototype,"featureVariationsOffset",2),Kt=re([dt("GSUB","gsub")],Kt);var ui=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ot=(i,e,t,n)=>{for(var r=n>1?void 0:n?pi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ui(e,t,r),r};let it=class extends yt{constructor(i=new ArrayBuffer(54),e){super(i,e,Math.min(54,i.byteLength-(e??0)))}};ot([g("fixed")],it.prototype,"version",2),ot([g("fixed")],it.prototype,"fontRevision",2),ot([g("uint32")],it.prototype,"checkSumAdjustment",2),ot([g("uint32")],it.prototype,"magickNumber",2),ot([g("uint16")],it.prototype,"flags",2),ot([g("uint16")],it.prototype,"unitsPerEm",2),ot([g({type:"longDateTime"})],it.prototype,"created",2),ot([g({type:"longDateTime"})],it.prototype,"modified",2),ot([g("int16")],it.prototype,"xMin",2),ot([g("int16")],it.prototype,"yMin",2),ot([g("int16")],it.prototype,"xMax",2),ot([g("int16")],it.prototype,"yMax",2),ot([g("uint16")],it.prototype,"macStyle",2),ot([g("uint16")],it.prototype,"lowestRecPPEM",2),ot([g("int16")],it.prototype,"fontDirectionHint",2),ot([g("int16")],it.prototype,"indexToLocFormat",2),ot([g("int16")],it.prototype,"glyphDataFormat",2),it=ot([dt("head")],it);var di=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,bt=(i,e,t,n)=>{for(var r=n>1?void 0:n?yi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&di(e,t,r),r};let gt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};bt([g("fixed")],gt.prototype,"version",2),bt([g("int16")],gt.prototype,"ascent",2),bt([g("int16")],gt.prototype,"descent",2),bt([g("int16")],gt.prototype,"lineGap",2),bt([g("uint16")],gt.prototype,"advanceWidthMax",2),bt([g("int16")],gt.prototype,"minLeftSideBearing",2),bt([g("int16")],gt.prototype,"minRightSideBearing",2),bt([g("int16")],gt.prototype,"xMaxExtent",2),bt([g("int16")],gt.prototype,"caretSlopeRise",2),bt([g("int16")],gt.prototype,"caretSlopeRun",2),bt([g("int16")],gt.prototype,"caretOffset",2),bt([g({type:"int16",size:4})],gt.prototype,"reserved",2),bt([g("int16")],gt.prototype,"metricDataFormat",2),bt([g("uint16")],gt.prototype,"numOfLongHorMetrics",2),gt=bt([dt("hhea")],gt);var gi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,xi=(i,e,t,n)=>{for(var r=n>1?void 0:n?mi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gi(e,t,r),r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new _n(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((o,s)=>(s<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};_n=xi([dt("hmtx")],_n);var wi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,bi=(i,e,t,n)=>{for(var r=n>1?void 0:n?vi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wi(e,t,r),r};let Sr=class extends yt{};Sr=bi([dt("kern","kern")],Sr);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Mi=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ci(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Si(e,t,r),r};let In=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new In(new ArrayBuffer(n));return e.forEach(o=>{t?r.view.writeUint32(o):r.view.writeUint16(o/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};In=Mi([dt("loca")],In);var Pi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,mt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ti(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Pi(e,t,r),r};let lt=class extends yt{constructor(i=new ArrayBuffer(32),e){super(i,e,Math.min(32,i.byteLength-(e??0)))}};mt([g("fixed")],lt.prototype,"version",2),mt([g("uint16")],lt.prototype,"numGlyphs",2),mt([g("uint16")],lt.prototype,"maxPoints",2),mt([g("uint16")],lt.prototype,"maxContours",2),mt([g("uint16")],lt.prototype,"maxComponentPoints",2),mt([g("uint16")],lt.prototype,"maxComponentContours",2),mt([g("uint16")],lt.prototype,"maxZones",2),mt([g("uint16")],lt.prototype,"maxTwilightPoints",2),mt([g("uint16")],lt.prototype,"maxStorage",2),mt([g("uint16")],lt.prototype,"maxFunctionDefs",2),mt([g("uint16")],lt.prototype,"maxInstructionDefs",2),mt([g("uint16")],lt.prototype,"maxStackElements",2),mt([g("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([g("uint16")],lt.prototype,"maxComponentElements",2),mt([g("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var Ai=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Ke=(i,e,t,n)=>{for(var r=n>1?void 0:n?ki(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ai(e,t,r),r};const Cr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},On={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},_i={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Mr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Oe=class extends yt{constructor(){super(...arguments);M(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=On.Macintosh,o=_i.Default,s=0;t.some(l=>l.platform===On.Microsoft&&l.encoding===Mr.UCS2&&l.language===1033)&&(r=On.Microsoft,o=Mr.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===o&&h.language===s&&Cr[h.nameId]&&(a[Cr[h.nameId]]=s===0?Os(h.name):Bs(h.name))}return a}};Ke([g("uint16")],Oe.prototype,"format",2),Ke([g("uint16")],Oe.prototype,"count",2),Ke([g("uint16")],Oe.prototype,"stringOffset",2),Oe=Ke([dt("name")],Oe);var Ii=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,z=(i,e,t,n)=>{for(var r=n>1?void 0:n?Oi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ii(e,t,r),r};let $=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};z([g("uint16")],$.prototype,"version",2),z([g("int16")],$.prototype,"xAvgCharWidth",2),z([g("uint16")],$.prototype,"usWeightClass",2),z([g("uint16")],$.prototype,"usWidthClass",2),z([g("uint16")],$.prototype,"fsType",2),z([g("uint16")],$.prototype,"ySubscriptXSize",2),z([g("uint16")],$.prototype,"ySubscriptYSize",2),z([g("uint16")],$.prototype,"ySubscriptXOffset",2),z([g("uint16")],$.prototype,"ySubscriptYOffset",2),z([g("uint16")],$.prototype,"ySuperscriptXSize",2),z([g("uint16")],$.prototype,"ySuperscriptYSize",2),z([g("uint16")],$.prototype,"ySuperscriptXOffset",2),z([g("uint16")],$.prototype,"ySuperscriptYOffset",2),z([g("uint16")],$.prototype,"yStrikeoutSize",2),z([g("uint16")],$.prototype,"yStrikeoutPosition",2),z([g("uint16")],$.prototype,"sFamilyClass",2),z([g({type:"uint8"})],$.prototype,"bFamilyType",2),z([g({type:"uint8"})],$.prototype,"bSerifStyle",2),z([g({type:"uint8"})],$.prototype,"bWeight",2),z([g({type:"uint8"})],$.prototype,"bProportion",2),z([g({type:"uint8"})],$.prototype,"bContrast",2),z([g({type:"uint8"})],$.prototype,"bStrokeVariation",2),z([g({type:"uint8"})],$.prototype,"bArmStyle",2),z([g({type:"uint8"})],$.prototype,"bLetterform",2),z([g({type:"uint8"})],$.prototype,"bMidline",2),z([g({type:"uint8"})],$.prototype,"bXHeight",2),z([g({type:"uint8",size:16})],$.prototype,"ulUnicodeRange",2),z([g({type:"char",size:4})],$.prototype,"achVendID",2),z([g("uint16")],$.prototype,"fsSelection",2),z([g("uint16")],$.prototype,"usFirstCharIndex",2),z([g("uint16")],$.prototype,"usLastCharIndex",2),z([g("int16")],$.prototype,"sTypoAscender",2),z([g("int16")],$.prototype,"sTypoDescender",2),z([g("int16")],$.prototype,"sTypoLineGap",2),z([g("uint16")],$.prototype,"usWinAscent",2),z([g("uint16")],$.prototype,"usWinDescent",2),z([g({offset:72,type:"uint8",size:8})],$.prototype,"ulCodePageRange",2),z([g({offset:72,type:"int16"})],$.prototype,"sxHeight",2),z([g("int16")],$.prototype,"sCapHeight",2),z([g("uint16")],$.prototype,"usDefaultChar",2),z([g("uint16")],$.prototype,"usBreakChar",2),z([g("uint16")],$.prototype,"usMaxContext",2),$=z([dt("OS/2","os2")],$);var Bi=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Rt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Bi(e,t,r),r};let Lt=class extends yt{constructor(i=new ArrayBuffer(32),e,t){super(i,e,t)}};Rt([g("fixed")],Lt.prototype,"format",2),Rt([g("fixed")],Lt.prototype,"italicAngle",2),Rt([g("int16")],Lt.prototype,"underlinePosition",2),Rt([g("int16")],Lt.prototype,"underlineThickness",2),Rt([g("uint32")],Lt.prototype,"isFixedPitch",2),Rt([g("uint32")],Lt.prototype,"minMemType42",2),Rt([g("uint32")],Lt.prototype,"maxMemType42",2),Rt([g("uint32")],Lt.prototype,"minMemType1",2),Rt([g("uint32")],Lt.prototype,"maxMemType1",2),Lt=Rt([dt("post")],Lt);var Di=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,St=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ui(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Di(e,t,r),r};let xt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};St([g("fixed")],xt.prototype,"version",2),St([g("int16")],xt.prototype,"vertTypoAscender",2),St([g("int16")],xt.prototype,"vertTypoDescender",2),St([g("int16")],xt.prototype,"vertTypoLineGap",2),St([g("int16")],xt.prototype,"advanceHeightMax",2),St([g("int16")],xt.prototype,"minTopSideBearing",2),St([g("int16")],xt.prototype,"minBottomSideBearing",2),St([g("int16")],xt.prototype,"yMaxExtent",2),St([g("int16")],xt.prototype,"caretSlopeRise",2),St([g("int16")],xt.prototype,"caretSlopeRun",2),St([g("int16")],xt.prototype,"caretOffset",2),St([g({type:"int16",size:4})],xt.prototype,"reserved",2),St([g("int16")],xt.prototype,"metricDataFormat",2),St([g("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Li=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Fi=(i,e,t,n)=>{for(var r=n>1?void 0:n?$i(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Li(e,t,r),r};let Bn=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new Bn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const e=this._sfnt.maxp.numGlyphs,t=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((s,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};Bn=Fi([dt("vmtx")],Bn);var zi=Object.defineProperty,Be=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zi(e,t,r),r};class $t extends Sn{constructor(){super(...arguments);M(this,"format","TrueType");M(this,"mimeType","font/ttf");M(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(he(t).getUint32(0))}static checksum(t){const n=he(t);let r=n.byteLength;for(;r%4;)r++;let o=0;for(let s=0,a=r/4;s<a;s+=4)s*4<r-4&&(o+=n.getUint32(s*4,!1));return o&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,o=Array.from(t.tableViews.values()).reduce((u,d)=>u+n(d.byteLength),0),s=new this(new ArrayBuffer(12+r*16+o));s.scalerType=65536,s.numTables=r;const a=Math.log(2);s.searchRange=Math.floor(Math.log(r)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=r*16-s.searchRange;let l=12+r*16,h=0;const c=s.getDirectories();t.tableViews.forEach((u,d)=>{const p=c[h++];p.tag=d,p.checkSum=this.checksum(u),p.offset=l,p.length=u.byteLength,s.view.writeBytes(u,l),l+=n(p.length)});const f=s.createSfnt().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Pe(this.view.buffer,t);return t+=n.view.byteLength,n})}createSfnt(){return new ce(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}M($t,"signature",new Set([65536,1953658213,1954115633])),Be([g("uint32")],$t.prototype,"scalerType"),Be([g("uint16")],$t.prototype,"numTables"),Be([g("uint16")],$t.prototype,"searchRange"),Be([g("uint16")],$t.prototype,"entrySelector"),Be([g("uint16")],$t.prototype,"rangeShift");class Qe extends $t{constructor(){super(...arguments);M(this,"format","OpenType");M(this,"mimeType","font/otf")}static from(t){return super.from(t)}}M(Qe,"signature",new Set([1330926671]));var ji=Object.defineProperty,Ee=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&ji(e,t,r),r};class de extends Ot{constructor(e,t){super(e,t,20)}}Ee([g({type:"char",size:4})],de.prototype,"tag"),Ee([g("uint32")],de.prototype,"offset"),Ee([g("uint32")],de.prototype,"compLength"),Ee([g("uint32")],de.prototype,"origLength"),Ee([g("uint32")],de.prototype,"origChecksum");var Ni=Object.defineProperty,It=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ni(e,t,r),r};const Mt=(ee=class extends Sn{constructor(){super(...arguments);M(this,"format","WOFF");M(this,"mimeType","font/woff");M(this,"_sfnt")}get subfontFormat(){return $t.is(this.flavor)?"TrueType":Qe.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(he(t).getUint32(0))}static checkSum(t){const n=he(t),r=n.byteLength,o=Math.floor(r/4);let s=0,a=0;for(;a<o;)s+=n.getUint32(4*a++,!1);let l=r-o*4;if(l){let h=o*4;for(;l>0;)s+=n.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,n=new ArrayBuffer(0)){const r=u=>u+3&-4,o=[];t.tableViews.forEach((u,d)=>{const p=he(Ms(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));o.push({tag:d,view:p.byteLength<u.byteLength?p:u,rawView:u})});const s=o.length,a=o.reduce((u,d)=>u+r(d.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*s+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSfntSize=12+16*s+o.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return o.forEach(u=>{const d=f[c++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=ee.checkSum(u.rawView),d.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(d.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new de(this.view.buffer,t);return t+=n.view.byteLength,n})}createSfnt(){return new ce(this.getDirectories().reduce((t,n)=>{const r=n.tag,o=this.view.byteOffset+n.offset,s=n.compLength,a=n.origLength,l=o+s;return t[r]=s>=a?new DataView(this.view.buffer,o,s):new DataView(Ps(new Uint8Array(this.view.buffer.slice(o,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);It([g("uint32")],Mt.prototype,"signature"),It([g("uint32")],Mt.prototype,"flavor"),It([g("uint32")],Mt.prototype,"length"),It([g("uint16")],Mt.prototype,"numTables"),It([g("uint16")],Mt.prototype,"reserved"),It([g("uint32")],Mt.prototype,"totalSfntSize"),It([g("uint16")],Mt.prototype,"majorVersion"),It([g("uint16")],Mt.prototype,"minorVersion"),It([g("uint32")],Mt.prototype,"metaOffset"),It([g("uint32")],Mt.prototype,"metaLength"),It([g("uint32")],Mt.prototype,"metaOrigLength"),It([g("uint32")],Mt.prototype,"privOffset"),It([g("uint32")],Mt.prototype,"privLength");let En=Mt;function Ri(i,e=!0){if($t.is(i))return new $t(i);if(Qe.is(i))return new Qe(i);if(En.is(i))return new En(i);if(e)throw new Error("Failed to parseFont")}const un=class un{constructor(){M(this,"fallbackFont");M(this,"loading",new Map);M(this,"loaded",new Map);M(this,"familyToUrl",new Map)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...un.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
1
|
+
(function(R,ct){typeof exports=="object"&&typeof module<"u"?ct(exports):typeof define=="function"&&define.amd?define(["exports"],ct):(R=typeof globalThis<"u"?globalThis:R||self,ct(R.modernText={}))})(this,function(R){"use strict";var ba=Object.defineProperty;var Sa=(R,ct,Nt)=>ct in R?ba(R,ct,{enumerable:!0,configurable:!0,writable:!0,value:Nt}):R[ct]=Nt;var M=(R,ct,Nt)=>Sa(R,typeof ct!="symbol"?ct+"":ct,Nt);var ee;function ct(i,e,t){if(typeof e=="string"&&e.startsWith("linear-gradient")){const{x0:n,y0:r,x1:o,y1:s,stops:a}=fs(e,t.left,t.top,t.width,t.height),l=i.createLinearGradient(n,r,o,s);return a.forEach(h=>l.addColorStop(h.offset,h.color)),l}return e}function Nt(i,e,t){i!=null&&i.color&&(i.color=ct(t,i.color,e)),i!=null&&i.backgroundColor&&(i.backgroundColor=ct(t,i.backgroundColor,e)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=ct(t,i.textStrokeColor,e))}function fs(i,e,t,n,r){var d;const o=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",s=o.split(",")[0],a=s.includes("deg")?s:"0deg",l=o.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),c=(Number(a.replace("deg",""))||0)*Math.PI/180,f=n*Math.sin(c),u=r*Math.cos(c);return{x0:e+n/2-f,y0:t+r/2+u,x1:e+n/2+f,y1:t+r/2-u,stops:Array.from(l).map(p=>{let m=p[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(p[3].replace("%",""))/100,color:m}})}}function le(i){const{ctx:e,path:t,fontSize:n,clipRect:r}=i;e.save(),e.beginPath();const o=t.style,s={...o,fill:i.color??o.fill,stroke:i.textStrokeColor??o.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*n:o.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*n,shadowOffsetY:(i.shadowOffsetY??0)*n,shadowBlur:(i.shadowBlur??0)*n,shadowColor:i.shadowColor};r&&(e.rect(r.left,r.top,r.width,r.height),e.clip(),e.beginPath()),t.drawTo(e,s),e.restore()}function Yn(i,e,t){const{left:n,top:r,width:o,height:s}=t,a=i.canvas;a.dataset.viewBox=`${n} ${r} ${o} ${s}`,a.dataset.pixelRatio=String(e);const l=o,h=s;a.width=Math.max(1,Math.ceil(l*e)),a.height=Math.max(1,Math.ceil(h*e)),a.style.width=`${l}px`,a.style.height=`${h}px`,i.clearRect(0,0,a.width,a.height),i.scale(e,e),i.translate(-n,-r)}function Kn(i,e){const{paragraphs:t,computedStyle:n,glyphBox:r}=e;Nt(n,r,i),t.forEach(o=>{Nt(o.computedStyle,o.lineBox,i),o.fragments.forEach(s=>{Nt(s.computedStyle,s.inlineBox,i)})})}var ft=Uint8Array,_t=Uint16Array,pn=Int32Array,ze=new ft([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ne=new ft([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dn=new ft([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qn=function(i,e){for(var t=new _t(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new pn(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},Jn=Qn(ze,2),tr=Jn.b,yn=Jn.r;tr[28]=258,yn[258]=28;for(var er=Qn(Ne,0),us=er.b,nr=er.r,gn=new _t(32768),Q=0;Q<32768;++Q){var Ht=(Q&43690)>>1|(Q&21845)<<1;Ht=(Ht&52428)>>2|(Ht&13107)<<2,Ht=(Ht&61680)>>4|(Ht&3855)<<4,gn[Q]=((Ht&65280)>>8|(Ht&255)<<8)>>1}for(var jt=function(i,e,t){for(var n=i.length,r=0,o=new _t(e);r<n;++r)i[r]&&++o[i[r]-1];var s=new _t(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new _t(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var h=r<<4|i[r],c=e-i[r],f=s[i[r]-1]++<<c,u=f|(1<<c)-1;f<=u;++f)a[gn[f]>>l]=h}else for(a=new _t(n),r=0;r<n;++r)i[r]&&(a[r]=gn[s[i[r]-1]++]>>15-i[r]);return a},Zt=new ft(288),Q=0;Q<144;++Q)Zt[Q]=8;for(var Q=144;Q<256;++Q)Zt[Q]=9;for(var Q=256;Q<280;++Q)Zt[Q]=7;for(var Q=280;Q<288;++Q)Zt[Q]=8;for(var be=new ft(32),Q=0;Q<32;++Q)be[Q]=5;var ps=jt(Zt,9,0),ds=jt(Zt,9,1),ys=jt(be,5,0),gs=jt(be,5,1),mn=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},Dt=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},xn=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},wn=function(i){return(i+7)/8|0},rr=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new ft(i.subarray(e,t))},ms=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ut=function(i,e,t){var n=new Error(e||ms[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,Ut),!t)throw n;return n},xs=function(i,e,t,n){var r=i.length,o=0;if(!r||e.f&&!e.l)return t||new ft(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new ft(r*3));var h=function(Ct){var At=t.length;if(Ct>At){var ht=new ft(Math.max(At*2,Ct));ht.set(t),t=ht}},c=e.f||0,f=e.p||0,u=e.b||0,d=e.l,p=e.d,m=e.m,y=e.n,k=r*8;do{if(!d){c=Dt(i,f,1);var P=Dt(i,f+1,3);if(f+=3,P)if(P==1)d=ds,p=gs,m=9,y=5;else if(P==2){var b=Dt(i,f,31)+257,S=Dt(i,f+10,15)+4,w=b+Dt(i,f+5,31)+1;f+=14;for(var I=new ft(w),$=new ft(19),E=0;E<S;++E)$[dn[E]]=Dt(i,f+E*3,7);f+=S*3;for(var _=mn($),N=(1<<_)-1,T=jt($,_,1),E=0;E<w;){var U=T[Dt(i,f,N)];f+=U&15;var v=U>>4;if(v<16)I[E++]=v;else{var V=0,B=0;for(v==16?(B=3+Dt(i,f,3),f+=2,V=I[E-1]):v==17?(B=3+Dt(i,f,7),f+=3):v==18&&(B=11+Dt(i,f,127),f+=7);B--;)I[E++]=V}}var O=I.subarray(0,b),q=I.subarray(b);m=mn(O),y=mn(q),d=jt(O,m,1),p=jt(q,y,1)}else Ut(1);else{var v=wn(f)+4,C=i[v-4]|i[v-3]<<8,x=v+C;if(x>r){l&&Ut(0);break}a&&h(u+C),t.set(i.subarray(v,x),u),e.b=u+=C,e.p=f=x*8,e.f=c;continue}if(f>k){l&&Ut(0);break}}a&&h(u+131072);for(var L=(1<<m)-1,D=(1<<y)-1,Z=f;;Z=f){var V=d[xn(i,f)&L],W=V>>4;if(f+=V&15,f>k){l&&Ut(0);break}if(V||Ut(2),W<256)t[u++]=W;else if(W==256){Z=f,d=null;break}else{var G=W-254;if(W>264){var E=W-257,j=ze[E];G=Dt(i,f,(1<<j)-1)+tr[E],f+=j}var K=p[xn(i,f)&D],X=K>>4;K||Ut(3),f+=K&15;var q=us[X];if(X>3){var j=Ne[X];q+=xn(i,f)&(1<<j)-1,f+=j}if(f>k){l&&Ut(0);break}a&&h(u+131072);var nt=u+G;if(u<q){var Wt=o-q,Bt=Math.min(q,nt);for(Wt+u<0&&Ut(3);u<Bt;++u)t[u]=n[Wt+u]}for(;u<nt;++u)t[u]=t[u-q]}}e.l=d,e.p=Z,e.b=u,e.f=c,d&&(c=1,e.m=m,e.d=p,e.n=y)}while(!c);return u!=t.length&&s?rr(t,0,u):t.subarray(0,u)},Vt=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},Se=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},vn=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,o=t.slice();if(!r)return{t:ar,l:0};if(r==1){var s=new ft(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(x,b){return x.f-b.f}),t.push({s:-1,f:25001});var a=t[0],l=t[1],h=0,c=1,f=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=t[t[h].f<t[f].f?h++:f++],l=t[h!=c&&t[h].f<t[f].f?h++:f++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};for(var u=o[0].s,n=1;n<r;++n)o[n].s>u&&(u=o[n].s);var d=new _t(u+1),p=bn(t[c-1],d,0);if(p>e){var n=0,m=0,y=p-e,k=1<<y;for(o.sort(function(b,S){return d[S.s]-d[b.s]||b.f-S.f});n<r;++n){var P=o[n].s;if(d[P]>e)m+=k-(1<<p-d[P]),d[P]=e;else break}for(m>>=y;m>0;){var v=o[n].s;d[v]<e?m-=1<<e-d[v]++-1:++n}for(;n>=0&&m;--n){var C=o[n].s;d[C]==e&&(--d[C],++m)}p=e}return{t:new ft(d),l:p}},bn=function(i,e,t){return i.s==-1?Math.max(bn(i.l,e,t+1),bn(i.r,e,t+1)):e[i.s]=t},sr=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new _t(++e),n=0,r=i[0],o=1,s=function(l){t[n++]=l},a=1;a<=e;++a)if(i[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=i[a]}return{c:t.subarray(0,n),n:e}},Ce=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},ir=function(i,e,t){var n=t.length,r=wn(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},or=function(i,e,t,n,r,o,s,a,l,h,c){Vt(e,c++,t),++r[256];for(var f=vn(r,15),u=f.t,d=f.l,p=vn(o,15),m=p.t,y=p.l,k=sr(u),P=k.c,v=k.n,C=sr(m),x=C.c,b=C.n,S=new _t(19),w=0;w<P.length;++w)++S[P[w]&31];for(var w=0;w<x.length;++w)++S[x[w]&31];for(var I=vn(S,7),$=I.t,E=I.l,_=19;_>4&&!$[dn[_-1]];--_);var N=h+5<<3,T=Ce(r,Zt)+Ce(o,be)+s,U=Ce(r,u)+Ce(o,m)+s+14+3*_+Ce(S,$)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&N<=T&&N<=U)return ir(e,c,i.subarray(l,l+h));var V,B,O,q;if(Vt(e,c,1+(U<T)),c+=2,U<T){V=jt(u,d,0),B=u,O=jt(m,y,0),q=m;var L=jt($,E,0);Vt(e,c,v-257),Vt(e,c+5,b-1),Vt(e,c+10,_-4),c+=14;for(var w=0;w<_;++w)Vt(e,c+3*w,$[dn[w]]);c+=3*_;for(var D=[P,x],Z=0;Z<2;++Z)for(var W=D[Z],w=0;w<W.length;++w){var G=W[w]&31;Vt(e,c,L[G]),c+=$[G],G>15&&(Vt(e,c,W[w]>>5&127),c+=W[w]>>12)}}else V=ps,B=Zt,O=ys,q=be;for(var w=0;w<a;++w){var j=n[w];if(j>255){var G=j>>18&31;Se(e,c,V[G+257]),c+=B[G+257],G>7&&(Vt(e,c,j>>23&31),c+=ze[G]);var K=j&31;Se(e,c,O[K]),c+=q[K],K>3&&(Se(e,c,j>>5&8191),c+=Ne[K])}else Se(e,c,V[j]),c+=B[j]}return Se(e,c,V[256]),c+B[256]},ws=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ar=new ft(0),vs=function(i,e,t,n,r,o){var s=o.z||i.length,a=new ft(n+s+5*(1+Math.ceil(s/7e3))+r),l=a.subarray(n,a.length-r),h=o.l,c=(o.r||0)&7;if(e){c&&(l[0]=o.r>>3);for(var f=ws[e-1],u=f>>13,d=f&8191,p=(1<<t)-1,m=o.p||new _t(32768),y=o.h||new _t(p+1),k=Math.ceil(t/3),P=2*k,v=function(kt){return(i[kt]^i[kt+1]<<k^i[kt+2]<<P)&p},C=new pn(25e3),x=new _t(288),b=new _t(32),S=0,w=0,I=o.i||0,$=0,E=o.w||0,_=0;I+2<s;++I){var N=v(I),T=I&32767,U=y[N];if(m[T]=U,y[N]=T,E<=I){var V=s-I;if((S>7e3||$>24576)&&(V>423||!h)){c=or(i,l,0,C,x,b,w,$,_,I-_,c),$=S=w=0,_=I;for(var B=0;B<286;++B)x[B]=0;for(var B=0;B<30;++B)b[B]=0}var O=2,q=0,L=d,D=T-U&32767;if(V>2&&N==v(I-D))for(var Z=Math.min(u,V)-1,W=Math.min(32767,I),G=Math.min(258,V);D<=W&&--L&&T!=U;){if(i[I+O]==i[I+O-D]){for(var j=0;j<G&&i[I+j]==i[I+j-D];++j);if(j>O){if(O=j,q=D,j>Z)break;for(var K=Math.min(D,j-2),X=0,B=0;B<K;++B){var nt=I-D+B&32767,Wt=m[nt],Bt=nt-Wt&32767;Bt>X&&(X=Bt,U=nt)}}}T=U,U=m[T],D+=T-U&32767}if(q){C[$++]=268435456|yn[O]<<18|nr[q];var Ct=yn[O]&31,At=nr[q]&31;w+=ze[Ct]+Ne[At],++x[257+Ct],++b[At],E=I+O,++S}else C[$++]=i[I],++x[i[I]]}}for(I=Math.max(I,E);I<s;++I)C[$++]=i[I],++x[i[I]];c=or(i,l,h,C,x,b,w,$,_,I-_,c),h||(o.r=c&7|l[c/8|0]<<3,c-=7,o.h=y,o.p=m,o.i=I,o.w=E)}else{for(var I=o.w||0;I<s+h;I+=65535){var ht=I+65535;ht>=s&&(l[c/8|0]=h,ht=s),c=ir(l,c+1,i.subarray(I,ht))}o.i=s}return rr(a,0,n+wn(c)+r)},lr=function(){var i=1,e=0;return{p:function(t){for(var n=i,r=e,o=t.length|0,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)r+=n+=t[s];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,e=r},d:function(){return i%=65521,e%=65521,(i&255)<<24|(i&65280)<<8|(e&255)<<8|e>>8}}},bs=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new ft(o.length+i.length);s.set(o),s.set(i,o.length),i=s,r.w=o.length}return vs(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},hr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},Ss=function(i,e){var t=e.level,n=t==0?0:t<6?1:t==9?3:2;if(i[0]=120,i[1]=n<<6|(e.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,e.dictionary){var r=lr();r.p(e.dictionary),hr(i,2,r.d())}},Cs=function(i,e){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&Ut(6,"invalid zlib data"),(i[1]>>5&1)==1&&Ut(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ms(i,e){e||(e={});var t=lr();t.p(i);var n=bs(i,e,e.dictionary?6:2,4);return Ss(n,e),hr(n,n.length-4,t.d()),n}function Ps(i,e){return xs(i.subarray(Cs(i),-4),{i:2},e,e)}var Ts=typeof TextDecoder<"u"&&new TextDecoder,As=0;try{Ts.decode(ar,{stream:!0}),As=1}catch{}const ks="modern-font";function Me(i,e){if(!i)throw new Error(`[${ks}] ${e}`)}function _s(i){if("buffer"in i){const e=i.buffer;return i.byteOffset>0||i.byteLength<i.buffer.byteLength?e.slice(i.byteOffset,i.byteOffset+i.byteLength):e}else return i}function he(i){return"buffer"in i?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}function Is(i){let e="";for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),r!==0&&(e+=String.fromCharCode(r));return e}function je(i){i=Is(i);const e=[];for(let t=0,n=i.length,r;t<n;t++)r=i.charCodeAt(t),e.push(r>>8),e.push(r&255);return e}function Os(i){let e="";for(let t=0,n=i.length;t<n;t++)i[t]<127?e+=String.fromCharCode(i[t]):e+=`%${(256+i[t]).toString(16).slice(1)}`;return unescape(e)}function Bs(i){let e="";for(let t=0,n=i.length;t<n;t+=2)e+=String.fromCharCode((i[t]<<8)+i[t+1]);return e}var Es=Object.defineProperty,ut=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Es(e,t,r),r};const Re={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function pt(){return function(i,e){Object.defineProperty(i.constructor.prototype,e,{get(){if(typeof e=="string"){if(e.startsWith("read"))return(...t)=>this.read(e.substring(4).toLowerCase(),...t);if(e.startsWith("write"))return(...t)=>this.write(e.substring(5).toLowerCase(),...t)}},configurable:!0,enumerable:!0})}}class at extends DataView{constructor(t,n,r,o){super(_s(t),n,r);M(this,"cursor",0);this.littleEndian=o}readColumn(t){if(t.size){const n=Array.from({length:t.size},(r,o)=>this.read(t.type,t.offset+o));switch(t.type){case"char":return n.join("");default:return n}}else return this.read(t.type,t.offset)}writeColumn(t,n){t.size?Array.from({length:t.size},(r,o)=>{this.write(t.type,n[o],t.offset+o)}):this.write(t.type,n,t.offset)}read(t,n=this.cursor,r=this.littleEndian){var h;switch(t){case"char":return this.readChar(n);case"fixed":return this.readFixed(n,r);case"longDateTime":return this.readLongDateTime(n,r)}const o=`get${t.replace(/^\S/,c=>c.toUpperCase())}`,s=this,a=(h=s[o])==null?void 0:h.bind(s),l=a==null?void 0:a(n,r);return this.cursor+=Re[t],l}readUint24(t=this.cursor){const[n,r,o]=this.readBytes(t,3);return(n<<16)+(r<<8)+o}readBytes(t,n){n==null&&(n=t,t=this.cursor);const r=[];for(let o=0;o<n;++o)r.push(this.getUint8(t+o));return this.cursor=t+n,r}readString(t,n){const r=this.readBytes(t,n);let o="";for(let s=0,a=r.length;s<a;s++)o+=String.fromCharCode(r[s]);return o}readFixed(t,n){const r=this.readInt32(t,n)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,n){const r=this.readUint32(t+4,n),o=new Date;return o.setTime(r*1e3+-20775456e5),o}readChar(t){return this.readString(t,1)}write(t,n,r=this.cursor,o=this.littleEndian){var c;switch(t){case"char":return this.writeChar(n,r);case"fixed":return this.writeFixed(n,r);case"longDateTime":return this.writeLongDateTime(n,r)}const s=`set${t.replace(/^\S/,f=>f.toUpperCase())}`,a=this,l=(c=a[s])==null?void 0:c.bind(a),h=l==null?void 0:l(r,n,o);return this.cursor+=Re[t.toLowerCase()],h}writeString(t="",n=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(n);for(let o=0,s=t.length,a;o<s;++o)a=t.charCodeAt(o)||0,a>127?this.writeUint16(a):this.writeUint8(a);return this.cursor+=r,this}writeChar(t,n){return this.writeString(t,n)}writeFixed(t,n){return this.writeInt32(Math.round(t*65536),n),this}writeLongDateTime(t,n=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const o=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,n),this.writeUint32(o,n+4),this}writeBytes(t,n=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let o=0;o<r;++o)this.setUint8(n+o,t[o])}else{const o=he(t);r=o.byteLength;for(let s=0;s<r;++s)this.setUint8(n+s,o.getUint8(s))}return this.cursor=n+r,this}seek(t){return this.cursor=t,this}}ut([pt()],at.prototype,"readInt8"),ut([pt()],at.prototype,"readInt16"),ut([pt()],at.prototype,"readInt32"),ut([pt()],at.prototype,"readUint8"),ut([pt()],at.prototype,"readUint16"),ut([pt()],at.prototype,"readUint32"),ut([pt()],at.prototype,"readFloat32"),ut([pt()],at.prototype,"readFloat64"),ut([pt()],at.prototype,"writeInt8"),ut([pt()],at.prototype,"writeInt16"),ut([pt()],at.prototype,"writeInt32"),ut([pt()],at.prototype,"writeUint8"),ut([pt()],at.prototype,"writeUint16"),ut([pt()],at.prototype,"writeUint32"),ut([pt()],at.prototype,"writeFloat32"),ut([pt()],at.prototype,"writeFloat64");const cr=new WeakMap;function g(i){const e=typeof i=="object"?i:{type:i},{size:t=1,type:n}=e;return(r,o)=>{if(typeof o!="string")return;let s=cr.get(r);s||(s={columns:[],byteLength:0},cr.set(r,s));const a={...e,name:o,byteLength:t*Re[n],offset:e.offset??s.columns.reduce((l,h)=>l+h.byteLength,0)};s.columns.push(a),s.byteLength=s.columns.reduce((l,h)=>l+Re[h.type]*(h.size??1),0),Object.defineProperty(r.constructor.prototype,o,{get(){return this.view.readColumn(a)},set(l){this.view.writeColumn(a,l)},configurable:!0,enumerable:!0})}}class Ot{constructor(e,t,n,r){M(this,"view");this.view=new at(e,t,n,r)}}class Sn extends Ot{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}}var Ds=Object.defineProperty,wt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ds(e,t,r),r};const vt=class as extends Sn{constructor(){super(...arguments);M(this,"format","EmbeddedOpenType");M(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const n=t.sfnt,o=n.name.names,s=je(o.fontFamily||""),a=s.length,l=je(o.fontStyle||""),h=l.length,c=je(o.version||""),f=c.length,u=je(o.fullName||""),d=u.length,p=86+a+4+h+4+f+4+d+2+t.view.byteLength,m=new as(new ArrayBuffer(p),0,p,!0);m.EOTSize=m.view.byteLength,m.FontDataSize=t.view.byteLength,m.Version=131073,m.Flags=0,m.Charset=1,m.MagicNumber=20556,m.Padding1=0,m.CheckSumAdjustment=n.head.checkSumAdjustment;const y=n.os2;return y&&(m.FontPANOSE=y.fontPANOSE,m.Italic=y.fsSelection,m.Weight=y.usWeightClass,m.fsType=y.fsType,m.UnicodeRange=y.ulUnicodeRange,m.CodePageRange=y.ulCodePageRange),m.view.writeUint16(a),m.view.writeBytes(s),m.view.writeUint16(0),m.view.writeUint16(h),m.view.writeBytes(l),m.view.writeUint16(0),m.view.writeUint16(f),m.view.writeBytes(c),m.view.writeUint16(0),m.view.writeUint16(d),m.view.writeBytes(u),m.view.writeUint16(0),m.view.writeUint16(0),m.view.writeBytes(t.view),m}};wt([g("uint32")],vt.prototype,"EOTSize"),wt([g("uint32")],vt.prototype,"FontDataSize"),wt([g("uint32")],vt.prototype,"Version"),wt([g("uint32")],vt.prototype,"Flags"),wt([g({type:"uint8",size:10})],vt.prototype,"FontPANOSE"),wt([g("uint8")],vt.prototype,"Charset"),wt([g("uint8")],vt.prototype,"Italic"),wt([g("uint32")],vt.prototype,"Weight"),wt([g("uint16")],vt.prototype,"fsType"),wt([g("uint16")],vt.prototype,"MagicNumber"),wt([g({type:"uint8",size:16})],vt.prototype,"UnicodeRange"),wt([g({type:"uint8",size:8})],vt.prototype,"CodePageRange"),wt([g("uint32")],vt.prototype,"CheckSumAdjustment"),wt([g({type:"uint8",size:16})],vt.prototype,"Reserved"),wt([g("uint16")],vt.prototype,"Padding1");var Us=Object.defineProperty,qe=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Us(e,t,r),r};class Pe extends Ot{constructor(e,t){super(e,t,16)}}qe([g({type:"char",size:4})],Pe.prototype,"tag"),qe([g("uint32")],Pe.prototype,"checkSum"),qe([g("uint32")],Pe.prototype,"offset"),qe([g("uint32")],Pe.prototype,"length");const Cn=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],Ls=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"];class fr{constructor(e){M(this,"index");M(this,"name");M(this,"isComposite",!1);M(this,"components",[]);M(this,"pathCommands",[]);const t={...e};if(this.index=t.index??0,t.name===".notdef"?t.unicode=void 0:t.name===".null"&&(t.unicode=0),t.unicode===0&&t.name!==".null")throw new Error('The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.');this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},o){const s=1/((o==null?void 0:o.unitsPerEm)??1e3)*n,{xScale:a=s,yScale:l=s}=r,h=this.pathCommands,c=[];for(let f=0,u=h.length;f<u;f+=1){const d=h[f];d.type==="M"?c.push({type:"M",x:e+d.x*a,y:t+-d.y*l}):d.type==="L"?c.push({type:"L",x:e+d.x*a,y:t+-d.y*l}):d.type==="Q"?c.push({type:"Q",x1:e+d.x1*a,y1:t+-d.y1*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="C"?c.push({type:"C",x1:e+d.x1*a,y1:t+-d.y1*l,x2:e+d.x2*a,y2:t+-d.y2*l,x:e+d.x*a,y:t+-d.y*l}):d.type==="Z"&&c.push({type:"Z"})}return c}}class Fs extends fr{parse(e,t,n){const r=this,{nominalWidthX:o,defaultWidthX:s,gsubrsBias:a,subrsBias:l}=e,h=e.topDict.paintType,c=this.index;let f,u,d,p;const m=[],y=[];let k=0,P=!1,v=!1,C=s,x=0,b=0;function S(T,U){m.push({type:"L",x:T,y:U})}function w(T,U,V,B,O,q){m.push({type:"C",x1:T,y1:U,x2:V,y2:B,x:O,y:q})}function I(T,U){v&&h!==2&&$(),v=!0,m.push({type:"M",x:T,y:U})}function $(){m.push({type:"Z"})}function E(T){m.push(...T)}function _(){y.length%2!==0&&!P&&(C=y.shift()+o),k+=y.length>>1,y.length=0,P=!0}function N(T){let U,V,B,O,q,L,D,Z,W,G,j,K,X=0;for(;X<T.length;){let nt=T[X++];switch(nt){case 1:_();break;case 3:_();break;case 4:y.length>1&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),I(x,b);break;case 5:for(;y.length>0;)x+=y.shift(),b+=y.shift(),S(x,b);break;case 6:for(;y.length>0&&(x+=y.shift(),S(x,b),y.length!==0);)b+=y.shift(),S(x,b);break;case 7:for(;y.length>0&&(b+=y.shift(),S(x,b),y.length!==0);)x+=y.shift(),S(x,b);break;case 8:for(;y.length>0;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 10:q=y.pop()+l,L=e.subrs[q],L&&N(L);break;case 11:return;case 12:switch(nt=T[X],X+=1,nt){case 35:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),j=W+y.shift(),K=G+y.shift(),x=j+y.shift(),b=K+y.shift(),y.shift(),w(f,u,d,p,D,Z),w(W,G,j,K,x,b);break;case 34:f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,j=W+y.shift(),K=b,x=j+y.shift(),w(f,u,d,p,D,Z),w(W,G,j,K,x,b);break;case 36:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p,W=D+y.shift(),G=p,j=W+y.shift(),K=G+y.shift(),x=j+y.shift(),w(f,u,d,p,D,Z),w(W,G,j,K,x,b);break;case 37:f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),D=d+y.shift(),Z=p+y.shift(),W=D+y.shift(),G=Z+y.shift(),j=W+y.shift(),K=G+y.shift(),Math.abs(j-x)>Math.abs(K-b)?x=j+y.shift():b=K+y.shift(),w(f,u,d,p,D,Z),w(W,G,j,K,x,b);break;default:console.warn(`Glyph ${c}: unknown operator ${1200+nt}`),y.length=0}break;case 14:if(y.length>=4){const Wt=Cn[y.pop()],Bt=Cn[y.pop()],Ct=y.pop(),At=y.pop();if(Wt&&Bt){r.isComposite=!0,r.components=[];const ht=e.charset.indexOf(Wt),kt=e.charset.indexOf(Bt);r.components.push({glyphIndex:kt,dx:0,dy:0}),r.components.push({glyphIndex:ht,dx:At,dy:Ct}),E(n.get(kt).pathCommands);const $t=JSON.parse(JSON.stringify(n.get(ht).pathCommands));for(let zt=0;zt<$t.length;zt+=1){const Et=$t[zt];Et.type!=="Z"&&(Et.x+=At,Et.y+=Ct),(Et.type==="Q"||Et.type==="C")&&(Et.x1+=At,Et.y1+=Ct),Et.type==="C"&&(Et.x2+=At,Et.y2+=Ct)}E($t)}}else y.length>0&&!P&&(C=y.shift()+o,P=!0);v&&h!==2&&($(),v=!1);break;case 18:_();break;case 19:case 20:_(),X+=k+7>>3;break;case 21:y.length>2&&!P&&(C=y.shift()+o,P=!0),b+=y.pop(),x+=y.pop(),I(x,b);break;case 22:y.length>1&&!P&&(C=y.shift()+o,P=!0),x+=y.pop(),I(x,b);break;case 23:_();break;case 24:for(;y.length>2;)f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);x+=y.shift(),b+=y.shift(),S(x,b);break;case 25:for(;y.length>6;)x+=y.shift(),b+=y.shift(),S(x,b);f=x+y.shift(),u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+y.shift(),w(f,u,d,p,x,b);break;case 26:for(y.length%2&&(x+=y.shift());y.length>0;)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d,b=p+y.shift(),w(f,u,d,p,x,b);break;case 27:for(y.length%2&&(b+=y.shift());y.length>0;)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p,w(f,u,d,p,x,b);break;case 28:U=T[X],V=T[X+1],y.push((U<<24|V<<16)>>16),X+=2;break;case 29:q=y.pop()+a,L=e.gsubrs[q],L&&N(L);break;case 30:for(;y.length>0&&(f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b);break;case 31:for(;y.length>0&&(f=x+y.shift(),u=b,d=f+y.shift(),p=u+y.shift(),b=p+y.shift(),x=d+(y.length===1?y.shift():0),w(f,u,d,p,x,b),y.length!==0);)f=x,u=b+y.shift(),d=f+y.shift(),p=u+y.shift(),x=d+y.shift(),b=p+(y.length===1?y.shift():0),w(f,u,d,p,x,b);break;default:nt<32?console.warn(`Glyph ${c}: unknown operator ${nt}`):nt<247?y.push(nt-139):nt<251?(U=T[X],X+=1,y.push((nt-247)*256+U+108)):nt<255?(U=T[X],X+=1,y.push(-(nt-251)*256-U-108)):(U=T[X],V=T[X+1],B=T[X+2],O=T[X+3],X+=4,y.push((U<<24|V<<16|B<<8|O)/65536))}}}N(t),this.pathCommands=m,P&&(this.advanceWidth=C)}}class ur{constructor(e){M(this,"_items",[]);this._sfnt=e}get(e){const t=this._items[e];let n;if(t)n=t;else{n=this._get(e);const r=this._sfnt.hmtx.metrics[e];r&&(n.advanceWidth=n.advanceWidth||r.advanceWidth,n.leftSideBearing=n.leftSideBearing||r.leftSideBearing);const o=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);o&&(n.unicode??(n.unicode=o[0]),n.unicodes??(n.unicodes=o)),this._items[e]=n}return n}}class $s extends ur{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){const t=this._sfnt.cff,n=new Fs({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}}var zs=Object.defineProperty,pr=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zs(e,t,r),r};class Ge extends Ot{constructor(t,n,r,o){super(t,n,r,o);M(this,"_offsets");M(this,"_objects");this._init()}get offsets(){return this._offsets??(this._offsets=this.readOffsets())}get objects(){return this._objects??(this._objects=this.readObjects())}_init(){const t=this.view,n=this.count,r=this.offsetSize;this.objectOffset=(n+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[n]}readOffsets(){const t=this.view,n=this.count,r=this.offsetSize;t.seek(3);const o=[];for(let s=0,a=n+1;s<a;s++){const l=this.view;let h=0;for(let c=0;c<r;c++)h<<=8,h+=l.readUint8();o.push(h)}return o}readObjects(){const t=[];for(let n=0,r=this.count;n<r;n++)t.push(this.get(n));return t}get(t){const n=this.offsets,r=this.objectOffset,o=r+n[t],a=r+n[t+1]-o;return this._isString?this.view.readString(o,a):this.view.readBytes(o,a)}}pr([g("uint16")],Ge.prototype,"count"),pr([g("uint8")],Ge.prototype,"offsetSize");class We extends Ge{constructor(){super(...arguments);M(this,"_isString",!1)}}class dr extends Ge{constructor(){super(...arguments);M(this,"_isString",!0)}}const Ns=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],js=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Rs=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],qs=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"];function Ve(i,e){return e<=390?Ns[e]:i[e-391]}function J(i,e="number",t){return(n,r)=>{if(typeof r!="string")return;const o={type:e,operator:i,default:t??e==="number"?0:void 0};Object.defineProperty(n.constructor.prototype,r,{get(){return this._getProp(o)},set(s){this._setProp(o,s)},configurable:!0,enumerable:!0})}}class yr extends Ot{constructor(){super(...arguments);M(this,"_dict");M(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let n="";const r=15,o=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),a=s>>4,l=s&15;if(a===r||(n+=o[a],l===r))break;n+=o[l]}return Number.parseFloat(n)}_readOperand(t){const n=this.view;let r,o,s,a;if(t===28)return r=n.readUint8(),o=n.readUint8(),r<<8|o;if(t===29)return r=n.readUint8(),o=n.readUint8(),s=n.readUint8(),a=n.readUint8(),r<<24|o<<16|s<<8|a;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=n.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=n.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${n.cursor}`)}_readDict(){const t=this.view;t.seek(0);let n=[];const r=t.cursor+t.byteLength,o={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),o[s]=n,n=[]):n.push(this._readOperand(s))}return o}_getProp(t){var r;const n=this.dict[t.operator]??t.default;switch(t.type){case"number":return n[0];case"string":return Ve(((r=this._stringIndex)==null?void 0:r.objects)??[],n[0]);case"number[]":return n}return n}_setProp(t,n){}}var Gs=Object.defineProperty,Mn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Gs(e,t,r),r};class Xe extends yr{}Mn([J(19)],Xe.prototype,"subrs"),Mn([J(20)],Xe.prototype,"defaultWidthX"),Mn([J(21)],Xe.prototype,"nominalWidthX");var Ws=Object.defineProperty,rt=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ws(e,t,r),r};class et extends yr{}rt([J(0,"string")],et.prototype,"version"),rt([J(1,"string")],et.prototype,"notice"),rt([J(1200,"string")],et.prototype,"copyright"),rt([J(2,"string")],et.prototype,"fullName"),rt([J(3,"string")],et.prototype,"familyName"),rt([J(4,"string")],et.prototype,"weight"),rt([J(1201)],et.prototype,"isFixedPitch"),rt([J(1202)],et.prototype,"italicAngle"),rt([J(1203,"number",-100)],et.prototype,"underlinePosition"),rt([J(1204,"number",50)],et.prototype,"underlineThickness"),rt([J(1205)],et.prototype,"paintType"),rt([J(1206,"number",2)],et.prototype,"charstringType"),rt([J(1207,"number[]",[.001,0,0,.001,0,0])],et.prototype,"fontMatrix"),rt([J(13)],et.prototype,"uniqueId"),rt([J(5,"number[]",[0,0,0,0])],et.prototype,"fontBBox"),rt([J(1208)],et.prototype,"strokeWidth"),rt([J(14)],et.prototype,"xuid"),rt([J(15)],et.prototype,"charset"),rt([J(16)],et.prototype,"encoding"),rt([J(17)],et.prototype,"charStrings"),rt([J(18,"number[]",[0,0])],et.prototype,"private");function dt(i,e=i){return t=>{ce.tableDefinitions.set(i,{tag:i,prop:e,class:t}),Object.defineProperty(ce.prototype,e,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const ae=class ae{constructor(e){M(this,"tables",new Map);M(this,"tableViews",new Map);(e instanceof Map?e:new Map(Object.entries(e))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get hasGlyf(){return this.tableViews.has("glyf")}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){const{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}textToGlyphIndexes(e){const t=[];for(const n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){const t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,o=Array.from({length:r}),s=t.get(0);for(let a=0;a<r;a+=1)o[a]=t.get(n[a])||s;return o}getPathCommands(e,t,n,r,o){const s=[];return this.forEachGlyph(e,t,n,r,o,(a,l,h,c,f)=>{s.push(...a.getPathCommands(l,h,c,f,this))}),s}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}forEachGlyph(e,t=0,n=0,r=72,o={},s){const a=1/this.unitsPerEm*r,l=this.textToGlyphs(e);for(let h=0;h<l.length;h+=1){const c=l[h];s.call(this,c,t,n,r,o),c.advanceWidth&&(t+=c.advanceWidth*a),o.letterSpacing?t+=o.letterSpacing*r:o.tracking&&(t+=o.tracking/1e3*r)}return t}clone(){return new ae(this.tableViews)}delete(e){const t=ae.tableDefinitions.get(e);return t?(this.tableViews.delete(e),this.tables.delete(t.prop),this):this}set(e,t){const n=ae.tableDefinitions.get(e);return n&&this.tables.set(n.prop,t),this.tableViews.set(e,t.view),this}get(e){const t=ae.tableDefinitions.get(e);if(!t)return;let n=this.tables.get(t.prop);if(!n){const r=t.class;if(r){const o=this.tableViews.get(e);if(!o)return;n=new r(o.buffer,o.byteOffset,o.byteLength).setSFNT(this),this.tables.set(t.prop,n)}}return n}};M(ae,"tableDefinitions",new Map);let ce=ae;class yt extends Ot{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}}var Vs=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,Te=(i,e,t,n)=>{for(var r=n>1?void 0:n?Xs(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Vs(e,t,r),r};let fe=class extends yt{constructor(e,t,n,r){super(e,t,n,r);M(this,"_glyphs");M(this,"privateDict");M(this,"subrsIndex");this._init()}get glyphs(){return this._glyphs??(this._glyphs=new $s(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var e;return((e=this.privateDict)==null?void 0:e.defaultWidthX)??0}get nominalWidthX(){var e;return((e=this.privateDict)==null?void 0:e.nominalWidthX)??0}get subrs(){var e;return((e=this.subrsIndex)==null?void 0:e.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const e=this.view,{buffer:t,byteOffset:n}=e,r=n+4;this.nameIndex=new dr(t,r),this.topDictIndex=new We(t,this.nameIndex.endOffset),this.stringIndex=new dr(t,this.topDictIndex.endOffset),this.globalSubrIndex=new We(t,this.stringIndex.endOffset),this.topDict=new et(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const o=this.topDict.private[0],s=this.topDict.private[1];o&&(this.privateDict=new Xe(t,n+s,o).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new We(t,n+s+this.privateDict.subrs))),this.charStringsIndex=new We(t,n+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=js:this.topDict.charset===1?this.charset=Rs:this.topDict.charset===2?this.charset=qs:this.charset=this._readCharset(n+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Cn:this.topDict.encoding===1?this.encoding=Ls:this.encoding=this._readEncoding(n+this.topDict.encoding)}_readCharset(e,t,n){const r=this.view;r.seek(e);let o,s,a;t-=1;const l=[".notdef"],h=r.readUint8();if(h===0)for(o=0;o<t;o+=1)s=r.readUint16(),l.push(Ve(n,s));else if(h===1)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint8(),o=0;o<=a;o+=1)l.push(Ve(n,s)),s+=1;else if(h===2)for(;l.length<=t;)for(s=r.readUint16(),a=r.readUint16(),o=0;o<=a;o+=1)l.push(Ve(n,s)),s+=1;else throw new Error(`Unknown charset format ${h}`);return l}_readEncoding(e){const t=this.view;t.seek(e);let n,r;const o={},s=t.readUint8();if(s===0){const a=t.readUint8();for(n=0;n<a;n+=1)r=t.readUint8(),o[r]=n}else if(s===1){const a=t.readUint8();for(r=1,n=0;n<a;n+=1){const l=t.readUint8(),h=t.readUint8();for(let c=l;c<=l+h;c+=1)o[c]=r,r+=1}}else console.warn(`unknown encoding format:${s}`);return o}_calcSubroutineBias(e){let t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}};Te([g("uint8")],fe.prototype,"majorVersion",2),Te([g("uint8")],fe.prototype,"minorVersion",2),Te([g("uint8")],fe.prototype,"headerSize",2),Te([g("uint8")],fe.prototype,"offsetSize",2),fe=Te([dt("CFF ","cff")],fe);var Hs=Object.defineProperty,He=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Hs(e,t,r),r};const Ae=class ls extends Ot{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(e){const t=new ls;return t.format=0,t.length=t.view.byteLength,t.language=0,e.forEach((n,r)=>{r<256&&n<256&&t.view.writeUint8(n,6+r)}),t}getUnicodeToGlyphIndexMap(){const e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};He([g("uint16")],Ae.prototype,"format"),He([g("uint16")],Ae.prototype,"length"),He([g("uint16")],Ae.prototype,"language"),He([g({type:"uint8",size:256})],Ae.prototype,"glyphIndexArray");let gr=Ae;var Zs=Object.defineProperty,Pn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Zs(e,t,r),r};class Ze extends Ot{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){const e=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){const e=this.maxSubHeaderKey,t=6+256*2+e*8;this.view.seek(t);const n=(this.view.byteLength-t)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){const t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,o=this.subHeaders,s=this.glyphIndexArray,a=n.findIndex(h=>h===r);let l=0;for(let h=0;h<256;h++)if(n[h]===0)h>=a||h<o[0].firstCode||h>=o[0].firstCode+o[0].entryCount||o[0].idRangeOffset+(h-o[0].firstCode)>=s.length?l=0:(l=s[o[0].idRangeOffset+(h-o[0].firstCode)],l!==0&&(l=l+o[0].idDelta)),l!==0&&l<e&&t.set(h,l);else{const c=n[h];for(let f=0,u=o[c].entryCount;f<u;f++)if(o[c].idRangeOffset+f>=s.length?l=0:(l=s[o[c].idRangeOffset+f],l!==0&&(l=l+o[c].idDelta)),l!==0&&l<e){const d=(h<<8|f+o[c].firstCode)%65535;t.set(d,l)}}return t}}Pn([g("uint16")],Ze.prototype,"format"),Pn([g("uint16")],Ze.prototype,"length"),Pn([g("uint16")],Ze.prototype,"language");function mr(i){return i>32767?i-65536:i<-32767?i+65536:i}function xr(i,e){let t;const n=[];let r={};return i.forEach((o,s)=>{e&&s>e||((!t||s!==t.unicode+1||o!==t.glyphIndex+1)&&(t?(r.end=t.unicode,n.push(r),r={start:s,startId:o,delta:mr(o-s)}):(r.start=Number(s),r.startId=o,r.delta=mr(o-s))),t={unicode:s,glyphIndex:o})}),t&&(r.end=t.unicode,n.push(r)),n}var Ys=Object.defineProperty,ne=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ys(e,t,r),r};const Yt=class hs extends Ot{get endCode(){const e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(t=>this.view.writeUint16(t))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){const e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(t=>this.view.writeUint16(t))}get idDelta(){const e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){const t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(n=>this.view.writeUint16(n))}get idRangeOffsetCursor(){const e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){const e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(t=>this.view.writeUint16(t))}get glyphIndexArrayCursor(){const e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){const e=this.glyphIndexArrayCursor;this.view.seek(e);const t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(e){const t=xr(e,65535),n=t.length+1,r=Math.floor(Math.log(n)/Math.LN2),o=2*2**r,s=new hs(new ArrayBuffer(24+t.length*8));return s.format=4,s.length=s.view.byteLength,s.language=0,s.segCountX2=n*2,s.searchRange=o,s.entrySelector=r,s.rangeShift=2*n-o,s.endCode=[...t.map(a=>a.end),65535],s.reservedPad=0,s.startCode=[...t.map(a=>a.start),65535],s.idDelta=[...t.map(a=>a.delta),1],s.idRangeOffset=Array.from({length:n},()=>0),s}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,o=this.endCode,s=this.idRangeOffset,a=this.idDelta,l=this.glyphIndexArray;for(let h=0;h<t;++h)for(let c=r[h],f=o[h];c<=f;++c)if(s[h]===0)e.set(c,(c+a[h])%65536);else{const u=h+s[h]/2+(c-r[h])-n,d=l[u];d!==0?e.set(c,(d+a[h])%65536):e.set(c,0)}return e.delete(65535),e}};ne([g("uint16")],Yt.prototype,"format"),ne([g("uint16")],Yt.prototype,"length"),ne([g("uint16")],Yt.prototype,"language"),ne([g("uint16")],Yt.prototype,"segCountX2"),ne([g("uint16")],Yt.prototype,"searchRange"),ne([g("uint16")],Yt.prototype,"entrySelector"),ne([g("uint16")],Yt.prototype,"rangeShift");let wr=Yt;var Ks=Object.defineProperty,ke=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ks(e,t,r),r};class ue extends Ot{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const e=this.glyphIndexArray,t=new Map;return e.forEach((n,r)=>{t.set(r,n)}),t}}ke([g("uint16")],ue.prototype,"format"),ke([g("uint16")],ue.prototype,"length"),ke([g("uint16")],ue.prototype,"language"),ke([g("uint16")],ue.prototype,"firstCode"),ke([g("uint16")],ue.prototype,"entryCount");var Qs=Object.defineProperty,_e=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Qs(e,t,r),r};const pe=class cs extends Ot{get groups(){const e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(e){const t=xr(e),n=new cs(new ArrayBuffer(16+t.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=t.length,t.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){const o=t[n];let s=o.startGlyphCode,a=o.startCharCode;const l=o.endCharCode;for(;a<=l;)e.set(a++,s++)}return e}};_e([g("uint16")],pe.prototype,"format"),_e([g("uint16")],pe.prototype,"reserved"),_e([g("uint32")],pe.prototype,"length"),_e([g("uint32")],pe.prototype,"language"),_e([g("uint32")],pe.prototype,"nGroups");let vr=pe;var Js=Object.defineProperty,Tn=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Js(e,t,r),r};class Ye extends Ot{getVarSelectorRecords(){const e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{const t={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(t.defaultUVSOffset){this.view.seek(t.defaultUVSOffset);const n=this.view.readUint32();t.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(t.nonDefaultUVSOffset){this.view.seek(t.nonDefaultUVSOffset);const n=this.view.readUint32();t.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return t})}getUnicodeToGlyphIndexMap(){const e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){const{uVSMappings:o}=t[n];o.forEach(s=>{e.set(s.unicodeValue,s.glyphID)})}return e}}Tn([g("uint16")],Ye.prototype,"format"),Tn([g("uint32")],Ye.prototype,"length"),Tn([g("uint32")],Ye.prototype,"numVarSelectorRecords");var ti=Object.defineProperty,ei=Object.getOwnPropertyDescriptor,An=(i,e,t,n)=>{for(var r=n>1?void 0:n?ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ti(e,t,r),r};let Ie=class extends yt{constructor(){super(...arguments);M(this,"_unicodeToGlyphIndexMap");M(this,"_glyphIndexToUnicodesMap")}static from(e){const t=Array.from(e.keys()).some(f=>f>65535),n=wr.from(e),r=gr.from(e),o=t?vr.from(e):void 0,s=4+(o?32:24),a=s+n.view.byteLength,l=a+r.view.byteLength,h=[{platformID:0,platformSpecificID:3,offset:s},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:s},o&&{platformID:3,platformSpecificID:10,offset:l}].filter(Boolean),c=new Ie(new ArrayBuffer(4+8*h.length+n.view.byteLength+r.view.byteLength+((o==null?void 0:o.view.byteLength)??0)));return c.numberSubtables=h.length,c.view.seek(4),h.forEach(f=>{c.view.writeUint16(f.platformID),c.view.writeUint16(f.platformSpecificID),c.view.writeUint32(f.offset)}),c.view.writeBytes(n.view,s),c.view.writeBytes(r.view,a),o&&c.view.writeBytes(o.view,l),c}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,o=n.length;r<o;r++){const s=n[r],a=t.get(s);e.has(a)?e.get(a).push(s):e.set(a,[s])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){const e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(t=>{this.view.seek(t.offset);const n=this.view.readUint16();let r;switch(n){case 0:r=new gr(this.view.buffer,t.offset);break;case 2:r=new Ze(this.view.buffer,t.offset,this.view.readUint16());break;case 4:r=new wr(this.view.buffer,t.offset,this.view.readUint16());break;case 6:r=new ue(this.view.buffer,t.offset,this.view.readUint16());break;case 12:r=new vr(this.view.buffer,t.offset,this.view.readUint32(t.offset+4));break;case 14:default:r=new Ye(this.view.buffer,t.offset,this.view.readUint32());break}return{...t,format:n,view:r}})}readunicodeToGlyphIndexMap(){var a,l,h,c,f;const e=this.readSubtables(),t=(a=e.find(u=>u.format===0))==null?void 0:a.view,n=(l=e.find(u=>u.platformID===3&&u.platformSpecificID===3&&u.format===2))==null?void 0:l.view,r=(h=e.find(u=>u.platformID===3&&u.platformSpecificID===1&&u.format===4))==null?void 0:h.view,o=(c=e.find(u=>u.platformID===3&&u.platformSpecificID===10&&u.format===12))==null?void 0:c.view,s=(f=e.find(u=>u.platformID===0&&u.platformSpecificID===5&&u.format===14))==null?void 0:f.view;return new Map([...(t==null?void 0:t.getUnicodeToGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[]])}};An([g("uint16")],Ie.prototype,"version",2),An([g("uint16")],Ie.prototype,"numberSubtables",2),Ie=An([dt("cmap")],Ie);class ni extends fr{_parseContours(e){const t=[];let n=[];for(let r=0;r<e.length;r+=1){const o=e[r];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return Me(n.length===0,"There are still points left in the current contour."),t}_transformPoints(e,t){const n=[];for(let r=0;r<e.length;r+=1){const o=e[r],s={x:t.xScale*o.x+t.scale10*o.y+t.dx,y:t.scale01*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(s)}return n}_parseGlyphCoordinate(e,t,n,r,o){let s;return(t&r)>0?(s=e.view.readUint8(),t&o||(s=-s),s=n+s):(t&o)>0?s=n:s=n+e.view.readInt16(),s}parse(e,t,n){e.view.seek(t);const r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){const a=this.endPointIndices=[];for(let m=0;m<r;m++)a.push(e.view.readUint16());const l=this.instructionLength=e.view.readUint16();Me(l<5e3,`Bad instructionLength:${l}`);const h=this.instructions=[];for(let m=0;m<l;++m)h.push(e.view.readUint8());const c=e.view.byteOffset,f=a[a.length-1]+1;Me(f<2e4,`Bad numberOfCoordinates:${c}`);const u=[];let d,p=0;for(;p<f;)if(d=e.view.readUint8(),u.push(d),p++,d&8&&p<f){const m=e.view.readUint8();for(let y=0;y<m;y++)u.push(d),p++}if(Me(u.length===f,`Bad flags length: ${u.length}, numberOfCoordinates: ${f}`),a.length>0){const m=[];let y;if(f>0){for(let v=0;v<f;v+=1)d=u[v],y={},y.onCurve=!!(d&1),y.lastPointOfContour=a.includes(v),m.push(y);let k=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.x=this._parseGlyphCoordinate(e,d,k,2,16),k=y.x;let P=0;for(let v=0;v<f;v+=1)d=u[v],y=m[v],y.y=this._parseGlyphCoordinate(e,d,P,4,32),P=y.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,l=!0;for(;l;){a=e.view.readUint16();const h={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(h.dx=e.view.readInt16(),h.dy=e.view.readInt16()):h.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(a&2)>0?(h.dx=e.view.readInt8(),h.dy=e.view.readInt8()):h.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(a&8)>0?h.xScale=h.yScale=e.view.readInt16()/16384:(a&64)>0?(h.xScale=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384):(a&128)>0&&(h.xScale=e.view.readInt16()/16384,h.scale01=e.view.readInt16()/16384,h.scale10=e.view.readInt16()/16384,h.yScale=e.view.readInt16()/16384),this.components.push(h),l=!!(a&32)}if(a&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let h=0;h<this.instructionLength;h+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const l=this.components[a],h=n.get(l.glyphIndex);if(h.getPathCommands(),h.points){let c;if(l.matchedPoints===void 0)c=this._transformPoints(h.points,l);else{Me(l.matchedPoints[0]>this.points.length-1||l.matchedPoints[1]>h.points.length-1,`Matched points out of range in ${this.name}`);const f=this.points[l.matchedPoints[0]];let u=h.points[l.matchedPoints[1]];const d={xScale:l.xScale,scale01:l.scale01,scale10:l.scale10,yScale:l.yScale,dx:0,dy:0};u=this._transformPoints([u],d)[0],d.dx=f.x-u.x,d.dy=f.y-u.y,c=this._transformPoints(h.points,d)}this.points=this.points.concat(c)}}const o=[],s=this._parseContours(this.points);for(let a=0,l=s.length;a<l;++a){const h=s[a];let c=h[h.length-1],f=h[0];c.onCurve?o.push({type:"M",x:c.x,y:c.y}):f.onCurve?o.push({type:"M",x:f.x,y:f.y}):o.push({type:"M",x:(c.x+f.x)*.5,y:(c.y+f.y)*.5});for(let u=0,d=h.length;u<d;++u)if(c=f,f=h[(u+1)%d],c.onCurve)o.push({type:"L",x:c.x,y:c.y});else{let p=f;f.onCurve||(p={x:(c.x+f.x)*.5,y:(c.y+f.y)*.5}),o.push({type:"Q",x1:c.x,y1:c.y,x:p.x,y:p.y})}o.push({type:"Z"})}this.pathCommands=o}}class ri extends ur{get length(){return this._sfnt.loca.locations.length}_get(e){const t=this._sfnt.loca.locations,n=t[e],r=new ni({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}}var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi=(i,e,t,n)=>{for(var r=n>1?void 0:n?ii(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&si(e,t,r),r};let kn=class extends yt{constructor(){super(...arguments);M(this,"_glyphs")}static from(e){const t=e.reduce((r,o)=>r+o.byteLength,0),n=new kn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs??(this._glyphs=new ri(this._sfnt))}};kn=oi([dt("glyf")],kn);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(i,e,t,n)=>{for(var r=n>1?void 0:n?li(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ai(e,t,r),r};let br=class extends yt{};br=hi([dt("GPOS","gpos")],br);var ci=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,re=(i,e,t,n)=>{for(var r=n>1?void 0:n?fi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ci(e,t,r),r};let Kt=class extends yt{};re([g("uint16")],Kt.prototype,"majorVersion",2),re([g("uint16")],Kt.prototype,"minorVersion",2),re([g("uint16")],Kt.prototype,"scriptListOffset",2),re([g("uint16")],Kt.prototype,"featureListOffset",2),re([g("uint16")],Kt.prototype,"lookupListOffset",2),re([g("uint16")],Kt.prototype,"featureVariationsOffset",2),Kt=re([dt("GSUB","gsub")],Kt);var ui=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ot=(i,e,t,n)=>{for(var r=n>1?void 0:n?pi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&ui(e,t,r),r};let it=class extends yt{constructor(i=new ArrayBuffer(54),e){super(i,e,Math.min(54,i.byteLength-(e??0)))}};ot([g("fixed")],it.prototype,"version",2),ot([g("fixed")],it.prototype,"fontRevision",2),ot([g("uint32")],it.prototype,"checkSumAdjustment",2),ot([g("uint32")],it.prototype,"magickNumber",2),ot([g("uint16")],it.prototype,"flags",2),ot([g("uint16")],it.prototype,"unitsPerEm",2),ot([g({type:"longDateTime"})],it.prototype,"created",2),ot([g({type:"longDateTime"})],it.prototype,"modified",2),ot([g("int16")],it.prototype,"xMin",2),ot([g("int16")],it.prototype,"yMin",2),ot([g("int16")],it.prototype,"xMax",2),ot([g("int16")],it.prototype,"yMax",2),ot([g("uint16")],it.prototype,"macStyle",2),ot([g("uint16")],it.prototype,"lowestRecPPEM",2),ot([g("int16")],it.prototype,"fontDirectionHint",2),ot([g("int16")],it.prototype,"indexToLocFormat",2),ot([g("int16")],it.prototype,"glyphDataFormat",2),it=ot([dt("head")],it);var di=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,bt=(i,e,t,n)=>{for(var r=n>1?void 0:n?yi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&di(e,t,r),r};let gt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};bt([g("fixed")],gt.prototype,"version",2),bt([g("int16")],gt.prototype,"ascent",2),bt([g("int16")],gt.prototype,"descent",2),bt([g("int16")],gt.prototype,"lineGap",2),bt([g("uint16")],gt.prototype,"advanceWidthMax",2),bt([g("int16")],gt.prototype,"minLeftSideBearing",2),bt([g("int16")],gt.prototype,"minRightSideBearing",2),bt([g("int16")],gt.prototype,"xMaxExtent",2),bt([g("int16")],gt.prototype,"caretSlopeRise",2),bt([g("int16")],gt.prototype,"caretSlopeRun",2),bt([g("int16")],gt.prototype,"caretOffset",2),bt([g({type:"int16",size:4})],gt.prototype,"reserved",2),bt([g("int16")],gt.prototype,"metricDataFormat",2),bt([g("uint16")],gt.prototype,"numOfLongHorMetrics",2),gt=bt([dt("hhea")],gt);var gi=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,xi=(i,e,t,n)=>{for(var r=n>1?void 0:n?mi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&gi(e,t,r),r};let _n=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new _n(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics;let n=0;const r=this.view;return r.seek(0),Array.from({length:e}).map((o,s)=>(s<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};_n=xi([dt("hmtx")],_n);var wi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,bi=(i,e,t,n)=>{for(var r=n>1?void 0:n?vi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&wi(e,t,r),r};let Sr=class extends yt{};Sr=bi([dt("kern","kern")],Sr);var Si=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Mi=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ci(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Si(e,t,r),r};let In=class extends yt{constructor(){super(...arguments);M(this,"_locations")}static from(e,t=1){const n=e.length*(t?4:2),r=new In(new ArrayBuffer(n));return e.forEach(o=>{t?r.view.writeUint32(o):r.view.writeUint16(o/2)}),r}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};In=Mi([dt("loca")],In);var Pi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,mt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ti(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Pi(e,t,r),r};let lt=class extends yt{constructor(i=new ArrayBuffer(32),e){super(i,e,Math.min(32,i.byteLength-(e??0)))}};mt([g("fixed")],lt.prototype,"version",2),mt([g("uint16")],lt.prototype,"numGlyphs",2),mt([g("uint16")],lt.prototype,"maxPoints",2),mt([g("uint16")],lt.prototype,"maxContours",2),mt([g("uint16")],lt.prototype,"maxComponentPoints",2),mt([g("uint16")],lt.prototype,"maxComponentContours",2),mt([g("uint16")],lt.prototype,"maxZones",2),mt([g("uint16")],lt.prototype,"maxTwilightPoints",2),mt([g("uint16")],lt.prototype,"maxStorage",2),mt([g("uint16")],lt.prototype,"maxFunctionDefs",2),mt([g("uint16")],lt.prototype,"maxInstructionDefs",2),mt([g("uint16")],lt.prototype,"maxStackElements",2),mt([g("uint16")],lt.prototype,"maxSizeOfInstructions",2),mt([g("uint16")],lt.prototype,"maxComponentElements",2),mt([g("uint16")],lt.prototype,"maxComponentDepth",2),lt=mt([dt("maxp")],lt);var Ai=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Ke=(i,e,t,n)=>{for(var r=n>1?void 0:n?ki(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ai(e,t,r),r};const Cr={0:"copyright",1:"fontFamily",2:"fontSubFamily",3:"uniqueSubFamily",4:"fullName",5:"version",6:"postScriptName",7:"tradeMark",8:"manufacturer",9:"designer",10:"description",11:"urlOfFontVendor",12:"urlOfFontDesigner",13:"licence",14:"urlOfLicence",16:"preferredFamily",17:"preferredSubFamily",18:"compatibleFull",19:"sampleText"},On={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},_i={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Mr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};let Oe=class extends yt{constructor(){super(...arguments);M(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const e=this.count;this.view.seek(6);const t=[];for(let l=0;l<e;++l)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let l=0;l<e;++l){const h=t[l];h.name=this.view.readBytes(n+h.offset,h.length)}let r=On.Macintosh,o=_i.Default,s=0;t.some(l=>l.platform===On.Microsoft&&l.encoding===Mr.UCS2&&l.language===1033)&&(r=On.Microsoft,o=Mr.UCS2,s=1033);const a={};for(let l=0;l<e;++l){const h=t[l];h.platform===r&&h.encoding===o&&h.language===s&&Cr[h.nameId]&&(a[Cr[h.nameId]]=s===0?Os(h.name):Bs(h.name))}return a}};Ke([g("uint16")],Oe.prototype,"format",2),Ke([g("uint16")],Oe.prototype,"count",2),Ke([g("uint16")],Oe.prototype,"stringOffset",2),Oe=Ke([dt("name")],Oe);var Ii=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,z=(i,e,t,n)=>{for(var r=n>1?void 0:n?Oi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Ii(e,t,r),r};let F=class extends yt{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};z([g("uint16")],F.prototype,"version",2),z([g("int16")],F.prototype,"xAvgCharWidth",2),z([g("uint16")],F.prototype,"usWeightClass",2),z([g("uint16")],F.prototype,"usWidthClass",2),z([g("uint16")],F.prototype,"fsType",2),z([g("uint16")],F.prototype,"ySubscriptXSize",2),z([g("uint16")],F.prototype,"ySubscriptYSize",2),z([g("uint16")],F.prototype,"ySubscriptXOffset",2),z([g("uint16")],F.prototype,"ySubscriptYOffset",2),z([g("uint16")],F.prototype,"ySuperscriptXSize",2),z([g("uint16")],F.prototype,"ySuperscriptYSize",2),z([g("uint16")],F.prototype,"ySuperscriptXOffset",2),z([g("uint16")],F.prototype,"ySuperscriptYOffset",2),z([g("uint16")],F.prototype,"yStrikeoutSize",2),z([g("uint16")],F.prototype,"yStrikeoutPosition",2),z([g("uint16")],F.prototype,"sFamilyClass",2),z([g({type:"uint8"})],F.prototype,"bFamilyType",2),z([g({type:"uint8"})],F.prototype,"bSerifStyle",2),z([g({type:"uint8"})],F.prototype,"bWeight",2),z([g({type:"uint8"})],F.prototype,"bProportion",2),z([g({type:"uint8"})],F.prototype,"bContrast",2),z([g({type:"uint8"})],F.prototype,"bStrokeVariation",2),z([g({type:"uint8"})],F.prototype,"bArmStyle",2),z([g({type:"uint8"})],F.prototype,"bLetterform",2),z([g({type:"uint8"})],F.prototype,"bMidline",2),z([g({type:"uint8"})],F.prototype,"bXHeight",2),z([g({type:"uint8",size:16})],F.prototype,"ulUnicodeRange",2),z([g({type:"char",size:4})],F.prototype,"achVendID",2),z([g("uint16")],F.prototype,"fsSelection",2),z([g("uint16")],F.prototype,"usFirstCharIndex",2),z([g("uint16")],F.prototype,"usLastCharIndex",2),z([g("int16")],F.prototype,"sTypoAscender",2),z([g("int16")],F.prototype,"sTypoDescender",2),z([g("int16")],F.prototype,"sTypoLineGap",2),z([g("uint16")],F.prototype,"usWinAscent",2),z([g("uint16")],F.prototype,"usWinDescent",2),z([g({offset:72,type:"uint8",size:8})],F.prototype,"ulCodePageRange",2),z([g({offset:72,type:"int16"})],F.prototype,"sxHeight",2),z([g("int16")],F.prototype,"sCapHeight",2),z([g("uint16")],F.prototype,"usDefaultChar",2),z([g("uint16")],F.prototype,"usBreakChar",2),z([g("uint16")],F.prototype,"usMaxContext",2),F=z([dt("OS/2","os2")],F);var Bi=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Rt=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ei(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Bi(e,t,r),r};let Lt=class extends yt{constructor(i=new ArrayBuffer(32),e,t){super(i,e,t)}};Rt([g("fixed")],Lt.prototype,"format",2),Rt([g("fixed")],Lt.prototype,"italicAngle",2),Rt([g("int16")],Lt.prototype,"underlinePosition",2),Rt([g("int16")],Lt.prototype,"underlineThickness",2),Rt([g("uint32")],Lt.prototype,"isFixedPitch",2),Rt([g("uint32")],Lt.prototype,"minMemType42",2),Rt([g("uint32")],Lt.prototype,"maxMemType42",2),Rt([g("uint32")],Lt.prototype,"minMemType1",2),Rt([g("uint32")],Lt.prototype,"maxMemType1",2),Lt=Rt([dt("post")],Lt);var Di=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,St=(i,e,t,n)=>{for(var r=n>1?void 0:n?Ui(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Di(e,t,r),r};let xt=class extends yt{constructor(i=new ArrayBuffer(36),e){super(i,e,Math.min(36,i.byteLength-(e??0)))}};St([g("fixed")],xt.prototype,"version",2),St([g("int16")],xt.prototype,"vertTypoAscender",2),St([g("int16")],xt.prototype,"vertTypoDescender",2),St([g("int16")],xt.prototype,"vertTypoLineGap",2),St([g("int16")],xt.prototype,"advanceHeightMax",2),St([g("int16")],xt.prototype,"minTopSideBearing",2),St([g("int16")],xt.prototype,"minBottomSideBearing",2),St([g("int16")],xt.prototype,"yMaxExtent",2),St([g("int16")],xt.prototype,"caretSlopeRise",2),St([g("int16")],xt.prototype,"caretSlopeRun",2),St([g("int16")],xt.prototype,"caretOffset",2),St([g({type:"int16",size:4})],xt.prototype,"reserved",2),St([g("int16")],xt.prototype,"metricDataFormat",2),St([g("int16")],xt.prototype,"numOfLongVerMetrics",2),xt=St([dt("vhea")],xt);var Li=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,$i=(i,e,t,n)=>{for(var r=n>1?void 0:n?Fi(e,t):e,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=(n?s(e,t,r):s(r))||r);return n&&r&&Li(e,t,r),r};let Bn=class extends yt{constructor(){super(...arguments);M(this,"_metrics")}static from(e){const t=e.length*4,n=new Bn(new ArrayBuffer(t));return e.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var o;const e=this._sfnt.maxp.numGlyphs,t=((o=this._sfnt.vhea)==null?void 0:o.numOfLongVerMetrics)??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((s,a)=>(a<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readUint8()}))}};Bn=$i([dt("vmtx")],Bn);var zi=Object.defineProperty,Be=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&zi(e,t,r),r};class Ft extends Sn{constructor(){super(...arguments);M(this,"format","TrueType");M(this,"mimeType","font/ttf");M(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(he(t).getUint32(0))}static checksum(t){const n=he(t);let r=n.byteLength;for(;r%4;)r++;let o=0;for(let s=0,a=r/4;s<a;s+=4)s*4<r-4&&(o+=n.getUint32(s*4,!1));return o&4294967295}static from(t){const n=u=>u+3&-4,r=t.tableViews.size,o=Array.from(t.tableViews.values()).reduce((u,d)=>u+n(d.byteLength),0),s=new this(new ArrayBuffer(12+r*16+o));s.scalerType=65536,s.numTables=r;const a=Math.log(2);s.searchRange=Math.floor(Math.log(r)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=r*16-s.searchRange;let l=12+r*16,h=0;const c=s.getDirectories();t.tableViews.forEach((u,d)=>{const p=c[h++];p.tag=d,p.checkSum=this.checksum(u),p.offset=l,p.length=u.byteLength,s.view.writeBytes(u,l),l+=n(p.length)});const f=s.createSFNT().head;return f.checkSumAdjustment=0,f.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const n=new Pe(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new ce(this.getDirectories().reduce((t,n)=>(t[n.tag]=new DataView(this.view.buffer,this.view.byteOffset+n.offset,n.length),t),{}))}}M(Ft,"signature",new Set([65536,1953658213,1954115633])),Be([g("uint32")],Ft.prototype,"scalerType"),Be([g("uint16")],Ft.prototype,"numTables"),Be([g("uint16")],Ft.prototype,"searchRange"),Be([g("uint16")],Ft.prototype,"entrySelector"),Be([g("uint16")],Ft.prototype,"rangeShift");class Qe extends Ft{constructor(){super(...arguments);M(this,"format","OpenType");M(this,"mimeType","font/otf")}static from(t){return super.from(t)}}M(Qe,"signature",new Set([1330926671]));var Ni=Object.defineProperty,Ee=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&Ni(e,t,r),r};class de extends Ot{constructor(e,t){super(e,t,20)}}Ee([g({type:"char",size:4})],de.prototype,"tag"),Ee([g("uint32")],de.prototype,"offset"),Ee([g("uint32")],de.prototype,"compLength"),Ee([g("uint32")],de.prototype,"origLength"),Ee([g("uint32")],de.prototype,"origChecksum");var ji=Object.defineProperty,It=(i,e,t,n)=>{for(var r=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(r=s(e,t,r)||r);return r&&ji(e,t,r),r};const Mt=(ee=class extends Sn{constructor(){super(...arguments);M(this,"format","WOFF");M(this,"mimeType","font/woff");M(this,"_sfnt")}get subfontFormat(){return Ft.is(this.flavor)?"TrueType":Qe.is(this.flavor)?"OpenType":"Open"}get sfnt(){return this._sfnt||(this._sfnt=this.createSFNT()),this._sfnt}static is(t){return typeof t=="number"?this.signature.has(t):this.signature.has(he(t).getUint32(0))}static checkSum(t){const n=he(t),r=n.byteLength,o=Math.floor(r/4);let s=0,a=0;for(;a<o;)s+=n.getUint32(4*a++,!1);let l=r-o*4;if(l){let h=o*4;for(;l>0;)s+=n.getUint8(h)<<l*8,h++,l--}return s%4294967296}static from(t,n=new ArrayBuffer(0)){const r=u=>u+3&-4,o=[];t.tableViews.forEach((u,d)=>{const p=he(Ms(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));o.push({tag:d,view:p.byteLength<u.byteLength?p:u,rawView:u})});const s=o.length,a=o.reduce((u,d)=>u+r(d.view.byteLength),0),l=new ee(new ArrayBuffer(44+20*s+a+n.byteLength));l.signature=2001684038,l.flavor=65536,l.length=l.view.byteLength,l.numTables=s,l.totalSFNTSize=12+16*s+o.reduce((u,d)=>u+r(d.rawView.byteLength),0);let h=44+s*20,c=0;const f=l.getDirectories();return o.forEach(u=>{const d=f[c++];d.tag=u.tag,d.offset=h,d.compLength=u.view.byteLength,d.origChecksum=ee.checkSum(u.rawView),d.origLength=u.rawView.byteLength,l.view.writeBytes(u.view,h),h+=r(d.compLength)}),l.view.writeBytes(n),l}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const n=new de(this.view.buffer,t);return t+=n.view.byteLength,n})}createSFNT(){return new ce(this.getDirectories().reduce((t,n)=>{const r=n.tag,o=this.view.byteOffset+n.offset,s=n.compLength,a=n.origLength,l=o+s;return t[r]=s>=a?new DataView(this.view.buffer,o,s):new DataView(Ps(new Uint8Array(this.view.buffer.slice(o,l))).buffer),t},{}))}},M(ee,"signature",new Set([2001684038])),ee);It([g("uint32")],Mt.prototype,"signature"),It([g("uint32")],Mt.prototype,"flavor"),It([g("uint32")],Mt.prototype,"length"),It([g("uint16")],Mt.prototype,"numTables"),It([g("uint16")],Mt.prototype,"reserved"),It([g("uint32")],Mt.prototype,"totalSFNTSize"),It([g("uint16")],Mt.prototype,"majorVersion"),It([g("uint16")],Mt.prototype,"minorVersion"),It([g("uint32")],Mt.prototype,"metaOffset"),It([g("uint32")],Mt.prototype,"metaLength"),It([g("uint32")],Mt.prototype,"metaOrigLength"),It([g("uint32")],Mt.prototype,"privOffset"),It([g("uint32")],Mt.prototype,"privLength");let En=Mt;function Ri(i,e=!0){if(Ft.is(i))return new Ft(i);if(Qe.is(i))return new Qe(i);if(En.is(i))return new En(i);if(e)throw new Error("Failed to parseFont")}function qi(i,e=!0){const t=Ri(i,!1);if(t)return t;if(e)throw new Error("Failed to parseFont")}const un=class un{constructor(){M(this,"fallbackFont");M(this,"loading",new Map);M(this,"loaded",new Map);M(this,"familyToUrl",new Map)}_createRequest(e,t){const n=new AbortController;return{url:e,when:fetch(e,{...un.defaultRequestInit,...t,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(e,t){return document.fonts.add(new FontFace(e,t)),this}injectStyleTag(e,t){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
|
|
2
2
|
font-family: "${e}";
|
|
3
3
|
src: url(${t});
|
|
4
|
-
}`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,o)=>r||this.loaded.get(o),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:o=!0,...s}=t,{src:a}=e;if(this.loaded.has(a))return n&&(this.loading.forEach(u=>u.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,s),this.loading.set(a,l)),n&&this.loading.forEach((u,d)=>{u!==l&&(u.cancel(),this.loading.delete(d))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const d=f(u);return t.noAdd||this.loaded.set(e.src,d),d.familySet.forEach(p=>{this.familyToUrl.set(p,a),typeof document<"u"&&(r&&this.injectFontFace(p,u),o&&this.injectStyleTag(p,a))}),d}}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return f();throw u}).finally(()=>{this.loading.delete(a)});function h(){return e.family?Array.isArray(e.family)?e.family:[e.family]:[]}function c(u){return h().forEach(d=>{u.familySet.add(d)}),u}function f(u=new ArrayBuffer(0)){let d;function p(){return d||(d=u.byteLength?Ri(u,!1):void 0),d}function m(){const y=p();if(y instanceof $t||y instanceof En)return y.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:p,getSfnt:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};M(un,"defaultRequestInit",{cache:"force-cache"});let Dn=un;const qi=new Dn;function Gi(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=Pr(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h;if(n&&(o=Zi(i,e,o,t)),i.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const d=i[u],p=i[u+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>f&&(f=p)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return De(o,s,t,a,l,h,0),s}function Pr(i,e,t,n,r){let o;if(r===oo(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=_r(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=_r(s/n|0,i[s],i[s+1],o);return o&&ye(o,o.next)&&($e(o),o=o.next),o}function se(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(ye(t,t.next)||tt(t.prev,t,t.next)===0)){if($e(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function De(i,e,t,n,r,o,s){if(!i)return;!s&&o&&to(i,n,r,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,h=i.next;if(o?Vi(i,n,r,o):Wi(i)){e.push(l.i,i.i,h.i),$e(i),i=h.next,a=h.next;continue}if(i=h,i===a){s?s===1?(i=Xi(se(i),e),De(i,e,t,n,r,o,2)):s===2&&Hi(i,e,t,n,r,o):De(se(i),e,t,n,r,o,1);break}}}function Wi(i){const e=i.prev,t=i,n=i.next;if(tt(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,o,s),f=Math.min(a,l,h),u=Math.max(r,o,s),d=Math.max(a,l,h);let p=n.next;for(;p!==e;){if(p.x>=c&&p.x<=u&&p.y>=f&&p.y<=d&&Ue(r,a,o,l,s,h,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Vi(i,e,t,n){const r=i.prev,o=i,s=i.next;if(tt(r,o,s)>=0)return!1;const a=r.x,l=o.x,h=s.x,c=r.y,f=o.y,u=s.y,d=Math.min(a,l,h),p=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),k=Un(d,p,e,t,n),P=Un(m,y,e,t,n);let v=i.prevZ,C=i.nextZ;for(;v&&v.z>=k&&C&&C.z<=P;){if(v.x>=d&&v.x<=m&&v.y>=p&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0||(v=v.prevZ,C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;v&&v.z>=k;){if(v.x>=d&&v.x<=m&&v.y>=p&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;C&&C.z<=P;){if(C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Xi(i,e){let t=i;do{const n=t.prev,r=t.next.next;!ye(n,r)&&Ar(n,t,t.next,r)&&Le(n,r)&&Le(r,n)&&(e.push(n.i,t.i,r.i),$e(t),$e(t.next),t=i=r),t=t.next}while(t!==i);return se(t)}function Hi(i,e,t,n,r,o){let s=i;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&ro(s,a)){let l=kr(s,a);s=se(s,s.next),l=se(l,l.next),De(s,e,t,n,r,o,0),De(l,e,t,n,r,o,0);return}a=a.next}s=s.next}while(s!==i)}function Zi(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const a=e[o]*n,l=o<s-1?e[o+1]*n:i.length,h=Pr(i,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(no(h))}r.sort(Yi);for(let o=0;o<r.length;o++)t=Ki(r[o],t);return t}function Yi(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Ki(i,e){const t=Qi(i,e);if(!t)return e;const n=kr(t,i);return se(n,n.next),se(t,t.next)}function Qi(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(ye(i,t))return t;do{if(ye(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>o&&(o=f,s=t.x<t.next.x?t:t.next,f===n))return s}t=t.next}while(t!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;t=s;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Tr(r<h?n:o,r,l,h,r<h?o:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Le(t,i)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&Ji(s,t)))&&(s=t,c=f)}t=t.next}while(t!==a);return s}function Ji(i,e){return tt(i.prev,i,e.prev)<0&&tt(e.next,i,i.next)<0}function to(i,e,t,n){let r=i;do r.z===0&&(r.z=Un(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,eo(r)}function eo(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let s=n,a=0;for(let h=0;h<t&&(a++,s=s.nextZ,!!s);h++);let l=t;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function Un(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function no(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Tr(i,e,t,n,r,o,s,a){return(r-s)*(e-a)>=(i-s)*(o-a)&&(i-s)*(n-a)>=(t-s)*(e-a)&&(t-s)*(o-a)>=(r-s)*(n-a)}function Ue(i,e,t,n,r,o,s,a){return!(i===s&&e===a)&&Tr(i,e,t,n,r,o,s,a)}function ro(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!so(i,e)&&(Le(i,e)&&Le(e,i)&&io(i,e)&&(tt(i.prev,i,e.prev)||tt(i,e.prev,e))||ye(i,e)&&tt(i.prev,i,i.next)>0&&tt(e.prev,e,e.next)>0)}function tt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ye(i,e){return i.x===e.x&&i.y===e.y}function Ar(i,e,t,n){const r=tn(tt(i,e,t)),o=tn(tt(i,e,n)),s=tn(tt(t,n,i)),a=tn(tt(t,n,e));return!!(r!==o&&s!==a||r===0&&Je(i,t,e)||o===0&&Je(i,n,e)||s===0&&Je(t,i,n)||a===0&&Je(t,e,n))}function Je(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tn(i){return i>0?1:i<0?-1:0}function so(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Ar(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Le(i,e){return tt(i.prev,i,i.next)<0?tt(i,e,i.next)>=0&&tt(i,i.prev,e)>=0:tt(i,e,i.prev)<0||tt(i,i.next,e)<0}function io(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function kr(i,e){const t=Ln(i.i,i.x,i.y),n=Ln(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function _r(i,e,t,n){const r=Ln(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $e(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Ln(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function oo(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function ao(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const lo={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function $n(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=lo[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=f,i.shadowBlur=u,i.shadowColor=d}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-o*s),t.y-(r*s+o*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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}){const r=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class H{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}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 A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new H;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new H(n.left,n.top,n.right-n.left,n.bottom-n.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 H(this.left,this.top,this.width,this.height)}}class Pt{constructor(e=1,t=0,n=0,r=0,o=1,s=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,o,s,a,l,h)}set(e,t,n,r,o,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=o,c[5]=l,c[6]=n,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,s=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],d=n[5],p=n[8],m=r[0],y=r[3],k=r[6],P=r[1],v=r[4],C=r[7],x=r[2],b=r[5],S=r[8];return o[0]=s*m+a*P+l*x,o[3]=s*y+a*v+l*b,o[6]=s*k+a*C+l*S,o[1]=h*m+c*P+f*x,o[4]=h*y+c*v+f*b,o[7]=h*k+c*C+f*S,o[2]=u*m+d*P+p*x,o[5]=u*y+d*v+p*b,o[8]=u*k+d*C+p*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*s-a*h,u=a*l-c*o,d=h*o-s*l,p=t*f+n*u+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*s)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*o-a*t)*m,e[6]=d*m,e[7]=(n*l-h*t)*m,e[8]=(s*t-n*o)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply(Fn.makeScale(e,t)),this}rotate(e){return this.premultiply(Fn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Fn.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const Fn=new Pt;function Ir(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function ho(i,e,t,n,r,o,s,a){if(e===0||t===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,f=-Math.sin(n)*l+Math.cos(n)*h;let u=e*e,d=t*t;const p=c*c,m=f*f,y=p/u+m/d;if(y>1){const F=Math.sqrt(y);e=F*e,t=F*t,u=e*e,d=t*t}const k=u*m+d*p,P=(u*d-k)/k;let v=Math.sqrt(Math.max(0,P));r===o&&(v=-v);const C=v*e*f/t,x=-v*t*c/e,b=Math.cos(n)*C-Math.sin(n)*x+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(s.y+a.y)/2,w=Ir(1,0,(c-C)/e,(f-x)/t),I=Ir((c-C)/e,(f-x)/t,(-c-C)/e,(-f-x)/t)%(Math.PI*2);i.ellipse(b,S,e,t,n,w,w+I,o===0)}const st={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function qt(i,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,k,P){const v=new SyntaxError(`Unexpected character "${y}" at index ${k}.`);throw v.partial=P,v}function d(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let p;const m=i.length;for(let y=0;y<m;y++){if(p=i[y],Array.isArray(e)&&e.includes(f.length%t)&&st.FLAGS.test(p)){a=1,h=p,d();continue}if(a===0){if(st.WHITESPACE.test(p))continue;if(st.DIGIT.test(p)||st.SIGN.test(p)){a=1,h=p;continue}if(st.POINT.test(p)){a=2,h=p;continue}st.COMMA.test(p)&&(l&&u(p,y,f),l=!0)}if(a===1){if(st.DIGIT.test(p)){h+=p;continue}if(st.POINT.test(p)){h+=p,a=2;continue}if(st.EXP.test(p)){a=3;continue}st.SIGN.test(p)&&h.length===1&&st.SIGN.test(h[0])&&u(p,y,f)}if(a===2){if(st.DIGIT.test(p)){h+=p;continue}if(st.EXP.test(p)){a=3;continue}st.POINT.test(p)&&h[h.length-1]==="."&&u(p,y,f)}if(a===3){if(st.DIGIT.test(p)){c+=p;continue}if(st.SIGN.test(p)){if(c===""){c+=p;continue}c.length===1&&st.SIGN.test(c)&&u(p,y,f)}}st.WHITESPACE.test(p)?(d(),a=0,l=!1):st.COMMA.test(p)?(d(),a=0,l=!0):st.SIGN.test(p)?(d(),a=1,h=p):st.POINT.test(p)?(d(),a=2,h=p):u(p,y,f)}return d(),f}function ge(i,e){return i-(e-i)}function Or(i,e){const t=new A,n=new A;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=ge(t.x,n.x),l=ge(t.y,n.y);n.x=a,n.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),ho(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function co(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const fo=/[a-df-z][^a-df-z]*/gi;function Br(i){const e=[],t=i.match(fo);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=qt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=qt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function Er(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*i+t}function uo(i,e){const t=1-i;return t*t*t*e}function po(i,e){const t=1-i;return 3*t*t*i*e}function yo(i,e){return 3*(1-i)*i*i*e}function go(i,e){return i*i*i*e}function Dr(i,e,t,n,r){return uo(i,e)+po(i,t)+yo(i,n)+go(i,r)}function mo(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=0,indicesOffset:a=0}=e;const l=Gi(i,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+s,n[a++]=l[c+1]+s,n[a++]=l[c+2]+s;let h=s*o;for(let c=0;c<i.length;c+=2)t[h]=i[c],t[h+1]=i[c+1],h+=o}return{vertices:t,indices:n}}const xo=8,en=11920929e-14,wo=1;function vo(i,e,t,n,r,o,s,a,l=.5,h){const f=Math.min(.99,Math.max(0,l));let u=(wo-f)/1;return u*=u,zn(i,e,t,n,r,o,s,a,h,u,0),h.push(s,a),h}function zn(i,e,t,n,r,o,s,a,l,h,c){if(c>xo)return;const f=(i+t)/2,u=(e+n)/2,d=(t+r)/2,p=(n+o)/2,m=(r+s)/2,y=(o+a)/2,k=(f+d)/2,P=(u+p)/2,v=(d+m)/2,C=(p+y)/2,x=(k+v)/2,b=(P+C)/2;if(c>0){let S=s-i,w=a-e;const I=Math.abs((t-s)*w-(n-a)*S),F=Math.abs((r-s)*w-(o-a)*S);if(I>en&&F>en){if((I+F)*(I+F)<=h*(S*S+w*w)){l.push(x,b);return}}else if(I>en){if(I*I<=h*(S*S+w*w)){l.push(x,b);return}}else if(F>en){if(F*F<=h*(S*S+w*w)){l.push(x,b);return}}else if(S=x-(i+s)/2,w=b-(e+a)/2,S*S+w*w<=h){l.push(x,b);return}}zn(i,e,f,u,k,P,x,b,l,h,c+1),zn(x,b,v,C,m,y,s,a,l,h,c+1)}const bo=8,So=11920929e-14,Co=1;function Mo(i,e,t,n,r,o,s=.5,a){const h=Math.min(.99,Math.max(0,s));let c=(Co-h)/1;return c*=c,jn(a,i,e,t,n,r,o,c,0),a.push(r,o),a}function jn(i,e,t,n,r,o,s,a,l){if(l>bo)return;const h=(e+n)/2,c=(t+r)/2,f=(n+o)/2,u=(r+s)/2,d=(h+f)/2,p=(c+u)/2;let m=o-e,y=s-t;const k=Math.abs((n-o)*y-(r-s)*m);if(k>So){if(k*k<=a*(m*m+y*y)){i.push(d,p);return}}else if(m=d-(e+o)/2,y=p-(t+s)/2,m*m+y*y<=a){i.push(d,p);return}jn(i,e,t,h,c,d,p,a,l+1),jn(i,d,p,f,u,o,s,a,l+1)}function Po(i,e){const t=1-i;return t*t*e}function To(i,e){return 2*(1-i)*i*e}function Ao(i,e){return i*i*e}function Ur(i,e,t,n){return Po(i,e)+To(i,t)+Ao(i,n)}const ko=1e-4,Lr=1e-4;function _o(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,a=ko;if(i.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=Io(i);o&&(L*=-1),h=(h-.5)*L+.5}const c={x:i[0],y:i[1]},f={x:i[i.length-2],y:i[i.length-1]},u=s,d=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){i=i.slice(),d&&(i.pop(),i.pop(),f.x=i[i.length-2],f.y=i[i.length-1]);const L=(c.x+f.x)*.5,D=(f.y+c.y)*.5;i.unshift(L,D),i.push(L,D)}const p=t,m=i.length/2;let y=i.length;const k=p.length/2,P=l.width/2,v=P*P,C=l.miterLimit*l.miterLimit;let x=i[0],b=i[1],S=i[2],w=i[3],I=0,F=0,E=-(b-w),_=x-S,j=0,T=0,U=Math.sqrt(E*E+_*_);E/=U,_/=U,E*=P,_*=P;const V=h,B=(1-V)*2,O=V*2;u||(l.cap==="round"?y+=ie(x-E*(B-O)*.5,b-_*(B-O)*.5,x-E*B,b-_*B,x+E*O,b+_*O,p,!0)+2:l.cap==="square"&&(y+=$r(x,b,E,_,B,O,!0,p))),p.push(x-E*B,b-_*B),p.push(x+E*O,b+_*O);for(let L=1;L<m-1;++L){x=i[(L-1)*2],b=i[(L-1)*2+1],S=i[L*2],w=i[L*2+1],I=i[(L+1)*2],F=i[(L+1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,j=-(w-F),T=S-I,U=Math.sqrt(j*j+T*T),j/=U,T/=U,j*=P,T*=P;const D=S-x,Z=b-w,W=S-I,G=F-w,N=D*W+Z*G,K=Z*W-G*D,X=K<0;if(Math.abs(K)<.001*Math.abs(N)){p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),N>=0&&(l.join==="round"?y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+4:y+=2,p.push(S-j*O,w-T*O),p.push(S+j*B,w+T*B));continue}const nt=(-E+x)*(-_+w)-(-E+S)*(-_+b),Wt=(-j+I)*(-T+w)-(-j+S)*(-T+F),Bt=(D*Wt-W*nt)/K,Ct=(G*nt-Z*Wt)/K,At=(Bt-S)*(Bt-S)+(Ct-w)*(Ct-w),ht=S+(Bt-S)*B,kt=w+(Ct-w)*B,Ft=S-(Bt-S)*O,zt=w-(Ct-w)*O,Et=Math.min(D*D+Z*Z,W*W+G*G),os=X?B:O,wa=Et+os*os*v;At<=wa?l.join==="bevel"||At/v>C?(X?(p.push(ht,kt),p.push(S+E*O,w+_*O),p.push(ht,kt),p.push(S+j*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push(Ft,zt),p.push(S-j*B,w-T*B),p.push(Ft,zt)),y+=2):l.join==="round"?X?(p.push(ht,kt),p.push(S+E*O,w+_*O),y+=ie(S,w,S+E*O,w+_*O,S+j*O,w+T*O,p,!0)+4,p.push(ht,kt),p.push(S+j*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push(Ft,zt),y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+4,p.push(S-j*B,w-T*B),p.push(Ft,zt)):(p.push(ht,kt),p.push(Ft,zt)):(p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),l.join==="round"?X?y+=ie(S,w,S+E*O,w+_*O,S+j*O,w+T*O,p,!0)+2:y+=ie(S,w,S-E*B,w-_*B,S-j*B,w-T*B,p,!1)+2:l.join==="miter"&&At/v<=C&&(X?(p.push(Ft,zt),p.push(Ft,zt)):(p.push(ht,kt),p.push(ht,kt)),y+=2),p.push(S-j*B,w-T*B),p.push(S+j*O,w+T*O),y+=2)}x=i[(m-2)*2],b=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),u||(l.cap==="round"?y+=ie(S-E*(B-O)*.5,w-_*(B-O)*.5,S-E*B,w-_*B,S+E*O,w+_*O,p,!1)+2:l.cap==="square"&&(y+=$r(S,w,E,_,B,O,!1,p)));const q=Lr*Lr;for(let L=k;L<y+k-2;++L)x=p[L*2],b=p[L*2+1],S=p[(L+1)*2],w=p[(L+1)*2+1],I=p[(L+2)*2],F=p[(L+2)*2+1],!(Math.abs(x*(w-F)+S*(F-b)+I*(b-w))<q)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function Io(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],a=i[n+1];t+=(s-r)*(a+o),r=s,o=a}return t<0?-1:1}function $r(i,e,t,n,r,o,s,a){const l=i-t*r,h=e-n*r,c=i+t*o,f=e+n*o;let u,d;s?(u=n,d=-t):(u=-n,d=t);const p=l+u,m=h+d,y=c+u,k=f+d;return a.push(p,m),a.push(y,k),2}function ie(i,e,t,n,r,o,s,a){const l=t-i,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-i,o-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const d=f-c,p=Math.abs(d),m=Math.sqrt(l*l+h*h),y=(15*p*Math.sqrt(m)/Math.PI>>0)+1,k=d/y;if(u+=k,a){s.push(i,e),s.push(t,n);for(let P=1,v=u;P<y;P++,v+=k)s.push(i,e),s.push(i+Math.sin(v)*m,e+Math.cos(v)*m);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let P=1,v=u;P<y;P++,v+=k)s.push(i+Math.sin(v)*m,e+Math.cos(v)*m),s.push(i,e);s.push(r,o),s.push(i,e)}return y*2}class me{constructor(){M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const o=e[n],s=e[n+1];t.push(new A(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/n[0];let s=0,a=0,l=r-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=n[s]-o,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(r-1);const c=n[s],u=n[s+1]-c,d=(o-c)/u;return(s+d)/(r-1)}getTangent(e,t=new A){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){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,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;r++){const s=n[r];e.min(s),t.max(s)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return mo(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return _o(this.getAdaptivePointArray(),e)}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return co(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Oo=new Pt,Fr=new Pt,zr=new Pt,nn=new A;class Nn extends me{constructor(e=new A,t=new A,n=new A,r=0,o=0,s=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=a}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}isClockwise(){return this.clockwise}getPoint(e,t=new A){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(o?r=0:r=n),this.clockwise&&!o&&(r===n?r=-n:r=r-n);const s=this.startAngle+e*r;let a=this.cx+this.rx*Math.cos(s),l=this.cy+this.ry*Math.sin(s);if(this.rotate!==0){const h=Math.cos(this.rotate),c=Math.sin(this.rotate),f=a-this.cx,u=l-this.cy;a=f*h-u*c+this.cx,l=f*c+u*h+this.cy}return t.set(a,l)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,h=e+n*Math.cos(o)*Math.cos(l)-r*Math.sin(o)*Math.sin(l),c=t+n*Math.cos(o)*Math.sin(l)+r*Math.sin(o)*Math.cos(l),f=Math.abs(o-s),u=f>Math.PI?1:0,d=a?1:0,p=l*180/Math.PI;if(f>=2*Math.PI){const m=o+Math.PI,y=e+n*Math.cos(m)*Math.cos(l)-r*Math.sin(m)*Math.sin(l),k=t+n*Math.cos(m)*Math.sin(l)+r*Math.sin(m)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:y,y:k},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:h,y:c}]}else{const m=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),y=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:u,sweepFlag:d,x:m,y}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,o,s,a,l,!h),this}applyTransform(e){return nn.set(this.cx,this.cy),nn.applyMatrix3(e),this.cx=nn.x,this.cy=nn.y,Do(e)?Bo(this,e):Eo(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:a}=this;if(!(r>=0&&o>=0&&s>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+o)),h=l*8+(s?4:0)+(a?4:0);if(h===0)return e;const c=[];if(l===0)c[0]=c[6]=t+s,c[1]=c[3]=n+a,c[2]=c[4]=t-s,c[5]=c[7]=n-a;else{let f=0,u=l*4+(s?2:0)+2,d=u,p=h,m=s+r,y=a,k=t+m,P=t-m,v=n+y;if(c[f++]=k,c[f++]=v,c[--u]=v,c[--u]=P,a){const x=n-y;c[d++]=P,c[d++]=x,c[--p]=x,c[--p]=k}for(let x=1;x<l;x++){const b=Math.PI/2*(x/l),S=s+Math.cos(b)*r,w=a+Math.sin(b)*o,I=t+S,F=t-S,E=n+w,_=n-w;c[f++]=I,c[f++]=E,c[--u]=E,c[--u]=F,c[d++]=F,c[d++]=_,c[--p]=_,c[--p]=I}m=s,y=a+o,k=t+m,P=t-m,v=n+y;const C=n-y;c[f++]=k,c[f++]=v,c[--p]=C,c[--p]=k,s&&(c[f++]=P,c[f++]=v,c[--p]=C,c[--p]=P)}return Array.prototype.push.apply(e,c),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let u=0;u<a.length;u+=2)l+=a[u],h+=a[u+1];l/=a.length/2,h/=a.length/2;let c=o;t[c*r]=l,t[c*r+1]=h;const f=c++;for(let u=0;u<a.length;u+=2)t[c*r]=a[u],t[c*r+1]=a[u+1],u>0&&(n[s++]=c,n[s++]=f,n[s++]=c-1),c++;return n[s++]=f+1,n[s++]=f,n[s++]=c-1,{vertices:t,indices:n}}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(o*o*l*l+s*s*h*h),f=Math.sqrt(o*o*h*h+s*s*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-f),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+f),{min:e,max:t}}copy(e){return super.copy(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 Bo(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new A(t*r,t*o),a=new A(-n*o,n*r),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=Oo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=Fr.copy(c).invert(),p=zr.copy(f).transpose().multiply(f).elements,m=Uo(p[0],p[1],p[4]),y=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(i.rx=1/y,i.ry=1/k,i.rotate=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=Fr.set(y,0,0,0,k,0,0,0,1),C=zr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),x=v.multiply(C).multiply(c),b=S=>{const{x:w,y:I}=new A(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(I,w)};i.startAngle=b(i.startAngle),i.endAngle=b(i.endAngle),jr(e)&&(i.clockwise=!i.clockwise)}}function Eo(i,e){const t=Nr(e),n=Rr(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,jr(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function jr(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function Do(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=Nr(i),r=Rr(i);return Math.abs(t/(n*r))>Number.EPSILON}function Nr(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Rr(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Uo(i,e,t){let n,r,o,s,a;const l=i+t,h=i-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=i*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(e)?(a=-2*e/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(e)===0?(o=1,s=0):(a=-.5*o/e,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:n,rt2:r,cs:o,sn:s}}class Lo extends Nn{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new A(e,t),new A(n,n),new A(0,0),0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;return e.arc(t,n,r,o,s,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;let l=Math.abs(o-s);(!a&&o>s||a&&s>o)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=o;c*=a?1:-1;for(let u=0;u<h+1;u++){const d=Math.cos(f),p=Math.sin(f),m=t+d*r,y=n+p*r;e.push(m,y),f+=c}return e}}class Fe extends me{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof Fe?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),t=e.length-1}),e}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Rn extends me{constructor(e=new A,t=new A,n=new A,r=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,a,l){return new Rn(new A(e,t),new A(n,r),new A(o,s),new A(a,l))}getPoint(e,t=new A){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Dr(e,n.x,r.x,o.x,s.x),Dr(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return vo(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){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),a=(-t-o)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((f,u)=>{for(const d of f)for(let p=0;p<=u;p++){const m=p/u-.5,y=Math.min(1,Math.max(0,d+m)),k=this.getPoint(y);e.x=Math.min(e.x,k.x),e.y=Math.min(e.y,k.y),t.x=Math.max(t.x,k.x),t.y=Math.max(t.y,k.y)}})(h,10),{min:e,max:t}}toCommands(){const{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){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class $o extends Nn{constructor(e=0,t=0,n=1,r=1,o=0,s=0,a=Math.PI*2,l=!1){super(new A(e,t),new A(n,r),new A,o,s,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Qt extends me{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Qt(new A(e,t),new A(n,r))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{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,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class Fo extends Fe{}class qn extends me{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new qn(new A(e,t),new A(n,r),new A(o,s))}getPoint(e,t=new A){const{p1:n,cp:r,p2:o}=this;return t.set(Ur(e,n.x,r.x,o.x),Ur(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Mo(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+o.x),h=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,l),e.y=Math.min(e.y,n.y,o.y,a,h),t.x=Math.max(t.x,n.x,o.x,s,l),t.y=Math.max(t.y,n.y,o.y,a,h),{min:e,max:t}}toCommands(){const{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){const{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}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class zo extends Fo{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(){const{x:e,y:t,width:n,height:r}=this,o=[new A(e,t),new A(e+n,t),new A(e+n,t+r),new A(e,t+r)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const{x:a,y:l,width:h,height:c}=this,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;o*=r,t[o+u]=f[0],t[o+u+1]=f[1],u+=r,t[o+u]=f[2],t[o+u+1]=f[3],u+=r,t[o+u]=f[6],t[o+u+1]=f[7],u+=r,t[o+u]=f[4],t[o+u+1]=f[5],u+=r;const d=o/r;return n[s++]=d,n[s++]=d+1,n[s++]=d+2,n[s++]=d+1,n[s++]=d+3,n[s++]=d+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class jo extends Nn{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,a=r/2,l=e+s,h=t+a,c=Math.max(0,Math.min(o,Math.min(s,a))),f=c,u=s-c,d=a-f;return this._center=new A(l,h),this._radius=new A(c,f),this._diff=new A(u,d),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class No extends me{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,a=n[o===0?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],c=n[o>n.length-3?n.length-1:o+2];return t.set(Er(s,a.x,l.x,h.x,c.x),Er(s,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class rn extends Fe{constructor(t){super();M(this,"startPoint");M(this,"currentPoint");M(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return Or(t,this),this}addData(t){return this.addCommands(Br(t)),this}getUnevenPointArray(t=40,n=[]){return super.getUnevenPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}getSpacedPointArray(t=40,n=[]){return super.getSpacedPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}_setCurrentPoint(t){return this.currentPoint=new A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Qt(n,t)),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Qt.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(Rn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,o,s,a)),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(qn.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,a){const l=new Lo(t,n,r,o,s,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,o,s,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,a,l,h=!0){const c=new $o(t,n,r,o,s,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,o,s,a,l,h){var c,f;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){const s=new zo(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const a=new jo(t,n,r,o,s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new No([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function Ro(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function qo(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),a=r.cross(o);if(a===0)return new A((i.x+t.x)/2,(i.y+t.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new A((i.x+t.x)/2,(i.y+t.y)/2):new A(i.x+l*r.x,i.y+l*r.y)}class Tt extends Fe{constructor(t,n={}){super();M(this,"currentCurve",new rn);M(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Tt?this.curves.push(...t.curves.map(n=>n.clone())):this.curves.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length>0&&(this.currentCurve=new rn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new rn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,o,s,a){return this.currentCurve.bezierCurveTo(t,n,r,o,s,a),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,a){return this.currentCurve.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,a,l,h){return this.currentCurve.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}reset(){return this.currentCurve=new rn,this.curves.push(this.currentCurve),this.style={},this}addCommands(t){return Or(t,this),this}addData(t){return this.addCommands(Br(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],o=[],s=[];n.forEach((l,h)=>{const c=l.getControlPointRefs(),f=l.isClockwise();s[h]=c,o[h]=f;const u=c[0],d=c[c.length-1]??u;r.push({start:f?d:u,end:f?u:d,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{var u;c.start&&l.end&&f!==h&&((u=c.start)!=null&&u.equals(l.end))&&a[h].push(c.index)})}),n.forEach((l,h)=>{const c=o[h];s[h].forEach(f=>{f.add(l.getNormal(l.getTForPoint(f)).scale(c?t:-t))})}),a.forEach((l,h)=>{const c=s[h];l.forEach(f=>{const u=s[f],d=qo(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);d&&(c[c.length-1].copy(d),u[0].copy(d))})}),this}getMinMax(t=A.MAX,n=A.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const a=o/2,l=s.isClockwise(),h=[];for(let c=0;c<=1;c+=1/s.arcLengthDivision){const f=s.getPoint(c),u=s.getNormal(c),d=u.clone().scale(l?a:-a),p=u.clone().scale(l?-a:a);h.push(f.clone().add(d),f.clone().add(p),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),$n(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),$n(t,n),this.getControlPointRefs().forEach(s=>{ao(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[Ro(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class Gn{constructor(e=[]){this.paths=e}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new H(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-o),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const qr="data:image/svg+xml;",Gr=`${qr}base64,`,Wr=`${qr}charset=utf8,`;function Vr(i){if(typeof i=="string"){let e;i.startsWith(Gr)?(i=i.substring(Gr.length,i.length),e=atob(i)):i.startsWith(Wr)?(i=i.substring(Wr.length,i.length),e=decodeURIComponent(i)):e=i;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
|
|
5
|
-
${e}`);return t.documentElement}else return i}const Go="px",Wo=90,Xr=["mm","cm","in","pt","pc","px"],Hr={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 Y(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Xr.length;n<r;n++){const o=Xr[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=Hr[e][Go],t<0&&(t=Hr[e].in*Wo),t*Number.parseFloat(i)}const Vo=new Pt,sn=new Pt,Zr=new Pt,Yr=new Pt;function Xo(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Ho(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Ho(i){const e=new Pt,t=Vo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(Y(i.getAttribute("x")),Y(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=qt(o.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),sn.makeTranslation(-f,-u),Zr.makeRotation(c),Yr.multiplyMatrices(Zr,sn),sn.makeTranslation(f,u),t.multiplyMatrices(sn,Yr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Zo(i){return new Tt().arc(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("r")||0),0,Math.PI*2)}function Yo(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function Ko(i){return new Tt().ellipse(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("rx")||0),Y(i.getAttribute("ry")||0),0,0,Math.PI*2)}function Qo(i){return new Tt().moveTo(Y(i.getAttribute("x1")||0),Y(i.getAttribute("y1")||0)).lineTo(Y(i.getAttribute("x2")||0),Y(i.getAttribute("y2")||0))}function Jo(i){const e=new Tt,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const ta=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ea(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(ta,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!0,e}const na=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ra(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(na,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!1,e}function sa(i){const e=Y(i.getAttribute("x")||0),t=Y(i.getAttribute("y")||0),n=Y(i.getAttribute("rx")||i.getAttribute("ry")||0),r=Y(i.getAttribute("ry")||i.getAttribute("rx")||0),o=Y(i.getAttribute("width")),s=Y(i.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+o-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+o-n*a,t,e+o,t+r*a,e+o,t+r),l.lineTo(e+o,t+s-r),(n!==0||r!==0)&&l.bezierCurveTo(e+o,t+s-r*a,e+o-n*a,t+s,e+o-n,t+s),l.lineTo(e+n,t+s),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+s,e,t+s-r*a,e,t+s-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function Gt(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const f=i.style.item(c),u=i.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=o){i.hasAttribute(h)&&(e[c]=f(i.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,Y(h)))}function a(h){return Math.max(0,Y(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>Y(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",Y),r("visibility","visibility"),e}function Wn(i,e,t=[],n={}){var f;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=Gt(i,s,n);break;case"style":Yo(i,n);break;case"g":s=Gt(i,s,n);break;case"path":s=Gt(i,s,n),i.hasAttribute("d")&&(o=Jo(i));break;case"rect":s=Gt(i,s,n),o=sa(i);break;case"polygon":s=Gt(i,s,n),o=ea(i);break;case"polyline":s=Gt(i,s,n),o=ra(i);break;case"circle":s=Gt(i,s,n),o=Zo(i);break;case"ellipse":s=Gt(i,s,n),o=Ko(i);break;case"line":s=Gt(i,s,n),o=Qo(i);break;case"defs":r=!0;break;case"use":{s=Gt(i,s,n);const d=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),p=(f=i.viewportElement)==null?void 0:f.getElementById(d);p?Wn(p,s,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(i);break}if(s.display==="none")return t;Object.assign(e,s);const a=new Pt,l=[],h=Xo(i,a,l);o&&(o.applyTransform(a),t.push(o),o.style=e);const c=i.childNodes;for(let u=0,d=c.length;u<d;u++){const p=c[u];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||Wn(p,e,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function Kr(i){return new Gn(Wn(Vr(i),{}))}const ia=new Set(["©","®","÷"]),oa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),aa={1:"italic",32:"bold"},la={1:"italic",2:"bold"},Qr={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Jr{constructor(e,t,n){M(this,"path",new Tt);M(this,"lineBox",new H);M(this,"inlineBox",new H);M(this,"glyphBox");M(this,"advanceWidth",0);M(this,"advanceHeight",0);M(this,"underlinePosition",0);M(this,"underlineThickness",0);M(this,"strikeoutPosition",0);M(this,"strikeoutSize",0);M(this,"ascender",0);M(this,"descender",0);M(this,"typoAscender",0);M(this,"typoDescender",0);M(this,"typoLineGap",0);M(this,"winAscent",0);M(this,"winDescent",0);M(this,"xHeight",0);M(this,"capHeight",0);M(this,"baseline",0);M(this,"centerDiviation",0);M(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get center(){var e;return(e=this.glyphBox)==null?void 0:e.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSfnt(e){const t=this.computedStyle.fontFamily,n=e??qi,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSfnt()}updateGlyph(e=this._getFontSfnt()){if(!e)return this;const{hhea:t,os2:n,post:r,head:o}=e,s=o.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,d=s/u,p=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/d,y=a/d;return this.advanceWidth=p,this.advanceHeight=m,this.inlineBox.width=f?m:p,this.inlineBox.height=f?p:m,this.underlinePosition=(a-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(a-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=aa[n.fsSelection]??la[o.macStyle],this}update(e){const t=this._getFontSfnt(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:d}=this,{left:p,top:m}=a,y=o.fontStyle==="italic"&&f!=="italic";let k=p,P=m+s,v;const C=new Tt;if(n&&(k+=(d-u)/2,Math.abs(u-d)>.1&&(P-=(l-c)/(l+Math.abs(h))*d),v=void 0),n&&!ia.has(r)&&(r.codePointAt(0)<=256||oa.has(r))){C.addCommands(t.getPathCommands(r,k,m+s-(d-u)/2,o.fontSize));const b={y:m-(d-u)/2+d/2,x:k+u/2};y&&this._italic(C,n?{x:b.x,y:m-(d-u)/2+s}:void 0),C.rotate(90,b)}else v!==void 0?(C.addCommands(t.glyphs.get(v).getPathCommands(k,P,o.fontSize)),y&&this._italic(C,n?{x:k+u/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(C.addCommands(t.getPathCommands(r,k,P,o.fontSize)),y&&this._italic(C,n?{x:k+d/2,y:P}:void 0));const x=o.fontWeight??400;return x in Qr&&(x===700||x==="bold")&&f!=="bold"&&C.bold(Qr[x]*o.fontSize*.05),C.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)le(r);else{e.save(),e.beginPath();const o=this.path.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:o.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};$n(e,s),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function on(i,e){return typeof i=="number"?i:i.endsWith("%")?(i=i.substring(0,i.length-1),Math.ceil(Number(i)/100*e.total)):i.endsWith("rem")?(i=i.substring(0,i.length-3),Number(i)*e.fontSize):i.endsWith("em")?(i=i.substring(0,i.length-2),Number(i)*e.fontSize):Number(i)}function Vn(i){const e=Xt(i)?{}:i;return Object.keys(e).reduce((t,n)=>{let r=e[n];const o=Xn(n),s=Xn(r);return o&&(n=o),s&&(r=s),t[n]=r,t},{})}function Xt(i){return!i||i==="none"}function ts(i,e){const t=Object.keys(i),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(o=>oe(i[o],e[o]))}function oe(i,e){const t=typeof i;return t===typeof e?t==="object"?ts(i,e):i===e:!1}function Xn(i){const e=i.startsWith("#")?i.slice(1):i;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${o}, ${s})`}function an(i){if(!i)return i;const e={};for(const t in i)i[t]!==""&&i[t]!==void 0&&(e[t]=i[t]);return e}function ln(i){return i.startsWith("http://")||i.startsWith("https://")||i.startsWith("blob://")}class es{constructor(e,t={},n){M(this,"inlineBox",new H);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...an(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new Jr(n,t++,this));return this.characters=e,this}}class xe{constructor(e,t){M(this,"lineBox",new H);M(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...an(this.parentStyle),...an(this.style)},this}addFragment(e,t){const n=new es(e,t,this);return this.fragments.push(n),n}}function ha(i){return i}const ve=class ve{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];ve.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&ve.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),o={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":o.justifyContent="start";break;case"center":o.justifyContent="center";break;case"end":case"right":o.justifyContent="end";break}switch(t.verticalAlign){case"top":o.alignItems="top";break;case"middle":o.alignItems="center";break;case"bottom":o.alignItems="end";break}const a=!!(o.justifyContent||o.alignItems);Object.assign(r.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(o),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(o=>{var f;const s=r+=n.substring(r).indexOf(o),a=s+o.length;r+=o.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{r.push({...u,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(d=>{r.push({...d,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:d}=f,p=o[s];f.inlineBox.left=p.left,f.inlineBox.top=p.top,f.inlineBox.width=p.width,f.inlineBox.height=p.height,d?(f.lineBox.left=p.left+(p.width-u)/2,f.lineBox.top=p.top,f.lineBox.width=u,f.lineBox.height=p.height):(f.lineBox.left=p.left,f.lineBox.top=p.top+(p.height-u)/2,f.lineBox.width=p.width,f.lineBox.height=u),s++}),{paragraphs:e,boundingBox:new H(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const o=this.measureParagraphDom(e,n);return r==null||r(),o}};M(ve,"notZeroStyles",new Set(["width","height"])),M(ve,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let hn=ve;function ca(){return{shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function fa(){return{left:0,top:0,width:0,height:0,rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ua(){return{overflow:"visible",visibility:"visible",filter:"none",opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,...fa(),backgroundImage:"none",backgroundColor:"transparent",...ca(),borderRadius:0,borderColor:"transparent",borderWidth:1}}function pa(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function da(){return{...ua(),...pa()}}class ya{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(r):this.eventListeners.set(e,[o,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var o,s;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((o=c.options)!=null&&o.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(s=r.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,o;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let s=n.length,a=0;a<s;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((o=n.options)!=null&&o.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function cn(i){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:o,highlightSize:s,highlightThickness:a}=i;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??o??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function ns(){const i=[],e=[],t=new Map,n=new Map;async function r(s){if(!t.has(s)){t.set(s,s);try{t.set(s,await fetch(s).then(a=>a.text()))}catch(a){console.warn(a),t.delete(s)}}}function o(s){let a=n.get(s);if(!a){const l=Vr(ln(s)?t.get(s)??s:s),h=Kr(l);a={dom:l,pathSet:h},n.set(s,a)}return a}return{name:"highlight",paths:i,load:async s=>{const a=new Set;s.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:f}=cn(h);ln(c)&&a.add(c),ln(f)&&a.add(f)}),await Promise.all(Array.from(a).map(l=>r(l)))},update:s=>{e.length=0,i.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=cn(f),{image:d,colormap:p,line:m,size:y,thickness:k}=u;if(Xt(d))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:P,isVertical:v}=c,{fontSize:C}=f;(!h||oe(h.image,d)&&oe(h.colormap,p)&&oe(h.line,m)&&oe(h.size,y)&&oe(h.thickness,k))&&(l!=null&&l.length)&&(v?l[0].inlineBox.left===P.left:l[0].inlineBox.top===P.top)&&l[0].fontSize===C?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const f=a[c],u=f[0],d=H.from(...f.filter(O=>O.glyphBox).map(O=>O.glyphBox)),{computedStyle:p}=u,{fontSize:m,writingMode:y}=p,{image:k,referImage:P,colormap:v,line:C,size:x,thickness:b}=cn(p),S=y.includes("vertical"),w=on(b,{fontSize:m,total:d.width})/d.width,I=Vn(v),{pathSet:F,dom:E}=o(k),_=F.getBoundingBox(!0),j=m/_.width*2,T=new H().copy(d);S&&(T.width=d.height,T.height=d.width,T.left=d.left+d.width);const U=Math.floor(T.width);let V=U;if(x!=="cover"&&(V=on(x,{fontSize:m,total:d.width})||U,T.width=V),!Xt(P)&&Xt(C)){const O=o(P).pathSet.getBoundingBox(!0);_.copy(O)}else{let O;if(Xt(C))if(_.width/_.height>4){O="underline";const q=E.getAttribute("viewBox");if(q){const[L,D,Z,W]=q.split(" ").map(N=>Number(N)),G=D+W/2;_.y<G&&_.y+_.height>G?O="line-through":_.y+_.height<G?O="overline":O="underline"}}else O="outline";else O=C;switch(O){case"outline":{const q=T.width*.2,L=T.height*.2;T.width+=q,T.height+=L,S?(T.x-=L/2,T.y-=q/2,T.x+=T.height):(T.x-=q/2,T.y-=L/2);break}case"overline":T.height=_.height*j,S?T.x=u.inlineBox.left+u.inlineBox.width:T.y=u.inlineBox.top;break;case"line-through":T.height=_.height*j,S?T.x=u.inlineBox.left+u.inlineBox.width-u.strikeoutPosition+T.height/2:T.y=u.inlineBox.top+u.strikeoutPosition-T.height/2;break;case"underline":T.height=_.height*j,S?T.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:T.y=u.inlineBox.top+u.underlinePosition;break}}const B=new Pt().translate(-_.x,-_.y).scale(T.width/_.width,T.height/_.height);S&&B.rotate(-Math.PI/2),B.translate(T.x,T.y);for(let O=0;O<Math.ceil(U/V);O++){const q=B.clone();S?q.translate(0,O*T.width):q.translate(O*T.width,0),F.paths.forEach(L=>{const D=L.clone().applyTransform(q);D.style.strokeWidth&&(D.style.strokeWidth*=j*w),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=j),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=j),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(Z=>Z*j)),D.style.fill&&D.style.fill in I&&(D.style.fill=I[D.style.fill]),D.style.stroke&&D.style.stroke in I&&(D.style.stroke=I[D.style.stroke]),i.push(D),U!==V&&(S?e[i.length-1]=new H(d.left-d.width*2,d.top,d.width*4,d.height):e[i.length-1]=new H(d.left,d.top-d.height*2,d.width,d.height*4))})}}},renderOrder:-1,render:(s,a)=>{i.forEach((l,h)=>{if(le({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=new Gn([l]).getBoundingBox();c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function ga(i,e){return`<svg width="${i*2}" height="${i*2}" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
}`)),document.head.appendChild(n),this}_parseUrls(e){const t=Array.from(new Set([...e.split(","),e]));return Array.from(new Set(t.map(n=>this.familyToUrl.get(n.trim())??this.familyToUrl.get(n)??n)))}get(e){let t;return e&&(t=this._parseUrls(e).reduce((r,o)=>r||this.loaded.get(o),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(t=>{this.familyToUrl.delete(t),this.loaded.delete(t)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}async load(e,t={}){const{cancelOther:n,injectFontFace:r=!0,injectStyleTag:o=!0,...s}=t,{src:a}=e;if(this.loaded.has(a))return n&&(this.loading.forEach(u=>u.cancel()),this.loading.clear()),c(this.loaded.get(a));let l=this.loading.get(a);return l||(l=this._createRequest(a,s),this.loading.set(a,l)),n&&this.loading.forEach((u,d)=>{u!==l&&(u.cancel(),this.loading.delete(d))}),l.when.then(u=>{if(this.loaded.has(a))return c(this.loaded.get(a));{const d=f(u);return t.noAdd||this.loaded.set(e.src,d),d.familySet.forEach(p=>{this.familyToUrl.set(p,a),typeof document<"u"&&(r&&this.injectFontFace(p,u),o&&this.injectStyleTag(p,a))}),d}}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return f();throw u}).finally(()=>{this.loading.delete(a)});function h(){return e.family?Array.isArray(e.family)?e.family:[e.family]:[]}function c(u){return h().forEach(d=>{u.familySet.add(d)}),u}function f(u=new ArrayBuffer(0)){let d;function p(){return d||(d=u.byteLength?qi(u,!1):void 0),d}function m(){const y=p();if(y instanceof Ft||y instanceof En)return y.sfnt}return{...e,buffer:u,familySet:new Set(h()),getFont:p,getSFNT:m}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values()).map(e=>e.when))}};M(un,"defaultRequestInit",{cache:"force-cache"});let Dn=un;const Gi=new Dn;function Wi(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=Pr(i,0,r,t,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,h;if(n&&(o=Yi(i,e,o,t)),i.length>80*t){a=1/0,l=1/0;let c=-1/0,f=-1/0;for(let u=t;u<r;u+=t){const d=i[u],p=i[u+1];d<a&&(a=d),p<l&&(l=p),d>c&&(c=d),p>f&&(f=p)}h=Math.max(c-a,f-l),h=h!==0?32767/h:0}return De(o,s,t,a,l,h,0),s}function Pr(i,e,t,n,r){let o;if(r===ao(i,e,t,n)>0)for(let s=e;s<t;s+=n)o=_r(s/n|0,i[s],i[s+1],o);else for(let s=t-n;s>=e;s-=n)o=_r(s/n|0,i[s],i[s+1],o);return o&&ye(o,o.next)&&(Fe(o),o=o.next),o}function se(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(ye(t,t.next)||tt(t.prev,t,t.next)===0)){if(Fe(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function De(i,e,t,n,r,o,s){if(!i)return;!s&&o&&eo(i,n,r,o);let a=i;for(;i.prev!==i.next;){const l=i.prev,h=i.next;if(o?Xi(i,n,r,o):Vi(i)){e.push(l.i,i.i,h.i),Fe(i),i=h.next,a=h.next;continue}if(i=h,i===a){s?s===1?(i=Hi(se(i),e),De(i,e,t,n,r,o,2)):s===2&&Zi(i,e,t,n,r,o):De(se(i),e,t,n,r,o,1);break}}}function Vi(i){const e=i.prev,t=i,n=i.next;if(tt(e,t,n)>=0)return!1;const r=e.x,o=t.x,s=n.x,a=e.y,l=t.y,h=n.y,c=Math.min(r,o,s),f=Math.min(a,l,h),u=Math.max(r,o,s),d=Math.max(a,l,h);let p=n.next;for(;p!==e;){if(p.x>=c&&p.x<=u&&p.y>=f&&p.y<=d&&Ue(r,a,o,l,s,h,p.x,p.y)&&tt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Xi(i,e,t,n){const r=i.prev,o=i,s=i.next;if(tt(r,o,s)>=0)return!1;const a=r.x,l=o.x,h=s.x,c=r.y,f=o.y,u=s.y,d=Math.min(a,l,h),p=Math.min(c,f,u),m=Math.max(a,l,h),y=Math.max(c,f,u),k=Un(d,p,e,t,n),P=Un(m,y,e,t,n);let v=i.prevZ,C=i.nextZ;for(;v&&v.z>=k&&C&&C.z<=P;){if(v.x>=d&&v.x<=m&&v.y>=p&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0||(v=v.prevZ,C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;v&&v.z>=k;){if(v.x>=d&&v.x<=m&&v.y>=p&&v.y<=y&&v!==r&&v!==s&&Ue(a,c,l,f,h,u,v.x,v.y)&&tt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;C&&C.z<=P;){if(C.x>=d&&C.x<=m&&C.y>=p&&C.y<=y&&C!==r&&C!==s&&Ue(a,c,l,f,h,u,C.x,C.y)&&tt(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Hi(i,e){let t=i;do{const n=t.prev,r=t.next.next;!ye(n,r)&&Ar(n,t,t.next,r)&&Le(n,r)&&Le(r,n)&&(e.push(n.i,t.i,r.i),Fe(t),Fe(t.next),t=i=r),t=t.next}while(t!==i);return se(t)}function Zi(i,e,t,n,r,o){let s=i;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&so(s,a)){let l=kr(s,a);s=se(s,s.next),l=se(l,l.next),De(s,e,t,n,r,o,0),De(l,e,t,n,r,o,0);return}a=a.next}s=s.next}while(s!==i)}function Yi(i,e,t,n){const r=[];for(let o=0,s=e.length;o<s;o++){const a=e[o]*n,l=o<s-1?e[o+1]*n:i.length,h=Pr(i,a,l,n,!1);h===h.next&&(h.steiner=!0),r.push(ro(h))}r.sort(Ki);for(let o=0;o<r.length;o++)t=Qi(r[o],t);return t}function Ki(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function Qi(i,e){const t=Ji(i,e);if(!t)return e;const n=kr(t,i);return se(n,n.next),se(t,t.next)}function Ji(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,s;if(ye(i,t))return t;do{if(ye(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>o&&(o=f,s=t.x<t.next.x?t:t.next,f===n))return s}t=t.next}while(t!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;t=s;do{if(n>=t.x&&t.x>=l&&n!==t.x&&Tr(r<h?n:o,r,l,h,r<h?o:n,r,t.x,t.y)){const f=Math.abs(r-t.y)/(n-t.x);Le(t,i)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&to(s,t)))&&(s=t,c=f)}t=t.next}while(t!==a);return s}function to(i,e){return tt(i.prev,i,e.prev)<0&&tt(e.next,i,i.next)<0}function eo(i,e,t,n){let r=i;do r.z===0&&(r.z=Un(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,no(r)}function no(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let s=n,a=0;for(let h=0;h<t&&(a++,s=s.nextZ,!!s);h++);let l=t;for(;a>0||l>0&&s;)a!==0&&(l===0||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=s}o.nextZ=null,t*=2}while(e>1);return i}function Un(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function ro(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Tr(i,e,t,n,r,o,s,a){return(r-s)*(e-a)>=(i-s)*(o-a)&&(i-s)*(n-a)>=(t-s)*(e-a)&&(t-s)*(o-a)>=(r-s)*(n-a)}function Ue(i,e,t,n,r,o,s,a){return!(i===s&&e===a)&&Tr(i,e,t,n,r,o,s,a)}function so(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!io(i,e)&&(Le(i,e)&&Le(e,i)&&oo(i,e)&&(tt(i.prev,i,e.prev)||tt(i,e.prev,e))||ye(i,e)&&tt(i.prev,i,i.next)>0&&tt(e.prev,e,e.next)>0)}function tt(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ye(i,e){return i.x===e.x&&i.y===e.y}function Ar(i,e,t,n){const r=tn(tt(i,e,t)),o=tn(tt(i,e,n)),s=tn(tt(t,n,i)),a=tn(tt(t,n,e));return!!(r!==o&&s!==a||r===0&&Je(i,t,e)||o===0&&Je(i,n,e)||s===0&&Je(t,i,n)||a===0&&Je(t,e,n))}function Je(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tn(i){return i>0?1:i<0?-1:0}function io(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&Ar(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Le(i,e){return tt(i.prev,i,i.next)<0?tt(i,e,i.next)>=0&&tt(i,i.prev,e)>=0:tt(i,e,i.prev)<0||tt(i,i.next,e)<0}function oo(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function kr(i,e){const t=Ln(i.i,i.x,i.y),n=Ln(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function _r(i,e,t,n){const r=Ln(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Fe(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Ln(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ao(i,e,t,n){let r=0;for(let o=e,s=t-n;o<t;o+=n)r+=(i[s]-i[o])*(i[o+1]+i[s+1]),s=o;return r}function lo(i,e,t,n={}){const{radius:r=1}=n;i.moveTo(e,t),i.arc(e,t,r,0,Math.PI*2)}const ho={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Fn(i,e){const{fill:t="#000",stroke:n="none",strokeWidth:r=n==="none"?0:1,strokeLinecap:o="round",strokeLinejoin:s="miter",strokeMiterlimit:a=0,strokeDasharray:l=[],strokeDashoffset:h=0,shadowOffsetX:c=0,shadowOffsetY:f=0,shadowBlur:u=0,shadowColor:d="rgba(0, 0, 0, 0)"}=e;i.fillStyle=t,i.strokeStyle=n,i.lineWidth=r,i.lineCap=o,i.lineJoin=ho[s],i.miterLimit=a,i.setLineDash(l),i.lineDashOffset=h,i.shadowOffsetX=c,i.shadowOffsetY=f,i.shadowBlur=u,i.shadowColor=d}class A{constructor(e=0,t=0){this.x=e,this.y=t}static get MAX(){return new A(1/0,1/0)}static get MIN(){return new A(-1/0,-1/0)}get array(){return[this.x,this.y]}set(e,t){return this.x=e,this.y=t,this}add(e){return this.x+=e.x,this.y+=e.y,this}sub(e){return this.x-=e.x,this.y-=e.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}divide(e){return this.x/=e.x,this.y/=e.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}rotate(e,t={x:0,y:0}){const n=-e/180*Math.PI,r=this.x-t.x,o=-(this.y-t.y),s=Math.sin(n),a=Math.cos(n);return this.set(t.x+(r*a-o*s),t.y-(r*s+o*a)),this}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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}){const r=e<0?n.x-this.x+n.x:this.x,o=t<0?n.y-this.y+n.y:this.y;return this.x=r*Math.abs(e),this.y=o*Math.abs(t),this}skew(e,t=0,n={x:0,y:0}){const r=this.x-n.x,o=this.y-n.y;return this.x=n.x+(r+Math.tan(e)*o),this.y=n.y+(o+Math.tan(t)*r),this}min(...e){return this.x=Math.min(this.x,...e.map(t=>t.x)),this.y=Math.min(this.y,...e.map(t=>t.y)),this}max(...e){return this.x=Math.max(this.x,...e.map(t=>t.x)),this.y=Math.max(this.y,...e.map(t=>t.y)),this}normalize(){return this.scale(1/(this.length()||1))}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this}divideVectors(e,t){return this.x=e.x/t.x,this.y=e.y/t.y,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return this.x===e.x&&this.y===e.y}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}copy(e){return this.x=e.x,this.y=e.y,this}clone(){return new A(this.x,this.y)}}class H{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}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 A((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...e){if(e.length===0)return new H;if(e.length===1)return e[0].clone();const t=e[0],n=e.slice(1).reduce((r,o)=>(r.left=Math.min(r.left,o.left),r.top=Math.min(r.top,o.top),r.right=Math.max(r.right,o.right),r.bottom=Math.max(r.bottom,o.bottom),r),{left:(t==null?void 0:t.left)??0,top:(t==null?void 0:t.top)??0,right:(t==null?void 0:t.right)??0,bottom:(t==null?void 0:t.bottom)??0});return new H(n.left,n.top,n.right-n.left,n.bottom-n.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 H(this.left,this.top,this.width,this.height)}}class Pt{constructor(e=1,t=0,n=0,r=0,o=1,s=0,a=0,l=0,h=1){M(this,"elements",[]);this.set(e,t,n,r,o,s,a,l,h)}set(e,t,n,r,o,s,a,l,h){const c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=o,c[5]=l,c[6]=n,c[7]=s,c[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,s=n[0],a=n[3],l=n[6],h=n[1],c=n[4],f=n[7],u=n[2],d=n[5],p=n[8],m=r[0],y=r[3],k=r[6],P=r[1],v=r[4],C=r[7],x=r[2],b=r[5],S=r[8];return o[0]=s*m+a*P+l*x,o[3]=s*y+a*v+l*b,o[6]=s*k+a*C+l*S,o[1]=h*m+c*P+f*x,o[4]=h*y+c*v+f*b,o[7]=h*k+c*C+f*S,o[2]=u*m+d*P+p*x,o[5]=u*y+d*v+p*b,o[8]=u*k+d*C+p*S,this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],l=e[6],h=e[7],c=e[8],f=c*s-a*h,u=a*l-c*o,d=h*o-s*l,p=t*f+n*u+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=f*m,e[1]=(r*h-c*n)*m,e[2]=(a*n-r*s)*m,e[3]=u*m,e[4]=(c*t-r*l)*m,e[5]=(r*o-a*t)*m,e[6]=d*m,e[7]=(n*l-h*t)*m,e[8]=(s*t-n*o)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}scale(e,t){return this.premultiply($n.makeScale(e,t)),this}rotate(e){return this.premultiply($n.makeRotation(-e)),this}translate(e,t){return this.premultiply($n.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}clone(){return new this.constructor().fromArray(this.elements)}}const $n=new Pt;function Ir(i,e,t,n){const r=i*t+e*n,o=Math.sqrt(i*i+e*e)*Math.sqrt(t*t+n*n);let s=Math.acos(Math.max(-1,Math.min(1,r/o)));return i*n-e*t<0&&(s=-s),s}function co(i,e,t,n,r,o,s,a){if(e===0||t===0){i.lineTo(a.x,a.y);return}n=n*Math.PI/180,e=Math.abs(e),t=Math.abs(t);const l=(s.x-a.x)/2,h=(s.y-a.y)/2,c=Math.cos(n)*l+Math.sin(n)*h,f=-Math.sin(n)*l+Math.cos(n)*h;let u=e*e,d=t*t;const p=c*c,m=f*f,y=p/u+m/d;if(y>1){const $=Math.sqrt(y);e=$*e,t=$*t,u=e*e,d=t*t}const k=u*m+d*p,P=(u*d-k)/k;let v=Math.sqrt(Math.max(0,P));r===o&&(v=-v);const C=v*e*f/t,x=-v*t*c/e,b=Math.cos(n)*C-Math.sin(n)*x+(s.x+a.x)/2,S=Math.sin(n)*C+Math.cos(n)*x+(s.y+a.y)/2,w=Ir(1,0,(c-C)/e,(f-x)/t),I=Ir((c-C)/e,(f-x)/t,(-c-C)/e,(-f-x)/t)%(Math.PI*2);i.ellipse(b,S,e,t,n,w,w+I,o===0)}const st={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function qt(i,e,t=0){let a=0,l=!0,h="",c="";const f=[];function u(y,k,P){const v=new SyntaxError(`Unexpected character "${y}" at index ${k}.`);throw v.partial=P,v}function d(){h!==""&&(c===""?f.push(Number(h)):f.push(Number(h)*10**Number(c))),h="",c=""}let p;const m=i.length;for(let y=0;y<m;y++){if(p=i[y],Array.isArray(e)&&e.includes(f.length%t)&&st.FLAGS.test(p)){a=1,h=p,d();continue}if(a===0){if(st.WHITESPACE.test(p))continue;if(st.DIGIT.test(p)||st.SIGN.test(p)){a=1,h=p;continue}if(st.POINT.test(p)){a=2,h=p;continue}st.COMMA.test(p)&&(l&&u(p,y,f),l=!0)}if(a===1){if(st.DIGIT.test(p)){h+=p;continue}if(st.POINT.test(p)){h+=p,a=2;continue}if(st.EXP.test(p)){a=3;continue}st.SIGN.test(p)&&h.length===1&&st.SIGN.test(h[0])&&u(p,y,f)}if(a===2){if(st.DIGIT.test(p)){h+=p;continue}if(st.EXP.test(p)){a=3;continue}st.POINT.test(p)&&h[h.length-1]==="."&&u(p,y,f)}if(a===3){if(st.DIGIT.test(p)){c+=p;continue}if(st.SIGN.test(p)){if(c===""){c+=p;continue}c.length===1&&st.SIGN.test(c)&&u(p,y,f)}}st.WHITESPACE.test(p)?(d(),a=0,l=!1):st.COMMA.test(p)?(d(),a=0,l=!0):st.SIGN.test(p)?(d(),a=1,h=p):st.POINT.test(p)?(d(),a=2,h=p):u(p,y,f)}return d(),f}function ge(i,e){return i-(e-i)}function Or(i,e){const t=new A,n=new A;for(let r=0,o=i.length;r<o;r++){const s=i[r];if(s.type==="m"||s.type==="M")s.type==="m"?t.add(s):t.copy(s),e.moveTo(t.x,t.y),n.copy(t);else if(s.type==="h"||s.type==="H")s.type==="h"?t.x+=s.x:t.x=s.x,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="v"||s.type==="V")s.type==="v"?t.y+=s.y:t.y=s.y,e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="l"||s.type==="L")s.type==="l"?t.add(s):t.copy(s),e.lineTo(t.x,t.y),n.copy(t);else if(s.type==="c"||s.type==="C")s.type==="c"?(e.bezierCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(s.x1,s.y1,s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="s"||s.type==="S")s.type==="s"?(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),t.x+s.x2,t.y+s.y2,t.x+s.x,t.y+s.y),n.x=t.x+s.x2,n.y=t.y+s.y2,t.add(s)):(e.bezierCurveTo(ge(t.x,n.x),ge(t.y,n.y),s.x2,s.y2,s.x,s.y),n.x=s.x2,n.y=s.y2,t.copy(s));else if(s.type==="q"||s.type==="Q")s.type==="q"?(e.quadraticCurveTo(t.x+s.x1,t.y+s.y1,t.x+s.x,t.y+s.y),n.x=t.x+s.x1,n.y=t.y+s.y1,t.add(s)):(e.quadraticCurveTo(s.x1,s.y1,s.x,s.y),n.x=s.x1,n.y=s.y1,t.copy(s));else if(s.type==="t"||s.type==="T"){const a=ge(t.x,n.x),l=ge(t.y,n.y);n.x=a,n.y=l,s.type==="t"?(e.quadraticCurveTo(a,l,t.x+s.x,t.y+s.y),t.add(s)):(e.quadraticCurveTo(a,l,s.x,s.y),t.copy(s))}else if(s.type==="a"||s.type==="A"){const a=t.clone();if(s.type==="a"){if(s.x===0&&s.y===0)continue;t.add(s)}else{if(t.equals(s))continue;t.copy(s)}n.copy(t),co(e,s.rx,s.ry,s.angle,s.largeArcFlag,s.sweepFlag,a,t)}else s.type==="z"||s.type==="Z"?(e.startPoint&&t.copy(e.startPoint),e.closePath()):console.warn("Unsupported commands",s)}}function fo(i){let e,t;const n=[];for(let r=0,o=i.length;r<o;r++){const s=i[r];switch(s.type){case"m":case"M":if(s.x.toFixed(4)===(t==null?void 0:t.x.toFixed(4))&&s.y.toFixed(4)===(t==null?void 0:t.y.toFixed(4)))continue;n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y},e={x:s.x,y:s.y};break;case"h":case"H":n.push(`${s.type} ${s.x}`),t={x:s.x,y:(t==null?void 0:t.y)??0};break;case"v":case"V":n.push(`${s.type} ${s.y}`),t={x:(t==null?void 0:t.x)??0,y:s.y};break;case"l":case"L":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"c":case"C":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"s":case"S":n.push(`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"q":case"Q":n.push(`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"t":case"T":n.push(`${s.type} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"a":case"A":n.push(`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`),t={x:s.x,y:s.y};break;case"z":case"Z":n.push(s.type),e&&(t={x:e.x,y:e.y});break}}return n.join(" ")}const uo=/[a-df-z][^a-df-z]*/gi;function Br(i){const e=[],t=i.match(uo);if(!t)return e;for(let n=0,r=t.length;n<r;n++){const o=t[n],s=o.charAt(0),a=o.slice(1).trim();let l;switch(s){case"m":case"M":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)h===0?e.push({type:s,x:l[h],y:l[h+1]}):e.push({type:s==="m"?"l":"L",x:l[h],y:l[h+1]});break;case"h":case"H":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,x:l[h]});break;case"v":case"V":l=qt(a);for(let h=0,c=l.length;h<c;h++)e.push({type:s,y:l[h]});break;case"l":case"L":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"c":case"C":l=qt(a);for(let h=0,c=l.length;h<c;h+=6)e.push({type:s,x1:l[h],y1:l[h+1],x2:l[h+2],y2:l[h+3],x:l[h+4],y:l[h+5]});break;case"s":case"S":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x2:l[h],y2:l[h+1],x:l[h+2],y:l[h+3]});break;case"q":case"Q":l=qt(a);for(let h=0,c=l.length;h<c;h+=4)e.push({type:s,x1:l[h],y1:l[h+1],x:l[h+2],y:l[h+3]});break;case"t":case"T":l=qt(a);for(let h=0,c=l.length;h<c;h+=2)e.push({type:s,x:l[h],y:l[h+1]});break;case"a":case"A":l=qt(a,[3,4],7);for(let h=0,c=l.length;h<c;h+=7)e.push({type:s,rx:l[h],ry:l[h+1],angle:l[h+2],largeArcFlag:l[h+3],sweepFlag:l[h+4],x:l[h+5],y:l[h+6]});break;case"z":case"Z":e.push({type:s});break;default:console.warn(o)}}return e}function Er(i,e,t,n,r){const o=(n-e)*.5,s=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*i+t}function po(i,e){const t=1-i;return t*t*t*e}function yo(i,e){const t=1-i;return 3*t*t*i*e}function go(i,e){return 3*(1-i)*i*i*e}function mo(i,e){return i*i*i*e}function Dr(i,e,t,n,r){return po(i,e)+yo(i,t)+go(i,n)+mo(i,r)}function xo(i,e={}){let{vertices:t=[],indices:n=[],holes:r=[],verticesStride:o=2,verticesOffset:s=0,indicesOffset:a=0}=e;const l=Wi(i,r,2);if(l){for(let c=0;c<l.length;c+=3)n[a++]=l[c]+s,n[a++]=l[c+1]+s,n[a++]=l[c+2]+s;let h=s*o;for(let c=0;c<i.length;c+=2)t[h]=i[c],t[h+1]=i[c+1],h+=o}return{vertices:t,indices:n}}const wo=8,en=11920929e-14,vo=1;function bo(i,e,t,n,r,o,s,a,l=.5,h){const f=Math.min(.99,Math.max(0,l));let u=(vo-f)/1;return u*=u,zn(i,e,t,n,r,o,s,a,h,u,0),h.push(s,a),h}function zn(i,e,t,n,r,o,s,a,l,h,c){if(c>wo)return;const f=(i+t)/2,u=(e+n)/2,d=(t+r)/2,p=(n+o)/2,m=(r+s)/2,y=(o+a)/2,k=(f+d)/2,P=(u+p)/2,v=(d+m)/2,C=(p+y)/2,x=(k+v)/2,b=(P+C)/2;if(c>0){let S=s-i,w=a-e;const I=Math.abs((t-s)*w-(n-a)*S),$=Math.abs((r-s)*w-(o-a)*S);if(I>en&&$>en){if((I+$)*(I+$)<=h*(S*S+w*w)){l.push(x,b);return}}else if(I>en){if(I*I<=h*(S*S+w*w)){l.push(x,b);return}}else if($>en){if($*$<=h*(S*S+w*w)){l.push(x,b);return}}else if(S=x-(i+s)/2,w=b-(e+a)/2,S*S+w*w<=h){l.push(x,b);return}}zn(i,e,f,u,k,P,x,b,l,h,c+1),zn(x,b,v,C,m,y,s,a,l,h,c+1)}const So=8,Co=11920929e-14,Mo=1;function Po(i,e,t,n,r,o,s=.5,a){const h=Math.min(.99,Math.max(0,s));let c=(Mo-h)/1;return c*=c,Nn(a,i,e,t,n,r,o,c,0),a.push(r,o),a}function Nn(i,e,t,n,r,o,s,a,l){if(l>So)return;const h=(e+n)/2,c=(t+r)/2,f=(n+o)/2,u=(r+s)/2,d=(h+f)/2,p=(c+u)/2;let m=o-e,y=s-t;const k=Math.abs((n-o)*y-(r-s)*m);if(k>Co){if(k*k<=a*(m*m+y*y)){i.push(d,p);return}}else if(m=d-(e+o)/2,y=p-(t+s)/2,m*m+y*y<=a){i.push(d,p);return}Nn(i,e,t,h,c,d,p,a,l+1),Nn(i,d,p,f,u,o,s,a,l+1)}function To(i,e){const t=1-i;return t*t*e}function Ao(i,e){return 2*(1-i)*i*e}function ko(i,e){return i*i*e}function Ur(i,e,t,n){return To(i,e)+Ao(i,t)+ko(i,n)}const _o=1e-4,Lr=1e-4;function Io(i,e={}){const{vertices:t=[],indices:n=[],lineStyle:r={alignment:.5,cap:"butt",join:"miter",width:1,miterLimit:10},flipAlignment:o=!1,closed:s=!0}=e,a=_o;if(i.length===0)return{vertices:t,indices:n};const l=r;let h=l.alignment;if(r.alignment!==.5){let L=Oo(i);o&&(L*=-1),h=(h-.5)*L+.5}const c={x:i[0],y:i[1]},f={x:i[i.length-2],y:i[i.length-1]},u=s,d=Math.abs(c.x-f.x)<a&&Math.abs(c.y-f.y)<a;if(u){i=i.slice(),d&&(i.pop(),i.pop(),f.x=i[i.length-2],f.y=i[i.length-1]);const L=(c.x+f.x)*.5,D=(f.y+c.y)*.5;i.unshift(L,D),i.push(L,D)}const p=t,m=i.length/2;let y=i.length;const k=p.length/2,P=l.width/2,v=P*P,C=l.miterLimit*l.miterLimit;let x=i[0],b=i[1],S=i[2],w=i[3],I=0,$=0,E=-(b-w),_=x-S,N=0,T=0,U=Math.sqrt(E*E+_*_);E/=U,_/=U,E*=P,_*=P;const V=h,B=(1-V)*2,O=V*2;u||(l.cap==="round"?y+=ie(x-E*(B-O)*.5,b-_*(B-O)*.5,x-E*B,b-_*B,x+E*O,b+_*O,p,!0)+2:l.cap==="square"&&(y+=Fr(x,b,E,_,B,O,!0,p))),p.push(x-E*B,b-_*B),p.push(x+E*O,b+_*O);for(let L=1;L<m-1;++L){x=i[(L-1)*2],b=i[(L-1)*2+1],S=i[L*2],w=i[L*2+1],I=i[(L+1)*2],$=i[(L+1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,N=-(w-$),T=S-I,U=Math.sqrt(N*N+T*T),N/=U,T/=U,N*=P,T*=P;const D=S-x,Z=b-w,W=S-I,G=$-w,j=D*W+Z*G,K=Z*W-G*D,X=K<0;if(Math.abs(K)<.001*Math.abs(j)){p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),j>=0&&(l.join==="round"?y+=ie(S,w,S-E*B,w-_*B,S-N*B,w-T*B,p,!1)+4:y+=2,p.push(S-N*O,w-T*O),p.push(S+N*B,w+T*B));continue}const nt=(-E+x)*(-_+w)-(-E+S)*(-_+b),Wt=(-N+I)*(-T+w)-(-N+S)*(-T+$),Bt=(D*Wt-W*nt)/K,Ct=(G*nt-Z*Wt)/K,At=(Bt-S)*(Bt-S)+(Ct-w)*(Ct-w),ht=S+(Bt-S)*B,kt=w+(Ct-w)*B,$t=S-(Bt-S)*O,zt=w-(Ct-w)*O,Et=Math.min(D*D+Z*Z,W*W+G*G),os=X?B:O,va=Et+os*os*v;At<=va?l.join==="bevel"||At/v>C?(X?(p.push(ht,kt),p.push(S+E*O,w+_*O),p.push(ht,kt),p.push(S+N*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push($t,zt),p.push(S-N*B,w-T*B),p.push($t,zt)),y+=2):l.join==="round"?X?(p.push(ht,kt),p.push(S+E*O,w+_*O),y+=ie(S,w,S+E*O,w+_*O,S+N*O,w+T*O,p,!0)+4,p.push(ht,kt),p.push(S+N*O,w+T*O)):(p.push(S-E*B,w-_*B),p.push($t,zt),y+=ie(S,w,S-E*B,w-_*B,S-N*B,w-T*B,p,!1)+4,p.push(S-N*B,w-T*B),p.push($t,zt)):(p.push(ht,kt),p.push($t,zt)):(p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),l.join==="round"?X?y+=ie(S,w,S+E*O,w+_*O,S+N*O,w+T*O,p,!0)+2:y+=ie(S,w,S-E*B,w-_*B,S-N*B,w-T*B,p,!1)+2:l.join==="miter"&&At/v<=C&&(X?(p.push($t,zt),p.push($t,zt)):(p.push(ht,kt),p.push(ht,kt)),y+=2),p.push(S-N*B,w-T*B),p.push(S+N*O,w+T*O),y+=2)}x=i[(m-2)*2],b=i[(m-2)*2+1],S=i[(m-1)*2],w=i[(m-1)*2+1],E=-(b-w),_=x-S,U=Math.sqrt(E*E+_*_),E/=U,_/=U,E*=P,_*=P,p.push(S-E*B,w-_*B),p.push(S+E*O,w+_*O),u||(l.cap==="round"?y+=ie(S-E*(B-O)*.5,w-_*(B-O)*.5,S-E*B,w-_*B,S+E*O,w+_*O,p,!1)+2:l.cap==="square"&&(y+=Fr(S,w,E,_,B,O,!1,p)));const q=Lr*Lr;for(let L=k;L<y+k-2;++L)x=p[L*2],b=p[L*2+1],S=p[(L+1)*2],w=p[(L+1)*2+1],I=p[(L+2)*2],$=p[(L+2)*2+1],!(Math.abs(x*(w-$)+S*($-b)+I*(b-w))<q)&&n.push(L,L+1,L+2);return{vertices:t,indices:n}}function Oo(i){const e=i.length;if(e<6)return 1;let t=0;for(let n=0,r=i[e-2],o=i[e-1];n<e;n+=2){const s=i[n],a=i[n+1];t+=(s-r)*(a+o),r=s,o=a}return t<0?-1:1}function Fr(i,e,t,n,r,o,s,a){const l=i-t*r,h=e-n*r,c=i+t*o,f=e+n*o;let u,d;s?(u=n,d=-t):(u=-n,d=t);const p=l+u,m=h+d,y=c+u,k=f+d;return a.push(p,m),a.push(y,k),2}function ie(i,e,t,n,r,o,s,a){const l=t-i,h=n-e;let c=Math.atan2(l,h),f=Math.atan2(r-i,o-e);a&&c<f?c+=Math.PI*2:!a&&c>f&&(f+=Math.PI*2);let u=c;const d=f-c,p=Math.abs(d),m=Math.sqrt(l*l+h*h),y=(15*p*Math.sqrt(m)/Math.PI>>0)+1,k=d/y;if(u+=k,a){s.push(i,e),s.push(t,n);for(let P=1,v=u;P<y;P++,v+=k)s.push(i,e),s.push(i+Math.sin(v)*m,e+Math.cos(v)*m);s.push(i,e),s.push(r,o)}else{s.push(t,n),s.push(i,e);for(let P=1,v=u;P<y;P++,v+=k)s.push(i+Math.sin(v)*m,e+Math.cos(v)*m),s.push(i,e);s.push(r,o),s.push(i,e)}return y*2}class me{constructor(){M(this,"arcLengthDivision",200);M(this,"_arcLengths")}getPointAt(e,t=new A){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){const e=this.getPoint(1),t=this.getPoint(.5),n=this.getPoint(1);return(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x)<0}getControlPointRefs(){return[]}applyTransform(e){return this.getControlPointRefs().forEach(t=>{t.applyMatrix3(e)}),this}getUnevenPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPoint(r/o,n),t.push(n.x,n.y);return t}getSpacedPointArray(e=5,t=[]){const n=new A;for(let r=0,o=Math.max(1,e)-1;r<=o;r++)this.getPointAt(r/o,n),t.push(n.x,n.y);return t}getAdaptivePointArray(e=[]){return this.getUnevenPointArray(5,e)}_pointArrayToPoint(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){const o=e[n],s=e[n+1];t.push(new A(o,s))}return t}getSpacedPoints(e,t=[]){const n=this.getSpacedPointArray(e);return this._pointArrayToPoint(n,t),t}getUnevenPoints(e,t=[]){const n=this.getUnevenPointArray(e);return this._pointArrayToPoint(n,t),t}getAdaptivePoints(e=[]){const t=this.getAdaptivePointArray();return this._pointArrayToPoint(t,e),e}getPoints(e,t=[]){let n;return e?n=this.getUnevenPointArray(e):n=this.getAdaptivePointArray(),this._pointArrayToPoint(n,t),t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){return(!this._arcLengths||this._arcLengths.length!==this.arcLengthDivision+1)&&this.updateLengths(),this._arcLengths}updateLengths(){const e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),o=1;o<=e;o++){const s=this.getPoint(o/e);n+=s.distanceTo(r),t.push(n),r=s}this._arcLengths=t}getUToTMapping(e,t){const n=this.getLengths(),r=n.length,o=t??e*n[r-1];if(r<2)return o/n[0];let s=0,a=0,l=r-1,h;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),h=n[s]-o,h<0)a=s+1;else if(h>0)l=s-1;else{l=s;break}if(s=l,n[s]===o)return s/(r-1);const c=n[s],u=n[s+1]-c,d=(o-c)/u;return(s+d)/(r-1)}getTangent(e,t=new A){const r=Math.max(0,e-1e-4),o=Math.min(1,e+1e-4);return t.copy(this.getPoint(o).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new A){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,o=(n+r)/2;for(;r-n>t;){o=(n+r)/2;const s=this.getPoint(o);if(s.distanceTo(e)<t)return o;s.x<e.x?n=o:r=o}return o}getMinMax(e=A.MAX,t=A.MIN){const n=this.getPoints();for(let r=0,o=n.length;r<o;r++){const s=n[r];e.min(s),t.max(s)}return{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}fillTriangulate(e){return xo(this.getAdaptivePointArray(),e)}strokeTriangulate(e){return Io(this.getAdaptivePointArray(),e)}toCommands(){const e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){const o=t[n];n===0?e.push({type:"M",x:o.x,y:o.y}):e.push({type:"L",x:o.x,y:o.y})}return e}toData(){return fo(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case"M":e.moveTo(t.x,t.y);break;case"L":e.lineTo(t.x,t.y);break}}),this}copy(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copy(this)}}const Bo=new Pt,$r=new Pt,zr=new Pt,nn=new A;class jn extends me{constructor(e=new A,t=new A,n=new A,r=0,o=0,s=Math.PI*2,a=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=o,this.endAngle=s,this.clockwise=a}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}isClockwise(){return this.clockwise}getPoint(e,t=new A){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(o?r=0:r=n),this.clockwise&&!o&&(r===n?r=-n:r=r-n);const s=this.startAngle+e*r;let a=this.cx+this.rx*Math.cos(s),l=this.cy+this.ry*Math.sin(s);if(this.rotate!==0){const h=Math.cos(this.rotate),c=Math.sin(this.rotate),f=a-this.cx,u=l-this.cy;a=f*h-u*c+this.cx,l=f*c+u*h+this.cy}return t.set(a,l)}toCommands(){const{cx:e,cy:t,rx:n,ry:r,startAngle:o,endAngle:s,clockwise:a,rotate:l}=this,h=e+n*Math.cos(o)*Math.cos(l)-r*Math.sin(o)*Math.sin(l),c=t+n*Math.cos(o)*Math.sin(l)+r*Math.sin(o)*Math.cos(l),f=Math.abs(o-s),u=f>Math.PI?1:0,d=a?1:0,p=l*180/Math.PI;if(f>=2*Math.PI){const m=o+Math.PI,y=e+n*Math.cos(m)*Math.cos(l)-r*Math.sin(m)*Math.sin(l),k=t+n*Math.cos(m)*Math.sin(l)+r*Math.sin(m)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:y,y:k},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:d,x:h,y:c}]}else{const m=e+n*Math.cos(s)*Math.cos(l)-r*Math.sin(s)*Math.sin(l),y=t+n*Math.cos(s)*Math.sin(l)+r*Math.sin(s)*Math.cos(l);return[{type:"M",x:h,y:c},{type:"A",rx:n,ry:r,angle:p,largeArcFlag:u,sweepFlag:d,x:m,y}]}}drawTo(e){const{cx:t,cy:n,rx:r,ry:o,rotate:s,startAngle:a,endAngle:l,clockwise:h}=this;return e.ellipse(t,n,r,o,s,a,l,!h),this}applyTransform(e){return nn.set(this.cx,this.cy),nn.applyMatrix3(e),this.cx=nn.x,this.cy=nn.y,Uo(e)?Eo(this,e):Do(this,e),this}getControlPointRefs(){return[this._center]}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,ry:o,dx:s,dy:a}=this;if(!(r>=0&&o>=0&&s>=0&&a>=0))return e;const l=Math.ceil(2.3*Math.sqrt(r+o)),h=l*8+(s?4:0)+(a?4:0);if(h===0)return e;const c=[];if(l===0)c[0]=c[6]=t+s,c[1]=c[3]=n+a,c[2]=c[4]=t-s,c[5]=c[7]=n-a;else{let f=0,u=l*4+(s?2:0)+2,d=u,p=h,m=s+r,y=a,k=t+m,P=t-m,v=n+y;if(c[f++]=k,c[f++]=v,c[--u]=v,c[--u]=P,a){const x=n-y;c[d++]=P,c[d++]=x,c[--p]=x,c[--p]=k}for(let x=1;x<l;x++){const b=Math.PI/2*(x/l),S=s+Math.cos(b)*r,w=a+Math.sin(b)*o,I=t+S,$=t-S,E=n+w,_=n-w;c[f++]=I,c[f++]=E,c[--u]=E,c[--u]=$,c[d++]=$,c[d++]=_,c[--p]=_,c[--p]=I}m=s,y=a+o,k=t+m,P=t-m,v=n+y;const C=n-y;c[f++]=k,c[f++]=v,c[--p]=C,c[--p]=k,s&&(c[f++]=P,c[f++]=v,c[--p]=C,c[--p]=P)}return Array.prototype.push.apply(e,c),e}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const a=this.getAdaptivePointArray();if(a.length===0)return{vertices:t,indices:n};let l=0,h=0;for(let u=0;u<a.length;u+=2)l+=a[u],h+=a[u+1];l/=a.length/2,h/=a.length/2;let c=o;t[c*r]=l,t[c*r+1]=h;const f=c++;for(let u=0;u<a.length;u+=2)t[c*r]=a[u],t[c*r+1]=a[u+1],u>0&&(n[s++]=c,n[s++]=f,n[s++]=c-1),c++;return n[s++]=f+1,n[s++]=f,n[s++]=c-1,{vertices:t,indices:n}}getMinMax(e=A.MAX,t=A.MIN){const{cx:n,cy:r,rx:o,ry:s,rotate:a}=this,l=Math.cos(a),h=Math.sin(a),c=Math.sqrt(o*o*l*l+s*s*h*h),f=Math.sqrt(o*o*h*h+s*s*l*l);return e.x=Math.min(e.x,n-c),e.y=Math.min(e.y,r-f),t.x=Math.max(t.x,n+c),t.y=Math.max(t.y,r+f),{min:e,max:t}}copy(e){return super.copy(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 Eo(i,e){const t=i.rx,n=i.ry,r=Math.cos(i.rotate),o=Math.sin(i.rotate),s=new A(t*r,t*o),a=new A(-n*o,n*r),l=s.applyMatrix3(e),h=a.applyMatrix3(e),c=Bo.set(l.x,h.x,0,l.y,h.y,0,0,0,1),f=$r.copy(c).invert(),p=zr.copy(f).transpose().multiply(f).elements,m=Lo(p[0],p[1],p[4]),y=Math.sqrt(m.rt1),k=Math.sqrt(m.rt2);if(i.rx=1/y,i.ry=1/k,i.rotate=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const v=$r.set(y,0,0,0,k,0,0,0,1),C=zr.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),x=v.multiply(C).multiply(c),b=S=>{const{x:w,y:I}=new A(Math.cos(S),Math.sin(S)).applyMatrix3(x);return Math.atan2(I,w)};i.startAngle=b(i.startAngle),i.endAngle=b(i.endAngle),Nr(e)&&(i.clockwise=!i.clockwise)}}function Do(i,e){const t=jr(e),n=Rr(e);i.rx*=t,i.ry*=n;const r=t>Number.EPSILON?Math.atan2(e.elements[1],e.elements[0]):Math.atan2(-e.elements[3],e.elements[4]);i.rotate+=r,Nr(e)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Nr(i){const e=i.elements;return e[0]*e[4]-e[1]*e[3]<0}function Uo(i){const e=i.elements,t=e[0]*e[3]+e[1]*e[4];if(t===0)return!1;const n=jr(i),r=Rr(i);return Math.abs(t/(n*r))>Number.EPSILON}function jr(i){const e=i.elements;return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Rr(i){const e=i.elements;return Math.sqrt(e[3]*e[3]+e[4]*e[4])}function Lo(i,e,t){let n,r,o,s,a;const l=i+t,h=i-t,c=Math.sqrt(h*h+4*e*e);return l>0?(n=.5*(l+c),a=1/n,r=i*a*t-e*a*e):l<0?r=.5*(l-c):(n=.5*c,r=-.5*c),h>0?o=h+c:o=h-c,Math.abs(o)>2*Math.abs(e)?(a=-2*e/o,s=1/Math.sqrt(1+a*a),o=a*s):Math.abs(e)===0?(o=1,s=0):(a=-.5*o/e,o=1/Math.sqrt(1+a*a),s=a*o),h>0&&(a=o,o=-s,s=a),{rt1:n,rt2:r,cs:o,sn:s}}class Fo extends jn{constructor(e=0,t=0,n=1,r=0,o=Math.PI*2,s=!1){super(new A(e,t),new A(n,n),new A(0,0),0,r,o,s)}drawTo(e){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;return e.arc(t,n,r,o,s,!a),this}getAdaptivePointArray(e=[]){const{cx:t,cy:n,rx:r,startAngle:o,endAngle:s,clockwise:a}=this;let l=Math.abs(o-s);(!a&&o>s||a&&s>o)&&(l=2*Math.PI-l);let h=Math.max(6,Math.floor(6*r**(1/3)*(l/Math.PI)));h=Math.max(h,3);let c=l/h,f=o;c*=a?1:-1;for(let u=0;u<h+1;u++){const d=Math.cos(f),p=Math.sin(f),m=t+d*r,y=n+p*r;e.push(m,y),f+=c}return e}}class $e extends me{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(e=>e instanceof $e?e.getFlatCurves():e)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new A){const n=e*this.getLength(),r=this.getLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const s=r[o]-n,a=this.curves[o],l=a.getLength();return a.getPointAt(l===0?0:1-s/l,t)}o++}return t}updateLengths(){const e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._arcLengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}getAdaptivePointArray(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptivePointArray(e),t&&e[t-1]===e[t+1]&&e[t]===e[t+2]&&e.splice(t+1,2),t=e.length-1}),e}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=A.MAX,t=A.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e,max:t}}getBoundingBox(){const{min:e,max:t}=this.getMinMax();return new H(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){var n;const t=(n=this.curves[0])==null?void 0:n.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(r=>r.drawTo(e)),this}copy(e){return super.copy(e),this.curves=e.curves.map(t=>t.clone()),this}}class Rn extends me{constructor(e=new A,t=new A,n=new A,r=new A){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(e,t,n,r,o,s,a,l){return new Rn(new A(e,t),new A(n,r),new A(o,s),new A(a,l))}getPoint(e,t=new A){const{p1:n,cp1:r,cp2:o,p2:s}=this;return t.set(Dr(e,n.x,r.x,o.x,s.x),Dr(e,n.y,r.y,o.y,s.y))}getAdaptivePointArray(e=[]){return bo(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){const r=t*t-4*e*n;if(r<0)return[];const o=Math.sqrt(r),s=(-t+o)/(2*e),a=(-t-o)/(2*e);return[s,a].filter(l=>l>=0&&l<=1)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp1:r,cp2:o,p2:s}=this,a=this._solveQuadratic(3*(r.x-n.x),6*(o.x-r.x),3*(s.x-o.x)),l=this._solveQuadratic(3*(r.y-n.y),6*(o.y-r.y),3*(s.y-o.y)),h=[0,1,...a,...l];return((f,u)=>{for(const d of f)for(let p=0;p<=u;p++){const m=p/u-.5,y=Math.min(1,Math.max(0,d+m)),k=this.getPoint(y);e.x=Math.min(e.x,k.x),e.y=Math.min(e.y,k.y),t.x=Math.max(t.x,k.x),t.y=Math.max(t.y,k.y)}})(h,10),{min:e,max:t}}toCommands(){const{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){const{p1:t,cp1:n,cp2:r,p2:o}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,o.x,o.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp1.copy(e.cp1),this.cp2.copy(e.cp2),this.p2.copy(e.p2),this}}class $o extends jn{constructor(e=0,t=0,n=1,r=1,o=0,s=0,a=Math.PI*2,l=!1){super(new A(e,t),new A(n,r),new A,o,s,a,l)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}}class Qt extends me{constructor(e=new A,t=new A){super(),this.p1=e,this.p2=t}static from(e,t,n,r){return new Qt(new A(e,t),new A(n,r))}getPoint(e,t=new A){return e===1?t.copy(this.p2):t.copy(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new A){return this.getPoint(e,t)}getTangent(e,t=new A){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new A){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptivePointArray(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=A.MAX,t=A.MIN){const{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,max:t}}toCommands(){const{p1:e,p2:t}=this;return[{type:"M",x:e.x,y:e.y},{type:"L",x:t.x,y:t.y}]}drawTo(e){const{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copy(e){return super.copy(e),this.p1.copy(e.p1),this.p2.copy(e.p2),this}}class zo extends $e{}class qn extends me{constructor(e=new A,t=new A,n=new A){super(),this.p1=e,this.cp=t,this.p2=n}static from(e,t,n,r,o,s){return new qn(new A(e,t),new A(n,r),new A(o,s))}getPoint(e,t=new A){const{p1:n,cp:r,p2:o}=this;return t.set(Ur(e,n.x,r.x,o.x),Ur(e,n.y,r.y,o.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptivePointArray(e=[]){return Po(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=A.MAX,t=A.MIN){const{p1:n,cp:r,p2:o}=this,s=.5*(n.x+r.x),a=.5*(n.y+r.y),l=.5*(n.x+o.x),h=.5*(n.y+o.y);return e.x=Math.min(e.x,n.x,o.x,s,l),e.y=Math.min(e.y,n.y,o.y,a,h),t.x=Math.max(t.x,n.x,o.x,s,l),t.y=Math.max(t.y,n.y,o.y,a,h),{min:e,max:t}}toCommands(){const{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){const{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}copy(e){return super.copy(e),this.p1.copy(e.p1),this.cp.copy(e.cp),this.p2.copy(e.p2),this}}class No extends zo{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(){const{x:e,y:t,width:n,height:r}=this,o=[new A(e,t),new A(e+n,t),new A(e+n,t+r),new A(e,t+r)];return this.curves=[new Qt(o[0],o[1]),new Qt(o[1],o[2]),new Qt(o[2],o[3]),new Qt(o[3],o[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}fillTriangulate(e={}){let{vertices:t=[],indices:n=[],verticesStride:r=2,verticesOffset:o=0,indicesOffset:s=0}=e;const{x:a,y:l,width:h,height:c}=this,f=[a,l,a+h,l,a+h,l+c,a,l+c];let u=0;o*=r,t[o+u]=f[0],t[o+u+1]=f[1],u+=r,t[o+u]=f[2],t[o+u+1]=f[3],u+=r,t[o+u]=f[6],t[o+u+1]=f[7],u+=r,t[o+u]=f[4],t[o+u+1]=f[5],u+=r;const d=o/r;return n[s++]=d,n[s++]=d+1,n[s++]=d+2,n[s++]=d+1,n[s++]=d+3,n[s++]=d+2,{vertices:t,indices:n}}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}}class jo extends jn{constructor(e=0,t=0,n=1,r=1,o=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=o,this.update()}update(){const{x:e,y:t,width:n,height:r,radius:o}=this,s=n/2,a=r/2,l=e+s,h=t+a,c=Math.max(0,Math.min(o,Math.min(s,a))),f=c,u=s-c,d=a-f;return this._center=new A(l,h),this._radius=new A(c,f),this._diff=new A(u,d),this}drawTo(e){const{x:t,y:n,width:r,height:o,radius:s}=this;return e.roundRect(t,n,r,o,s),this}copy(e){return super.copy(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}}class Ro extends me{constructor(e=[]){super(),this.points=e}getPoint(e,t=new A){const{points:n}=this,r=(n.length-1)*e,o=Math.floor(r),s=r-o,a=n[o===0?o:o-1],l=n[o],h=n[o>n.length-2?n.length-1:o+1],c=n[o>n.length-3?n.length-1:o+2];return t.set(Er(s,a.x,l.x,h.x,c.x),Er(s,a.y,l.y,h.y,c.y)),t}getControlPointRefs(){return this.points}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}}class rn extends $e{constructor(t){super();M(this,"startPoint");M(this,"currentPoint");M(this,"autoClose",!1);t&&this.addPoints(t)}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let n=1,r=t.length;n<r;n++){const{x:o,y:s}=t[n];this.lineTo(o,s)}return this}addCommands(t){return Or(t,this),this}addData(t){return this.addCommands(Br(t)),this}getUnevenPointArray(t=40,n=[]){return super.getUnevenPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}getSpacedPointArray(t=40,n=[]){return super.getSpacedPointArray(t,n),this.autoClose&&n.length>=4&&n[0]!==n[n.length-2]&&n[1]!==n[n.length-1]&&n.push(n[0],n[1]),n}_setCurrentPoint(t){return this.currentPoint=new A(t.x,t.y),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}_connetLineTo(t){if(this.curves.length>0){const n=t.getPoint(0);(!this.currentPoint||!n.equals(this.currentPoint))&&this.lineTo(n.x,n.y)}return this}closePath(){const t=this.startPoint;if(t){const n=this.currentPoint;n&&!t.equals(n)&&(this.curves.push(new Qt(n,t)),n.copy(t)),this.startPoint=void 0}return this}moveTo(t,n){return this.currentPoint=new A(t,n),this.startPoint=this.currentPoint.clone(),this}lineTo(t,n){const r=this.currentPoint;return r!=null&&r.equals({x:t,y:n})||this.curves.push(Qt.from((r==null?void 0:r.x)??0,(r==null?void 0:r.y)??0,t,n)),this._setCurrentPoint({x:t,y:n}),this}bezierCurveTo(t,n,r,o,s,a){const l=this.currentPoint;return l!=null&&l.equals({x:s,y:a})||this.curves.push(Rn.from((l==null?void 0:l.x)??0,(l==null?void 0:l.y)??0,t,n,r,o,s,a)),this._setCurrentPoint({x:s,y:a}),this}quadraticCurveTo(t,n,r,o){const s=this.currentPoint;return s!=null&&s.equals({x:r,y:o})||this.curves.push(qn.from((s==null?void 0:s.x)??0,(s==null?void 0:s.y)??0,t,n,r,o)),this._setCurrentPoint({x:r,y:o}),this}arc(t,n,r,o,s,a){const l=new Fo(t,n,r,o,s,!a);return this._connetLineTo(l),this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeArc(t,n,r,o,s,a){var l,h;return t+=((l=this.currentPoint)==null?void 0:l.x)??0,n+=((h=this.currentPoint)==null?void 0:h.y)??0,this.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,n,r,o,s,a,l,h=!0){const c=new $o(t,n,r,o,s,a,l,!h);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(t,n,r,o,s,a,l,h){var c,f;return t+=((c=this.currentPoint)==null?void 0:c.x)??0,n+=((f=this.currentPoint)==null?void 0:f.y)??0,this.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){const s=new No(t,n,r,o);return this._connetLineTo(s),this.curves.push(s),this._setCurrentPoint({x:t,y:n}),this}roundRect(t,n,r,o,s){const a=new jo(t,n,r,o,s);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:t,y:n}),this}splineThru(t){const n=this.currentPoint??new A;return this.curves.push(new Ro([n].concat(t))),this._setCurrentPoint(t[t.length-1]),this}drawTo(t){var r;const n=(r=this.curves[0])==null?void 0:r.getPoint(0);return n&&t.moveTo(n.x,n.y),this.curves.forEach(o=>o.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){var n;return super.copy(t),this.autoClose=t.autoClose,this.currentPoint=(n=t.currentPoint)==null?void 0:n.clone(),this}}function qo(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}function Go(i,e,t,n){const r=e.clone().sub(i),o=n.clone().sub(t),s=t.clone().sub(i),a=r.cross(o);if(a===0)return new A((i.x+t.x)/2,(i.y+t.y)/2);const l=s.cross(o)/a;return Math.abs(l)>1?new A((i.x+t.x)/2,(i.y+t.y)/2):new A(i.x+l*r.x,i.y+l*r.y)}class Tt extends $e{constructor(t,n={}){super();M(this,"currentCurve",new rn);M(this,"style");this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof Tt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof Tt?this.curves.push(...t.curves.map(n=>n.clone())):this.curves.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentCurve.closePath(),this.currentCurve.curves.length>0&&(this.currentCurve=new rn().moveTo(t.x,t.y),this.curves.push(this.currentCurve))),this}moveTo(t,n){var r;return(r=this.currentCurve.currentPoint)!=null&&r.equals({x:t,y:n})||(this.currentCurve.curves.length&&(this.currentCurve=new rn,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(t,n)),this}lineTo(t,n){return this.currentCurve.lineTo(t,n),this}bezierCurveTo(t,n,r,o,s,a){return this.currentCurve.bezierCurveTo(t,n,r,o,s,a),this}quadraticCurveTo(t,n,r,o){return this.currentCurve.quadraticCurveTo(t,n,r,o),this}arc(t,n,r,o,s,a){return this.currentCurve.arc(t,n,r,o,s,a),this}arcTo(t,n,r,o,s){return this.currentCurve.arcTo(t,n,r,o,s),this}ellipse(t,n,r,o,s,a,l,h){return this.currentCurve.ellipse(t,n,r,o,s,a,l,h),this}rect(t,n,r,o){return this.currentCurve.rect(t,n,r,o),this}roundRect(t,n,r,o,s){return this.currentCurve.roundRect(t,n,r,o,s),this}reset(){return this.currentCurve=new rn,this.curves.push(this.currentCurve),this.style={},this}addCommands(t){return Or(t,this),this}addData(t){return this.addCommands(Br(t)),this}splineThru(t){return this.currentCurve.splineThru(t),this}scale(t,n=t,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.scale(t,n,r)}),this}skew(t,n=0,r={x:0,y:0}){return this.getControlPointRefs().forEach(o=>{o.skew(t,n,r)}),this}rotate(t,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.rotate(t,n)}),this}bold(t){if(t===0)return this;const n=this.getFlatCurves(),r=[],o=[],s=[];n.forEach((l,h)=>{const c=l.getControlPointRefs(),f=l.isClockwise();s[h]=c,o[h]=f;const u=c[0],d=c[c.length-1]??u;r.push({start:f?d:u,end:f?u:d,index:h})});const a=[];return r.forEach((l,h)=>{a[h]=[],r.forEach((c,f)=>{var u;c.start&&l.end&&f!==h&&((u=c.start)!=null&&u.equals(l.end))&&a[h].push(c.index)})}),n.forEach((l,h)=>{const c=o[h];s[h].forEach(f=>{f.add(l.getNormal(l.getTForPoint(f)).scale(c?t:-t))})}),a.forEach((l,h)=>{const c=s[h];l.forEach(f=>{const u=s[f],d=Go(c[c.length-1],c[c.length-2]??c[c.length-1],u[0],u[1]??u[0]);d&&(c[c.length-1].copy(d),u[0].copy(d))})}),this}getMinMax(t=A.MAX,n=A.MIN,r=!0){const o=this.strokeWidth;return this.curves.forEach(s=>{if(s.getMinMax(t,n),r&&o>1){const a=o/2,l=s.isClockwise(),h=[];for(let c=0;c<=1;c+=1/s.arcLengthDivision){const f=s.getPoint(c),u=s.getNormal(c),d=u.clone().scale(l?a:-a),p=u.clone().scale(l?-a:a);h.push(f.clone().add(d),f.clone().add(p),f.clone().add({x:a,y:0}),f.clone().add({x:-a,y:0}),f.clone().add({x:0,y:a}),f.clone().add({x:0,y:-a}),f.clone().add({x:a,y:a}),f.clone().add({x:-a,y:-a}))}t.min(...h),n.max(...h)}}),{min:t,max:n}}getBoundingBox(t=!0){const{min:n,max:r}=this.getMinMax(void 0,void 0,t);return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.curves.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}drawControlPointsTo(t,n={}){n={...this.style,...n};const{fill:r="#000",stroke:o="none"}=n;return t.beginPath(),t.save(),Fn(t,n),this.getControlPointRefs().forEach(s=>{lo(t,s.x,s.y,{radius:4})}),r!=="none"&&t.fill(),o!=="none"&&t.stroke(),t.restore(),this}toCommands(){return this.curves.flatMap(t=>t.toCommands())}toData(){return this.curves.filter(t=>t.curves.length).map(t=>t.toData()).join(" ")}toSVGPathString(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},n={};for(const o in t)t[o]!==void 0&&(n[qo(o)]=t[o]);Object.assign(n,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const o in n)n[o]!==void 0&&(r+=`${o}:${n[o]};`);return`<path d="${this.toData()}" style="${r}"></path>`}copy(t){return super.copy(t),this.currentCurve=t.currentCurve.clone(),this.style={...t.style},this}}class Gn{constructor(e=[]){this.paths=e}getBoundingBox(e=!0){if(!this.paths.length)return;const t=A.MAX,n=A.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new H(t.x,t.y,n.x-t.x,n.y-t.y)}toSVGString(){const{x:e,y:t,width:n,height:r}=this.getBoundingBox(),o=this.paths.map(s=>s.toSVGPathString()).join("");return`<svg viewBox="${e} ${t} ${n} ${r}" width="${n}px" height="${r}px" xmlns="http://www.w3.org/2000/svg">${o}</svg>`}toSVGUrl(){return`data:image/svg+xml;base64,${btoa(this.toSVGString())}`}toSVG(){return new DOMParser().parseFromString(this.toSVGString(),"image/svg+xml").documentElement}toCanvas(e={}){const{pixelRatio:t=2,...n}=e,{left:r,top:o,width:s,height:a}=this.getBoundingBox(),l=document.createElement("canvas");l.width=s*t,l.height=a*t,l.style.width=`${s}px`,l.style.height=`${a}px`;const h=l.getContext("2d");return h&&(h.scale(t,t),h.translate(-r,-o),this.paths.forEach(c=>{c.drawTo(h,n)})),l}}const qr="data:image/svg+xml;",Gr=`${qr}base64,`,Wr=`${qr}charset=utf8,`;function Vr(i){if(typeof i=="string"){let e;i.startsWith(Gr)?(i=i.substring(Gr.length,i.length),e=atob(i)):i.startsWith(Wr)?(i=i.substring(Wr.length,i.length),e=decodeURIComponent(i)):e=i;const t=new DOMParser().parseFromString(e,"text/xml"),n=t.querySelector("parsererror");if(n)throw new Error(`${n.textContent??"parser error"}
|
|
5
|
+
${e}`);return t.documentElement}else return i}const Wo="px",Vo=90,Xr=["mm","cm","in","pt","pc","px"],Hr={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 Y(i){let e="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=Xr.length;n<r;n++){const o=Xr[n];if(i.endsWith(o)){e=o,i=i.substring(0,i.length-o.length);break}}let t;return t=Hr[e][Wo],t<0&&(t=Hr[e].in*Vo),t*Number.parseFloat(i)}const Xo=new Pt,sn=new Pt,Zr=new Pt,Yr=new Pt;function Ho(i,e,t){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Zo(i);return t.length>0&&n.premultiply(t[t.length-1]),e.copy(n),t.push(n),n}function Zo(i){const e=new Pt,t=Xo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&e.translate(Y(i.getAttribute("x")),Y(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const o=n[r].trim();if(o==="")continue;const s=o.indexOf("("),a=o.length;if(s>0&&s<a){const l=o.slice(0,s),h=qt(o.slice(s+1));switch(t.identity(),l){case"translate":if(h.length>=1){const c=h[0];let f=0;h.length>=2&&(f=h[1]),t.translate(c,f)}break;case"rotate":if(h.length>=1){let c=0,f=0,u=0;c=h[0]*Math.PI/180,h.length>=3&&(f=h[1],u=h[2]),sn.makeTranslation(-f,-u),Zr.makeRotation(c),Yr.multiplyMatrices(Zr,sn),sn.makeTranslation(f,u),t.multiplyMatrices(sn,Yr)}break;case"scale":h.length>=1&&t.scale(h[0],h[1]??h[0]);break;case"skewX":h.length===1&&t.set(1,Math.tan(h[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":h.length===1&&t.set(1,0,0,Math.tan(h[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":h.length===6&&t.set(h[0],h[2],h[4],h[1],h[3],h[5],0,0,1);break}}e.premultiply(t)}}return e}function Yo(i){return new Tt().arc(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("r")||0),0,Math.PI*2)}function Ko(i,e){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let t=0;t<i.sheet.cssRules.length;t++){const n=i.sheet.cssRules[t];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim()),o={};for(let s=n.style.length,a=0;a<s;a++){const l=n.style.item(a);o[l]=n.style.getPropertyValue(l)}for(let s=0;s<r.length;s++)e[r[s]]=Object.assign(e[r[s]]||{},{...o})}}function Qo(i){return new Tt().ellipse(Y(i.getAttribute("cx")||0),Y(i.getAttribute("cy")||0),Y(i.getAttribute("rx")||0),Y(i.getAttribute("ry")||0),0,0,Math.PI*2)}function Jo(i){return new Tt().moveTo(Y(i.getAttribute("x1")||0),Y(i.getAttribute("y1")||0)).lineTo(Y(i.getAttribute("x2")||0),Y(i.getAttribute("y2")||0))}function ta(i){const e=new Tt,t=i.getAttribute("d");return!t||t==="none"?null:(e.addData(t),e)}const ea=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function na(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(ea,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!0,e}const ra=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function sa(i){var n;const e=new Tt;let t=0;return(n=i.getAttribute("points"))==null||n.replace(ra,(r,o,s)=>{const a=Y(o),l=Y(s);return t===0?e.moveTo(a,l):e.lineTo(a,l),t++,r}),e.currentCurve.autoClose=!1,e}function ia(i){const e=Y(i.getAttribute("x")||0),t=Y(i.getAttribute("y")||0),n=Y(i.getAttribute("rx")||i.getAttribute("ry")||0),r=Y(i.getAttribute("ry")||i.getAttribute("rx")||0),o=Y(i.getAttribute("width")),s=Y(i.getAttribute("height")),a=1-.551915024494,l=new Tt;return l.moveTo(e+n,t),l.lineTo(e+o-n,t),(n!==0||r!==0)&&l.bezierCurveTo(e+o-n*a,t,e+o,t+r*a,e+o,t+r),l.lineTo(e+o,t+s-r),(n!==0||r!==0)&&l.bezierCurveTo(e+o,t+s-r*a,e+o-n*a,t+s,e+o-n,t+s),l.lineTo(e+n,t+s),(n!==0||r!==0)&&l.bezierCurveTo(e+n*a,t+s,e,t+s-r*a,e,t+s-r),l.lineTo(e,t+r),(n!==0||r!==0)&&l.bezierCurveTo(e,t+r*a,e+n*a,t,e+n,t),l}function Gt(i,e,t){e=Object.assign({},e);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,t[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,t[`#${i.getAttribute("id")}`]));for(let h=i.style.length,c=0;c<h;c++){const f=i.style.item(c),u=i.style.getPropertyValue(f);e[f]=u,n[f]=u}function r(h,c,f=o){i.hasAttribute(h)&&(e[c]=f(i.getAttribute(h))),n[h]&&(e[c]=f(n[h]))}function o(h){return h.startsWith("url")&&console.warn("url access in attributes is not implemented."),h}function s(h){return Math.max(0,Math.min(1,Y(h)))}function a(h){return Math.max(0,Y(h))}function l(h){return h.split(" ").filter(c=>c!=="").map(c=>Y(c))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("stroke-linecap","strokeLinecap"),r("stroke-linejoin","strokeLinejoin"),r("stroke-miterlimit","strokeMiterlimit",a),r("stroke-dasharray","strokeDasharray",l),r("stroke-dashoffset","strokeDashoffset",Y),r("visibility","visibility"),e}function Wn(i,e,t=[],n={}){var f;if(i.nodeType!==1)return t;let r=!1,o=null,s={...e};switch(i.nodeName){case"svg":s=Gt(i,s,n);break;case"style":Ko(i,n);break;case"g":s=Gt(i,s,n);break;case"path":s=Gt(i,s,n),i.hasAttribute("d")&&(o=ta(i));break;case"rect":s=Gt(i,s,n),o=ia(i);break;case"polygon":s=Gt(i,s,n),o=na(i);break;case"polyline":s=Gt(i,s,n),o=sa(i);break;case"circle":s=Gt(i,s,n),o=Yo(i);break;case"ellipse":s=Gt(i,s,n),o=Qo(i);break;case"line":s=Gt(i,s,n),o=Jo(i);break;case"defs":r=!0;break;case"use":{s=Gt(i,s,n);const d=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||i.getAttribute("href")||"").substring(1),p=(f=i.viewportElement)==null?void 0:f.getElementById(d);p?Wn(p,s,t,n):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(i);break}if(s.display==="none")return t;Object.assign(e,s);const a=new Pt,l=[],h=Ho(i,a,l);o&&(o.applyTransform(a),t.push(o),o.style=e);const c=i.childNodes;for(let u=0,d=c.length;u<d;u++){const p=c[u];r&&p.nodeName!=="style"&&p.nodeName!=="defs"||Wn(p,e,t,n)}return h&&(l.pop(),l.length>0?a.copy(l[l.length-1]):a.identity()),t}function Kr(i){return new Gn(Wn(Vr(i),{}))}const oa=new Set(["©","®","÷"]),aa=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]),la={1:"italic",32:"bold"},ha={1:"italic",2:"bold"},Qr={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5};class Jr{constructor(e,t,n){M(this,"path",new Tt);M(this,"lineBox",new H);M(this,"inlineBox",new H);M(this,"glyphBox");M(this,"advanceWidth",0);M(this,"advanceHeight",0);M(this,"underlinePosition",0);M(this,"underlineThickness",0);M(this,"strikeoutPosition",0);M(this,"strikeoutSize",0);M(this,"ascender",0);M(this,"descender",0);M(this,"typoAscender",0);M(this,"typoDescender",0);M(this,"typoLineGap",0);M(this,"winAscent",0);M(this,"winDescent",0);M(this,"xHeight",0);M(this,"capHeight",0);M(this,"baseline",0);M(this,"centerDiviation",0);M(this,"fontStyle");this.content=e,this.index=t,this.parent=n}get center(){var e;return(e=this.glyphBox)==null?void 0:e.center}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}_getFontSFNT(e){const t=this.computedStyle.fontFamily,n=e??Gi,r=t?n.get(t):n.fallbackFont;return r==null?void 0:r.getSFNT()}updateGlyph(e=this._getFontSFNT()){if(!e)return this;const{hhea:t,os2:n,post:r,head:o}=e,s=o.unitsPerEm,a=t.ascent,l=t.descent,{content:h,computedStyle:c,isVertical:f}=this,{fontSize:u}=c,d=s/u,p=e.getAdvanceWidth(h,u),m=(a+Math.abs(l))/d,y=a/d;return this.advanceWidth=p,this.advanceHeight=m,this.inlineBox.width=f?m:p,this.inlineBox.height=f?p:m,this.underlinePosition=(a-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(a-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=a/d,this.descender=l/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.sxHeight/d,this.capHeight=n.sCapHeight/d,this.baseline=y,this.centerDiviation=m/2-y,this.fontStyle=la[n.fsSelection]??ha[o.macStyle],this}update(e){const t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);const{isVertical:n,content:r,computedStyle:o,baseline:s,inlineBox:a,ascender:l,descender:h,typoAscender:c,fontStyle:f,advanceWidth:u,advanceHeight:d}=this,{left:p,top:m}=a,y=o.fontStyle==="italic"&&f!=="italic";let k=p,P=m+s,v;const C=new Tt;if(n&&(k+=(d-u)/2,Math.abs(u-d)>.1&&(P-=(l-c)/(l+Math.abs(h))*d),v=void 0),n&&!oa.has(r)&&(r.codePointAt(0)<=256||aa.has(r))){C.addCommands(t.getPathCommands(r,k,m+s-(d-u)/2,o.fontSize));const b={y:m-(d-u)/2+d/2,x:k+u/2};y&&this._italic(C,n?{x:b.x,y:m-(d-u)/2+s}:void 0),C.rotate(90,b)}else v!==void 0?(C.addCommands(t.glyphs.get(v).getPathCommands(k,P,o.fontSize)),y&&this._italic(C,n?{x:k+u/2,y:m+c/(l+Math.abs(h))*d}:void 0)):(C.addCommands(t.getPathCommands(r,k,P,o.fontSize)),y&&this._italic(C,n?{x:k+d/2,y:P}:void 0));const x=o.fontWeight??400;return x in Qr&&(x===700||x==="bold")&&f!=="bold"&&C.bold(Qr[x]*o.fontSize*.05),C.style={fill:o.color,stroke:o.textStrokeWidth?o.textStrokeColor:"none",strokeWidth:o.textStrokeWidth?o.textStrokeWidth*o.fontSize*.03:0},this.path=C,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){var r;if((r=this.path.curves[0])!=null&&r.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){const t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;const{min:n,max:r}=t;return new H(n.x,n.y,r.x-n.x,r.y-n.y)}drawTo(e,t={}){const n=this.computedStyle,r={ctx:e,path:this.path,fontSize:n.fontSize,color:n.color,...t};if(this.glyphBox)le(r);else{e.save(),e.beginPath();const o=this.path.style,s={...o,fill:r.color??o.fill,stroke:r.textStrokeColor??o.stroke,strokeWidth:r.textStrokeWidth?r.textStrokeWidth*r.fontSize:o.strokeWidth,shadowOffsetX:(r.shadowOffsetX??0)*r.fontSize,shadowOffsetY:(r.shadowOffsetY??0)*r.fontSize,shadowBlur:(r.shadowBlur??0)*r.fontSize,shadowColor:r.shadowColor};Fn(e,s),e.font=`${r.fontSize}px ${r.fontFamily}`,this.isVertical?(e.textBaseline="middle",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.inlineBox.height/2)):(e.textBaseline="alphabetic",e.fillText(this.content,this.inlineBox.left,this.inlineBox.top+this.baseline)),e.restore()}}}function on(i,e){return typeof i=="number"?i:i.endsWith("%")?(i=i.substring(0,i.length-1),Math.ceil(Number(i)/100*e.total)):i.endsWith("rem")?(i=i.substring(0,i.length-3),Number(i)*e.fontSize):i.endsWith("em")?(i=i.substring(0,i.length-2),Number(i)*e.fontSize):Number(i)}function Vn(i){const e=Xt(i)?{}:i;return Object.keys(e).reduce((t,n)=>{let r=e[n];const o=Xn(n),s=Xn(r);return o&&(n=o),s&&(r=s),t[n]=r,t},{})}function Xt(i){return!i||i==="none"}function ts(i,e){const t=Object.keys(i),n=Object.keys(e);return Array.from(new Set([...t,...n])).every(o=>oe(i[o],e[o]))}function oe(i,e){const t=typeof i;return t===typeof e?t==="object"?ts(i,e):i===e:!1}function Xn(i){const e=i.startsWith("#")?i.slice(1):i;if(!/^(?:[0-9A-F]{3}|[0-9A-F]{6})$/i.test(e))return null;const n=e.length===3?e.split("").map(a=>a+a).join(""):e,r=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),s=Number.parseInt(n.slice(4,6),16);return`rgb(${r}, ${o}, ${s})`}function an(i){if(!i)return i;const e={};for(const t in i)i[t]!==""&&i[t]!==void 0&&(e[t]=i[t]);return e}function ln(i){return i.startsWith("http://")||i.startsWith("https://")||i.startsWith("blob://")}class es{constructor(e,t={},n){M(this,"inlineBox",new H);this.content=e,this.style=t,this.parent=n,this.updateComputedStyle().initCharacters()}get computedContent(){const e=this.computedStyle;return e.textTransform==="uppercase"?this.content.toUpperCase():e.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...an(this.style)},this}initCharacters(){const e=[];let t=0;for(const n of this.computedContent)e.push(new Jr(n,t++,this));return this.characters=e,this}}class xe{constructor(e,t){M(this,"lineBox",new H);M(this,"fragments",[]);this.style=e,this.parentStyle=t,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...an(this.parentStyle),...an(this.style)},this}addFragment(e,t){const n=new es(e,t,this);return this.fragments.push(n),n}}function ca(i){return i}const ve=class ve{_styleToDomStyle(e){const t={};for(const n in e){const r=e[n];ve.notZeroStyles.has(n)&&r===0||(typeof r=="number"&&ve.pxStyles.has(n)?t[n]=`${r}px`:t[n]=r)}return t}createParagraphDom(e,t){const n=document.createDocumentFragment(),r=document.createElement("section"),o={...t},s=t.writingMode.includes("horizontal");switch(t.textAlign){case"start":case"left":o.justifyContent="start";break;case"center":o.justifyContent="center";break;case"end":case"right":o.justifyContent="end";break}switch(t.verticalAlign){case"top":o.alignItems="top";break;case"middle":o.alignItems="center";break;case"bottom":o.alignItems="end";break}const a=!!(o.justifyContent||o.alignItems);Object.assign(r.style,{boxSizing:"border-box",display:a?"inline-flex":void 0,width:"max-content",height:"max-content",whiteSpace:"pre-wrap",wordBreak:"break-all",...this._styleToDomStyle(o),position:"fixed",visibility:"hidden"});const l=document.createElement("ul");return Object.assign(l.style,{verticalAlign:"inherit",listStyleType:"inherit",padding:"0",margin:"0",width:a&&s?"100%":void 0,height:a&&!s?"100%":void 0}),e.forEach(h=>{const c=document.createElement("li");Object.assign(c.style,{verticalAlign:"inherit",...this._styleToDomStyle(h.style)}),h.fragments.forEach(f=>{const u=document.createElement("span");Object.assign(u.style,{verticalAlign:"inherit",...this._styleToDomStyle(f.style)}),u.appendChild(document.createTextNode(f.content)),c.appendChild(u)}),l.appendChild(c)}),r.appendChild(l),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var h;return(h=r.parentNode)==null?void 0:h.removeChild(r)}}}measureDomText(e){const t=document.createRange();t.selectNodeContents(e);const n=e.data??"";let r=0;return Array.from(n).map(o=>{var f;const s=r+=n.substring(r).indexOf(o),a=s+o.length;r+=o.length,t.setStart(e,Math.max(s,0)),t.setEnd(e,a);const l=((f=t.getClientRects)==null?void 0:f.call(t))??[t.getBoundingClientRect()];let h=l[l.length-1];l.length>1&&h.width<2&&(h=l[l.length-2]);const c=t.toString();if(c!==""&&h&&h.width+h.height!==0)return{content:c,top:h.top,left:h.left,height:h.height,width:h.width}}).filter(Boolean)}measureDom(e){const t=[],n=[],r=[];return e.querySelectorAll("li").forEach((o,s)=>{const a=o.getBoundingClientRect();t.push({paragraphIndex:s,left:a.left,top:a.top,width:a.width,height:a.height}),o.querySelectorAll(":scope > *").forEach((l,h)=>{const c=l.getBoundingClientRect();n.push({paragraphIndex:s,fragmentIndex:h,left:c.left,top:c.top,width:c.width,height:c.height});let f=0;!l.children.length&&l.firstChild instanceof window.Text?this.measureDomText(l.firstChild).forEach(u=>{r.push({...u,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})}):l.querySelectorAll(":scope > *").forEach(u=>{u.firstChild instanceof window.Text&&this.measureDomText(u.firstChild).forEach(d=>{r.push({...d,newParagraphIndex:-1,paragraphIndex:s,fragmentIndex:h,characterIndex:f++,textWidth:-1,textHeight:-1})})})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){const n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(a=>{const l=e[a.paragraphIndex];l.lineBox.left=a.left-n.left,l.lineBox.top=a.top-n.top,l.lineBox.width=a.width,l.lineBox.height=a.height}),r.fragments.forEach(a=>{const l=e[a.paragraphIndex].fragments[a.fragmentIndex];l.inlineBox.left=a.left-n.left,l.inlineBox.top=a.top-n.top,l.inlineBox.width=a.width,l.inlineBox.height=a.height});const o=[];let s=0;return r.characters.forEach(a=>{const{paragraphIndex:l,fragmentIndex:h,characterIndex:c}=a;o.push({...a,newParagraphIndex:l,left:a.left-n.left,top:a.top-n.top});const f=e[l].fragments[h].characters[c],{fontHeight:u,isVertical:d}=f,p=o[s];f.inlineBox.left=p.left,f.inlineBox.top=p.top,f.inlineBox.width=p.width,f.inlineBox.height=p.height,d?(f.lineBox.left=p.left+(p.width-u)/2,f.lineBox.top=p.top,f.lineBox.width=u,f.lineBox.height=p.height):(f.lineBox.left=p.left,f.lineBox.top=p.top+(p.height-u)/2,f.lineBox.width=p.width,f.lineBox.height=u),s++}),{paragraphs:e,boundingBox:new H(0,0,n.width,n.height)}}measure(e,t,n){let r;n||({dom:n,destory:r}=this.createParagraphDom(e,t));const o=this.measureParagraphDom(e,n);return r==null||r(),o}};M(ve,"notZeroStyles",new Set(["width","height"])),M(ve,"pxStyles",new Set(["width","height","fontSize","letterSpacing","textStrokeWidth","textIndent","shadowOffsetX","shadowOffsetY","shadowBlur","marginLeft","marginTop","marginRight","marginBottom","paddingLeft","paddingTop","paddingRight","paddingBottom"]));let hn=ve;function fa(){return{shadowColor:"transparent",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0}}function ua(){return{left:0,top:0,width:0,height:0,rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function pa(){return{overflow:"visible",visibility:"visible",filter:"none",opacity:1,marginLeft:0,marginTop:0,marginRight:0,marginBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,...ua(),backgroundImage:"none",backgroundColor:"transparent",...fa(),borderRadius:0,borderColor:"transparent",borderWidth:1}}function da(){return{writingMode:"horizontal-tb",verticalAlign:"baseline",lineHeight:1.2,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",textIndent:0,textTransform:"none",textOrientation:"mixed",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"black",color:"black",listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside",highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function ya(){return{...pa(),...da()}}class ga{constructor(){M(this,"eventListeners",new Map)}addEventListener(e,t,n){const r={value:t,options:n},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(r):this.eventListeners.set(e,[o,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){var o,s;if(!t)return this.eventListeners.delete(e),this;const r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){const a=[];for(let l=0,h=r.length;l<h;l++){const c=r[l];(c.value!==t||typeof n=="object"&&(n!=null&&n.once)&&(typeof c.options=="boolean"||!((o=c.options)!=null&&o.once)))&&a.push(c)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else r.value===t&&(typeof n=="boolean"||!(n!=null&&n.once)||typeof r.options=="boolean"||(s=r.options)!=null&&s.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,t){var r,o;const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let s=n.length,a=0;a<s;a++){const l=n[a];typeof l.options=="object"&&((r=l.options)!=null&&r.once)&&this.off(e,l.value,l.options),l.value.apply(this,[t])}else typeof n.options=="object"&&((o=n.options)!=null&&o.once)&&this.off(e,n.value,n.options),n.value.apply(this,[t]);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,t){this.dispatchEvent(e,t)}}function cn(i){const{highlight:e,highlightImage:t,highlightReferImage:n,highlightColormap:r,highlightLine:o,highlightSize:s,highlightThickness:a}=i;return{image:(e==null?void 0:e.image)??t??"none",referImage:(e==null?void 0:e.referImage)??n??"none",colormap:(e==null?void 0:e.colormap)??r??"none",line:(e==null?void 0:e.line)??o??"none",size:(e==null?void 0:e.size)??s??"cover",thickness:(e==null?void 0:e.thickness)??a??"100%"}}function ns(){const i=[],e=[],t=new Map,n=new Map;async function r(s){if(!t.has(s)){t.set(s,s);try{t.set(s,await fetch(s).then(a=>a.text()))}catch(a){console.warn(a),t.delete(s)}}}function o(s){let a=n.get(s);if(!a){const l=Vr(ln(s)?t.get(s)??s:s),h=Kr(l);a={dom:l,pathSet:h},n.set(s,a)}return a}return{name:"highlight",paths:i,load:async s=>{const a=new Set;s.forEachCharacter(l=>{const{computedStyle:h}=l,{image:c,referImage:f}=cn(h);ln(c)&&a.add(c),ln(f)&&a.add(f)}),await Promise.all(Array.from(a).map(l=>r(l)))},update:s=>{e.length=0,i.length=0;let a=[],l,h;s.forEachCharacter(c=>{const{computedStyle:f}=c,u=cn(f),{image:d,colormap:p,line:m,size:y,thickness:k}=u;if(Xt(d))l!=null&&l.length&&(l=[],a.push(l));else{const{inlineBox:P,isVertical:v}=c,{fontSize:C}=f;(!h||oe(h.image,d)&&oe(h.colormap,p)&&oe(h.line,m)&&oe(h.size,y)&&oe(h.thickness,k))&&(l!=null&&l.length)&&(v?l[0].inlineBox.left===P.left:l[0].inlineBox.top===P.top)&&l[0].fontSize===C?l.push(c):(l=[],l.push(c),a.push(l))}h=u}),a=a.filter(c=>c.length);for(let c=0;c<a.length;c++){const f=a[c],u=f[0],d=H.from(...f.filter(O=>O.glyphBox).map(O=>O.glyphBox)),{computedStyle:p}=u,{fontSize:m,writingMode:y}=p,{image:k,referImage:P,colormap:v,line:C,size:x,thickness:b}=cn(p),S=y.includes("vertical"),w=on(b,{fontSize:m,total:d.width})/d.width,I=Vn(v),{pathSet:$,dom:E}=o(k),_=$.getBoundingBox(!0),N=m/_.width*2,T=new H().copy(d);S&&(T.width=d.height,T.height=d.width,T.left=d.left+d.width);const U=Math.floor(T.width);let V=U;if(x!=="cover"&&(V=on(x,{fontSize:m,total:d.width})||U,T.width=V),!Xt(P)&&Xt(C)){const O=o(P).pathSet.getBoundingBox(!0);_.copy(O)}else{let O;if(Xt(C))if(_.width/_.height>4){O="underline";const q=E.getAttribute("viewBox");if(q){const[L,D,Z,W]=q.split(" ").map(j=>Number(j)),G=D+W/2;_.y<G&&_.y+_.height>G?O="line-through":_.y+_.height<G?O="overline":O="underline"}}else O="outline";else O=C;switch(O){case"outline":{const q=T.width*.2,L=T.height*.2;T.width+=q,T.height+=L,S?(T.x-=L/2,T.y-=q/2,T.x+=T.height):(T.x-=q/2,T.y-=L/2);break}case"overline":T.height=_.height*N,S?T.x=u.inlineBox.left+u.inlineBox.width:T.y=u.inlineBox.top;break;case"line-through":T.height=_.height*N,S?T.x=u.inlineBox.left+u.inlineBox.width-u.strikeoutPosition+T.height/2:T.y=u.inlineBox.top+u.strikeoutPosition-T.height/2;break;case"underline":T.height=_.height*N,S?T.x=u.inlineBox.left+u.inlineBox.width-u.underlinePosition:T.y=u.inlineBox.top+u.underlinePosition;break}}const B=new Pt().translate(-_.x,-_.y).scale(T.width/_.width,T.height/_.height);S&&B.rotate(-Math.PI/2),B.translate(T.x,T.y);for(let O=0;O<Math.ceil(U/V);O++){const q=B.clone();S?q.translate(0,O*T.width):q.translate(O*T.width,0),$.paths.forEach(L=>{const D=L.clone().applyTransform(q);D.style.strokeWidth&&(D.style.strokeWidth*=N*w),D.style.strokeMiterlimit&&(D.style.strokeMiterlimit*=N),D.style.strokeDashoffset&&(D.style.strokeDashoffset*=N),D.style.strokeDasharray&&(D.style.strokeDasharray=D.style.strokeDasharray.map(Z=>Z*N)),D.style.fill&&D.style.fill in I&&(D.style.fill=I[D.style.fill]),D.style.stroke&&D.style.stroke in I&&(D.style.stroke=I[D.style.stroke]),i.push(D),U!==V&&(S?e[i.length-1]=new H(d.left-d.width*2,d.top,d.width*4,d.height):e[i.length-1]=new H(d.left,d.top-d.height*2,d.width,d.height*4))})}}},renderOrder:-1,render:(s,a)=>{i.forEach((l,h)=>{if(le({ctx:s,path:l,fontSize:a.computedStyle.fontSize,clipRect:e[h]}),a.debug){const c=new Gn([l]).getBoundingBox();c&&s.strokeRect(c.x,c.y,c.width,c.height)}})}}}function ma(i,e){return`<svg width="${i*2}" height="${i*2}" xmlns="http://www.w3.org/2000/svg">
|
|
6
6
|
<circle cx="${i}" cy="${i}" r="${i}" fill="${e}" />
|
|
7
|
-
</svg>`}function rs(){const i=[];return{name:"listStyle",paths:i,update:e=>{i.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,o=r*.45;t.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,d=Vn(c);let p=f,m;if(!Xt(h))m=h;else if(!Xt(u)){const v=r*.38/2;switch(p=p==="cover"?v*2:p,u){case"disc":m=
|
|
7
|
+
</svg>`}function rs(){const i=[];return{name:"listStyle",paths:i,update:e=>{i.length=0;const{paragraphs:t,isVertical:n,fontSize:r}=e,o=r*.45;t.forEach(s=>{const{computedStyle:a}=s,{color:l,listStyleImage:h,listStyleColormap:c,listStyleSize:f,listStyleType:u}=a,d=Vn(c);let p=f,m;if(!Xt(h))m=h;else if(!Xt(u)){const v=r*.38/2;switch(p=p==="cover"?v*2:p,u){case"disc":m=ma(v,String(l));break}}if(!m)return;const y=Kr(m),k=y.getBoundingBox();let P;s.fragments.forEach(v=>{v.characters.forEach(C=>{const{inlineBox:x}=C;if(n?(P==null?void 0:P.inlineBox.left)!==x.left:(P==null?void 0:P.inlineBox.top)!==x.top){P=C;const b=p==="cover"?1:on(p,{total:r,fontSize:r})/r,S=new Pt;if(n){const w=r/k.height*b;S.translate(-k.left,-k.top).rotate(Math.PI/2).scale(w,w).translate(x.left+(x.width-k.height*w)/2,x.top-o)}else{const w=r/k.height*b;S.translate(-k.left,-k.top).scale(w,w).translate(x.left-k.width*w-o,x.top+(x.height-k.height*w)/2)}i.push(...y.paths.map(w=>{const I=w.clone();return I.applyTransform(S),I.style.fill&&I.style.fill in d&&(I.style.fill=d[I.style.fill]),I.style.stroke&&I.style.stroke in d&&(I.style.stroke=d[I.style.stroke]),I}))}})})})}}}const Jt=new A,we=new Pt,te=new Pt;function ss(){return{name:"render",getBoundingBox:i=>{const{characters:e,fontSize:t,effects:n}=i,r=[];return e.forEach(o=>{n==null||n.forEach(s=>{if(!o.glyphBox)return;const a=o.glyphBox.clone(),l=fn(i,s);Jt.set(a.left,a.top),Jt.applyMatrix3(l),a.left=Jt.x,a.top=Jt.y,Jt.set(a.right,a.bottom),Jt.applyMatrix3(l),a.width=Jt.x-a.left,a.height=Jt.y-a.top;const h=(s.shadowOffsetX??0)*t,c=(s.shadowOffsetY??0)*t,f=Math.max(.1,s.textStrokeWidth??0)*t;a.left+=h-f,a.top+=c-f,a.width+=f*2,a.height+=f*2,r.push(a)})}),r.length?H.from(...r):void 0},render:(i,e)=>{const{paragraphs:t,glyphBox:n,effects:r,style:o}=e;function s(a,l){i.fillStyle=a,i.fillRect(l.left,l.top,l.width,l.height)}o!=null&&o.backgroundColor&&s(o.backgroundColor,new H(0,0,i.canvas.width,i.canvas.height)),t.forEach(a=>{var l;(l=a.style)!=null&&l.backgroundColor&&s(a.style.backgroundColor,a.lineBox)}),r?r.forEach(a=>{Nt(a,n,i),i.save();const[l,h,c,f,u,d]=fn(e,a).transpose().elements;i.transform(l,f,h,u,c,d),e.forEachCharacter(p=>{var m;(m=p.parent.style)!=null&&m.backgroundColor&&s(p.parent.style.backgroundColor,p.inlineBox),p.drawTo(i,a)}),i.restore()}):t.forEach(a=>{a.fragments.forEach(l=>{var h;(h=l.style)!=null&&h.backgroundColor&&s(l.computedStyle.backgroundColor,l.inlineBox),l.characters.forEach(c=>{c.drawTo(i)})})}),e.debug&&t.forEach(a=>{i.strokeRect(a.lineBox.x,a.lineBox.y,a.lineBox.width,a.lineBox.height)})}}}function fn(i,e){const{fontSize:t,glyphBox:n}=i,r=(e.translateX??0)*t,o=(e.translateY??0)*t,s=Math.PI*2,a=(e.skewX??0)/360*s,l=(e.skewY??0)/360*s,{left:h,top:c,width:f,height:u}=n,d=h+f/2,p=c+u/2;return we.identity(),te.makeTranslation(r,o),we.multiply(te),te.makeTranslation(d,p),we.multiply(te),te.set(1,Math.tan(a),0,Math.tan(l),1,0,0,0,1),we.multiply(te),te.makeTranslation(-d,-p),we.multiply(te),we.clone()}function is(){const i=[];return{name:"textDecoration",paths:i,update:e=>{i.length=0;const t=[];let n,r;e.forEachCharacter(o=>{const{computedStyle:s,isVertical:a,inlineBox:l,underlinePosition:h,underlineThickness:c,strikeoutPosition:f,strikeoutSize:u}=o,{color:d,textDecoration:p,writingMode:m}=s;if(Xt(p))r=void 0;else{let y=!1;if((r==null?void 0:r.textDecoration)===p&&(r==null?void 0:r.writingMode)===m&&(r==null?void 0:r.color)===d&&(a?n[0].inlineBox.left===l.left:n[0].inlineBox.top===l.top))switch(p){case"underline":n[0].underlinePosition===h&&n[0].underlineThickness===c&&(y=!0);break;case"line-through":n[0].strikeoutPosition===f&&n[0].strikeoutSize===u&&(y=!0);break}y?n.push(o):(n=[],n.push(o),t.push(n)),r=s}}),t.forEach(o=>{const{computedStyle:s,isVertical:a,underlinePosition:l,underlineThickness:h,strikeoutPosition:c,strikeoutSize:f}=o[0],{color:u,textDecoration:d}=s,{left:p,top:m,width:y,height:k}=H.from(...o.map(b=>b.inlineBox));let P=a?p+y:m;const v=a?-1:1;let C=0;switch(d){case"overline":C=h*2;break;case"underline":P+=v*l,C=h*2;break;case"line-through":P+=v*c,C=f*2;break}P-=C;let x;a?x=new Tt([{type:"M",x:P,y:m},{type:"L",x:P,y:m+k},{type:"L",x:P+C,y:m+k},{type:"L",x:P+C,y:m},{type:"Z"}],{fill:u}):x=new Tt([{type:"M",x:p,y:P},{type:"L",x:p+y,y:P},{type:"L",x:p+y,y:P+C},{type:"L",x:p,y:P+C},{type:"Z"}],{fill:u}),i.push(x)})},render:(e,t)=>{const{effects:n,computedStyle:r}=t;n?n.forEach(o=>{e.save();const[s,a,l,h,c,f]=fn(t,o).transpose().elements;e.transform(s,h,a,c,l,f),i.forEach(u=>{le({ctx:e,path:u,fontSize:r.fontSize,...o})}),e.restore()}):i.forEach(o=>{le({ctx:e,path:o,fontSize:r.fontSize})})}}}const Hn=ya();class Zn extends ga{constructor(t={}){super();M(this,"debug");M(this,"content");M(this,"style");M(this,"effects");M(this,"measureDom");M(this,"needsUpdate",!0);M(this,"computedStyle",{...Hn});M(this,"paragraphs",[]);M(this,"lineBox",new H);M(this,"rawGlyphBox",new H);M(this,"glyphBox",new H);M(this,"pathBox",new H);M(this,"boundingBox",new H);M(this,"measurer",new hn);M(this,"plugins",new Map);M(this,"fonts");this.debug=t.debug??!1,this.content=t.content??"",this.style=t.style??{},this.measureDom=t.measureDom,this.effects=t.effects,this.fonts=t.fonts,this.use(rs()).use(is()).use(ns()).use(ss()),this.updateParagraphs()}get fontSize(){return this.computedStyle.fontSize}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(n=>n.characters))}use(t){return this.plugins.set(t.name,t),this}forEachCharacter(t){return this.paragraphs.forEach((n,r)=>{n.fragments.forEach((o,s)=>{o.characters.forEach((a,l)=>{t(a,{paragraphIndex:r,fragmentIndex:s,characterIndex:l})})})}),this}async load(){await Promise.all(Array.from(this.plugins.values()).map(t=>{var n;return(n=t.load)==null?void 0:n.call(t,this)}))}updateParagraphs(){this.computedStyle={...Hn,...this.style};let{content:t,computedStyle:n}=this;const r=[];if(typeof t=="string"){const o=new xe({},n);o.addFragment(t),r.push(o)}else{t=Array.isArray(t)?t:[t];for(const o of t)if(typeof o=="string"){const s=new xe({},n);s.addFragment(o),r.push(s)}else if(Array.isArray(o)){const s=new xe({},n);o.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:l,...h}=a;l!==void 0&&s.addFragment(l,h)}}),r.push(s)}else if("fragments"in o){const{fragments:s,...a}=o,l=new xe(a,n);s.forEach(h=>{const{content:c,...f}=h;c!==void 0&&l.addFragment(c,f)}),r.push(l)}else if("content"in o){const{content:s,...a}=o;if(s!==void 0){const l=new xe(a,n);l.addFragment(s),r.push(l)}}}return this.paragraphs=r,this}measure(t=this.measureDom){const n={paragraphs:this.paragraphs,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this.updateParagraphs();const r=this.measurer.measure(this.paragraphs,this.computedStyle,t);this.paragraphs=r.paragraphs,this.lineBox=r.boundingBox,this.characters.forEach(o=>{o.update(this.fonts)}),this.rawGlyphBox=this.getGlyphBox(),Array.from(this.plugins.values()).sort((o,s)=>(o.updateOrder??0)-(s.updateOrder??0)).forEach(o=>{var s;(s=o.update)==null||s.call(o,this)}),this.glyphBox=this.getGlyphBox(),this.updatePathBox().updateBoundingBox();for(const o in n)r[o]=this[o],this[o]=n[o];return this.emit("measure",{text:this,result:r}),r}getGlyphBox(){const t=A.MAX,n=A.MIN;return this.characters.forEach(r=>{if(!r.getGlyphMinMax(t,n)){const{inlineBox:o}=r,s=new A(o.left,o.top),a=new A(o.left+o.width,o.top+o.height);t.min(s,a),n.max(s,a)}}),new H(t.x,t.y,n.x-t.x,n.y-t.y)}updatePathBox(){return this.pathBox=H.from(this.glyphBox,...Array.from(this.plugins.values()).map(t=>t.getBoundingBox?t.getBoundingBox(this):new Gn(t.paths??[]).getBoundingBox()).filter(Boolean)),this}updateBoundingBox(){const{lineBox:t,rawGlyphBox:n,pathBox:r}=this,o=Math.min(r.left,r.left+t.left-n.left),s=Math.min(r.top,r.top+t.top-n.top),a=Math.max(r.right,r.right+t.right-n.right),l=Math.max(r.bottom,r.bottom+t.bottom-n.bottom);return this.boundingBox=new H(o,s,a-o,l-s),this}requestUpdate(){return this.needsUpdate=!0,this}update(){const t=this.measure();for(const n in t)this[n]=t[n];return this.emit("update",{text:this}),this.needsUpdate=!1,this}render(t){const{view:n,pixelRatio:r=2}=t,o=n.getContext("2d");o&&(this.needsUpdate&&this.update(),Yn(o,r,this.boundingBox),Kn(o,this),Array.from(this.plugins.values()).sort((s,a)=>(s.renderOrder??0)-(a.renderOrder??0)).forEach(s=>{var a;if(s.render)(a=s.render)==null||a.call(s,o,this);else if(s.paths){const l=this.computedStyle;s.paths.forEach(h=>{le({ctx:o,path:h,fontSize:l.fontSize})})}}),this.emit("render",{text:this,view:n,pixelRatio:r}))}}function xa(i,e){const t=new Zn(i);return e?t.load().then(()=>t.measure()):t.measure()}function wa(i,e){const t=new Zn(i);return e?t.load().then(()=>t.render(i)):t.render(i)}R.Character=Jr,R.Fragment=es,R.Measurer=hn,R.Paragraph=xe,R.Text=Zn,R.definePlugin=ca,R.drawPath=le,R.filterEmpty=an,R.getHighlightStyle=cn,R.getTransform2D=fn,R.hexToRgb=Xn,R.highlight=ns,R.isEqualObject=ts,R.isEqualValue=oe,R.isNone=Xt,R.listStyle=rs,R.measureText=xa,R.needsFetch=ln,R.parseColor=ct,R.parseColormap=Vn,R.parseValueNumber=on,R.render=ss,R.renderText=wa,R.setupView=Yn,R.textDecoration=is,R.textDefaultStyle=Hn,R.uploadColor=Nt,R.uploadColors=Kn,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -179,13 +179,13 @@ class Character {
|
|
|
179
179
|
get fontHeight() {
|
|
180
180
|
return this.fontSize * this.computedStyle.lineHeight;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
_getFontSFNT(fonts$1) {
|
|
183
183
|
const fontFamily = this.computedStyle.fontFamily;
|
|
184
184
|
const _fonts = fonts$1 ?? fonts;
|
|
185
185
|
const font = fontFamily ? _fonts.get(fontFamily) : _fonts.fallbackFont;
|
|
186
|
-
return font?.
|
|
186
|
+
return font?.getSFNT();
|
|
187
187
|
}
|
|
188
|
-
updateGlyph(sfnt = this.
|
|
188
|
+
updateGlyph(sfnt = this._getFontSFNT()) {
|
|
189
189
|
if (!sfnt) {
|
|
190
190
|
return this;
|
|
191
191
|
}
|
|
@@ -222,7 +222,7 @@ class Character {
|
|
|
222
222
|
return this;
|
|
223
223
|
}
|
|
224
224
|
update(fonts) {
|
|
225
|
-
const sfnt = this.
|
|
225
|
+
const sfnt = this._getFontSFNT(fonts);
|
|
226
226
|
if (!sfnt) {
|
|
227
227
|
return this;
|
|
228
228
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-text",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "Measure and render text in a way that describes the DOM.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"prepare": "simple-git-hooks"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"modern-font": "^0.
|
|
60
|
+
"modern-font": "^0.4.0",
|
|
61
61
|
"modern-idoc": "^0.1.5",
|
|
62
62
|
"modern-path2d": "^1.2.6"
|
|
63
63
|
},
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"eslint": "^9.17.0",
|
|
70
70
|
"lint-staged": "^15.3.0",
|
|
71
71
|
"simple-git-hooks": "^2.11.1",
|
|
72
|
-
"typescript": "^5.7.
|
|
72
|
+
"typescript": "^5.7.3",
|
|
73
73
|
"unbuild": "^3.2.0",
|
|
74
74
|
"vite": "^6.0.7",
|
|
75
75
|
"vitest": "^2.1.8"
|