modern-text 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -162,10 +162,22 @@ class Character {
162
162
  this.content = content;
163
163
  this.index = index;
164
164
  this.parent = parent;
165
+ // measure dom
165
166
  __publicField$4(this, "boundingBox", new modernPath2d.BoundingBox());
166
167
  __publicField$4(this, "textWidth", 0);
167
168
  __publicField$4(this, "textHeight", 0);
169
+ // font glyph
170
+ __publicField$4(this, "glyphHeight", 0);
171
+ __publicField$4(this, "glyphWidth", 0);
172
+ __publicField$4(this, "underlinePosition", 0);
173
+ __publicField$4(this, "underlineThickness", 0);
174
+ __publicField$4(this, "yStrikeoutPosition", 0);
175
+ __publicField$4(this, "yStrikeoutSize", 0);
176
+ __publicField$4(this, "baseline", 0);
177
+ __publicField$4(this, "centerDiviation", 0);
168
178
  __publicField$4(this, "path", new modernPath2d.Path2D());
179
+ __publicField$4(this, "glyphBox", new modernPath2d.BoundingBox());
180
+ __publicField$4(this, "center", new modernPath2d.Vector2());
169
181
  }
170
182
  get computedStyle() {
171
183
  return this.parent.computedStyle;
@@ -393,7 +405,7 @@ class Character {
393
405
  }
394
406
  getGlyphBoundingBox(withStyle) {
395
407
  const { min, max } = this.getGlyphMinMax(void 0, void 0, withStyle);
396
- return new modernPath2d.BoundingBox(min.x, min.y, max.x - max.x, max.y - max.y);
408
+ return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
397
409
  }
398
410
  drawTo(ctx, config = {}) {
399
411
  drawPath({
@@ -731,6 +743,8 @@ class Measurer extends Feature {
731
743
  const documentFragment = document.createDocumentFragment();
732
744
  const dom = document.createElement("section");
733
745
  Object.assign(dom.style, {
746
+ width: "max-content",
747
+ height: "max-content",
734
748
  ...this._styleToDomStyle(computedStyle),
735
749
  position: "absolute",
736
750
  visibility: "hidden"
@@ -850,15 +864,15 @@ class Measurer extends Feature {
850
864
  const measured = this._measureDom(dom);
851
865
  measured.paragraphs.forEach((p) => {
852
866
  const _p = paragraphs[p.paragraphIndex];
853
- _p.boundingBox.left = p.left;
854
- _p.boundingBox.top = p.top;
867
+ _p.boundingBox.left = p.left - rect.left;
868
+ _p.boundingBox.top = p.top - rect.top;
855
869
  _p.boundingBox.width = p.width;
856
870
  _p.boundingBox.height = p.height;
857
871
  });
858
872
  measured.fragments.forEach((f) => {
859
873
  const _f = paragraphs[f.paragraphIndex].fragments[f.fragmentIndex];
860
- _f.boundingBox.left = f.left;
861
- _f.boundingBox.top = f.top;
874
+ _f.boundingBox.left = f.left - rect.left;
875
+ _f.boundingBox.top = f.top - rect.top;
862
876
  _f.boundingBox.width = f.width;
863
877
  _f.boundingBox.height = f.height;
864
878
  });
@@ -983,8 +997,7 @@ class Renderer2D extends Feature {
983
997
  uploadColors(options) {
984
998
  const { ctx } = options;
985
999
  const { paragraphs, computedStyle: style, renderBoundingBox } = this._text;
986
- const { width, height } = renderBoundingBox;
987
- uploadColor(style, new modernPath2d.BoundingBox(0, 0, width, height), ctx);
1000
+ uploadColor(style, renderBoundingBox, ctx);
988
1001
  paragraphs.forEach((paragraph) => {
989
1002
  uploadColor(paragraph.computedStyle, paragraph.boundingBox, ctx);
990
1003
  paragraph.fragments.forEach((fragment) => {
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -104,7 +104,6 @@ declare class Character {
104
104
  boundingBox: BoundingBox;
105
105
  textWidth: number;
106
106
  textHeight: number;
107
- path: Path2D;
108
107
  glyphHeight: number;
109
108
  glyphWidth: number;
110
109
  underlinePosition: number;
@@ -113,8 +112,9 @@ declare class Character {
113
112
  yStrikeoutSize: number;
114
113
  baseline: number;
115
114
  centerDiviation: number;
115
+ path: Path2D;
116
116
  glyphBox: BoundingBox;
117
- center: VectorLike;
117
+ center: Vector2;
118
118
  get computedStyle(): TextStyle;
119
119
  get isVertical(): boolean;
120
120
  get fontSize(): number;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -104,7 +104,6 @@ declare class Character {
104
104
  boundingBox: BoundingBox;
105
105
  textWidth: number;
106
106
  textHeight: number;
107
- path: Path2D;
108
107
  glyphHeight: number;
109
108
  glyphWidth: number;
110
109
  underlinePosition: number;
@@ -113,8 +112,9 @@ declare class Character {
113
112
  yStrikeoutSize: number;
114
113
  baseline: number;
115
114
  centerDiviation: number;
115
+ path: Path2D;
116
116
  glyphBox: BoundingBox;
117
- center: VectorLike;
117
+ center: Vector2;
118
118
  get computedStyle(): TextStyle;
119
119
  get isVertical(): boolean;
120
120
  get fontSize(): number;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, Vector2, VectorLike, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -104,7 +104,6 @@ declare class Character {
104
104
  boundingBox: BoundingBox;
105
105
  textWidth: number;
106
106
  textHeight: number;
107
- path: Path2D;
108
107
  glyphHeight: number;
109
108
  glyphWidth: number;
110
109
  underlinePosition: number;
@@ -113,8 +112,9 @@ declare class Character {
113
112
  yStrikeoutSize: number;
114
113
  baseline: number;
115
114
  centerDiviation: number;
115
+ path: Path2D;
116
116
  glyphBox: BoundingBox;
117
- center: VectorLike;
117
+ center: Vector2;
118
118
  get computedStyle(): TextStyle;
119
119
  get isVertical(): boolean;
120
120
  get fontSize(): number;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(f,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(f=typeof globalThis<"u"?globalThis:f||self,it(f.modernText={}))})(this,function(f){"use strict";var Yo=Object.defineProperty;var Zo=(f,it,Ct)=>it in f?Yo(f,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):f[it]=Ct;var z=(f,it,Ct)=>Zo(f,typeof it!="symbol"?it+"":it,Ct);function it(s,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:i,y1:o,stops:a}=Yn(t,e.left,e.top,e.width,e.height),h=s.createLinearGradient(r,n,i,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ct(s,t,e){s!=null&&s.color&&(s.color=it(e,s.color,t)),s!=null&&s.backgroundColor&&(s.backgroundColor=it(e,s.backgroundColor,t)),s!=null&&s.textStrokeColor&&(s.textStrokeColor=it(e,s.textStrokeColor,t))}function Yn(s,t,e,r,n){var g;const i=((g=s.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",o=i.split(",")[0],a=o.includes("deg")?o:"0deg",h=i.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),p=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+p,x1:t+r/2+c,y1:e+n/2-p,stops:Array.from(h).map(y=>{let w=y[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(y[3].replace("%",""))/100,color:w}})}}function Ge(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style,o={...i,fill:s.color??i.fill,stroke:s.textStrokeColor??i.stroke,strokeWidth:s.textStrokeWidth?s.textStrokeWidth*r:i.strokeWidth,shadowOffsetX:(s.shadowOffsetX??0)*r,shadowOffsetY:(s.shadowOffsetY??0)*r,shadowBlur:(s.shadowBlur??0)*r,shadowColor:s.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}var ot=Uint8Array,yt=Uint16Array,Re=Int32Array,xe=new ot([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]),_e=new ot([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]),Ve=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pr=function(s,t){for(var e=new yt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Re(e[30]),r=1;r<30;++r)for(var i=e[r];i<e[r+1];++i)n[i]=i-e[r]<<5|r;return{b:e,r:n}},Tr=Pr(xe,2),Or=Tr.b,qe=Tr.r;Or[28]=258,qe[258]=28;for(var Ar=Pr(_e,0),Zn=Ar.b,Dr=Ar.r,We=new yt(32768),B=0;B<32768;++B){var Lt=(B&43690)>>1|(B&21845)<<1;Lt=(Lt&52428)>>2|(Lt&13107)<<2,Lt=(Lt&61680)>>4|(Lt&3855)<<4,We[B]=((Lt&65280)>>8|(Lt&255)<<8)>>1}for(var Pt=function(s,t,e){for(var r=s.length,n=0,i=new yt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new yt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new yt(1<<t);var h=15-t;for(n=0;n<r;++n)if(s[n])for(var l=n<<4|s[n],u=t-s[n],c=o[s[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[We[c]>>h]=l}else for(a=new yt(r),n=0;n<r;++n)s[n]&&(a[n]=We[o[s[n]-1]++]>>15-s[n]);return a},$t=new ot(288),B=0;B<144;++B)$t[B]=8;for(var B=144;B<256;++B)$t[B]=9;for(var B=256;B<280;++B)$t[B]=7;for(var B=280;B<288;++B)$t[B]=8;for(var se=new ot(32),B=0;B<32;++B)se[B]=5;var Kn=Pt($t,9,0),Jn=Pt($t,9,1),ts=Pt(se,5,0),es=Pt(se,5,1),He=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},_t=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},Xe=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Qe=function(s){return(s+7)/8|0},Ir=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},rs=["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"],St=function(s,t,e){var r=new Error(t||rs[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},ns=function(s,t,e,r){var n=s.length,i=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(Dt){var It=e.length;if(Dt>It){var Et=new ot(Math.max(It*2,Dt));Et.set(e),e=Et}},u=t.f||0,c=t.p||0,p=t.b||0,g=t.l,y=t.d,w=t.m,d=t.n,C=n*8;do{if(!g){u=_t(s,c,1);var _=_t(s,c+1,3);if(c+=3,_)if(_==1)g=Jn,y=es,w=9,d=5;else if(_==2){var v=_t(s,c,31)+257,A=_t(s,c+10,15)+4,S=v+_t(s,c+5,31)+1;c+=14;for(var P=new ot(S),L=new ot(19),H=0;H<A;++H)L[Ve[H]]=_t(s,c+H*3,7);c+=A*3;for(var X=He(L),Mt=(1<<X)-1,I=Pt(L,X,1),H=0;H<S;){var N=I[_t(s,c,Mt)];c+=N&15;var M=N>>4;if(M<16)P[H++]=M;else{var R=0,E=0;for(M==16?(E=3+_t(s,c,3),c+=2,R=P[H-1]):M==17?(E=3+_t(s,c,7),c+=3):M==18&&(E=11+_t(s,c,127),c+=7);E--;)P[H++]=R}}var J=P.subarray(0,v),V=P.subarray(v);w=He(J),d=He(V),g=Pt(J,w,1),y=Pt(V,d,1)}else St(1);else{var M=Qe(c)+4,T=s[M-4]|s[M-3]<<8,b=M+T;if(b>n){h&&St(0);break}a&&l(p+T),e.set(s.subarray(M,b),p),t.b=p+=T,t.p=c=b*8,t.f=u;continue}if(c>C){h&&St(0);break}}a&&l(p+131072);for(var xt=(1<<w)-1,j=(1<<d)-1,K=c;;K=c){var R=g[Xe(s,c)&xt],$=R>>4;if(c+=R&15,c>C){h&&St(0);break}if(R||St(2),$<256)e[p++]=$;else if($==256){K=c,g=null;break}else{var k=$-254;if($>264){var H=$-257,D=xe[H];k=_t(s,c,(1<<D)-1)+Or[H],c+=D}var Q=y[Xe(s,c)&j],q=Q>>4;Q||St(3),c+=Q&15;var V=Zn[q];if(q>3){var D=_e[q];V+=Xe(s,c)&(1<<D)-1,c+=D}if(c>C){h&&St(0);break}a&&l(p+131072);var tt=p+k;if(p<V){var Xt=i-V,Qt=Math.min(V,tt);for(Xt+p<0&&St(3);p<Qt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-V]}}t.l=g,t.p=K,t.b=p,t.f=u,g&&(u=1,t.m=w,t.d=y,t.n=d)}while(!u);return p!=e.length&&o?Ir(e,0,p):e.subarray(0,p)},zt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ie=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8,s[r+2]|=e>>16},Ye=function(s,t){for(var e=[],r=0;r<s.length;++r)s[r]&&e.push({s:r,f:s[r]});var n=e.length,i=e.slice();if(!n)return{t:Er,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(b,v){return b.f-v.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var p=i[0].s,r=1;r<n;++r)i[r].s>p&&(p=i[r].s);var g=new yt(p+1),y=Ze(e[u-1],g,0);if(y>t){var r=0,w=0,d=y-t,C=1<<d;for(i.sort(function(v,A){return g[A.s]-g[v.s]||v.f-A.f});r<n;++r){var _=i[r].s;if(g[_]>t)w+=C-(1<<y-g[_]),g[_]=t;else break}for(w>>=d;w>0;){var M=i[r].s;g[M]<t?w-=1<<t-g[M]++-1:++r}for(;r>=0&&w;--r){var T=i[r].s;g[T]==t&&(--g[T],++w)}y=t}return{t:new ot(g),l:y}},Ze=function(s,t,e){return s.s==-1?Math.max(Ze(s.l,t,e+1),Ze(s.r,t,e+1)):t[s.s]=e},Nr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new yt(++t),r=0,n=s[0],i=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(s[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=s[a]}return{c:e.subarray(0,r),n:t}},oe=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},zr=function(s,t,e){var r=e.length,n=Qe(t+2);s[n]=r&255,s[n+1]=r>>8,s[n+2]=s[n]^255,s[n+3]=s[n+1]^255;for(var i=0;i<r;++i)s[n+i+4]=e[i];return(n+4+r)*8},Ur=function(s,t,e,r,n,i,o,a,h,l,u){zt(t,u++,e),++n[256];for(var c=Ye(n,15),p=c.t,g=c.l,y=Ye(i,15),w=y.t,d=y.l,C=Nr(p),_=C.c,M=C.n,T=Nr(w),b=T.c,v=T.n,A=new yt(19),S=0;S<_.length;++S)++A[_[S]&31];for(var S=0;S<b.length;++S)++A[b[S]&31];for(var P=Ye(A,7),L=P.t,H=P.l,X=19;X>4&&!L[Ve[X-1]];--X);var Mt=l+5<<3,I=oe(n,$t)+oe(i,se)+o,N=oe(n,p)+oe(i,w)+o+14+3*X+oe(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&Mt<=I&&Mt<=N)return zr(t,u,s.subarray(h,h+l));var R,E,J,V;if(zt(t,u,1+(N<I)),u+=2,N<I){R=Pt(p,g,0),E=p,J=Pt(w,d,0),V=w;var xt=Pt(L,H,0);zt(t,u,M-257),zt(t,u+5,v-1),zt(t,u+10,X-4),u+=14;for(var S=0;S<X;++S)zt(t,u+3*S,L[Ve[S]]);u+=3*X;for(var j=[_,b],K=0;K<2;++K)for(var $=j[K],S=0;S<$.length;++S){var k=$[S]&31;zt(t,u,xt[k]),u+=L[k],k>15&&(zt(t,u,$[S]>>5&127),u+=$[S]>>12)}}else R=Kn,E=$t,J=ts,V=se;for(var S=0;S<a;++S){var D=r[S];if(D>255){var k=D>>18&31;ie(t,u,R[k+257]),u+=E[k+257],k>7&&(zt(t,u,D>>23&31),u+=xe[k]);var Q=D&31;ie(t,u,J[Q]),u+=V[Q],Q>3&&(ie(t,u,D>>5&8191),u+=_e[Q])}else ie(t,u,R[D]),u+=E[D]}return ie(t,u,R[256]),u+E[256]},ss=new Re([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Er=new ot(0),is=function(s,t,e,r,n,i){var o=i.z||s.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=i.l,u=(i.r||0)&7;if(t){u&&(h[0]=i.r>>3);for(var c=ss[t-1],p=c>>13,g=c&8191,y=(1<<e)-1,w=i.p||new yt(32768),d=i.h||new yt(y+1),C=Math.ceil(e/3),_=2*C,M=function(ne){return(s[ne]^s[ne+1]<<C^s[ne+2]<<_)&y},T=new Re(25e3),b=new yt(288),v=new yt(32),A=0,S=0,P=i.i||0,L=0,H=i.w||0,X=0;P+2<o;++P){var Mt=M(P),I=P&32767,N=d[Mt];if(w[I]=N,d[Mt]=I,H<=P){var R=o-P;if((A>7e3||L>24576)&&(R>423||!l)){u=Ur(s,h,0,T,b,v,S,L,X,P-X,u),L=A=S=0,X=P;for(var E=0;E<286;++E)b[E]=0;for(var E=0;E<30;++E)v[E]=0}var J=2,V=0,xt=g,j=I-N&32767;if(R>2&&Mt==M(P-j))for(var K=Math.min(p,R)-1,$=Math.min(32767,P),k=Math.min(258,R);j<=$&&--xt&&I!=N;){if(s[P+J]==s[P+J-j]){for(var D=0;D<k&&s[P+D]==s[P+D-j];++D);if(D>J){if(J=D,V=j,D>K)break;for(var Q=Math.min(j,D-2),q=0,E=0;E<Q;++E){var tt=P-j+E&32767,Xt=w[tt],Qt=tt-Xt&32767;Qt>q&&(q=Qt,N=tt)}}}I=N,N=w[I],j+=I-N&32767}if(V){T[L++]=268435456|qe[J]<<18|Dr[V];var Dt=qe[J]&31,It=Dr[V]&31;S+=xe[Dt]+_e[It],++b[257+Dt],++v[It],H=P+J,++A}else T[L++]=s[P],++b[s[P]]}}for(P=Math.max(P,H);P<o;++P)T[L++]=s[P],++b[s[P]];u=Ur(s,h,l,T,b,v,S,L,X,P-X,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=d,i.p=w,i.i=P,i.w=H)}else{for(var P=i.w||0;P<o+l;P+=65535){var Et=P+65535;Et>=o&&(h[u/8|0]=l,Et=o),u=zr(h,u+1,s.subarray(P,Et))}i.i=o}return Ir(a,0,r+Qe(u)+n)},Lr=function(){var s=1,t=0;return{p:function(e){for(var r=s,n=t,i=e.length|0,o=0;o!=i;){for(var a=Math.min(o+2655,i);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}s=r,t=n},d:function(){return s%=65521,t%=65521,(s&255)<<24|(s&65280)<<8|(t&255)<<8|t>>8}}},os=function(s,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ot(i.length+s.length);o.set(i),o.set(s,i.length),s=o,n.w=i.length}return is(s,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(s.length)))*1.5):20:12+t.mem,e,r,n)},$r=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},as=function(s,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(s[0]=120,s[1]=r<<6|(t.dictionary&&32),s[1]|=31-(s[0]<<8|s[1])%31,t.dictionary){var n=Lr();n.p(t.dictionary),$r(s,2,n.d())}},ls=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&St(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function hs(s,t){t||(t={});var e=Lr();e.p(s);var r=os(s,t,t.dictionary?6:2,4);return as(r,t),$r(r,r.length-4,e.d()),r}function cs(s,t){return ns(s.subarray(ls(s,t),-4),{i:2},t,t)}var us=typeof TextDecoder<"u"&&new TextDecoder,fs=0;try{us.decode(Er,{stream:!0}),fs=1}catch{}const ps="modern-font";function ae(s,t){if(!s)throw new Error(`[${ps}] ${t}`)}function ds(s){return ArrayBuffer.isView(s)?s.byteOffset>0||s.byteLength<s.buffer.byteLength?s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength):s.buffer:s}function Ft(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Br=Object.defineProperty,gs=(s,t,e)=>t in s?Br(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,at=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Br(t,e,n),n},ys=(s,t,e)=>(gs(s,t+"",e),e);const Se={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(s,t){Object.defineProperty(s.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(ds(t),e,r),this.littleEndian=n,ys(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,i=this[n](e,r);return this.cursor+=Se[t],i}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let i=0,o=r.length;i<o;i++)n+=String.fromCharCode(r[i]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const i=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[i](r,e,n);return this.cursor+=Se[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,i=t.length,o;n<i;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Ft(t);r=n.byteLength;for(let i=0;i<r;++i)this.setUint8(e+i,n.getUint8(i))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var ms=Object.defineProperty,ws=(s,t,e)=>t in s?ms(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vs=(s,t,e)=>(ws(s,t+"",e),e);const jr=new WeakMap;function m(s){const t=typeof s=="object"?s:{type:s},{size:e=1,type:r}=t;return(n,i)=>{if(typeof i!="string")return;let o=jr.get(n);o||(o={columns:[],byteLength:0},jr.set(n,o));const a={...t,name:i,byteLength:e*Se[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+Se[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,i,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class vt{constructor(t,e,r,n){vs(this,"view"),this.view=new rt(t,e,r,n)}}function bs(s){let t="";for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Ce(s){s=bs(s);const t=[];for(let e=0,r=s.length,n;e<r;e++)n=s.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Ms(s){let t="";for(let e=0,r=s.length;e<r;e++)s[e]<127?t+=String.fromCharCode(s[e]):t+=`%${(256+s[e]).toString(16).slice(1)}`;return unescape(t)}function xs(s){let t="";for(let e=0,r=s.length;e<r;e+=2)t+=String.fromCharCode((s[e]<<8)+s[e+1]);return t}class Pe extends vt{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(t){return new FontFace(t,this.view.buffer)}}var kr=Object.defineProperty,_s=(s,t,e)=>t in s?kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ft=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&kr(t,e,n),n},Fr=(s,t,e)=>(_s(s,typeof t!="symbol"?t+"":t,e),e);const ht=class qn extends Pe{constructor(){super(...arguments),Fr(this,"format","EmbeddedOpenType"),Fr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Ce(n.fontFamily||""),o=i.length,a=Ce(n.fontStyle||""),h=a.length,l=Ce(n.version||""),u=l.length,c=Ce(n.fullName||""),p=c.length,g=86+o+4+h+4+u+4+p+2+t.view.byteLength,y=new qn(new ArrayBuffer(g),0,g,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(y.FontPANOSE=w.fontPANOSE,y.Italic=w.fsSelection,y.Weight=w.usWeightClass,y.fsType=w.fsType,y.UnicodeRange=w.ulUnicodeRange,y.CodePageRange=w.ulCodePageRange),y.view.writeUint16(o),y.view.writeBytes(i),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(a),y.view.writeUint16(0),y.view.writeUint16(u),y.view.writeBytes(l),y.view.writeUint16(0),y.view.writeUint16(p),y.view.writeBytes(c),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};ft([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let Ss=ht;var Cs=Object.defineProperty,Te=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Cs(t,e,n),n};class Yt extends vt{constructor(t,e){super(t,e,16)}}Te([m({type:"char",size:4})],Yt.prototype,"tag"),Te([m("uint32")],Yt.prototype,"checkSum"),Te([m("uint32")],Yt.prototype,"offset"),Te([m("uint32")],Yt.prototype,"length");const Ke=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Ps=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"];var Ts=Object.defineProperty,Os=(s,t,e)=>t in s?Ts(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,le=(s,t,e)=>(Os(s,typeof t!="symbol"?t+"":t,e),e);class Je{constructor(t){le(this,"index"),le(this,"name"),le(this,"isComposite",!1),le(this,"components",[]),le(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.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=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},i){const o=1/((i==null?void 0:i.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const g=l[c];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*h}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*h}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*h,x2:t+g.x2*a,y2:e+-g.y2*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="Z"&&u.push({type:"Z"})}return u}}class As extends Je{parse(t,e,r){const n=this,{nominalWidthX:i,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,g,y;const w=[],d=[];let C=0,_=!1,M=!1,T=o,b=0,v=0;function A(I,N){w.push({type:"L",x:I,y:N})}function S(I,N,R,E,J,V){w.push({type:"C",x1:I,y1:N,x2:R,y2:E,x:J,y:V})}function P(I,N){M&&l!==2&&L(),M=!0,w.push({type:"M",x:I,y:N})}function L(){w.push({type:"Z"})}function H(I){w.push(...I)}function X(){d.length%2!==0&&!_&&(T=d.shift()+i),C+=d.length>>1,d.length=0,_=!0}function Mt(I){let N,R,E,J,V,xt,j,K,$,k,D,Q,q=0;for(;q<I.length;){let tt=I[q++];switch(tt){case 1:X();break;case 3:X();break;case 4:d.length>1&&!_&&(T=d.shift()+i,_=!0),v+=d.pop(),P(b,v);break;case 5:for(;d.length>0;)b+=d.shift(),v+=d.shift(),A(b,v);break;case 6:for(;d.length>0&&(b+=d.shift(),A(b,v),d.length!==0);)v+=d.shift(),A(b,v);break;case 7:for(;d.length>0&&(v+=d.shift(),A(b,v),d.length!==0);)b+=d.shift(),A(b,v);break;case 8:for(;d.length>0;)c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);break;case 10:V=d.pop()+h,xt=t.subrs[V],xt&&Mt(xt);break;case 11:return;case 12:switch(tt=I[q],q+=1,tt){case 35:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y+d.shift(),$=j+d.shift(),k=K+d.shift(),D=$+d.shift(),Q=k+d.shift(),b=D+d.shift(),v=Q+d.shift(),d.shift(),S(c,p,g,y,j,K),S($,k,D,Q,b,v);break;case 34:c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y,$=j+d.shift(),k=y,D=$+d.shift(),Q=v,b=D+d.shift(),S(c,p,g,y,j,K),S($,k,D,Q,b,v);break;case 36:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y,$=j+d.shift(),k=y,D=$+d.shift(),Q=k+d.shift(),b=D+d.shift(),S(c,p,g,y,j,K),S($,k,D,Q,b,v);break;case 37:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y+d.shift(),$=j+d.shift(),k=K+d.shift(),D=$+d.shift(),Q=k+d.shift(),Math.abs(D-b)>Math.abs(Q-v)?b=D+d.shift():v=Q+d.shift(),S(c,p,g,y,j,K),S($,k,D,Q,b,v);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Ke[d.pop()],Qt=Ke[d.pop()],Dt=d.pop(),It=d.pop();if(Xt&&Qt){n.isComposite=!0,n.components=[];const Et=t.charset.indexOf(Xt),ne=t.charset.indexOf(Qt);n.components.push({glyphIndex:ne,dx:0,dy:0}),n.components.push({glyphIndex:Et,dx:It,dy:Dt}),H(r.get(ne).pathCommands);const _r=JSON.parse(JSON.stringify(r.get(Et).pathCommands));for(let Sr=0;Sr<_r.length;Sr+=1){const Nt=_r[Sr];Nt.type!=="Z"&&(Nt.x+=It,Nt.y+=Dt),(Nt.type==="Q"||Nt.type==="C")&&(Nt.x1+=It,Nt.y1+=Dt),Nt.type==="C"&&(Nt.x2+=It,Nt.y2+=Dt)}H(_r)}}else d.length>0&&!_&&(T=d.shift()+i,_=!0);M&&l!==2&&(L(),M=!1);break;case 18:X();break;case 19:case 20:X(),q+=C+7>>3;break;case 21:d.length>2&&!_&&(T=d.shift()+i,_=!0),v+=d.pop(),b+=d.pop(),P(b,v);break;case 22:d.length>1&&!_&&(T=d.shift()+i,_=!0),b+=d.pop(),P(b,v);break;case 23:X();break;case 24:for(;d.length>2;)c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);b+=d.shift(),v+=d.shift(),A(b,v);break;case 25:for(;d.length>6;)b+=d.shift(),v+=d.shift(),A(b,v);c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);break;case 26:for(d.length%2&&(b+=d.shift());d.length>0;)c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g,v=y+d.shift(),S(c,p,g,y,b,v);break;case 27:for(d.length%2&&(v+=d.shift());d.length>0;)c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y,S(c,p,g,y,b,v);break;case 28:N=I[q],R=I[q+1],d.push((N<<24|R<<16)>>16),q+=2;break;case 29:V=d.pop()+a,xt=t.gsubrs[V],xt&&Mt(xt);break;case 30:for(;d.length>0&&(c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+(d.length===1?d.shift():0),S(c,p,g,y,b,v),d.length!==0);)c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),v=y+d.shift(),b=g+(d.length===1?d.shift():0),S(c,p,g,y,b,v);break;case 31:for(;d.length>0&&(c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),v=y+d.shift(),b=g+(d.length===1?d.shift():0),S(c,p,g,y,b,v),d.length!==0);)c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+(d.length===1?d.shift():0),S(c,p,g,y,b,v);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(N=I[q],q+=1,d.push((tt-247)*256+N+108)):tt<255?(N=I[q],q+=1,d.push(-(tt-251)*256-N-108)):(N=I[q],R=I[q+1],E=I[q+2],J=I[q+3],q+=4,d.push((N<<24|R<<16|E<<8|J)/65536))}}}Mt(e),this.pathCommands=w,_&&(this.advanceWidth=T)}}var Ds=Object.defineProperty,Is=(s,t,e)=>t in s?Ds(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ns=(s,t,e)=>(Is(s,t+"",e),e);class tr{constructor(t){this._sfnt=t,Ns(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);i&&(r.unicode??(r.unicode=i[0]),r.unicodes??(r.unicodes=i)),this._items[t]=r}return r}}class zs extends tr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new As({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Gr=Object.defineProperty,Us=(s,t,e)=>t in s?Gr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Rr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Gr(t,e,n),n},Oe=(s,t,e)=>(Us(s,typeof t!="symbol"?t+"":t,e),e);class Ae extends vt{constructor(t,e,r,n){super(t,e,r,n),Oe(this,"_offsets"),Oe(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,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let i=0,o=e+1;i<o;i++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}Rr([m("uint16")],Ae.prototype,"count"),Rr([m("uint8")],Ae.prototype,"offsetSize");class De extends Ae{constructor(){super(...arguments),Oe(this,"_isString",!1)}}class Vr extends Ae{constructor(){super(...arguments),Oe(this,"_isString",!0)}}const Es=[".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"],Ls=[".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"],$s=[".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"],Bs=[".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 Ie(s,t){return t<=390?Es[t]:s[t-391]}var js=Object.defineProperty,ks=(s,t,e)=>t in s?js(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,qr=(s,t,e)=>(ks(s,typeof t!="symbol"?t+"":t,e),e);function F(s,t="number",e){return(r,n)=>{if(typeof n!="string")return;const i={type:t,operator:s,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(i)},set(o){this._setProp(i,o)},configurable:!0,enumerable:!0})}}class Wr extends vt{constructor(){super(...arguments),qr(this,"_dict"),qr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const i=t.readUint8(),o=i>>4,a=i&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,i,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),i=e.readUint8(),o=e.readUint8(),r<<24|n<<16|i<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let i=t.readUint8();i<=21?(i===12&&(i=1200+t.readUint8()),n[i]=e,e=[]):e.push(this._readOperand(i))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Ie(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Fs=Object.defineProperty,er=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Fs(t,e,n),n};class Ne extends Wr{}er([F(19)],Ne.prototype,"subrs"),er([F(20)],Ne.prototype,"defaultWidthX"),er([F(21)],Ne.prototype,"nominalWidthX");var Gs=Object.defineProperty,Y=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Gs(t,e,n),n};class W extends Wr{}Y([F(0,"string")],W.prototype,"version"),Y([F(1,"string")],W.prototype,"notice"),Y([F(1200,"string")],W.prototype,"copyright"),Y([F(2,"string")],W.prototype,"fullName"),Y([F(3,"string")],W.prototype,"familyName"),Y([F(4,"string")],W.prototype,"weight"),Y([F(1201)],W.prototype,"isFixedPitch"),Y([F(1202)],W.prototype,"italicAngle"),Y([F(1203,"number",-100)],W.prototype,"underlinePosition"),Y([F(1204,"number",50)],W.prototype,"underlineThickness"),Y([F(1205)],W.prototype,"paintType"),Y([F(1206,"number",2)],W.prototype,"charstringType"),Y([F(1207,"number[]",[.001,0,0,.001,0,0])],W.prototype,"fontMatrix"),Y([F(13)],W.prototype,"uniqueId"),Y([F(5,"number[]",[0,0,0,0])],W.prototype,"fontBBox"),Y([F(1208)],W.prototype,"strokeWidth"),Y([F(14)],W.prototype,"xuid"),Y([F(15)],W.prototype,"charset"),Y([F(16)],W.prototype,"encoding"),Y([F(17)],W.prototype,"charStrings"),Y([F(18,"number[]",[0,0])],W.prototype,"private");var Rs=Object.defineProperty,Vs=(s,t,e)=>t in s?Rs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,rr=(s,t,e)=>(Vs(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{he.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(he.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const Hr=class Me{constructor(t){rr(this,"tables",new Map),rr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.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(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,i=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)i[a]=e.get(r[a])||o;return i}getPathCommands(t,e,r,n,i){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,i,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,i={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];o.call(this,u,e,r,n,i),u.advanceWidth&&(e+=u.advanceWidth*a),i.letterSpacing?e+=i.letterSpacing*n:i.tracking&&(e+=i.tracking/1e3*n)}return e}clone(){return new Me(this.tableViews)}delete(t){const e=Me.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Me.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Me.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const i=this.tableViews.get(t);if(!i)return;r=new n(i.buffer,i.byteOffset,i.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};rr(Hr,"tableDefinitions",new Map);let he=Hr;class ct extends vt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var Xr=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,Ws=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ce=(s,t,e,r)=>{for(var n=r>1?void 0:r?qs(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Xr(t,e,n),n},nr=(s,t,e)=>(Ws(s,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),nr(this,"_glyphs"),nr(this,"privateDict"),nr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new zs(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Vr(e,n),this.topDictIndex=new De(e,this.nameIndex.endOffset),this.stringIndex=new Vr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new De(e,this.stringIndex.endOffset),this.topDict=new W(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const i=this.topDict.private[0],o=this.topDict.private[1];i&&(this.privateDict=new Ne(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new De(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ls:this.topDict.charset===1?this.charset=$s:this.topDict.charset===2?this.charset=Bs:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Ke:this.topDict.encoding===1?this.encoding=Ps:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let i,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(i=0;i<e;i+=1)o=n.readUint16(),h.push(Ie(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),i=0;i<=a;i+=1)h.push(Ie(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),i=0;i<=a;i+=1)h.push(Ie(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const i={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),i[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let u=h;u<=h+l;u+=1)i[u]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return i}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},ce([m("uint8")],f.Cff.prototype,"majorVersion",2),ce([m("uint8")],f.Cff.prototype,"minorVersion",2),ce([m("uint8")],f.Cff.prototype,"headerSize",2),ce([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=ce([nt("CFF ","cff")],f.Cff);var Hs=Object.defineProperty,ze=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Hs(t,e,n),n};const ue=class Wn extends vt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Wn;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};ze([m("uint16")],ue.prototype,"format"),ze([m("uint16")],ue.prototype,"length"),ze([m("uint16")],ue.prototype,"language"),ze([m({type:"uint8",size:256})],ue.prototype,"glyphIndexArray");let sr=ue;var Xs=Object.defineProperty,ir=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Xs(t,e,n),n};class fe extends vt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,i=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<i[0].firstCode||l>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(l-i[0].firstCode)>=o.length?h=0:(h=o[i[0].idRangeOffset+(l-i[0].firstCode)],h!==0&&(h=h+i[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=i[u].entryCount;c<p;c++)if(i[u].idRangeOffset+c>=o.length?h=0:(h=o[i[u].idRangeOffset+c],h!==0&&(h=h+i[u].idDelta)),h!==0&&h<t){const g=(l<<8|c+i[u].firstCode)%65535;e.set(g,h)}}return e}}ir([m("uint16")],fe.prototype,"format"),ir([m("uint16")],fe.prototype,"length"),ir([m("uint16")],fe.prototype,"language");function Qr(s){return s>32767?s-65536:s<-32767?s+65536:s}function or(s,t){let e;const r=[];let n={};return s.forEach((i,o)=>{t&&o>t||((!e||o!==e.unicode+1||i!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:i,delta:Qr(i-o)}):(n.start=Number(o),n.startId=i,n.delta=Qr(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var Qs=Object.defineProperty,Gt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Qs(t,e,n),n};const Bt=class Hn extends vt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=or(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new Hn(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=i,o.entrySelector=n,o.rangeShift=2*r-i,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,i=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=i[l];u<=c;++u)if(o[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+o[l]/2+(u-n[l])-r,g=h[p];g!==0?t.set(u,(g+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Gt([m("uint16")],Bt.prototype,"format"),Gt([m("uint16")],Bt.prototype,"length"),Gt([m("uint16")],Bt.prototype,"language"),Gt([m("uint16")],Bt.prototype,"segCountX2"),Gt([m("uint16")],Bt.prototype,"searchRange"),Gt([m("uint16")],Bt.prototype,"entrySelector"),Gt([m("uint16")],Bt.prototype,"rangeShift");let ar=Bt;var Ys=Object.defineProperty,pe=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ys(t,e,n),n};class Rt extends vt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}pe([m("uint16")],Rt.prototype,"format"),pe([m("uint16")],Rt.prototype,"length"),pe([m("uint16")],Rt.prototype,"language"),pe([m("uint16")],Rt.prototype,"firstCode"),pe([m("uint16")],Rt.prototype,"entryCount");var Zs=Object.defineProperty,de=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Zs(t,e,n),n};const Zt=class Xn extends vt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=or(t),r=new Xn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const i=e[r];let o=i.startGlyphCode,a=i.startCharCode;const h=i.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};de([m("uint16")],Zt.prototype,"format"),de([m("uint16")],Zt.prototype,"reserved"),de([m("uint32")],Zt.prototype,"length"),de([m("uint32")],Zt.prototype,"language"),de([m("uint32")],Zt.prototype,"nGroups");let lr=Zt;var Ks=Object.defineProperty,hr=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Ks(t,e,n),n};class ge extends vt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:i}=e[r];i.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}hr([m("uint16")],ge.prototype,"format"),hr([m("uint32")],ge.prototype,"length"),hr([m("uint32")],ge.prototype,"numVarSelectorRecords");var Yr=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,ti=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,cr=(s,t,e,r)=>{for(var n=r>1?void 0:r?Js(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yr(t,e,n),n},Zr=(s,t,e)=>(ti(s,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),Zr(this,"_unicodeToGlyphIndexMap"),Zr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=ar.from(t),n=sr.from(t),i=e?lr.from(t):void 0,o=4+(i?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},i&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((i==null?void 0:i.view.byteLength)??0)));return u.numberSubtables=l.length,u.view.seek(4),l.forEach(c=>{u.view.writeUint16(c.platformID),u.view.writeUint16(c.platformSpecificID),u.view.writeUint32(c.offset)}),u.view.writeBytes(r.view,o),u.view.writeBytes(n.view,a),i&&u.view.writeBytes(i.view,h),u}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,i=r.length;n<i;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new sr(this.view.buffer,e.offset);break;case 2:n=new fe(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new ar(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Rt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new lr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ge(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,u,c;const t=this.readSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:h.view,n=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:l.view,i=(u=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:u.view,o=(c=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:c.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(i==null?void 0:i.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},cr([m("uint16")],f.Cmap.prototype,"version",2),cr([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=cr([nt("cmap")],f.Cmap);class ei extends Je{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const i=t[n];r.push(i),i.lastPointOfContour&&(e.push(r),r=[])}return ae(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const i=t[n],o={x:e.xScale*i.x+e.scale10*i.y+e.dx,y:e.scale01*i.x+e.yScale*i.y+e.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,i){let o;return(e&n)>0?(o=t.view.readUint8(),e&i||(o=-o),o=r+o):(e&i)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ae(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;ae(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let g,y=0;for(;y<c;)if(g=t.view.readUint8(),p.push(g),y++,g&8&&y<c){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(g),y++}if(ae(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let d;if(c>0){for(let M=0;M<c;M+=1)g=p[M],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(M),w.push(d);let C=0;for(let M=0;M<c;M+=1)g=p[M],d=w[M],d.x=this._parseGlyphCoordinate(t,g,C,2,16),C=d.x;let _=0;for(let M=0;M<c;M+=1)g=p[M],d=w[M],d.y=this._parseGlyphCoordinate(t,g,_,4,32),_=d.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{ae(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let p=l.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=c.x-p.x,g.dy=c.y-p.y,u=this._transformPoints(l.points,g)}this.points=this.points.concat(u)}}const i=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let u=l[l.length-1],c=l[0];u.onCurve?i.push({type:"M",x:u.x,y:u.y}):c.onCurve?i.push({type:"M",x:c.x,y:c.y}):i.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,g=l.length;p<g;++p)if(u=c,c=l[(p+1)%g],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let y=c;c.onCurve||(y={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:y.x,y:y.y})}i.push({type:"Z"})}this.pathCommands=i}}class ri extends tr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new ei({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Kr=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,si=(s,t,e)=>t in s?Kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ii=(s,t,e,r)=>{for(var n=r>1?void 0:r?ni(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Kr(t,e,n),n},oi=(s,t,e)=>(si(s,t+"",e),e);const Kt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ct{constructor(){super(...arguments),oi(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new ri(this._sfnt))}},f.Glyf=ii([nt("glyf")],f.Glyf);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,hi=(s,t,e,r)=>{for(var n=r>1?void 0:r?li(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ai(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=hi([nt("GPOS","gpos")],f.Gpos);var ci=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,Vt=(s,t,e,r)=>{for(var n=r>1?void 0:r?ui(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ci(t,e,n),n};f.Gsub=class extends ct{},Vt([m("uint16")],f.Gsub.prototype,"majorVersion",2),Vt([m("uint16")],f.Gsub.prototype,"minorVersion",2),Vt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Vt([nt("GSUB","gsub")],f.Gsub);var fi=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?pi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&fi(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],f.Head.prototype,"version",2),et([m("fixed")],f.Head.prototype,"fontRevision",2),et([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],f.Head.prototype,"magickNumber",2),et([m("uint16")],f.Head.prototype,"flags",2),et([m("uint16")],f.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],f.Head.prototype,"created",2),et([m({type:"longDateTime"})],f.Head.prototype,"modified",2),et([m("int16")],f.Head.prototype,"xMin",2),et([m("int16")],f.Head.prototype,"yMin",2),et([m("int16")],f.Head.prototype,"xMax",2),et([m("int16")],f.Head.prototype,"yMax",2),et([m("uint16")],f.Head.prototype,"macStyle",2),et([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([m("int16")],f.Head.prototype,"fontDirectionHint",2),et([m("int16")],f.Head.prototype,"indexToLocFormat",2),et([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var di=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?gi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&di(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Hhea.prototype,"version",2),pt([m("int16")],f.Hhea.prototype,"ascent",2),pt([m("int16")],f.Hhea.prototype,"descent",2),pt([m("int16")],f.Hhea.prototype,"lineGap",2),pt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var Jr=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,mi=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wi=(s,t,e,r)=>{for(var n=r>1?void 0:r?yi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Jr(t,e,n),n},vi=(s,t,e)=>(mi(s,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),vi(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((i,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=wi([nt("hmtx")],f.Hmtx);var bi=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,xi=(s,t,e,r)=>{for(var n=r>1?void 0:r?Mi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bi(t,e,n),n};f.Kern=class extends ct{},f.Kern=xi([nt("kern","kern")],f.Kern);var tn=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,Si=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ci=(s,t,e,r)=>{for(var n=r>1?void 0:r?_i(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&tn(t,e,n),n},Pi=(s,t,e)=>(Si(s,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),Pi(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(i=>{e?n.view.writeUint32(i):n.view.writeUint16(i/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Ci([nt("loca")],f.Loca);var Ti=Object.defineProperty,Oi=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?Oi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ti(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],f.Maxp.prototype,"version",2),ut([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],f.Maxp.prototype,"maxPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxContours",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],f.Maxp.prototype,"maxZones",2),ut([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxStorage",2),ut([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var en=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Di=(s,t,e)=>t in s?en(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ue=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ai(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&en(t,e,n),n},Ii=(s,t,e)=>(Di(s,t+"",e),e);const rn={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"},ur={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ni={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},nn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Ii(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.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 r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=ur.Macintosh,i=Ni.Default,o=0;e.some(h=>h.platform===ur.Microsoft&&h.encoding===nn.UCS2&&h.language===1033)&&(n=ur.Microsoft,i=nn.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===i&&l.language===o&&rn[l.nameId]&&(a[rn[l.nameId]]=o===0?Ms(l.name):xs(l.name))}return a}},Ue([m("uint16")],f.Name.prototype,"format",2),Ue([m("uint16")],f.Name.prototype,"count",2),Ue([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Ue([nt("name")],f.Name);var zi=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,O=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ui(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&zi(t,e,n),n};f.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([m("uint16")],f.Os2.prototype,"version",2),O([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([m("uint16")],f.Os2.prototype,"usWeightClass",2),O([m("uint16")],f.Os2.prototype,"usWidthClass",2),O([m("uint16")],f.Os2.prototype,"fsType",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([m("uint16")],f.Os2.prototype,"sFamilyClass",2),O([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([m("uint16")],f.Os2.prototype,"fsSelection",2),O([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([m("int16")],f.Os2.prototype,"sTypoAscender",2),O([m("int16")],f.Os2.prototype,"sTypoDescender",2),O([m("int16")],f.Os2.prototype,"sTypoLineGap",2),O([m("uint16")],f.Os2.prototype,"usWinAscent",2),O([m("uint16")],f.Os2.prototype,"usWinDescent",2),O([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([m("int16")],f.Os2.prototype,"sCapHeight",2),O([m("uint16")],f.Os2.prototype,"usDefaultChar",2),O([m("uint16")],f.Os2.prototype,"usBreakChar",2),O([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([nt("OS/2","os2")],f.Os2);var Ei=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Tt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Li(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ei(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Tt([m("fixed")],f.Post.prototype,"format",2),Tt([m("fixed")],f.Post.prototype,"italicAngle",2),Tt([m("int16")],f.Post.prototype,"underlinePosition",2),Tt([m("int16")],f.Post.prototype,"underlineThickness",2),Tt([m("uint32")],f.Post.prototype,"isFixedPitch",2),Tt([m("uint32")],f.Post.prototype,"minMemType42",2),Tt([m("uint32")],f.Post.prototype,"maxMemType42",2),Tt([m("uint32")],f.Post.prototype,"minMemType1",2),Tt([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=Tt([nt("post")],f.Post);var $i=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var n=r>1?void 0:r?Bi(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&$i(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],f.Vhea.prototype,"version",2),dt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([m("int16")],f.Vhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var sn=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,ki=(s,t,e)=>t in s?sn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fi=(s,t,e,r)=>{for(var n=r>1?void 0:r?ji(t,e):t,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&sn(t,e,n),n},Gi=(s,t,e)=>(ki(s,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Gi(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var i;const t=this._sfnt.maxp.numGlyphs,e=((i=this._sfnt.vhea)==null?void 0:i.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Fi([nt("vmtx")],f.Vmtx);var on=Object.defineProperty,Ri=(s,t,e)=>t in s?on(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ye=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&on(t,e,n),n},Ee=(s,t,e)=>(Ri(s,typeof t!="symbol"?t+"":t,e),e);class st extends Pe{constructor(){super(...arguments),Ee(this,"format","TrueType"),Ee(this,"mimeType","font/ttf"),Ee(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(Ft(t).getUint32(0))}static checksum(t){const e=Ft(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let i=0,o=r/4;i<o;i+=4)i*4<r-4&&(n+=e.getUint32(i*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,p)=>c+e(p.byteLength),0),i=new this(new ArrayBuffer(12+r*16+n));i.scalerType=65536,i.numTables=r;const o=Math.log(2);i.searchRange=Math.floor(Math.log(r)/o)*16,i.entrySelector=Math.floor(i.searchRange/o),i.rangeShift=r*16-i.searchRange;let a=12+r*16,h=0;const l=i.getDirectories();t.tableViews.forEach((c,p)=>{const g=l[h++];g.tag=p,g.checkSum=this.checksum(c),g.offset=a,g.length=c.byteLength,i.view.writeBytes(c,a),a+=e(g.length)});const u=i.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(i.view),i}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Yt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ee(st,"signature",new Set([65536,1953658213,1954115633])),ye([m("uint32")],st.prototype,"scalerType"),ye([m("uint16")],st.prototype,"numTables"),ye([m("uint16")],st.prototype,"searchRange"),ye([m("uint16")],st.prototype,"entrySelector"),ye([m("uint16")],st.prototype,"rangeShift");var Vi=Object.defineProperty,qi=(s,t,e)=>t in s?Vi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(s,t,e)=>(qi(s,typeof t!="symbol"?t+"":t,e),e);class Le extends st{constructor(){super(...arguments),fr(this,"format","OpenType"),fr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}fr(Le,"signature",new Set([1330926671]));var Wi=Object.defineProperty,me=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&Wi(t,e,n),n};class qt extends vt{constructor(t,e){super(t,e,20)}}me([m({type:"char",size:4})],qt.prototype,"tag"),me([m("uint32")],qt.prototype,"offset"),me([m("uint32")],qt.prototype,"compLength"),me([m("uint32")],qt.prototype,"origLength"),me([m("uint32")],qt.prototype,"origChecksum");var an=Object.defineProperty,Hi=(s,t,e)=>t in s?an(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,mt=(s,t,e,r)=>{for(var n=void 0,i=s.length-1,o;i>=0;i--)(o=s[i])&&(n=o(t,e,n)||n);return n&&an(t,e,n),n},$e=(s,t,e)=>(Hi(s,typeof t!="symbol"?t+"":t,e),e);const gt=class Cr extends Pe{constructor(){super(...arguments),$e(this,"format","WOFF"),$e(this,"mimeType","font/woff"),$e(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":Le.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(Ft(t).getUint32(0))}static checkSum(t){const e=Ft(t),r=e.byteLength,n=Math.floor(r/4);let i=0,o=0;for(;o<n;)i+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)i+=e.getUint8(h)<<a*8,h++,a--}return i%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const g=Ft(hs(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:g.byteLength<c.byteLength?g:c,rawView:c})});const i=n.length,o=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new Cr(new ArrayBuffer(44+20*i+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=i,a.totalSfntSize=12+16*i+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const p=u[l++];p.tag=c.tag,p.offset=h,p.compLength=c.view.byteLength,p.origChecksum=Cr.checkSum(c.rawView),p.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new qt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,i=e.compLength,o=e.origLength,a=n+i;return t[r]=i>=o?new DataView(this.view.buffer,n,i):new DataView(cs(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};$e(gt,"signature",new Set([2001684038])),mt([m("uint32")],gt.prototype,"signature"),mt([m("uint32")],gt.prototype,"flavor"),mt([m("uint32")],gt.prototype,"length"),mt([m("uint16")],gt.prototype,"numTables"),mt([m("uint16")],gt.prototype,"reserved"),mt([m("uint32")],gt.prototype,"totalSfntSize"),mt([m("uint16")],gt.prototype,"majorVersion"),mt([m("uint16")],gt.prototype,"minorVersion"),mt([m("uint32")],gt.prototype,"metaOffset"),mt([m("uint32")],gt.prototype,"metaLength"),mt([m("uint32")],gt.prototype,"metaOrigLength"),mt([m("uint32")],gt.prototype,"privOffset"),mt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function ln(s){if(st.is(s))return new st(s);if(Le.is(s))return new Le(s);if(Ut.is(s))return new Ut(s)}var Xi=Object.defineProperty,Qi=(s,t,e)=>t in s?Xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t,e)=>(Qi(s,typeof t!="symbol"?t+"":t,e),e);const hn=class Qn{constructor(){we(this,"fallbackFont"),we(this,"_loading",new Map),we(this,"_loaded",new Map),we(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Qn.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
1
+ (function(f,st){typeof exports=="object"&&typeof module<"u"?st(exports):typeof define=="function"&&define.amd?define(["exports"],st):(f=typeof globalThis<"u"?globalThis:f||self,st(f.modernText={}))})(this,function(f){"use strict";var Yo=Object.defineProperty;var Zo=(f,st,Ct)=>st in f?Yo(f,st,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):f[st]=Ct;var D=(f,st,Ct)=>Zo(f,typeof st!="symbol"?st+"":st,Ct);function st(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:r,y0:n,x1:s,y1:o,stops:a}=Yn(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(r,n,s,o);return a.forEach(l=>h.addColorStop(l.offset,l.color)),h}return t}function Ct(i,t,e){i!=null&&i.color&&(i.color=st(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=st(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=st(e,i.textStrokeColor,t))}function Yn(i,t,e,r,n){var g;const s=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",o=s.split(",")[0],a=o.includes("deg")?o:"0deg",h=s.replace(a,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),u=(Number(a.replace("deg",""))||0)*Math.PI/180,c=r*Math.sin(u),p=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+p,x1:t+r/2+c,y1:e+n/2-p,stops:Array.from(h).map(y=>{let w=y[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(y[3].replace("%",""))/100,color:w}})}}function Ge(i){const{ctx:t,path:e,fontSize:r,clipRect:n}=i;t.save(),t.beginPath();const s=e.style,o={...s,fill:i.color??s.fill,stroke:i.textStrokeColor??s.stroke,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*r:s.strokeWidth,shadowOffsetX:(i.shadowOffsetX??0)*r,shadowOffsetY:(i.shadowOffsetY??0)*r,shadowBlur:(i.shadowBlur??0)*r,shadowColor:i.shadowColor};n&&(t.rect(n.left,n.top,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}var ot=Uint8Array,yt=Uint16Array,Re=Int32Array,xe=new ot([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]),_e=new ot([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]),Ve=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pr=function(i,t){for(var e=new yt(31),r=0;r<31;++r)e[r]=t+=1<<i[r-1];for(var n=new Re(e[30]),r=1;r<30;++r)for(var s=e[r];s<e[r+1];++s)n[s]=s-e[r]<<5|r;return{b:e,r:n}},Tr=Pr(xe,2),Or=Tr.b,We=Tr.r;Or[28]=258,We[258]=28;for(var Ar=Pr(_e,0),Zn=Ar.b,Dr=Ar.r,qe=new yt(32768),B=0;B<32768;++B){var Lt=(B&43690)>>1|(B&21845)<<1;Lt=(Lt&52428)>>2|(Lt&13107)<<2,Lt=(Lt&61680)>>4|(Lt&3855)<<4,qe[B]=((Lt&65280)>>8|(Lt&255)<<8)>>1}for(var Pt=function(i,t,e){for(var r=i.length,n=0,s=new yt(t);n<r;++n)i[n]&&++s[i[n]-1];var o=new yt(t);for(n=1;n<t;++n)o[n]=o[n-1]+s[n-1]<<1;var a;if(e){a=new yt(1<<t);var h=15-t;for(n=0;n<r;++n)if(i[n])for(var l=n<<4|i[n],u=t-i[n],c=o[i[n]-1]++<<u,p=c|(1<<u)-1;c<=p;++c)a[qe[c]>>h]=l}else for(a=new yt(r),n=0;n<r;++n)i[n]&&(a[n]=qe[o[i[n]-1]++]>>15-i[n]);return a},$t=new ot(288),B=0;B<144;++B)$t[B]=8;for(var B=144;B<256;++B)$t[B]=9;for(var B=256;B<280;++B)$t[B]=7;for(var B=280;B<288;++B)$t[B]=8;for(var ie=new ot(32),B=0;B<32;++B)ie[B]=5;var Kn=Pt($t,9,0),Jn=Pt($t,9,1),ti=Pt(ie,5,0),ei=Pt(ie,5,1),He=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},_t=function(i,t,e){var r=t/8|0;return(i[r]|i[r+1]<<8)>>(t&7)&e},Xe=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Qe=function(i){return(i+7)/8|0},Ir=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new ot(i.subarray(t,e))},ri=["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"],St=function(i,t,e){var r=new Error(t||ri[i]);if(r.code=i,Error.captureStackTrace&&Error.captureStackTrace(r,St),!e)throw r;return r},ni=function(i,t,e,r){var n=i.length,s=0;if(!n||t.f&&!t.l)return e||new ot(0);var o=!e,a=o||t.i!=2,h=t.i;o&&(e=new ot(n*3));var l=function(Dt){var It=e.length;if(Dt>It){var Et=new ot(Math.max(It*2,Dt));Et.set(e),e=Et}},u=t.f||0,c=t.p||0,p=t.b||0,g=t.l,y=t.d,w=t.m,d=t.n,C=n*8;do{if(!g){u=_t(i,c,1);var _=_t(i,c+1,3);if(c+=3,_)if(_==1)g=Jn,y=ei,w=9,d=5;else if(_==2){var v=_t(i,c,31)+257,A=_t(i,c+10,15)+4,S=v+_t(i,c+5,31)+1;c+=14;for(var P=new ot(S),L=new ot(19),H=0;H<A;++H)L[Ve[H]]=_t(i,c+H*3,7);c+=A*3;for(var X=He(L),Mt=(1<<X)-1,N=Pt(L,X,1),H=0;H<S;){var z=N[_t(i,c,Mt)];c+=z&15;var M=z>>4;if(M<16)P[H++]=M;else{var R=0,E=0;for(M==16?(E=3+_t(i,c,3),c+=2,R=P[H-1]):M==17?(E=3+_t(i,c,7),c+=3):M==18&&(E=11+_t(i,c,127),c+=7);E--;)P[H++]=R}}var J=P.subarray(0,v),V=P.subarray(v);w=He(J),d=He(V),g=Pt(J,w,1),y=Pt(V,d,1)}else St(1);else{var M=Qe(c)+4,T=i[M-4]|i[M-3]<<8,b=M+T;if(b>n){h&&St(0);break}a&&l(p+T),e.set(i.subarray(M,b),p),t.b=p+=T,t.p=c=b*8,t.f=u;continue}if(c>C){h&&St(0);break}}a&&l(p+131072);for(var xt=(1<<w)-1,j=(1<<d)-1,K=c;;K=c){var R=g[Xe(i,c)&xt],$=R>>4;if(c+=R&15,c>C){h&&St(0);break}if(R||St(2),$<256)e[p++]=$;else if($==256){K=c,g=null;break}else{var k=$-254;if($>264){var H=$-257,I=xe[H];k=_t(i,c,(1<<I)-1)+Or[H],c+=I}var Q=y[Xe(i,c)&j],W=Q>>4;Q||St(3),c+=Q&15;var V=Zn[W];if(W>3){var I=_e[W];V+=Xe(i,c)&(1<<I)-1,c+=I}if(c>C){h&&St(0);break}a&&l(p+131072);var tt=p+k;if(p<V){var Xt=s-V,Qt=Math.min(V,tt);for(Xt+p<0&&St(3);p<Qt;++p)e[p]=r[Xt+p]}for(;p<tt;++p)e[p]=e[p-V]}}t.l=g,t.p=K,t.b=p,t.f=u,g&&(u=1,t.m=w,t.d=y,t.n=d)}while(!u);return p!=e.length&&o?Ir(e,0,p):e.subarray(0,p)},zt=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8},se=function(i,t,e){e<<=t&7;var r=t/8|0;i[r]|=e,i[r+1]|=e>>8,i[r+2]|=e>>16},Ye=function(i,t){for(var e=[],r=0;r<i.length;++r)i[r]&&e.push({s:r,f:i[r]});var n=e.length,s=e.slice();if(!n)return{t:Er,l:0};if(n==1){var o=new ot(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(b,v){return b.f-v.f}),e.push({s:-1,f:25001});var a=e[0],h=e[1],l=0,u=1,c=2;for(e[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=n-1;)a=e[e[l].f<e[c].f?l++:c++],h=e[l!=u&&e[l].f<e[c].f?l++:c++],e[u++]={s:-1,f:a.f+h.f,l:a,r:h};for(var p=s[0].s,r=1;r<n;++r)s[r].s>p&&(p=s[r].s);var g=new yt(p+1),y=Ze(e[u-1],g,0);if(y>t){var r=0,w=0,d=y-t,C=1<<d;for(s.sort(function(v,A){return g[A.s]-g[v.s]||v.f-A.f});r<n;++r){var _=s[r].s;if(g[_]>t)w+=C-(1<<y-g[_]),g[_]=t;else break}for(w>>=d;w>0;){var M=s[r].s;g[M]<t?w-=1<<t-g[M]++-1:++r}for(;r>=0&&w;--r){var T=s[r].s;g[T]==t&&(--g[T],++w)}y=t}return{t:new ot(g),l:y}},Ze=function(i,t,e){return i.s==-1?Math.max(Ze(i.l,t,e+1),Ze(i.r,t,e+1)):t[i.s]=e},Nr=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new yt(++t),r=0,n=i[0],s=1,o=function(h){e[r++]=h},a=1;a<=t;++a)if(i[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=i[a]}return{c:e.subarray(0,r),n:t}},oe=function(i,t){for(var e=0,r=0;r<t.length;++r)e+=i[r]*t[r];return e},zr=function(i,t,e){var r=e.length,n=Qe(t+2);i[n]=r&255,i[n+1]=r>>8,i[n+2]=i[n]^255,i[n+3]=i[n+1]^255;for(var s=0;s<r;++s)i[n+s+4]=e[s];return(n+4+r)*8},Ur=function(i,t,e,r,n,s,o,a,h,l,u){zt(t,u++,e),++n[256];for(var c=Ye(n,15),p=c.t,g=c.l,y=Ye(s,15),w=y.t,d=y.l,C=Nr(p),_=C.c,M=C.n,T=Nr(w),b=T.c,v=T.n,A=new yt(19),S=0;S<_.length;++S)++A[_[S]&31];for(var S=0;S<b.length;++S)++A[b[S]&31];for(var P=Ye(A,7),L=P.t,H=P.l,X=19;X>4&&!L[Ve[X-1]];--X);var Mt=l+5<<3,N=oe(n,$t)+oe(s,ie)+o,z=oe(n,p)+oe(s,w)+o+14+3*X+oe(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&Mt<=N&&Mt<=z)return zr(t,u,i.subarray(h,h+l));var R,E,J,V;if(zt(t,u,1+(z<N)),u+=2,z<N){R=Pt(p,g,0),E=p,J=Pt(w,d,0),V=w;var xt=Pt(L,H,0);zt(t,u,M-257),zt(t,u+5,v-1),zt(t,u+10,X-4),u+=14;for(var S=0;S<X;++S)zt(t,u+3*S,L[Ve[S]]);u+=3*X;for(var j=[_,b],K=0;K<2;++K)for(var $=j[K],S=0;S<$.length;++S){var k=$[S]&31;zt(t,u,xt[k]),u+=L[k],k>15&&(zt(t,u,$[S]>>5&127),u+=$[S]>>12)}}else R=Kn,E=$t,J=ti,V=ie;for(var S=0;S<a;++S){var I=r[S];if(I>255){var k=I>>18&31;se(t,u,R[k+257]),u+=E[k+257],k>7&&(zt(t,u,I>>23&31),u+=xe[k]);var Q=I&31;se(t,u,J[Q]),u+=V[Q],Q>3&&(se(t,u,I>>5&8191),u+=_e[Q])}else se(t,u,R[I]),u+=E[I]}return se(t,u,R[256]),u+E[256]},ii=new Re([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Er=new ot(0),si=function(i,t,e,r,n,s){var o=s.z||i.length,a=new ot(r+o+5*(1+Math.ceil(o/7e3))+n),h=a.subarray(r,a.length-n),l=s.l,u=(s.r||0)&7;if(t){u&&(h[0]=s.r>>3);for(var c=ii[t-1],p=c>>13,g=c&8191,y=(1<<e)-1,w=s.p||new yt(32768),d=s.h||new yt(y+1),C=Math.ceil(e/3),_=2*C,M=function(ne){return(i[ne]^i[ne+1]<<C^i[ne+2]<<_)&y},T=new Re(25e3),b=new yt(288),v=new yt(32),A=0,S=0,P=s.i||0,L=0,H=s.w||0,X=0;P+2<o;++P){var Mt=M(P),N=P&32767,z=d[Mt];if(w[N]=z,d[Mt]=N,H<=P){var R=o-P;if((A>7e3||L>24576)&&(R>423||!l)){u=Ur(i,h,0,T,b,v,S,L,X,P-X,u),L=A=S=0,X=P;for(var E=0;E<286;++E)b[E]=0;for(var E=0;E<30;++E)v[E]=0}var J=2,V=0,xt=g,j=N-z&32767;if(R>2&&Mt==M(P-j))for(var K=Math.min(p,R)-1,$=Math.min(32767,P),k=Math.min(258,R);j<=$&&--xt&&N!=z;){if(i[P+J]==i[P+J-j]){for(var I=0;I<k&&i[P+I]==i[P+I-j];++I);if(I>J){if(J=I,V=j,I>K)break;for(var Q=Math.min(j,I-2),W=0,E=0;E<Q;++E){var tt=P-j+E&32767,Xt=w[tt],Qt=tt-Xt&32767;Qt>W&&(W=Qt,z=tt)}}}N=z,z=w[N],j+=N-z&32767}if(V){T[L++]=268435456|We[J]<<18|Dr[V];var Dt=We[J]&31,It=Dr[V]&31;S+=xe[Dt]+_e[It],++b[257+Dt],++v[It],H=P+J,++A}else T[L++]=i[P],++b[i[P]]}}for(P=Math.max(P,H);P<o;++P)T[L++]=i[P],++b[i[P]];u=Ur(i,h,l,T,b,v,S,L,X,P-X,u),l||(s.r=u&7|h[u/8|0]<<3,u-=7,s.h=d,s.p=w,s.i=P,s.w=H)}else{for(var P=s.w||0;P<o+l;P+=65535){var Et=P+65535;Et>=o&&(h[u/8|0]=l,Et=o),u=zr(h,u+1,i.subarray(P,Et))}s.i=o}return Ir(a,0,r+Qe(u)+n)},Lr=function(){var i=1,t=0;return{p:function(e){for(var r=i,n=t,s=e.length|0,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)n+=r+=e[o];r=(r&65535)+15*(r>>16),n=(n&65535)+15*(n>>16)}i=r,t=n},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},oi=function(i,t,e,r,n){if(!n&&(n={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new ot(s.length+i.length);o.set(s),o.set(i,s.length),i=o,n.w=s.length}return si(i,t.level==null?6:t.level,t.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,r,n)},$r=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},ai=function(i,t){var e=t.level,r=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=r<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var n=Lr();n.p(t.dictionary),$r(i,2,n.d())}},li=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&St(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&St(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function hi(i,t){t||(t={});var e=Lr();e.p(i);var r=oi(i,t,t.dictionary?6:2,4);return ai(r,t),$r(r,r.length-4,e.d()),r}function ci(i,t){return ni(i.subarray(li(i,t),-4),{i:2},t,t)}var ui=typeof TextDecoder<"u"&&new TextDecoder,fi=0;try{ui.decode(Er,{stream:!0}),fi=1}catch{}const pi="modern-font";function ae(i,t){if(!i)throw new Error(`[${pi}] ${t}`)}function di(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function Ft(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var Br=Object.defineProperty,gi=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,at=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Br(t,e,n),n},yi=(i,t,e)=>(gi(i,t+"",e),e);const Se={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function lt(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class rt extends DataView{constructor(t,e,r,n){super(di(t),e,r),this.littleEndian=n,yi(this,"cursor",0)}readColumn(t){if(t.size){const e=Array.from({length:t.size},(r,n)=>this.read(t.type,t.offset+n));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}writeColumn(t,e){t.size?Array.from({length:t.size},(r,n)=>{this.write(t.type,e[n],t.offset+n)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,r=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,r);case"longDateTime":return this.readLongDateTime(e,r)}const n=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[n](e,r);return this.cursor+=Se[t],s}readUint24(t=this.cursor){const[e,r,n]=this.readBytes(t,3);return(e<<16)+(r<<8)+n}readBytes(t,e){e==null&&(e=t,t=this.cursor);const r=[];for(let n=0;n<e;++n)r.push(this.getUint8(t+n));return this.cursor=t+e,r}readString(t,e){const r=this.readBytes(t,e);let n="";for(let s=0,o=r.length;s<o;s++)n+=String.fromCharCode(r[s]);return n}readFixed(t,e){const r=this.readInt32(t,e)/65536;return Math.ceil(r*1e5)/1e5}readLongDateTime(t=this.cursor,e){const r=this.readUint32(t+4,e),n=new Date;return n.setTime(r*1e3+-20775456e5),n}readChar(t){return this.readString(t,1)}write(t,e,r=this.cursor,n=this.littleEndian){switch(t){case"char":return this.writeChar(e,r);case"fixed":return this.writeFixed(e,r);case"longDateTime":return this.writeLongDateTime(e,r)}const s=`set${t.replace(/^\S/,a=>a.toUpperCase())}`,o=this[s](r,e,n);return this.cursor+=Se[t.toLowerCase()],o}writeString(t="",e=this.cursor){const r=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let n=0,s=t.length,o;n<s;++n)o=t.charCodeAt(n)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=r,this}writeChar(t,e){return this.writeString(t,e)}writeFixed(t,e){return this.writeInt32(Math.round(t*65536),e),this}writeLongDateTime(t,e=this.cursor){typeof t>"u"?t=-20775456e5:typeof t.getTime=="function"?t=t.getTime():/^\d+$/.test(t)?t=+t:t=Date.parse(t);const n=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(n,e+4),this}writeBytes(t,e=this.cursor){let r;if(Array.isArray(t)){r=t.length;for(let n=0;n<r;++n)this.setUint8(e+n,t[n])}else{const n=Ft(t);r=n.byteLength;for(let s=0;s<r;++s)this.setUint8(e+s,n.getUint8(s))}return this.cursor=e+r,this}seek(t){return this.cursor=t,this}}at([lt()],rt.prototype,"readInt8"),at([lt()],rt.prototype,"readInt16"),at([lt()],rt.prototype,"readInt32"),at([lt()],rt.prototype,"readUint8"),at([lt()],rt.prototype,"readUint16"),at([lt()],rt.prototype,"readUint32"),at([lt()],rt.prototype,"readFloat32"),at([lt()],rt.prototype,"readFloat64"),at([lt()],rt.prototype,"writeInt8"),at([lt()],rt.prototype,"writeInt16"),at([lt()],rt.prototype,"writeInt32"),at([lt()],rt.prototype,"writeUint8"),at([lt()],rt.prototype,"writeUint16"),at([lt()],rt.prototype,"writeUint32"),at([lt()],rt.prototype,"writeFloat32"),at([lt()],rt.prototype,"writeFloat64");var mi=Object.defineProperty,wi=(i,t,e)=>t in i?mi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,vi=(i,t,e)=>(wi(i,t+"",e),e);const jr=new WeakMap;function m(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:r}=t;return(n,s)=>{if(typeof s!="string")return;let o=jr.get(n);o||(o={columns:[],byteLength:0},jr.set(n,o));const a={...t,name:s,byteLength:e*Se[r],offset:t.offset??o.columns.reduce((h,l)=>h+l.byteLength,0)};o.columns.push(a),o.byteLength=o.columns.reduce((h,l)=>h+Se[l.type]*(l.size??1),0),Object.defineProperty(n.constructor.prototype,s,{get(){return this.view.readColumn(a)},set(h){this.view.writeColumn(a,h)},configurable:!0,enumerable:!0})}}class vt{constructor(t,e,r,n){vi(this,"view"),this.view=new rt(t,e,r,n)}}function bi(i){let t="";for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),n!==0&&(t+=String.fromCharCode(n));return t}function Ce(i){i=bi(i);const t=[];for(let e=0,r=i.length,n;e<r;e++)n=i.charCodeAt(e),t.push(n>>8),t.push(n&255);return t}function Mi(i){let t="";for(let e=0,r=i.length;e<r;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function xi(i){let t="";for(let e=0,r=i.length;e<r;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}class Pe extends vt{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(t){return new FontFace(t,this.view.buffer)}}var kr=Object.defineProperty,_i=(i,t,e)=>t in i?kr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ft=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&kr(t,e,n),n},Fr=(i,t,e)=>(_i(i,typeof t!="symbol"?t+"":t,e),e);const ht=class Wn extends Pe{constructor(){super(...arguments),Fr(this,"format","EmbeddedOpenType"),Fr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,s=Ce(n.fontFamily||""),o=s.length,a=Ce(n.fontStyle||""),h=a.length,l=Ce(n.version||""),u=l.length,c=Ce(n.fullName||""),p=c.length,g=86+o+4+h+4+u+4+p+2+t.view.byteLength,y=new Wn(new ArrayBuffer(g),0,g,!0);y.EOTSize=y.view.byteLength,y.FontDataSize=t.view.byteLength,y.Version=131073,y.Flags=0,y.Charset=1,y.MagicNumber=20556,y.Padding1=0,y.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(y.FontPANOSE=w.fontPANOSE,y.Italic=w.fsSelection,y.Weight=w.usWeightClass,y.fsType=w.fsType,y.UnicodeRange=w.ulUnicodeRange,y.CodePageRange=w.ulCodePageRange),y.view.writeUint16(o),y.view.writeBytes(s),y.view.writeUint16(0),y.view.writeUint16(h),y.view.writeBytes(a),y.view.writeUint16(0),y.view.writeUint16(u),y.view.writeBytes(l),y.view.writeUint16(0),y.view.writeUint16(p),y.view.writeBytes(c),y.view.writeUint16(0),y.view.writeUint16(0),y.view.writeBytes(t.view),y}};ft([m("uint32")],ht.prototype,"EOTSize"),ft([m("uint32")],ht.prototype,"FontDataSize"),ft([m("uint32")],ht.prototype,"Version"),ft([m("uint32")],ht.prototype,"Flags"),ft([m({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([m("uint8")],ht.prototype,"Charset"),ft([m("uint8")],ht.prototype,"Italic"),ft([m("uint32")],ht.prototype,"Weight"),ft([m("uint16")],ht.prototype,"fsType"),ft([m("uint16")],ht.prototype,"MagicNumber"),ft([m({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([m({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([m("uint32")],ht.prototype,"CheckSumAdjustment"),ft([m({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([m("uint16")],ht.prototype,"Padding1");let Si=ht;var Ci=Object.defineProperty,Te=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Ci(t,e,n),n};class Yt extends vt{constructor(t,e){super(t,e,16)}}Te([m({type:"char",size:4})],Yt.prototype,"tag"),Te([m("uint32")],Yt.prototype,"checkSum"),Te([m("uint32")],Yt.prototype,"offset"),Te([m("uint32")],Yt.prototype,"length");const Ke=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],Pi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"];var Ti=Object.defineProperty,Oi=(i,t,e)=>t in i?Ti(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,le=(i,t,e)=>(Oi(i,typeof t!="symbol"?t+"":t,e),e);class Je{constructor(t){le(this,"index"),le(this,"name"),le(this,"isComposite",!1),le(this,"components",[]),le(this,"pathCommands",[]);const e={...t};if(this.index=e.index??0,e.name===".notdef"?e.unicode=void 0:e.name===".null"&&(e.unicode=0),e.unicode===0&&e.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=e.name??null,e.unicode&&(this.unicode=e.unicode),e.unicodes?this.unicodes=e.unicodes:e.unicode&&(this.unicodes=[e.unicode])}getPathCommands(t=0,e=0,r=72,n={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*r,{xScale:a=o,yScale:h=o}=n,l=this.pathCommands,u=[];for(let c=0,p=l.length;c<p;c+=1){const g=l[c];g.type==="M"?u.push({type:"M",x:t+g.x*a,y:e+-g.y*h}):g.type==="L"?u.push({type:"L",x:t+g.x*a,y:e+-g.y*h}):g.type==="Q"?u.push({type:"Q",x1:t+g.x1*a,y1:e+-g.y1*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="C"?u.push({type:"C",x1:t+g.x1*a,y1:e+-g.y1*h,x2:t+g.x2*a,y2:e+-g.y2*h,x:t+g.x*a,y:e+-g.y*h}):g.type==="Z"&&u.push({type:"Z"})}return u}}class Ai extends Je{parse(t,e,r){const n=this,{nominalWidthX:s,defaultWidthX:o,gsubrsBias:a,subrsBias:h}=t,l=t.topDict.paintType,u=this.index;let c,p,g,y;const w=[],d=[];let C=0,_=!1,M=!1,T=o,b=0,v=0;function A(N,z){w.push({type:"L",x:N,y:z})}function S(N,z,R,E,J,V){w.push({type:"C",x1:N,y1:z,x2:R,y2:E,x:J,y:V})}function P(N,z){M&&l!==2&&L(),M=!0,w.push({type:"M",x:N,y:z})}function L(){w.push({type:"Z"})}function H(N){w.push(...N)}function X(){d.length%2!==0&&!_&&(T=d.shift()+s),C+=d.length>>1,d.length=0,_=!0}function Mt(N){let z,R,E,J,V,xt,j,K,$,k,I,Q,W=0;for(;W<N.length;){let tt=N[W++];switch(tt){case 1:X();break;case 3:X();break;case 4:d.length>1&&!_&&(T=d.shift()+s,_=!0),v+=d.pop(),P(b,v);break;case 5:for(;d.length>0;)b+=d.shift(),v+=d.shift(),A(b,v);break;case 6:for(;d.length>0&&(b+=d.shift(),A(b,v),d.length!==0);)v+=d.shift(),A(b,v);break;case 7:for(;d.length>0&&(v+=d.shift(),A(b,v),d.length!==0);)b+=d.shift(),A(b,v);break;case 8:for(;d.length>0;)c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);break;case 10:V=d.pop()+h,xt=t.subrs[V],xt&&Mt(xt);break;case 11:return;case 12:switch(tt=N[W],W+=1,tt){case 35:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y+d.shift(),$=j+d.shift(),k=K+d.shift(),I=$+d.shift(),Q=k+d.shift(),b=I+d.shift(),v=Q+d.shift(),d.shift(),S(c,p,g,y,j,K),S($,k,I,Q,b,v);break;case 34:c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y,$=j+d.shift(),k=y,I=$+d.shift(),Q=v,b=I+d.shift(),S(c,p,g,y,j,K),S($,k,I,Q,b,v);break;case 36:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y,$=j+d.shift(),k=y,I=$+d.shift(),Q=k+d.shift(),b=I+d.shift(),S(c,p,g,y,j,K),S($,k,I,Q,b,v);break;case 37:c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),j=g+d.shift(),K=y+d.shift(),$=j+d.shift(),k=K+d.shift(),I=$+d.shift(),Q=k+d.shift(),Math.abs(I-b)>Math.abs(Q-v)?b=I+d.shift():v=Q+d.shift(),S(c,p,g,y,j,K),S($,k,I,Q,b,v);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),d.length=0}break;case 14:if(d.length>=4){const Xt=Ke[d.pop()],Qt=Ke[d.pop()],Dt=d.pop(),It=d.pop();if(Xt&&Qt){n.isComposite=!0,n.components=[];const Et=t.charset.indexOf(Xt),ne=t.charset.indexOf(Qt);n.components.push({glyphIndex:ne,dx:0,dy:0}),n.components.push({glyphIndex:Et,dx:It,dy:Dt}),H(r.get(ne).pathCommands);const _r=JSON.parse(JSON.stringify(r.get(Et).pathCommands));for(let Sr=0;Sr<_r.length;Sr+=1){const Nt=_r[Sr];Nt.type!=="Z"&&(Nt.x+=It,Nt.y+=Dt),(Nt.type==="Q"||Nt.type==="C")&&(Nt.x1+=It,Nt.y1+=Dt),Nt.type==="C"&&(Nt.x2+=It,Nt.y2+=Dt)}H(_r)}}else d.length>0&&!_&&(T=d.shift()+s,_=!0);M&&l!==2&&(L(),M=!1);break;case 18:X();break;case 19:case 20:X(),W+=C+7>>3;break;case 21:d.length>2&&!_&&(T=d.shift()+s,_=!0),v+=d.pop(),b+=d.pop(),P(b,v);break;case 22:d.length>1&&!_&&(T=d.shift()+s,_=!0),b+=d.pop(),P(b,v);break;case 23:X();break;case 24:for(;d.length>2;)c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);b+=d.shift(),v+=d.shift(),A(b,v);break;case 25:for(;d.length>6;)b+=d.shift(),v+=d.shift(),A(b,v);c=b+d.shift(),p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+d.shift(),S(c,p,g,y,b,v);break;case 26:for(d.length%2&&(b+=d.shift());d.length>0;)c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g,v=y+d.shift(),S(c,p,g,y,b,v);break;case 27:for(d.length%2&&(v+=d.shift());d.length>0;)c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y,S(c,p,g,y,b,v);break;case 28:z=N[W],R=N[W+1],d.push((z<<24|R<<16)>>16),W+=2;break;case 29:V=d.pop()+a,xt=t.gsubrs[V],xt&&Mt(xt);break;case 30:for(;d.length>0&&(c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+(d.length===1?d.shift():0),S(c,p,g,y,b,v),d.length!==0);)c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),v=y+d.shift(),b=g+(d.length===1?d.shift():0),S(c,p,g,y,b,v);break;case 31:for(;d.length>0&&(c=b+d.shift(),p=v,g=c+d.shift(),y=p+d.shift(),v=y+d.shift(),b=g+(d.length===1?d.shift():0),S(c,p,g,y,b,v),d.length!==0);)c=b,p=v+d.shift(),g=c+d.shift(),y=p+d.shift(),b=g+d.shift(),v=y+(d.length===1?d.shift():0),S(c,p,g,y,b,v);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?d.push(tt-139):tt<251?(z=N[W],W+=1,d.push((tt-247)*256+z+108)):tt<255?(z=N[W],W+=1,d.push(-(tt-251)*256-z-108)):(z=N[W],R=N[W+1],E=N[W+2],J=N[W+3],W+=4,d.push((z<<24|R<<16|E<<8|J)/65536))}}}Mt(e),this.pathCommands=w,_&&(this.advanceWidth=T)}}var Di=Object.defineProperty,Ii=(i,t,e)=>t in i?Di(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ni=(i,t,e)=>(Ii(i,t+"",e),e);class tr{constructor(t){this._sfnt=t,Ni(this,"_items",[])}get(t){const e=this._items[t];let r;if(e)r=e;else{r=this._get(t);const n=this._sfnt.hmtx.metrics[t];n&&(r.advanceWidth=r.advanceWidth||n.advanceWidth,r.leftSideBearing=r.leftSideBearing||n.leftSideBearing);const s=this._sfnt.cmap.glyphIndexToUnicodesMap.get(t);s&&(r.unicode??(r.unicode=s[0]),r.unicodes??(r.unicodes=s)),this._items[t]=r}return r}}class zi extends tr{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ai({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Gr=Object.defineProperty,Ui=(i,t,e)=>t in i?Gr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Rr=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Gr(t,e,n),n},Oe=(i,t,e)=>(Ui(i,typeof t!="symbol"?t+"":t,e),e);class Ae extends vt{constructor(t,e,r,n){super(t,e,r,n),Oe(this,"_offsets"),Oe(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,e=this.count,r=this.offsetSize;this.objectOffset=(e+1)*r+2,this.endOffset=t.byteOffset+this.objectOffset+this.offsets[e]}readOffsets(){const t=this.view,e=this.count,r=this.offsetSize;t.seek(3);const n=[];for(let s=0,o=e+1;s<o;s++){const a=this.view;let h=0;for(let l=0;l<r;l++)h<<=8,h+=a.readUint8();n.push(h)}return n}readObjects(){const t=[];for(let e=0,r=this.count;e<r;e++)t.push(this.get(e));return t}get(t){const e=this.offsets,r=this.objectOffset,n=r+e[t],o=r+e[t+1]-n;return this._isString?this.view.readString(n,o):this.view.readBytes(n,o)}}Rr([m("uint16")],Ae.prototype,"count"),Rr([m("uint8")],Ae.prototype,"offsetSize");class De extends Ae{constructor(){super(...arguments),Oe(this,"_isString",!1)}}class Vr extends Ae{constructor(){super(...arguments),Oe(this,"_isString",!0)}}const Ei=[".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"],Li=[".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"],$i=[".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"],Bi=[".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 Ie(i,t){return t<=390?Ei[t]:i[t-391]}var ji=Object.defineProperty,ki=(i,t,e)=>t in i?ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wr=(i,t,e)=>(ki(i,typeof t!="symbol"?t+"":t,e),e);function F(i,t="number",e){return(r,n)=>{if(typeof n!="string")return;const s={type:t,operator:i,default:e??t==="number"?0:void 0};Object.defineProperty(r.constructor.prototype,n,{get(){return this._getProp(s)},set(o){this._setProp(s,o)},configurable:!0,enumerable:!0})}}class qr extends vt{constructor(){super(...arguments),Wr(this,"_dict"),Wr(this,"_stringIndex")}get dict(){return this._dict??(this._dict=this._readDict())}setStringIndex(t){return this._stringIndex=t,this}_readFloatOperand(){const t=this.view;let e="";const r=15,n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];for(;;){const s=t.readUint8(),o=s>>4,a=s&15;if(o===r||(e+=n[o],a===r))break;e+=n[a]}return Number.parseFloat(e)}_readOperand(t){const e=this.view;let r,n,s,o;if(t===28)return r=e.readUint8(),n=e.readUint8(),r<<8|n;if(t===29)return r=e.readUint8(),n=e.readUint8(),s=e.readUint8(),o=e.readUint8(),r<<24|n<<16|s<<8|o;if(t===30)return this._readFloatOperand();if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.readUint8(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.readUint8(),-(t-251)*256-r-108;throw new Error(`invalid b0 ${t}, at: ${e.cursor}`)}_readDict(){const t=this.view;t.seek(0);let e=[];const r=t.cursor+t.byteLength,n={};for(;t.cursor<r;){let s=t.readUint8();s<=21?(s===12&&(s=1200+t.readUint8()),n[s]=e,e=[]):e.push(this._readOperand(s))}return n}_getProp(t){var r;const e=this.dict[t.operator]??t.default;switch(t.type){case"number":return e[0];case"string":return Ie(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Fi=Object.defineProperty,er=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Fi(t,e,n),n};class Ne extends qr{}er([F(19)],Ne.prototype,"subrs"),er([F(20)],Ne.prototype,"defaultWidthX"),er([F(21)],Ne.prototype,"nominalWidthX");var Gi=Object.defineProperty,Y=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Gi(t,e,n),n};class q extends qr{}Y([F(0,"string")],q.prototype,"version"),Y([F(1,"string")],q.prototype,"notice"),Y([F(1200,"string")],q.prototype,"copyright"),Y([F(2,"string")],q.prototype,"fullName"),Y([F(3,"string")],q.prototype,"familyName"),Y([F(4,"string")],q.prototype,"weight"),Y([F(1201)],q.prototype,"isFixedPitch"),Y([F(1202)],q.prototype,"italicAngle"),Y([F(1203,"number",-100)],q.prototype,"underlinePosition"),Y([F(1204,"number",50)],q.prototype,"underlineThickness"),Y([F(1205)],q.prototype,"paintType"),Y([F(1206,"number",2)],q.prototype,"charstringType"),Y([F(1207,"number[]",[.001,0,0,.001,0,0])],q.prototype,"fontMatrix"),Y([F(13)],q.prototype,"uniqueId"),Y([F(5,"number[]",[0,0,0,0])],q.prototype,"fontBBox"),Y([F(1208)],q.prototype,"strokeWidth"),Y([F(14)],q.prototype,"xuid"),Y([F(15)],q.prototype,"charset"),Y([F(16)],q.prototype,"encoding"),Y([F(17)],q.prototype,"charStrings"),Y([F(18,"number[]",[0,0])],q.prototype,"private");var Ri=Object.defineProperty,Vi=(i,t,e)=>t in i?Ri(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,rr=(i,t,e)=>(Vi(i,typeof t!="symbol"?t+"":t,e),e);function nt(i,t=i){return e=>{he.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(he.prototype,t,{get(){return this.get(i)},set(r){return this.set(i,r)},configurable:!0,enumerable:!0})}}const Hr=class Me{constructor(t){rr(this,"tables",new Map),rr(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((r,n)=>{this.tableViews.set(n,new DataView(r.buffer.slice(r.byteOffset,r.byteOffset+r.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(t){let e=this.cmap.unicodeToGlyphIndexMap.get(t.codePointAt(0));if(e===void 0&&!this.hasGlyf){const{encoding:r,charset:n}=this.cff;e=n.indexOf(r[t.codePointAt(0)])}return e??0}charToGlyph(t){return this.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=[];for(const r of t)e.push(this.charToGlyphIndex(r));return e}textToGlyphs(t){const e=this.glyphs,r=this.textToGlyphIndexes(t),n=r.length,s=Array.from({length:n}),o=e.get(0);for(let a=0;a<n;a+=1)s[a]=e.get(r[a])||o;return s}getPathCommands(t,e,r,n,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,r,n,s,this)}getAdvanceWidth(t,e,r){return this.forEachGlyph(t,0,0,e,r,()=>{})}forEachGlyph(t,e=0,r=0,n=72,s={},o){const a=1/this.unitsPerEm*n,h=this.textToGlyphs(t);for(let l=0;l<h.length;l+=1){const u=h[l];o.call(this,u,e,r,n,s),u.advanceWidth&&(e+=u.advanceWidth*a),s.letterSpacing?e+=s.letterSpacing*n:s.tracking&&(e+=s.tracking/1e3*n)}return e}clone(){return new Me(this.tableViews)}delete(t){const e=Me.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=Me.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=Me.tableDefinitions.get(t);if(!e)return;let r=this.tables.get(e.prop);if(!r){const n=e.class;if(n){const s=this.tableViews.get(t);if(!s)return;r=new n(s.buffer,s.byteOffset,s.byteLength).setSfnt(this),this.tables.set(e.prop,r)}}return r}};rr(Hr,"tableDefinitions",new Map);let he=Hr;class ct extends vt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var Xr=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,qi=(i,t,e)=>t in i?Xr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ce=(i,t,e,r)=>{for(var n=r>1?void 0:r?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Xr(t,e,n),n},nr=(i,t,e)=>(qi(i,typeof t!="symbol"?t+"":t,e),e);f.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),nr(this,"_glyphs"),nr(this,"privateDict"),nr(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new zi(this._sfnt))}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}get defaultWidthX(){var t;return((t=this.privateDict)==null?void 0:t.defaultWidthX)??0}get nominalWidthX(){var t;return((t=this.privateDict)==null?void 0:t.nominalWidthX)??0}get subrs(){var t;return((t=this.subrsIndex)==null?void 0:t.objects)??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}_init(){const t=this.view,{buffer:e,byteOffset:r}=t,n=r+4;this.nameIndex=new Vr(e,n),this.topDictIndex=new De(e,this.nameIndex.endOffset),this.stringIndex=new Vr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new De(e,this.stringIndex.endOffset),this.topDict=new q(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);const s=this.topDict.private[0],o=this.topDict.private[1];s&&(this.privateDict=new Ne(e,r+o,s).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new De(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new De(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Li:this.topDict.charset===1?this.charset=$i:this.topDict.charset===2?this.charset=Bi:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Ke:this.topDict.encoding===1?this.encoding=Pi:this.encoding=this._readEncoding(r+this.topDict.encoding)}_readCharset(t,e,r){const n=this.view;n.seek(t);let s,o,a;e-=1;const h=[".notdef"],l=n.readUint8();if(l===0)for(s=0;s<e;s+=1)o=n.readUint16(),h.push(Ie(r,o));else if(l===1)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint8(),s=0;s<=a;s+=1)h.push(Ie(r,o)),o+=1;else if(l===2)for(;h.length<=e;)for(o=n.readUint16(),a=n.readUint16(),s=0;s<=a;s+=1)h.push(Ie(r,o)),o+=1;else throw new Error(`Unknown charset format ${l}`);return h}_readEncoding(t){const e=this.view;e.seek(t);let r,n;const s={},o=e.readUint8();if(o===0){const a=e.readUint8();for(r=0;r<a;r+=1)n=e.readUint8(),s[n]=r}else if(o===1){const a=e.readUint8();for(n=1,r=0;r<a;r+=1){const h=e.readUint8(),l=e.readUint8();for(let u=h;u<=h+l;u+=1)s[u]=n,n+=1}}else console.warn(`unknown encoding format:${o}`);return s}_calcSubroutineBias(t){let e;return t.length<1240?e=107:t.length<33900?e=1131:e=32768,e}},ce([m("uint8")],f.Cff.prototype,"majorVersion",2),ce([m("uint8")],f.Cff.prototype,"minorVersion",2),ce([m("uint8")],f.Cff.prototype,"headerSize",2),ce([m("uint8")],f.Cff.prototype,"offsetSize",2),f.Cff=ce([nt("CFF ","cff")],f.Cff);var Hi=Object.defineProperty,ze=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Hi(t,e,n),n};const ue=class qn extends vt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new qn;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((r,n)=>{n<256&&r<256&&e.view.writeUint8(r,6+n)}),e}getUnicodeToGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,r)=>{t.set(r,e)}),t}};ze([m("uint16")],ue.prototype,"format"),ze([m("uint16")],ue.prototype,"length"),ze([m("uint16")],ue.prototype,"language"),ze([m({type:"uint8",size:256})],ue.prototype,"glyphIndexArray");let ir=ue;var Xi=Object.defineProperty,sr=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Xi(t,e,n),n};class fe extends vt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,r)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-r)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const r=(this.view.byteLength-e)/2;return Array.from({length:r},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(t){const e=new Map,r=this.subHeaderKeys,n=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,a=r.findIndex(l=>l===n);let h=0;for(let l=0;l<256;l++)if(r[l]===0)l>=a||l<s[0].firstCode||l>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(l-s[0].firstCode)>=o.length?h=0:(h=o[s[0].idRangeOffset+(l-s[0].firstCode)],h!==0&&(h=h+s[0].idDelta)),h!==0&&h<t&&e.set(l,h);else{const u=r[l];for(let c=0,p=s[u].entryCount;c<p;c++)if(s[u].idRangeOffset+c>=o.length?h=0:(h=o[s[u].idRangeOffset+c],h!==0&&(h=h+s[u].idDelta)),h!==0&&h<t){const g=(l<<8|c+s[u].firstCode)%65535;e.set(g,h)}}return e}}sr([m("uint16")],fe.prototype,"format"),sr([m("uint16")],fe.prototype,"length"),sr([m("uint16")],fe.prototype,"language");function Qr(i){return i>32767?i-65536:i<-32767?i+65536:i}function or(i,t){let e;const r=[];let n={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(n.end=e.unicode,r.push(n),n={start:o,startId:s,delta:Qr(s-o)}):(n.start=Number(o),n.startId=s,n.delta=Qr(s-o))),e={unicode:o,glyphIndex:s})}),e&&(n.end=e.unicode,r.push(n)),r}var Qi=Object.defineProperty,Gt=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Qi(t,e,n),n};const Bt=class Hn extends vt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(r=>this.view.writeUint16(r))}get idRangeOffsetCursor(){const t=this.segCountX2;return 14+t+2+t*2}get idRangeOffset(){const t=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:t/2},()=>this.view.readUint16())}set idRangeOffset(t){this.view.seek(this.idRangeOffsetCursor),t.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){const t=this.segCountX2;return 14+t+2+t*3}get glyphIndexArray(){const t=this.glyphIndexArrayCursor;this.view.seek(t);const e=(this.view.byteLength-t)/2;return Array.from({length:e},()=>this.view.readUint16())}static from(t){const e=or(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),s=2*2**n,o=new Hn(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=s,o.entrySelector=n,o.rangeShift=2*r-s,o.endCode=[...e.map(a=>a.end),65535],o.reservedPad=0,o.startCode=[...e.map(a=>a.start),65535],o.idDelta=[...e.map(a=>a.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,r=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,n=this.startCode,s=this.endCode,o=this.idRangeOffset,a=this.idDelta,h=this.glyphIndexArray;for(let l=0;l<e;++l)for(let u=n[l],c=s[l];u<=c;++u)if(o[l]===0)t.set(u,(u+a[l])%65536);else{const p=l+o[l]/2+(u-n[l])-r,g=h[p];g!==0?t.set(u,(g+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Gt([m("uint16")],Bt.prototype,"format"),Gt([m("uint16")],Bt.prototype,"length"),Gt([m("uint16")],Bt.prototype,"language"),Gt([m("uint16")],Bt.prototype,"segCountX2"),Gt([m("uint16")],Bt.prototype,"searchRange"),Gt([m("uint16")],Bt.prototype,"entrySelector"),Gt([m("uint16")],Bt.prototype,"rangeShift");let ar=Bt;var Yi=Object.defineProperty,pe=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Yi(t,e,n),n};class Rt extends vt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((r,n)=>{e.set(n,r)}),e}}pe([m("uint16")],Rt.prototype,"format"),pe([m("uint16")],Rt.prototype,"length"),pe([m("uint16")],Rt.prototype,"language"),pe([m("uint16")],Rt.prototype,"firstCode"),pe([m("uint16")],Rt.prototype,"entryCount");var Zi=Object.defineProperty,de=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Zi(t,e,n),n};const Zt=class Xn extends vt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=or(t),r=new Xn(new ArrayBuffer(16+e.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=e.length,e.forEach(n=>{r.view.writeUint32(n.start),r.view.writeUint32(n.end),r.view.writeUint32(n.startId)}),r}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.groups;for(let r=0,n=e.length;r<n;r++){const s=e[r];let o=s.startGlyphCode,a=s.startCharCode;const h=s.endCharCode;for(;a<=h;)t.set(a++,o++)}return t}};de([m("uint16")],Zt.prototype,"format"),de([m("uint16")],Zt.prototype,"reserved"),de([m("uint32")],Zt.prototype,"length"),de([m("uint32")],Zt.prototype,"language"),de([m("uint32")],Zt.prototype,"nGroups");let lr=Zt;var Ki=Object.defineProperty,hr=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&Ki(t,e,n),n};class ge extends vt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const r=this.view.readUint32();e.unicodeValueRanges=Array.from({length:r},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const r=this.view.readUint32();e.uVSMappings=Array.from({length:r},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let r=0,n=e.length;r<n;r++){const{uVSMappings:s}=e[r];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}hr([m("uint16")],ge.prototype,"format"),hr([m("uint32")],ge.prototype,"length"),hr([m("uint32")],ge.prototype,"numVarSelectorRecords");var Yr=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,ts=(i,t,e)=>t in i?Yr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,cr=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ji(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Yr(t,e,n),n},Zr=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);f.Cmap=class extends ct{constructor(){super(...arguments),Zr(this,"_unicodeToGlyphIndexMap"),Zr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=ar.from(t),n=ir.from(t),s=e?lr.from(t):void 0,o=4+(s?32:24),a=o+r.view.byteLength,h=a+n.view.byteLength,l=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:a},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),u=new f.Cmap(new ArrayBuffer(4+8*l.length+r.view.byteLength+n.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return u.numberSubtables=l.length,u.view.seek(4),l.forEach(c=>{u.view.writeUint16(c.platformID),u.view.writeUint16(c.platformSpecificID),u.view.writeUint32(c.offset)}),u.view.writeBytes(r.view,o),u.view.writeBytes(n.view,a),s&&u.view.writeBytes(s.view,h),u}get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??(this._unicodeToGlyphIndexMap=this.readunicodeToGlyphIndexMap())}get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){const t=new Map,e=this.unicodeToGlyphIndexMap,r=Array.from(e.keys());for(let n=0,s=r.length;n<s;n++){const o=r[n],a=e.get(o);t.has(a)?t.get(a).push(o):t.set(a,[o])}this._glyphIndexToUnicodesMap=t}return this._glyphIndexToUnicodesMap}readSubtables(){const t=this.numberSubtables;return this.view.seek(4),Array.from({length:t},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);const r=this.view.readUint16();let n;switch(r){case 0:n=new ir(this.view.buffer,e.offset);break;case 2:n=new fe(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new ar(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new Rt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new lr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ge(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:r,view:n}})}readunicodeToGlyphIndexMap(){var a,h,l,u,c;const t=this.readSubtables(),e=(a=t.find(p=>p.format===0))==null?void 0:a.view,r=(h=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:h.view,n=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:l.view,s=(u=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:u.view,o=(c=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:c.view;return new Map([...(e==null?void 0:e.getUnicodeToGlyphIndexMap())??[],...(r==null?void 0:r.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(n==null?void 0:n.getUnicodeToGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeToGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeToGlyphIndexMap())??[]])}},cr([m("uint16")],f.Cmap.prototype,"version",2),cr([m("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=cr([nt("cmap")],f.Cmap);class es extends Je{_parseContours(t){const e=[];let r=[];for(let n=0;n<t.length;n+=1){const s=t[n];r.push(s),s.lastPointOfContour&&(e.push(r),r=[])}return ae(r.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const r=[];for(let n=0;n<t.length;n+=1){const s=t[n],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};r.push(o)}return r}_parseGlyphCoordinate(t,e,r,n,s){let o;return(e&n)>0?(o=t.view.readUint8(),e&s||(o=-o),o=r+o):(e&s)>0?o=r:o=r+t.view.readInt16(),o}parse(t,e,r){t.view.seek(e);const n=this.numberOfContours=t.view.readInt16();if(this.xMin=t.view.readInt16(),this.yMin=t.view.readInt16(),this.xMax=t.view.readInt16(),this.yMax=t.view.readInt16(),n>0){const a=this.endPointIndices=[];for(let w=0;w<n;w++)a.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();ae(h<5e3,`Bad instructionLength:${h}`);const l=this.instructions=[];for(let w=0;w<h;++w)l.push(t.view.readUint8());const u=t.view.byteOffset,c=a[a.length-1]+1;ae(c<2e4,`Bad numberOfCoordinates:${u}`);const p=[];let g,y=0;for(;y<c;)if(g=t.view.readUint8(),p.push(g),y++,g&8&&y<c){const w=t.view.readUint8();for(let d=0;d<w;d++)p.push(g),y++}if(ae(p.length===c,`Bad flags length: ${p.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let d;if(c>0){for(let M=0;M<c;M+=1)g=p[M],d={},d.onCurve=!!(g&1),d.lastPointOfContour=a.includes(M),w.push(d);let C=0;for(let M=0;M<c;M+=1)g=p[M],d=w[M],d.x=this._parseGlyphCoordinate(t,g,C,2,16),C=d.x;let _=0;for(let M=0;M<c;M+=1)g=p[M],d=w[M],d.y=this._parseGlyphCoordinate(t,g,_,4,32),_=d.y}this.points=w}else this.points=[]}else if(n===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let a,h=!0;for(;h;){a=t.view.readUint16();const l={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(a&1)>0?(a&2)>0?(l.dx=t.view.readInt16(),l.dy=t.view.readInt16()):l.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(a&2)>0?(l.dx=t.view.readInt8(),l.dy=t.view.readInt8()):l.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(a&8)>0?l.xScale=l.yScale=t.view.readInt16()/16384:(a&64)>0?(l.xScale=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384):(a&128)>0&&(l.xScale=t.view.readInt16()/16384,l.scale01=t.view.readInt16()/16384,l.scale10=t.view.readInt16()/16384,l.yScale=t.view.readInt16()/16384),this.components.push(l),h=!!(a&32)}if(a&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let l=0;l<this.instructionLength;l+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let a=0;a<this.components.length;a+=1){const h=this.components[a],l=r.get(h.glyphIndex);if(l.getPathCommands(),l.points){let u;if(h.matchedPoints===void 0)u=this._transformPoints(l.points,h);else{ae(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>l.points.length-1,`Matched points out of range in ${this.name}`);const c=this.points[h.matchedPoints[0]];let p=l.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};p=this._transformPoints([p],g)[0],g.dx=c.x-p.x,g.dy=c.y-p.y,u=this._transformPoints(l.points,g)}this.points=this.points.concat(u)}}const s=[],o=this._parseContours(this.points);for(let a=0,h=o.length;a<h;++a){const l=o[a];let u=l[l.length-1],c=l[0];u.onCurve?s.push({type:"M",x:u.x,y:u.y}):c.onCurve?s.push({type:"M",x:c.x,y:c.y}):s.push({type:"M",x:(u.x+c.x)*.5,y:(u.y+c.y)*.5});for(let p=0,g=l.length;p<g;++p)if(u=c,c=l[(p+1)%g],u.onCurve)s.push({type:"L",x:u.x,y:u.y});else{let y=c;c.onCurve||(y={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),s.push({type:"Q",x1:u.x,y1:u.y,x:y.x,y:y.y})}s.push({type:"Z"})}this.pathCommands=s}}class rs extends tr{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new es({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Kr=Object.defineProperty,ns=Object.getOwnPropertyDescriptor,is=(i,t,e)=>t in i?Kr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ss=(i,t,e,r)=>{for(var n=r>1?void 0:r?ns(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Kr(t,e,n),n},os=(i,t,e)=>(is(i,t+"",e),e);const Kt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends ct{constructor(){super(...arguments),os(this,"_glyphs")}static from(t){const e=t.reduce((n,s)=>n+s.byteLength,0),r=new f.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new rs(this._sfnt))}},f.Glyf=ss([nt("glyf")],f.Glyf);var as=Object.defineProperty,ls=Object.getOwnPropertyDescriptor,hs=(i,t,e,r)=>{for(var n=r>1?void 0:r?ls(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&as(t,e,n),n};f.Gpos=class extends ct{},f.Gpos=hs([nt("GPOS","gpos")],f.Gpos);var cs=Object.defineProperty,us=Object.getOwnPropertyDescriptor,Vt=(i,t,e,r)=>{for(var n=r>1?void 0:r?us(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&cs(t,e,n),n};f.Gsub=class extends ct{},Vt([m("uint16")],f.Gsub.prototype,"majorVersion",2),Vt([m("uint16")],f.Gsub.prototype,"minorVersion",2),Vt([m("uint16")],f.Gsub.prototype,"scriptListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"featureListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"lookupListOffset",2),Vt([m("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Vt([nt("GSUB","gsub")],f.Gsub);var fs=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,et=(i,t,e,r)=>{for(var n=r>1?void 0:r?ps(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&fs(t,e,n),n};f.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([m("fixed")],f.Head.prototype,"version",2),et([m("fixed")],f.Head.prototype,"fontRevision",2),et([m("uint32")],f.Head.prototype,"checkSumAdjustment",2),et([m("uint32")],f.Head.prototype,"magickNumber",2),et([m("uint16")],f.Head.prototype,"flags",2),et([m("uint16")],f.Head.prototype,"unitsPerEm",2),et([m({type:"longDateTime"})],f.Head.prototype,"created",2),et([m({type:"longDateTime"})],f.Head.prototype,"modified",2),et([m("int16")],f.Head.prototype,"xMin",2),et([m("int16")],f.Head.prototype,"yMin",2),et([m("int16")],f.Head.prototype,"xMax",2),et([m("int16")],f.Head.prototype,"yMax",2),et([m("uint16")],f.Head.prototype,"macStyle",2),et([m("uint16")],f.Head.prototype,"lowestRecPPEM",2),et([m("int16")],f.Head.prototype,"fontDirectionHint",2),et([m("int16")],f.Head.prototype,"indexToLocFormat",2),et([m("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=et([nt("head")],f.Head);var ds=Object.defineProperty,gs=Object.getOwnPropertyDescriptor,pt=(i,t,e,r)=>{for(var n=r>1?void 0:r?gs(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&ds(t,e,n),n};f.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([m("fixed")],f.Hhea.prototype,"version",2),pt([m("int16")],f.Hhea.prototype,"ascent",2),pt([m("int16")],f.Hhea.prototype,"descent",2),pt([m("int16")],f.Hhea.prototype,"lineGap",2),pt([m("uint16")],f.Hhea.prototype,"advanceWidthMax",2),pt([m("int16")],f.Hhea.prototype,"minLeftSideBearing",2),pt([m("int16")],f.Hhea.prototype,"minRightSideBearing",2),pt([m("int16")],f.Hhea.prototype,"xMaxExtent",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRise",2),pt([m("int16")],f.Hhea.prototype,"caretSlopeRun",2),pt([m("int16")],f.Hhea.prototype,"caretOffset",2),pt([m({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),pt([m("int16")],f.Hhea.prototype,"metricDataFormat",2),pt([m("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=pt([nt("hhea")],f.Hhea);var Jr=Object.defineProperty,ys=Object.getOwnPropertyDescriptor,ms=(i,t,e)=>t in i?Jr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ws=(i,t,e,r)=>{for(var n=r>1?void 0:r?ys(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Jr(t,e,n),n},vs=(i,t,e)=>(ms(i,t+"",e),e);f.Hmtx=class extends ct{constructor(){super(...arguments),vs(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Hmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceWidth),r.view.writeUint16(n.leftSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let r=0;const n=this.view;return n.seek(0),Array.from({length:t}).map((s,o)=>(o<e&&(r=n.readUint16()),{advanceWidth:r,leftSideBearing:n.readUint16()}))}},f.Hmtx=ws([nt("hmtx")],f.Hmtx);var bs=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,xs=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ms(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&bs(t,e,n),n};f.Kern=class extends ct{},f.Kern=xs([nt("kern","kern")],f.Kern);var tn=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,Ss=(i,t,e)=>t in i?tn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Cs=(i,t,e,r)=>{for(var n=r>1?void 0:r?_s(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&tn(t,e,n),n},Ps=(i,t,e)=>(Ss(i,t+"",e),e);f.Loca=class extends ct{constructor(){super(...arguments),Ps(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new f.Loca(new ArrayBuffer(r));return t.forEach(s=>{e?n.view.writeUint32(s):n.view.writeUint16(s/2)}),n}get locations(){return this._locations??(this._locations=this.readLocations())}readLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat,r=this.view;return r.seek(0),Array.from({length:t}).map(()=>e?r.readUint32():r.readUint16()*2)}},f.Loca=Cs([nt("loca")],f.Loca);var Ts=Object.defineProperty,Os=Object.getOwnPropertyDescriptor,ut=(i,t,e,r)=>{for(var n=r>1?void 0:r?Os(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Ts(t,e,n),n};f.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([m("fixed")],f.Maxp.prototype,"version",2),ut([m("uint16")],f.Maxp.prototype,"numGlyphs",2),ut([m("uint16")],f.Maxp.prototype,"maxPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxContours",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentContours",2),ut([m("uint16")],f.Maxp.prototype,"maxZones",2),ut([m("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),ut([m("uint16")],f.Maxp.prototype,"maxStorage",2),ut([m("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),ut([m("uint16")],f.Maxp.prototype,"maxStackElements",2),ut([m("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentElements",2),ut([m("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=ut([nt("maxp")],f.Maxp);var en=Object.defineProperty,As=Object.getOwnPropertyDescriptor,Ds=(i,t,e)=>t in i?en(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ue=(i,t,e,r)=>{for(var n=r>1?void 0:r?As(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&en(t,e,n),n},Is=(i,t,e)=>(Ds(i,t+"",e),e);const rn={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"},ur={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ns={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},nn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends ct{constructor(){super(...arguments),Is(this,"_names")}get names(){return this._names??(this._names=this.readNames())}readNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.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 r=this.stringOffset;for(let h=0;h<t;++h){const l=e[h];l.name=this.view.readBytes(r+l.offset,l.length)}let n=ur.Macintosh,s=Ns.Default,o=0;e.some(h=>h.platform===ur.Microsoft&&h.encoding===nn.UCS2&&h.language===1033)&&(n=ur.Microsoft,s=nn.UCS2,o=1033);const a={};for(let h=0;h<t;++h){const l=e[h];l.platform===n&&l.encoding===s&&l.language===o&&rn[l.nameId]&&(a[rn[l.nameId]]=o===0?Mi(l.name):xi(l.name))}return a}},Ue([m("uint16")],f.Name.prototype,"format",2),Ue([m("uint16")],f.Name.prototype,"count",2),Ue([m("uint16")],f.Name.prototype,"stringOffset",2),f.Name=Ue([nt("name")],f.Name);var zs=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,O=(i,t,e,r)=>{for(var n=r>1?void 0:r?Us(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&zs(t,e,n),n};f.Os2=class extends ct{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},O([m("uint16")],f.Os2.prototype,"version",2),O([m("int16")],f.Os2.prototype,"xAvgCharWidth",2),O([m("uint16")],f.Os2.prototype,"usWeightClass",2),O([m("uint16")],f.Os2.prototype,"usWidthClass",2),O([m("uint16")],f.Os2.prototype,"fsType",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),O([m("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutSize",2),O([m("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),O([m("uint16")],f.Os2.prototype,"sFamilyClass",2),O([m({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),O([m({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bWeight",2),O([m({type:"uint8"})],f.Os2.prototype,"bProportion",2),O([m({type:"uint8"})],f.Os2.prototype,"bContrast",2),O([m({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),O([m({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),O([m({type:"uint8"})],f.Os2.prototype,"bLetterform",2),O([m({type:"uint8"})],f.Os2.prototype,"bMidline",2),O([m({type:"uint8"})],f.Os2.prototype,"bXHeight",2),O([m({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),O([m({type:"char",size:4})],f.Os2.prototype,"achVendID",2),O([m("uint16")],f.Os2.prototype,"fsSelection",2),O([m("uint16")],f.Os2.prototype,"usFirstCharIndex",2),O([m("uint16")],f.Os2.prototype,"usLastCharIndex",2),O([m("int16")],f.Os2.prototype,"sTypoAscender",2),O([m("int16")],f.Os2.prototype,"sTypoDescender",2),O([m("int16")],f.Os2.prototype,"sTypoLineGap",2),O([m("uint16")],f.Os2.prototype,"usWinAscent",2),O([m("uint16")],f.Os2.prototype,"usWinDescent",2),O([m({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),O([m({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),O([m("int16")],f.Os2.prototype,"sCapHeight",2),O([m("uint16")],f.Os2.prototype,"usDefaultChar",2),O([m("uint16")],f.Os2.prototype,"usBreakChar",2),O([m("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=O([nt("OS/2","os2")],f.Os2);var Es=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,Tt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Ls(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&Es(t,e,n),n};f.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Tt([m("fixed")],f.Post.prototype,"format",2),Tt([m("fixed")],f.Post.prototype,"italicAngle",2),Tt([m("int16")],f.Post.prototype,"underlinePosition",2),Tt([m("int16")],f.Post.prototype,"underlineThickness",2),Tt([m("uint32")],f.Post.prototype,"isFixedPitch",2),Tt([m("uint32")],f.Post.prototype,"minMemType42",2),Tt([m("uint32")],f.Post.prototype,"maxMemType42",2),Tt([m("uint32")],f.Post.prototype,"minMemType1",2),Tt([m("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=Tt([nt("post")],f.Post);var $s=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,dt=(i,t,e,r)=>{for(var n=r>1?void 0:r?Bs(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&$s(t,e,n),n};f.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([m("fixed")],f.Vhea.prototype,"version",2),dt([m("int16")],f.Vhea.prototype,"vertTypoAscender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoDescender",2),dt([m("int16")],f.Vhea.prototype,"vertTypoLineGap",2),dt([m("int16")],f.Vhea.prototype,"advanceHeightMax",2),dt([m("int16")],f.Vhea.prototype,"minTopSideBearing",2),dt([m("int16")],f.Vhea.prototype,"minBottomSideBearing",2),dt([m("int16")],f.Vhea.prototype,"yMaxExtent",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRise",2),dt([m("int16")],f.Vhea.prototype,"caretSlopeRun",2),dt([m("int16")],f.Vhea.prototype,"caretOffset",2),dt([m({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),dt([m("int16")],f.Vhea.prototype,"metricDataFormat",2),dt([m("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=dt([nt("vhea")],f.Vhea);var sn=Object.defineProperty,js=Object.getOwnPropertyDescriptor,ks=(i,t,e)=>t in i?sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Fs=(i,t,e,r)=>{for(var n=r>1?void 0:r?js(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=(r?o(t,e,n):o(n))||n);return r&&n&&sn(t,e,n),n},Gs=(i,t,e)=>(ks(i,t+"",e),e);f.Vmtx=class extends ct{constructor(){super(...arguments),Gs(this,"_metrics")}static from(t){const e=t.length*4,r=new f.Vmtx(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeUint16(n.advanceHeight),r.view.writeInt16(n.topSideBearing)}),r}get metrics(){return this._metrics??(this._metrics=this.readMetrics())}readMetrics(){var s;const t=this._sfnt.maxp.numGlyphs,e=((s=this._sfnt.vhea)==null?void 0:s.numOfLongVerMetrics)??0,r=this.view;r.seek(0);let n=0;return Array.from({length:t}).map((o,a)=>(a<e&&(n=r.readUint16()),{advanceHeight:n,topSideBearing:r.readUint8()}))}},f.Vmtx=Fs([nt("vmtx")],f.Vmtx);var on=Object.defineProperty,Rs=(i,t,e)=>t in i?on(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ye=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&on(t,e,n),n},Ee=(i,t,e)=>(Rs(i,typeof t!="symbol"?t+"":t,e),e);class it extends Pe{constructor(){super(...arguments),Ee(this,"format","TrueType"),Ee(this,"mimeType","font/ttf"),Ee(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(Ft(t).getUint32(0))}static checksum(t){const e=Ft(t);let r=e.byteLength;for(;r%4;)r++;let n=0;for(let s=0,o=r/4;s<o;s+=4)s*4<r-4&&(n+=e.getUint32(s*4,!1));return n&4294967295}static from(t){const e=c=>c+3&-4,r=t.tableViews.size,n=t.tableViews.values().reduce((c,p)=>c+e(p.byteLength),0),s=new this(new ArrayBuffer(12+r*16+n));s.scalerType=65536,s.numTables=r;const o=Math.log(2);s.searchRange=Math.floor(Math.log(r)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=r*16-s.searchRange;let a=12+r*16,h=0;const l=s.getDirectories();t.tableViews.forEach((c,p)=>{const g=l[h++];g.tag=p,g.checkSum=this.checksum(c),g.offset=a,g.length=c.byteLength,s.view.writeBytes(c,a),a+=e(g.length)});const u=s.createSfnt().head;return u.checkSumAdjustment=0,u.checkSumAdjustment=2981146554-this.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Yt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}Ee(it,"signature",new Set([65536,1953658213,1954115633])),ye([m("uint32")],it.prototype,"scalerType"),ye([m("uint16")],it.prototype,"numTables"),ye([m("uint16")],it.prototype,"searchRange"),ye([m("uint16")],it.prototype,"entrySelector"),ye([m("uint16")],it.prototype,"rangeShift");var Vs=Object.defineProperty,Ws=(i,t,e)=>t in i?Vs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fr=(i,t,e)=>(Ws(i,typeof t!="symbol"?t+"":t,e),e);class Le extends it{constructor(){super(...arguments),fr(this,"format","OpenType"),fr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}fr(Le,"signature",new Set([1330926671]));var qs=Object.defineProperty,me=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&qs(t,e,n),n};class Wt extends vt{constructor(t,e){super(t,e,20)}}me([m({type:"char",size:4})],Wt.prototype,"tag"),me([m("uint32")],Wt.prototype,"offset"),me([m("uint32")],Wt.prototype,"compLength"),me([m("uint32")],Wt.prototype,"origLength"),me([m("uint32")],Wt.prototype,"origChecksum");var an=Object.defineProperty,Hs=(i,t,e)=>t in i?an(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mt=(i,t,e,r)=>{for(var n=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(n=o(t,e,n)||n);return n&&an(t,e,n),n},$e=(i,t,e)=>(Hs(i,typeof t!="symbol"?t+"":t,e),e);const gt=class Cr extends Pe{constructor(){super(...arguments),$e(this,"format","WOFF"),$e(this,"mimeType","font/woff"),$e(this,"_sfnt")}get subfontFormat(){return it.is(this.flavor)?"TrueType":Le.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(Ft(t).getUint32(0))}static checkSum(t){const e=Ft(t),r=e.byteLength,n=Math.floor(r/4);let s=0,o=0;for(;o<n;)s+=e.getUint32(4*o++,!1);let a=r-n*4;if(a){let h=n*4;for(;a>0;)s+=e.getUint8(h)<<a*8,h++,a--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const r=c=>c+3&-4,n=[];t.tableViews.forEach((c,p)=>{const g=Ft(hi(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:p,view:g.byteLength<c.byteLength?g:c,rawView:c})});const s=n.length,o=n.reduce((c,p)=>c+r(p.view.byteLength),0),a=new Cr(new ArrayBuffer(44+20*s+o+e.byteLength));a.signature=2001684038,a.flavor=65536,a.length=a.view.byteLength,a.numTables=s,a.totalSfntSize=12+16*s+n.reduce((c,p)=>c+r(p.rawView.byteLength),0);let h=44+s*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const p=u[l++];p.tag=c.tag,p.offset=h,p.compLength=c.view.byteLength,p.origChecksum=Cr.checkSum(c.rawView),p.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(p.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Wt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new he(this.getDirectories().reduce((t,e)=>{const r=e.tag,n=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,a=n+s;return t[r]=s>=o?new DataView(this.view.buffer,n,s):new DataView(ci(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};$e(gt,"signature",new Set([2001684038])),mt([m("uint32")],gt.prototype,"signature"),mt([m("uint32")],gt.prototype,"flavor"),mt([m("uint32")],gt.prototype,"length"),mt([m("uint16")],gt.prototype,"numTables"),mt([m("uint16")],gt.prototype,"reserved"),mt([m("uint32")],gt.prototype,"totalSfntSize"),mt([m("uint16")],gt.prototype,"majorVersion"),mt([m("uint16")],gt.prototype,"minorVersion"),mt([m("uint32")],gt.prototype,"metaOffset"),mt([m("uint32")],gt.prototype,"metaLength"),mt([m("uint32")],gt.prototype,"metaOrigLength"),mt([m("uint32")],gt.prototype,"privOffset"),mt([m("uint32")],gt.prototype,"privLength");let Ut=gt;function ln(i){if(it.is(i))return new it(i);if(Le.is(i))return new Le(i);if(Ut.is(i))return new Ut(i)}var Xs=Object.defineProperty,Qs=(i,t,e)=>t in i?Xs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,we=(i,t,e)=>(Qs(i,typeof t!="symbol"?t+"":t,e),e);const hn=class Qn{constructor(){we(this,"fallbackFont"),we(this,"_loading",new Map),we(this,"_loaded",new Map),we(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Qn.defaultRequestInit,...e,signal:r.signal}).then(n=>n.arrayBuffer()),cancel:()=>r.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const r=document.createElement("style");return r.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:i=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(u=>u.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((u,c)=>{u!==l&&(u.cancel(),this._loading.delete(c))}),l.when.then(u=>{const c={...t,font:ln(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,h),typeof document<"u"&&(n&&this.injectFontFace(p,u),i&&this.injectStyleTag(p,h))})),c}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw u}).finally(()=>{this._loading.delete(h)})}};we(hn,"defaultRequestInit",{cache:"force-cache"});let cn=hn;const un=new cn;function fn(s,t){const{cmap:e,loca:r,hmtx:n,vmtx:i,glyf:o}=s,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=i==null?void 0:i.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;c.forEach(w=>{const d=a.get(w)??0;let C=p.get(d);C||p.set(d,C=new Set),C.add(w)});const g=[],y=w=>{const d=l[w],C=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],M=h[w+1]??_,T={...d,...C,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,M-_)};return g.push(T),T};return y(0),c.forEach(w=>y(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let _=10,M;do{M=d.getUint16(_);const T=_+2,b=d.getUint16(T);_+=4,Kt.ARG_1_AND_2_ARE_WORDS&M?_+=4:_+=2,Kt.WE_HAVE_A_SCALE&M?_+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&M?_+=4:Kt.WE_HAVE_A_TWO_BY_TWO&M&&(_+=8);const v=y(b);d.setUint16(T,v.glyphIndex)}while(Kt.MORE_COMPONENTS&M)}),g}function pn(s,t){const e=fn(s,t),r=e.length,{head:n,maxp:i,hhea:o,vhea:a}=s;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,i.numGlyphs=r;let h=0;s.loca=f.Loca.from([...e.map(p=>{const g=h;return h+=p.view.byteLength,g}),h],n.indexToLocFormat);const l=e.reduce((p,g,y)=>(g.unicodes.forEach(w=>p.set(w,y)),p),new Map);s.cmap=f.Cmap.from(l),s.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=r,s.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const c=new f.Post;return c.format=3,c.italicAngle=0,c.underlinePosition=0,c.underlineThickness=0,c.isFixedPitch=0,c.minMemType42=0,c.minMemType42=0,c.minMemType1=0,c.maxMemType1=r,s.post=c,s.delete("GPOS"),s.delete("GSUB"),s.delete("hdmx"),s}function Yi(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Ut)e=s.sfnt.clone(),r="woff";else{const i=Ft(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Ut.is(i))e=new Ut(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=pn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const Zi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ki(s,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:i="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=Zi[o],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=p,s.shadowColor=g}class x{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new x(1/0,1/0)}static get MIN(){return new x(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new x(this.x,this.y)}}class G{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new G;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,i)=>(n.left=Math.min(n.left,i.left),n.top=Math.min(n.top,i.top),n.right=Math.max(n.right,i.right),n.bottom=Math.max(n.bottom,i.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new G(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new x((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new G(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Ji=Object.defineProperty,to=(s,t,e)=>t in s?Ji(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,eo=(s,t,e)=>(to(s,t+"",e),e);class wt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){eo(this,"elements",[]),this.set(t,e,r,n,i,o,a,h,l)}set(t,e,r,n,i,o,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=i,u[5]=h,u[6]=r,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,i=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],g=r[5],y=r[8],w=n[0],d=n[3],C=n[6],_=n[1],M=n[4],T=n[7],b=n[2],v=n[5],A=n[8];return i[0]=o*w+a*_+h*b,i[3]=o*d+a*M+h*v,i[6]=o*C+a*T+h*A,i[1]=l*w+u*_+c*b,i[4]=l*d+u*M+c*v,i[7]=l*C+u*T+c*A,i[2]=p*w+g*_+y*b,i[5]=p*d+g*M+y*v,i[8]=p*C+g*T+y*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*o-a*l,p=a*h-u*i,g=l*i-o*h,y=e*c+r*p+n*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=p*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=g*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*i)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(pr.makeScale(t,e)),this}rotate(t){return this.premultiply(pr.makeRotation(-t)),this}translate(t,e){return this.premultiply(pr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const pr=new wt;function dn(s,t,e,r){const n=s*e+t*r,i=Math.sqrt(s*s+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/i)));return s*r-t*e<0&&(o=-o),o}function ro(s,t,e,r,n,i,o,a){if(t===0||e===0){s.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let p=t*t,g=e*e;const y=u*u,w=c*c,d=y/p+w/g;if(d>1){const L=Math.sqrt(d);t=L*t,e=L*e,p=t*t,g=e*e}const C=p*w+g*y,_=(p*g-C)/C;let M=Math.sqrt(Math.max(0,_));n===i&&(M=-M);const T=M*t*c/e,b=-M*e*u/t,v=Math.cos(r)*T-Math.sin(r)*b+(o.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*b+(o.y+a.y)/2,S=dn(1,0,(u-T)/t,(c-b)/e),P=dn((u-T)/t,(c-b)/e,(-u-T)/t,(-c-b)/e)%(Math.PI*2);s.ellipse(v,A,t,e,r,S,S+P,i===1)}function Jt(s,t){return s-(t-s)}function gn(s,t){const e=new x,r=new x;for(let n=0,i=s.length;n<i;n++){const o=s[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Jt(e.x,r.x),Jt(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Jt(e.x,r.x),Jt(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Jt(e.x,r.x),h=Jt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),ro(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ot(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(d,C,_){const M=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw M.partial=_,M}function g(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let y;const w=s.length;for(let d=0;d<w;d++){if(y=s[d],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(y)){a=1,l=y,g();continue}if(a===0){if(Z.WHITESPACE.test(y))continue;if(Z.DIGIT.test(y)||Z.SIGN.test(y)){a=1,l=y;continue}if(Z.POINT.test(y)){a=2,l=y;continue}Z.COMMA.test(y)&&(h&&p(y,d,c),h=!0)}if(a===1){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.POINT.test(y)){l+=y,a=2;continue}if(Z.EXP.test(y)){a=3;continue}Z.SIGN.test(y)&&l.length===1&&Z.SIGN.test(l[0])&&p(y,d,c)}if(a===2){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.EXP.test(y)){a=3;continue}Z.POINT.test(y)&&l[l.length-1]==="."&&p(y,d,c)}if(a===3){if(Z.DIGIT.test(y)){u+=y;continue}if(Z.SIGN.test(y)){if(u===""){u+=y;continue}u.length===1&&Z.SIGN.test(u)&&p(y,d,c)}}Z.WHITESPACE.test(y)?(g(),a=0,h=!1):Z.COMMA.test(y)?(g(),a=0,h=!0):Z.SIGN.test(y)?(g(),a=1,l=y):Z.POINT.test(y)?(g(),a=2,l=y):p(y,d,c)}return g(),c}function no(s){switch(s.type){case"m":case"M":return`${s.type} ${s.x} ${s.y}`;case"h":case"H":return`${s.type} ${s.x}`;case"v":case"V":return`${s.type} ${s.y}`;case"l":case"L":return`${s.type} ${s.x} ${s.y}`;case"c":case"C":return`${s.type} ${s.x1} ${s.y1} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"s":case"S":return`${s.type} ${s.x2} ${s.y2} ${s.x} ${s.y}`;case"q":case"Q":return`${s.type} ${s.x1} ${s.y1} ${s.x} ${s.y}`;case"t":case"T":return`${s.type} ${s.x} ${s.y}`;case"a":case"A":return`${s.type} ${s.rx} ${s.ry} ${s.angle} ${s.largeArcFlag} ${s.sweepFlag} ${s.x} ${s.y}`;case"z":case"Z":return s.type;default:return""}}function so(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${no(s[e])} `;return t}const io=/[a-df-z][^a-df-z]*/gi;function yn(s){const t=[],e=s.match(io);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const i=e[r],o=i.charAt(0),a=i.slice(1).trim();let h;switch(o){case"m":case"M":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Ot(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Ot(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Ot(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Ot(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Ot(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Ot(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(i)}}return t}var oo=Object.defineProperty,ao=(s,t,e)=>t in s?oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,dr=(s,t,e)=>(ao(s,typeof t!="symbol"?t+"":t,e),e);class Wt{constructor(){dr(this,"arcLengthDivisions",200),dr(this,"_cacheArcLengths"),dr(this,"_needsUpdate",!1)}getPointAt(t,e=new x){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),i+=r.distanceTo(n),e.push(i),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const r=this.getLengths();let n=0;const i=r.length;let o;e?o=e:o=t*r[i-1];let a=0,h=i-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(i-1);const u=r[n],p=r[n+1]-u,g=(o-u)/p;return(n+g)/(i-1)}getTangent(t,e=new x){const n=Math.max(0,t-1e-4),i=Math.min(1,t+1e-4);return e.copy(this.getPoint(i).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return so(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function mn(s,t,e,r,n){const i=(r-t)*.5,o=(n-e)*.5,a=s*s,h=s*a;return(2*e-2*r+i+o)*h+(-3*e+3*r-2*i-o)*a+i*s+e}function lo(s,t){const e=1-s;return e*e*t}function ho(s,t){return 2*(1-s)*s*t}function co(s,t){return s*s*t}function wn(s,t,e,r){return lo(s,t)+ho(s,e)+co(s,r)}function uo(s,t){const e=1-s;return e*e*e*t}function fo(s,t){const e=1-s;return 3*e*e*s*t}function po(s,t){return 3*(1-s)*s*s*t}function go(s,t){return s*s*s*t}function vn(s,t,e,r,n){return uo(s,t)+fo(s,e)+po(s,r)+go(s,n)}class yo extends Wt{constructor(t=new x,e=new x,r=new x,n=new x){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new x){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(vn(t,r.x,n.x,i.x,o.x),vn(t,r.y,n.y,i.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const i=Math.sqrt(n),o=(-e+i)/(2*t),a=(-e-i)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=x.MAX,e=x.MIN){const r=this.start,n=this.startControl,i=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(i.x-n.x),3*(o.x-i.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(i.y-n.y),3*(o.y-i.y)),l=[0,1,...a,...h];return((c,p)=>{for(const g of c)for(let y=0;y<=p;y++){const w=y/p-.5,d=Math.min(1,Math.max(0,g+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{startControl:e,endControl:r,end:n}=this;return t.bezierCurveTo(e.x,e.y,r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const mo=new wt,bn=new wt,Mn=new wt,Be=new x;class wo extends Wt{constructor(t=new x,e=1,r=1,n=0,i=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=i,this.endAngle=o,this.clockwise=a}getPoint(t,e=new x){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const i=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(i?n=0:n=r),this.clockwise&&!i&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,p=h-this.center.y;a=c*l-p*u+this.center.x,h=c*u+p*l+this.center.y}return e.set(a,h)}getCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:i,clockwise:o,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),p=Math.abs(n-i),g=p>Math.PI?1:0,y=o?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),_=l+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:C,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:u,y:c}]}else{const d=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),C=l+e*Math.cos(i)*Math.sin(a)+r*Math.sin(i)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:g,sweepFlag:y,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:i,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,i,o,a,!h),this}transform(t){return Be.set(this.center.x,this.center.y),Be.applyMatrix3(t),this.center.x=Be.x,this.center.y=Be.y,Mo(t)?vo(this,t):bo(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=x.MAX,e=x.MIN){const{center:r,radiusX:n,radiusY:i,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),u=Math.sin(o),c=Math.sqrt(n*n*l*l+i*i*u*u),p=Math.sqrt(n*n*u*u+i*i*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-p),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function vo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new x(e*n,e*i),a=new x(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=mo.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=bn.copy(u).invert(),y=Mn.copy(c).transpose().multiply(c).elements,w=xo(y[0],y[1],y[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(s.radiusX=1/d,s.radiusY=1/C,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const M=bn.set(d,0,0,0,C,0,0,0,1),T=Mn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),b=M.multiply(T).multiply(u),v=A=>{const{x:S,y:P}=new x(Math.cos(A),Math.sin(A)).applyMatrix3(b);return Math.atan2(P,S)};s.startAngle=v(s.startAngle),s.endAngle=v(s.endAngle),xn(t)&&(s.clockwise=!s.clockwise)}}function bo(s,t){const e=_n(t),r=Sn(t);s.radiusX*=e,s.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);s.rotation+=n,xn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function xn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function Mo(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=_n(s),n=Sn(s);return Math.abs(e/(r*n))>Number.EPSILON}function _n(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Sn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function xo(s,t,e){let r,n,i,o,a;const h=s+e,l=s-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=s*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?i=l+u:i=l-u,Math.abs(i)>2*Math.abs(t)?(a=-2*t/i,o=1/Math.sqrt(1+a*a),i=a*o):Math.abs(t)===0?(i=1,o=0):(a=-.5*i/t,i=1/Math.sqrt(1+a*a),o=a*i),l>0&&(a=i,i=-o,o=a),{rt1:r,rt2:n,cs:i,sn:o}}class gr extends Wt{constructor(t=new x,e=new x){super(),this.start=t,this.end=e}getPoint(t,e=new x){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new x){return this.getPoint(t,e)}getTangent(t,e=new x){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new x){return this.getTangent(t,e)}getNormal(t,e=new x){const{x:r,y:n}=this.getPoint(t).sub(this.start);return e.set(n,-r).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=x.MAX,e=x.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class _o extends Wt{constructor(t=new x,e=new x,r=new x){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new x){const{start:r,control:n,end:i}=this;return e.set(wn(t,r.x,n.x,i.x),wn(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=x.MAX,e=x.MIN){const{start:r,control:n,end:i}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+i.x),l=.5*(r.y+i.y);return t.x=Math.min(t.x,r.x,i.x,o,h),t.y=Math.min(t.y,r.y,i.y,a,l),e.x=Math.max(e.x,r.x,i.x,o,h),e.y=Math.max(e.y,r.y,i.y,a,l),{min:t,max:e}}getCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{control:e,end:r}=this;return t.quadraticCurveTo(e.x,e.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var So=Object.defineProperty,Co=(s,t,e)=>t in s?So(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Cn=(s,t,e)=>(Co(s,typeof t!="symbol"?t+"":t,e),e);class Po extends Wt{constructor(t,e,r=1,n=0,i=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=i,Cn(this,"curves",[]),Cn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,i=[new x(t-r,e-n),new x(t+r,e-n),new x(t+r,e+n),new x(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new gr(i[o].clone(),i[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class To extends Wt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new x){const{points:r}=this,n=(r.length-1)*t,i=Math.floor(n),o=n-i,a=r[i===0?i:i-1],h=r[i],l=r[i>r.length-2?r.length-1:i+1],u=r[i>r.length-3?r.length-1:i+2];return e.set(mn(o,a.x,h.x,l.x,u.x),mn(o,a.y,h.y,l.y,u.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var Oo=Object.defineProperty,Ao=(s,t,e)=>t in s?Oo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ve=(s,t,e)=>(Ao(s,typeof t!="symbol"?t+"":t,e),e);class be extends Wt{constructor(t){super(),ve(this,"curves",[]),ve(this,"startPoint"),ve(this,"currentPoint",new x),ve(this,"autoClose",!1),ve(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:i}=t[e];this.lineTo(n,i)}return this}addCommands(t){return gn(t,this),this}addData(t){return this.addCommands(yn(t)),this}getPoint(t,e=new x){const r=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=r){const o=n[i]-r,a=this.curves[i],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}i++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let i=0,o=r.length;i<o;i++){const h=r[i].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new gr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new gr(this.currentPoint.clone(),new x(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPoint.equals({x:i,y:o})||this.curves.push(new yo(this.currentPoint.clone(),new x(t,e),new x(r,n),new x(i,o))),this._setCurrentPoint({x:i,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new _o(this.currentPoint.clone(),new x(t,e),new x(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,i,o){return this.ellipse(t,e,r,r,0,n,i,o),this}relativeArc(t,e,r,n,i,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,i,o),this}arcTo(t,e,r,n,i){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,i,o,a,h=!0){const l=new wo(new x(t,e),r,n,i,o,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,i,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,i,o,a,h),this}rect(t,e,r,n){return this.curves.push(new Po(new x(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new To([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Do(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Io=Object.defineProperty,No=(s,t,e)=>t in s?Io(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yr=(s,t,e)=>(No(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){yr(this,"currentPath",new be),yr(this,"paths",[this.currentPath]),yr(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new be().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new be().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,i,o){return this.currentPath.bezierCurveTo(t,e,r,n,i,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,i,o){return this.currentPath.arc(t,e,r,n,i,o),this}arcTo(t,e,r,n,i){return this.currentPath.arcTo(t,e,r,n,i),this}ellipse(t,e,r,n,i,o,a,h){return this.currentPath.ellipse(t,e,r,n,i,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return gn(t,this),this}addData(t){return this.addCommands(yn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(r=>t(r))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=x.MAX,e=x.MIN,r=!0){if(this.forEachCurve(n=>n.getMinMax(t,e)),r){const n=this.strokeWidth/2;t.x-=n,t.y-=n,e.x+=n,e.y+=n}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new G(e.x,e.y,r.x-e.x,r.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[Do(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.getData()}" style="${r}"></path>`}getSvgXml(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),i=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${i}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;Ki(t,e),this.paths.forEach(i=>{i.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:r,width:n,height:i}=this.getBoundingBox(),o=document.createElement("canvas");o.width=n*t,o.height=i*t,o.style.width=`${n}px`,o.style.height=`${i}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-r),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const mr="px",Pn=90,Tn=["mm","cm","in","pt","pc","px"],wr={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 U(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Tn.length;r<n;r++){const i=Tn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&mr!=="px"?e=wr.in[mr]/Pn:(e=wr[t][mr],e<0&&(e=wr[t].in*Pn)),e*Number.parseFloat(s)}const zo=new wt,je=new wt,On=new wt,An=new wt;function Uo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Eo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Eo(s){const t=new wt,e=zo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(U(s.getAttribute("x")),U(s.getAttribute("y"))),s.hasAttribute("transform")){const r=s.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const i=r[n].trim();if(i==="")continue;const o=i.indexOf("("),a=i.length;if(o>0&&o<a){const h=i.slice(0,o),l=Ot(i.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,p=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],p=l[2]),je.makeTranslation(-c,-p),On.makeRotation(u),An.multiplyMatrices(On,je),je.makeTranslation(c,p),e.multiplyMatrices(je,An)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Lo(s){return new bt().addPath(new be().arc(U(s.getAttribute("cx")||0),U(s.getAttribute("cy")||0),U(s.getAttribute("r")||0),0,Math.PI*2))}function $o(s,t){if(!(!s.sheet||!s.sheet.cssRules||!s.sheet.cssRules.length))for(let e=0;e<s.sheet.cssRules.length;e++){const r=s.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(i=>i.trim());for(let i=0;i<n.length;i++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[i]]=Object.assign(t[n[i]]||{},o)}}}function Bo(s){return new bt().addPath(new be().ellipse(U(s.getAttribute("cx")||0),U(s.getAttribute("cy")||0),U(s.getAttribute("rx")||0),U(s.getAttribute("ry")||0),0,0,Math.PI*2))}function jo(s){return new bt().moveTo(U(s.getAttribute("x1")||0),U(s.getAttribute("y1")||0)).lineTo(U(s.getAttribute("x2")||0),U(s.getAttribute("y2")||0))}function ko(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Fo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Go(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Fo,(n,i,o)=>{const a=U(i),h=U(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ro=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Vo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Ro,(n,i,o)=>{const a=U(i),h=U(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function qo(s){const t=U(s.getAttribute("x")||0),e=U(s.getAttribute("y")||0),r=U(s.getAttribute("rx")||s.getAttribute("ry")||0),n=U(s.getAttribute("ry")||s.getAttribute("rx")||0),i=U(s.getAttribute("width")),o=U(s.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+i-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+i-r*a,e,t+i,e+n*a,t+i,e+n),h.lineTo(t+i,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+i,e+o-n*a,t+i-r*a,e+o,t+i-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(s,t,e){t=Object.assign({},t);let r={};if(s.hasAttribute("class")){const h=s.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}s.hasAttribute("id")&&(r=Object.assign(r,e[`#${s.getAttribute("id")}`]));function n(h,l,u){u===void 0&&(u=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),s.hasAttribute(h)&&(t[l]=u(s.getAttribute(h))),r[h]&&(t[l]=u(r[h])),s.style&&s.style[h]!==""&&(t[l]=u(s.style[h]))}function i(h){return Math.max(0,Math.min(1,U(h)))}function o(h){return Math.max(0,U(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>U(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",i),n("fill-rule","fillRule"),n("opacity","opacity",i),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",i),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",U),n("visibility","visibility"),t}function vr(s,t,e=[]){var u;if(s.nodeType!==1)return e;let r=!1,n=null;const i={};switch(s.nodeName){case"svg":t=At(s,t,i);break;case"style":$o(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=ko(s));break;case"rect":t=At(s,t,i),n=qo(s);break;case"polygon":t=At(s,t,i),n=Go(s);break;case"polyline":t=At(s,t,i),n=Vo(s);break;case"circle":t=At(s,t,i),n=Lo(s);break;case"ellipse":t=At(s,t,i),n=Bo(s);break;case"line":t=At(s,t,i),n=jo(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const p=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=s.viewportElement)==null?void 0:u.getElementById(p);g?vr(g,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(s);break}const o=new wt,a=[],h=Uo(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,p=l.length;c<p;c++){const g=l[c];r&&g.nodeName!=="style"&&g.nodeName!=="defs"||vr(g,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Dn="data:image/svg+xml;",In=`${Dn}base64,`,Nn=`${Dn}charset=utf8,`;function zn(s){if(typeof s=="string"){let t;return s.startsWith(In)?(s=s.substring(In.length,s.length),t=atob(s)):s.startsWith(Nn)?(s=s.substring(Nn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function br(s){return vr(zn(s),{})}function ke(s){if(!s)return s;const t={};for(const e in s)s[e]!==""&&s[e]!==void 0&&(t[e]=s[e]);return t}function Un(s,t){const{x:e,y:r}=s,n=Math.sin(t),i=Math.cos(t);return{x:e*i-r*n,y:e*n+r*i}}function Mr(s,t,e,r){const n=s.x-t.x,i=s.y-t.y;return{x:t.x+(n+Math.tan(e)*i),y:t.y+(i+Math.tan(r)*n)}}function En(s,t,e,r){const n=e<0?t.x-s.x+t.x:s.x,i=r<0?t.y-s.y+t.y:s.y;return{x:n*Math.abs(e),y:i*Math.abs(r)}}function Ln(s,t,e=0,r=0,n=0,i=1,o=1){let a=Array.isArray(s)?s:[s];const h=-e/180*Math.PI,{x:l,y:u}=t;return(i!==1||o!==1)&&(a=a.map(c=>En(c,t,i,o))),(r||n)&&(a=a.map(c=>Mr(c,t,r,n))),a=a.map(c=>{const p=c.x-l,g=-(c.y-u);return c=Un({x:p,y:g},h),{x:l+c.x,y:u-c.y}}),a[0]}const Wo=new Set(["©","®","÷"]),Ho=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class $n{constructor(t,e,r){z(this,"boundingBox",new G);z(this,"textWidth",0);z(this,"textHeight",0);z(this,"path",new bt);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=un.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof st)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:i,post:o}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:u}=l,{fontSize:c}=h,p=e/c,g=t.getAdvanceWidth(a,c),y=(r+Math.abs(n))/p,w=r/p,d=(r-i.yStrikeoutPosition)/p,C=i.yStrikeoutSize/p,_=(r-o.underlinePosition)/p,M=o.underlineThickness/p;return this.glyphWidth=g,this.glyphHeight=y,this.underlinePosition=_,this.underlineThickness=M,this.yStrikeoutPosition=d,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*u-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:i,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:u}=this.updateGlyph(t),{os2:c,ascender:p,descender:g}=t,y=p,w=g,d=c.sTypoAscender,{left:C,top:_}=o,{fontSize:M,fontStyle:T}=a;let b=C,v=_+h,A,S;if(e&&(b+=(l-u)/2,Math.abs(n-i)>.1&&(v-=(y-d)/(y+Math.abs(w))*l),A=void 0),e&&!Wo.has(r)&&(r.codePointAt(0)<=256||Ho.has(r))){S=t.getPathCommands(r,b,_+h-(l-u)/2,M)??[];const L={y:_-(l-u)/2+l/2,x:b+u/2};T==="italic"&&(S=this._italic(S,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),S=this._rotation90(S,L)}else A!==void 0?(S=t.glyphs.get(A).getPathCommands(b,v,M),T==="italic"&&(S=this._italic(S,e?{x:b+u/2,y:_+d/(y+Math.abs(w))*l}:void 0))):(S=t.getPathCommands(r,b,v,M)??[],T==="italic"&&(S=this._italic(S,e?{x:b+l/2,y:v}:void 0)));S.push(...this._decoration());const P=new bt(S);return P.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*M*.03:0},this.path=P,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:i}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,u=.1*i;let c;switch(n){case"underline":t?c=o:c=a+e;break;case"line-through":t?c=o+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:o,y:c},{type:"L",x:o+h,y:c},{type:"L",x:o+h,y:c+u},{type:"L",x:o,y:c+u},{type:"Z"}]}_italic(t,e){const{baseline:r,glyphWidth:n}=this,{left:i,top:o}=this.boundingBox,a=e||{y:o+r,x:i+n/2};return this._transform(t,(h,l)=>{const u=Mr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=Ln({x:r,y:n},e,90);return[i.x,i.y]})}_transform(t,e){return t.map(r=>{const n={...r};switch(n.type){case"L":case"M":[n.x,n.y]=e(n.x,n.y);break;case"Q":[n.x1,n.y1]=e(n.x1,n.y1),[n.x,n.y]=e(n.x,n.y);break;case"C":[n.x1,n.y1]=e(n.x1,n.y1),[n.x2,n.y2]=e(n.x2,n.y2),[n.x,n.y]=e(n.x,n.y);break}return n})}getGlyphMinMax(t,e,r){var n;return(n=this.path.paths[0])!=null&&n.curves.length?this.path.getMinMax(t,e,r):(t??(t=x.MAX),e??(e=x.MIN),t.x=Math.min(t.x,this.boundingBox.left),t.y=Math.min(t.y,this.boundingBox.top),e.x=Math.max(e.x,this.boundingBox.right),e.y=Math.max(e.y,this.boundingBox.bottom),{min:t,max:e})}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new G(e.x,e.y,r.x-r.x,r.y-r.y)}drawTo(t,e={}){Ge({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Bn{constructor(t,e={},r){z(this,"boundingBox",new G);z(this,"highlight");this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...ke(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new $n(r,e++,this));return this.characters=t,this}}class te{constructor(t,e){z(this,"boundingBox",new G);z(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...ke(this.parentStyle),...ke(this.style)},this}addFragment(t,e){const r=new Bn(t,e,this);return this.fragments.push(r),r}}class Ht{constructor(t){this._text=t}}class jn extends Ht{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}const ee=new wt,jt=new wt,kt=new x;class kn extends Ht{getTransform2D(t){const{fontSize:e,renderBoundingBox:r}=this._text,n=(t.offsetX??0)*e,i=(t.offsetY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,h=(t.skewY??0)/360*o,{left:l,top:u,width:c,height:p}=r,g=l+c/2,y=u+p/2;return ee.identity(),jt.makeTranslation(n,i),ee.multiply(jt),jt.makeTranslation(g,y),ee.multiply(jt),jt.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),ee.multiply(jt),jt.makeTranslation(-g,-y),ee.multiply(jt),ee.clone()}getBoundingBox(){const{characters:t,effects:e,fontSize:r}=this._text,n=[];return t.forEach(i=>{e==null||e.forEach(o=>{const a=i.glyphBox.clone(),h=this.getTransform2D(o);kt.set(a.left,a.top),kt.applyMatrix3(h),a.left=kt.x,a.top=kt.y,kt.set(a.right,a.bottom),kt.applyMatrix3(h),a.width=kt.x-a.left,a.height=kt.y-a.top;const l=(o.shadowOffsetX??0)*r,u=(o.shadowOffsetY??0)*r,c=Math.max(.1,o.textStrokeWidth??0)*r;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),G.from(...n)}draw(t){const{ctx:e}=t,{effects:r,characters:n,renderBoundingBox:i}=this._text;return r&&r.forEach(o=>{Ct(o,i,e),e.save();const[a,h,l,u,c,p]=this.getTransform2D(o).transpose().elements;e.transform(a,u,h,c,l,p),n.forEach(g=>{g.drawTo(e,o)}),e.restore()}),this}}const Fn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=",re=class re extends Ht{constructor(){super(...arguments);z(this,"paths",[])}static get refer(){return this._refer}static set refer(e){this._refer=e,this.parsedRefer=br(e)}getReferBoundingBox(){const e=x.MIN,r=x.MAX;return re.parsedRefer.forEach(n=>{n.getMinMax(r,e)}),new G(r.x,r.y,e.x-r.x,e.y-r.y)}getBoundingBox(){if(!this.paths.length)return;const e=x.MAX,r=x.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new G(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(e=!1){const{characters:r}=this._text;let n;const i=[];let o;r.forEach(a=>{const h=a.parent.highlight;h!=null&&h.url&&(!e&&(o==null?void 0:o.url)===h.url&&(o==null?void 0:o.strokeWidth)===h.strokeWidth&&(o==null?void 0:o.repeatXByFontsize)===h.repeatXByFontsize&&(o==null?void 0:o.overflowXHidden)===h.overflowXHidden&&n.length&&n[0].boundingBox.top===a.boundingBox.top&&n[0].fontSize===a.fontSize?n.push(a):(n=[],n.push(a),i.push(n))),o=h}),this.paths=i.filter(a=>a.length).map(a=>({highlight:a[0].parent.highlight,box:G.from(...a.map(h=>h.glyphBox)),baseline:Math.max(...a.map(h=>h.baseline)),fontSize:a[0].fontSize})).map(a=>this._parseGroup(a)).flat()}_parseSvg(e){const r=zn(e),n=br(r),i=x.MAX,o=x.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new G(i.x,i.y,o.x-i.x,o.y-i.y)}}_parseGroup(e){const{highlight:r,box:n,fontSize:i}=e,{strokeWidth:o=1,repeatXByFontsize:a=0,overflowXHidden:h=!!a}=r,{box:l,paths:u}=this._parseSvg(r.url),c=[],p=this.getReferBoundingBox(),g={x:a?i*a*(l.width/p.width)/l.width:n.width*(l.width/p.width)/l.width,y:n.height*(l.height/p.height)/l.height},y=i/l.width*2,w=l.width*g.x,d=Math.ceil(n.width/w),C={x:(l.left-p.left)*g.x,y:(l.top-p.top)*g.y},_=new wt().translate(-l.left,-l.top).scale(g.x,g.y).translate(n.left,n.top).translate(C.x,C.y);for(let M=0;M<d;M++){const T=_.clone().translate(M*w,0);u.forEach(b=>{const v=b.clone().transform(T);v.style.strokeWidth&&(v.style.strokeWidth*=y*o),v.style.strokeMiterlimit&&(v.style.strokeMiterlimit*=y),v.style.strokeDashoffset&&(v.style.strokeDashoffset*=y),v.style.strokeDasharray&&(v.style.strokeDasharray=v.style.strokeDasharray.map(A=>A*y)),c.push({clipRect:h?new G(n.left+C.x*2,n.top-n.height,n.width-C.x*2,n.height*3):void 0,path:v})})}return c}draw({ctx:e}){return this.paths.forEach(r=>{Ge({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}};z(re,"_refer",Fn),z(re,"parsedRefer",br(re._refer));let Fe=re;class Gn extends Ht{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const i=document.createElement("ul");return Object.assign(i.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),i.appendChild(a)}),n.appendChild(i),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((i,o)=>{const a=i.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),i.querySelectorAll("span").forEach((h,l)=>{var p;const u=i.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const g=document.createRange();g.selectNodeContents(c);const y=c.data?c.data.length:0;let w=0;for(;w<=y;){g.setStart(c,Math.max(w-1,0)),g.setEnd(c,w);const d=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const _=g.toString();_!==""&&C&&C.width+C.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),i=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((g,y)=>{const w=i?"left":"top";return Math.abs(y[w]-g[w])>4e3/2&&(h=[],a.push(h)),h.push(y),y})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(g=>{const y=e[g.paragraphIndex];y.boundingBox.left=g.left,y.boundingBox.top=g.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height}),u.fragments.forEach(g=>{const y=e[g.paragraphIndex].fragments[g.fragmentIndex];y.boundingBox.left=g.left,y.boundingBox.top=g.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height});const c=[];let p=0;return a.forEach(g=>{g.forEach(y=>{const w=u.characters[p],{paragraphIndex:d,fragmentIndex:C,characterIndex:_}=w;c.push({...w,newParagraphIndex:d,textWidth:y.width,textHeight:y.height,left:w.left-r.left,top:w.top-r.top});const M=e[d].fragments[C].characters[_];M.boundingBox.left=c[p].left,M.boundingBox.top=c[p].top,M.boundingBox.width=c[p].width,M.boundingBox.height=c[p].height,M.textWidth=c[p].textWidth,M.textHeight=c[p].textHeight,p++})}),{paragraphs:e,boundingBox:new G(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Rn extends Ht{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new te({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const i=new te({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new te({},e);n.forEach(o=>{if(typeof o=="string")i.addFragment(o);else{const{content:a,highlight:h,...l}=o;if(a!==void 0){const u=i.addFragment(a,l);u.highlight=h}}}),r.push(i)}else if("fragments"in n){const{fragments:i,...o}=n,a=new te(o,e);i.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const p=a.addFragment(l,c);p.highlight=u}}),r.push(a)}else if("content"in n){const{content:i,highlight:o,...a}=n;if(i!==void 0){const h=new te(a,e),l=h.addFragment(i);l.highlight=o,r.push(h)}}}return r}}class Xo extends Ht{}class Vn extends Ht{setupView(t){const{ctx:e,pixelRatio:r}=t,{renderBoundingBox:n}=this._text,{left:i,top:o,width:a,height:h}=n,l=e.canvas;return l.dataset.viewbox=`${i} ${o} ${a} ${h}`,l.dataset.pixelRatio=String(r),l.width=Math.max(1,Math.ceil(a*r)),l.height=Math.max(1,Math.ceil(h*r)),l.style.marginTop=`${o}px`,l.style.marginLeft=`${i}px`,l.style.width=`${a}px`,l.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(r,r),e.translate(-i,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:r,computedStyle:n,renderBoundingBox:i}=this._text,{width:o,height:a}=i;return Ct(n,new G(0,0,o,a),e),r.forEach(h=>{Ct(h.computedStyle,h.boundingBox,e),h.fragments.forEach(l=>{Ct(l.computedStyle,l.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:r,paragraphs:n}=this._text;function i(o,a,h,l,u){e.fillStyle=o,e.fillRect(a,h,l,u)}return r!=null&&r.backgroundColor&&i(r.backgroundColor,0,0,e.canvas.width,e.canvas.height),n.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&i(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&i(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:r}=this._text;return r.forEach(n=>{n.drawTo(e)}),this}}const xr={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class Qo{constructor(t={}){z(this,"content");z(this,"style");z(this,"effects");z(this,"deformation");z(this,"measureDom");z(this,"needsUpdate",!0);z(this,"computedStyle",{...xr});z(this,"paragraphs",[]);z(this,"boundingBox",new G);z(this,"renderBoundingBox",new G);z(this,"parser",new Rn(this));z(this,"measurer",new Gn(this));z(this,"deformer",new jn(this));z(this,"effector",new kn(this));z(this,"highlighter",new Fe(this));z(this,"renderer2D",new Vn(this));const{content:e="",style:r={},effects:n,deformation:i,measureDom:o}=t;this.content=e,this.style=r,this.effects=n,this.deformation=i,this.measureDom=o}get fontSize(){return this.computedStyle.fontSize}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...xr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(o=>o.update()),this.deformation?this.deformer.deform():this.highlighter.highlight();const n=x.MAX,i=x.MIN;return r.forEach(o=>o.getGlyphMinMax(n,i)),this.renderBoundingBox=new G(n.x,n.y,i.x-n.x,i.y-n.y),this}render(t){var i,o;const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),(i=this.effects)!=null&&i.length?this.renderBoundingBox=G.from(...[this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()].filter(Boolean)):this.renderBoundingBox=G.from(...[this.renderBoundingBox,this.highlighter.getBoundingBox()].filter(Boolean)),this.renderer2D.setupView({pixelRatio:r,ctx:n}),this.renderer2D.uploadColors({ctx:n}),this.highlighter.draw({ctx:n}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:n}):this.renderer2D.draw({ctx:n}),this):this}}f.Character=$n,f.CmapSubtableFormat0=sr,f.CmapSubtableFormat12=lr,f.CmapSubtableFormat14=ge,f.CmapSubtableFormat2=fe,f.CmapSubtableFormat4=ar,f.CmapSubtableFormat6=Rt,f.Deformer=jn,f.Effector=kn,f.Eot=Ss,f.Font=Pe,f.Fonts=cn,f.Fragment=Bn,f.Glyph=Je,f.GlyphSet=tr,f.Highlighter=Fe,f.Measurer=Gn,f.Paragraph=te,f.Parser=Rn,f.Reflector=Xo,f.Renderer2D=Vn,f.Sfnt=he,f.TableDirectory=Yt,f.Text=Qo,f.Ttf=st,f.Woff=Ut,f.WoffTableDirectoryEntry=qt,f.componentFlags=Kt,f.createCmapSegments=or,f.defaultHighlightRefer=Fn,f.defaultTextStyles=xr,f.defineSfntTable=nt,f.drawPath=Ge,f.filterEmpty=ke,f.fonts=un,f.getPointPosition=Ln,f.getRotationPoint=Un,f.getScalePoint=En,f.getSkewPoint=Mr,f.minify=Yi,f.minifyGlyphs=fn,f.minifySfnt=pn,f.parse=ln,f.parseColor=it,f.uploadColor=Ct,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
4
+ }`)),document.head.appendChild(r),this}get(t){let e;if(t){const r=this._namesUrls.get(t)??t;e=this._loaded.get(r)}return e??this.fallbackFont}set(t,e){return this._namesUrls.set(t,e.url),this._loaded.set(e.url,e),this}delete(t){const e=this._namesUrls.get(t)??t;return this._namesUrls.delete(t),this._loaded.delete(e),this}clear(){return this._namesUrls.clear(),this._loaded.clear(),this}async waitUntilLoad(){await Promise.all(Array.from(this._loading.values()).map(t=>t.when))}async load(t,e={}){const{cancelOther:r,injectFontFace:n=!0,injectStyleTag:s=!0,...o}=e,{family:a,url:h}=t;if(this._loaded.has(h))return r&&(this._loading.forEach(u=>u.cancel()),this._loading.clear()),this._loaded.get(h);let l=this._loading.get(h);return l||(l=this._createRequest(h,o),this._loading.set(h,l)),r&&this._loading.forEach((u,c)=>{u!==l&&(u.cancel(),this._loading.delete(c))}),l.when.then(u=>{const c={...t,font:ln(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(p=>{this._namesUrls.set(p,h),typeof document<"u"&&(n&&this.injectFontFace(p,u),s&&this.injectStyleTag(p,h))})),c}).catch(u=>{if(u instanceof DOMException&&u.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw u}).finally(()=>{this._loading.delete(h)})}};we(hn,"defaultRequestInit",{cache:"force-cache"});let cn=hn;const un=new cn;function fn(i,t){const{cmap:e,loca:r,hmtx:n,vmtx:s,glyf:o}=i,a=e.unicodeToGlyphIndexMap,h=r.locations,l=n.metrics,u=s==null?void 0:s.metrics,c=Array.from(new Set(t.split("").map(w=>w.codePointAt(0)).filter(w=>w!==void 0&&a.has(w)))).sort((w,d)=>w-d),p=new Map;c.forEach(w=>{const d=a.get(w)??0;let C=p.get(d);C||p.set(d,C=new Set),C.add(w)});const g=[],y=w=>{const d=l[w],C=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],M=h[w+1]??_,T={...d,...C,rawGlyphIndex:w,glyphIndex:g.length,unicodes:Array.from(p.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,M-_)};return g.push(T),T};return y(0),c.forEach(w=>y(a.get(w))),g.slice().forEach(w=>{const{view:d}=w;if(!d.byteLength||d.getInt16(0)>=0)return;let _=10,M;do{M=d.getUint16(_);const T=_+2,b=d.getUint16(T);_+=4,Kt.ARG_1_AND_2_ARE_WORDS&M?_+=4:_+=2,Kt.WE_HAVE_A_SCALE&M?_+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&M?_+=4:Kt.WE_HAVE_A_TWO_BY_TWO&M&&(_+=8);const v=y(b);d.setUint16(T,v.glyphIndex)}while(Kt.MORE_COMPONENTS&M)}),g}function pn(i,t){const e=fn(i,t),r=e.length,{head:n,maxp:s,hhea:o,vhea:a}=i;n.checkSumAdjustment=0,n.magickNumber=1594834165,n.indexToLocFormat=1,s.numGlyphs=r;let h=0;i.loca=f.Loca.from([...e.map(p=>{const g=h;return h+=p.view.byteLength,g}),h],n.indexToLocFormat);const l=e.reduce((p,g,y)=>(g.unicodes.forEach(w=>p.set(w,y)),p),new Map);i.cmap=f.Cmap.from(l),i.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=r,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const c=new f.Post;return c.format=3,c.italicAngle=0,c.underlinePosition=0,c.underlineThickness=0,c.isFixedPitch=0,c.minMemType42=0,c.minMemType42=0,c.minMemType1=0,c.maxMemType1=r,i.post=c,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function Ys(i,t){let e,r;if(i instanceof it)e=i.sfnt.clone(),r="ttf";else if(i instanceof Ut)e=i.sfnt.clone(),r="woff";else{const s=Ft(i);if(it.is(s))e=new it(s).sfnt,r="ttf-buffer";else if(Ut.is(s))e=new Ut(s).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=pn(e,t);switch(r){case"ttf":return it.from(n);case"woff":return Ut.from(n);case"ttf-buffer":return it.from(n).view.buffer;case"woff-buffer":default:return Ut.from(n).view.buffer}}const Zs={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Ks(i,t){const{fill:e="#000",stroke:r="none",strokeWidth:n=r==="none"?0:1,strokeLinecap:s="round",strokeLinejoin:o="miter",strokeMiterlimit:a=0,strokeDasharray:h=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:c=0,shadowBlur:p=0,shadowColor:g="rgba(0, 0, 0, 0)"}=t;i.fillStyle=e,i.strokeStyle=r,i.lineWidth=n,i.lineCap=s,i.lineJoin=Zs[o],i.miterLimit=a,i.setLineDash(h),i.lineDashOffset=l,i.shadowOffsetX=u,i.shadowOffsetY=c,i.shadowBlur=p,i.shadowColor=g}class x{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new x(1/0,1/0)}static get MIN(){return new x(-1/0,-1/0)}set(t,e){return this.x=t,this.y=e,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,r=this.y-t.y;return e*e+r*r}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}normalize(){return this.divideScalar(this.length()||1)}lerpVectors(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,r=this.y,n=t.elements;return this.x=n[0]*e+n[3]*r+n[6],this.y=n[1]*e+n[4]*r+n[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new x(this.x,this.y)}}class G{constructor(t=0,e=0,r=0,n=0){this.left=t,this.top=e,this.width=r,this.height=n}get x(){return this.left}set x(t){this.left=t}get y(){return this.top}set y(t){this.top=t}get right(){return this.left+this.width}get bottom(){return this.top+this.height}static from(...t){if(t.length===0)return new G;if(t.length===1)return t[0].clone();const e=t[0],r=t.slice(1).reduce((n,s)=>(n.left=Math.min(n.left,s.left),n.top=Math.min(n.top,s.top),n.right=Math.max(n.right,s.right),n.bottom=Math.max(n.bottom,s.bottom),n),{left:(e==null?void 0:e.left)??0,top:(e==null?void 0:e.top)??0,right:(e==null?void 0:e.right)??0,bottom:(e==null?void 0:e.bottom)??0});return new G(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new x((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new G(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Js=Object.defineProperty,to=(i,t,e)=>t in i?Js(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,eo=(i,t,e)=>(to(i,t+"",e),e);class wt{constructor(t=1,e=0,r=0,n=0,s=1,o=0,a=0,h=0,l=1){eo(this,"elements",[]),this.set(t,e,r,n,s,o,a,h,l)}set(t,e,r,n,s,o,a,h,l){const u=this.elements;return u[0]=t,u[1]=n,u[2]=a,u[3]=e,u[4]=s,u[5]=h,u[6]=r,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,r=t.elements;return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const r=t.elements,n=e.elements,s=this.elements,o=r[0],a=r[3],h=r[6],l=r[1],u=r[4],c=r[7],p=r[2],g=r[5],y=r[8],w=n[0],d=n[3],C=n[6],_=n[1],M=n[4],T=n[7],b=n[2],v=n[5],A=n[8];return s[0]=o*w+a*_+h*b,s[3]=o*d+a*M+h*v,s[6]=o*C+a*T+h*A,s[1]=l*w+u*_+c*b,s[4]=l*d+u*M+c*v,s[7]=l*C+u*T+c*A,s[2]=p*w+g*_+y*b,s[5]=p*d+g*M+y*v,s[8]=p*C+g*T+y*A,this}invert(){const t=this.elements,e=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],h=t[6],l=t[7],u=t[8],c=u*o-a*l,p=a*h-u*s,g=l*s-o*h,y=e*c+r*p+n*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=p*w,t[4]=(u*e-n*h)*w,t[5]=(n*s-a*e)*w,t[6]=g*w,t[7]=(r*h-l*e)*w,t[8]=(o*e-r*s)*w,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}scale(t,e){return this.premultiply(pr.makeScale(t,e)),this}rotate(t){return this.premultiply(pr.makeRotation(-t)),this}translate(t,e){return this.premultiply(pr.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),r=Math.sin(t);return this.set(e,-r,0,r,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}fromArray(t,e=0){for(let r=0;r<9;r++)this.elements[r]=t[r+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const pr=new wt;function dn(i,t,e,r){const n=i*e+t*r,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+r*r);let o=Math.acos(Math.max(-1,Math.min(1,n/s)));return i*r-t*e<0&&(o=-o),o}function ro(i,t,e,r,n,s,o,a){if(t===0||e===0){i.lineTo(a.x,a.y);return}r=r*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(o.x-a.x)/2,l=(o.y-a.y)/2,u=Math.cos(r)*h+Math.sin(r)*l,c=-Math.sin(r)*h+Math.cos(r)*l;let p=t*t,g=e*e;const y=u*u,w=c*c,d=y/p+w/g;if(d>1){const L=Math.sqrt(d);t=L*t,e=L*e,p=t*t,g=e*e}const C=p*w+g*y,_=(p*g-C)/C;let M=Math.sqrt(Math.max(0,_));n===s&&(M=-M);const T=M*t*c/e,b=-M*e*u/t,v=Math.cos(r)*T-Math.sin(r)*b+(o.x+a.x)/2,A=Math.sin(r)*T+Math.cos(r)*b+(o.y+a.y)/2,S=dn(1,0,(u-T)/t,(c-b)/e),P=dn((u-T)/t,(c-b)/e,(-u-T)/t,(-c-b)/e)%(Math.PI*2);i.ellipse(v,A,t,e,r,S,S+P,s===1)}function Jt(i,t){return i-(t-i)}function gn(i,t){const e=new x,r=new x;for(let n=0,s=i.length;n<s;n++){const o=i[n];if(o.type==="m"||o.type==="M")o.type==="m"?e.add(o):e.copy(o),t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?e.add(o):e.copy(o),t.lineTo(e.x,e.y),r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Jt(e.x,r.x),Jt(e.y,r.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),r.x=e.x+o.x2,r.y=e.y+o.y2,e.add(o)):(t.bezierCurveTo(Jt(e.x,r.x),Jt(e.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,e.copy(o));else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),r.x=e.x+o.x1,r.y=e.y+o.y1,e.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,e.copy(o));else if(o.type==="t"||o.type==="T"){const a=Jt(e.x,r.x),h=Jt(e.y,r.y);r.x=a,r.y=h,o.type==="t"?(t.quadraticCurveTo(a,h,e.x+o.x,e.y+o.y),e.add(o)):(t.quadraticCurveTo(a,h,o.x,o.y),e.copy(o))}else if(o.type==="a"||o.type==="A"){const a=e.clone();if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.add(o)}else{if(e.equals(o))continue;e.copy(o)}r.copy(e),ro(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,a,e)}else o.type==="z"||o.type==="Z"?(t.startPoint&&e.copy(t.startPoint),t.closePath()):console.warn("Unsupported commands",o)}}const Z={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Ot(i,t,e=0){let a=0,h=!0,l="",u="";const c=[];function p(d,C,_){const M=new SyntaxError(`Unexpected character "${d}" at index ${C}.`);throw M.partial=_,M}function g(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let y;const w=i.length;for(let d=0;d<w;d++){if(y=i[d],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(y)){a=1,l=y,g();continue}if(a===0){if(Z.WHITESPACE.test(y))continue;if(Z.DIGIT.test(y)||Z.SIGN.test(y)){a=1,l=y;continue}if(Z.POINT.test(y)){a=2,l=y;continue}Z.COMMA.test(y)&&(h&&p(y,d,c),h=!0)}if(a===1){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.POINT.test(y)){l+=y,a=2;continue}if(Z.EXP.test(y)){a=3;continue}Z.SIGN.test(y)&&l.length===1&&Z.SIGN.test(l[0])&&p(y,d,c)}if(a===2){if(Z.DIGIT.test(y)){l+=y;continue}if(Z.EXP.test(y)){a=3;continue}Z.POINT.test(y)&&l[l.length-1]==="."&&p(y,d,c)}if(a===3){if(Z.DIGIT.test(y)){u+=y;continue}if(Z.SIGN.test(y)){if(u===""){u+=y;continue}u.length===1&&Z.SIGN.test(u)&&p(y,d,c)}}Z.WHITESPACE.test(y)?(g(),a=0,h=!1):Z.COMMA.test(y)?(g(),a=0,h=!0):Z.SIGN.test(y)?(g(),a=1,l=y):Z.POINT.test(y)?(g(),a=2,l=y):p(y,d,c)}return g(),c}function no(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function io(i){let t="";for(let e=0,r=i.length;e<r;e++)t+=`${no(i[e])} `;return t}const so=/[a-df-z][^a-df-z]*/gi;function yn(i){const t=[],e=i.match(so);if(!e)return t;for(let r=0,n=e.length;r<n;r++){const s=e[r],o=s.charAt(0),a=s.slice(1).trim();let h;switch(o){case"m":case"M":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)l===0?t.push({type:o,x:h[l],y:h[l+1]}):t.push({type:o==="m"?"l":"L",x:h[l],y:h[l+1]});break;case"h":case"H":h=Ot(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Ot(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"c":case"C":h=Ot(a);for(let l=0,u=h.length;l<u;l+=6)t.push({type:o,x1:h[l],y1:h[l+1],x2:h[l+2],y2:h[l+3],x:h[l+4],y:h[l+5]});break;case"s":case"S":h=Ot(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x2:h[l],y2:h[l+1],x:h[l+2],y:h[l+3]});break;case"q":case"Q":h=Ot(a);for(let l=0,u=h.length;l<u;l+=4)t.push({type:o,x1:h[l],y1:h[l+1],x:h[l+2],y:h[l+3]});break;case"t":case"T":h=Ot(a);for(let l=0,u=h.length;l<u;l+=2)t.push({type:o,x:h[l],y:h[l+1]});break;case"a":case"A":h=Ot(a,[3,4],7);for(let l=0,u=h.length;l<u;l+=7)t.push({type:o,rx:h[l],ry:h[l+1],angle:h[l+2],largeArcFlag:h[l+3],sweepFlag:h[l+4],x:h[l+5],y:h[l+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var oo=Object.defineProperty,ao=(i,t,e)=>t in i?oo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,dr=(i,t,e)=>(ao(i,typeof t!="symbol"?t+"":t,e),e);class qt{constructor(){dr(this,"arcLengthDivisions",200),dr(this,"_cacheArcLengths"),dr(this,"_needsUpdate",!1)}getPointAt(t,e=new x){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return e}getSpacedPoints(t=5){const e=[];for(let r=0;r<=t;r++)e.push(this.getPointAt(r/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===t+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;const e=[];let r,n=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)r=this.getPoint(o/t),s+=r.distanceTo(n),e.push(s),n=r;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const r=this.getLengths();let n=0;const s=r.length;let o;e?o=e:o=t*r[s-1];let a=0,h=s-1,l;for(;a<=h;)if(n=Math.floor(a+(h-a)/2),l=r[n]-o,l<0)a=n+1;else if(l>0)h=n-1;else{h=n;break}if(n=h,r[n]===o)return n/(s-1);const u=r[n],p=r[n+1]-u,g=(o-u)/p;return(n+g)/(s-1)}getTangent(t,e=new x){const n=Math.max(0,t-1e-4),s=Math.min(1,t+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(n)).normalize())}getTangentAt(t,e){return this.getTangent(this.getUtoTmapping(t),e)}transformPoint(t){return this}transform(t){return this.transformPoint(e=>e.applyMatrix3(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.getPoints().forEach(r=>{t.x=Math.min(t.x,r.x),t.y=Math.min(t.y,r.y),e.x=Math.max(e.x,r.x),e.y=Math.max(e.y,r.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.getPoints().map((t,e)=>e===0?{type:"M",x:t.x,y:t.y}:{type:"L",x:t.x,y:t.y})}getData(){return io(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function mn(i,t,e,r,n){const s=(r-t)*.5,o=(n-e)*.5,a=i*i,h=i*a;return(2*e-2*r+s+o)*h+(-3*e+3*r-2*s-o)*a+s*i+e}function lo(i,t){const e=1-i;return e*e*t}function ho(i,t){return 2*(1-i)*i*t}function co(i,t){return i*i*t}function wn(i,t,e,r){return lo(i,t)+ho(i,e)+co(i,r)}function uo(i,t){const e=1-i;return e*e*e*t}function fo(i,t){const e=1-i;return 3*e*e*i*t}function po(i,t){return 3*(1-i)*i*i*t}function go(i,t){return i*i*i*t}function vn(i,t,e,r,n){return uo(i,t)+fo(i,e)+po(i,r)+go(i,n)}class yo extends qt{constructor(t=new x,e=new x,r=new x,n=new x){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new x){const{start:r,startControl:n,endControl:s,end:o}=this;return e.set(vn(t,r.x,n.x,s.x,o.x),vn(t,r.y,n.y,s.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}_solveQuadratic(t,e,r){const n=e*e-4*t*r;if(n<0)return[];const s=Math.sqrt(n),o=(-e+s)/(2*t),a=(-e-s)/(2*t);return[o,a].filter(h=>h>=0&&h<=1)}getMinMax(t=x.MAX,e=x.MIN){const r=this.start,n=this.startControl,s=this.endControl,o=this.end,a=this._solveQuadratic(3*(n.x-r.x),6*(s.x-n.x),3*(o.x-s.x)),h=this._solveQuadratic(3*(n.y-r.y),6*(s.y-n.y),3*(o.y-s.y)),l=[0,1,...a,...h];return((c,p)=>{for(const g of c)for(let y=0;y<=p;y++){const w=y/p-.5,d=Math.min(1,Math.max(0,g+w)),C=this.getPoint(d);t.x=Math.min(t.x,C.x),t.y=Math.min(t.y,C.y),e.x=Math.max(e.x,C.x),e.y=Math.max(e.y,C.y)}})(l,10),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:r,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:r.x,y2:r.y,x:n.x,y:n.y}]}drawTo(t){const{startControl:e,endControl:r,end:n}=this;return t.bezierCurveTo(e.x,e.y,r.x,r.y,n.x,n.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.startControl.copy(t.startControl),this.endControl.copy(t.endControl),this.end.copy(t.end),this}}const mo=new wt,bn=new wt,Mn=new wt,Be=new x;class wo extends qt{constructor(t=new x,e=1,r=1,n=0,s=0,o=Math.PI*2,a=!1){super(),this.center=t,this.radiusX=e,this.radiusY=r,this.rotation=n,this.startAngle=s,this.endAngle=o,this.clockwise=a}getPoint(t,e=new x){const r=Math.PI*2;let n=this.endAngle-this.startAngle;const s=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=r;for(;n>r;)n-=r;n<Number.EPSILON&&(s?n=0:n=r),this.clockwise&&!s&&(n===r?n=-r:n=n-r);const o=this.startAngle+t*n;let a=this.center.x+this.radiusX*Math.cos(o),h=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const l=Math.cos(this.rotation),u=Math.sin(this.rotation),c=a-this.center.x,p=h-this.center.y;a=c*l-p*u+this.center.x,h=c*u+p*l+this.center.y}return e.set(a,h)}getCommands(){const{center:t,radiusX:e,radiusY:r,startAngle:n,endAngle:s,clockwise:o,rotation:a}=this,{x:h,y:l}=t,u=h+e*Math.cos(n)*Math.cos(a)-r*Math.sin(n)*Math.sin(a),c=l+e*Math.cos(n)*Math.sin(a)+r*Math.sin(n)*Math.cos(a),p=Math.abs(n-s),g=p>Math.PI?1:0,y=o?1:0,w=a*180/Math.PI;if(p>=2*Math.PI){const d=n+Math.PI,C=h+e*Math.cos(d)*Math.cos(a)-r*Math.sin(d)*Math.sin(a),_=l+e*Math.cos(d)*Math.sin(a)+r*Math.sin(d)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:C,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:y,x:u,y:c}]}else{const d=h+e*Math.cos(s)*Math.cos(a)-r*Math.sin(s)*Math.sin(a),C=l+e*Math.cos(s)*Math.sin(a)+r*Math.sin(s)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:g,sweepFlag:y,x:d,y:C}]}}drawTo(t){const{center:e,radiusX:r,radiusY:n,rotation:s,startAngle:o,endAngle:a,clockwise:h}=this;return t.ellipse(e.x,e.y,r,n,s,o,a,!h),this}transform(t){return Be.set(this.center.x,this.center.y),Be.applyMatrix3(t),this.center.x=Be.x,this.center.y=Be.y,Mo(t)?vo(this,t):bo(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=x.MAX,e=x.MIN){const{center:r,radiusX:n,radiusY:s,rotation:o}=this,{x:a,y:h}=r,l=Math.cos(o),u=Math.sin(o),c=Math.sqrt(n*n*l*l+s*s*u*u),p=Math.sqrt(n*n*u*u+s*s*l*l);return t.x=Math.min(t.x,a-c),t.y=Math.min(t.y,h-p),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function vo(i,t){const e=i.radiusX,r=i.radiusY,n=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new x(e*n,e*s),a=new x(-r*s,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=mo.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=bn.copy(u).invert(),y=Mn.copy(c).transpose().multiply(c).elements,w=xo(y[0],y[1],y[4]),d=Math.sqrt(w.rt1),C=Math.sqrt(w.rt2);if(i.radiusX=1/d,i.radiusY=1/C,i.rotation=Math.atan2(w.sn,w.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const M=bn.set(d,0,0,0,C,0,0,0,1),T=Mn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),b=M.multiply(T).multiply(u),v=A=>{const{x:S,y:P}=new x(Math.cos(A),Math.sin(A)).applyMatrix3(b);return Math.atan2(P,S)};i.startAngle=v(i.startAngle),i.endAngle=v(i.endAngle),xn(t)&&(i.clockwise=!i.clockwise)}}function bo(i,t){const e=_n(t),r=Sn(t);i.radiusX*=e,i.radiusY*=r;const n=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=n,xn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function xn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Mo(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=_n(i),n=Sn(i);return Math.abs(e/(r*n))>Number.EPSILON}function _n(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Sn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function xo(i,t,e){let r,n,s,o,a;const h=i+e,l=i-e,u=Math.sqrt(l*l+4*t*t);return h>0?(r=.5*(h+u),a=1/r,n=i*a*e-t*a*t):h<0?n=.5*(h-u):(r=.5*u,n=-.5*u),l>0?s=l+u:s=l-u,Math.abs(s)>2*Math.abs(t)?(a=-2*t/s,o=1/Math.sqrt(1+a*a),s=a*o):Math.abs(t)===0?(s=1,o=0):(a=-.5*s/t,s=1/Math.sqrt(1+a*a),o=a*s),l>0&&(a=s,s=-o,o=a),{rt1:r,rt2:n,cs:s,sn:o}}class gr extends qt{constructor(t=new x,e=new x){super(),this.start=t,this.end=e}getPoint(t,e=new x){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new x){return this.getPoint(t,e)}getTangent(t,e=new x){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new x){return this.getTangent(t,e)}getNormal(t,e=new x){const{x:r,y:n}=this.getPoint(t).sub(this.start);return e.set(n,-r).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getMinMax(t=x.MAX,e=x.MIN){const{start:r,end:n}=this;return t.x=Math.min(t.x,r.x,n.x),t.y=Math.min(t.y,r.y,n.y),e.x=Math.max(e.x,r.x,n.x),e.y=Math.max(e.y,r.y,n.y),{min:t,max:e}}getCommands(){const{start:t,end:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{end:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.end.copy(t.end),this}}class _o extends qt{constructor(t=new x,e=new x,r=new x){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new x){const{start:r,control:n,end:s}=this;return e.set(wn(t,r.x,n.x,s.x),wn(t,r.y,n.y,s.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=x.MAX,e=x.MIN){const{start:r,control:n,end:s}=this,o=.5*(r.x+n.x),a=.5*(r.y+n.y),h=.5*(r.x+s.x),l=.5*(r.y+s.y);return t.x=Math.min(t.x,r.x,s.x,o,h),t.y=Math.min(t.y,r.y,s.y,a,l),e.x=Math.max(e.x,r.x,s.x,o,h),e.y=Math.max(e.y,r.y,s.y,a,l),{min:t,max:e}}getCommands(){const{start:t,control:e,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:r.x,y:r.y}]}drawTo(t){const{control:e,end:r}=this;return t.quadraticCurveTo(e.x,e.y,r.x,r.y),this}copy(t){return super.copy(t),this.start.copy(t.start),this.control.copy(t.control),this.end.copy(t.end),this}}var So=Object.defineProperty,Co=(i,t,e)=>t in i?So(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Cn=(i,t,e)=>(Co(i,typeof t!="symbol"?t+"":t,e),e);class Po extends qt{constructor(t,e,r=1,n=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=r,this.start=n,this.end=s,Cn(this,"curves",[]),Cn(this,"curveT",0),this.update()}get x(){return this.center.x-this.rx}get y(){return this.center.y-this.rx/this.aspectRatio}get width(){return this.rx*2}get height(){return this.rx/this.aspectRatio*2}update(){const{x:t,y:e}=this.center,r=this.rx,n=this.rx/this.aspectRatio,s=[new x(t-r,e-n),new x(t+r,e-n),new x(t+r,e+n),new x(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new gr(s[o].clone(),s[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let r;return e<this.aspectRatio?(r=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(r=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(r=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(r=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[r]}getPoint(t,e){return this.getCurve(t).getPoint(this.curveT,e)}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){return this.getCurve(t).getTangent(this.curveT,e)}getNormal(t,e){return this.getCurve(t).getNormal(this.curveT,e)}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){return this.curves.forEach(e=>e.drawTo(t)),this}}class To extends qt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new x){const{points:r}=this,n=(r.length-1)*t,s=Math.floor(n),o=n-s,a=r[s===0?s:s-1],h=r[s],l=r[s>r.length-2?r.length-1:s+1],u=r[s>r.length-3?r.length-1:s+2];return e.set(mn(o,a.x,h.x,l.x,u.x),mn(o,a.y,h.y,l.y,u.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,r=t.points.length;e<r;e++)this.points.push(t.points[e].clone());return this}}var Oo=Object.defineProperty,Ao=(i,t,e)=>t in i?Oo(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ve=(i,t,e)=>(Ao(i,typeof t!="symbol"?t+"":t,e),e);class be extends qt{constructor(t){super(),ve(this,"curves",[]),ve(this,"startPoint"),ve(this,"currentPoint",new x),ve(this,"autoClose",!1),ve(this,"_cacheLengths",[]),t&&this.addPoints(t)}addCurve(t){return this.curves.push(t),this}addPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,r=t.length;e<r;e++){const{x:n,y:s}=t[e];this.lineTo(n,s)}return this}addCommands(t){return gn(t,this),this}addData(t){return this.addCommands(yn(t)),this}getPoint(t,e=new x){const r=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=r){const o=n[s]-r,a=this.curves[s],h=a.getLength();return a.getPointAt(h===0?0:1-o/h,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let r=0,n=this.curves.length;r<n;r++)e+=this.curves[r].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let r=0;r<=t;r++)e.push(this.getPoint(r/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[],r=this.curves;let n;for(let s=0,o=r.length;s<o;s++){const h=r[s].getPoints(t);for(let l=0;l<h.length;l++){const u=h[l];n!=null&&n.equals(u)||(e.push(u),n=u)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}_setCurrentPoint(t){return this.currentPoint.copy(t),this.startPoint||(this.startPoint=this.currentPoint.clone()),this}closePath(){const t=this.startPoint;if(t){const e=this.currentPoint;t.equals(e)||(this.curves.push(new gr(e.clone(),t)),this.currentPoint.copy(t)),this.startPoint=void 0}return this}moveTo(t,e){return this.currentPoint.set(t,e),this.startPoint=this.currentPoint.clone(),this}lineTo(t,e){return this.currentPoint.equals({x:t,y:e})||this.curves.push(new gr(this.currentPoint.clone(),new x(t,e))),this._setCurrentPoint({x:t,y:e}),this}bezierCurveTo(t,e,r,n,s,o){return this.currentPoint.equals({x:s,y:o})||this.curves.push(new yo(this.currentPoint.clone(),new x(t,e),new x(r,n),new x(s,o))),this._setCurrentPoint({x:s,y:o}),this}quadraticCurveTo(t,e,r,n){return this.currentPoint.equals({x:r,y:n})||this.curves.push(new _o(this.currentPoint.clone(),new x(t,e),new x(r,n))),this._setCurrentPoint({x:r,y:n}),this}arc(t,e,r,n,s,o){return this.ellipse(t,e,r,r,0,n,s,o),this}relativeArc(t,e,r,n,s,o){const a=this.currentPoint;return this.arc(t+a.x,e+a.y,r,n,s,o),this}arcTo(t,e,r,n,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,r,n,s,o,a,h=!0){const l=new wo(new x(t,e),r,n,s,o,a,!h);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}return this.curves.push(l),this._setCurrentPoint(l.getPoint(1)),this}relativeEllipse(t,e,r,n,s,o,a,h){const l=this.currentPoint;return this.ellipse(t+l.x,e+l.y,r,n,s,o,a,h),this}rect(t,e,r,n){return this.curves.push(new Po(new x(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new To([this.currentPoint.clone()].concat(t))),this._setCurrentPoint(t[t.length-1]),this}transformPoint(t){return this.curves.forEach(e=>e.transformPoint(t)),this}getMinMax(t=x.MAX,e=x.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new G(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.curves.flatMap(t=>t.getCommands())}drawTo(t){var r;const e=(r=this.curves[0])==null?void 0:r.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(n=>n.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,r=t.curves.length;e<r;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}function Do(i){return i.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Io=Object.defineProperty,No=(i,t,e)=>t in i?Io(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yr=(i,t,e)=>(No(i,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){yr(this,"currentPath",new be),yr(this,"paths",[this.currentPath]),yr(this,"style",{}),t&&(t instanceof bt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}get startPoint(){return this.currentPath.startPoint}get currentPoint(){return this.currentPath.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??"none")==="none"?0:1)}addPath(t){return t instanceof bt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){const t=this.startPoint;return t&&(this.currentPath.closePath(),this.currentPath.curves.length>0&&(this.currentPath=new be().moveTo(t.x,t.y),this.paths.push(this.currentPath))),this}moveTo(t,e){const{currentPoint:r,curves:n}=this.currentPath;return r.equals({x:t,y:e})||(n.length?(this.currentPath=new be().moveTo(t,e),this.paths.push(this.currentPath)):this.currentPath.moveTo(t,e)),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}bezierCurveTo(t,e,r,n,s,o){return this.currentPath.bezierCurveTo(t,e,r,n,s,o),this}quadraticCurveTo(t,e,r,n){return this.currentPath.quadraticCurveTo(t,e,r,n),this}arc(t,e,r,n,s,o){return this.currentPath.arc(t,e,r,n,s,o),this}arcTo(t,e,r,n,s){return this.currentPath.arcTo(t,e,r,n,s),this}ellipse(t,e,r,n,s,o,a,h){return this.currentPath.ellipse(t,e,r,n,s,o,a,h),this}rect(t,e,r,n){return this.currentPath.rect(t,e,r,n),this}addCommands(t){return gn(t,this),this}addData(t){return this.addCommands(yn(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(r=>t(r))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=x.MAX,e=x.MIN,r=!0){if(this.forEachCurve(n=>n.getMinMax(t,e)),r){const n=this.strokeWidth/2;t.x-=n,t.y-=n,e.x+=n,e.y+=n}return{min:t,max:e}}getBoundingBox(t=!0){const{min:e,max:r}=this.getMinMax(void 0,void 0,t);return new G(e.x,e.y,r.x-e.x,r.y-e.y)}getCommands(){return this.paths.flatMap(t=>t.getCommands())}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgPathXml(){const t={...this.style,fill:this.style.fill??"#000",stroke:this.style.stroke??"none"},e={};for(const n in t)t[n]!==void 0&&(e[Do(n)]=t[n]);Object.assign(e,{"stroke-width":`${this.strokeWidth}px`});let r="";for(const n in e)e[n]!==void 0&&(r+=`${n}:${e[n]};`);return`<path d="${this.getData()}" style="${r}"></path>`}getSvgXml(){const{x:t,y:e,width:r,height:n}=this.getBoundingBox(),s=this.getSvgPathXml();return`<svg viewBox="${t} ${e} ${r} ${n}" width="${r}px" height="${n}px" xmlns="http://www.w3.org/2000/svg">${s}</svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgXml())}`}drawTo(t,e={}){e={...this.style,...e};const{fill:r="#000",stroke:n="none"}=e;Ks(t,e),this.paths.forEach(s=>{s.drawTo(t)}),r!=="none"&&t.fill(),n!=="none"&&t.stroke()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.style={...t.style},this}toSvg(){return new DOMParser().parseFromString(this.getSvgXml(),"image/svg+xml").documentElement}toCanvas(t=2){const{left:e,top:r,width:n,height:s}=this.getBoundingBox(),o=document.createElement("canvas");o.width=n*t,o.height=s*t,o.style.width=`${n}px`,o.style.height=`${s}px`;const a=o.getContext("2d");return a&&(a.scale(t,t),a.translate(-e,-r),this.drawTo(a)),o}clone(){return new this.constructor().copy(this)}}const mr="px",Pn=90,Tn=["mm","cm","in","pt","pc","px"],wr={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 U(i){let t="px";if(typeof i=="string"||i instanceof String)for(let r=0,n=Tn.length;r<n;r++){const s=Tn[r];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&mr!=="px"?e=wr.in[mr]/Pn:(e=wr[t][mr],e<0&&(e=wr[t].in*Pn)),e*Number.parseFloat(i)}const zo=new wt,je=new wt,On=new wt,An=new wt;function Uo(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const r=Eo(i);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Eo(i){const t=new wt,e=zo;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(U(i.getAttribute("x")),U(i.getAttribute("y"))),i.hasAttribute("transform")){const r=i.getAttribute("transform").split(")");for(let n=r.length-1;n>=0;n--){const s=r[n].trim();if(s==="")continue;const o=s.indexOf("("),a=s.length;if(o>0&&o<a){const h=s.slice(0,o),l=Ot(s.slice(o+1));switch(e.identity(),h){case"translate":if(l.length>=1){const u=l[0];let c=0;l.length>=2&&(c=l[1]),e.translate(u,c)}break;case"rotate":if(l.length>=1){let u=0,c=0,p=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],p=l[2]),je.makeTranslation(-c,-p),On.makeRotation(u),An.multiplyMatrices(On,je),je.makeTranslation(c,p),e.multiplyMatrices(je,An)}break;case"scale":l.length>=1&&e.scale(l[0],l[1]??l[0]);break;case"skewX":l.length===1&&e.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":l.length===1&&e.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":l.length===6&&e.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1);break}}t.premultiply(e)}}return t}function Lo(i){return new bt().addPath(new be().arc(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("r")||0),0,Math.PI*2))}function $o(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const r=i.sheet.cssRules[e];if(r.type!==1)continue;const n=r.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<n.length;s++){const o=Object.fromEntries(Object.entries(r.style).filter(([,a])=>a!==""));t[n[s]]=Object.assign(t[n[s]]||{},o)}}}function Bo(i){return new bt().addPath(new be().ellipse(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("rx")||0),U(i.getAttribute("ry")||0),0,0,Math.PI*2))}function jo(i){return new bt().moveTo(U(i.getAttribute("x1")||0),U(i.getAttribute("y1")||0)).lineTo(U(i.getAttribute("x2")||0),U(i.getAttribute("y2")||0))}function ko(i){const t=new bt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Fo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Go(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Fo,(n,s,o)=>{const a=U(s),h=U(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Ro=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Vo(i){var r;const t=new bt;let e=0;return(r=i.getAttribute("points"))==null||r.replace(Ro,(n,s,o)=>{const a=U(s),h=U(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function Wo(i){const t=U(i.getAttribute("x")||0),e=U(i.getAttribute("y")||0),r=U(i.getAttribute("rx")||i.getAttribute("ry")||0),n=U(i.getAttribute("ry")||i.getAttribute("rx")||0),s=U(i.getAttribute("width")),o=U(i.getAttribute("height")),a=1-.551915024494,h=new bt;return h.moveTo(t+r,e),h.lineTo(t+s-r,e),(r!==0||n!==0)&&h.bezierCurveTo(t+s-r*a,e,t+s,e+n*a,t+s,e+n),h.lineTo(t+s,e+o-n),(r!==0||n!==0)&&h.bezierCurveTo(t+s,e+o-n*a,t+s-r*a,e+o,t+s-r,e+o),h.lineTo(t+r,e+o),(r!==0||n!==0)&&h.bezierCurveTo(t+r*a,e+o,t,e+o-n*a,t,e+o-n),h.lineTo(t,e+n),(r!==0||n!==0)&&h.bezierCurveTo(t,e+n*a,t+r*a,e,t+r,e),h}function At(i,t,e){t=Object.assign({},t);let r={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(l=>l.trim());for(let l=0;l<h.length;l++)r=Object.assign(r,e[`.${h[l]}`])}i.hasAttribute("id")&&(r=Object.assign(r,e[`#${i.getAttribute("id")}`]));function n(h,l,u){u===void 0&&(u=function(p){return p.startsWith("url")&&console.warn("url access in attributes is not implemented."),p}),i.hasAttribute(h)&&(t[l]=u(i.getAttribute(h))),r[h]&&(t[l]=u(r[h])),i.style&&i.style[h]!==""&&(t[l]=u(i.style[h]))}function s(h){return Math.max(0,Math.min(1,U(h)))}function o(h){return Math.max(0,U(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>U(l))}return n("fill","fill"),n("fill-opacity","fillOpacity",s),n("fill-rule","fillRule"),n("opacity","opacity",s),n("stroke","stroke"),n("stroke-opacity","strokeOpacity",s),n("stroke-width","strokeWidth",o),n("stroke-linecap","strokeLinecap"),n("stroke-linejoin","strokeLinejoin"),n("stroke-miterlimit","strokeMiterlimit",o),n("stroke-dasharray","strokeDasharray",a),n("stroke-dashoffset","strokeDashoffset",U),n("visibility","visibility"),t}function vr(i,t,e=[]){var u;if(i.nodeType!==1)return e;let r=!1,n=null;const s={};switch(i.nodeName){case"svg":t=At(i,t,s);break;case"style":$o(i,s);break;case"g":t=At(i,t,s);break;case"path":t=At(i,t,s),i.hasAttribute("d")&&(n=ko(i));break;case"rect":t=At(i,t,s),n=Wo(i);break;case"polygon":t=At(i,t,s),n=Go(i);break;case"polyline":t=At(i,t,s),n=Vo(i);break;case"circle":t=At(i,t,s),n=Lo(i);break;case"ellipse":t=At(i,t,s),n=Bo(i);break;case"line":t=At(i,t,s),n=jo(i);break;case"defs":r=!0;break;case"use":{t=At(i,t,s);const p=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(u=i.viewportElement)==null?void 0:u.getElementById(p);g?vr(g,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(i);break}const o=new wt,a=[],h=Uo(i,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=i.childNodes;for(let c=0,p=l.length;c<p;c++){const g=l[c];r&&g.nodeName!=="style"&&g.nodeName!=="defs"||vr(g,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Dn="data:image/svg+xml;",In=`${Dn}base64,`,Nn=`${Dn}charset=utf8,`;function zn(i){if(typeof i=="string"){let t;return i.startsWith(In)?(i=i.substring(In.length,i.length),t=atob(i)):i.startsWith(Nn)?(i=i.substring(Nn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function br(i){return vr(zn(i),{})}function ke(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function Un(i,t){const{x:e,y:r}=i,n=Math.sin(t),s=Math.cos(t);return{x:e*s-r*n,y:e*n+r*s}}function Mr(i,t,e,r){const n=i.x-t.x,s=i.y-t.y;return{x:t.x+(n+Math.tan(e)*s),y:t.y+(s+Math.tan(r)*n)}}function En(i,t,e,r){const n=e<0?t.x-i.x+t.x:i.x,s=r<0?t.y-i.y+t.y:i.y;return{x:n*Math.abs(e),y:s*Math.abs(r)}}function Ln(i,t,e=0,r=0,n=0,s=1,o=1){let a=Array.isArray(i)?i:[i];const h=-e/180*Math.PI,{x:l,y:u}=t;return(s!==1||o!==1)&&(a=a.map(c=>En(c,t,s,o))),(r||n)&&(a=a.map(c=>Mr(c,t,r,n))),a=a.map(c=>{const p=c.x-l,g=-(c.y-u);return c=Un({x:p,y:g},h),{x:l+c.x,y:u-c.y}}),a[0]}const qo=new Set(["©","®","÷"]),Ho=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class $n{constructor(t,e,r){D(this,"boundingBox",new G);D(this,"textWidth",0);D(this,"textHeight",0);D(this,"glyphHeight",0);D(this,"glyphWidth",0);D(this,"underlinePosition",0);D(this,"underlineThickness",0);D(this,"yStrikeoutPosition",0);D(this,"yStrikeoutSize",0);D(this,"baseline",0);D(this,"centerDiviation",0);D(this,"path",new bt);D(this,"glyphBox",new G);D(this,"center",new x);this.content=t,this.index=e,this.parent=r}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes("vertical")}get fontSize(){return this.computedStyle.fontSize}_font(){var e;const t=(e=un.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Ut||t instanceof it)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:r,descender:n,os2:s,post:o}=t,{content:a,computedStyle:h,boundingBox:l}=this,{height:u}=l,{fontSize:c}=h,p=e/c,g=t.getAdvanceWidth(a,c),y=(r+Math.abs(n))/p,w=r/p,d=(r-s.yStrikeoutPosition)/p,C=s.yStrikeoutSize/p,_=(r-o.underlinePosition)/p,M=o.underlineThickness/p;return this.glyphWidth=g,this.glyphHeight=y,this.underlinePosition=_,this.underlineThickness=M,this.yStrikeoutPosition=d,this.yStrikeoutSize=C,this.baseline=w,this.centerDiviation=.5*u-w,this}updatePath(){const t=this._font();if(!t)return this;const{isVertical:e,content:r,textWidth:n,textHeight:s,boundingBox:o,computedStyle:a,baseline:h,glyphHeight:l,glyphWidth:u}=this.updateGlyph(t),{os2:c,ascender:p,descender:g}=t,y=p,w=g,d=c.sTypoAscender,{left:C,top:_}=o,{fontSize:M,fontStyle:T}=a;let b=C,v=_+h,A,S;if(e&&(b+=(l-u)/2,Math.abs(n-s)>.1&&(v-=(y-d)/(y+Math.abs(w))*l),A=void 0),e&&!qo.has(r)&&(r.codePointAt(0)<=256||Ho.has(r))){S=t.getPathCommands(r,b,_+h-(l-u)/2,M)??[];const L={y:_-(l-u)/2+l/2,x:b+u/2};T==="italic"&&(S=this._italic(S,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),S=this._rotation90(S,L)}else A!==void 0?(S=t.glyphs.get(A).getPathCommands(b,v,M),T==="italic"&&(S=this._italic(S,e?{x:b+u/2,y:_+d/(y+Math.abs(w))*l}:void 0))):(S=t.getPathCommands(r,b,v,M)??[],T==="italic"&&(S=this._italic(S,e?{x:b+l/2,y:v}:void 0)));S.push(...this._decoration());const P=new bt(S);return P.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*M*.03:0},this.path=P,this.glyphBox=this.getGlyphBoundingBox(),this.center=this.glyphBox.getCenterPoint(),this}update(){return this.updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:r}=this,{textDecoration:n,fontSize:s}=this.computedStyle,{left:o,top:a,width:h,height:l}=this.boundingBox,u=.1*s;let c;switch(n){case"underline":t?c=o:c=a+e;break;case"line-through":t?c=o+h/2:c=a+r;break;case"none":default:return[]}return t?[{type:"M",x:c,y:a},{type:"L",x:c,y:a+l},{type:"L",x:c+u,y:a+l},{type:"L",x:c+u,y:a},{type:"Z"}]:[{type:"M",x:o,y:c},{type:"L",x:o+h,y:c},{type:"L",x:o+h,y:c+u},{type:"L",x:o,y:c+u},{type:"Z"}]}_italic(t,e){const{baseline:r,glyphWidth:n}=this,{left:s,top:o}=this.boundingBox,a=e||{y:o+r,x:s+n/2};return this._transform(t,(h,l)=>{const u=Mr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const s=Ln({x:r,y:n},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(r=>{const n={...r};switch(n.type){case"L":case"M":[n.x,n.y]=e(n.x,n.y);break;case"Q":[n.x1,n.y1]=e(n.x1,n.y1),[n.x,n.y]=e(n.x,n.y);break;case"C":[n.x1,n.y1]=e(n.x1,n.y1),[n.x2,n.y2]=e(n.x2,n.y2),[n.x,n.y]=e(n.x,n.y);break}return n})}getGlyphMinMax(t,e,r){var n;return(n=this.path.paths[0])!=null&&n.curves.length?this.path.getMinMax(t,e,r):(t??(t=x.MAX),e??(e=x.MIN),t.x=Math.min(t.x,this.boundingBox.left),t.y=Math.min(t.y,this.boundingBox.top),e.x=Math.max(e.x,this.boundingBox.right),e.y=Math.max(e.y,this.boundingBox.bottom),{min:t,max:e})}getGlyphBoundingBox(t){const{min:e,max:r}=this.getGlyphMinMax(void 0,void 0,t);return new G(e.x,e.y,r.x-e.x,r.y-e.y)}drawTo(t,e={}){Ge({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Bn{constructor(t,e={},r){D(this,"boundingBox",new G);D(this,"highlight");this.content=t,this.style=e,this.parent=r,this.updateComputedStyle().initCharacters()}get computedContent(){const t=this.computedStyle;return t.textTransform==="uppercase"?this.content.toUpperCase():t.textTransform==="lowercase"?this.content.toLowerCase():this.content}updateComputedStyle(){return this.computedStyle={...this.parent.computedStyle,...ke(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new $n(r,e++,this));return this.characters=t,this}}class te{constructor(t,e){D(this,"boundingBox",new G);D(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...ke(this.parentStyle),...ke(this.style)},this}addFragment(t,e){const r=new Bn(t,e,this);return this.fragments.push(r),r}}class Ht{constructor(t){this._text=t}}class jn extends Ht{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}const ee=new wt,jt=new wt,kt=new x;class kn extends Ht{getTransform2D(t){const{fontSize:e,renderBoundingBox:r}=this._text,n=(t.offsetX??0)*e,s=(t.offsetY??0)*e,o=Math.PI*2,a=(t.skewX??0)/360*o,h=(t.skewY??0)/360*o,{left:l,top:u,width:c,height:p}=r,g=l+c/2,y=u+p/2;return ee.identity(),jt.makeTranslation(n,s),ee.multiply(jt),jt.makeTranslation(g,y),ee.multiply(jt),jt.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),ee.multiply(jt),jt.makeTranslation(-g,-y),ee.multiply(jt),ee.clone()}getBoundingBox(){const{characters:t,effects:e,fontSize:r}=this._text,n=[];return t.forEach(s=>{e==null||e.forEach(o=>{const a=s.glyphBox.clone(),h=this.getTransform2D(o);kt.set(a.left,a.top),kt.applyMatrix3(h),a.left=kt.x,a.top=kt.y,kt.set(a.right,a.bottom),kt.applyMatrix3(h),a.width=kt.x-a.left,a.height=kt.y-a.top;const l=(o.shadowOffsetX??0)*r,u=(o.shadowOffsetY??0)*r,c=Math.max(.1,o.textStrokeWidth??0)*r;a.left+=l-c,a.top+=u-c,a.width+=c*2,a.height+=c*2,n.push(a)})}),G.from(...n)}draw(t){const{ctx:e}=t,{effects:r,characters:n,renderBoundingBox:s}=this._text;return r&&r.forEach(o=>{Ct(o,s,e),e.save();const[a,h,l,u,c,p]=this.getTransform2D(o).transpose().elements;e.transform(a,u,h,c,l,p),n.forEach(g=>{g.drawTo(e,o)}),e.restore()}),this}}const Fn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MiIgaGVpZ2h0PSI3MiIgdmlld0JveD0iMCAwIDcyIDcyIiBmaWxsPSJub25lIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTMyLjQwMjkgMjhIMzUuMTU5NFYzMy4xNzcxQzM1Ljk4MjEgMzIuMzExNSAzNi45NzEgMzEuODczNyAzOC4wOTQ4IDMxLjg3MzdDMzkuNjY3NiAzMS44NzM3IDQwLjkxNjYgMzIuNDI5NSA0MS44MzkgMzMuNTQzN0w0MS44NDAzIDMzLjU0NTNDNDIuNjcxNyAzNC41NzA1IDQzLjA5MTUgMzUuODU1OSA0My4wOTE1IDM3LjM4NzdDNDMuMDkxNSAzOC45NzYxIDQyLjY3MjkgNDAuMzAyOCA0MS44MTgzIDQxLjMzMDRMNDEuODE3MSA0MS4zMzE4QzQwLjg3MzEgNDIuNDQ2MSAzOS41ODMyIDQzIDM3Ljk3MjEgNDNDMzYuNzQ3NyA0MyAzNS43NDg4IDQyLjY1OTkgMzQuOTk1OCA0MS45NjkzVjQyLjcyNDdIMzIuNDAyOVYyOFpNMzcuNTQyOCAzNC4wOTI0QzM2Ljg1NDkgMzQuMDkyNCAzNi4zMDE0IDM0LjM1NjEgMzUuODQ4NyAzNC45MDA0TDM1Ljg0NTIgMzQuOTA0NkMzNS4zMzU4IDM1LjQ4NTMgMzUuMDc3NiAzNi4yOTc2IDM1LjA3NzYgMzcuMzQ4NFYzNy41MDU3QzM1LjA3NzYgMzguNDY0IDM1LjI3NzIgMzkuMjQ0MyAzNS42OTQzIDM5LjgyNzlDMzYuMTQ0MSA0MC40NTg3IDM2Ljc3MjYgNDAuNzgxMyAzNy42MjQ1IDQwLjc4MTNDMzguNTg3NCA0MC43ODEzIDM5LjI3MDcgNDAuNDUyNyAzOS43MTUyIDM5LjgxMjdDNDAuMDcyOCAzOS4yNjg0IDQwLjI3MzcgMzguNDY3MyA0MC4yNzM3IDM3LjM4NzdDNDAuMjczNyAzNi4zMTA1IDQwLjA1MzMgMzUuNTMxMyAzOS42NzgzIDM1LjAwNzdDMzkuMjM3MSAzNC40MDcxIDM4LjUzNDIgMzQuMDkyNCAzNy41NDI4IDM0LjA5MjRaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZD0iTTQ5Ljg2MTQgMzEuODczN0M0OC4xNTM1IDMxLjg3MzcgNDYuODAxNiAzMi40MjM5IDQ1LjgzNDggMzMuNTM5MkM0NC45MzcgMzQuNTQ3MiA0NC40OTY2IDM1Ljg1NiA0NC40OTY2IDM3LjQyN0M0NC40OTY2IDM5LjAzNjggNDQuOTM2NyA0MC4zNjU5IDQ1Ljg1NTkgNDEuMzk0M0M0Ni44MDMxIDQyLjQ3MDYgNDguMTM0OCA0MyA0OS44MjA1IDQzQzUxLjIyNiA0MyA1Mi4zODI2IDQyLjY1NjMgNTMuMjQ3OSA0MS45Njk3QzU0LjEzNTkgNDEuMjYxNCA1NC43MDYxIDQwLjE4ODcgNTQuOTU3MyAzOC43NzkxTDU1IDM4LjUzOTdINTIuMjQ4NEw1Mi4yMjU5IDM4LjcyMDFDNTIuMTM3OSAzOS40MjUxIDUxLjg5MjUgMzkuOTI3OCA1MS41MTA5IDQwLjI1NThDNTEuMTI5NSA0MC41ODM1IDUwLjU4MzEgNDAuNzYxNiA0OS44NDA5IDQwLjc2MTZDNDkuMDAwMSA0MC43NjE2IDQ4LjM5NDkgNDAuNDcxNSA0Ny45OTA3IDM5LjkyMzdMNDcuOTg3NCAzOS45MTk0QzQ3LjUzNTYgMzkuMzQwMSA0Ny4zMTQ0IDM4LjUwNjIgNDcuMzE0NCAzNy40MDc0QzQ3LjMxNDQgMzYuMzMyMiA0Ny41NTQ0IDM1LjUxNzcgNDguMDA1OCAzNC45NTY4TDQ4LjAwNzggMzQuOTU0M0M0OC40NTM3IDM0LjM4MjUgNDkuMDYxOCAzNC4xMTIxIDQ5Ljg2MTQgMzQuMTEyMUM1MC41MjMgMzQuMTEyMSA1MS4wNDUxIDM0LjI2MTUgNTEuNDI3MiAzNC41NDA3QzUxLjc4ODQgMzQuODE5NCA1Mi4wNTMgMzUuMjQ0NyA1Mi4xODgxIDM1Ljg1NzFMNTIuMjIzOSAzNi4wMTk0SDU0Ljk1NDhMNTQuOTE3IDM1Ljc4MzVDNTQuNzA2MyAzNC40NjYgNTQuMTUzNiAzMy40NzAxIDUzLjI2MzQgMzIuODAxOUw1My4yNjAyIDMyLjc5OTVDNTIuMzk1MSAzMi4xNzU1IDUxLjI2MjEgMzEuODczNyA0OS44NjE0IDMxLjg3MzdaIiBmaWxsPSIjMjIyNTI5Ii8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNS43NTYxIDI4LjI3NTNIMjIuNzQ0TDE3IDQyLjcyNDdIMjAuMDE0MUwyMS4zNDI5IDM5LjIwNDlIMjcuMTU3MkwyOC40ODYgNDIuNzI0N0gzMS41MDAxTDI1Ljc1NjEgMjguMjc1M1pNMjIuMjEyNSAzNi45MDc2TDI0LjI1OTYgMzEuNDUzOUwyNi4yODg1IDM2LjkwNzZIMjIuMjEyNVoiIGZpbGw9IiMyMjI1MjkiLz48L3N2Zz4=",re=class re extends Ht{constructor(){super(...arguments);D(this,"paths",[])}static get refer(){return this._refer}static set refer(e){this._refer=e,this.parsedRefer=br(e)}getReferBoundingBox(){const e=x.MIN,r=x.MAX;return re.parsedRefer.forEach(n=>{n.getMinMax(r,e)}),new G(r.x,r.y,e.x-r.x,e.y-r.y)}getBoundingBox(){if(!this.paths.length)return;const e=x.MAX,r=x.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new G(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(e=!1){const{characters:r}=this._text;let n;const s=[];let o;r.forEach(a=>{const h=a.parent.highlight;h!=null&&h.url&&(!e&&(o==null?void 0:o.url)===h.url&&(o==null?void 0:o.strokeWidth)===h.strokeWidth&&(o==null?void 0:o.repeatXByFontsize)===h.repeatXByFontsize&&(o==null?void 0:o.overflowXHidden)===h.overflowXHidden&&n.length&&n[0].boundingBox.top===a.boundingBox.top&&n[0].fontSize===a.fontSize?n.push(a):(n=[],n.push(a),s.push(n))),o=h}),this.paths=s.filter(a=>a.length).map(a=>({highlight:a[0].parent.highlight,box:G.from(...a.map(h=>h.glyphBox)),baseline:Math.max(...a.map(h=>h.baseline)),fontSize:a[0].fontSize})).map(a=>this._parseGroup(a)).flat()}_parseSvg(e){const r=zn(e),n=br(r),s=x.MAX,o=x.MIN;return n.forEach(a=>a.getMinMax(s,o)),{paths:n,box:new G(s.x,s.y,o.x-s.x,o.y-s.y)}}_parseGroup(e){const{highlight:r,box:n,fontSize:s}=e,{strokeWidth:o=1,repeatXByFontsize:a=0,overflowXHidden:h=!!a}=r,{box:l,paths:u}=this._parseSvg(r.url),c=[],p=this.getReferBoundingBox(),g={x:a?s*a*(l.width/p.width)/l.width:n.width*(l.width/p.width)/l.width,y:n.height*(l.height/p.height)/l.height},y=s/l.width*2,w=l.width*g.x,d=Math.ceil(n.width/w),C={x:(l.left-p.left)*g.x,y:(l.top-p.top)*g.y},_=new wt().translate(-l.left,-l.top).scale(g.x,g.y).translate(n.left,n.top).translate(C.x,C.y);for(let M=0;M<d;M++){const T=_.clone().translate(M*w,0);u.forEach(b=>{const v=b.clone().transform(T);v.style.strokeWidth&&(v.style.strokeWidth*=y*o),v.style.strokeMiterlimit&&(v.style.strokeMiterlimit*=y),v.style.strokeDashoffset&&(v.style.strokeDashoffset*=y),v.style.strokeDasharray&&(v.style.strokeDasharray=v.style.strokeDasharray.map(A=>A*y)),c.push({clipRect:h?new G(n.left+C.x*2,n.top-n.height,n.width-C.x*2,n.height*3):void 0,path:v})})}return c}draw({ctx:e}){return this.paths.forEach(r=>{Ge({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}};D(re,"_refer",Fn),D(re,"parsedRefer",br(re._refer));let Fe=re;class Gn extends Ht{_styleToDomStyle(t){const e={...t};for(const r in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(r)?e[r]=`${t[r]}px`:e[r]=t[r];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,r=document.createDocumentFragment(),n=document.createElement("section");Object.assign(n.style,{width:"max-content",height:"max-content",...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const a=document.createElement("li");Object.assign(a.style,this._styleToDomStyle(o.style)),o.fragments.forEach(h=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(h.style)),l.appendChild(document.createTextNode(h.content)),a.appendChild(l)}),s.appendChild(a)}),n.appendChild(s),r.appendChild(n),document.body.appendChild(r),{dom:n,destory:()=>{var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}}}_measureDom(t){const e=[],r=[],n=[];return t.querySelectorAll("li").forEach((s,o)=>{const a=s.getBoundingClientRect();e.push({paragraphIndex:o,left:a.left,top:a.top,width:a.width,height:a.height}),s.querySelectorAll("span").forEach((h,l)=>{var p;const u=s.getBoundingClientRect();r.push({paragraphIndex:o,fragmentIndex:l,left:u.left,top:u.top,width:u.width,height:u.height});const c=h.firstChild;if(c instanceof window.Text){const g=document.createRange();g.selectNodeContents(c);const y=c.data?c.data.length:0;let w=0;for(;w<=y;){g.setStart(c,Math.max(w-1,0)),g.setEnd(c,w);const d=((p=g.getClientRects)==null?void 0:p.call(g))??[g.getBoundingClientRect()];let C=d[d.length-1];d.length>1&&C.width<2&&(C=d[d.length-2]);const _=g.toString();_!==""&&C&&C.width+C.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:C.top,left:C.left,height:C.height,width:C.width,textWidth:-1,textHeight:-1}),w++}}})}),{paragraphs:e,fragments:r,characters:n}}measureDom(t){const{paragraphs:e}=this._text,r=t.getBoundingClientRect(),n=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=n.style.lineHeight;n.style.lineHeight="4000px";const a=[[]];let h=a[0];const{characters:l}=this._measureDom(t);l.length>0&&(h.push(l[0]),l.reduce((g,y)=>{const w=s?"left":"top";return Math.abs(y[w]-g[w])>4e3/2&&(h=[],a.push(h)),h.push(y),y})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(g=>{const y=e[g.paragraphIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height}),u.fragments.forEach(g=>{const y=e[g.paragraphIndex].fragments[g.fragmentIndex];y.boundingBox.left=g.left-r.left,y.boundingBox.top=g.top-r.top,y.boundingBox.width=g.width,y.boundingBox.height=g.height});const c=[];let p=0;return a.forEach(g=>{g.forEach(y=>{const w=u.characters[p],{paragraphIndex:d,fragmentIndex:C,characterIndex:_}=w;c.push({...w,newParagraphIndex:d,textWidth:y.width,textHeight:y.height,left:w.left-r.left,top:w.top-r.top});const M=e[d].fragments[C].characters[_];M.boundingBox.left=c[p].left,M.boundingBox.top=c[p].top,M.boundingBox.width=c[p].width,M.boundingBox.height=c[p].height,M.textWidth=c[p].textWidth,M.textHeight=c[p].textHeight,p++})}),{paragraphs:e,boundingBox:new G(0,0,r.width,r.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const r=this.measureDom(t);return e==null||e(),r}}class Rn extends Ht{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new te({},e);n.addFragment(t),r.push(n)}else{t=Array.isArray(t)?t:[t];for(const n of t)if(typeof n=="string"){const s=new te({},e);s.addFragment(n),r.push(s)}else if(Array.isArray(n)){const s=new te({},e);n.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:a,highlight:h,...l}=o;if(a!==void 0){const u=s.addFragment(a,l);u.highlight=h}}}),r.push(s)}else if("fragments"in n){const{fragments:s,...o}=n,a=new te(o,e);s.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const p=a.addFragment(l,c);p.highlight=u}}),r.push(a)}else if("content"in n){const{content:s,highlight:o,...a}=n;if(s!==void 0){const h=new te(a,e),l=h.addFragment(s);l.highlight=o,r.push(h)}}}return r}}class Xo extends Ht{}class Vn extends Ht{setupView(t){const{ctx:e,pixelRatio:r}=t,{renderBoundingBox:n}=this._text,{left:s,top:o,width:a,height:h}=n,l=e.canvas;return l.dataset.viewbox=`${s} ${o} ${a} ${h}`,l.dataset.pixelRatio=String(r),l.width=Math.max(1,Math.ceil(a*r)),l.height=Math.max(1,Math.ceil(h*r)),l.style.marginTop=`${o}px`,l.style.marginLeft=`${s}px`,l.style.width=`${a}px`,l.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(r,r),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:r,computedStyle:n,renderBoundingBox:s}=this._text;return Ct(n,s,e),r.forEach(o=>{Ct(o.computedStyle,o.boundingBox,e),o.fragments.forEach(a=>{Ct(a.computedStyle,a.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:r,paragraphs:n}=this._text;function s(o,a,h,l,u){e.fillStyle=o,e.fillRect(a,h,l,u)}return r!=null&&r.backgroundColor&&s(r.backgroundColor,0,0,e.canvas.width,e.canvas.height),n.forEach(o=>{var a;(a=o.style)!=null&&a.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(h=>{var l;(l=h.style)!=null&&l.backgroundColor&&s(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:r}=this._text;return r.forEach(n=>{n.drawTo(e)}),this}}const xr={color:"#000",backgroundColor:"rgba(0, 0, 0, 0)",fontSize:14,fontWeight:"normal",fontFamily:"_fallback",fontStyle:"normal",fontKerning:"normal",textWrap:"wrap",textAlign:"start",verticalAlign:"baseline",textTransform:"none",textDecoration:"none",textStrokeWidth:0,textStrokeColor:"#000",lineHeight:1,letterSpacing:0,shadowColor:"rgba(0, 0, 0, 0)",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,writingMode:"horizontal-tb",textOrientation:"mixed"};class Qo{constructor(t={}){D(this,"content");D(this,"style");D(this,"effects");D(this,"deformation");D(this,"measureDom");D(this,"needsUpdate",!0);D(this,"computedStyle",{...xr});D(this,"paragraphs",[]);D(this,"boundingBox",new G);D(this,"renderBoundingBox",new G);D(this,"parser",new Rn(this));D(this,"measurer",new Gn(this));D(this,"deformer",new jn(this));D(this,"effector",new kn(this));D(this,"highlighter",new Fe(this));D(this,"renderer2D",new Vn(this));const{content:e="",style:r={},effects:n,deformation:s,measureDom:o}=t;this.content=e,this.style=r,this.effects=n,this.deformation=s,this.measureDom=o}get fontSize(){return this.computedStyle.fontSize}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...xr,...this.style};const e=this.paragraphs;this.paragraphs=this.parser.parse();const r=this.measurer.measure(t);return this.paragraphs=e,r}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const r=this.characters;r.forEach(o=>o.update()),this.deformation?this.deformer.deform():this.highlighter.highlight();const n=x.MAX,s=x.MIN;return r.forEach(o=>o.getGlyphMinMax(n,s)),this.renderBoundingBox=new G(n.x,n.y,s.x-n.x,s.y-n.y),this}render(t){var s,o;const{view:e,pixelRatio:r=2}=t,n=e.getContext("2d");return n?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=G.from(...[this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()].filter(Boolean)):this.renderBoundingBox=G.from(...[this.renderBoundingBox,this.highlighter.getBoundingBox()].filter(Boolean)),this.renderer2D.setupView({pixelRatio:r,ctx:n}),this.renderer2D.uploadColors({ctx:n}),this.highlighter.draw({ctx:n}),(o=this.effects)!=null&&o.length?this.effector.draw({ctx:n}):this.renderer2D.draw({ctx:n}),this):this}}f.Character=$n,f.CmapSubtableFormat0=ir,f.CmapSubtableFormat12=lr,f.CmapSubtableFormat14=ge,f.CmapSubtableFormat2=fe,f.CmapSubtableFormat4=ar,f.CmapSubtableFormat6=Rt,f.Deformer=jn,f.Effector=kn,f.Eot=Si,f.Font=Pe,f.Fonts=cn,f.Fragment=Bn,f.Glyph=Je,f.GlyphSet=tr,f.Highlighter=Fe,f.Measurer=Gn,f.Paragraph=te,f.Parser=Rn,f.Reflector=Xo,f.Renderer2D=Vn,f.Sfnt=he,f.TableDirectory=Yt,f.Text=Qo,f.Ttf=it,f.Woff=Ut,f.WoffTableDirectoryEntry=Wt,f.componentFlags=Kt,f.createCmapSegments=or,f.defaultHighlightRefer=Fn,f.defaultTextStyles=xr,f.defineSfntTable=nt,f.drawPath=Ge,f.filterEmpty=ke,f.fonts=un,f.getPointPosition=Ln,f.getRotationPoint=Un,f.getScalePoint=En,f.getSkewPoint=Mr,f.minify=Ys,f.minifyGlyphs=fn,f.minifySfnt=pn,f.parse=ln,f.parseColor=st,f.uploadColor=Ct,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -161,10 +161,22 @@ class Character {
161
161
  this.content = content;
162
162
  this.index = index;
163
163
  this.parent = parent;
164
+ // measure dom
164
165
  __publicField$4(this, "boundingBox", new BoundingBox());
165
166
  __publicField$4(this, "textWidth", 0);
166
167
  __publicField$4(this, "textHeight", 0);
168
+ // font glyph
169
+ __publicField$4(this, "glyphHeight", 0);
170
+ __publicField$4(this, "glyphWidth", 0);
171
+ __publicField$4(this, "underlinePosition", 0);
172
+ __publicField$4(this, "underlineThickness", 0);
173
+ __publicField$4(this, "yStrikeoutPosition", 0);
174
+ __publicField$4(this, "yStrikeoutSize", 0);
175
+ __publicField$4(this, "baseline", 0);
176
+ __publicField$4(this, "centerDiviation", 0);
167
177
  __publicField$4(this, "path", new Path2D());
178
+ __publicField$4(this, "glyphBox", new BoundingBox());
179
+ __publicField$4(this, "center", new Vector2());
168
180
  }
169
181
  get computedStyle() {
170
182
  return this.parent.computedStyle;
@@ -392,7 +404,7 @@ class Character {
392
404
  }
393
405
  getGlyphBoundingBox(withStyle) {
394
406
  const { min, max } = this.getGlyphMinMax(void 0, void 0, withStyle);
395
- return new BoundingBox(min.x, min.y, max.x - max.x, max.y - max.y);
407
+ return new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
396
408
  }
397
409
  drawTo(ctx, config = {}) {
398
410
  drawPath({
@@ -730,6 +742,8 @@ class Measurer extends Feature {
730
742
  const documentFragment = document.createDocumentFragment();
731
743
  const dom = document.createElement("section");
732
744
  Object.assign(dom.style, {
745
+ width: "max-content",
746
+ height: "max-content",
733
747
  ...this._styleToDomStyle(computedStyle),
734
748
  position: "absolute",
735
749
  visibility: "hidden"
@@ -849,15 +863,15 @@ class Measurer extends Feature {
849
863
  const measured = this._measureDom(dom);
850
864
  measured.paragraphs.forEach((p) => {
851
865
  const _p = paragraphs[p.paragraphIndex];
852
- _p.boundingBox.left = p.left;
853
- _p.boundingBox.top = p.top;
866
+ _p.boundingBox.left = p.left - rect.left;
867
+ _p.boundingBox.top = p.top - rect.top;
854
868
  _p.boundingBox.width = p.width;
855
869
  _p.boundingBox.height = p.height;
856
870
  });
857
871
  measured.fragments.forEach((f) => {
858
872
  const _f = paragraphs[f.paragraphIndex].fragments[f.fragmentIndex];
859
- _f.boundingBox.left = f.left;
860
- _f.boundingBox.top = f.top;
873
+ _f.boundingBox.left = f.left - rect.left;
874
+ _f.boundingBox.top = f.top - rect.top;
861
875
  _f.boundingBox.width = f.width;
862
876
  _f.boundingBox.height = f.height;
863
877
  });
@@ -982,8 +996,7 @@ class Renderer2D extends Feature {
982
996
  uploadColors(options) {
983
997
  const { ctx } = options;
984
998
  const { paragraphs, computedStyle: style, renderBoundingBox } = this._text;
985
- const { width, height } = renderBoundingBox;
986
- uploadColor(style, new BoundingBox(0, 0, width, height), ctx);
999
+ uploadColor(style, renderBoundingBox, ctx);
987
1000
  paragraphs.forEach((paragraph) => {
988
1001
  uploadColor(paragraph.computedStyle, paragraph.boundingBox, ctx);
989
1002
  paragraph.fragments.forEach((fragment) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.26",
4
+ "version": "0.2.28",
5
5
  "packageManager": "pnpm@9.9.0",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",