modern-text 0.2.16 → 0.2.18

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
@@ -56,26 +56,23 @@ function drawPath(options) {
56
56
  const { ctx, path, fontSize, clipRect } = options;
57
57
  ctx.save();
58
58
  ctx.beginPath();
59
- const style = path.style;
60
- path.style = {
61
- ...style,
62
- fill: options.color ?? style.fill,
63
- stroke: options.textStrokeColor ?? style.stroke,
64
- strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
59
+ const pathStyle = path.style;
60
+ const style = {
61
+ ...pathStyle,
62
+ fill: options.color ?? pathStyle.fill,
63
+ stroke: options.textStrokeColor ?? pathStyle.stroke,
64
+ strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : pathStyle.strokeWidth,
65
65
  shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
66
66
  shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
67
67
  shadowBlur: (options.shadowBlur ?? 0) * fontSize,
68
68
  shadowColor: options.shadowColor
69
69
  };
70
- const offsetX = (options.offsetX ?? 0) * fontSize;
71
- const offsetY = (options.offsetY ?? 0) * fontSize;
72
- ctx.translate(offsetX, offsetY);
73
70
  if (clipRect) {
74
71
  ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
75
72
  ctx.clip();
76
73
  ctx.beginPath();
77
74
  }
78
- path.drawTo(ctx);
75
+ path.drawTo(ctx, style);
79
76
  ctx.restore();
80
77
  }
81
78
 
@@ -475,21 +472,51 @@ class Deformer extends Feature {
475
472
  }
476
473
  }
477
474
 
475
+ const tempM1 = new modernPath2d.Matrix3();
476
+ const tempM2 = new modernPath2d.Matrix3();
477
+ const tempV1 = new modernPath2d.Vector2();
478
478
  class Effector extends Feature {
479
+ getTransform2D(style) {
480
+ const { fontSize, renderBoundingBox } = this._text;
481
+ const offsetX = (style.offsetX ?? 0) * fontSize;
482
+ const offsetY = (style.offsetY ?? 0) * fontSize;
483
+ const PI_2 = Math.PI * 2;
484
+ const skewX = (style.skewX ?? 0) / 360 * PI_2;
485
+ const skewY = (style.skewY ?? 0) / 360 * PI_2;
486
+ const { left, top, width, height } = renderBoundingBox;
487
+ const centerX = left + width / 2;
488
+ const centerY = top + height / 2;
489
+ tempM1.identity();
490
+ tempM2.makeTranslation(offsetX, offsetY);
491
+ tempM1.multiply(tempM2);
492
+ tempM2.makeTranslation(centerX, centerY);
493
+ tempM1.multiply(tempM2);
494
+ tempM2.set(1, Math.tan(skewX), 0, Math.tan(skewY), 1, 0, 0, 0, 1);
495
+ tempM1.multiply(tempM2);
496
+ tempM2.makeTranslation(-centerX, -centerY);
497
+ tempM1.multiply(tempM2);
498
+ return tempM1.clone();
499
+ }
479
500
  getBoundingBox() {
480
- const { characters, effects } = this._text;
501
+ const { characters, effects, fontSize } = this._text;
481
502
  const boxes = [];
482
503
  characters.forEach((character) => {
483
- const fontSize = character.computedStyle.fontSize;
484
- effects?.forEach((effect) => {
485
- const offsetX = (effect.offsetX ?? 0) * fontSize;
486
- const offsetY = (effect.offsetY ?? 0) * fontSize;
487
- const shadowOffsetX = (effect.shadowOffsetX ?? 0) * fontSize;
488
- const shadowOffsetY = (effect.shadowOffsetY ?? 0) * fontSize;
489
- const textStrokeWidth = Math.max(0.1, effect.textStrokeWidth ?? 0) * fontSize;
504
+ effects?.forEach((style) => {
490
505
  const aabb = character.boundingBox.clone();
491
- aabb.left += offsetX + shadowOffsetX - textStrokeWidth;
492
- aabb.top += offsetY + shadowOffsetY - textStrokeWidth;
506
+ const m = this.getTransform2D(style);
507
+ tempV1.set(aabb.left, aabb.top);
508
+ tempV1.applyMatrix3(m);
509
+ aabb.left = tempV1.x;
510
+ aabb.top = tempV1.y;
511
+ tempV1.set(aabb.right, aabb.bottom);
512
+ tempV1.applyMatrix3(m);
513
+ aabb.width = tempV1.x - aabb.left;
514
+ aabb.height = tempV1.y - aabb.top;
515
+ const shadowOffsetX = (style.shadowOffsetX ?? 0) * fontSize;
516
+ const shadowOffsetY = (style.shadowOffsetY ?? 0) * fontSize;
517
+ const textStrokeWidth = Math.max(0.1, style.textStrokeWidth ?? 0) * fontSize;
518
+ aabb.left += shadowOffsetX - textStrokeWidth;
519
+ aabb.top += shadowOffsetY - textStrokeWidth;
493
520
  aabb.width += textStrokeWidth * 2;
494
521
  aabb.height += textStrokeWidth * 2;
495
522
  boxes.push(aabb);
@@ -499,15 +526,17 @@ class Effector extends Feature {
499
526
  }
500
527
  draw(options) {
501
528
  const { ctx } = options;
502
- const { effects, characters, boundingBox } = this._text;
529
+ const { effects, characters, renderBoundingBox } = this._text;
503
530
  if (effects) {
504
- effects.forEach((effect) => {
505
- uploadColor(effect, boundingBox, ctx);
506
- });
507
- characters.forEach((character) => {
508
- effects.forEach((style) => {
531
+ effects.forEach((style) => {
532
+ uploadColor(style, renderBoundingBox, ctx);
533
+ ctx.save();
534
+ const [a, c, e, b, d, f] = this.getTransform2D(style).transpose().elements;
535
+ ctx.transform(a, b, c, d, e, f);
536
+ characters.forEach((character) => {
509
537
  character.drawTo(ctx, style);
510
538
  });
539
+ ctx.restore();
511
540
  });
512
541
  }
513
542
  return this;
@@ -1024,6 +1053,9 @@ class Text {
1024
1053
  this.deformation = deformation;
1025
1054
  this.measureDom = measureDom;
1026
1055
  }
1056
+ get fontSize() {
1057
+ return this.computedStyle.fontSize;
1058
+ }
1027
1059
  get characters() {
1028
1060
  return this.paragraphs.flatMap((p) => p.fragments.flatMap((f) => f.characters));
1029
1061
  }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -193,6 +195,7 @@ declare class Text {
193
195
  effector: Effector;
194
196
  highlighter: Highlighter;
195
197
  renderer2D: Renderer2D;
198
+ get fontSize(): number;
196
199
  get characters(): Character[];
197
200
  constructor(options?: TextOptions);
198
201
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -214,6 +217,7 @@ interface EffectOptions {
214
217
  ctx: CanvasRenderingContext2D;
215
218
  }
216
219
  declare class Effector extends Feature {
220
+ getTransform2D(style: TextEffect): Matrix3;
217
221
  getBoundingBox(): BoundingBox;
218
222
  draw(options: EffectOptions): this;
219
223
  }
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -193,6 +195,7 @@ declare class Text {
193
195
  effector: Effector;
194
196
  highlighter: Highlighter;
195
197
  renderer2D: Renderer2D;
198
+ get fontSize(): number;
196
199
  get characters(): Character[];
197
200
  constructor(options?: TextOptions);
198
201
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -214,6 +217,7 @@ interface EffectOptions {
214
217
  ctx: CanvasRenderingContext2D;
215
218
  }
216
219
  declare class Effector extends Feature {
220
+ getTransform2D(style: TextEffect): Matrix3;
217
221
  getBoundingBox(): BoundingBox;
218
222
  draw(options: EffectOptions): this;
219
223
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2, Matrix3 } from 'modern-path2d';
2
2
  import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -51,6 +51,8 @@ type TextContent = string | FragmentContent | ParagraphContent | (string | Fragm
51
51
  type TextEffect = Partial<TextDrawStyle & {
52
52
  offsetX: number;
53
53
  offsetY: number;
54
+ skewX: number;
55
+ skewY: number;
54
56
  }>;
55
57
  type TextDeformation = () => void;
56
58
  interface FragmentHighlight {
@@ -193,6 +195,7 @@ declare class Text {
193
195
  effector: Effector;
194
196
  highlighter: Highlighter;
195
197
  renderer2D: Renderer2D;
198
+ get fontSize(): number;
196
199
  get characters(): Character[];
197
200
  constructor(options?: TextOptions);
198
201
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -214,6 +217,7 @@ interface EffectOptions {
214
217
  ctx: CanvasRenderingContext2D;
215
218
  }
216
219
  declare class Effector extends Feature {
220
+ getTransform2D(style: TextEffect): Matrix3;
217
221
  getBoundingBox(): BoundingBox;
218
222
  draw(options: EffectOptions): this;
219
223
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(p,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(p=typeof globalThis<"u"?globalThis:p||self,it(p.modernText={}))})(this,function(p){"use strict";var Ho=Object.defineProperty;var Wo=(p,it,Ct)=>it in p?Ho(p,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):p[it]=Ct;var F=(p,it,Ct)=>Wo(p,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}=Vn(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 Vn(s,t,e,r,n){var m;const i=((m=s.match(/linear-gradient\((.+)\)$/))==null?void 0:m[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),d=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+d,x1:t+r/2+c,y1:e+n/2-d,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[3].replace("%",""))/100,color:w}})}}function Fe(s){const{ctx:t,path:e,fontSize:r,clipRect:n}=s;t.save(),t.beginPath();const i=e.style;e.style={...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};const o=(s.offsetX??0)*r,a=(s.offsetY??0)*r;t.translate(o,a),n&&(t.rect(n.x,n.y,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t),t.restore()}var ot=Uint8Array,mt=Uint16Array,Ne=Int32Array,we=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]),ve=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]),ke=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(s,t){for(var e=new mt(31),r=0;r<31;++r)e[r]=t+=1<<s[r-1];for(var n=new Ne(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}},xr=br(we,2),_r=xr.b,Ge=xr.r;_r[28]=258,Ge[258]=28;for(var Sr=br(ve,0),Hn=Sr.b,Pr=Sr.r,Re=new mt(32768),N=0;N<32768;++N){var Bt=(N&43690)>>1|(N&21845)<<1;Bt=(Bt&52428)>>2|(Bt&13107)<<2,Bt=(Bt&61680)>>4|(Bt&3855)<<4,Re[N]=((Bt&65280)>>8|(Bt&255)<<8)>>1}for(var Mt=function(s,t,e){for(var r=s.length,n=0,i=new mt(t);n<r;++n)s[n]&&++i[s[n]-1];var o=new mt(t);for(n=1;n<t;++n)o[n]=o[n-1]+i[n-1]<<1;var a;if(e){a=new mt(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,d=c|(1<<u)-1;c<=d;++c)a[Re[c]>>h]=l}else for(a=new mt(r),n=0;n<r;++n)s[n]&&(a[n]=Re[o[s[n]-1]++]>>15-s[n]);return a},Ft=new ot(288),N=0;N<144;++N)Ft[N]=8;for(var N=144;N<256;++N)Ft[N]=9;for(var N=256;N<280;++N)Ft[N]=7;for(var N=280;N<288;++N)Ft[N]=8;for(var te=new ot(32),N=0;N<32;++N)te[N]=5;var Wn=Mt(Ft,9,0),Xn=Mt(Ft,9,1),jn=Mt(te,5,0),Yn=Mt(te,5,1),ze=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},St=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},qe=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Ve=function(s){return(s+7)/8|0},Cr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},Kn=["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"],Pt=function(s,t,e){var r=new Error(t||Kn[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Pt),!e)throw r;return r},Zn=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(It){var Et=e.length;if(It>Et){var Lt=new ot(Math.max(Et*2,It));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,d=t.b||0,m=t.l,g=t.d,w=t.m,f=t.n,P=n*8;do{if(!m){u=St(s,c,1);var _=St(s,c+1,3);if(c+=3,_)if(_==1)m=Xn,g=Yn,w=9,f=5;else if(_==2){var b=St(s,c,31)+257,A=St(s,c+10,15)+4,C=b+St(s,c+5,31)+1;c+=14;for(var M=new ot(C),L=new ot(19),X=0;X<A;++X)L[ke[X]]=St(s,c+X*3,7);c+=A*3;for(var j=ze(L),xt=(1<<j)-1,E=Mt(L,j,1),X=0;X<C;){var U=E[St(s,c,xt)];c+=U&15;var x=U>>4;if(x<16)M[X++]=x;else{var q=0,D=0;for(x==16?(D=3+St(s,c,3),c+=2,q=M[X-1]):x==17?(D=3+St(s,c,7),c+=3):x==18&&(D=11+St(s,c,127),c+=7);D--;)M[X++]=q}}var J=M.subarray(0,b),V=M.subarray(b);w=ze(J),f=ze(V),m=Mt(J,w,1),g=Mt(V,f,1)}else Pt(1);else{var x=Ve(c)+4,O=s[x-4]|s[x-3]<<8,v=x+O;if(v>n){h&&Pt(0);break}a&&l(d+O),e.set(s.subarray(x,v),d),t.b=d+=O,t.p=c=v*8,t.f=u;continue}if(c>P){h&&Pt(0);break}}a&&l(d+131072);for(var _t=(1<<w)-1,k=(1<<f)-1,Q=c;;Q=c){var q=m[qe(s,c)&_t],B=q>>4;if(c+=q&15,c>P){h&&Pt(0);break}if(q||Pt(2),B<256)e[d++]=B;else if(B==256){Q=c,m=null;break}else{var G=B-254;if(B>264){var X=B-257,I=we[X];G=St(s,c,(1<<I)-1)+_r[X],c+=I}var Y=g[qe(s,c)&k],H=Y>>4;Y||Pt(3),c+=Y&15;var V=Hn[H];if(H>3){var I=ve[H];V+=qe(s,c)&(1<<I)-1,c+=I}if(c>P){h&&Pt(0);break}a&&l(d+131072);var tt=d+G;if(d<V){var Wt=i-V,Xt=Math.min(V,tt);for(Wt+d<0&&Pt(3);d<Xt;++d)e[d]=r[Wt+d]}for(;d<tt;++d)e[d]=e[d-V]}}t.l=m,t.p=Q,t.b=d,t.f=u,m&&(u=1,t.m=w,t.d=g,t.n=f)}while(!u);return d!=e.length&&o?Cr(e,0,d):e.subarray(0,d)},$t=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},ee=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},He=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:Ar,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(v,b){return v.f-b.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 d=i[0].s,r=1;r<n;++r)i[r].s>d&&(d=i[r].s);var m=new mt(d+1),g=We(e[u-1],m,0);if(g>t){var r=0,w=0,f=g-t,P=1<<f;for(i.sort(function(b,A){return m[A.s]-m[b.s]||b.f-A.f});r<n;++r){var _=i[r].s;if(m[_]>t)w+=P-(1<<g-m[_]),m[_]=t;else break}for(w>>=f;w>0;){var x=i[r].s;m[x]<t?w-=1<<t-m[x]++-1:++r}for(;r>=0&&w;--r){var O=i[r].s;m[O]==t&&(--m[O],++w)}g=t}return{t:new ot(m),l:g}},We=function(s,t,e){return s.s==-1?Math.max(We(s.l,t,e+1),We(s.r,t,e+1)):t[s.s]=e},Mr=function(s){for(var t=s.length;t&&!s[--t];);for(var e=new mt(++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}},re=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Or=function(s,t,e){var r=e.length,n=Ve(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},Tr=function(s,t,e,r,n,i,o,a,h,l,u){$t(t,u++,e),++n[256];for(var c=He(n,15),d=c.t,m=c.l,g=He(i,15),w=g.t,f=g.l,P=Mr(d),_=P.c,x=P.n,O=Mr(w),v=O.c,b=O.n,A=new mt(19),C=0;C<_.length;++C)++A[_[C]&31];for(var C=0;C<v.length;++C)++A[v[C]&31];for(var M=He(A,7),L=M.t,X=M.l,j=19;j>4&&!L[ke[j-1]];--j);var xt=l+5<<3,E=re(n,Ft)+re(i,te)+o,U=re(n,d)+re(i,w)+o+14+3*j+re(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&xt<=E&&xt<=U)return Or(t,u,s.subarray(h,h+l));var q,D,J,V;if($t(t,u,1+(U<E)),u+=2,U<E){q=Mt(d,m,0),D=d,J=Mt(w,f,0),V=w;var _t=Mt(L,X,0);$t(t,u,x-257),$t(t,u+5,b-1),$t(t,u+10,j-4),u+=14;for(var C=0;C<j;++C)$t(t,u+3*C,L[ke[C]]);u+=3*j;for(var k=[_,v],Q=0;Q<2;++Q)for(var B=k[Q],C=0;C<B.length;++C){var G=B[C]&31;$t(t,u,_t[G]),u+=L[G],G>15&&($t(t,u,B[C]>>5&127),u+=B[C]>>12)}}else q=Wn,D=Ft,J=jn,V=te;for(var C=0;C<a;++C){var I=r[C];if(I>255){var G=I>>18&31;ee(t,u,q[G+257]),u+=D[G+257],G>7&&($t(t,u,I>>23&31),u+=we[G]);var Y=I&31;ee(t,u,J[Y]),u+=V[Y],Y>3&&(ee(t,u,I>>5&8191),u+=ve[Y])}else ee(t,u,q[I]),u+=D[I]}return ee(t,u,q[256]),u+D[256]},Qn=new Ne([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ar=new ot(0),Jn=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=Qn[t-1],d=c>>13,m=c&8191,g=(1<<e)-1,w=i.p||new mt(32768),f=i.h||new mt(g+1),P=Math.ceil(e/3),_=2*P,x=function(Jt){return(s[Jt]^s[Jt+1]<<P^s[Jt+2]<<_)&g},O=new Ne(25e3),v=new mt(288),b=new mt(32),A=0,C=0,M=i.i||0,L=0,X=i.w||0,j=0;M+2<o;++M){var xt=x(M),E=M&32767,U=f[xt];if(w[E]=U,f[xt]=E,X<=M){var q=o-M;if((A>7e3||L>24576)&&(q>423||!l)){u=Tr(s,h,0,O,v,b,C,L,j,M-j,u),L=A=C=0,j=M;for(var D=0;D<286;++D)v[D]=0;for(var D=0;D<30;++D)b[D]=0}var J=2,V=0,_t=m,k=E-U&32767;if(q>2&&xt==x(M-k))for(var Q=Math.min(d,q)-1,B=Math.min(32767,M),G=Math.min(258,q);k<=B&&--_t&&E!=U;){if(s[M+J]==s[M+J-k]){for(var I=0;I<G&&s[M+I]==s[M+I-k];++I);if(I>J){if(J=I,V=k,I>Q)break;for(var Y=Math.min(k,I-2),H=0,D=0;D<Y;++D){var tt=M-k+D&32767,Wt=w[tt],Xt=tt-Wt&32767;Xt>H&&(H=Xt,U=tt)}}}E=U,U=w[E],k+=E-U&32767}if(V){O[L++]=268435456|Ge[J]<<18|Pr[V];var It=Ge[J]&31,Et=Pr[V]&31;C+=we[It]+ve[Et],++v[257+It],++b[Et],X=M+J,++A}else O[L++]=s[M],++v[s[M]]}}for(M=Math.max(M,X);M<o;++M)O[L++]=s[M],++v[s[M]];u=Tr(s,h,l,O,v,b,C,L,j,M-j,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=f,i.p=w,i.i=M,i.w=X)}else{for(var M=i.w||0;M<o+l;M+=65535){var Lt=M+65535;Lt>=o&&(h[u/8|0]=l,Lt=o),u=Or(h,u+1,s.subarray(M,Lt))}i.i=o}return Cr(a,0,r+Ve(u)+n)},Ir=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}}},ts=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 Jn(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)},Er=function(s,t,e){for(;e;++t)s[t]=e,e>>>=8},es=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=Ir();n.p(t.dictionary),Er(s,2,n.d())}},rs=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Pt(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Pt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function ns(s,t){t||(t={});var e=Ir();e.p(s);var r=ts(s,t,t.dictionary?6:2,4);return es(r,t),Er(r,r.length-4,e.d()),r}function ss(s,t){return Zn(s.subarray(rs(s,t),-4),{i:2},t,t)}var is=typeof TextDecoder<"u"&&new TextDecoder,os=0;try{is.decode(Ar,{stream:!0}),os=1}catch{}const as="modern-font";function ne(s,t){if(!s)throw new Error(`[${as}] ${t}`)}function ls(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 kt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Ur=Object.defineProperty,hs=(s,t,e)=>t in s?Ur(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&&Ur(t,e,n),n},cs=(s,t,e)=>(hs(s,t+"",e),e);const be={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(ls(t),e,r),this.littleEndian=n,cs(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+=be[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+=be[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=kt(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 us=Object.defineProperty,fs=(s,t,e)=>t in s?us(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ps=(s,t,e)=>(fs(s,t+"",e),e);const $r=new WeakMap;function y(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=$r.get(n);o||(o={columns:[],byteLength:0},$r.set(n,o));const a={...t,name:i,byteLength:e*be[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+be[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 wt{constructor(t,e,r,n){ps(this,"view"),this.view=new rt(t,e,r,n)}}function ds(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 xe(s){s=ds(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 gs(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 ms(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 _e extends wt{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 Dr=Object.defineProperty,ys=(s,t,e)=>t in s?Dr(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&&Dr(t,e,n),n},Lr=(s,t,e)=>(ys(s,typeof t!="symbol"?t+"":t,e),e);const ht=class kn extends _e{constructor(){super(...arguments),Lr(this,"format","EmbeddedOpenType"),Lr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=xe(n.fontFamily||""),o=i.length,a=xe(n.fontStyle||""),h=a.length,l=xe(n.version||""),u=l.length,c=xe(n.fullName||""),d=c.length,m=86+o+4+h+4+u+4+d+2+t.view.byteLength,g=new kn(new ArrayBuffer(m),0,m,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(u),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let ws=ht;var vs=Object.defineProperty,Se=(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&&vs(t,e,n),n};class jt extends wt{constructor(t,e){super(t,e,16)}}Se([y({type:"char",size:4})],jt.prototype,"tag"),Se([y("uint32")],jt.prototype,"checkSum"),Se([y("uint32")],jt.prototype,"offset"),Se([y("uint32")],jt.prototype,"length");const Xe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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"],bs=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 xs=Object.defineProperty,_s=(s,t,e)=>t in s?xs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,se=(s,t,e)=>(_s(s,typeof t!="symbol"?t+"":t,e),e);class je{constructor(t){se(this,"index"),se(this,"name"),se(this,"isComposite",!1),se(this,"components",[]),se(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,d=l.length;c<d;c+=1){const m=l[c];m.type==="M"?u.push({type:"M",x:t+m.x*a,y:e+-m.y*h}):m.type==="L"?u.push({type:"L",x:t+m.x*a,y:e+-m.y*h}):m.type==="Q"?u.push({type:"Q",x1:t+m.x1*a,y1:e+-m.y1*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="C"?u.push({type:"C",x1:t+m.x1*a,y1:e+-m.y1*h,x2:t+m.x2*a,y2:e+-m.y2*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="Z"&&u.push({type:"Z"})}return u}}class Ss 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,d,m,g;const w=[],f=[];let P=0,_=!1,x=!1,O=o,v=0,b=0;function A(E,U){w.push({type:"L",x:E,y:U})}function C(E,U,q,D,J,V){w.push({type:"C",x1:E,y1:U,x2:q,y2:D,x:J,y:V})}function M(E,U){x&&l!==2&&L(),x=!0,w.push({type:"M",x:E,y:U})}function L(){w.push({type:"Z"})}function X(E){w.push(...E)}function j(){f.length%2!==0&&!_&&(O=f.shift()+i),P+=f.length>>1,f.length=0,_=!0}function xt(E){let U,q,D,J,V,_t,k,Q,B,G,I,Y,H=0;for(;H<E.length;){let tt=E[H++];switch(tt){case 1:j();break;case 3:j();break;case 4:f.length>1&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),M(v,b);break;case 5:for(;f.length>0;)v+=f.shift(),b+=f.shift(),A(v,b);break;case 6:for(;f.length>0&&(v+=f.shift(),A(v,b),f.length!==0);)b+=f.shift(),A(v,b);break;case 7:for(;f.length>0&&(b+=f.shift(),A(v,b),f.length!==0);)v+=f.shift(),A(v,b);break;case 8:for(;f.length>0;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 10:V=f.pop()+h,_t=t.subrs[V],_t&&xt(_t);break;case 11:return;case 12:switch(tt=E[H],H+=1,tt){case 35:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),b=Y+f.shift(),f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 34:c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=b,v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 36:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 37:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),Math.abs(I-v)>Math.abs(Y-b)?v=I+f.shift():b=Y+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),f.length=0}break;case 14:if(f.length>=4){const Wt=Xe[f.pop()],Xt=Xe[f.pop()],It=f.pop(),Et=f.pop();if(Wt&&Xt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(Wt),Jt=t.charset.indexOf(Xt);n.components.push({glyphIndex:Jt,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Et,dy:It}),X(r.get(Jt).pathCommands);const yr=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let wr=0;wr<yr.length;wr+=1){const Ut=yr[wr];Ut.type!=="Z"&&(Ut.x+=Et,Ut.y+=It),(Ut.type==="Q"||Ut.type==="C")&&(Ut.x1+=Et,Ut.y1+=It),Ut.type==="C"&&(Ut.x2+=Et,Ut.y2+=It)}X(yr)}}else f.length>0&&!_&&(O=f.shift()+i,_=!0);x&&l!==2&&(L(),x=!1);break;case 18:j();break;case 19:case 20:j(),H+=P+7>>3;break;case 21:f.length>2&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),v+=f.pop(),M(v,b);break;case 22:f.length>1&&!_&&(O=f.shift()+i,_=!0),v+=f.pop(),M(v,b);break;case 23:j();break;case 24:for(;f.length>2;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);v+=f.shift(),b+=f.shift(),A(v,b);break;case 25:for(;f.length>6;)v+=f.shift(),b+=f.shift(),A(v,b);c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 26:for(f.length%2&&(v+=f.shift());f.length>0;)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m,b=g+f.shift(),C(c,d,m,g,v,b);break;case 27:for(f.length%2&&(b+=f.shift());f.length>0;)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g,C(c,d,m,g,v,b);break;case 28:U=E[H],q=E[H+1],f.push((U<<24|q<<16)>>16),H+=2;break;case 29:V=f.pop()+a,_t=t.gsubrs[V],_t&&xt(_t);break;case 30:for(;f.length>0&&(c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;case 31:for(;f.length>0&&(c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?f.push(tt-139):tt<251?(U=E[H],H+=1,f.push((tt-247)*256+U+108)):tt<255?(U=E[H],H+=1,f.push(-(tt-251)*256-U-108)):(U=E[H],q=E[H+1],D=E[H+2],J=E[H+3],H+=4,f.push((U<<24|q<<16|D<<8|J)/65536))}}}xt(e),this.pathCommands=w,_&&(this.advanceWidth=O)}}var Ps=Object.defineProperty,Cs=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ms=(s,t,e)=>(Cs(s,t+"",e),e);class Ye{constructor(t){this._sfnt=t,Ms(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 Os extends Ye{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ss({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var Br=Object.defineProperty,Ts=(s,t,e)=>t in s?Br(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Fr=(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},Pe=(s,t,e)=>(Ts(s,typeof t!="symbol"?t+"":t,e),e);class Ce extends wt{constructor(t,e,r,n){super(t,e,r,n),Pe(this,"_offsets"),Pe(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)}}Fr([y("uint16")],Ce.prototype,"count"),Fr([y("uint8")],Ce.prototype,"offsetSize");class Me extends Ce{constructor(){super(...arguments),Pe(this,"_isString",!1)}}class Nr extends Ce{constructor(){super(...arguments),Pe(this,"_isString",!0)}}const As=[".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"],Is=[".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"],Es=[".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"],Us=[".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 Oe(s,t){return t<=390?As[t]:s[t-391]}var $s=Object.defineProperty,Ds=(s,t,e)=>t in s?$s(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,kr=(s,t,e)=>(Ds(s,typeof t!="symbol"?t+"":t,e),e);function R(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 Gr extends wt{constructor(){super(...arguments),kr(this,"_dict"),kr(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 Oe(((r=this._stringIndex)==null?void 0:r.objects)??[],e[0]);case"number[]":return e}return e}_setProp(t,e){}}var Ls=Object.defineProperty,Ke=(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&&Ls(t,e,n),n};class Te extends Gr{}Ke([R(19)],Te.prototype,"subrs"),Ke([R(20)],Te.prototype,"defaultWidthX"),Ke([R(21)],Te.prototype,"nominalWidthX");var Bs=Object.defineProperty,K=(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&&Bs(t,e,n),n};class W extends Gr{}K([R(0,"string")],W.prototype,"version"),K([R(1,"string")],W.prototype,"notice"),K([R(1200,"string")],W.prototype,"copyright"),K([R(2,"string")],W.prototype,"fullName"),K([R(3,"string")],W.prototype,"familyName"),K([R(4,"string")],W.prototype,"weight"),K([R(1201)],W.prototype,"isFixedPitch"),K([R(1202)],W.prototype,"italicAngle"),K([R(1203,"number",-100)],W.prototype,"underlinePosition"),K([R(1204,"number",50)],W.prototype,"underlineThickness"),K([R(1205)],W.prototype,"paintType"),K([R(1206,"number",2)],W.prototype,"charstringType"),K([R(1207,"number[]",[.001,0,0,.001,0,0])],W.prototype,"fontMatrix"),K([R(13)],W.prototype,"uniqueId"),K([R(5,"number[]",[0,0,0,0])],W.prototype,"fontBBox"),K([R(1208)],W.prototype,"strokeWidth"),K([R(14)],W.prototype,"xuid"),K([R(15)],W.prototype,"charset"),K([R(16)],W.prototype,"encoding"),K([R(17)],W.prototype,"charStrings"),K([R(18,"number[]",[0,0])],W.prototype,"private");var Fs=Object.defineProperty,Ns=(s,t,e)=>t in s?Fs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ze=(s,t,e)=>(Ns(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{ie.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(ie.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const Rr=class ye{constructor(t){Ze(this,"tables",new Map),Ze(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 ye(this.tableViews)}delete(t){const e=ye.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=ye.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ye.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}};Ze(Rr,"tableDefinitions",new Map);let ie=Rr;class ct extends wt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var zr=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Gs=(s,t,e)=>t in s?zr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,oe=(s,t,e,r)=>{for(var n=r>1?void 0:r?ks(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&&zr(t,e,n),n},Qe=(s,t,e)=>(Gs(s,typeof t!="symbol"?t+"":t,e),e);p.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),Qe(this,"_glyphs"),Qe(this,"privateDict"),Qe(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Os(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 Nr(e,n),this.topDictIndex=new Me(e,this.nameIndex.endOffset),this.stringIndex=new Nr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Me(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 Te(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Me(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Me(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Is:this.topDict.charset===1?this.charset=Es:this.topDict.charset===2?this.charset=Us:this.charset=this._readCharset(r+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Xe:this.topDict.encoding===1?this.encoding=bs: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(Oe(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(Oe(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(Oe(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}},oe([y("uint8")],p.Cff.prototype,"majorVersion",2),oe([y("uint8")],p.Cff.prototype,"minorVersion",2),oe([y("uint8")],p.Cff.prototype,"headerSize",2),oe([y("uint8")],p.Cff.prototype,"offsetSize",2),p.Cff=oe([nt("CFF ","cff")],p.Cff);var Rs=Object.defineProperty,Ae=(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&&Rs(t,e,n),n};const ae=class Gn extends wt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new Gn;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}};Ae([y("uint16")],ae.prototype,"format"),Ae([y("uint16")],ae.prototype,"length"),Ae([y("uint16")],ae.prototype,"language"),Ae([y({type:"uint8",size:256})],ae.prototype,"glyphIndexArray");let Je=ae;var zs=Object.defineProperty,tr=(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};class le extends wt{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,d=i[u].entryCount;c<d;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 m=(l<<8|c+i[u].firstCode)%65535;e.set(m,h)}}return e}}tr([y("uint16")],le.prototype,"format"),tr([y("uint16")],le.prototype,"length"),tr([y("uint16")],le.prototype,"language");function qr(s){return s>32767?s-65536:s<-32767?s+65536:s}function er(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 Nt=class Rn extends wt{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=er(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new Rn(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 d=l+o[l]/2+(u-n[l])-r,m=h[d];m!==0?t.set(u,(m+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Gt([y("uint16")],Nt.prototype,"format"),Gt([y("uint16")],Nt.prototype,"length"),Gt([y("uint16")],Nt.prototype,"language"),Gt([y("uint16")],Nt.prototype,"segCountX2"),Gt([y("uint16")],Nt.prototype,"searchRange"),Gt([y("uint16")],Nt.prototype,"entrySelector"),Gt([y("uint16")],Nt.prototype,"rangeShift");let rr=Nt;var Vs=Object.defineProperty,he=(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&&Vs(t,e,n),n};class Rt extends wt{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}}he([y("uint16")],Rt.prototype,"format"),he([y("uint16")],Rt.prototype,"length"),he([y("uint16")],Rt.prototype,"language"),he([y("uint16")],Rt.prototype,"firstCode"),he([y("uint16")],Rt.prototype,"entryCount");var Hs=Object.defineProperty,ce=(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 Yt=class zn extends wt{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=er(t),r=new zn(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}};ce([y("uint16")],Yt.prototype,"format"),ce([y("uint16")],Yt.prototype,"reserved"),ce([y("uint32")],Yt.prototype,"length"),ce([y("uint32")],Yt.prototype,"language"),ce([y("uint32")],Yt.prototype,"nGroups");let nr=Yt;var Ws=Object.defineProperty,sr=(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&&Ws(t,e,n),n};class ue extends wt{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}}sr([y("uint16")],ue.prototype,"format"),sr([y("uint32")],ue.prototype,"length"),sr([y("uint32")],ue.prototype,"numVarSelectorRecords");var Vr=Object.defineProperty,Xs=Object.getOwnPropertyDescriptor,js=(s,t,e)=>t in s?Vr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ir=(s,t,e,r)=>{for(var n=r>1?void 0:r?Xs(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&&Vr(t,e,n),n},Hr=(s,t,e)=>(js(s,typeof t!="symbol"?t+"":t,e),e);p.Cmap=class extends ct{constructor(){super(...arguments),Hr(this,"_unicodeToGlyphIndexMap"),Hr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=rr.from(t),n=Je.from(t),i=e?nr.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 p.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 Je(this.view.buffer,e.offset);break;case 2:n=new le(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new rr(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 nr(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new ue(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(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,i=(u=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:u.view,o=(c=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.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())??[]])}},ir([y("uint16")],p.Cmap.prototype,"version",2),ir([y("uint16")],p.Cmap.prototype,"numberSubtables",2),p.Cmap=ir([nt("cmap")],p.Cmap);class Ys 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 ne(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();ne(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;ne(c<2e4,`Bad numberOfCoordinates:${u}`);const d=[];let m,g=0;for(;g<c;)if(m=t.view.readUint8(),d.push(m),g++,m&8&&g<c){const w=t.view.readUint8();for(let f=0;f<w;f++)d.push(m),g++}if(ne(d.length===c,`Bad flags length: ${d.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let f;if(c>0){for(let x=0;x<c;x+=1)m=d[x],f={},f.onCurve=!!(m&1),f.lastPointOfContour=a.includes(x),w.push(f);let P=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.x=this._parseGlyphCoordinate(t,m,P,2,16),P=f.x;let _=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.y=this._parseGlyphCoordinate(t,m,_,4,32),_=f.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{ne(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 d=l.points[h.matchedPoints[1]];const m={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],m)[0],m.dx=c.x-d.x,m.dy=c.y-d.y,u=this._transformPoints(l.points,m)}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 d=0,m=l.length;d<m;++d)if(u=c,c=l[(d+1)%m],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let g=c;c.onCurve||(g={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Ks extends Ye{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new Ys({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Wr=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(s,t,e)=>t in s?Wr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Js=(s,t,e,r)=>{for(var n=r>1?void 0:r?Zs(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&&Wr(t,e,n),n},ti=(s,t,e)=>(Qs(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};p.Glyf=class extends ct{constructor(){super(...arguments),ti(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new p.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Ks(this._sfnt))}},p.Glyf=Js([nt("glyf")],p.Glyf);var ei=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,ni=(s,t,e,r)=>{for(var n=r>1?void 0:r?ri(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};p.Gpos=class extends ct{},p.Gpos=ni([nt("GPOS","gpos")],p.Gpos);var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,zt=(s,t,e,r)=>{for(var n=r>1?void 0:r?ii(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&&si(t,e,n),n};p.Gsub=class extends ct{},zt([y("uint16")],p.Gsub.prototype,"majorVersion",2),zt([y("uint16")],p.Gsub.prototype,"minorVersion",2),zt([y("uint16")],p.Gsub.prototype,"scriptListOffset",2),zt([y("uint16")],p.Gsub.prototype,"featureListOffset",2),zt([y("uint16")],p.Gsub.prototype,"lookupListOffset",2),zt([y("uint16")],p.Gsub.prototype,"featureVariationsOffset",2),p.Gsub=zt([nt("GSUB","gsub")],p.Gsub);var oi=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,et=(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&&oi(t,e,n),n};p.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],p.Head.prototype,"version",2),et([y("fixed")],p.Head.prototype,"fontRevision",2),et([y("uint32")],p.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],p.Head.prototype,"magickNumber",2),et([y("uint16")],p.Head.prototype,"flags",2),et([y("uint16")],p.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],p.Head.prototype,"created",2),et([y({type:"longDateTime"})],p.Head.prototype,"modified",2),et([y("int16")],p.Head.prototype,"xMin",2),et([y("int16")],p.Head.prototype,"yMin",2),et([y("int16")],p.Head.prototype,"xMax",2),et([y("int16")],p.Head.prototype,"yMax",2),et([y("uint16")],p.Head.prototype,"macStyle",2),et([y("uint16")],p.Head.prototype,"lowestRecPPEM",2),et([y("int16")],p.Head.prototype,"fontDirectionHint",2),et([y("int16")],p.Head.prototype,"indexToLocFormat",2),et([y("int16")],p.Head.prototype,"glyphDataFormat",2),p.Head=et([nt("head")],p.Head);var li=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?hi(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&&li(t,e,n),n};p.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],p.Hhea.prototype,"version",2),pt([y("int16")],p.Hhea.prototype,"ascent",2),pt([y("int16")],p.Hhea.prototype,"descent",2),pt([y("int16")],p.Hhea.prototype,"lineGap",2),pt([y("uint16")],p.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],p.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],p.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],p.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],p.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],p.Hhea.prototype,"reserved",2),pt([y("int16")],p.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],p.Hhea.prototype,"numOfLongHorMetrics",2),p.Hhea=pt([nt("hhea")],p.Hhea);var Xr=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,ui=(s,t,e)=>t in s?Xr(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?ci(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},pi=(s,t,e)=>(ui(s,t+"",e),e);p.Hmtx=class extends ct{constructor(){super(...arguments),pi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.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()}))}},p.Hmtx=fi([nt("hmtx")],p.Hmtx);var di=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,mi=(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};p.Kern=class extends ct{},p.Kern=mi([nt("kern","kern")],p.Kern);var jr=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,wi=(s,t,e)=>t in s?jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vi=(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},bi=(s,t,e)=>(wi(s,t+"",e),e);p.Loca=class extends ct{constructor(){super(...arguments),bi(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new p.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)}},p.Loca=vi([nt("loca")],p.Loca);var xi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,ut=(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&&xi(t,e,n),n};p.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],p.Maxp.prototype,"version",2),ut([y("uint16")],p.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],p.Maxp.prototype,"maxPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxContours",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],p.Maxp.prototype,"maxZones",2),ut([y("uint16")],p.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxStorage",2),ut([y("uint16")],p.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],p.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentDepth",2),p.Maxp=ut([nt("maxp")],p.Maxp);var Yr=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Pi=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ie=(s,t,e,r)=>{for(var n=r>1?void 0:r?Si(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},Ci=(s,t,e)=>(Pi(s,t+"",e),e);const Kr={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"},or={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Mi={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Zr={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};p.Name=class extends ct{constructor(){super(...arguments),Ci(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=or.Macintosh,i=Mi.Default,o=0;e.some(h=>h.platform===or.Microsoft&&h.encoding===Zr.UCS2&&h.language===1033)&&(n=or.Microsoft,i=Zr.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&&Kr[l.nameId]&&(a[Kr[l.nameId]]=o===0?gs(l.name):ms(l.name))}return a}},Ie([y("uint16")],p.Name.prototype,"format",2),Ie([y("uint16")],p.Name.prototype,"count",2),Ie([y("uint16")],p.Name.prototype,"stringOffset",2),p.Name=Ie([nt("name")],p.Name);var Oi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,T=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ti(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&&Oi(t,e,n),n};p.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]}},T([y("uint16")],p.Os2.prototype,"version",2),T([y("int16")],p.Os2.prototype,"xAvgCharWidth",2),T([y("uint16")],p.Os2.prototype,"usWeightClass",2),T([y("uint16")],p.Os2.prototype,"usWidthClass",2),T([y("uint16")],p.Os2.prototype,"fsType",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutSize",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutPosition",2),T([y("uint16")],p.Os2.prototype,"sFamilyClass",2),T([y({type:"uint8"})],p.Os2.prototype,"bFamilyType",2),T([y({type:"uint8"})],p.Os2.prototype,"bSerifStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bWeight",2),T([y({type:"uint8"})],p.Os2.prototype,"bProportion",2),T([y({type:"uint8"})],p.Os2.prototype,"bContrast",2),T([y({type:"uint8"})],p.Os2.prototype,"bStrokeVariation",2),T([y({type:"uint8"})],p.Os2.prototype,"bArmStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bLetterform",2),T([y({type:"uint8"})],p.Os2.prototype,"bMidline",2),T([y({type:"uint8"})],p.Os2.prototype,"bXHeight",2),T([y({type:"uint8",size:16})],p.Os2.prototype,"ulUnicodeRange",2),T([y({type:"char",size:4})],p.Os2.prototype,"achVendID",2),T([y("uint16")],p.Os2.prototype,"fsSelection",2),T([y("uint16")],p.Os2.prototype,"usFirstCharIndex",2),T([y("uint16")],p.Os2.prototype,"usLastCharIndex",2),T([y("int16")],p.Os2.prototype,"sTypoAscender",2),T([y("int16")],p.Os2.prototype,"sTypoDescender",2),T([y("int16")],p.Os2.prototype,"sTypoLineGap",2),T([y("uint16")],p.Os2.prototype,"usWinAscent",2),T([y("uint16")],p.Os2.prototype,"usWinDescent",2),T([y({offset:72,type:"uint8",size:8})],p.Os2.prototype,"ulCodePageRange",2),T([y({offset:72,type:"int16"})],p.Os2.prototype,"sxHeight",2),T([y("int16")],p.Os2.prototype,"sCapHeight",2),T([y("uint16")],p.Os2.prototype,"usDefaultChar",2),T([y("uint16")],p.Os2.prototype,"usBreakChar",2),T([y("uint16")],p.Os2.prototype,"usMaxContext",2),p.Os2=T([nt("OS/2","os2")],p.Os2);var Ai=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Ot=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ii(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};p.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([y("fixed")],p.Post.prototype,"format",2),Ot([y("fixed")],p.Post.prototype,"italicAngle",2),Ot([y("int16")],p.Post.prototype,"underlinePosition",2),Ot([y("int16")],p.Post.prototype,"underlineThickness",2),Ot([y("uint32")],p.Post.prototype,"isFixedPitch",2),Ot([y("uint32")],p.Post.prototype,"minMemType42",2),Ot([y("uint32")],p.Post.prototype,"maxMemType42",2),Ot([y("uint32")],p.Post.prototype,"minMemType1",2),Ot([y("uint32")],p.Post.prototype,"maxMemType1",2),p.Post=Ot([nt("post")],p.Post);var Ei=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,dt=(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&&Ei(t,e,n),n};p.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],p.Vhea.prototype,"version",2),dt([y("int16")],p.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],p.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],p.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],p.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],p.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],p.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],p.Vhea.prototype,"reserved",2),dt([y("int16")],p.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],p.Vhea.prototype,"numOfLongVerMetrics",2),p.Vhea=dt([nt("vhea")],p.Vhea);var Qr=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,Di=(s,t,e)=>t in s?Qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Li=(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&&Qr(t,e,n),n},Bi=(s,t,e)=>(Di(s,t+"",e),e);p.Vmtx=class extends ct{constructor(){super(...arguments),Bi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.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()}))}},p.Vmtx=Li([nt("vmtx")],p.Vmtx);var Jr=Object.defineProperty,Fi=(s,t,e)=>t in s?Jr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fe=(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&&Jr(t,e,n),n},Ee=(s,t,e)=>(Fi(s,typeof t!="symbol"?t+"":t,e),e);class st extends _e{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(kt(t).getUint32(0))}static checksum(t){const e=kt(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,d)=>c+e(d.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,d)=>{const m=l[h++];m.tag=d,m.checkSum=this.checksum(c),m.offset=a,m.length=c.byteLength,i.view.writeBytes(c,a),a+=e(m.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 jt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new ie(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])),fe([y("uint32")],st.prototype,"scalerType"),fe([y("uint16")],st.prototype,"numTables"),fe([y("uint16")],st.prototype,"searchRange"),fe([y("uint16")],st.prototype,"entrySelector"),fe([y("uint16")],st.prototype,"rangeShift");var Ni=Object.defineProperty,ki=(s,t,e)=>t in s?Ni(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ar=(s,t,e)=>(ki(s,typeof t!="symbol"?t+"":t,e),e);class Ue extends st{constructor(){super(...arguments),ar(this,"format","OpenType"),ar(this,"mimeType","font/otf")}static from(t){return super.from(t)}}ar(Ue,"signature",new Set([1330926671]));var Gi=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&&Gi(t,e,n),n};class qt extends wt{constructor(t,e){super(t,e,20)}}pe([y({type:"char",size:4})],qt.prototype,"tag"),pe([y("uint32")],qt.prototype,"offset"),pe([y("uint32")],qt.prototype,"compLength"),pe([y("uint32")],qt.prototype,"origLength"),pe([y("uint32")],qt.prototype,"origChecksum");var tn=Object.defineProperty,Ri=(s,t,e)=>t in s?tn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,yt=(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&&tn(t,e,n),n},$e=(s,t,e)=>(Ri(s,typeof t!="symbol"?t+"":t,e),e);const gt=class vr extends _e{constructor(){super(...arguments),$e(this,"format","WOFF"),$e(this,"mimeType","font/woff"),$e(this,"_sfnt")}get subfontFormat(){return st.is(this.flavor)?"TrueType":Ue.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(kt(t).getUint32(0))}static checkSum(t){const e=kt(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,d)=>{const m=kt(ns(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:d,view:m.byteLength<c.byteLength?m:c,rawView:c})});const i=n.length,o=n.reduce((c,d)=>c+r(d.view.byteLength),0),a=new vr(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,d)=>c+r(d.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const d=u[l++];d.tag=c.tag,d.offset=h,d.compLength=c.view.byteLength,d.origChecksum=vr.checkSum(c.rawView),d.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(d.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 ie(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(ss(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};$e(gt,"signature",new Set([2001684038])),yt([y("uint32")],gt.prototype,"signature"),yt([y("uint32")],gt.prototype,"flavor"),yt([y("uint32")],gt.prototype,"length"),yt([y("uint16")],gt.prototype,"numTables"),yt([y("uint16")],gt.prototype,"reserved"),yt([y("uint32")],gt.prototype,"totalSfntSize"),yt([y("uint16")],gt.prototype,"majorVersion"),yt([y("uint16")],gt.prototype,"minorVersion"),yt([y("uint32")],gt.prototype,"metaOffset"),yt([y("uint32")],gt.prototype,"metaLength"),yt([y("uint32")],gt.prototype,"metaOrigLength"),yt([y("uint32")],gt.prototype,"privOffset"),yt([y("uint32")],gt.prototype,"privLength");let Dt=gt;function en(s){if(st.is(s))return new st(s);if(Ue.is(s))return new Ue(s);if(Dt.is(s))return new Dt(s)}var zi=Object.defineProperty,qi=(s,t,e)=>t in s?zi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,de=(s,t,e)=>(qi(s,typeof t!="symbol"?t+"":t,e),e);const rn=class qn{constructor(){de(this,"fallbackFont"),de(this,"_loading",new Map),de(this,"_loaded",new Map),de(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(p,it){typeof exports=="object"&&typeof module<"u"?it(exports):typeof define=="function"&&define.amd?define(["exports"],it):(p=typeof globalThis<"u"?globalThis:p||self,it(p.modernText={}))})(this,function(p){"use strict";var jo=Object.defineProperty;var Yo=(p,it,Ct)=>it in p?jo(p,it,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):p[it]=Ct;var F=(p,it,Ct)=>Yo(p,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}=Xn(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 Xn(s,t,e,r,n){var m;const i=((m=s.match(/linear-gradient\((.+)\)$/))==null?void 0:m[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),d=n*Math.cos(u);return{x0:t+r/2-c,y0:e+n/2+d,x1:t+r/2+c,y1:e+n/2-d,stops:Array.from(h).map(g=>{let w=g[2];return w.startsWith("(")?w=w.split(",").length>3?`rgba${w}`:`rgb${w}`:w=`#${w}`,{offset:Number(g[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.x,n.y,n.width,n.height),t.clip(),t.beginPath()),e.drawTo(t,o),t.restore()}var ot=Uint8Array,yt=Uint16Array,ze=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]),Re=new ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sr=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 ze(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}},Pr=Sr(xe,2),Cr=Pr.b,qe=Pr.r;Cr[28]=258,qe[258]=28;for(var Mr=Sr(_e,0),jn=Mr.b,Or=Mr.r,Ve=new yt(32768),N=0;N<32768;++N){var Bt=(N&43690)>>1|(N&21845)<<1;Bt=(Bt&52428)>>2|(Bt&13107)<<2,Bt=(Bt&61680)>>4|(Bt&3855)<<4,Ve[N]=((Bt&65280)>>8|(Bt&255)<<8)>>1}for(var Mt=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,d=c|(1<<u)-1;c<=d;++c)a[Ve[c]>>h]=l}else for(a=new yt(r),n=0;n<r;++n)s[n]&&(a[n]=Ve[o[s[n]-1]++]>>15-s[n]);return a},Ft=new ot(288),N=0;N<144;++N)Ft[N]=8;for(var N=144;N<256;++N)Ft[N]=9;for(var N=256;N<280;++N)Ft[N]=7;for(var N=280;N<288;++N)Ft[N]=8;for(var ne=new ot(32),N=0;N<32;++N)ne[N]=5;var Yn=Mt(Ft,9,0),Kn=Mt(Ft,9,1),Zn=Mt(ne,5,0),Qn=Mt(ne,5,1),He=function(s){for(var t=s[0],e=1;e<s.length;++e)s[e]>t&&(t=s[e]);return t},St=function(s,t,e){var r=t/8|0;return(s[r]|s[r+1]<<8)>>(t&7)&e},We=function(s,t){var e=t/8|0;return(s[e]|s[e+1]<<8|s[e+2]<<16)>>(t&7)},Xe=function(s){return(s+7)/8|0},Tr=function(s,t,e){return(e==null||e>s.length)&&(e=s.length),new ot(s.subarray(t,e))},Jn=["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"],Pt=function(s,t,e){var r=new Error(t||Jn[s]);if(r.code=s,Error.captureStackTrace&&Error.captureStackTrace(r,Pt),!e)throw r;return r},ts=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(It){var Et=e.length;if(It>Et){var Lt=new ot(Math.max(Et*2,It));Lt.set(e),e=Lt}},u=t.f||0,c=t.p||0,d=t.b||0,m=t.l,g=t.d,w=t.m,f=t.n,P=n*8;do{if(!m){u=St(s,c,1);var _=St(s,c+1,3);if(c+=3,_)if(_==1)m=Kn,g=Qn,w=9,f=5;else if(_==2){var b=St(s,c,31)+257,A=St(s,c+10,15)+4,C=b+St(s,c+5,31)+1;c+=14;for(var M=new ot(C),L=new ot(19),X=0;X<A;++X)L[Re[X]]=St(s,c+X*3,7);c+=A*3;for(var j=He(L),xt=(1<<j)-1,E=Mt(L,j,1),X=0;X<C;){var U=E[St(s,c,xt)];c+=U&15;var x=U>>4;if(x<16)M[X++]=x;else{var q=0,$=0;for(x==16?($=3+St(s,c,3),c+=2,q=M[X-1]):x==17?($=3+St(s,c,7),c+=3):x==18&&($=11+St(s,c,127),c+=7);$--;)M[X++]=q}}var J=M.subarray(0,b),V=M.subarray(b);w=He(J),f=He(V),m=Mt(J,w,1),g=Mt(V,f,1)}else Pt(1);else{var x=Xe(c)+4,O=s[x-4]|s[x-3]<<8,v=x+O;if(v>n){h&&Pt(0);break}a&&l(d+O),e.set(s.subarray(x,v),d),t.b=d+=O,t.p=c=v*8,t.f=u;continue}if(c>P){h&&Pt(0);break}}a&&l(d+131072);for(var _t=(1<<w)-1,k=(1<<f)-1,Q=c;;Q=c){var q=m[We(s,c)&_t],B=q>>4;if(c+=q&15,c>P){h&&Pt(0);break}if(q||Pt(2),B<256)e[d++]=B;else if(B==256){Q=c,m=null;break}else{var G=B-254;if(B>264){var X=B-257,I=xe[X];G=St(s,c,(1<<I)-1)+Cr[X],c+=I}var Y=g[We(s,c)&k],H=Y>>4;Y||Pt(3),c+=Y&15;var V=jn[H];if(H>3){var I=_e[H];V+=We(s,c)&(1<<I)-1,c+=I}if(c>P){h&&Pt(0);break}a&&l(d+131072);var tt=d+G;if(d<V){var jt=i-V,Yt=Math.min(V,tt);for(jt+d<0&&Pt(3);d<Yt;++d)e[d]=r[jt+d]}for(;d<tt;++d)e[d]=e[d-V]}}t.l=m,t.p=Q,t.b=d,t.f=u,m&&(u=1,t.m=w,t.d=g,t.n=f)}while(!u);return d!=e.length&&o?Tr(e,0,d):e.subarray(0,d)},Dt=function(s,t,e){e<<=t&7;var r=t/8|0;s[r]|=e,s[r+1]|=e>>8},se=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},je=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:Ur,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(v,b){return v.f-b.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 d=i[0].s,r=1;r<n;++r)i[r].s>d&&(d=i[r].s);var m=new yt(d+1),g=Ye(e[u-1],m,0);if(g>t){var r=0,w=0,f=g-t,P=1<<f;for(i.sort(function(b,A){return m[A.s]-m[b.s]||b.f-A.f});r<n;++r){var _=i[r].s;if(m[_]>t)w+=P-(1<<g-m[_]),m[_]=t;else break}for(w>>=f;w>0;){var x=i[r].s;m[x]<t?w-=1<<t-m[x]++-1:++r}for(;r>=0&&w;--r){var O=i[r].s;m[O]==t&&(--m[O],++w)}g=t}return{t:new ot(m),l:g}},Ye=function(s,t,e){return s.s==-1?Math.max(Ye(s.l,t,e+1),Ye(s.r,t,e+1)):t[s.s]=e},Ar=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}},ie=function(s,t){for(var e=0,r=0;r<t.length;++r)e+=s[r]*t[r];return e},Ir=function(s,t,e){var r=e.length,n=Xe(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},Er=function(s,t,e,r,n,i,o,a,h,l,u){Dt(t,u++,e),++n[256];for(var c=je(n,15),d=c.t,m=c.l,g=je(i,15),w=g.t,f=g.l,P=Ar(d),_=P.c,x=P.n,O=Ar(w),v=O.c,b=O.n,A=new yt(19),C=0;C<_.length;++C)++A[_[C]&31];for(var C=0;C<v.length;++C)++A[v[C]&31];for(var M=je(A,7),L=M.t,X=M.l,j=19;j>4&&!L[Re[j-1]];--j);var xt=l+5<<3,E=ie(n,Ft)+ie(i,ne)+o,U=ie(n,d)+ie(i,w)+o+14+3*j+ie(A,L)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&xt<=E&&xt<=U)return Ir(t,u,s.subarray(h,h+l));var q,$,J,V;if(Dt(t,u,1+(U<E)),u+=2,U<E){q=Mt(d,m,0),$=d,J=Mt(w,f,0),V=w;var _t=Mt(L,X,0);Dt(t,u,x-257),Dt(t,u+5,b-1),Dt(t,u+10,j-4),u+=14;for(var C=0;C<j;++C)Dt(t,u+3*C,L[Re[C]]);u+=3*j;for(var k=[_,v],Q=0;Q<2;++Q)for(var B=k[Q],C=0;C<B.length;++C){var G=B[C]&31;Dt(t,u,_t[G]),u+=L[G],G>15&&(Dt(t,u,B[C]>>5&127),u+=B[C]>>12)}}else q=Yn,$=Ft,J=Zn,V=ne;for(var C=0;C<a;++C){var I=r[C];if(I>255){var G=I>>18&31;se(t,u,q[G+257]),u+=$[G+257],G>7&&(Dt(t,u,I>>23&31),u+=xe[G]);var Y=I&31;se(t,u,J[Y]),u+=V[Y],Y>3&&(se(t,u,I>>5&8191),u+=_e[Y])}else se(t,u,q[I]),u+=$[I]}return se(t,u,q[256]),u+$[256]},es=new ze([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ur=new ot(0),rs=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=es[t-1],d=c>>13,m=c&8191,g=(1<<e)-1,w=i.p||new yt(32768),f=i.h||new yt(g+1),P=Math.ceil(e/3),_=2*P,x=function(re){return(s[re]^s[re+1]<<P^s[re+2]<<_)&g},O=new ze(25e3),v=new yt(288),b=new yt(32),A=0,C=0,M=i.i||0,L=0,X=i.w||0,j=0;M+2<o;++M){var xt=x(M),E=M&32767,U=f[xt];if(w[E]=U,f[xt]=E,X<=M){var q=o-M;if((A>7e3||L>24576)&&(q>423||!l)){u=Er(s,h,0,O,v,b,C,L,j,M-j,u),L=A=C=0,j=M;for(var $=0;$<286;++$)v[$]=0;for(var $=0;$<30;++$)b[$]=0}var J=2,V=0,_t=m,k=E-U&32767;if(q>2&&xt==x(M-k))for(var Q=Math.min(d,q)-1,B=Math.min(32767,M),G=Math.min(258,q);k<=B&&--_t&&E!=U;){if(s[M+J]==s[M+J-k]){for(var I=0;I<G&&s[M+I]==s[M+I-k];++I);if(I>J){if(J=I,V=k,I>Q)break;for(var Y=Math.min(k,I-2),H=0,$=0;$<Y;++$){var tt=M-k+$&32767,jt=w[tt],Yt=tt-jt&32767;Yt>H&&(H=Yt,U=tt)}}}E=U,U=w[E],k+=E-U&32767}if(V){O[L++]=268435456|qe[J]<<18|Or[V];var It=qe[J]&31,Et=Or[V]&31;C+=xe[It]+_e[Et],++v[257+It],++b[Et],X=M+J,++A}else O[L++]=s[M],++v[s[M]]}}for(M=Math.max(M,X);M<o;++M)O[L++]=s[M],++v[s[M]];u=Er(s,h,l,O,v,b,C,L,j,M-j,u),l||(i.r=u&7|h[u/8|0]<<3,u-=7,i.h=f,i.p=w,i.i=M,i.w=X)}else{for(var M=i.w||0;M<o+l;M+=65535){var Lt=M+65535;Lt>=o&&(h[u/8|0]=l,Lt=o),u=Ir(h,u+1,s.subarray(M,Lt))}i.i=o}return Tr(a,0,r+Xe(u)+n)},Dr=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}}},ns=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 rs(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},ss=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=Dr();n.p(t.dictionary),$r(s,2,n.d())}},is=function(s,t){return((s[0]&15)!=8||s[0]>>4>7||(s[0]<<8|s[1])%31)&&Pt(6,"invalid zlib data"),(s[1]>>5&1)==+!t&&Pt(6,"invalid zlib data: "+(s[1]&32?"need":"unexpected")+" dictionary"),(s[1]>>3&4)+2};function os(s,t){t||(t={});var e=Dr();e.p(s);var r=ns(s,t,t.dictionary?6:2,4);return ss(r,t),$r(r,r.length-4,e.d()),r}function as(s,t){return ts(s.subarray(is(s,t),-4),{i:2},t,t)}var ls=typeof TextDecoder<"u"&&new TextDecoder,hs=0;try{ls.decode(Ur,{stream:!0}),hs=1}catch{}const cs="modern-font";function oe(s,t){if(!s)throw new Error(`[${cs}] ${t}`)}function us(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 zt(s){return ArrayBuffer.isView(s)?new DataView(s.buffer,s.byteOffset,s.byteLength):new DataView(s)}var Lr=Object.defineProperty,fs=(s,t,e)=>t in s?Lr(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&&Lr(t,e,n),n},ps=(s,t,e)=>(fs(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(us(t),e,r),this.littleEndian=n,ps(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=zt(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 ds=Object.defineProperty,gs=(s,t,e)=>t in s?ds(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ms=(s,t,e)=>(gs(s,t+"",e),e);const Br=new WeakMap;function y(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=Br.get(n);o||(o={columns:[],byteLength:0},Br.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){ms(this,"view"),this.view=new rt(t,e,r,n)}}function ys(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 Pe(s){s=ys(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 ws(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 vs(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 Ce 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 Fr=Object.defineProperty,bs=(s,t,e)=>t in s?Fr(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&&Fr(t,e,n),n},Nr=(s,t,e)=>(bs(s,typeof t!="symbol"?t+"":t,e),e);const ht=class Rn extends Ce{constructor(){super(...arguments),Nr(this,"format","EmbeddedOpenType"),Nr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,n=e.name.names,i=Pe(n.fontFamily||""),o=i.length,a=Pe(n.fontStyle||""),h=a.length,l=Pe(n.version||""),u=l.length,c=Pe(n.fullName||""),d=c.length,m=86+o+4+h+4+u+4+d+2+t.view.byteLength,g=new Rn(new ArrayBuffer(m),0,m,!0);g.EOTSize=g.view.byteLength,g.FontDataSize=t.view.byteLength,g.Version=131073,g.Flags=0,g.Charset=1,g.MagicNumber=20556,g.Padding1=0,g.CheckSumAdjustment=e.head.checkSumAdjustment;const w=e.os2;return w&&(g.FontPANOSE=w.fontPANOSE,g.Italic=w.fsSelection,g.Weight=w.usWeightClass,g.fsType=w.fsType,g.UnicodeRange=w.ulUnicodeRange,g.CodePageRange=w.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(i),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(u),g.view.writeBytes(l),g.view.writeUint16(0),g.view.writeUint16(d),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};ft([y("uint32")],ht.prototype,"EOTSize"),ft([y("uint32")],ht.prototype,"FontDataSize"),ft([y("uint32")],ht.prototype,"Version"),ft([y("uint32")],ht.prototype,"Flags"),ft([y({type:"uint8",size:10})],ht.prototype,"FontPANOSE"),ft([y("uint8")],ht.prototype,"Charset"),ft([y("uint8")],ht.prototype,"Italic"),ft([y("uint32")],ht.prototype,"Weight"),ft([y("uint16")],ht.prototype,"fsType"),ft([y("uint16")],ht.prototype,"MagicNumber"),ft([y({type:"uint8",size:16})],ht.prototype,"UnicodeRange"),ft([y({type:"uint8",size:8})],ht.prototype,"CodePageRange"),ft([y("uint32")],ht.prototype,"CheckSumAdjustment"),ft([y({type:"uint8",size:16})],ht.prototype,"Reserved"),ft([y("uint16")],ht.prototype,"Padding1");let xs=ht;var _s=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&&_s(t,e,n),n};class Kt extends vt{constructor(t,e){super(t,e,16)}}Me([y({type:"char",size:4})],Kt.prototype,"tag"),Me([y("uint32")],Kt.prototype,"checkSum"),Me([y("uint32")],Kt.prototype,"offset"),Me([y("uint32")],Kt.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"],Ss=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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 Ps=Object.defineProperty,Cs=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ae=(s,t,e)=>(Cs(s,typeof t!="symbol"?t+"":t,e),e);class Ze{constructor(t){ae(this,"index"),ae(this,"name"),ae(this,"isComposite",!1),ae(this,"components",[]),ae(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,d=l.length;c<d;c+=1){const m=l[c];m.type==="M"?u.push({type:"M",x:t+m.x*a,y:e+-m.y*h}):m.type==="L"?u.push({type:"L",x:t+m.x*a,y:e+-m.y*h}):m.type==="Q"?u.push({type:"Q",x1:t+m.x1*a,y1:e+-m.y1*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="C"?u.push({type:"C",x1:t+m.x1*a,y1:e+-m.y1*h,x2:t+m.x2*a,y2:e+-m.y2*h,x:t+m.x*a,y:e+-m.y*h}):m.type==="Z"&&u.push({type:"Z"})}return u}}class Ms extends Ze{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,d,m,g;const w=[],f=[];let P=0,_=!1,x=!1,O=o,v=0,b=0;function A(E,U){w.push({type:"L",x:E,y:U})}function C(E,U,q,$,J,V){w.push({type:"C",x1:E,y1:U,x2:q,y2:$,x:J,y:V})}function M(E,U){x&&l!==2&&L(),x=!0,w.push({type:"M",x:E,y:U})}function L(){w.push({type:"Z"})}function X(E){w.push(...E)}function j(){f.length%2!==0&&!_&&(O=f.shift()+i),P+=f.length>>1,f.length=0,_=!0}function xt(E){let U,q,$,J,V,_t,k,Q,B,G,I,Y,H=0;for(;H<E.length;){let tt=E[H++];switch(tt){case 1:j();break;case 3:j();break;case 4:f.length>1&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),M(v,b);break;case 5:for(;f.length>0;)v+=f.shift(),b+=f.shift(),A(v,b);break;case 6:for(;f.length>0&&(v+=f.shift(),A(v,b),f.length!==0);)b+=f.shift(),A(v,b);break;case 7:for(;f.length>0&&(b+=f.shift(),A(v,b),f.length!==0);)v+=f.shift(),A(v,b);break;case 8:for(;f.length>0;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 10:V=f.pop()+h,_t=t.subrs[V],_t&&xt(_t);break;case 11:return;case 12:switch(tt=E[H],H+=1,tt){case 35:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),b=Y+f.shift(),f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 34:c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=b,v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 36:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g,B=k+f.shift(),G=g,I=B+f.shift(),Y=G+f.shift(),v=I+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;case 37:c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),k=m+f.shift(),Q=g+f.shift(),B=k+f.shift(),G=Q+f.shift(),I=B+f.shift(),Y=G+f.shift(),Math.abs(I-v)>Math.abs(Y-b)?v=I+f.shift():b=Y+f.shift(),C(c,d,m,g,k,Q),C(B,G,I,Y,v,b);break;default:console.warn(`Glyph ${u}: unknown operator ${1200+tt}`),f.length=0}break;case 14:if(f.length>=4){const jt=Ke[f.pop()],Yt=Ke[f.pop()],It=f.pop(),Et=f.pop();if(jt&&Yt){n.isComposite=!0,n.components=[];const Lt=t.charset.indexOf(jt),re=t.charset.indexOf(Yt);n.components.push({glyphIndex:re,dx:0,dy:0}),n.components.push({glyphIndex:Lt,dx:Et,dy:It}),X(r.get(re).pathCommands);const br=JSON.parse(JSON.stringify(r.get(Lt).pathCommands));for(let xr=0;xr<br.length;xr+=1){const Ut=br[xr];Ut.type!=="Z"&&(Ut.x+=Et,Ut.y+=It),(Ut.type==="Q"||Ut.type==="C")&&(Ut.x1+=Et,Ut.y1+=It),Ut.type==="C"&&(Ut.x2+=Et,Ut.y2+=It)}X(br)}}else f.length>0&&!_&&(O=f.shift()+i,_=!0);x&&l!==2&&(L(),x=!1);break;case 18:j();break;case 19:case 20:j(),H+=P+7>>3;break;case 21:f.length>2&&!_&&(O=f.shift()+i,_=!0),b+=f.pop(),v+=f.pop(),M(v,b);break;case 22:f.length>1&&!_&&(O=f.shift()+i,_=!0),v+=f.pop(),M(v,b);break;case 23:j();break;case 24:for(;f.length>2;)c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);v+=f.shift(),b+=f.shift(),A(v,b);break;case 25:for(;f.length>6;)v+=f.shift(),b+=f.shift(),A(v,b);c=v+f.shift(),d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+f.shift(),C(c,d,m,g,v,b);break;case 26:for(f.length%2&&(v+=f.shift());f.length>0;)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m,b=g+f.shift(),C(c,d,m,g,v,b);break;case 27:for(f.length%2&&(b+=f.shift());f.length>0;)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g,C(c,d,m,g,v,b);break;case 28:U=E[H],q=E[H+1],f.push((U<<24|q<<16)>>16),H+=2;break;case 29:V=f.pop()+a,_t=t.gsubrs[V],_t&&xt(_t);break;case 30:for(;f.length>0&&(c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;case 31:for(;f.length>0&&(c=v+f.shift(),d=b,m=c+f.shift(),g=d+f.shift(),b=g+f.shift(),v=m+(f.length===1?f.shift():0),C(c,d,m,g,v,b),f.length!==0);)c=v,d=b+f.shift(),m=c+f.shift(),g=d+f.shift(),v=m+f.shift(),b=g+(f.length===1?f.shift():0),C(c,d,m,g,v,b);break;default:tt<32?console.warn(`Glyph ${u}: unknown operator ${tt}`):tt<247?f.push(tt-139):tt<251?(U=E[H],H+=1,f.push((tt-247)*256+U+108)):tt<255?(U=E[H],H+=1,f.push(-(tt-251)*256-U-108)):(U=E[H],q=E[H+1],$=E[H+2],J=E[H+3],H+=4,f.push((U<<24|q<<16|$<<8|J)/65536))}}}xt(e),this.pathCommands=w,_&&(this.advanceWidth=O)}}var Os=Object.defineProperty,Ts=(s,t,e)=>t in s?Os(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,As=(s,t,e)=>(Ts(s,t+"",e),e);class Qe{constructor(t){this._sfnt=t,As(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 Is extends Qe{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(t){const e=this._sfnt.cff,r=new Ms({index:t});return r.parse(e,e.charStringsIndex.get(t),this),r.name=e.charset[t],r}}var kr=Object.defineProperty,Es=(s,t,e)=>t in s?kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Gr=(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},Oe=(s,t,e)=>(Es(s,typeof t!="symbol"?t+"":t,e),e);class Te 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)}}Gr([y("uint16")],Te.prototype,"count"),Gr([y("uint8")],Te.prototype,"offsetSize");class Ae extends Te{constructor(){super(...arguments),Oe(this,"_isString",!1)}}class zr extends Te{constructor(){super(...arguments),Oe(this,"_isString",!0)}}const Us=[".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"],Ds=[".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"],Ls=[".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?Us[t]:s[t-391]}var Bs=Object.defineProperty,Fs=(s,t,e)=>t in s?Bs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Rr=(s,t,e)=>(Fs(s,typeof t!="symbol"?t+"":t,e),e);function z(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 qr extends vt{constructor(){super(...arguments),Rr(this,"_dict"),Rr(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 Ns=Object.defineProperty,Je=(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&&Ns(t,e,n),n};class Ee extends qr{}Je([z(19)],Ee.prototype,"subrs"),Je([z(20)],Ee.prototype,"defaultWidthX"),Je([z(21)],Ee.prototype,"nominalWidthX");var ks=Object.defineProperty,K=(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 W extends qr{}K([z(0,"string")],W.prototype,"version"),K([z(1,"string")],W.prototype,"notice"),K([z(1200,"string")],W.prototype,"copyright"),K([z(2,"string")],W.prototype,"fullName"),K([z(3,"string")],W.prototype,"familyName"),K([z(4,"string")],W.prototype,"weight"),K([z(1201)],W.prototype,"isFixedPitch"),K([z(1202)],W.prototype,"italicAngle"),K([z(1203,"number",-100)],W.prototype,"underlinePosition"),K([z(1204,"number",50)],W.prototype,"underlineThickness"),K([z(1205)],W.prototype,"paintType"),K([z(1206,"number",2)],W.prototype,"charstringType"),K([z(1207,"number[]",[.001,0,0,.001,0,0])],W.prototype,"fontMatrix"),K([z(13)],W.prototype,"uniqueId"),K([z(5,"number[]",[0,0,0,0])],W.prototype,"fontBBox"),K([z(1208)],W.prototype,"strokeWidth"),K([z(14)],W.prototype,"xuid"),K([z(15)],W.prototype,"charset"),K([z(16)],W.prototype,"encoding"),K([z(17)],W.prototype,"charStrings"),K([z(18,"number[]",[0,0])],W.prototype,"private");var Gs=Object.defineProperty,zs=(s,t,e)=>t in s?Gs(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,tr=(s,t,e)=>(zs(s,typeof t!="symbol"?t+"":t,e),e);function nt(s,t=s){return e=>{le.tableDefinitions.set(s,{tag:s,prop:t,class:e}),Object.defineProperty(le.prototype,t,{get(){return this.get(s)},set(r){return this.set(s,r)},configurable:!0,enumerable:!0})}}const Vr=class be{constructor(t){tr(this,"tables",new Map),tr(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 be(this.tableViews)}delete(t){const e=be.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const r=be.tableDefinitions.get(t);return r&&this.tables.set(r.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=be.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}};tr(Vr,"tableDefinitions",new Map);let le=Vr;class ct extends vt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var Hr=Object.defineProperty,Rs=Object.getOwnPropertyDescriptor,qs=(s,t,e)=>t in s?Hr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,he=(s,t,e,r)=>{for(var n=r>1?void 0:r?Rs(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&&Hr(t,e,n),n},er=(s,t,e)=>(qs(s,typeof t!="symbol"?t+"":t,e),e);p.Cff=class extends ct{constructor(t,e,r,n){super(t,e,r,n),er(this,"_glyphs"),er(this,"privateDict"),er(this,"subrsIndex"),this._init()}get glyphs(){return this._glyphs??(this._glyphs=new Is(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 zr(e,n),this.topDictIndex=new Ae(e,this.nameIndex.endOffset),this.stringIndex=new zr(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ae(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 Ee(e,r+o,i).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ae(e,r+o+this.privateDict.subrs))),this.charStringsIndex=new Ae(e,r+this.topDict.charStrings);const a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ds:this.topDict.charset===1?this.charset=$s:this.topDict.charset===2?this.charset=Ls: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=Ss: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}},he([y("uint8")],p.Cff.prototype,"majorVersion",2),he([y("uint8")],p.Cff.prototype,"minorVersion",2),he([y("uint8")],p.Cff.prototype,"headerSize",2),he([y("uint8")],p.Cff.prototype,"offsetSize",2),p.Cff=he([nt("CFF ","cff")],p.Cff);var Vs=Object.defineProperty,Ue=(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&&Vs(t,e,n),n};const ce=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}};Ue([y("uint16")],ce.prototype,"format"),Ue([y("uint16")],ce.prototype,"length"),Ue([y("uint16")],ce.prototype,"language"),Ue([y({type:"uint8",size:256})],ce.prototype,"glyphIndexArray");let rr=ce;var Hs=Object.defineProperty,nr=(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};class ue 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,d=i[u].entryCount;c<d;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 m=(l<<8|c+i[u].firstCode)%65535;e.set(m,h)}}return e}}nr([y("uint16")],ue.prototype,"format"),nr([y("uint16")],ue.prototype,"length"),nr([y("uint16")],ue.prototype,"language");function Wr(s){return s>32767?s-65536:s<-32767?s+65536:s}function sr(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:Wr(i-o)}):(n.start=Number(o),n.startId=i,n.delta=Wr(i-o))),e={unicode:o,glyphIndex:i})}),e&&(n.end=e.unicode,r.push(n)),r}var Ws=Object.defineProperty,Rt=(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&&Ws(t,e,n),n};const Nt=class Vn 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=sr(t,65535),r=e.length+1,n=Math.floor(Math.log(r)/Math.LN2),i=2*2**n,o=new Vn(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 d=l+o[l]/2+(u-n[l])-r,m=h[d];m!==0?t.set(u,(m+a[l])%65536):t.set(u,0)}return t.delete(65535),t}};Rt([y("uint16")],Nt.prototype,"format"),Rt([y("uint16")],Nt.prototype,"length"),Rt([y("uint16")],Nt.prototype,"language"),Rt([y("uint16")],Nt.prototype,"segCountX2"),Rt([y("uint16")],Nt.prototype,"searchRange"),Rt([y("uint16")],Nt.prototype,"entrySelector"),Rt([y("uint16")],Nt.prototype,"rangeShift");let ir=Nt;var Xs=Object.defineProperty,fe=(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 qt 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}}fe([y("uint16")],qt.prototype,"format"),fe([y("uint16")],qt.prototype,"length"),fe([y("uint16")],qt.prototype,"language"),fe([y("uint16")],qt.prototype,"firstCode"),fe([y("uint16")],qt.prototype,"entryCount");var js=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&&js(t,e,n),n};const Zt=class Hn 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=sr(t),r=new Hn(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}};pe([y("uint16")],Zt.prototype,"format"),pe([y("uint16")],Zt.prototype,"reserved"),pe([y("uint32")],Zt.prototype,"length"),pe([y("uint32")],Zt.prototype,"language"),pe([y("uint32")],Zt.prototype,"nGroups");let or=Zt;var Ys=Object.defineProperty,ar=(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 de 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}}ar([y("uint16")],de.prototype,"format"),ar([y("uint32")],de.prototype,"length"),ar([y("uint32")],de.prototype,"numVarSelectorRecords");var Xr=Object.defineProperty,Ks=Object.getOwnPropertyDescriptor,Zs=(s,t,e)=>t in s?Xr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,lr=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ks(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},jr=(s,t,e)=>(Zs(s,typeof t!="symbol"?t+"":t,e),e);p.Cmap=class extends ct{constructor(){super(...arguments),jr(this,"_unicodeToGlyphIndexMap"),jr(this,"_glyphIndexToUnicodesMap")}static from(t){const e=Array.from(t.keys()).some(c=>c>65535),r=ir.from(t),n=rr.from(t),i=e?or.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 p.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 rr(this.view.buffer,e.offset);break;case 2:n=new ue(this.view.buffer,e.offset,this.view.readUint16());break;case 4:n=new ir(this.view.buffer,e.offset,this.view.readUint16());break;case 6:n=new qt(this.view.buffer,e.offset,this.view.readUint16());break;case 12:n=new or(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:n=new de(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(d=>d.format===0))==null?void 0:a.view,r=(h=t.find(d=>d.platformID===3&&d.platformSpecificID===3&&d.format===2))==null?void 0:h.view,n=(l=t.find(d=>d.platformID===3&&d.platformSpecificID===1&&d.format===4))==null?void 0:l.view,i=(u=t.find(d=>d.platformID===3&&d.platformSpecificID===10&&d.format===12))==null?void 0:u.view,o=(c=t.find(d=>d.platformID===0&&d.platformSpecificID===5&&d.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())??[]])}},lr([y("uint16")],p.Cmap.prototype,"version",2),lr([y("uint16")],p.Cmap.prototype,"numberSubtables",2),p.Cmap=lr([nt("cmap")],p.Cmap);class Qs extends Ze{_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 oe(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();oe(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;oe(c<2e4,`Bad numberOfCoordinates:${u}`);const d=[];let m,g=0;for(;g<c;)if(m=t.view.readUint8(),d.push(m),g++,m&8&&g<c){const w=t.view.readUint8();for(let f=0;f<w;f++)d.push(m),g++}if(oe(d.length===c,`Bad flags length: ${d.length}, numberOfCoordinates: ${c}`),a.length>0){const w=[];let f;if(c>0){for(let x=0;x<c;x+=1)m=d[x],f={},f.onCurve=!!(m&1),f.lastPointOfContour=a.includes(x),w.push(f);let P=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.x=this._parseGlyphCoordinate(t,m,P,2,16),P=f.x;let _=0;for(let x=0;x<c;x+=1)m=d[x],f=w[x],f.y=this._parseGlyphCoordinate(t,m,_,4,32),_=f.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{oe(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 d=l.points[h.matchedPoints[1]];const m={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};d=this._transformPoints([d],m)[0],m.dx=c.x-d.x,m.dy=c.y-d.y,u=this._transformPoints(l.points,m)}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 d=0,m=l.length;d<m;++d)if(u=c,c=l[(d+1)%m],u.onCurve)i.push({type:"L",x:u.x,y:u.y});else{let g=c;c.onCurve||(g={x:(u.x+c.x)*.5,y:(u.y+c.y)*.5}),i.push({type:"Q",x1:u.x,y1:u.y,x:g.x,y:g.y})}i.push({type:"Z"})}this.pathCommands=i}}class Js extends Qe{get length(){return this._sfnt.loca.locations.length}_get(t){const e=this._sfnt.loca.locations,r=e[t],n=new Qs({index:t});return r!==e[t+1]&&n.parse(this._sfnt.glyf,r,this),n}}var Yr=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,ei=(s,t,e)=>t in s?Yr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ri=(s,t,e,r)=>{for(var n=r>1?void 0:r?ti(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},ni=(s,t,e)=>(ei(s,t+"",e),e);const Qt={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};p.Glyf=class extends ct{constructor(){super(...arguments),ni(this,"_glyphs")}static from(t){const e=t.reduce((n,i)=>n+i.byteLength,0),r=new p.Glyf(new ArrayBuffer(e));return t.forEach(n=>{r.view.writeBytes(n)}),r}get glyphs(){return this._glyphs??(this._glyphs=new Js(this._sfnt))}},p.Glyf=ri([nt("glyf")],p.Glyf);var si=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi=(s,t,e,r)=>{for(var n=r>1?void 0:r?ii(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&&si(t,e,n),n};p.Gpos=class extends ct{},p.Gpos=oi([nt("GPOS","gpos")],p.Gpos);var ai=Object.defineProperty,li=Object.getOwnPropertyDescriptor,Vt=(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};p.Gsub=class extends ct{},Vt([y("uint16")],p.Gsub.prototype,"majorVersion",2),Vt([y("uint16")],p.Gsub.prototype,"minorVersion",2),Vt([y("uint16")],p.Gsub.prototype,"scriptListOffset",2),Vt([y("uint16")],p.Gsub.prototype,"featureListOffset",2),Vt([y("uint16")],p.Gsub.prototype,"lookupListOffset",2),Vt([y("uint16")],p.Gsub.prototype,"featureVariationsOffset",2),p.Gsub=Vt([nt("GSUB","gsub")],p.Gsub);var hi=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,et=(s,t,e,r)=>{for(var n=r>1?void 0:r?ci(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&&hi(t,e,n),n};p.Head=class extends ct{constructor(t=new ArrayBuffer(54),e){super(t,e,Math.min(54,t.byteLength-(e??0)))}},et([y("fixed")],p.Head.prototype,"version",2),et([y("fixed")],p.Head.prototype,"fontRevision",2),et([y("uint32")],p.Head.prototype,"checkSumAdjustment",2),et([y("uint32")],p.Head.prototype,"magickNumber",2),et([y("uint16")],p.Head.prototype,"flags",2),et([y("uint16")],p.Head.prototype,"unitsPerEm",2),et([y({type:"longDateTime"})],p.Head.prototype,"created",2),et([y({type:"longDateTime"})],p.Head.prototype,"modified",2),et([y("int16")],p.Head.prototype,"xMin",2),et([y("int16")],p.Head.prototype,"yMin",2),et([y("int16")],p.Head.prototype,"xMax",2),et([y("int16")],p.Head.prototype,"yMax",2),et([y("uint16")],p.Head.prototype,"macStyle",2),et([y("uint16")],p.Head.prototype,"lowestRecPPEM",2),et([y("int16")],p.Head.prototype,"fontDirectionHint",2),et([y("int16")],p.Head.prototype,"indexToLocFormat",2),et([y("int16")],p.Head.prototype,"glyphDataFormat",2),p.Head=et([nt("head")],p.Head);var ui=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,pt=(s,t,e,r)=>{for(var n=r>1?void 0:r?fi(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&&ui(t,e,n),n};p.Hhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},pt([y("fixed")],p.Hhea.prototype,"version",2),pt([y("int16")],p.Hhea.prototype,"ascent",2),pt([y("int16")],p.Hhea.prototype,"descent",2),pt([y("int16")],p.Hhea.prototype,"lineGap",2),pt([y("uint16")],p.Hhea.prototype,"advanceWidthMax",2),pt([y("int16")],p.Hhea.prototype,"minLeftSideBearing",2),pt([y("int16")],p.Hhea.prototype,"minRightSideBearing",2),pt([y("int16")],p.Hhea.prototype,"xMaxExtent",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRise",2),pt([y("int16")],p.Hhea.prototype,"caretSlopeRun",2),pt([y("int16")],p.Hhea.prototype,"caretOffset",2),pt([y({type:"int16",size:4})],p.Hhea.prototype,"reserved",2),pt([y("int16")],p.Hhea.prototype,"metricDataFormat",2),pt([y("uint16")],p.Hhea.prototype,"numOfLongHorMetrics",2),p.Hhea=pt([nt("hhea")],p.Hhea);var Kr=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,di=(s,t,e)=>t in s?Kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,gi=(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&&Kr(t,e,n),n},mi=(s,t,e)=>(di(s,t+"",e),e);p.Hmtx=class extends ct{constructor(){super(...arguments),mi(this,"_metrics")}static from(t){const e=t.length*4,r=new p.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()}))}},p.Hmtx=gi([nt("hmtx")],p.Hmtx);var yi=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,vi=(s,t,e,r)=>{for(var n=r>1?void 0:r?wi(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&&yi(t,e,n),n};p.Kern=class extends ct{},p.Kern=vi([nt("kern","kern")],p.Kern);var Zr=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,xi=(s,t,e)=>t in s?Zr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_i=(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&&Zr(t,e,n),n},Si=(s,t,e)=>(xi(s,t+"",e),e);p.Loca=class extends ct{constructor(){super(...arguments),Si(this,"_locations")}static from(t,e=1){const r=t.length*(e?4:2),n=new p.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)}},p.Loca=_i([nt("loca")],p.Loca);var Pi=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,ut=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ci(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&&Pi(t,e,n),n};p.Maxp=class extends ct{constructor(t=new ArrayBuffer(32),e){super(t,e,Math.min(32,t.byteLength-(e??0)))}},ut([y("fixed")],p.Maxp.prototype,"version",2),ut([y("uint16")],p.Maxp.prototype,"numGlyphs",2),ut([y("uint16")],p.Maxp.prototype,"maxPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxContours",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentContours",2),ut([y("uint16")],p.Maxp.prototype,"maxZones",2),ut([y("uint16")],p.Maxp.prototype,"maxTwilightPoints",2),ut([y("uint16")],p.Maxp.prototype,"maxStorage",2),ut([y("uint16")],p.Maxp.prototype,"maxFunctionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxInstructionDefs",2),ut([y("uint16")],p.Maxp.prototype,"maxStackElements",2),ut([y("uint16")],p.Maxp.prototype,"maxSizeOfInstructions",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentElements",2),ut([y("uint16")],p.Maxp.prototype,"maxComponentDepth",2),p.Maxp=ut([nt("maxp")],p.Maxp);var Qr=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,Oi=(s,t,e)=>t in s?Qr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,De=(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&&Qr(t,e,n),n},Ti=(s,t,e)=>(Oi(s,t+"",e),e);const Jr={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"},hr={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Ai={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},tn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};p.Name=class extends ct{constructor(){super(...arguments),Ti(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=hr.Macintosh,i=Ai.Default,o=0;e.some(h=>h.platform===hr.Microsoft&&h.encoding===tn.UCS2&&h.language===1033)&&(n=hr.Microsoft,i=tn.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&&Jr[l.nameId]&&(a[Jr[l.nameId]]=o===0?ws(l.name):vs(l.name))}return a}},De([y("uint16")],p.Name.prototype,"format",2),De([y("uint16")],p.Name.prototype,"count",2),De([y("uint16")],p.Name.prototype,"stringOffset",2),p.Name=De([nt("name")],p.Name);var Ii=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,T=(s,t,e,r)=>{for(var n=r>1?void 0:r?Ei(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&&Ii(t,e,n),n};p.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]}},T([y("uint16")],p.Os2.prototype,"version",2),T([y("int16")],p.Os2.prototype,"xAvgCharWidth",2),T([y("uint16")],p.Os2.prototype,"usWeightClass",2),T([y("uint16")],p.Os2.prototype,"usWidthClass",2),T([y("uint16")],p.Os2.prototype,"fsType",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySubscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySubscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYSize",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptXOffset",2),T([y("uint16")],p.Os2.prototype,"ySuperscriptYOffset",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutSize",2),T([y("uint16")],p.Os2.prototype,"yStrikeoutPosition",2),T([y("uint16")],p.Os2.prototype,"sFamilyClass",2),T([y({type:"uint8"})],p.Os2.prototype,"bFamilyType",2),T([y({type:"uint8"})],p.Os2.prototype,"bSerifStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bWeight",2),T([y({type:"uint8"})],p.Os2.prototype,"bProportion",2),T([y({type:"uint8"})],p.Os2.prototype,"bContrast",2),T([y({type:"uint8"})],p.Os2.prototype,"bStrokeVariation",2),T([y({type:"uint8"})],p.Os2.prototype,"bArmStyle",2),T([y({type:"uint8"})],p.Os2.prototype,"bLetterform",2),T([y({type:"uint8"})],p.Os2.prototype,"bMidline",2),T([y({type:"uint8"})],p.Os2.prototype,"bXHeight",2),T([y({type:"uint8",size:16})],p.Os2.prototype,"ulUnicodeRange",2),T([y({type:"char",size:4})],p.Os2.prototype,"achVendID",2),T([y("uint16")],p.Os2.prototype,"fsSelection",2),T([y("uint16")],p.Os2.prototype,"usFirstCharIndex",2),T([y("uint16")],p.Os2.prototype,"usLastCharIndex",2),T([y("int16")],p.Os2.prototype,"sTypoAscender",2),T([y("int16")],p.Os2.prototype,"sTypoDescender",2),T([y("int16")],p.Os2.prototype,"sTypoLineGap",2),T([y("uint16")],p.Os2.prototype,"usWinAscent",2),T([y("uint16")],p.Os2.prototype,"usWinDescent",2),T([y({offset:72,type:"uint8",size:8})],p.Os2.prototype,"ulCodePageRange",2),T([y({offset:72,type:"int16"})],p.Os2.prototype,"sxHeight",2),T([y("int16")],p.Os2.prototype,"sCapHeight",2),T([y("uint16")],p.Os2.prototype,"usDefaultChar",2),T([y("uint16")],p.Os2.prototype,"usBreakChar",2),T([y("uint16")],p.Os2.prototype,"usMaxContext",2),p.Os2=T([nt("OS/2","os2")],p.Os2);var Ui=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ot=(s,t,e,r)=>{for(var n=r>1?void 0:r?Di(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&&Ui(t,e,n),n};p.Post=class extends ct{constructor(t=new ArrayBuffer(32),e,r){super(t,e,r)}},Ot([y("fixed")],p.Post.prototype,"format",2),Ot([y("fixed")],p.Post.prototype,"italicAngle",2),Ot([y("int16")],p.Post.prototype,"underlinePosition",2),Ot([y("int16")],p.Post.prototype,"underlineThickness",2),Ot([y("uint32")],p.Post.prototype,"isFixedPitch",2),Ot([y("uint32")],p.Post.prototype,"minMemType42",2),Ot([y("uint32")],p.Post.prototype,"maxMemType42",2),Ot([y("uint32")],p.Post.prototype,"minMemType1",2),Ot([y("uint32")],p.Post.prototype,"maxMemType1",2),p.Post=Ot([nt("post")],p.Post);var $i=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,dt=(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&&$i(t,e,n),n};p.Vhea=class extends ct{constructor(t=new ArrayBuffer(36),e){super(t,e,Math.min(36,t.byteLength-(e??0)))}},dt([y("fixed")],p.Vhea.prototype,"version",2),dt([y("int16")],p.Vhea.prototype,"vertTypoAscender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoDescender",2),dt([y("int16")],p.Vhea.prototype,"vertTypoLineGap",2),dt([y("int16")],p.Vhea.prototype,"advanceHeightMax",2),dt([y("int16")],p.Vhea.prototype,"minTopSideBearing",2),dt([y("int16")],p.Vhea.prototype,"minBottomSideBearing",2),dt([y("int16")],p.Vhea.prototype,"yMaxExtent",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRise",2),dt([y("int16")],p.Vhea.prototype,"caretSlopeRun",2),dt([y("int16")],p.Vhea.prototype,"caretOffset",2),dt([y({type:"int16",size:4})],p.Vhea.prototype,"reserved",2),dt([y("int16")],p.Vhea.prototype,"metricDataFormat",2),dt([y("int16")],p.Vhea.prototype,"numOfLongVerMetrics",2),p.Vhea=dt([nt("vhea")],p.Vhea);var en=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Fi=(s,t,e)=>t in s?en(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Ni=(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&&en(t,e,n),n},ki=(s,t,e)=>(Fi(s,t+"",e),e);p.Vmtx=class extends ct{constructor(){super(...arguments),ki(this,"_metrics")}static from(t){const e=t.length*4,r=new p.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()}))}},p.Vmtx=Ni([nt("vmtx")],p.Vmtx);var rn=Object.defineProperty,Gi=(s,t,e)=>t in s?rn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(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&&rn(t,e,n),n},$e=(s,t,e)=>(Gi(s,typeof t!="symbol"?t+"":t,e),e);class st extends Ce{constructor(){super(...arguments),$e(this,"format","TrueType"),$e(this,"mimeType","font/ttf"),$e(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(zt(t).getUint32(0))}static checksum(t){const e=zt(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,d)=>c+e(d.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,d)=>{const m=l[h++];m.tag=d,m.checkSum=this.checksum(c),m.offset=a,m.length=c.byteLength,i.view.writeBytes(c,a),a+=e(m.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 Kt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new le(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}}$e(st,"signature",new Set([65536,1953658213,1954115633])),ge([y("uint32")],st.prototype,"scalerType"),ge([y("uint16")],st.prototype,"numTables"),ge([y("uint16")],st.prototype,"searchRange"),ge([y("uint16")],st.prototype,"entrySelector"),ge([y("uint16")],st.prototype,"rangeShift");var zi=Object.defineProperty,Ri=(s,t,e)=>t in s?zi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,cr=(s,t,e)=>(Ri(s,typeof t!="symbol"?t+"":t,e),e);class Le extends st{constructor(){super(...arguments),cr(this,"format","OpenType"),cr(this,"mimeType","font/otf")}static from(t){return super.from(t)}}cr(Le,"signature",new Set([1330926671]));var qi=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&&qi(t,e,n),n};class Ht extends vt{constructor(t,e){super(t,e,20)}}me([y({type:"char",size:4})],Ht.prototype,"tag"),me([y("uint32")],Ht.prototype,"offset"),me([y("uint32")],Ht.prototype,"compLength"),me([y("uint32")],Ht.prototype,"origLength"),me([y("uint32")],Ht.prototype,"origChecksum");var nn=Object.defineProperty,Vi=(s,t,e)=>t in s?nn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,wt=(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&&nn(t,e,n),n},Be=(s,t,e)=>(Vi(s,typeof t!="symbol"?t+"":t,e),e);const gt=class _r extends Ce{constructor(){super(...arguments),Be(this,"format","WOFF"),Be(this,"mimeType","font/woff"),Be(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(zt(t).getUint32(0))}static checkSum(t){const e=zt(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,d)=>{const m=zt(os(new Uint8Array(c.buffer,c.byteOffset,c.byteLength)));n.push({tag:d,view:m.byteLength<c.byteLength?m:c,rawView:c})});const i=n.length,o=n.reduce((c,d)=>c+r(d.view.byteLength),0),a=new _r(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,d)=>c+r(d.rawView.byteLength),0);let h=44+i*20,l=0;const u=a.getDirectories();return n.forEach(c=>{const d=u[l++];d.tag=c.tag,d.offset=h,d.compLength=c.view.byteLength,d.origChecksum=_r.checkSum(c.rawView),d.origLength=c.rawView.byteLength,a.view.writeBytes(c.view,h),h+=r(d.compLength)}),a.view.writeBytes(e),a}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ht(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new le(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(as(new Uint8Array(this.view.buffer.slice(n,a))).buffer),t},{}))}};Be(gt,"signature",new Set([2001684038])),wt([y("uint32")],gt.prototype,"signature"),wt([y("uint32")],gt.prototype,"flavor"),wt([y("uint32")],gt.prototype,"length"),wt([y("uint16")],gt.prototype,"numTables"),wt([y("uint16")],gt.prototype,"reserved"),wt([y("uint32")],gt.prototype,"totalSfntSize"),wt([y("uint16")],gt.prototype,"majorVersion"),wt([y("uint16")],gt.prototype,"minorVersion"),wt([y("uint32")],gt.prototype,"metaOffset"),wt([y("uint32")],gt.prototype,"metaLength"),wt([y("uint32")],gt.prototype,"metaOrigLength"),wt([y("uint32")],gt.prototype,"privOffset"),wt([y("uint32")],gt.prototype,"privLength");let $t=gt;function sn(s){if(st.is(s))return new st(s);if(Le.is(s))return new Le(s);if($t.is(s))return new $t(s)}var Hi=Object.defineProperty,Wi=(s,t,e)=>t in s?Hi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ye=(s,t,e)=>(Wi(s,typeof t!="symbol"?t+"":t,e),e);const on=class Wn{constructor(){ye(this,"fallbackFont"),ye(this,"_loading",new Map),ye(this,"_loaded",new Map),ye(this,"_namesUrls",new Map)}_createRequest(t,e){const r=new AbortController;return{url:t,when:fetch(t,{...Wn.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:en(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,u),i&&this.injectStyleTag(d,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)})}};de(rn,"defaultRequestInit",{cache:"force-cache"});let nn=rn;const sn=new nn;function on(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,f)=>w-f),d=new Map;c.forEach(w=>{const f=a.get(w)??0;let P=d.get(f);P||d.set(f,P=new Set),P.add(w)});const m=[],g=w=>{const f=l[w],P=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],x=h[w+1]??_,O={...f,...P,rawGlyphIndex:w,glyphIndex:m.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,x-_)};return m.push(O),O};return g(0),c.forEach(w=>g(a.get(w))),m.slice().forEach(w=>{const{view:f}=w;if(!f.byteLength||f.getInt16(0)>=0)return;let _=10,x;do{x=f.getUint16(_);const O=_+2,v=f.getUint16(O);_+=4,Kt.ARG_1_AND_2_ARE_WORDS&x?_+=4:_+=2,Kt.WE_HAVE_A_SCALE&x?_+=2:Kt.WE_HAVE_AN_X_AND_Y_SCALE&x?_+=4:Kt.WE_HAVE_A_TWO_BY_TWO&x&&(_+=8);const b=g(v);f.setUint16(O,b.glyphIndex)}while(Kt.MORE_COMPONENTS&x)}),m}function an(s,t){const e=on(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=p.Loca.from([...e.map(d=>{const m=h;return h+=d.view.byteLength,m}),h],n.indexToLocFormat);const l=e.reduce((d,m,g)=>(m.unicodes.forEach(w=>d.set(w,g)),d),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(d=>d.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const c=new p.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 Vi(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof Dt)e=s.sfnt.clone(),r="woff";else{const i=kt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if(Dt.is(i))e=new Dt(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=an(e,t);switch(r){case"ttf":return st.from(n);case"woff":return Dt.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return Dt.from(n).view.buffer}}const Hi={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Wi(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:d=0,shadowColor:m="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=Hi[o],s.miterLimit=a,h&&s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=d,s.shadowColor=m}class S{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new S(1/0,1/0)}static get MIN(){return new S(-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 S(this.x,this.y)}}class z{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){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 z(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 S((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new z(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Xi=Object.defineProperty,ji=(s,t,e)=>t in s?Xi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Yi=(s,t,e)=>(ji(s,t+"",e),e);class vt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){Yi(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],d=r[2],m=r[5],g=r[8],w=n[0],f=n[3],P=n[6],_=n[1],x=n[4],O=n[7],v=n[2],b=n[5],A=n[8];return i[0]=o*w+a*_+h*v,i[3]=o*f+a*x+h*b,i[6]=o*P+a*O+h*A,i[1]=l*w+u*_+c*v,i[4]=l*f+u*x+c*b,i[7]=l*P+u*O+c*A,i[2]=d*w+m*_+g*v,i[5]=d*f+m*x+g*b,i[8]=d*P+m*O+g*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,d=a*h-u*i,m=l*i-o*h,g=e*c+r*d+n*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=d*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=m*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(lr.makeScale(t,e)),this}rotate(t){return this.premultiply(lr.makeRotation(-t)),this}translate(t,e){return this.premultiply(lr.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 lr=new vt;function ln(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 Ki(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 d=t*t,m=e*e;const g=u*u,w=c*c,f=g/d+w/m;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,d=t*t,m=e*e}const P=d*w+m*g,_=(d*m-P)/P;let x=Math.sqrt(Math.max(0,_));n===i&&(x=-x);const O=x*t*c/e,v=-x*e*u/t,b=Math.cos(r)*O-Math.sin(r)*v+(o.x+a.x)/2,A=Math.sin(r)*O+Math.cos(r)*v+(o.y+a.y)/2,C=ln(1,0,(u-O)/t,(c-v)/e),M=ln((u-O)/t,(c-v)/e,(-u-O)/t,(-c-v)/e)%(Math.PI*2);s.ellipse(b,A,t,e,r,C,C+M,i===1)}function Zt(s,t){return s-(t-s)}function hn(s,t){const e=new S,r=new S;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(Zt(e.x,r.x),Zt(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(Zt(e.x,r.x),Zt(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=Zt(e.x,r.x),h=Zt(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),Ki(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 Tt(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function d(f,P,_){const x=new SyntaxError(`Unexpected character "${f}" at index ${P}.`);throw x.partial=_,x}function m(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=s.length;for(let f=0;f<w;f++){if(g=s[f],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,m();continue}if(a===0){if(Z.WHITESPACE.test(g))continue;if(Z.DIGIT.test(g)||Z.SIGN.test(g)){a=1,l=g;continue}if(Z.POINT.test(g)){a=2,l=g;continue}Z.COMMA.test(g)&&(h&&d(g,f,c),h=!0)}if(a===1){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.POINT.test(g)){l+=g,a=2;continue}if(Z.EXP.test(g)){a=3;continue}Z.SIGN.test(g)&&l.length===1&&Z.SIGN.test(l[0])&&d(g,f,c)}if(a===2){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.EXP.test(g)){a=3;continue}Z.POINT.test(g)&&l[l.length-1]==="."&&d(g,f,c)}if(a===3){if(Z.DIGIT.test(g)){u+=g;continue}if(Z.SIGN.test(g)){if(u===""){u+=g;continue}u.length===1&&Z.SIGN.test(u)&&d(g,f,c)}}Z.WHITESPACE.test(g)?(m(),a=0,h=!1):Z.COMMA.test(g)?(m(),a=0,h=!0):Z.SIGN.test(g)?(m(),a=1,l=g):Z.POINT.test(g)?(m(),a=2,l=g):d(g,f,c)}return m(),c}function Zi(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 Qi(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${Zi(s[e])} `;return t}const Ji=/[a-df-z][^a-df-z]*/gi;function cn(s){const t=[],e=s.match(Ji);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=Tt(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=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Tt(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=Tt(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=Tt(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=Tt(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=Tt(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=Tt(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 to=Object.defineProperty,eo=(s,t,e)=>t in s?to(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,hr=(s,t,e)=>(eo(s,typeof t!="symbol"?t+"":t,e),e);class Vt{constructor(){hr(this,"arcLengthDivisions",200),hr(this,"_cacheArcLengths"),hr(this,"_needsUpdate",!1)}getPointAt(t,e=new S){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],d=r[n+1]-u,m=(o-u)/d;return(n+m)/(i-1)}getTangent(t,e=new S){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=S.MAX,e=S.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 z(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 Qi(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function un(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 ro(s,t){const e=1-s;return e*e*t}function no(s,t){return 2*(1-s)*s*t}function so(s,t){return s*s*t}function fn(s,t,e,r){return ro(s,t)+no(s,e)+so(s,r)}function io(s,t){const e=1-s;return e*e*e*t}function oo(s,t){const e=1-s;return 3*e*e*s*t}function ao(s,t){return 3*(1-s)*s*s*t}function lo(s,t){return s*s*s*t}function pn(s,t,e,r,n){return io(s,t)+oo(s,e)+ao(s,r)+lo(s,n)}class ho extends Vt{constructor(t=new S,e=new S,r=new S,n=new S){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new S){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(pn(t,r.x,n.x,i.x,o.x),pn(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=S.MAX,e=S.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,d)=>{for(const m of c)for(let g=0;g<=d;g++){const w=g/d-.5,f=Math.min(1,Math.max(0,m+w)),P=this.getPoint(f);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.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 co=new vt,dn=new vt,gn=new vt,De=new S;class uo extends Vt{constructor(t=new S,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 S){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,d=h-this.center.y;a=c*l-d*u+this.center.x,h=c*u+d*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),d=Math.abs(n-i),m=d>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const f=n+Math.PI,P=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),_=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:P,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const f=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),P=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:m,sweepFlag:g,x:f,y:P}]}}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 De.set(this.center.x,this.center.y),De.applyMatrix3(t),this.center.x=De.x,this.center.y=De.y,go(t)?fo(this,t):po(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=S.MAX,e=S.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),d=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-d),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+d),{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 fo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new S(e*n,e*i),a=new S(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=co.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=dn.copy(u).invert(),g=gn.copy(c).transpose().multiply(c).elements,w=mo(g[0],g[1],g[4]),f=Math.sqrt(w.rt1),P=Math.sqrt(w.rt2);if(s.radiusX=1/f,s.radiusY=1/P,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=dn.set(f,0,0,0,P,0,0,0,1),O=gn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(O).multiply(u),b=A=>{const{x:C,y:M}=new S(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(M,C)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),mn(t)&&(s.clockwise=!s.clockwise)}}function po(s,t){const e=yn(t),r=wn(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,mn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function mn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function go(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=yn(s),n=wn(s);return Math.abs(e/(r*n))>Number.EPSILON}function yn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function wn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function mo(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 cr extends Vt{constructor(t=new S,e=new S){super(),this.start=t,this.end=e}getPoint(t,e=new S){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new S){return this.getPoint(t,e)}getTangent(t,e=new S){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new S){return this.getTangent(t,e)}getNormal(t,e=new S){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=S.MAX,e=S.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 yo extends Vt{constructor(t=new S,e=new S,r=new S){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new S){const{start:r,control:n,end:i}=this;return e.set(fn(t,r.x,n.x,i.x),fn(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=S.MAX,e=S.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 wo=Object.defineProperty,vo=(s,t,e)=>t in s?wo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,vn=(s,t,e)=>(vo(s,typeof t!="symbol"?t+"":t,e),e);class bo extends Vt{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,vn(this,"curves",[]),vn(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 S(t-r,e-n),new S(t+r,e-n),new S(t+r,e+n),new S(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new cr(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=S.MAX,e=S.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 xo extends Vt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new S){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(un(o,a.x,h.x,l.x,u.x),un(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 _o=Object.defineProperty,So=(s,t,e)=>t in s?_o(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ge=(s,t,e)=>(So(s,typeof t!="symbol"?t+"":t,e),e);class me extends Vt{constructor(t){super(),ge(this,"curves",[]),ge(this,"startPoint"),ge(this,"currentPoint",new S),ge(this,"autoClose",!1),ge(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 hn(t,this),this}addData(t){return this.addCommands(cn(t)),this}getPoint(t,e=new S){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 cr(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 cr(this.currentPoint.clone(),new S(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 ho(this.currentPoint.clone(),new S(t,e),new S(r,n),new S(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 yo(this.currentPoint.clone(),new S(t,e),new S(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 uo(new S(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 bo(new S(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new xo([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=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new z(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 Po(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var Co=Object.defineProperty,Mo=(s,t,e)=>t in s?Co(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,ur=(s,t,e)=>(Mo(s,typeof t!="symbol"?t+"":t,e),e);class bt{constructor(t){ur(this,"currentPath",new me),ur(this,"paths",[this.currentPath]),ur(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 me().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 me().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 hn(t,this),this}addData(t){return this.addCommands(cn(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=S.MAX,e=S.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 z(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[Po(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=!0){const{fill:r="#000",stroke:n="none"}=this.style;e&&Wi(t,this.style),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 fr="px",bn=90,xn=["mm","cm","in","pt","pc","px"],pr={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 $(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=xn.length;r<n;r++){const i=xn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&fr!=="px"?e=pr.in[fr]/bn:(e=pr[t][fr],e<0&&(e=pr[t].in*bn)),e*Number.parseFloat(s)}const Oo=new vt,Le=new vt,_n=new vt,Sn=new vt;function To(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Ao(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Ao(s){const t=new vt,e=Oo;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate($(s.getAttribute("x")),$(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=Tt(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,d=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],d=l[2]),Le.makeTranslation(-c,-d),_n.makeRotation(u),Sn.multiplyMatrices(_n,Le),Le.makeTranslation(c,d),e.multiplyMatrices(Le,Sn)}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 Io(s){return new bt().addPath(new me().arc($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("r")||0),0,Math.PI*2))}function Eo(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 Uo(s){return new bt().addPath(new me().ellipse($(s.getAttribute("cx")||0),$(s.getAttribute("cy")||0),$(s.getAttribute("rx")||0),$(s.getAttribute("ry")||0),0,0,Math.PI*2))}function $o(s){return new bt().moveTo($(s.getAttribute("x1")||0),$(s.getAttribute("y1")||0)).lineTo($(s.getAttribute("x2")||0),$(s.getAttribute("y2")||0))}function Do(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Lo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Bo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Lo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Fo=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function No(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Fo,(n,i,o)=>{const a=$(i),h=$(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function ko(s){const t=$(s.getAttribute("x")||0),e=$(s.getAttribute("y")||0),r=$(s.getAttribute("rx")||s.getAttribute("ry")||0),n=$(s.getAttribute("ry")||s.getAttribute("rx")||0),i=$(s.getAttribute("width")),o=$(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(d){return d.startsWith("url")&&console.warn("url access in attributes is not implemented."),d}),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,$(h)))}function o(h){return Math.max(0,$(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>$(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",$),n("visibility","visibility"),t}function dr(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":Eo(s,i);break;case"g":t=At(s,t,i);break;case"path":t=At(s,t,i),s.hasAttribute("d")&&(n=Do(s));break;case"rect":t=At(s,t,i),n=ko(s);break;case"polygon":t=At(s,t,i),n=Bo(s);break;case"polyline":t=At(s,t,i),n=No(s);break;case"circle":t=At(s,t,i),n=Io(s);break;case"ellipse":t=At(s,t,i),n=Uo(s);break;case"line":t=At(s,t,i),n=$o(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=s.viewportElement)==null?void 0:u.getElementById(d);m?dr(m,t,e):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}const o=new vt,a=[],h=To(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,d=l.length;c<d;c++){const m=l[c];r&&m.nodeName!=="style"&&m.nodeName!=="defs"||dr(m,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const Pn="data:image/svg+xml;",Cn=`${Pn}base64,`,Mn=`${Pn}charset=utf8,`;function On(s){if(typeof s=="string"){let t;return s.startsWith(Cn)?(s=s.substring(Cn.length,s.length),t=atob(s)):s.startsWith(Mn)?(s=s.substring(Mn.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function Go(s){return dr(On(s),{})}function Be(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 Tn(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 gr(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 An(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 In(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=>An(c,t,i,o))),(r||n)&&(a=a.map(c=>gr(c,t,r,n))),a=a.map(c=>{const d=c.x-l,m=-(c.y-u);return c=Tn({x:d,y:m},h),{x:l+c.x,y:u-c.y}}),a[0]}const Ro=new Set(["©","®","÷"]),zo=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class En{constructor(t,e,r){F(this,"boundingBox",new z);F(this,"textWidth",0);F(this,"textHeight",0);F(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=sn.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof Dt||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,isVertical:u}=this,{left:c,top:d,height:m}=l,{fontSize:g}=h,w=e/g,f=t.getAdvanceWidth(a,g),P=(r+Math.abs(n))/w,_=r/w,x=(r-i.yStrikeoutPosition)/w,O=i.yStrikeoutSize/w,v=(r-o.underlinePosition)/w,b=o.underlineThickness/w;return this.glyphWidth=f,this.glyphHeight=P,this.underlinePosition=v,this.underlineThickness=b,this.yStrikeoutPosition=x,this.yStrikeoutSize=O,this.baseline=_,this.centerDiviation=.5*m-_,this.glyphBox=u?new z(c,d,P,f):new z(c,d,f,P),this.centerPoint=this.glyphBox.getCenterPoint(),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:d,descender:m}=t,g=d,w=m,f=c.sTypoAscender,{left:P,top:_}=o,{fontSize:x,fontStyle:O}=a;let v=P,b=_+h,A,C;if(e&&(v+=(l-u)/2,Math.abs(n-i)>.1&&(b-=(g-f)/(g+Math.abs(w))*l),A=void 0),e&&!Ro.has(r)&&(r.codePointAt(0)<=256||zo.has(r))){C=t.getPathCommands(r,v,_+h-(l-u)/2,x)??[];const L={y:_-(l-u)/2+l/2,x:v+u/2};O==="italic"&&(C=this._italic(C,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),C=this._rotation90(C,L)}else A!==void 0?(C=t.glyphs.get(A).getPathCommands(v,b,x),O==="italic"&&(C=this._italic(C,e?{x:v+u/2,y:_+f/(g+Math.abs(w))*l}:void 0))):(C=t.getPathCommands(r,v,b,x)??[],O==="italic"&&(C=this._italic(C,e?{x:v+l/2,y:b}:void 0)));C.push(...this._decoration());const M=new bt(C);return M.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=M,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=gr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=In({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})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Fe({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Un{constructor(t,e={},r){F(this,"boundingBox",new z);F(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,...Be(this.style)},this}initCharacters(){const t=[];let e=0;for(const r of this.computedContent)t.push(new En(r,e++,this));return this.characters=t,this}}class Qt{constructor(t,e){F(this,"boundingBox",new z);F(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Be(this.parentStyle),...Be(this.style)},this}addFragment(t,e){const r=new Un(t,e,this);return this.fragments.push(r),r}}class Ht{constructor(t){this._text=t}}class $n extends Ht{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class Dn extends Ht{getBoundingBox(){const{characters:t,effects:e}=this._text,r=[];return t.forEach(n=>{const i=n.computedStyle.fontSize;e==null||e.forEach(o=>{const a=(o.offsetX??0)*i,h=(o.offsetY??0)*i,l=(o.shadowOffsetX??0)*i,u=(o.shadowOffsetY??0)*i,c=Math.max(.1,o.textStrokeWidth??0)*i,d=n.boundingBox.clone();d.left+=a+l-c,d.top+=h+u-c,d.width+=c*2,d.height+=c*2,r.push(d)})}),z.from(...r)}draw(t){const{ctx:e}=t,{effects:r,characters:n,boundingBox:i}=this._text;return r&&(r.forEach(o=>{Ct(o,i,e)}),n.forEach(o=>{r.forEach(a=>{o.drawTo(e,a)})})),this}}class Ln extends Ht{constructor(){super(...arguments);F(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new z;const e=S.MAX,r=S.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new z(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(){const{characters:e}=this._text;let r;const n=[];let i;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((i==null?void 0:i.url)===a.url&&r.length&&r[0].boundingBox.top===o.boundingBox.top&&r[0].fontSize===o.fontSize?r.push(o):(r=[],r.push(o),n.push(r))),i=a}),this.paths=n.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:z.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const r=On(e),n=Go(r),i=S.MAX,o=S.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new z(i.x,i.y,o.x-i.x,o.y-i.y),viewBox:new z(...r.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:r,box:n,baseline:i,fontSize:o}=e,{box:a,viewBox:h,paths:l}=this._parseSvg(r),u=h.top+h.height/2,c=[],d=u>a.top?0:1;function m(g,w){g.style.strokeWidth&&(g.style.strokeWidth*=w),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=w),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=w),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(f=>f*w))}if(d===0){const g={x:n.left-o*.2,y:n.top},w=(n.width+o*.2*2)/a.width,f=n.height/a.height,P=new vt().translate(-a.x,-a.y).scale(w,f).translate(g.x,g.y);l.forEach(_=>{const x=_.clone().transform(P);m(x,w),c.push({path:x})})}else if(d===1){const g=o/a.width,w=a.width*g,f=Math.ceil(n.width/w),P={x:n.left,y:n.top+i+o*.1},_=new vt().translate(-a.x,-a.y).scale(g,g).translate(P.x,P.y);for(let x=0;x<f;x++){const O=_.clone().translate(x*w,0);l.forEach(v=>{const b=v.clone().transform(O);m(b,g),c.push({clipRect:n,path:b})})}}return c}draw({ctx:e}){return this.paths.forEach(r=>{Fe({ctx:e,path:r.path,clipRect:r.clipRect,fontSize:this._text.computedStyle.fontSize})}),this}}class Bn 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 d;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 m=document.createRange();m.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){m.setStart(c,Math.max(w-1,0)),m.setEnd(c,w);const f=((d=m.getClientRects)==null?void 0:d.call(m))??[m.getBoundingClientRect()];let P=f[f.length-1];f.length>1&&P.width<2&&(P=f[f.length-2]);const _=m.toString();_!==""&&P&&P.width+P.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:P.top,left:P.left,height:P.height,width:P.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((m,g)=>{const w=i?"left":"top";return Math.abs(g[w]-m[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(m=>{const g=e[m.paragraphIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height}),u.fragments.forEach(m=>{const g=e[m.paragraphIndex].fragments[m.fragmentIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height});const c=[];let d=0;return a.forEach(m=>{m.forEach(g=>{const w=u.characters[d],{paragraphIndex:f,fragmentIndex:P,characterIndex:_}=w;c.push({...w,newParagraphIndex:f,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[f].fragments[P].characters[_];x.boundingBox.left=c[d].left,x.boundingBox.top=c[d].top,x.boundingBox.width=c[d].width,x.boundingBox.height=c[d].height,x.textWidth=c[d].textWidth,x.textHeight=c[d].textHeight,d++})}),{paragraphs:e,boundingBox:new z(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 Fn extends Ht{parse(){let{content:t,computedStyle:e}=this._text;const r=[];if(typeof t=="string"){const n=new Qt({},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 Qt({},e);i.addFragment(n),r.push(i)}else if(Array.isArray(n)){const i=new Qt({},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 Qt(o,e);i.forEach(h=>{const{content:l,highlight:u,...c}=h;if(l!==void 0){const d=a.addFragment(l,c);d.highlight=u}}),r.push(a)}else if("content"in n){const{content:i,highlight:o,...a}=n;if(i!==void 0){const h=new Qt(a,e),l=h.addFragment(i);l.highlight=o,r.push(h)}}}return r}}class qo extends Ht{}class Nn 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 z(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 mr={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 Vo{constructor(t={}){F(this,"content");F(this,"style");F(this,"effects");F(this,"deformation");F(this,"measureDom");F(this,"needsUpdate",!0);F(this,"computedStyle",{...mr});F(this,"paragraphs",[]);F(this,"boundingBox",new z);F(this,"renderBoundingBox",new z);F(this,"parser",new Fn(this));F(this,"measurer",new Bn(this));F(this,"deformer",new $n(this));F(this,"effector",new Dn(this));F(this,"highlighter",new Ln(this));F(this,"renderer2D",new Nn(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 characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...mr,...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.highlighter.highlight(),this.deformation&&this.deformer.deform();const n=S.MAX,i=S.MIN;return r.forEach(o=>o.getMinMax(n,i)),this.renderBoundingBox=new z(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=z.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=z.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),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}}p.Character=En,p.CmapSubtableFormat0=Je,p.CmapSubtableFormat12=nr,p.CmapSubtableFormat14=ue,p.CmapSubtableFormat2=le,p.CmapSubtableFormat4=rr,p.CmapSubtableFormat6=Rt,p.Deformer=$n,p.Effector=Dn,p.Eot=ws,p.Font=_e,p.Fonts=nn,p.Fragment=Un,p.Glyph=je,p.GlyphSet=Ye,p.Highlighter=Ln,p.Measurer=Bn,p.Paragraph=Qt,p.Parser=Fn,p.Reflector=qo,p.Renderer2D=Nn,p.Sfnt=ie,p.TableDirectory=jt,p.Text=Vo,p.Ttf=st,p.Woff=Dt,p.WoffTableDirectoryEntry=qt,p.componentFlags=Kt,p.createCmapSegments=er,p.defaultTextStyles=mr,p.defineSfntTable=nt,p.drawPath=Fe,p.filterEmpty=Be,p.fonts=sn,p.getPointPosition=In,p.getRotationPoint=Tn,p.getScalePoint=An,p.getSkewPoint=gr,p.minify=Vi,p.minifyGlyphs=on,p.minifySfnt=an,p.parse=en,p.parseColor=it,p.uploadColor=Ct,Object.defineProperty(p,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: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:sn(u)??u};return this._loaded.has(h)||(this._loaded.set(h,c),new Set(Array.isArray(a)?a:[a]).forEach(d=>{this._namesUrls.set(d,h),typeof document<"u"&&(n&&this.injectFontFace(d,u),i&&this.injectStyleTag(d,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)})}};ye(on,"defaultRequestInit",{cache:"force-cache"});let an=on;const ln=new an;function hn(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,f)=>w-f),d=new Map;c.forEach(w=>{const f=a.get(w)??0;let P=d.get(f);P||d.set(f,P=new Set),P.add(w)});const m=[],g=w=>{const f=l[w],P=(u==null?void 0:u[w])??{advanceHeight:0,topSideBearing:0},_=h[w],x=h[w+1]??_,O={...f,...P,rawGlyphIndex:w,glyphIndex:m.length,unicodes:Array.from(d.get(w)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+_,x-_)};return m.push(O),O};return g(0),c.forEach(w=>g(a.get(w))),m.slice().forEach(w=>{const{view:f}=w;if(!f.byteLength||f.getInt16(0)>=0)return;let _=10,x;do{x=f.getUint16(_);const O=_+2,v=f.getUint16(O);_+=4,Qt.ARG_1_AND_2_ARE_WORDS&x?_+=4:_+=2,Qt.WE_HAVE_A_SCALE&x?_+=2:Qt.WE_HAVE_AN_X_AND_Y_SCALE&x?_+=4:Qt.WE_HAVE_A_TWO_BY_TWO&x&&(_+=8);const b=g(v);f.setUint16(O,b.glyphIndex)}while(Qt.MORE_COMPONENTS&x)}),m}function cn(s,t){const e=hn(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=p.Loca.from([...e.map(d=>{const m=h;return h+=d.view.byteLength,m}),h],n.indexToLocFormat);const l=e.reduce((d,m,g)=>(m.unicodes.forEach(w=>d.set(w,g)),d),new Map);s.cmap=p.Cmap.from(l),s.glyf=p.Glyf.from(e.map(d=>d.view)),o.numOfLongHorMetrics=r,s.hmtx=p.Hmtx.from(e.map(d=>({advanceWidth:d.advanceWidth,leftSideBearing:d.leftSideBearing}))),a&&(a.numOfLongVerMetrics=r),s.vmtx&&(s.vmtx=p.Vmtx.from(e.map(d=>({advanceHeight:d.advanceHeight,topSideBearing:d.topSideBearing}))));const c=new p.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 Xi(s,t){let e,r;if(s instanceof st)e=s.sfnt.clone(),r="ttf";else if(s instanceof $t)e=s.sfnt.clone(),r="woff";else{const i=zt(s);if(st.is(i))e=new st(i).sfnt,r="ttf-buffer";else if($t.is(i))e=new $t(i).sfnt,r="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const n=cn(e,t);switch(r){case"ttf":return st.from(n);case"woff":return $t.from(n);case"ttf-buffer":return st.from(n).view.buffer;case"woff-buffer":default:return $t.from(n).view.buffer}}const ji={arcs:"bevel",bevel:"bevel",miter:"miter","miter-clip":"miter",round:"round"};function Yi(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:d=0,shadowColor:m="rgba(0, 0, 0, 0)"}=t;s.fillStyle=e,s.strokeStyle=r,s.lineWidth=n,s.lineCap=i,s.lineJoin=ji[o],s.miterLimit=a,s.setLineDash(h),s.lineDashOffset=l,s.shadowOffsetX=u,s.shadowOffsetY=c,s.shadowBlur=d,s.shadowColor=m}class S{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new S(1/0,1/0)}static get MIN(){return new S(-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 S(this.x,this.y)}}class R{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){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 R(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 S((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new R(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var Ki=Object.defineProperty,Zi=(s,t,e)=>t in s?Ki(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Qi=(s,t,e)=>(Zi(s,t+"",e),e);class mt{constructor(t=1,e=0,r=0,n=0,i=1,o=0,a=0,h=0,l=1){Qi(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],d=r[2],m=r[5],g=r[8],w=n[0],f=n[3],P=n[6],_=n[1],x=n[4],O=n[7],v=n[2],b=n[5],A=n[8];return i[0]=o*w+a*_+h*v,i[3]=o*f+a*x+h*b,i[6]=o*P+a*O+h*A,i[1]=l*w+u*_+c*v,i[4]=l*f+u*x+c*b,i[7]=l*P+u*O+c*A,i[2]=d*w+m*_+g*v,i[5]=d*f+m*x+g*b,i[8]=d*P+m*O+g*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,d=a*h-u*i,m=l*i-o*h,g=e*c+r*d+n*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/g;return t[0]=c*w,t[1]=(n*l-u*r)*w,t[2]=(a*r-n*o)*w,t[3]=d*w,t[4]=(u*e-n*h)*w,t[5]=(n*i-a*e)*w,t[6]=m*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(ur.makeScale(t,e)),this}rotate(t){return this.premultiply(ur.makeRotation(-t)),this}translate(t,e){return this.premultiply(ur.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 ur=new mt;function un(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 Ji(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 d=t*t,m=e*e;const g=u*u,w=c*c,f=g/d+w/m;if(f>1){const L=Math.sqrt(f);t=L*t,e=L*e,d=t*t,m=e*e}const P=d*w+m*g,_=(d*m-P)/P;let x=Math.sqrt(Math.max(0,_));n===i&&(x=-x);const O=x*t*c/e,v=-x*e*u/t,b=Math.cos(r)*O-Math.sin(r)*v+(o.x+a.x)/2,A=Math.sin(r)*O+Math.cos(r)*v+(o.y+a.y)/2,C=un(1,0,(u-O)/t,(c-v)/e),M=un((u-O)/t,(c-v)/e,(-u-O)/t,(-c-v)/e)%(Math.PI*2);s.ellipse(b,A,t,e,r,C,C+M,i===1)}function Jt(s,t){return s-(t-s)}function fn(s,t){const e=new S,r=new S;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),Ji(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 Tt(s,t,e=0){let a=0,h=!0,l="",u="";const c=[];function d(f,P,_){const x=new SyntaxError(`Unexpected character "${f}" at index ${P}.`);throw x.partial=_,x}function m(){l!==""&&(u===""?c.push(Number(l)):c.push(Number(l)*10**Number(u))),l="",u=""}let g;const w=s.length;for(let f=0;f<w;f++){if(g=s[f],Array.isArray(t)&&t.includes(c.length%e)&&Z.FLAGS.test(g)){a=1,l=g,m();continue}if(a===0){if(Z.WHITESPACE.test(g))continue;if(Z.DIGIT.test(g)||Z.SIGN.test(g)){a=1,l=g;continue}if(Z.POINT.test(g)){a=2,l=g;continue}Z.COMMA.test(g)&&(h&&d(g,f,c),h=!0)}if(a===1){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.POINT.test(g)){l+=g,a=2;continue}if(Z.EXP.test(g)){a=3;continue}Z.SIGN.test(g)&&l.length===1&&Z.SIGN.test(l[0])&&d(g,f,c)}if(a===2){if(Z.DIGIT.test(g)){l+=g;continue}if(Z.EXP.test(g)){a=3;continue}Z.POINT.test(g)&&l[l.length-1]==="."&&d(g,f,c)}if(a===3){if(Z.DIGIT.test(g)){u+=g;continue}if(Z.SIGN.test(g)){if(u===""){u+=g;continue}u.length===1&&Z.SIGN.test(u)&&d(g,f,c)}}Z.WHITESPACE.test(g)?(m(),a=0,h=!1):Z.COMMA.test(g)?(m(),a=0,h=!0):Z.SIGN.test(g)?(m(),a=1,l=g):Z.POINT.test(g)?(m(),a=2,l=g):d(g,f,c)}return m(),c}function to(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 eo(s){let t="";for(let e=0,r=s.length;e<r;e++)t+=`${to(s[e])} `;return t}const ro=/[a-df-z][^a-df-z]*/gi;function pn(s){const t=[],e=s.match(ro);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=Tt(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=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,x:h[l]});break;case"v":case"V":h=Tt(a);for(let l=0,u=h.length;l<u;l++)t.push({type:o,y:h[l]});break;case"l":case"L":h=Tt(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=Tt(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=Tt(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=Tt(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=Tt(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=Tt(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 no=Object.defineProperty,so=(s,t,e)=>t in s?no(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,fr=(s,t,e)=>(so(s,typeof t!="symbol"?t+"":t,e),e);class Wt{constructor(){fr(this,"arcLengthDivisions",200),fr(this,"_cacheArcLengths"),fr(this,"_needsUpdate",!1)}getPointAt(t,e=new S){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],d=r[n+1]-u,m=(o-u)/d;return(n+m)/(i-1)}getTangent(t,e=new S){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=S.MAX,e=S.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 R(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 eo(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function dn(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 io(s,t){const e=1-s;return e*e*t}function oo(s,t){return 2*(1-s)*s*t}function ao(s,t){return s*s*t}function gn(s,t,e,r){return io(s,t)+oo(s,e)+ao(s,r)}function lo(s,t){const e=1-s;return e*e*e*t}function ho(s,t){const e=1-s;return 3*e*e*s*t}function co(s,t){return 3*(1-s)*s*s*t}function uo(s,t){return s*s*s*t}function mn(s,t,e,r,n){return lo(s,t)+ho(s,e)+co(s,r)+uo(s,n)}class fo extends Wt{constructor(t=new S,e=new S,r=new S,n=new S){super(),this.start=t,this.startControl=e,this.endControl=r,this.end=n}getPoint(t,e=new S){const{start:r,startControl:n,endControl:i,end:o}=this;return e.set(mn(t,r.x,n.x,i.x,o.x),mn(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=S.MAX,e=S.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,d)=>{for(const m of c)for(let g=0;g<=d;g++){const w=g/d-.5,f=Math.min(1,Math.max(0,m+w)),P=this.getPoint(f);t.x=Math.min(t.x,P.x),t.y=Math.min(t.y,P.y),e.x=Math.max(e.x,P.x),e.y=Math.max(e.y,P.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 po=new mt,yn=new mt,wn=new mt,Fe=new S;class go extends Wt{constructor(t=new S,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 S){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,d=h-this.center.y;a=c*l-d*u+this.center.x,h=c*u+d*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),d=Math.abs(n-i),m=d>Math.PI?1:0,g=o?1:0,w=a*180/Math.PI;if(d>=2*Math.PI){const f=n+Math.PI,P=h+e*Math.cos(f)*Math.cos(a)-r*Math.sin(f)*Math.sin(a),_=l+e*Math.cos(f)*Math.sin(a)+r*Math.sin(f)*Math.cos(a);return[{type:"M",x:u,y:c},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:P,y:_},{type:"A",rx:e,ry:r,angle:w,largeArcFlag:0,sweepFlag:g,x:u,y:c}]}else{const f=h+e*Math.cos(i)*Math.cos(a)-r*Math.sin(i)*Math.sin(a),P=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:m,sweepFlag:g,x:f,y:P}]}}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 Fe.set(this.center.x,this.center.y),Fe.applyMatrix3(t),this.center.x=Fe.x,this.center.y=Fe.y,wo(t)?mo(this,t):yo(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=S.MAX,e=S.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),d=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-d),e.x=Math.max(e.x,a+c),e.y=Math.max(e.y,h+d),{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 mo(s,t){const e=s.radiusX,r=s.radiusY,n=Math.cos(s.rotation),i=Math.sin(s.rotation),o=new S(e*n,e*i),a=new S(-r*i,r*n),h=o.applyMatrix3(t),l=a.applyMatrix3(t),u=po.set(h.x,l.x,0,h.y,l.y,0,0,0,1),c=yn.copy(u).invert(),g=wn.copy(c).transpose().multiply(c).elements,w=vo(g[0],g[1],g[4]),f=Math.sqrt(w.rt1),P=Math.sqrt(w.rt2);if(s.radiusX=1/f,s.radiusY=1/P,s.rotation=Math.atan2(w.sn,w.cs),!((s.endAngle-s.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=yn.set(f,0,0,0,P,0,0,0,1),O=wn.set(w.cs,w.sn,0,-w.sn,w.cs,0,0,0,1),v=x.multiply(O).multiply(u),b=A=>{const{x:C,y:M}=new S(Math.cos(A),Math.sin(A)).applyMatrix3(v);return Math.atan2(M,C)};s.startAngle=b(s.startAngle),s.endAngle=b(s.endAngle),vn(t)&&(s.clockwise=!s.clockwise)}}function yo(s,t){const e=bn(t),r=xn(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,vn(t)&&(s.startAngle*=-1,s.endAngle*=-1,s.clockwise=!s.clockwise)}function vn(s){const t=s.elements;return t[0]*t[4]-t[1]*t[3]<0}function wo(s){const t=s.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const r=bn(s),n=xn(s);return Math.abs(e/(r*n))>Number.EPSILON}function bn(s){const t=s.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function xn(s){const t=s.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function vo(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 pr extends Wt{constructor(t=new S,e=new S){super(),this.start=t,this.end=e}getPoint(t,e=new S){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new S){return this.getPoint(t,e)}getTangent(t,e=new S){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new S){return this.getTangent(t,e)}getNormal(t,e=new S){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=S.MAX,e=S.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 bo extends Wt{constructor(t=new S,e=new S,r=new S){super(),this.start=t,this.control=e,this.end=r}getPoint(t,e=new S){const{start:r,control:n,end:i}=this;return e.set(gn(t,r.x,n.x,i.x),gn(t,r.y,n.y,i.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=S.MAX,e=S.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 xo=Object.defineProperty,_o=(s,t,e)=>t in s?xo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_n=(s,t,e)=>(_o(s,typeof t!="symbol"?t+"":t,e),e);class So 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,_n(this,"curves",[]),_n(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 S(t-r,e-n),new S(t+r,e-n),new S(t+r,e+n),new S(t-r,e+n)];for(let o=0;o<4;o++)this.curves.push(new pr(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=S.MAX,e=S.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 Po extends Wt{constructor(t=[]){super(),this.points=t}getPoint(t,e=new S){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(dn(o,a.x,h.x,l.x,u.x),dn(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 Co=Object.defineProperty,Mo=(s,t,e)=>t in s?Co(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,we=(s,t,e)=>(Mo(s,typeof t!="symbol"?t+"":t,e),e);class ve extends Wt{constructor(t){super(),we(this,"curves",[]),we(this,"startPoint"),we(this,"currentPoint",new S),we(this,"autoClose",!1),we(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 fn(t,this),this}addData(t){return this.addCommands(pn(t)),this}getPoint(t,e=new S){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 pr(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 pr(this.currentPoint.clone(),new S(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 fo(this.currentPoint.clone(),new S(t,e),new S(r,n),new S(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 bo(this.currentPoint.clone(),new S(t,e),new S(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 go(new S(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 So(new S(t+r/2,e+n/2),r/2,r/n)),this._setCurrentPoint({x:t,y:e}),this}splineThru(t){return this.curves.push(new Po([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=S.MAX,e=S.MIN){return this.curves.forEach(r=>r.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new R(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 Oo(s){return s.replace(/[^a-z0-9]/gi,"-").replace(/\B([A-Z])/g,"-$1").toLowerCase()}var To=Object.defineProperty,Ao=(s,t,e)=>t in s?To(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 bt{constructor(t){dr(this,"currentPath",new ve),dr(this,"paths",[this.currentPath]),dr(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 ve().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 ve().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 fn(t,this),this}addData(t){return this.addCommands(pn(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=S.MAX,e=S.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 R(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[Oo(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;Yi(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 gr="px",Sn=90,Pn=["mm","cm","in","pt","pc","px"],mr={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 D(s){let t="px";if(typeof s=="string"||s instanceof String)for(let r=0,n=Pn.length;r<n;r++){const i=Pn[r];if(s.endsWith(i)){t=i,s=s.substring(0,s.length-i.length);break}}let e;return t==="px"&&gr!=="px"?e=mr.in[gr]/Sn:(e=mr[t][gr],e<0&&(e=mr[t].in*Sn)),e*Number.parseFloat(s)}const Io=new mt,Ne=new mt,Cn=new mt,Mn=new mt;function Eo(s,t,e){if(!(s.hasAttribute("transform")||s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))))return null;const r=Uo(s);return e.length>0&&r.premultiply(e[e.length-1]),t.copy(r),e.push(r),r}function Uo(s){const t=new mt,e=Io;if(s.nodeName==="use"&&(s.hasAttribute("x")||s.hasAttribute("y"))&&t.translate(D(s.getAttribute("x")),D(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=Tt(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,d=0;u=l[0]*Math.PI/180,l.length>=3&&(c=l[1],d=l[2]),Ne.makeTranslation(-c,-d),Cn.makeRotation(u),Mn.multiplyMatrices(Cn,Ne),Ne.makeTranslation(c,d),e.multiplyMatrices(Ne,Mn)}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 Do(s){return new bt().addPath(new ve().arc(D(s.getAttribute("cx")||0),D(s.getAttribute("cy")||0),D(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 Lo(s){return new bt().addPath(new ve().ellipse(D(s.getAttribute("cx")||0),D(s.getAttribute("cy")||0),D(s.getAttribute("rx")||0),D(s.getAttribute("ry")||0),0,0,Math.PI*2))}function Bo(s){return new bt().moveTo(D(s.getAttribute("x1")||0),D(s.getAttribute("y1")||0)).lineTo(D(s.getAttribute("x2")||0),D(s.getAttribute("y2")||0))}function Fo(s){const t=new bt,e=s.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const No=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ko(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(No,(n,i,o)=>{const a=D(i),h=D(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!0,t}const Go=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function zo(s){var r;const t=new bt;let e=0;return(r=s.getAttribute("points"))==null||r.replace(Go,(n,i,o)=>{const a=D(i),h=D(o);return e===0?t.moveTo(a,h):t.lineTo(a,h),e++,n}),t.currentPath.autoClose=!1,t}function Ro(s){const t=D(s.getAttribute("x")||0),e=D(s.getAttribute("y")||0),r=D(s.getAttribute("rx")||s.getAttribute("ry")||0),n=D(s.getAttribute("ry")||s.getAttribute("rx")||0),i=D(s.getAttribute("width")),o=D(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(d){return d.startsWith("url")&&console.warn("url access in attributes is not implemented."),d}),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,D(h)))}function o(h){return Math.max(0,D(h))}function a(h){return h.split(" ").filter(l=>l!=="").map(l=>D(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",D),n("visibility","visibility"),t}function yr(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=Fo(s));break;case"rect":t=At(s,t,i),n=Ro(s);break;case"polygon":t=At(s,t,i),n=ko(s);break;case"polyline":t=At(s,t,i),n=zo(s);break;case"circle":t=At(s,t,i),n=Do(s);break;case"ellipse":t=At(s,t,i),n=Lo(s);break;case"line":t=At(s,t,i),n=Bo(s);break;case"defs":r=!0;break;case"use":{t=At(s,t,i);const d=(s.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),m=(u=s.viewportElement)==null?void 0:u.getElementById(d);m?yr(m,t,e):console.warn(`'use node' references non-existent node id: ${d}`);break}default:console.warn(s);break}const o=new mt,a=[],h=Eo(s,o,a);n&&(n.transform(o),e.push(n),n.style=t);const l=s.childNodes;for(let c=0,d=l.length;c<d;c++){const m=l[c];r&&m.nodeName!=="style"&&m.nodeName!=="defs"||yr(m,t,e)}return h&&(a.pop(),a.length>0?o.copy(a[a.length-1]):o.identity()),e}const On="data:image/svg+xml;",Tn=`${On}base64,`,An=`${On}charset=utf8,`;function In(s){if(typeof s=="string"){let t;return s.startsWith(Tn)?(s=s.substring(Tn.length,s.length),t=atob(s)):s.startsWith(An)?(s=s.substring(An.length,s.length),t=decodeURIComponent(s)):t=s,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return s}function qo(s){return yr(In(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 En(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 wr(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 Un(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 Dn(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=>Un(c,t,i,o))),(r||n)&&(a=a.map(c=>wr(c,t,r,n))),a=a.map(c=>{const d=c.x-l,m=-(c.y-u);return c=En({x:d,y:m},h),{x:l+c.x,y:u-c.y}}),a[0]}const Vo=new Set(["©","®","÷"]),Ho=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class $n{constructor(t,e,r){F(this,"boundingBox",new R);F(this,"textWidth",0);F(this,"textHeight",0);F(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=ln.get(this.computedStyle.fontFamily))==null?void 0:e.font;if(t instanceof $t||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,isVertical:u}=this,{left:c,top:d,height:m}=l,{fontSize:g}=h,w=e/g,f=t.getAdvanceWidth(a,g),P=(r+Math.abs(n))/w,_=r/w,x=(r-i.yStrikeoutPosition)/w,O=i.yStrikeoutSize/w,v=(r-o.underlinePosition)/w,b=o.underlineThickness/w;return this.glyphWidth=f,this.glyphHeight=P,this.underlinePosition=v,this.underlineThickness=b,this.yStrikeoutPosition=x,this.yStrikeoutSize=O,this.baseline=_,this.centerDiviation=.5*m-_,this.glyphBox=u?new R(c,d,P,f):new R(c,d,f,P),this.centerPoint=this.glyphBox.getCenterPoint(),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:d,descender:m}=t,g=d,w=m,f=c.sTypoAscender,{left:P,top:_}=o,{fontSize:x,fontStyle:O}=a;let v=P,b=_+h,A,C;if(e&&(v+=(l-u)/2,Math.abs(n-i)>.1&&(b-=(g-f)/(g+Math.abs(w))*l),A=void 0),e&&!Vo.has(r)&&(r.codePointAt(0)<=256||Ho.has(r))){C=t.getPathCommands(r,v,_+h-(l-u)/2,x)??[];const L={y:_-(l-u)/2+l/2,x:v+u/2};O==="italic"&&(C=this._italic(C,e?{x:L.x,y:_-(l-u)/2+h}:void 0)),C=this._rotation90(C,L)}else A!==void 0?(C=t.glyphs.get(A).getPathCommands(v,b,x),O==="italic"&&(C=this._italic(C,e?{x:v+u/2,y:_+f/(g+Math.abs(w))*l}:void 0))):(C=t.getPathCommands(r,v,b,x)??[],O==="italic"&&(C=this._italic(C,e?{x:v+l/2,y:b}:void 0)));C.push(...this._decoration());const M=new bt(C);return M.style={fill:a.color,stroke:a.textStrokeWidth?a.textStrokeColor:"none",strokeWidth:a.textStrokeWidth?a.textStrokeWidth*x*.03:0},this.path=M,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=wr({x:h,y:l},a,-.24,0);return[u.x,u.y]})}_rotation90(t,e){return this._transform(t,(r,n)=>{const i=Dn({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})}getMinMax(t,e){return this.path.getMinMax(t,e)}getBoundingBox(){return this.path.getBoundingBox()}drawTo(t,e={}){Ge({ctx:t,path:this.path,fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Ln{constructor(t,e={},r){F(this,"boundingBox",new R);F(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){F(this,"boundingBox",new R);F(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 Ln(t,e,this);return this.fragments.push(r),r}}class Xt{constructor(t){this._text=t}}class Bn extends Xt{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}const ee=new mt,kt=new mt,Gt=new S;class Fn extends Xt{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:d}=r,m=l+c/2,g=u+d/2;return ee.identity(),kt.makeTranslation(n,i),ee.multiply(kt),kt.makeTranslation(m,g),ee.multiply(kt),kt.set(1,Math.tan(a),0,Math.tan(h),1,0,0,0,1),ee.multiply(kt),kt.makeTranslation(-m,-g),ee.multiply(kt),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.boundingBox.clone(),h=this.getTransform2D(o);Gt.set(a.left,a.top),Gt.applyMatrix3(h),a.left=Gt.x,a.top=Gt.y,Gt.set(a.right,a.bottom),Gt.applyMatrix3(h),a.width=Gt.x-a.left,a.height=Gt.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)})}),R.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,d]=this.getTransform2D(o).transpose().elements;e.transform(a,u,h,c,l,d),n.forEach(m=>{m.drawTo(e,o)}),e.restore()}),this}}class Nn extends Xt{constructor(){super(...arguments);F(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new R;const e=S.MAX,r=S.MIN;return this.paths.forEach(n=>n.path.getMinMax(e,r)),new R(e.x,e.y,r.x-e.x,r.y-e.y)}highlight(){const{characters:e}=this._text;let r;const n=[];let i;e.forEach(o=>{const a=o.parent.highlight;a!=null&&a.url&&((i==null?void 0:i.url)===a.url&&r.length&&r[0].boundingBox.top===o.boundingBox.top&&r[0].fontSize===o.fontSize?r.push(o):(r=[],r.push(o),n.push(r))),i=a}),this.paths=n.filter(o=>o.length).map(o=>({url:o[0].parent.highlight.url,box:R.from(...o.map(a=>a.boundingBox)),baseline:Math.max(...o.map(a=>a.baseline)),fontSize:o[0].fontSize})).map(o=>this._parseGroup(o)).flat()}_parseSvg(e){const r=In(e),n=qo(r),i=S.MAX,o=S.MIN;return n.forEach(a=>a.getMinMax(i,o)),{paths:n,box:new R(i.x,i.y,o.x-i.x,o.y-i.y),viewBox:new R(...r.getAttribute("viewBox").split(" ").map(Number))}}_parseGroup(e){const{url:r,box:n,baseline:i,fontSize:o}=e,{box:a,viewBox:h,paths:l}=this._parseSvg(r),u=h.top+h.height/2,c=[],d=u>a.top?0:1;function m(g,w){g.style.strokeWidth&&(g.style.strokeWidth*=w),g.style.strokeMiterlimit&&(g.style.strokeMiterlimit*=w),g.style.strokeDashoffset&&(g.style.strokeDashoffset*=w),g.style.strokeDasharray&&(g.style.strokeDasharray=g.style.strokeDasharray.map(f=>f*w))}if(d===0){const g={x:n.left-o*.2,y:n.top},w=(n.width+o*.2*2)/a.width,f=n.height/a.height,P=new mt().translate(-a.x,-a.y).scale(w,f).translate(g.x,g.y);l.forEach(_=>{const x=_.clone().transform(P);m(x,w),c.push({path:x})})}else if(d===1){const g=o/a.width,w=a.width*g,f=Math.ceil(n.width/w),P={x:n.left,y:n.top+i+o*.1},_=new mt().translate(-a.x,-a.y).scale(g,g).translate(P.x,P.y);for(let x=0;x<f;x++){const O=_.clone().translate(x*w,0);l.forEach(v=>{const b=v.clone().transform(O);m(b,g),c.push({clipRect:n,path:b})})}}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}}class kn extends Xt{_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 d;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 m=document.createRange();m.selectNodeContents(c);const g=c.data?c.data.length:0;let w=0;for(;w<=g;){m.setStart(c,Math.max(w-1,0)),m.setEnd(c,w);const f=((d=m.getClientRects)==null?void 0:d.call(m))??[m.getBoundingClientRect()];let P=f[f.length-1];f.length>1&&P.width<2&&(P=f[f.length-2]);const _=m.toString();_!==""&&P&&P.width+P.height!==0&&n.push({content:_,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:l,characterIndex:w-1,top:P.top,left:P.left,height:P.height,width:P.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((m,g)=>{const w=i?"left":"top";return Math.abs(g[w]-m[w])>4e3/2&&(h=[],a.push(h)),h.push(g),g})),n.style.lineHeight=o;const u=this._measureDom(t);u.paragraphs.forEach(m=>{const g=e[m.paragraphIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height}),u.fragments.forEach(m=>{const g=e[m.paragraphIndex].fragments[m.fragmentIndex];g.boundingBox.left=m.left,g.boundingBox.top=m.top,g.boundingBox.width=m.width,g.boundingBox.height=m.height});const c=[];let d=0;return a.forEach(m=>{m.forEach(g=>{const w=u.characters[d],{paragraphIndex:f,fragmentIndex:P,characterIndex:_}=w;c.push({...w,newParagraphIndex:f,textWidth:g.width,textHeight:g.height,left:w.left-r.left,top:w.top-r.top});const x=e[f].fragments[P].characters[_];x.boundingBox.left=c[d].left,x.boundingBox.top=c[d].top,x.boundingBox.width=c[d].width,x.boundingBox.height=c[d].height,x.textWidth=c[d].textWidth,x.textHeight=c[d].textHeight,d++})}),{paragraphs:e,boundingBox:new R(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 Gn extends Xt{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 d=a.addFragment(l,c);d.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 Wo extends Xt{}class zn extends Xt{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 R(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 vr={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 Xo{constructor(t={}){F(this,"content");F(this,"style");F(this,"effects");F(this,"deformation");F(this,"measureDom");F(this,"needsUpdate",!0);F(this,"computedStyle",{...vr});F(this,"paragraphs",[]);F(this,"boundingBox",new R);F(this,"renderBoundingBox",new R);F(this,"parser",new Gn(this));F(this,"measurer",new kn(this));F(this,"deformer",new Bn(this));F(this,"effector",new Fn(this));F(this,"highlighter",new Nn(this));F(this,"renderer2D",new zn(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={...vr,...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.highlighter.highlight(),this.deformation&&this.deformer.deform();const n=S.MAX,i=S.MIN;return r.forEach(o=>o.getMinMax(n,i)),this.renderBoundingBox=new R(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=R.from(this.renderBoundingBox,this.effector.getBoundingBox(),this.highlighter.getBoundingBox()):this.renderBoundingBox=R.from(this.renderBoundingBox,this.highlighter.getBoundingBox()),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}}p.Character=$n,p.CmapSubtableFormat0=rr,p.CmapSubtableFormat12=or,p.CmapSubtableFormat14=de,p.CmapSubtableFormat2=ue,p.CmapSubtableFormat4=ir,p.CmapSubtableFormat6=qt,p.Deformer=Bn,p.Effector=Fn,p.Eot=xs,p.Font=Ce,p.Fonts=an,p.Fragment=Ln,p.Glyph=Ze,p.GlyphSet=Qe,p.Highlighter=Nn,p.Measurer=kn,p.Paragraph=te,p.Parser=Gn,p.Reflector=Wo,p.Renderer2D=zn,p.Sfnt=le,p.TableDirectory=Kt,p.Text=Xo,p.Ttf=st,p.Woff=$t,p.WoffTableDirectoryEntry=Ht,p.componentFlags=Qt,p.createCmapSegments=sr,p.defaultTextStyles=vr,p.defineSfntTable=nt,p.drawPath=Ge,p.filterEmpty=ke,p.fonts=ln,p.getPointPosition=Dn,p.getRotationPoint=En,p.getScalePoint=Un,p.getSkewPoint=wr,p.minify=Xi,p.minifyGlyphs=hn,p.minifySfnt=cn,p.parse=sn,p.parseColor=it,p.uploadColor=Ct,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, Vector2, parseSvgToDom, parseSvg, Matrix3 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, Matrix3, Vector2, parseSvgToDom, parseSvg } from 'modern-path2d';
2
2
  import { fonts, Woff, Ttf } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -55,26 +55,23 @@ function drawPath(options) {
55
55
  const { ctx, path, fontSize, clipRect } = options;
56
56
  ctx.save();
57
57
  ctx.beginPath();
58
- const style = path.style;
59
- path.style = {
60
- ...style,
61
- fill: options.color ?? style.fill,
62
- stroke: options.textStrokeColor ?? style.stroke,
63
- strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : style.strokeWidth,
58
+ const pathStyle = path.style;
59
+ const style = {
60
+ ...pathStyle,
61
+ fill: options.color ?? pathStyle.fill,
62
+ stroke: options.textStrokeColor ?? pathStyle.stroke,
63
+ strokeWidth: options.textStrokeWidth ? options.textStrokeWidth * fontSize : pathStyle.strokeWidth,
64
64
  shadowOffsetX: (options.shadowOffsetX ?? 0) * fontSize,
65
65
  shadowOffsetY: (options.shadowOffsetY ?? 0) * fontSize,
66
66
  shadowBlur: (options.shadowBlur ?? 0) * fontSize,
67
67
  shadowColor: options.shadowColor
68
68
  };
69
- const offsetX = (options.offsetX ?? 0) * fontSize;
70
- const offsetY = (options.offsetY ?? 0) * fontSize;
71
- ctx.translate(offsetX, offsetY);
72
69
  if (clipRect) {
73
70
  ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
74
71
  ctx.clip();
75
72
  ctx.beginPath();
76
73
  }
77
- path.drawTo(ctx);
74
+ path.drawTo(ctx, style);
78
75
  ctx.restore();
79
76
  }
80
77
 
@@ -474,21 +471,51 @@ class Deformer extends Feature {
474
471
  }
475
472
  }
476
473
 
474
+ const tempM1 = new Matrix3();
475
+ const tempM2 = new Matrix3();
476
+ const tempV1 = new Vector2();
477
477
  class Effector extends Feature {
478
+ getTransform2D(style) {
479
+ const { fontSize, renderBoundingBox } = this._text;
480
+ const offsetX = (style.offsetX ?? 0) * fontSize;
481
+ const offsetY = (style.offsetY ?? 0) * fontSize;
482
+ const PI_2 = Math.PI * 2;
483
+ const skewX = (style.skewX ?? 0) / 360 * PI_2;
484
+ const skewY = (style.skewY ?? 0) / 360 * PI_2;
485
+ const { left, top, width, height } = renderBoundingBox;
486
+ const centerX = left + width / 2;
487
+ const centerY = top + height / 2;
488
+ tempM1.identity();
489
+ tempM2.makeTranslation(offsetX, offsetY);
490
+ tempM1.multiply(tempM2);
491
+ tempM2.makeTranslation(centerX, centerY);
492
+ tempM1.multiply(tempM2);
493
+ tempM2.set(1, Math.tan(skewX), 0, Math.tan(skewY), 1, 0, 0, 0, 1);
494
+ tempM1.multiply(tempM2);
495
+ tempM2.makeTranslation(-centerX, -centerY);
496
+ tempM1.multiply(tempM2);
497
+ return tempM1.clone();
498
+ }
478
499
  getBoundingBox() {
479
- const { characters, effects } = this._text;
500
+ const { characters, effects, fontSize } = this._text;
480
501
  const boxes = [];
481
502
  characters.forEach((character) => {
482
- const fontSize = character.computedStyle.fontSize;
483
- effects?.forEach((effect) => {
484
- const offsetX = (effect.offsetX ?? 0) * fontSize;
485
- const offsetY = (effect.offsetY ?? 0) * fontSize;
486
- const shadowOffsetX = (effect.shadowOffsetX ?? 0) * fontSize;
487
- const shadowOffsetY = (effect.shadowOffsetY ?? 0) * fontSize;
488
- const textStrokeWidth = Math.max(0.1, effect.textStrokeWidth ?? 0) * fontSize;
503
+ effects?.forEach((style) => {
489
504
  const aabb = character.boundingBox.clone();
490
- aabb.left += offsetX + shadowOffsetX - textStrokeWidth;
491
- aabb.top += offsetY + shadowOffsetY - textStrokeWidth;
505
+ const m = this.getTransform2D(style);
506
+ tempV1.set(aabb.left, aabb.top);
507
+ tempV1.applyMatrix3(m);
508
+ aabb.left = tempV1.x;
509
+ aabb.top = tempV1.y;
510
+ tempV1.set(aabb.right, aabb.bottom);
511
+ tempV1.applyMatrix3(m);
512
+ aabb.width = tempV1.x - aabb.left;
513
+ aabb.height = tempV1.y - aabb.top;
514
+ const shadowOffsetX = (style.shadowOffsetX ?? 0) * fontSize;
515
+ const shadowOffsetY = (style.shadowOffsetY ?? 0) * fontSize;
516
+ const textStrokeWidth = Math.max(0.1, style.textStrokeWidth ?? 0) * fontSize;
517
+ aabb.left += shadowOffsetX - textStrokeWidth;
518
+ aabb.top += shadowOffsetY - textStrokeWidth;
492
519
  aabb.width += textStrokeWidth * 2;
493
520
  aabb.height += textStrokeWidth * 2;
494
521
  boxes.push(aabb);
@@ -498,15 +525,17 @@ class Effector extends Feature {
498
525
  }
499
526
  draw(options) {
500
527
  const { ctx } = options;
501
- const { effects, characters, boundingBox } = this._text;
528
+ const { effects, characters, renderBoundingBox } = this._text;
502
529
  if (effects) {
503
- effects.forEach((effect) => {
504
- uploadColor(effect, boundingBox, ctx);
505
- });
506
- characters.forEach((character) => {
507
- effects.forEach((style) => {
530
+ effects.forEach((style) => {
531
+ uploadColor(style, renderBoundingBox, ctx);
532
+ ctx.save();
533
+ const [a, c, e, b, d, f] = this.getTransform2D(style).transpose().elements;
534
+ ctx.transform(a, b, c, d, e, f);
535
+ characters.forEach((character) => {
508
536
  character.drawTo(ctx, style);
509
537
  });
538
+ ctx.restore();
510
539
  });
511
540
  }
512
541
  return this;
@@ -1023,6 +1052,9 @@ class Text {
1023
1052
  this.deformation = deformation;
1024
1053
  this.measureDom = measureDom;
1025
1054
  }
1055
+ get fontSize() {
1056
+ return this.computedStyle.fontSize;
1057
+ }
1026
1058
  get characters() {
1027
1059
  return this.paragraphs.flatMap((p) => p.fragments.flatMap((f) => f.characters));
1028
1060
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.16",
4
+ "version": "0.2.18",
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",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "modern-font": "^0.2.1",
61
- "modern-path2d": "^0.1.16"
61
+ "modern-path2d": "^0.1.17"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@antfu/eslint-config": "^3.7.3",