modern-text 0.2.6 → 0.2.7

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
@@ -173,6 +173,7 @@ class Character {
173
173
  __publicField$4(this, "boundingBox", new modernPath2d.BoundingBox());
174
174
  __publicField$4(this, "textWidth", 0);
175
175
  __publicField$4(this, "textHeight", 0);
176
+ __publicField$4(this, "path", new modernPath2d.Path2D());
176
177
  // glyph
177
178
  __publicField$4(this, "commands", []);
178
179
  }
@@ -295,8 +296,12 @@ class Character {
295
296
  this.commands = commands;
296
297
  return this;
297
298
  }
299
+ updatePath() {
300
+ this.path?.copy(new modernPath2d.Path2D(this.commands));
301
+ return this;
302
+ }
298
303
  update() {
299
- this.updateCommands();
304
+ this.updateCommands().updatePath();
300
305
  return this;
301
306
  }
302
307
  _decoration() {
@@ -409,7 +414,7 @@ class Character {
409
414
  }
410
415
  return this;
411
416
  }
412
- getMinMax(min = modernPath2d.Point2D.MAX, max = modernPath2d.Point2D.MIN) {
417
+ getMinMax(min = modernPath2d.Vector2.MAX, max = modernPath2d.Vector2.MIN) {
413
418
  let last = { x: 0, y: 0 };
414
419
  this.commands.forEach((cmd) => {
415
420
  switch (cmd.type) {
@@ -437,10 +442,17 @@ class Character {
437
442
  });
438
443
  return { min, max };
439
444
  }
445
+ getBoundingBox() {
446
+ const min = modernPath2d.Vector2.MAX;
447
+ const max = modernPath2d.Vector2.MIN;
448
+ this.getMinMax(min, max);
449
+ this.path.getMinMax(min, max);
450
+ return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
451
+ }
440
452
  drawTo(ctx, config = {}) {
441
453
  drawPaths({
442
454
  ctx,
443
- paths: [new modernPath2d.Path2D(this.commands)],
455
+ paths: [this.path],
444
456
  fontSize: this.computedStyle.fontSize,
445
457
  color: this.computedStyle.color,
446
458
  ...config
@@ -579,8 +591,8 @@ class Highlighter extends Feature {
579
591
  if (!this.paths.length) {
580
592
  return new modernPath2d.BoundingBox();
581
593
  }
582
- const min = modernPath2d.Point2D.MAX;
583
- const max = modernPath2d.Point2D.MIN;
594
+ const min = modernPath2d.Vector2.MAX;
595
+ const max = modernPath2d.Vector2.MIN;
584
596
  this.paths.forEach((path) => path.getMinMax(min, max));
585
597
  return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
586
598
  }
@@ -614,8 +626,8 @@ class Highlighter extends Feature {
614
626
  _parseSvg(url) {
615
627
  const svg = modernPath2d.parseSvgToDom(url);
616
628
  const paths = modernPath2d.parseSvg(svg);
617
- const min = modernPath2d.Point2D.MAX;
618
- const max = modernPath2d.Point2D.MIN;
629
+ const min = modernPath2d.Vector2.MAX;
630
+ const max = modernPath2d.Vector2.MIN;
619
631
  paths.forEach((path) => path.getMinMax(min, max));
620
632
  const { x, y, width, height } = new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
621
633
  const viewBox = svg.getAttribute("viewBox").split(" ").map(Number);
@@ -1077,12 +1089,12 @@ class Text {
1077
1089
  this.boundingBox = boundingBox;
1078
1090
  const characters = this.characters;
1079
1091
  characters.forEach((c) => c.update());
1092
+ this._highlighter.highlight();
1080
1093
  if (this.deformation) {
1081
1094
  this._deformer.deform();
1082
1095
  }
1083
- this._highlighter.highlight();
1084
- const min = modernPath2d.Point2D.MAX;
1085
- const max = modernPath2d.Point2D.MIN;
1096
+ const min = modernPath2d.Vector2.MAX;
1097
+ const max = modernPath2d.Vector2.MIN;
1086
1098
  characters.forEach((c) => c.getMinMax(min, max));
1087
1099
  this.renderBoundingBox = new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
1088
1100
  return this;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
2
  import { GlyphPathCommand, Sfnt } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,6 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
102
+ path: Path2D<any>;
106
103
  commands: GlyphPathCommand[];
107
104
  glyphHeight: number;
108
105
  glyphWidth: number;
@@ -113,7 +110,7 @@ declare class Character {
113
110
  baseline: number;
114
111
  centerDiviation: number;
115
112
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
113
+ centerPoint: VectorLike;
117
114
  get computedStyle(): TextStyle;
118
115
  get isVertical(): boolean;
119
116
  get fontSize(): number;
@@ -121,19 +118,21 @@ declare class Character {
121
118
  protected _font(): Sfnt | undefined;
122
119
  updateGlyph(font?: Sfnt | undefined): this;
123
120
  updateCommands(): this;
121
+ updatePath(): this;
124
122
  update(): this;
125
123
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
124
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
125
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
126
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
127
  forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
128
+ first: VectorLike;
129
+ last: VectorLike;
132
130
  }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
131
+ getMinMax(min?: Vector2, max?: Vector2): {
132
+ min: Vector2;
133
+ max: Vector2;
136
134
  };
135
+ getBoundingBox(): BoundingBox;
137
136
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
137
  }
139
138
 
@@ -344,4 +343,4 @@ declare function getPointPosition(point: {
344
343
  y: number;
345
344
  };
346
345
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
346
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
2
  import { GlyphPathCommand, Sfnt } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,6 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
102
+ path: Path2D<any>;
106
103
  commands: GlyphPathCommand[];
107
104
  glyphHeight: number;
108
105
  glyphWidth: number;
@@ -113,7 +110,7 @@ declare class Character {
113
110
  baseline: number;
114
111
  centerDiviation: number;
115
112
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
113
+ centerPoint: VectorLike;
117
114
  get computedStyle(): TextStyle;
118
115
  get isVertical(): boolean;
119
116
  get fontSize(): number;
@@ -121,19 +118,21 @@ declare class Character {
121
118
  protected _font(): Sfnt | undefined;
122
119
  updateGlyph(font?: Sfnt | undefined): this;
123
120
  updateCommands(): this;
121
+ updatePath(): this;
124
122
  update(): this;
125
123
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
124
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
125
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
126
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
127
  forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
128
+ first: VectorLike;
129
+ last: VectorLike;
132
130
  }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
131
+ getMinMax(min?: Vector2, max?: Vector2): {
132
+ min: Vector2;
133
+ max: Vector2;
136
134
  };
135
+ getBoundingBox(): BoundingBox;
137
136
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
137
  }
139
138
 
@@ -344,4 +343,4 @@ declare function getPointPosition(point: {
344
343
  y: number;
345
344
  };
346
345
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
346
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
2
  import { GlyphPathCommand, Sfnt } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,6 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
102
+ path: Path2D<any>;
106
103
  commands: GlyphPathCommand[];
107
104
  glyphHeight: number;
108
105
  glyphWidth: number;
@@ -113,7 +110,7 @@ declare class Character {
113
110
  baseline: number;
114
111
  centerDiviation: number;
115
112
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
113
+ centerPoint: VectorLike;
117
114
  get computedStyle(): TextStyle;
118
115
  get isVertical(): boolean;
119
116
  get fontSize(): number;
@@ -121,19 +118,21 @@ declare class Character {
121
118
  protected _font(): Sfnt | undefined;
122
119
  updateGlyph(font?: Sfnt | undefined): this;
123
120
  updateCommands(): this;
121
+ updatePath(): this;
124
122
  update(): this;
125
123
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
124
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
125
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
126
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
127
  forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
128
+ first: VectorLike;
129
+ last: VectorLike;
132
130
  }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
131
+ getMinMax(min?: Vector2, max?: Vector2): {
132
+ min: Vector2;
133
+ max: Vector2;
136
134
  };
135
+ getBoundingBox(): BoundingBox;
137
136
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
137
  }
139
138
 
@@ -344,4 +343,4 @@ declare function getPointPosition(point: {
344
343
  y: number;
345
344
  };
346
345
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
346
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(f,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(f=typeof globalThis<"u"?globalThis:f||self,z(f.modernText={}))})(this,function(f){"use strict";var no=Object.defineProperty;var ro=(f,z,yt)=>z in f?no(f,z,{enumerable:!0,configurable:!0,writable:!0,value:yt}):f[z]=yt;var $=(f,z,yt)=>ro(f,typeof z!="symbol"?z+"":z,yt);function z(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:h}=gr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return h.forEach(a=>c.addColorStop(a.offset,a.color)),c}return t}function yt(i,t,e){i!=null&&i.color&&(i.color=z(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=z(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=z(e,i.textStrokeColor,t))}function gr(i,t,e,n,r){var d;const s=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",o=s.split(",")[0],h=o.includes("deg")?o:"0deg",c=s.replace(h,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(h.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),y=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+y,x1:t+n/2+u,y1:e+r/2-y,stops:Array.from(c).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function Se(i){const{ctx:t,paths:e,fontSize:n}=i;e.forEach(r=>{var l;t.save(),t.beginPath();const s=((l=r.userData)==null?void 0:l.style)??{},o=i.color??s.fill??"none",h=i.textStrokeColor??s.stroke??"none";t.fillStyle=o!=="none"?o:"#000",t.strokeStyle=h!=="none"?h:"#000",t.lineWidth=i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth?s.strokeWidth*n*.03:0,t.lineCap=s.strokeLineCap??"round",t.lineJoin=s.strokeLineJoin??"miter",t.miterLimit=s.strokeMiterLimit??0,t.shadowOffsetX=(i.shadowOffsetX??0)*n,t.shadowOffsetY=(i.shadowOffsetY??0)*n,t.shadowBlur=(i.shadowBlur??0)*n,t.shadowColor=i.shadowColor??"rgba(0, 0, 0, 0)";const c=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(c,a),r.drawTo(t),o!=="none"&&t.fill(),h!=="none"&&t.stroke(),t.restore()})}var k=Uint8Array,it=Uint16Array,Pe=Int32Array,he=new k([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]),ce=new k([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]),Ce=new k([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Pe(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(he,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ce,0),mr=on.b,an=on.r,Oe=new it(32768),I=0;I<32768;++I){var Pt=(I&43690)>>1|(I&21845)<<1;Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,Oe[I]=((Pt&65280)>>8|(Pt&255)<<8)>>1}for(var dt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var h;if(e){h=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var a=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,y=u|(1<<l)-1;u<=y;++u)h[Oe[u]>>c]=a}else for(h=new it(n),r=0;r<n;++r)i[r]&&(h[r]=Oe[o[i[r]-1]++]>>15-i[r]);return h},Ct=new k(288),I=0;I<144;++I)Ct[I]=8;for(var I=144;I<256;++I)Ct[I]=9;for(var I=256;I<280;++I)Ct[I]=7;for(var I=280;I<288;++I)Ct[I]=8;for(var Wt=new k(32),I=0;I<32;++I)Wt[I]=5;var vr=dt(Ct,9,0),wr=dt(Ct,9,1),br=dt(Wt,5,0),xr=dt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ut=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ie=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new k(i.subarray(t,e))},_r=["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"],ft=function(i,t,e){var n=new Error(t||_r[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,ft),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new k(0);var o=!e,h=o||t.i!=2,c=t.i;o&&(e=new k(r*3));var a=function(se){var oe=e.length;if(se>oe){var kt=new k(Math.max(oe*2,se));kt.set(e),e=kt}},l=t.f||0,u=t.p||0,y=t.b||0,d=t.l,g=t.d,m=t.m,v=t.n,_=r*8;do{if(!d){l=ut(i,u,1);var x=ut(i,u+1,3);if(u+=3,x)if(x==1)d=wr,g=xr,m=9,v=5;else if(x==2){var O=ut(i,u,31)+257,A=ut(i,u+10,15)+4,M=O+ut(i,u+5,31)+1;u+=14;for(var S=new k(M),B=new k(19),N=0;N<A;++N)B[Ce[N]]=ut(i,u+N*3,7);u+=A*3;for(var K=Ae(B),Ot=(1<<K)-1,ot=dt(B,K,1),N=0;N<M;){var nt=ot[ut(i,u,Ot)];u+=nt&15;var w=nt>>4;if(w<16)S[N++]=w;else{var V=0,U=0;for(w==16?(U=3+ut(i,u,3),u+=2,V=S[N-1]):w==17?(U=3+ut(i,u,7),u+=3):w==18&&(U=11+ut(i,u,127),u+=7);U--;)S[N++]=V}}var rt=S.subarray(0,O),H=S.subarray(O);m=Ae(rt),v=Ae(H),d=dt(rt,m,1),g=dt(H,v,1)}else ft(1);else{var w=Ie(u)+4,C=i[w-4]|i[w-3]<<8,T=w+C;if(T>r){c&&ft(0);break}h&&a(y+C),e.set(i.subarray(w,T),y),t.b=y+=C,t.p=u=T*8,t.f=l;continue}if(u>_){c&&ft(0);break}}h&&a(y+131072);for(var ie=(1<<m)-1,lt=(1<<v)-1,St=u;;St=u){var V=d[$e(i,u)&ie],at=V>>4;if(u+=V&15,u>_){c&&ft(0);break}if(V||ft(2),at<256)e[y++]=at;else if(at==256){St=u,d=null;break}else{var ht=at-254;if(at>264){var N=at-257,E=he[N];ht=ut(i,u,(1<<E)-1)+sn[N],u+=E}var bt=g[$e(i,u)&lt],Ht=bt>>4;bt||ft(3),u+=bt&15;var H=mr[Ht];if(Ht>3){var E=ce[Ht];H+=$e(i,u)&(1<<E)-1,u+=E}if(u>_){c&&ft(0);break}h&&a(y+131072);var zt=y+ht;if(y<H){var xe=s-H,_e=Math.min(H,zt);for(xe+y<0&&ft(3);y<_e;++y)e[y]=n[xe+y]}for(;y<zt;++y)e[y]=e[y-H]}}t.l=d,t.p=St,t.b=y,t.f=l,d&&(l=1,t.m=m,t.d=g,t.n=v)}while(!l);return y!=e.length&&o?hn(e,0,y):e.subarray(0,y)},xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},De=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new k(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(T,O){return T.f-O.f}),e.push({s:-1,f:25001});var h=e[0],c=e[1],a=0,l=1,u=2;for(e[0]={s:-1,f:h.f+c.f,l:h,r:c};l!=r-1;)h=e[e[a].f<e[u].f?a++:u++],c=e[a!=l&&e[a].f<e[u].f?a++:u++],e[l++]={s:-1,f:h.f+c.f,l:h,r:c};for(var y=s[0].s,n=1;n<r;++n)s[n].s>y&&(y=s[n].s);var d=new it(y+1),g=Le(e[l-1],d,0);if(g>t){var n=0,m=0,v=g-t,_=1<<v;for(s.sort(function(O,A){return d[A.s]-d[O.s]||O.f-A.f});n<r;++n){var x=s[n].s;if(d[x]>t)m+=_-(1<<g-d[x]),d[x]=t;else break}for(m>>=v;m>0;){var w=s[n].s;d[w]<t?m-=1<<t-d[w]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;d[C]==t&&(--d[C],++m)}g=t}return{t:new k(d),l:g}},Le=function(i,t,e){return i.s==-1?Math.max(Le(i.l,t,e+1),Le(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},h=1;h<=t;++h)if(i[h]==r&&h!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[h]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=Ie(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,h,c,a,l){xt(t,l++,e),++r[256];for(var u=De(r,15),y=u.t,d=u.l,g=De(s,15),m=g.t,v=g.l,_=cn(y),x=_.c,w=_.n,C=cn(m),T=C.c,O=C.n,A=new it(19),M=0;M<x.length;++M)++A[x[M]&31];for(var M=0;M<T.length;++M)++A[T[M]&31];for(var S=De(A,7),B=S.t,N=S.l,K=19;K>4&&!B[Ce[K-1]];--K);var Ot=a+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,y)+qt(s,m)+o+14+3*K+qt(A,B)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+a));var V,U,rt,H;if(xt(t,l,1+(nt<ot)),l+=2,nt<ot){V=dt(y,d,0),U=y,rt=dt(m,v,0),H=m;var ie=dt(B,N,0);xt(t,l,w-257),xt(t,l+5,O-1),xt(t,l+10,K-4),l+=14;for(var M=0;M<K;++M)xt(t,l+3*M,B[Ce[M]]);l+=3*K;for(var lt=[x,T],St=0;St<2;++St)for(var at=lt[St],M=0;M<at.length;++M){var ht=at[M]&31;xt(t,l,ie[ht]),l+=B[ht],ht>15&&(xt(t,l,at[M]>>5&127),l+=at[M]>>12)}}else V=vr,U=Ct,rt=br,H=Wt;for(var M=0;M<h;++M){var E=n[M];if(E>255){var ht=E>>18&31;Xt(t,l,V[ht+257]),l+=U[ht+257],ht>7&&(xt(t,l,E>>23&31),l+=he[ht]);var bt=E&31;Xt(t,l,rt[bt]),l+=H[bt],bt>3&&(Xt(t,l,E>>5&8191),l+=ce[bt])}else Xt(t,l,V[E]),l+=U[E]}return Xt(t,l,V[256]),l+U[256]},Sr=new Pe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new k(0),Pr=function(i,t,e,n,r,s){var o=s.z||i.length,h=new k(n+o+5*(1+Math.ceil(o/7e3))+r),c=h.subarray(n,h.length-r),a=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Sr[t-1],y=u>>13,d=u&8191,g=(1<<e)-1,m=s.p||new it(32768),v=s.h||new it(g+1),_=Math.ceil(e/3),x=2*_,w=function(tn){return(i[tn]^i[tn+1]<<_^i[tn+2]<<x)&g},C=new Pe(25e3),T=new it(288),O=new it(32),A=0,M=0,S=s.i||0,B=0,N=s.w||0,K=0;S+2<o;++S){var Ot=w(S),ot=S&32767,nt=v[Ot];if(m[ot]=nt,v[Ot]=ot,N<=S){var V=o-S;if((A>7e3||B>24576)&&(V>423||!a)){l=un(i,c,0,C,T,O,M,B,K,S-K,l),B=A=M=0,K=S;for(var U=0;U<286;++U)T[U]=0;for(var U=0;U<30;++U)O[U]=0}var rt=2,H=0,ie=d,lt=ot-nt&32767;if(V>2&&Ot==w(S-lt))for(var St=Math.min(y,V)-1,at=Math.min(32767,S),ht=Math.min(258,V);lt<=at&&--ie&&ot!=nt;){if(i[S+rt]==i[S+rt-lt]){for(var E=0;E<ht&&i[S+E]==i[S+E-lt];++E);if(E>rt){if(rt=E,H=lt,E>St)break;for(var bt=Math.min(lt,E-2),Ht=0,U=0;U<bt;++U){var zt=S-lt+U&32767,xe=m[zt],_e=zt-xe&32767;_e>Ht&&(Ht=_e,nt=zt)}}}ot=nt,nt=m[ot],lt+=ot-nt&32767}if(H){C[B++]=268435456|Te[rt]<<18|an[H];var se=Te[rt]&31,oe=an[H]&31;M+=he[se]+ce[oe],++T[257+se],++O[oe],N=S+rt,++A}else C[B++]=i[S],++T[i[S]]}}for(S=Math.max(S,N);S<o;++S)C[B++]=i[S],++T[i[S]];l=un(i,c,a,C,T,O,M,B,K,S-K,l),a||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=v,s.p=m,s.i=S,s.w=N)}else{for(var S=s.w||0;S<o+a;S+=65535){var kt=S+65535;kt>=o&&(c[l/8|0]=a,kt=o),l=ln(c,l+1,i.subarray(S,kt))}s.i=o}return hn(h,0,n+Ie(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var h=Math.min(o+2655,s);o<h;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Cr=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new k(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Pr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},yn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Tr=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),yn(i,2,r.d())}},Or=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&ft(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&ft(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ar(i,t){t||(t={});var e=pn();e.p(i);var n=Cr(i,t,t.dictionary?6:2,4);return Tr(n,t),yn(n,n.length-4,e.d()),n}function $r(i,t){return Mr(i.subarray(Or(i,t),-4),{i:2},t,t)}var Ir=typeof TextDecoder<"u"&&new TextDecoder,Dr=0;try{Ir.decode(fn,{stream:!0}),Dr=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Ur(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var dn=Object.defineProperty,Er=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&dn(t,e,r),r},Fr=(i,t,e)=>(Er(i,t+"",e),e);const le={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class R extends DataView{constructor(t,e,n,r){super(Ur(t),e,n),this.littleEndian=r,Fr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=le[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,h=>h.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=le[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,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 r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Br=Object.defineProperty,Nr=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gr=(i,t,e)=>(Nr(i,t+"",e),e);const gn=new WeakMap;function p(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=gn.get(r);o||(o={columns:[],byteLength:0},gn.set(r,o));const h={...t,name:s,byteLength:e*le[n],offset:t.offset??o.columns.reduce((c,a)=>c+a.byteLength,0)};o.columns.push(h),o.byteLength=o.columns.reduce((c,a)=>c+le[a.type]*(a.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(h)},set(c){this.view.setColumn(h,c)},configurable:!0,enumerable:!0})}}class gt{constructor(t,e,n,r){Gr(this,"view"),this.view=new R(t,e,n,r)}}function Rr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function ue(i){i=Rr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Vr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var zr=Object.defineProperty,kr=(i,t,e)=>t in i?zr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wr=(i,t,e)=>(kr(i,t+"",e),e);class fe extends gt{constructor(){super(...arguments),Wr(this,"mimeType","font/opentype")}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 mn=Object.defineProperty,Xr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},qr=(i,t,e)=>(Xr(i,t+"",e),e);const q=class ur extends fe{constructor(){super(...arguments),qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=ue(r.fontFamily||""),o=s.length,h=ue(r.fontStyle||""),c=h.length,a=ue(r.version||""),l=a.length,u=ue(r.fullName||""),y=u.length,d=86+o+4+c+4+l+4+y+2+t.view.byteLength,g=new ur(new ArrayBuffer(d),0,d,!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 m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(y),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Q([p("uint32")],q.prototype,"EOTSize"),Q([p("uint32")],q.prototype,"FontDataSize"),Q([p("uint32")],q.prototype,"Version"),Q([p("uint32")],q.prototype,"Flags"),Q([p({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([p("uint8")],q.prototype,"Charset"),Q([p("uint8")],q.prototype,"Italic"),Q([p("uint32")],q.prototype,"Weight"),Q([p("uint16")],q.prototype,"fsType"),Q([p("uint16")],q.prototype,"MagicNumber"),Q([p({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([p({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([p("uint32")],q.prototype,"CheckSumAdjustment"),Q([p({type:"uint8",size:16})],q.prototype,"Reserved"),Q([p("uint16")],q.prototype,"Padding1");let jr=q;var Yr=Object.defineProperty,pe=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Yr(t,e,r),r};class Bt extends gt{constructor(t,e){super(t,e,16)}}pe([p({type:"char",size:4})],Bt.prototype,"tag"),pe([p("uint32")],Bt.prototype,"checkSum"),pe([p("uint32")],Bt.prototype,"offset"),pe([p("uint32")],Bt.prototype,"length");var Kr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Kr(t,e,r),r};const Yt=class fr extends gt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new fr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([p("uint16")],Yt.prototype,"format"),ye([p("uint16")],Yt.prototype,"length"),ye([p("uint16")],Yt.prototype,"language"),ye([p({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ue=Yt;var Qr=Object.defineProperty,Ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Kt extends gt{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,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,h=n.findIndex(a=>a===r);let c=0;for(let a=0;a<256;a++)if(n[a]===0)a>=h||a<s[0].firstCode||a>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(a-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(a-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(a,c);else{const l=n[a];for(let u=0,y=s[l].entryCount;u<y;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const d=(a<<8|u+s[l].firstCode)%65535;e.set(d,c)}}return e}}Ee([p("uint16")],Kt.prototype,"format"),Ee([p("uint16")],Kt.prototype,"length"),Ee([p("uint16")],Kt.prototype,"language");function vn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Fe(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:vn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=vn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var Zr=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Tt=class pr extends gt{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(n=>this.view.writeUint16(n))}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=Fe(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new pr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(h=>h.end),65535],o.reservedPad=0,o.startCode=[...e.map(h=>h.start),65535],o.idDelta=[...e.map(h=>h.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,h=this.idDelta,c=this.glyphIndexArray;for(let a=0;a<e;++a)for(let l=r[a],u=s[a];l<=u;++l)if(o[a]===0)t.set(l,(l+h[a])%65536);else{const y=a+o[a]/2+(l-r[a])-n,d=c[y];d!==0?t.set(l,(d+h[a])%65536):t.set(l,0)}return t.delete(65535),t}};$t([p("uint16")],Tt.prototype,"format"),$t([p("uint16")],Tt.prototype,"length"),$t([p("uint16")],Tt.prototype,"language"),$t([p("uint16")],Tt.prototype,"segCountX2"),$t([p("uint16")],Tt.prototype,"searchRange"),$t([p("uint16")],Tt.prototype,"entrySelector"),$t([p("uint16")],Tt.prototype,"rangeShift");let Be=Tt;var Jr=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class It extends gt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([p("uint16")],It.prototype,"format"),Qt([p("uint16")],It.prototype,"length"),Qt([p("uint16")],It.prototype,"language"),Qt([p("uint16")],It.prototype,"firstCode"),Qt([p("uint16")],It.prototype,"entryCount");var ti=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Nt=class yr extends gt{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=Fe(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,h=s.startCharCode;const c=s.endCharCode;for(;h<=c;)t.set(h++,o++)}return t}};Zt([p("uint16")],Nt.prototype,"format"),Zt([p("uint16")],Nt.prototype,"reserved"),Zt([p("uint32")],Nt.prototype,"length"),Zt([p("uint32")],Nt.prototype,"language"),Zt([p("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ei=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class Jt extends gt{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 n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([p("uint16")],Jt.prototype,"format"),Ge([p("uint32")],Jt.prototype,"length"),Ge([p("uint32")],Jt.prototype,"numVarSelectorRecords");var ni=Object.defineProperty,ri=(i,t,e)=>t in i?ni(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(ri(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const wn=class ae{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}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}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let h=0;h<r;h+=1)s[h]=e.get(n[h])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const h=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let a=0;a<c.length;a+=1){const l=c[a];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*h),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ae(this.tableViews)}delete(t){const e=ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ae.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ae.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(wn,"tableDefinitions",new Map);let te=wn;class Z extends gt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var bn=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,si=(i,t,e)=>t in i?bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bn(t,e,r),r},oi=(i,t,e)=>(si(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),oi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Be.from(t),r=Ue.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),h=o+n.view.byteLength,c=h+r.view.byteLength,a=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:h},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*a.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=a.length,l.view.seek(4),a.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,h),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){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 n=this.view.readUint16();let r;switch(n){case 0:r=new Ue(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Be(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new It(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var h,c,a,l,u;const t=this._getSubtables(),e=(h=t.find(y=>y.format===0))==null?void 0:h.view,n=(c=t.find(y=>y.platformID===3&&y.platformSpecificID===3&&y.format===2))==null?void 0:c.view,r=(a=t.find(y=>y.platformID===3&&y.platformSpecificID===1&&y.format===4))==null?void 0:a.view,s=(l=t.find(y=>y.platformID===3&&y.platformSpecificID===10&&y.format===12))==null?void 0:l.view,o=(u=t.find(y=>y.platformID===0&&y.platformSpecificID===5&&y.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([p("uint16")],f.Cmap.prototype,"version",2),Ve([p("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ai=Object.defineProperty,hi=(i,t,e)=>t in i?ai(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ci=(i,t,e)=>(hi(i,t+"",e),e);class xn{constructor(t){ci(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,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=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(),r>0){const h=this.endPointIndices=[];for(let m=0;m<r;m++)h.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const a=this.instructions=[];for(let m=0;m<c;++m)a.push(t.view.readUint8());const l=t.view.byteOffset,u=h[h.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const y=[];let d,g=0;for(;g<u;)if(d=t.view.readUint8(),y.push(d),g++,d&8&&g<u){const m=t.view.readUint8();for(let v=0;v<m;v++)y.push(d),g++}if(jt(y.length===u,`Bad flags length: ${y.length}, numberOfCoordinates: ${u}`),h.length>0){const m=[];let v;if(u>0){for(let w=0;w<u;w+=1)d=y[w],v={},v.onCurve=!!(d&1),v.lastPointOfContour=h.includes(w),m.push(v);let _=0;for(let w=0;w<u;w+=1)d=y[w],v=m[w],v.x=this._parseGlyphCoordinate(t,d,_,2,16),_=v.x;let x=0;for(let w=0;w<u;w+=1)d=y[w],v=m[w],v.y=this._parseGlyphCoordinate(t,d,x,4,32),x=v.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let h,c=!0;for(;c;){h=t.view.readUint16();const a={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(h&1)>0?(h&2)>0?(a.dx=t.view.readInt16(),a.dy=t.view.readInt16()):a.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(h&2)>0?(a.dx=t.view.readInt8(),a.dy=t.view.readInt8()):a.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(h&8)>0?a.xScale=a.yScale=t.view.readInt16()/16384:(h&64)>0?(a.xScale=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384):(h&128)>0&&(a.xScale=t.view.readInt16()/16384,a.scale01=t.view.readInt16()/16384,a.scale10=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384),this.components.push(a),c=!!(h&32)}if(h&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let a=0;a<this.instructionLength;a+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let h=0;h<this.components.length;h+=1){const c=this.components[h],a=n.get(c.glyphIndex);if(a.getPathCommands(),a.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(a.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>a.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let y=a.points[c.matchedPoints[1]];const d={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};y=this._transformPoints([y],d)[0],d.dx=u.x-y.x,d.dy=u.y-y.y,l=this._transformPoints(a.points,d)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let h=0,c=o.length;h<c;++h){const a=o[h];let l=a[a.length-1],u=a[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let y=0,d=a.length;y<d;++y)if(l=u,u=a[(y+1)%d],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let g=u;u.onCurve||(g={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:g.x,y:g.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:h=o,yScale:c=o}=r,a=this.pathCommands,l=[];for(let u=0,y=a.length;u<y;u+=1){const d=a[u];d.type==="M"?l.push({type:"M",x:t+d.x*h,y:e+-d.y*c}):d.type==="L"?l.push({type:"L",x:t+d.x*h,y:e+-d.y*c}):d.type==="Q"?l.push({type:"Q",x1:t+d.x1*h,y1:e+-d.y1*c,x:t+d.x*h,y:e+-d.y*c}):d.type==="Z"&&l.push({type:"Z"})}return l}}var li=Object.defineProperty,ui=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fi=(i,t,e)=>(ui(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,fi(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new xn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],h=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),h!==r[t+1]&&n._parse(this._sfnt.glyf,h,this),this._items[t]=n}return n}}var Mn=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,di=(i,t,e,n)=>{for(var r=n>1?void 0:n?pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},gi=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),gi(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=di([j("glyf")],f.Glyf);var mi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,wi=(i,t,e,n)=>{for(var r=n>1?void 0:n?vi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&mi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=wi([j("GPOS","gpos")],f.Gpos);var bi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,Dt=(i,t,e,n)=>{for(var r=n>1?void 0:n?xi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&bi(t,e,r),r};f.Gsub=class extends Z{},Dt([p("uint16")],f.Gsub.prototype,"majorVersion",2),Dt([p("uint16")],f.Gsub.prototype,"minorVersion",2),Dt([p("uint16")],f.Gsub.prototype,"scriptListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"featureListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"lookupListOffset",2),Dt([p("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Dt([j("GSUB","gsub")],f.Gsub);var _i=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([p("fixed")],f.Head.prototype,"version",2),G([p("fixed")],f.Head.prototype,"fontRevision",2),G([p("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([p("uint32")],f.Head.prototype,"magickNumber",2),G([p("uint16")],f.Head.prototype,"flags",2),G([p("uint16")],f.Head.prototype,"unitsPerEm",2),G([p({type:"longDateTime"})],f.Head.prototype,"created",2),G([p({type:"longDateTime"})],f.Head.prototype,"modified",2),G([p("int16")],f.Head.prototype,"xMin",2),G([p("int16")],f.Head.prototype,"yMin",2),G([p("int16")],f.Head.prototype,"xMax",2),G([p("int16")],f.Head.prototype,"yMax",2),G([p("uint16")],f.Head.prototype,"macStyle",2),G([p("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([p("int16")],f.Head.prototype,"fontDirectionHint",2),G([p("int16")],f.Head.prototype,"indexToLocFormat",2),G([p("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Si(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([p("fixed")],f.Hhea.prototype,"version",2),J([p("int16")],f.Hhea.prototype,"ascent",2),J([p("int16")],f.Hhea.prototype,"descent",2),J([p("int16")],f.Hhea.prototype,"lineGap",2),J([p("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([p("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([p("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([p("int16")],f.Hhea.prototype,"xMaxExtent",2),J([p("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([p("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([p("int16")],f.Hhea.prototype,"caretOffset",2),J([p({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([p("int16")],f.Hhea.prototype,"metricDataFormat",2),J([p("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Sn=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Ti=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ci(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Ai=(i,t,e)=>(Ti(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Ai(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=Oi([j("hmtx")],f.Hmtx);var $i=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Di=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&$i(t,e,r),r};f.Kern=class extends Z{},f.Kern=Di([j("kern","kern")],f.Kern);var Pn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Ui=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ei=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},Fi=(i,t,e)=>(Ui(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Fi(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Ei([j("loca")],f.Loca);var Bi=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ni(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Bi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([p("fixed")],f.Maxp.prototype,"version",2),Y([p("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([p("uint16")],f.Maxp.prototype,"maxPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxContours",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([p("uint16")],f.Maxp.prototype,"maxZones",2),Y([p("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([p("uint16")],f.Maxp.prototype,"maxStorage",2),Y([p("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([p("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([p("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([p("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([p("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,de=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};const Cn={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"},He={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Vi={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};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)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 n=this.stringOffset;for(let c=0;c<t;++c){const a=e[c];a.name=this.view.readBytes(n+a.offset,a.length)}let r=He.Macintosh,s=Vi.Default,o=0;e.some(c=>c.platform===He.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=He.Microsoft,s=Tn.UCS2,o=1033);const h={};for(let c=0;c<t;++c){const a=e[c];a.platform===r&&a.encoding===s&&a.language===o&&Cn[a.nameId]&&(h[Cn[a.nameId]]=o===0?Vr(a.name):Hr(a.name))}return h}},de([p("uint16")],f.Name.prototype,"format",2),de([p("uint16")],f.Name.prototype,"count",2),de([p("uint16")],f.Name.prototype,"stringOffset",2),f.Name=de([j("name")],f.Name);var Hi=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,P=(i,t,e,n)=>{for(var r=n>1?void 0:n?zi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Hi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},P([p("uint16")],f.Os2.prototype,"version",2),P([p("int16")],f.Os2.prototype,"xAvgCharWidth",2),P([p("uint16")],f.Os2.prototype,"usWeightClass",2),P([p("uint16")],f.Os2.prototype,"usWidthClass",2),P([p("uint16")],f.Os2.prototype,"fsType",2),P([p("uint16")],f.Os2.prototype,"ySubscriptXSize",2),P([p("uint16")],f.Os2.prototype,"ySubscriptYSize",2),P([p("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),P([p("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),P([p("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),P([p("uint16")],f.Os2.prototype,"yStrikeoutSize",2),P([p("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),P([p("uint16")],f.Os2.prototype,"sFamilyClass",2),P([p({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),P([p({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),P([p({type:"uint8"})],f.Os2.prototype,"bWeight",2),P([p({type:"uint8"})],f.Os2.prototype,"bProportion",2),P([p({type:"uint8"})],f.Os2.prototype,"bContrast",2),P([p({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),P([p({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),P([p({type:"uint8"})],f.Os2.prototype,"bLetterform",2),P([p({type:"uint8"})],f.Os2.prototype,"bMidline",2),P([p({type:"uint8"})],f.Os2.prototype,"bXHeight",2),P([p({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),P([p({type:"char",size:4})],f.Os2.prototype,"achVendID",2),P([p("uint16")],f.Os2.prototype,"fsSelection",2),P([p("uint16")],f.Os2.prototype,"usFirstCharIndex",2),P([p("uint16")],f.Os2.prototype,"usLastCharIndex",2),P([p("int16")],f.Os2.prototype,"sTypoAscender",2),P([p("int16")],f.Os2.prototype,"sTypoDescender",2),P([p("int16")],f.Os2.prototype,"sTypoLineGap",2),P([p("uint16")],f.Os2.prototype,"usWinAscent",2),P([p("uint16")],f.Os2.prototype,"usWinDescent",2),P([p({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),P([p({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),P([p("int16")],f.Os2.prototype,"sCapHeight",2),P([p("uint16")],f.Os2.prototype,"usDefaultChar",2),P([p("uint16")],f.Os2.prototype,"usBreakChar",2),P([p("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=P([j("OS/2","os2")],f.Os2);var ki=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ki(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([p("fixed")],f.Post.prototype,"format",2),mt([p("fixed")],f.Post.prototype,"italicAngle",2),mt([p("int16")],f.Post.prototype,"underlinePosition",2),mt([p("int16")],f.Post.prototype,"underlineThickness",2),mt([p("uint32")],f.Post.prototype,"isFixedPitch",2),mt([p("uint32")],f.Post.prototype,"minMemType42",2),mt([p("uint32")],f.Post.prototype,"maxMemType42",2),mt([p("uint32")],f.Post.prototype,"minMemType1",2),mt([p("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([p("fixed")],f.Vhea.prototype,"version",2),tt([p("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([p("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([p("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([p("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([p("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([p("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([p("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([p("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([p("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([p("int16")],f.Vhea.prototype,"caretOffset",2),tt([p({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([p("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([p("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Yi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t,e,n)=>{for(var r=n>1?void 0:n?ji(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Qi=(i,t,e)=>(Yi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Qi(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Ki([j("vmtx")],f.Vmtx);var An=Object.defineProperty,Zi=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},ze=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);const Lt=class Me extends fe{constructor(){super(...arguments),ze(this,"mimeType","font/ttf"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,y)=>u+e(y.byteLength),0),s=new Me(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let h=12+n*16,c=0;const a=s.getDirectories();t.tableViews.forEach((u,y)=>{const d=a[c++];d.tag=y,d.checkSum=Me.checksum(u),d.offset=h,d.length=u.byteLength,s.view.writeBytes(u,h),h+=e(d.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Me.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Bt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};ze(Lt,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([p("uint32")],Lt.prototype,"scalerType"),ee([p("uint16")],Lt.prototype,"numTables"),ee([p("uint16")],Lt.prototype,"searchRange"),ee([p("uint16")],Lt.prototype,"entrySelector"),ee([p("uint16")],Lt.prototype,"rangeShift");let _t=Lt;var Ji=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Ji(t,e,r),r};class Ut extends gt{constructor(t,e){super(t,e,20)}}ne([p({type:"char",size:4})],Ut.prototype,"tag"),ne([p("uint32")],Ut.prototype,"offset"),ne([p("uint32")],Ut.prototype,"compLength"),ne([p("uint32")],Ut.prototype,"origLength"),ne([p("uint32")],Ut.prototype,"origChecksum");var $n=Object.defineProperty,ts=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ke=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends fe{constructor(){super(...arguments),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let h=n-r*4;if(h){let c=r*4;for(;h>0;)s+=e.getUint8(c)<<h*8,c++,h--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,y)=>{const d=At(Ar(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:y,view:d.byteLength<u.byteLength?d:u,rawView:u})});const s=r.length,o=r.reduce((u,y)=>u+n(y.view.byteLength),0),h=new en(new ArrayBuffer(44+20*s+o+e.byteLength));h.signature=2001684038,h.flavor=65536,h.length=h.view.byteLength,h.numTables=s,h.totalSfntSize=12+16*s+r.reduce((u,y)=>u+n(y.rawView.byteLength),0);let c=44+s*20,a=0;const l=h.getDirectories();return r.forEach(u=>{const y=l[a++];y.tag=u.tag,y.offset=c,y.compLength=u.view.byteLength,y.origChecksum=en.checkSum(u.rawView),y.origLength=u.rawView.byteLength,h.view.writeBytes(u.view,c),c+=n(y.compLength)}),h.view.writeBytes(e),h}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Ut(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,h=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView($r(new Uint8Array(this.view.buffer.slice(r,h))).buffer),t},{}))}};ke(et,"FLAGS",new Set([2001684038])),st([p("uint32")],et.prototype,"signature"),st([p("uint32")],et.prototype,"flavor"),st([p("uint32")],et.prototype,"length"),st([p("uint16")],et.prototype,"numTables"),st([p("uint16")],et.prototype,"reserved"),st([p("uint32")],et.prototype,"totalSfntSize"),st([p("uint16")],et.prototype,"majorVersion"),st([p("uint16")],et.prototype,"minorVersion"),st([p("uint32")],et.prototype,"metaOffset"),st([p("uint32")],et.prototype,"metaLength"),st([p("uint32")],et.prototype,"metaOrigLength"),st([p("uint32")],et.prototype,"privOffset"),st([p("uint32")],et.prototype,"privLength");let Mt=et;var es=Object.defineProperty,ns=(i,t,e)=>t in i?es(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const In=class dr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...dr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
1
+ (function(f,z){typeof exports=="object"&&typeof module<"u"?z(exports):typeof define=="function"&&define.amd?define(["exports"],z):(f=typeof globalThis<"u"?globalThis:f||self,z(f.modernText={}))})(this,function(f){"use strict";var no=Object.defineProperty;var ro=(f,z,yt)=>z in f?no(f,z,{enumerable:!0,configurable:!0,writable:!0,value:yt}):f[z]=yt;var $=(f,z,yt)=>ro(f,typeof z!="symbol"?z+"":z,yt);function z(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:o,stops:h}=gr(t,e.left,e.top,e.width,e.height),c=i.createLinearGradient(n,r,s,o);return h.forEach(a=>c.addColorStop(a.offset,a.color)),c}return t}function yt(i,t,e){i!=null&&i.color&&(i.color=z(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=z(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=z(e,i.textStrokeColor,t))}function gr(i,t,e,n,r){var d;const s=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",o=s.split(",")[0],h=o.includes("deg")?o:"0deg",c=s.replace(h,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(h.replace("deg",""))||0)*Math.PI/180,u=n*Math.sin(l),p=r*Math.cos(l);return{x0:t+n/2-u,y0:e+r/2+p,x1:t+n/2+u,y1:e+r/2-p,stops:Array.from(c).map(g=>{let m=g[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(g[3].replace("%",""))/100,color:m}})}}function Se(i){const{ctx:t,paths:e,fontSize:n}=i;e.forEach(r=>{var l;t.save(),t.beginPath();const s=((l=r.userData)==null?void 0:l.style)??{},o=i.color??s.fill??"none",h=i.textStrokeColor??s.stroke??"none";t.fillStyle=o!=="none"?o:"#000",t.strokeStyle=h!=="none"?h:"#000",t.lineWidth=i.textStrokeWidth?i.textStrokeWidth*n:s.strokeWidth?s.strokeWidth*n*.03:0,t.lineCap=s.strokeLineCap??"round",t.lineJoin=s.strokeLineJoin??"miter",t.miterLimit=s.strokeMiterLimit??0,t.shadowOffsetX=(i.shadowOffsetX??0)*n,t.shadowOffsetY=(i.shadowOffsetY??0)*n,t.shadowBlur=(i.shadowBlur??0)*n,t.shadowColor=i.shadowColor??"rgba(0, 0, 0, 0)";const c=(i.offsetX??0)*n,a=(i.offsetY??0)*n;t.translate(c,a),r.drawTo(t),o!=="none"&&t.fill(),h!=="none"&&t.stroke(),t.restore()})}var k=Uint8Array,it=Uint16Array,Pe=Int32Array,he=new k([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]),ce=new k([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]),Ce=new k([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nn=function(i,t){for(var e=new it(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new Pe(e[30]),n=1;n<30;++n)for(var s=e[n];s<e[n+1];++s)r[s]=s-e[n]<<5|n;return{b:e,r}},rn=nn(he,2),sn=rn.b,Te=rn.r;sn[28]=258,Te[258]=28;for(var on=nn(ce,0),mr=on.b,an=on.r,Oe=new it(32768),I=0;I<32768;++I){var Pt=(I&43690)>>1|(I&21845)<<1;Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,Oe[I]=((Pt&65280)>>8|(Pt&255)<<8)>>1}for(var dt=function(i,t,e){for(var n=i.length,r=0,s=new it(t);r<n;++r)i[r]&&++s[i[r]-1];var o=new it(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;var h;if(e){h=new it(1<<t);var c=15-t;for(r=0;r<n;++r)if(i[r])for(var a=r<<4|i[r],l=t-i[r],u=o[i[r]-1]++<<l,p=u|(1<<l)-1;u<=p;++u)h[Oe[u]>>c]=a}else for(h=new it(n),r=0;r<n;++r)i[r]&&(h[r]=Oe[o[i[r]-1]++]>>15-i[r]);return h},Ct=new k(288),I=0;I<144;++I)Ct[I]=8;for(var I=144;I<256;++I)Ct[I]=9;for(var I=256;I<280;++I)Ct[I]=7;for(var I=280;I<288;++I)Ct[I]=8;for(var Wt=new k(32),I=0;I<32;++I)Wt[I]=5;var wr=dt(Ct,9,0),vr=dt(Ct,9,1),xr=dt(Wt,5,0),br=dt(Wt,5,1),Ae=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},ft=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},$e=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Ie=function(i){return(i+7)/8|0},hn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new k(i.subarray(t,e))},_r=["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(i,t,e){var n=new Error(t||_r[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,pt),!e)throw n;return n},Mr=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new k(0);var o=!e,h=o||t.i!=2,c=t.i;o&&(e=new k(r*3));var a=function(se){var oe=e.length;if(se>oe){var kt=new k(Math.max(oe*2,se));kt.set(e),e=kt}},l=t.f||0,u=t.p||0,p=t.b||0,d=t.l,g=t.d,m=t.m,w=t.n,_=r*8;do{if(!d){l=ft(i,u,1);var b=ft(i,u+1,3);if(u+=3,b)if(b==1)d=vr,g=br,m=9,w=5;else if(b==2){var O=ft(i,u,31)+257,A=ft(i,u+10,15)+4,M=O+ft(i,u+5,31)+1;u+=14;for(var S=new k(M),B=new k(19),N=0;N<A;++N)B[Ce[N]]=ft(i,u+N*3,7);u+=A*3;for(var K=Ae(B),Ot=(1<<K)-1,ot=dt(B,K,1),N=0;N<M;){var nt=ot[ft(i,u,Ot)];u+=nt&15;var x=nt>>4;if(x<16)S[N++]=x;else{var V=0,E=0;for(x==16?(E=3+ft(i,u,3),u+=2,V=S[N-1]):x==17?(E=3+ft(i,u,7),u+=3):x==18&&(E=11+ft(i,u,127),u+=7);E--;)S[N++]=V}}var rt=S.subarray(0,O),H=S.subarray(O);m=Ae(rt),w=Ae(H),d=dt(rt,m,1),g=dt(H,w,1)}else pt(1);else{var x=Ie(u)+4,C=i[x-4]|i[x-3]<<8,T=x+C;if(T>r){c&&pt(0);break}h&&a(p+C),e.set(i.subarray(x,T),p),t.b=p+=C,t.p=u=T*8,t.f=l;continue}if(u>_){c&&pt(0);break}}h&&a(p+131072);for(var ie=(1<<m)-1,ut=(1<<w)-1,St=u;;St=u){var V=d[$e(i,u)&ie],at=V>>4;if(u+=V&15,u>_){c&&pt(0);break}if(V||pt(2),at<256)e[p++]=at;else if(at==256){St=u,d=null;break}else{var ht=at-254;if(at>264){var N=at-257,U=he[N];ht=ft(i,u,(1<<U)-1)+sn[N],u+=U}var xt=g[$e(i,u)&ut],Ht=xt>>4;xt||pt(3),u+=xt&15;var H=mr[Ht];if(Ht>3){var U=ce[Ht];H+=$e(i,u)&(1<<U)-1,u+=U}if(u>_){c&&pt(0);break}h&&a(p+131072);var zt=p+ht;if(p<H){var be=s-H,_e=Math.min(H,zt);for(be+p<0&&pt(3);p<_e;++p)e[p]=n[be+p]}for(;p<zt;++p)e[p]=e[p-H]}}t.l=d,t.p=St,t.b=p,t.f=l,d&&(l=1,t.m=m,t.d=g,t.n=w)}while(!l);return p!=e.length&&o?hn(e,0,p):e.subarray(0,p)},bt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Xt=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8,i[n+2]|=e>>16},De=function(i,t){for(var e=[],n=0;n<i.length;++n)i[n]&&e.push({s:n,f:i[n]});var r=e.length,s=e.slice();if(!r)return{t:fn,l:0};if(r==1){var o=new k(e[0].s+1);return o[e[0].s]=1,{t:o,l:1}}e.sort(function(T,O){return T.f-O.f}),e.push({s:-1,f:25001});var h=e[0],c=e[1],a=0,l=1,u=2;for(e[0]={s:-1,f:h.f+c.f,l:h,r:c};l!=r-1;)h=e[e[a].f<e[u].f?a++:u++],c=e[a!=l&&e[a].f<e[u].f?a++:u++],e[l++]={s:-1,f:h.f+c.f,l:h,r:c};for(var p=s[0].s,n=1;n<r;++n)s[n].s>p&&(p=s[n].s);var d=new it(p+1),g=Le(e[l-1],d,0);if(g>t){var n=0,m=0,w=g-t,_=1<<w;for(s.sort(function(O,A){return d[A.s]-d[O.s]||O.f-A.f});n<r;++n){var b=s[n].s;if(d[b]>t)m+=_-(1<<g-d[b]),d[b]=t;else break}for(m>>=w;m>0;){var x=s[n].s;d[x]<t?m-=1<<t-d[x]++-1:++n}for(;n>=0&&m;--n){var C=s[n].s;d[C]==t&&(--d[C],++m)}g=t}return{t:new k(d),l:g}},Le=function(i,t,e){return i.s==-1?Math.max(Le(i.l,t,e+1),Le(i.r,t,e+1)):t[i.s]=e},cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new it(++t),n=0,r=i[0],s=1,o=function(c){e[n++]=c},h=1;h<=t;++h)if(i[h]==r&&h!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=i[h]}return{c:e.subarray(0,n),n:t}},qt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},ln=function(i,t,e){var n=e.length,r=Ie(t+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var s=0;s<n;++s)i[r+s+4]=e[s];return(r+4+n)*8},un=function(i,t,e,n,r,s,o,h,c,a,l){bt(t,l++,e),++r[256];for(var u=De(r,15),p=u.t,d=u.l,g=De(s,15),m=g.t,w=g.l,_=cn(p),b=_.c,x=_.n,C=cn(m),T=C.c,O=C.n,A=new it(19),M=0;M<b.length;++M)++A[b[M]&31];for(var M=0;M<T.length;++M)++A[T[M]&31];for(var S=De(A,7),B=S.t,N=S.l,K=19;K>4&&!B[Ce[K-1]];--K);var Ot=a+5<<3,ot=qt(r,Ct)+qt(s,Wt)+o,nt=qt(r,p)+qt(s,m)+o+14+3*K+qt(A,B)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&Ot<=ot&&Ot<=nt)return ln(t,l,i.subarray(c,c+a));var V,E,rt,H;if(bt(t,l,1+(nt<ot)),l+=2,nt<ot){V=dt(p,d,0),E=p,rt=dt(m,w,0),H=m;var ie=dt(B,N,0);bt(t,l,x-257),bt(t,l+5,O-1),bt(t,l+10,K-4),l+=14;for(var M=0;M<K;++M)bt(t,l+3*M,B[Ce[M]]);l+=3*K;for(var ut=[b,T],St=0;St<2;++St)for(var at=ut[St],M=0;M<at.length;++M){var ht=at[M]&31;bt(t,l,ie[ht]),l+=B[ht],ht>15&&(bt(t,l,at[M]>>5&127),l+=at[M]>>12)}}else V=wr,E=Ct,rt=xr,H=Wt;for(var M=0;M<h;++M){var U=n[M];if(U>255){var ht=U>>18&31;Xt(t,l,V[ht+257]),l+=E[ht+257],ht>7&&(bt(t,l,U>>23&31),l+=he[ht]);var xt=U&31;Xt(t,l,rt[xt]),l+=H[xt],xt>3&&(Xt(t,l,U>>5&8191),l+=ce[xt])}else Xt(t,l,V[U]),l+=E[U]}return Xt(t,l,V[256]),l+E[256]},Sr=new Pe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fn=new k(0),Pr=function(i,t,e,n,r,s){var o=s.z||i.length,h=new k(n+o+5*(1+Math.ceil(o/7e3))+r),c=h.subarray(n,h.length-r),a=s.l,l=(s.r||0)&7;if(t){l&&(c[0]=s.r>>3);for(var u=Sr[t-1],p=u>>13,d=u&8191,g=(1<<e)-1,m=s.p||new it(32768),w=s.h||new it(g+1),_=Math.ceil(e/3),b=2*_,x=function(tn){return(i[tn]^i[tn+1]<<_^i[tn+2]<<b)&g},C=new Pe(25e3),T=new it(288),O=new it(32),A=0,M=0,S=s.i||0,B=0,N=s.w||0,K=0;S+2<o;++S){var Ot=x(S),ot=S&32767,nt=w[Ot];if(m[ot]=nt,w[Ot]=ot,N<=S){var V=o-S;if((A>7e3||B>24576)&&(V>423||!a)){l=un(i,c,0,C,T,O,M,B,K,S-K,l),B=A=M=0,K=S;for(var E=0;E<286;++E)T[E]=0;for(var E=0;E<30;++E)O[E]=0}var rt=2,H=0,ie=d,ut=ot-nt&32767;if(V>2&&Ot==x(S-ut))for(var St=Math.min(p,V)-1,at=Math.min(32767,S),ht=Math.min(258,V);ut<=at&&--ie&&ot!=nt;){if(i[S+rt]==i[S+rt-ut]){for(var U=0;U<ht&&i[S+U]==i[S+U-ut];++U);if(U>rt){if(rt=U,H=ut,U>St)break;for(var xt=Math.min(ut,U-2),Ht=0,E=0;E<xt;++E){var zt=S-ut+E&32767,be=m[zt],_e=zt-be&32767;_e>Ht&&(Ht=_e,nt=zt)}}}ot=nt,nt=m[ot],ut+=ot-nt&32767}if(H){C[B++]=268435456|Te[rt]<<18|an[H];var se=Te[rt]&31,oe=an[H]&31;M+=he[se]+ce[oe],++T[257+se],++O[oe],N=S+rt,++A}else C[B++]=i[S],++T[i[S]]}}for(S=Math.max(S,N);S<o;++S)C[B++]=i[S],++T[i[S]];l=un(i,c,a,C,T,O,M,B,K,S-K,l),a||(s.r=l&7|c[l/8|0]<<3,l-=7,s.h=w,s.p=m,s.i=S,s.w=N)}else{for(var S=s.w||0;S<o+a;S+=65535){var kt=S+65535;kt>=o&&(c[l/8|0]=a,kt=o),l=ln(c,l+1,i.subarray(S,kt))}s.i=o}return hn(h,0,n+Ie(l)+r)},pn=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,o=0;o!=s;){for(var h=Math.min(o+2655,s);o<h;++o)r+=n+=e[o];n=(n&65535)+15*(n>>16),r=(r&65535)+15*(r>>16)}i=n,t=r},d:function(){return i%=65521,t%=65521,(i&255)<<24|(i&65280)<<8|(t&255)<<8|t>>8}}},Cr=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),o=new k(s.length+i.length);o.set(s),o.set(i,s.length),i=o,r.w=s.length}return Pr(i,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+t.mem,e,n,r)},yn=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},Tr=function(i,t){var e=t.level,n=e==0?0:e<6?1:e==9?3:2;if(i[0]=120,i[1]=n<<6|(t.dictionary&&32),i[1]|=31-(i[0]<<8|i[1])%31,t.dictionary){var r=pn();r.p(t.dictionary),yn(i,2,r.d())}},Or=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&pt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&pt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function Ar(i,t){t||(t={});var e=pn();e.p(i);var n=Cr(i,t,t.dictionary?6:2,4);return Tr(n,t),yn(n,n.length-4,e.d()),n}function $r(i,t){return Mr(i.subarray(Or(i,t),-4),{i:2},t,t)}var Ir=typeof TextDecoder<"u"&&new TextDecoder,Dr=0;try{Ir.decode(fn,{stream:!0}),Dr=1}catch{}const Lr="modern-font";function jt(i,t){if(!i)throw new Error(`[${Lr}] ${t}`)}function Er(i){return ArrayBuffer.isView(i)?i.byteOffset>0||i.byteLength<i.buffer.byteLength?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer:i}function At(i){return ArrayBuffer.isView(i)?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(i)}var dn=Object.defineProperty,Ur=(i,t,e)=>t in i?dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,W=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&dn(t,e,r),r},Fr=(i,t,e)=>(Ur(i,t+"",e),e);const le={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function X(){return function(i,t){Object.defineProperty(i.constructor.prototype,t,{get(){if(typeof t=="string"){if(t.startsWith("read"))return(...e)=>this.read(t.substring(4).toLowerCase(),...e);if(t.startsWith("write"))return(...e)=>this.write(t.substring(5).toLowerCase(),...e)}},configurable:!0,enumerable:!0})}}class R extends DataView{constructor(t,e,n,r){super(Er(t),e,n),this.littleEndian=r,Fr(this,"cursor",0)}getColumn(t){if(t.size){const e=Array.from({length:t.size},(n,r)=>this.read(t.type,t.offset+r));switch(t.type){case"char":return e.join("");default:return e}}else return this.read(t.type,t.offset)}setColumn(t,e){t.size?Array.from({length:t.size},(n,r)=>{this.write(t.type,e[r],t.offset+r)}):this.write(t.type,e,t.offset)}read(t,e=this.cursor,n=this.littleEndian){switch(t){case"char":return this.readChar(e);case"fixed":return this.readFixed(e,n);case"longDateTime":return this.readLongDateTime(e,n)}const r=`get${t.replace(/^\S/,o=>o.toUpperCase())}`,s=this[r](e,n);return this.cursor+=le[t],s}readUint24(t=this.cursor){const[e,n,r]=this.readBytes(t,3);return(e<<16)+(n<<8)+r}readBytes(t,e){e==null&&(e=t,t=this.cursor);const n=[];for(let r=0;r<e;++r)n.push(this.getUint8(t+r));return this.cursor=t+e,n}readString(t,e){e===void 0&&(e=t,t=this.cursor);let n="";for(let r=0;r<e;++r)n+=String.fromCharCode(this.readUint8(t+r));return this.cursor=t+e,n}readFixed(t,e){const n=this.readInt32(t,e)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(t=this.cursor,e){const n=this.readUint32(t+4,e),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(t){return this.readString(t,1)}write(t,e,n=this.cursor,r=this.littleEndian){switch(t){case"char":return this.writeChar(e,n);case"fixed":return this.writeFixed(e,n);case"longDateTime":return this.writeLongDateTime(e,n)}const s=`set${t.replace(/^\S/,h=>h.toUpperCase())}`,o=this[s](n,e,r);return this.cursor+=le[t.toLowerCase()],o}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,o;r<s;++r)o=t.charCodeAt(r)||0,o>127?this.writeUint16(o):this.writeUint8(o);return this.cursor+=n,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 r=Math.round((t- -20775456e5)/1e3);return this.writeUint32(0,e),this.writeUint32(r,e+4),this}writeBytes(t,e=this.cursor){let n;if(Array.isArray(t)){n=t.length;for(let r=0;r<n;++r)this.setUint8(e+r,t[r])}else{const r=At(t);n=r.byteLength;for(let s=0;s<n;++s)this.setUint8(e+s,r.getUint8(s))}return this.cursor=e+n,this}seek(t){return this.cursor=t,this}}W([X()],R.prototype,"readInt8"),W([X()],R.prototype,"readInt16"),W([X()],R.prototype,"readInt32"),W([X()],R.prototype,"readUint8"),W([X()],R.prototype,"readUint16"),W([X()],R.prototype,"readUint32"),W([X()],R.prototype,"readFloat32"),W([X()],R.prototype,"readFloat64"),W([X()],R.prototype,"writeInt8"),W([X()],R.prototype,"writeInt16"),W([X()],R.prototype,"writeInt32"),W([X()],R.prototype,"writeUint8"),W([X()],R.prototype,"writeUint16"),W([X()],R.prototype,"writeUint32"),W([X()],R.prototype,"writeFloat32"),W([X()],R.prototype,"writeFloat64");var Br=Object.defineProperty,Nr=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gr=(i,t,e)=>(Nr(i,t+"",e),e);const gn=new WeakMap;function y(i){const t=typeof i=="object"?i:{type:i},{size:e=1,type:n}=t;return(r,s)=>{if(typeof s!="string")return;let o=gn.get(r);o||(o={columns:[],byteLength:0},gn.set(r,o));const h={...t,name:s,byteLength:e*le[n],offset:t.offset??o.columns.reduce((c,a)=>c+a.byteLength,0)};o.columns.push(h),o.byteLength=o.columns.reduce((c,a)=>c+le[a.type]*(a.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(h)},set(c){this.view.setColumn(h,c)},configurable:!0,enumerable:!0})}}class gt{constructor(t,e,n,r){Gr(this,"view"),this.view=new R(t,e,n,r)}}function Rr(i){let t="";for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),r!==0&&(t+=String.fromCharCode(r));return t}function ue(i){i=Rr(i);const t=[];for(let e=0,n=i.length,r;e<n;e++)r=i.charCodeAt(e),t.push(r>>8),t.push(r&255);return t}function Vr(i){let t="";for(let e=0,n=i.length;e<n;e++)i[e]<127?t+=String.fromCharCode(i[e]):t+=`%${(256+i[e]).toString(16).slice(1)}`;return unescape(t)}function Hr(i){let t="";for(let e=0,n=i.length;e<n;e+=2)t+=String.fromCharCode((i[e]<<8)+i[e+1]);return t}var zr=Object.defineProperty,kr=(i,t,e)=>t in i?zr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wr=(i,t,e)=>(kr(i,t+"",e),e);class fe extends gt{constructor(){super(...arguments),Wr(this,"mimeType","font/opentype")}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 mn=Object.defineProperty,Xr=(i,t,e)=>t in i?mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Q=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&mn(t,e,r),r},qr=(i,t,e)=>(Xr(i,t+"",e),e);const q=class ur extends fe{constructor(){super(...arguments),qr(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=ue(r.fontFamily||""),o=s.length,h=ue(r.fontStyle||""),c=h.length,a=ue(r.version||""),l=a.length,u=ue(r.fullName||""),p=u.length,d=86+o+4+c+4+l+4+p+2+t.view.byteLength,g=new ur(new ArrayBuffer(d),0,d,!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 m=e.os2;return m&&(g.FontPANOSE=m.fontPANOSE,g.Italic=m.fsSelection,g.Weight=m.usWeightClass,g.fsType=m.fsType,g.UnicodeRange=m.ulUnicodeRange,g.CodePageRange=m.ulCodePageRange),g.view.writeUint16(o),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(c),g.view.writeBytes(h),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(a),g.view.writeUint16(0),g.view.writeUint16(p),g.view.writeBytes(u),g.view.writeUint16(0),g.view.writeUint16(0),g.view.writeBytes(t.view),g}};Q([y("uint32")],q.prototype,"EOTSize"),Q([y("uint32")],q.prototype,"FontDataSize"),Q([y("uint32")],q.prototype,"Version"),Q([y("uint32")],q.prototype,"Flags"),Q([y({type:"uint8",size:10})],q.prototype,"FontPANOSE"),Q([y("uint8")],q.prototype,"Charset"),Q([y("uint8")],q.prototype,"Italic"),Q([y("uint32")],q.prototype,"Weight"),Q([y("uint16")],q.prototype,"fsType"),Q([y("uint16")],q.prototype,"MagicNumber"),Q([y({type:"uint8",size:16})],q.prototype,"UnicodeRange"),Q([y({type:"uint8",size:8})],q.prototype,"CodePageRange"),Q([y("uint32")],q.prototype,"CheckSumAdjustment"),Q([y({type:"uint8",size:16})],q.prototype,"Reserved"),Q([y("uint16")],q.prototype,"Padding1");let jr=q;var Yr=Object.defineProperty,pe=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Yr(t,e,r),r};class Bt extends gt{constructor(t,e){super(t,e,16)}}pe([y({type:"char",size:4})],Bt.prototype,"tag"),pe([y("uint32")],Bt.prototype,"checkSum"),pe([y("uint32")],Bt.prototype,"offset"),pe([y("uint32")],Bt.prototype,"length");var Kr=Object.defineProperty,ye=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Kr(t,e,r),r};const Yt=class fr extends gt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new fr;return e.format=0,e.length=e.view.byteLength,e.language=0,t.forEach((n,r)=>{r<256&&n<256&&e.view.writeUint8(n,6+r)}),e}getUnicodeGlyphIndexMap(){const t=new Map;return this.glyphIndexArray.forEach((e,n)=>{t.set(n,e)}),t}};ye([y("uint16")],Yt.prototype,"format"),ye([y("uint16")],Yt.prototype,"length"),ye([y("uint16")],Yt.prototype,"language"),ye([y({type:"uint8",size:256})],Yt.prototype,"glyphIndexArray");let Ee=Yt;var Qr=Object.defineProperty,Ue=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Qr(t,e,r),r};class Kt extends gt{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,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(t-n)*8-2)/2}))}get glyphIndexArray(){const t=this.maxSubHeaderKey,e=6+256*2+t*8;this.view.seek(e);const n=(this.view.byteLength-e)/2;return Array.from({length:n},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(t){const e=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,s=this.subHeaders,o=this.glyphIndexArray,h=n.findIndex(a=>a===r);let c=0;for(let a=0;a<256;a++)if(n[a]===0)a>=h||a<s[0].firstCode||a>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(a-s[0].firstCode)>=o.length?c=0:(c=o[s[0].idRangeOffset+(a-s[0].firstCode)],c!==0&&(c=c+s[0].idDelta)),c!==0&&c<t&&e.set(a,c);else{const l=n[a];for(let u=0,p=s[l].entryCount;u<p;u++)if(s[l].idRangeOffset+u>=o.length?c=0:(c=o[s[l].idRangeOffset+u],c!==0&&(c=c+s[l].idDelta)),c!==0&&c<t){const d=(a<<8|u+s[l].firstCode)%65535;e.set(d,c)}}return e}}Ue([y("uint16")],Kt.prototype,"format"),Ue([y("uint16")],Kt.prototype,"length"),Ue([y("uint16")],Kt.prototype,"language");function wn(i){return i>32767?i-65536:i<-32767?i+65536:i}function Fe(i,t){let e;const n=[];let r={};return i.forEach((s,o)=>{t&&o>t||((!e||o!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:o,startId:s,delta:wn(s-o)}):(r.start=Number(o),r.startId=s,r.delta=wn(s-o))),e={unicode:o,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var Zr=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Zr(t,e,r),r};const Tt=class pr extends gt{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(n=>this.view.writeUint16(n))}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=Fe(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,o=new pr(new ArrayBuffer(24+e.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=n*2,o.searchRange=s,o.entrySelector=r,o.rangeShift=2*n-s,o.endCode=[...e.map(h=>h.end),65535],o.reservedPad=0,o.startCode=[...e.map(h=>h.start),65535],o.idDelta=[...e.map(h=>h.delta),1],o.idRangeOffset=Array.from({length:n},()=>0),o}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,o=this.idRangeOffset,h=this.idDelta,c=this.glyphIndexArray;for(let a=0;a<e;++a)for(let l=r[a],u=s[a];l<=u;++l)if(o[a]===0)t.set(l,(l+h[a])%65536);else{const p=a+o[a]/2+(l-r[a])-n,d=c[p];d!==0?t.set(l,(d+h[a])%65536):t.set(l,0)}return t.delete(65535),t}};$t([y("uint16")],Tt.prototype,"format"),$t([y("uint16")],Tt.prototype,"length"),$t([y("uint16")],Tt.prototype,"language"),$t([y("uint16")],Tt.prototype,"segCountX2"),$t([y("uint16")],Tt.prototype,"searchRange"),$t([y("uint16")],Tt.prototype,"entrySelector"),$t([y("uint16")],Tt.prototype,"rangeShift");let Be=Tt;var Jr=Object.defineProperty,Qt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Jr(t,e,r),r};class It extends gt{get glyphIndexArray(){return this.view.seek(12),Array.from({length:this.entryCount},()=>this.view.readUint16())}getUnicodeGlyphIndexMap(){const t=this.glyphIndexArray,e=new Map;return t.forEach((n,r)=>{e.set(r,n)}),e}}Qt([y("uint16")],It.prototype,"format"),Qt([y("uint16")],It.prototype,"length"),Qt([y("uint16")],It.prototype,"language"),Qt([y("uint16")],It.prototype,"firstCode"),Qt([y("uint16")],It.prototype,"entryCount");var ti=Object.defineProperty,Zt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ti(t,e,r),r};const Nt=class yr extends gt{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=Fe(t),n=new yr(new ArrayBuffer(16+e.length*12));return n.format=12,n.reserved=0,n.length=n.view.byteLength,n.language=0,n.nGroups=e.length,e.forEach(r=>{n.view.writeUint32(r.start),n.view.writeUint32(r.end),n.view.writeUint32(r.startId)}),n}getUnicodeGlyphIndexMap(){const t=new Map,e=this.groups;for(let n=0,r=e.length;n<r;n++){const s=e[n];let o=s.startGlyphCode,h=s.startCharCode;const c=s.endCharCode;for(;h<=c;)t.set(h++,o++)}return t}};Zt([y("uint16")],Nt.prototype,"format"),Zt([y("uint16")],Nt.prototype,"reserved"),Zt([y("uint32")],Nt.prototype,"length"),Zt([y("uint32")],Nt.prototype,"language"),Zt([y("uint32")],Nt.prototype,"nGroups");let Ne=Nt;var ei=Object.defineProperty,Ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&ei(t,e,r),r};class Jt extends gt{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 n=this.view.readUint32();e.unicodeValueRanges=Array.from({length:n},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);const n=this.view.readUint32();e.uVSMappings=Array.from({length:n},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeGlyphIndexMap(){const t=new Map,e=this.getVarSelectorRecords();for(let n=0,r=e.length;n<r;n++){const{uVSMappings:s}=e[n];s.forEach(o=>{t.set(o.unicodeValue,o.glyphID)})}return t}}Ge([y("uint16")],Jt.prototype,"format"),Ge([y("uint32")],Jt.prototype,"length"),Ge([y("uint32")],Jt.prototype,"numVarSelectorRecords");var ni=Object.defineProperty,ri=(i,t,e)=>t in i?ni(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e)=>(ri(i,typeof t!="symbol"?t+"":t,e),e);function j(i,t=i){return e=>{te.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(te.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const vn=class ae{constructor(t){Re(this,"tables",new Map),Re(this,"tableViews",new Map),(t instanceof Map?t:new Map(Object.entries(t))).forEach((n,r)=>{this.tableViews.set(r,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))})}get names(){return this.name.getNames()}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}charToGlyphIndex(t){return this.cmap.unicodeGlyphIndexMap.get(t.codePointAt(0))??0}charToGlyph(t){return this.glyf.glyphs.get(this.charToGlyphIndex(t))}textToGlyphIndexes(t){const e=this.cmap.unicodeGlyphIndexMap,n=[];for(const r of t){const s=r.codePointAt(0);n.push(e.get(s)??0)}return n}textToGlyphs(t){const e=this.glyf.glyphs,n=this.textToGlyphIndexes(t),r=n.length,s=Array.from({length:r}),o=e.get(0);for(let h=0;h<r;h+=1)s[h]=e.get(n[h])||o;return s}getPathCommands(t,e,n,r,s){var o;return(o=this.charToGlyph(t))==null?void 0:o.getPathCommands(e,n,r,s,this)}getAdvanceWidth(t,e,n){return this.forEachGlyph(t,0,0,e,n,()=>{})}forEachGlyph(t,e=0,n=0,r=72,s={},o){const h=1/this.unitsPerEm*r,c=this.textToGlyphs(t);for(let a=0;a<c.length;a+=1){const l=c[a];o.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*h),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new ae(this.tableViews)}delete(t){const e=ae.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=ae.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=ae.tableDefinitions.get(t);if(!e)return;let n=this.tables.get(e.prop);if(!n){const r=e.class;if(r){const s=this.tableViews.get(t);s?n=new r(s.buffer,s.byteOffset,s.byteLength).setSfnt(this):n=new r().setSfnt(this),this.tables.set(e.prop,n)}}return n}};Re(vn,"tableDefinitions",new Map);let te=vn;class Z extends gt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var xn=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,si=(i,t,e)=>t in i?xn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&xn(t,e,r),r},oi=(i,t,e)=>(si(i,t+"",e),e);f.Cmap=class extends Z{constructor(){super(...arguments),oi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=Be.from(t),r=Ee.from(t),s=e?Ne.from(t):void 0,o=4+(s?32:24),h=o+n.view.byteLength,c=h+r.view.byteLength,a=[{platformID:0,platformSpecificID:3,offset:o},{platformID:1,platformSpecificID:0,offset:h},{platformID:3,platformSpecificID:1,offset:o},s&&{platformID:3,platformSpecificID:10,offset:c}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*a.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=a.length,l.view.seek(4),a.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,o),l.view.writeBytes(r.view,h),s&&l.view.writeBytes(s.view,c),l}get unicodeGlyphIndexMap(){return this._unicodeGlyphIndexMap||(this._unicodeGlyphIndexMap=this._getUnicodeGlyphIndexMap()),this._unicodeGlyphIndexMap}_getSubtables(){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 n=this.view.readUint16();let r;switch(n){case 0:r=new Ee(this.view.buffer,e.offset);break;case 2:r=new Kt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new Be(this.view.buffer,e.offset,this.view.readUint16());break;case 6:r=new It(this.view.buffer,e.offset,this.view.readUint16());break;case 12:r=new Ne(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Jt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var h,c,a,l,u;const t=this._getSubtables(),e=(h=t.find(p=>p.format===0))==null?void 0:h.view,n=(c=t.find(p=>p.platformID===3&&p.platformSpecificID===3&&p.format===2))==null?void 0:c.view,r=(a=t.find(p=>p.platformID===3&&p.platformSpecificID===1&&p.format===4))==null?void 0:a.view,s=(l=t.find(p=>p.platformID===3&&p.platformSpecificID===10&&p.format===12))==null?void 0:l.view,o=(u=t.find(p=>p.platformID===0&&p.platformSpecificID===5&&p.format===14))==null?void 0:u.view;return new Map([...(e==null?void 0:e.getUnicodeGlyphIndexMap())??[],...(n==null?void 0:n.getUnicodeGlyphIndexMap(this._sfnt.maxp.numGlyphs))??[],...(r==null?void 0:r.getUnicodeGlyphIndexMap())??[],...(s==null?void 0:s.getUnicodeGlyphIndexMap())??[],...(o==null?void 0:o.getUnicodeGlyphIndexMap())??[]])}},Ve([y("uint16")],f.Cmap.prototype,"version",2),Ve([y("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Ve([j("cmap")],f.Cmap);var ai=Object.defineProperty,hi=(i,t,e)=>t in i?ai(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ci=(i,t,e)=>(hi(i,t+"",e),e);class bn{constructor(t){ci(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,this.unicode=e.unicode,this.unicodes=e.unicodes||(e.unicode!==void 0?[e.unicode]:[]),e.xMin!==void 0&&(this.xMin=e.xMin),e.yMin!==void 0&&(this.yMin=e.yMin),e.xMax!==void 0&&(this.xMax=e.xMax),e.yMax!==void 0&&(this.yMax=e.yMax),e.advanceWidth!==void 0&&(this.advanceWidth=e.advanceWidth),e.leftSideBearing!==void 0&&(this.leftSideBearing=e.leftSideBearing),e.points!==void 0&&(this.points=e.points)}_parseContours(t){const e=[];let n=[];for(let r=0;r<t.length;r+=1){const s=t[r];n.push(s),s.lastPointOfContour&&(e.push(n),n=[])}return jt(n.length===0,"There are still points left in the current contour."),e}_transformPoints(t,e){const n=[];for(let r=0;r<t.length;r+=1){const s=t[r],o={x:e.xScale*s.x+e.scale10*s.y+e.dx,y:e.scale01*s.x+e.yScale*s.y+e.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};n.push(o)}return n}_parseGlyphCoordinate(t,e,n,r,s){let o;return(e&r)>0?(o=t.view.readUint8(),e&s||(o=-o),o=n+o):(e&s)>0?o=n:o=n+t.view.readInt16(),o}_parse(t,e,n){t.view.seek(e);const r=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(),r>0){const h=this.endPointIndices=[];for(let m=0;m<r;m++)h.push(t.view.readUint16());const c=this.instructionLength=t.view.readUint16();jt(c<5e3,`Bad instructionLength:${c}`);const a=this.instructions=[];for(let m=0;m<c;++m)a.push(t.view.readUint8());const l=t.view.byteOffset,u=h[h.length-1]+1;jt(u<2e4,`Bad numberOfCoordinates:${l}`);const p=[];let d,g=0;for(;g<u;)if(d=t.view.readUint8(),p.push(d),g++,d&8&&g<u){const m=t.view.readUint8();for(let w=0;w<m;w++)p.push(d),g++}if(jt(p.length===u,`Bad flags length: ${p.length}, numberOfCoordinates: ${u}`),h.length>0){const m=[];let w;if(u>0){for(let x=0;x<u;x+=1)d=p[x],w={},w.onCurve=!!(d&1),w.lastPointOfContour=h.includes(x),m.push(w);let _=0;for(let x=0;x<u;x+=1)d=p[x],w=m[x],w.x=this._parseGlyphCoordinate(t,d,_,2,16),_=w.x;let b=0;for(let x=0;x<u;x+=1)d=p[x],w=m[x],w.y=this._parseGlyphCoordinate(t,d,b,4,32),b=w.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let h,c=!0;for(;c;){h=t.view.readUint16();const a={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(h&1)>0?(h&2)>0?(a.dx=t.view.readInt16(),a.dy=t.view.readInt16()):a.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(h&2)>0?(a.dx=t.view.readInt8(),a.dy=t.view.readInt8()):a.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(h&8)>0?a.xScale=a.yScale=t.view.readInt16()/16384:(h&64)>0?(a.xScale=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384):(h&128)>0&&(a.xScale=t.view.readInt16()/16384,a.scale01=t.view.readInt16()/16384,a.scale10=t.view.readInt16()/16384,a.yScale=t.view.readInt16()/16384),this.components.push(a),c=!!(h&32)}if(h&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let a=0;a<this.instructionLength;a+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let h=0;h<this.components.length;h+=1){const c=this.components[h],a=n.get(c.glyphIndex);if(a.getPathCommands(),a.points){let l;if(c.matchedPoints===void 0)l=this._transformPoints(a.points,c);else{jt(c.matchedPoints[0]>this.points.length-1||c.matchedPoints[1]>a.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[c.matchedPoints[0]];let p=a.points[c.matchedPoints[1]];const d={xScale:c.xScale,scale01:c.scale01,scale10:c.scale10,yScale:c.yScale,dx:0,dy:0};p=this._transformPoints([p],d)[0],d.dx=u.x-p.x,d.dy=u.y-p.y,l=this._transformPoints(a.points,d)}this.points=this.points.concat(l)}}const s=[],o=this._parseContours(this.points);for(let h=0,c=o.length;h<c;++h){const a=o[h];let l=a[a.length-1],u=a[0];l.onCurve?s.push({type:"M",x:l.x,y:l.y}):u.onCurve?s.push({type:"M",x:u.x,y:u.y}):s.push({type:"M",x:(l.x+u.x)*.5,y:(l.y+u.y)*.5});for(let p=0,d=a.length;p<d;++p)if(l=u,u=a[(p+1)%d],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let g=u;u.onCurve||(g={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:g.x,y:g.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const o=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:h=o,yScale:c=o}=r,a=this.pathCommands,l=[];for(let u=0,p=a.length;u<p;u+=1){const d=a[u];d.type==="M"?l.push({type:"M",x:t+d.x*h,y:e+-d.y*c}):d.type==="L"?l.push({type:"L",x:t+d.x*h,y:e+-d.y*c}):d.type==="Q"?l.push({type:"Q",x1:t+d.x1*h,y1:e+-d.y1*c,x:t+d.x*h,y:e+-d.y*c}):d.type==="Z"&&l.push({type:"Z"})}return l}}var li=Object.defineProperty,ui=(i,t,e)=>t in i?li(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fi=(i,t,e)=>(ui(i,t+"",e),e);class _n{constructor(t){this._sfnt=t,fi(this,"_items",[])}get length(){return this._sfnt.loca.locations.length}get(t){const e=this._items[t];let n;if(e)n=e;else{n=new bn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,o=s[t],h=r[t];o&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),h!==r[t+1]&&n._parse(this._sfnt.glyf,h,this),this._items[t]=n}return n}}var Mn=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,yi=(i,t,e)=>t in i?Mn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,di=(i,t,e,n)=>{for(var r=n>1?void 0:n?pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Mn(t,e,r),r},gi=(i,t,e)=>(yi(i,t+"",e),e);const Gt={ARG_1_AND_2_ARE_WORDS:1,ARGS_ARE_XY_VALUES:2,ROUND_XY_TO_GRID:4,WE_HAVE_A_SCALE:8,RESERVED:16,MORE_COMPONENTS:32,WE_HAVE_AN_X_AND_Y_SCALE:64,WE_HAVE_A_TWO_BY_TWO:128,WE_HAVE_INSTRUCTIONS:256,USE_MY_METRICS:512,OVERLAP_COMPOUND:1024,SCALED_COMPONENT_OFFSET:2048,UNSCALED_COMPONENT_OFFSET:4096};f.Glyf=class extends Z{constructor(){super(...arguments),gi(this,"_glyphs")}static from(t){const e=t.reduce((r,s)=>r+s.byteLength,0),n=new f.Glyf(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeBytes(r)}),n}get glyphs(){return this._glyphs||(this._glyphs=new _n(this._sfnt)),this._glyphs}},f.Glyf=di([j("glyf")],f.Glyf);var mi=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,vi=(i,t,e,n)=>{for(var r=n>1?void 0:n?wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&mi(t,e,r),r};f.Gpos=class extends Z{},f.Gpos=vi([j("GPOS","gpos")],f.Gpos);var xi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,Dt=(i,t,e,n)=>{for(var r=n>1?void 0:n?bi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&xi(t,e,r),r};f.Gsub=class extends Z{},Dt([y("uint16")],f.Gsub.prototype,"majorVersion",2),Dt([y("uint16")],f.Gsub.prototype,"minorVersion",2),Dt([y("uint16")],f.Gsub.prototype,"scriptListOffset",2),Dt([y("uint16")],f.Gsub.prototype,"featureListOffset",2),Dt([y("uint16")],f.Gsub.prototype,"lookupListOffset",2),Dt([y("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Dt([j("GSUB","gsub")],f.Gsub);var _i=Object.defineProperty,Mi=Object.getOwnPropertyDescriptor,G=(i,t,e,n)=>{for(var r=n>1?void 0:n?Mi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&_i(t,e,r),r};f.Head=class extends Z{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},G([y("fixed")],f.Head.prototype,"version",2),G([y("fixed")],f.Head.prototype,"fontRevision",2),G([y("uint32")],f.Head.prototype,"checkSumAdjustment",2),G([y("uint32")],f.Head.prototype,"magickNumber",2),G([y("uint16")],f.Head.prototype,"flags",2),G([y("uint16")],f.Head.prototype,"unitsPerEm",2),G([y({type:"longDateTime"})],f.Head.prototype,"created",2),G([y({type:"longDateTime"})],f.Head.prototype,"modified",2),G([y("int16")],f.Head.prototype,"xMin",2),G([y("int16")],f.Head.prototype,"yMin",2),G([y("int16")],f.Head.prototype,"xMax",2),G([y("int16")],f.Head.prototype,"yMax",2),G([y("uint16")],f.Head.prototype,"macStyle",2),G([y("uint16")],f.Head.prototype,"lowestRecPPEM",2),G([y("int16")],f.Head.prototype,"fontDirectionHint",2),G([y("int16")],f.Head.prototype,"indexToLocFormat",2),G([y("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=G([j("head")],f.Head);var Si=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,J=(i,t,e,n)=>{for(var r=n>1?void 0:n?Pi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Si(t,e,r),r};f.Hhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},J([y("fixed")],f.Hhea.prototype,"version",2),J([y("int16")],f.Hhea.prototype,"ascent",2),J([y("int16")],f.Hhea.prototype,"descent",2),J([y("int16")],f.Hhea.prototype,"lineGap",2),J([y("uint16")],f.Hhea.prototype,"advanceWidthMax",2),J([y("int16")],f.Hhea.prototype,"minLeftSideBearing",2),J([y("int16")],f.Hhea.prototype,"minRightSideBearing",2),J([y("int16")],f.Hhea.prototype,"xMaxExtent",2),J([y("int16")],f.Hhea.prototype,"caretSlopeRise",2),J([y("int16")],f.Hhea.prototype,"caretSlopeRun",2),J([y("int16")],f.Hhea.prototype,"caretOffset",2),J([y({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),J([y("int16")],f.Hhea.prototype,"metricDataFormat",2),J([y("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=J([j("hhea")],f.Hhea);var Sn=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Ti=(i,t,e)=>t in i?Sn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oi=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ci(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Sn(t,e,r),r},Ai=(i,t,e)=>(Ti(i,t+"",e),e);f.Hmtx=class extends Z{constructor(){super(...arguments),Ai(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Hmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceWidth),n.view.writeUint16(r.leftSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.hhea.numOfLongHorMetrics;let n=0;return this.view.seek(0),Array.from({length:t}).map((r,s)=>(s<e&&(n=this.view.readUint16()),{advanceWidth:n,leftSideBearing:this.view.readUint16()}))}},f.Hmtx=Oi([j("hmtx")],f.Hmtx);var $i=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Di=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ii(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&$i(t,e,r),r};f.Kern=class extends Z{},f.Kern=Di([j("kern","kern")],f.Kern);var Pn=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,Ei=(i,t,e)=>t in i?Pn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ui=(i,t,e,n)=>{for(var r=n>1?void 0:n?Li(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Pn(t,e,r),r},Fi=(i,t,e)=>(Ei(i,t+"",e),e);f.Loca=class extends Z{constructor(){super(...arguments),Fi(this,"_locations")}static from(t,e=1){const n=t.length*(e?4:2),r=new f.Loca(new ArrayBuffer(n));return t.forEach(s=>{e?r.view.writeUint32(s):r.view.writeUint16(s/2)}),r}get locations(){return this._locations||(this._locations=this._getLocations()),this._locations}_getLocations(){const t=this._sfnt.maxp.numGlyphs,e=this._sfnt.head.indexToLocFormat;return this.view.seek(0),Array.from({length:t}).map(()=>e?this.view.readUint32():this.view.readUint16()*2)}},f.Loca=Ui([j("loca")],f.Loca);var Bi=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,Y=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ni(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Bi(t,e,r),r};f.Maxp=class extends Z{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},Y([y("fixed")],f.Maxp.prototype,"version",2),Y([y("uint16")],f.Maxp.prototype,"numGlyphs",2),Y([y("uint16")],f.Maxp.prototype,"maxPoints",2),Y([y("uint16")],f.Maxp.prototype,"maxContours",2),Y([y("uint16")],f.Maxp.prototype,"maxComponentPoints",2),Y([y("uint16")],f.Maxp.prototype,"maxComponentContours",2),Y([y("uint16")],f.Maxp.prototype,"maxZones",2),Y([y("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),Y([y("uint16")],f.Maxp.prototype,"maxStorage",2),Y([y("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),Y([y("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),Y([y("uint16")],f.Maxp.prototype,"maxStackElements",2),Y([y("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),Y([y("uint16")],f.Maxp.prototype,"maxComponentElements",2),Y([y("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=Y([j("maxp")],f.Maxp);var Gi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,de=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ri(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Gi(t,e,r),r};const Cn={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"},He={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Vi={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};f.Name=class extends Z{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let c=0;c<t;++c)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 n=this.stringOffset;for(let c=0;c<t;++c){const a=e[c];a.name=this.view.readBytes(n+a.offset,a.length)}let r=He.Macintosh,s=Vi.Default,o=0;e.some(c=>c.platform===He.Microsoft&&c.encoding===Tn.UCS2&&c.language===1033)&&(r=He.Microsoft,s=Tn.UCS2,o=1033);const h={};for(let c=0;c<t;++c){const a=e[c];a.platform===r&&a.encoding===s&&a.language===o&&Cn[a.nameId]&&(h[Cn[a.nameId]]=o===0?Vr(a.name):Hr(a.name))}return h}},de([y("uint16")],f.Name.prototype,"format",2),de([y("uint16")],f.Name.prototype,"count",2),de([y("uint16")],f.Name.prototype,"stringOffset",2),f.Name=de([j("name")],f.Name);var Hi=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,P=(i,t,e,n)=>{for(var r=n>1?void 0:n?zi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Hi(t,e,r),r};f.Os2=class extends Z{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}},P([y("uint16")],f.Os2.prototype,"version",2),P([y("int16")],f.Os2.prototype,"xAvgCharWidth",2),P([y("uint16")],f.Os2.prototype,"usWeightClass",2),P([y("uint16")],f.Os2.prototype,"usWidthClass",2),P([y("uint16")],f.Os2.prototype,"fsType",2),P([y("uint16")],f.Os2.prototype,"ySubscriptXSize",2),P([y("uint16")],f.Os2.prototype,"ySubscriptYSize",2),P([y("uint16")],f.Os2.prototype,"ySubscriptXOffset",2),P([y("uint16")],f.Os2.prototype,"ySubscriptYOffset",2),P([y("uint16")],f.Os2.prototype,"ySuperscriptXSize",2),P([y("uint16")],f.Os2.prototype,"ySuperscriptYSize",2),P([y("uint16")],f.Os2.prototype,"ySuperscriptXOffset",2),P([y("uint16")],f.Os2.prototype,"ySuperscriptYOffset",2),P([y("uint16")],f.Os2.prototype,"yStrikeoutSize",2),P([y("uint16")],f.Os2.prototype,"yStrikeoutPosition",2),P([y("uint16")],f.Os2.prototype,"sFamilyClass",2),P([y({type:"uint8"})],f.Os2.prototype,"bFamilyType",2),P([y({type:"uint8"})],f.Os2.prototype,"bSerifStyle",2),P([y({type:"uint8"})],f.Os2.prototype,"bWeight",2),P([y({type:"uint8"})],f.Os2.prototype,"bProportion",2),P([y({type:"uint8"})],f.Os2.prototype,"bContrast",2),P([y({type:"uint8"})],f.Os2.prototype,"bStrokeVariation",2),P([y({type:"uint8"})],f.Os2.prototype,"bArmStyle",2),P([y({type:"uint8"})],f.Os2.prototype,"bLetterform",2),P([y({type:"uint8"})],f.Os2.prototype,"bMidline",2),P([y({type:"uint8"})],f.Os2.prototype,"bXHeight",2),P([y({type:"uint8",size:16})],f.Os2.prototype,"ulUnicodeRange",2),P([y({type:"char",size:4})],f.Os2.prototype,"achVendID",2),P([y("uint16")],f.Os2.prototype,"fsSelection",2),P([y("uint16")],f.Os2.prototype,"usFirstCharIndex",2),P([y("uint16")],f.Os2.prototype,"usLastCharIndex",2),P([y("int16")],f.Os2.prototype,"sTypoAscender",2),P([y("int16")],f.Os2.prototype,"sTypoDescender",2),P([y("int16")],f.Os2.prototype,"sTypoLineGap",2),P([y("uint16")],f.Os2.prototype,"usWinAscent",2),P([y("uint16")],f.Os2.prototype,"usWinDescent",2),P([y({offset:72,type:"uint8",size:8})],f.Os2.prototype,"ulCodePageRange",2),P([y({offset:72,type:"int16"})],f.Os2.prototype,"sxHeight",2),P([y("int16")],f.Os2.prototype,"sCapHeight",2),P([y("uint16")],f.Os2.prototype,"usDefaultChar",2),P([y("uint16")],f.Os2.prototype,"usBreakChar",2),P([y("uint16")],f.Os2.prototype,"usMaxContext",2),f.Os2=P([j("OS/2","os2")],f.Os2);var ki=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,mt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Wi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&ki(t,e,r),r};f.Post=class extends Z{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},mt([y("fixed")],f.Post.prototype,"format",2),mt([y("fixed")],f.Post.prototype,"italicAngle",2),mt([y("int16")],f.Post.prototype,"underlinePosition",2),mt([y("int16")],f.Post.prototype,"underlineThickness",2),mt([y("uint32")],f.Post.prototype,"isFixedPitch",2),mt([y("uint32")],f.Post.prototype,"minMemType42",2),mt([y("uint32")],f.Post.prototype,"maxMemType42",2),mt([y("uint32")],f.Post.prototype,"minMemType1",2),mt([y("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=mt([j("post")],f.Post);var Xi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,tt=(i,t,e,n)=>{for(var r=n>1?void 0:n?qi(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&Xi(t,e,r),r};f.Vhea=class extends Z{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},tt([y("fixed")],f.Vhea.prototype,"version",2),tt([y("int16")],f.Vhea.prototype,"vertTypoAscender",2),tt([y("int16")],f.Vhea.prototype,"vertTypoDescender",2),tt([y("int16")],f.Vhea.prototype,"vertTypoLineGap",2),tt([y("int16")],f.Vhea.prototype,"advanceHeightMax",2),tt([y("int16")],f.Vhea.prototype,"minTopSideBearing",2),tt([y("int16")],f.Vhea.prototype,"minBottomSideBearing",2),tt([y("int16")],f.Vhea.prototype,"yMaxExtent",2),tt([y("int16")],f.Vhea.prototype,"caretSlopeRise",2),tt([y("int16")],f.Vhea.prototype,"caretSlopeRun",2),tt([y("int16")],f.Vhea.prototype,"caretOffset",2),tt([y({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),tt([y("int16")],f.Vhea.prototype,"metricDataFormat",2),tt([y("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=tt([j("vhea")],f.Vhea);var On=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Yi=(i,t,e)=>t in i?On(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t,e,n)=>{for(var r=n>1?void 0:n?ji(t,e):t,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=(n?o(t,e,r):o(r))||r);return n&&r&&On(t,e,r),r},Qi=(i,t,e)=>(Yi(i,t+"",e),e);f.Vmtx=class extends Z{constructor(){super(...arguments),Qi(this,"_metrics")}static from(t){const e=t.length*4,n=new f.Vmtx(new ArrayBuffer(e));return t.forEach(r=>{n.view.writeUint16(r.advanceHeight),n.view.writeInt16(r.topSideBearing)}),n}get metrics(){return this._metrics||(this._metrics=this._getMetrics()),this._metrics}_getMetrics(){var r;const t=this._sfnt.maxp.numGlyphs,e=((r=this._sfnt.vhea)==null?void 0:r.numOfLongVerMetrics)??0;this.view.seek(0);let n=0;return Array.from({length:t}).map((s,o)=>(o<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Ki([j("vmtx")],f.Vmtx);var An=Object.defineProperty,Zi=(i,t,e)=>t in i?An(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&An(t,e,r),r},ze=(i,t,e)=>(Zi(i,typeof t!="symbol"?t+"":t,e),e);const Lt=class Me extends fe{constructor(){super(...arguments),ze(this,"mimeType","font/ttf"),ze(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checksum(t){const e=At(t);let n=e.byteLength;for(;n%4;)n++;let r=0;for(let s=0,o=n/4;s<o;s+=4)s*4<n-4&&(r+=e.getUint32(s*4,!1));return r&4294967295}static from(t){const e=u=>u+3&-4,n=t.tableViews.size,r=t.tableViews.values().reduce((u,p)=>u+e(p.byteLength),0),s=new Me(new ArrayBuffer(12+n*16+r)),o=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/o)*16,s.entrySelector=Math.floor(s.searchRange/o),s.rangeShift=n*16-s.searchRange;let h=12+n*16,c=0;const a=s.getDirectories();t.tableViews.forEach((u,p)=>{const d=a[c++];d.tag=p,d.checkSum=Me.checksum(u),d.offset=h,d.length=u.byteLength,s.view.writeBytes(u,h),h+=e(d.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-Me.checksum(s.view),s}getDirectories(){let t=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{const e=new Bt(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};ze(Lt,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),ee([y("uint32")],Lt.prototype,"scalerType"),ee([y("uint16")],Lt.prototype,"numTables"),ee([y("uint16")],Lt.prototype,"searchRange"),ee([y("uint16")],Lt.prototype,"entrySelector"),ee([y("uint16")],Lt.prototype,"rangeShift");let _t=Lt;var Ji=Object.defineProperty,ne=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&Ji(t,e,r),r};class Et extends gt{constructor(t,e){super(t,e,20)}}ne([y({type:"char",size:4})],Et.prototype,"tag"),ne([y("uint32")],Et.prototype,"offset"),ne([y("uint32")],Et.prototype,"compLength"),ne([y("uint32")],Et.prototype,"origLength"),ne([y("uint32")],Et.prototype,"origChecksum");var $n=Object.defineProperty,ts=(i,t,e)=>t in i?$n(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,st=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,o;s>=0;s--)(o=i[s])&&(r=o(t,e,r)||r);return r&&$n(t,e,r),r},ke=(i,t,e)=>(ts(i,typeof t!="symbol"?t+"":t,e),e);const et=class en extends fe{constructor(){super(...arguments),ke(this,"mimeType","font/woff"),ke(this,"_sfnt")}get sfnt(){return this._sfnt||(this._sfnt=this.createSfnt()),this._sfnt}static is(t){return this.FLAGS.has(At(t).getUint32(0))}static checkSum(t){const e=At(t),n=e.byteLength,r=Math.floor(n/4);let s=0,o=0;for(;o<r;)s+=e.getUint32(4*o++,!1);let h=n-r*4;if(h){let c=r*4;for(;h>0;)s+=e.getUint8(c)<<h*8,c++,h--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,p)=>{const d=At(Ar(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:p,view:d.byteLength<u.byteLength?d:u,rawView:u})});const s=r.length,o=r.reduce((u,p)=>u+n(p.view.byteLength),0),h=new en(new ArrayBuffer(44+20*s+o+e.byteLength));h.signature=2001684038,h.flavor=65536,h.length=h.view.byteLength,h.numTables=s,h.totalSfntSize=12+16*s+r.reduce((u,p)=>u+n(p.rawView.byteLength),0);let c=44+s*20,a=0;const l=h.getDirectories();return r.forEach(u=>{const p=l[a++];p.tag=u.tag,p.offset=c,p.compLength=u.view.byteLength,p.origChecksum=en.checkSum(u.rawView),p.origLength=u.rawView.byteLength,h.view.writeBytes(u.view,c),c+=n(p.compLength)}),h.view.writeBytes(e),h}getDirectories(){let t=44;return Array.from({length:this.numTables},()=>{const e=new Et(this.view.buffer,t);return t+=e.view.byteLength,e})}createSfnt(){return new te(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,o=e.origLength,h=r+s;return t[n]=s>=o?new DataView(this.view.buffer,r,s):new DataView($r(new Uint8Array(this.view.buffer.slice(r,h))).buffer),t},{}))}};ke(et,"FLAGS",new Set([2001684038])),st([y("uint32")],et.prototype,"signature"),st([y("uint32")],et.prototype,"flavor"),st([y("uint32")],et.prototype,"length"),st([y("uint16")],et.prototype,"numTables"),st([y("uint16")],et.prototype,"reserved"),st([y("uint32")],et.prototype,"totalSfntSize"),st([y("uint16")],et.prototype,"majorVersion"),st([y("uint16")],et.prototype,"minorVersion"),st([y("uint32")],et.prototype,"metaOffset"),st([y("uint32")],et.prototype,"metaLength"),st([y("uint32")],et.prototype,"metaOrigLength"),st([y("uint32")],et.prototype,"privOffset"),st([y("uint32")],et.prototype,"privLength");let Mt=et;var es=Object.defineProperty,ns=(i,t,e)=>t in i?es(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,re=(i,t,e)=>(ns(i,typeof t!="symbol"?t+"":t,e),e);const In=class dr{constructor(){re(this,"fallbackFont"),re(this,"_loading",new Map),re(this,"_loaded",new Map),re(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...dr.defaultRequestInit,...e,signal:n.signal}).then(r=>r.arrayBuffer()),cancel:()=>n.abort()}}injectFontFace(t,e){return document.fonts.add(new FontFace(t,e)),this}injectStyleTag(t,e){const n=document.createElement("style");return n.appendChild(document.createTextNode(`@font-face {
2
2
  font-family: "${t}";
3
3
  src: url(${e});
4
- }`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(Mt.is(t))return new Mt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}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:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:h,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let a=this._loading.get(c);return a||(a=this._createRequest(c,o),this._loading.set(c,a)),n&&this._loading.forEach((l,u)=>{l!==a&&(l.cancel(),this._loading.delete(u))}),a.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(h)?h:[h]).forEach(y=>{this._namesUrls.set(y,c),typeof document<"u"&&(r&&this.injectFontFace(y,l),s&&this.injectStyleTag(y,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(In,"defaultRequestInit",{cache:"force-cache"});let Dn=In;const Ln=new Dn;function Un(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,h=e.unicodeGlyphIndexMap,c=n.locations,a=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&h.has(m)))).sort((m,v)=>m-v),y=new Map;u.forEach(m=>{const v=h.get(m)??0;let _=y.get(v);_||y.set(v,_=new Set),_.add(m)});const d=[],g=m=>{const v=a[m],_=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},x=c[m],w=c[m+1]??x,C={...v,..._,rawGlyphIndex:m,glyphIndex:d.length,unicodes:Array.from(y.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+x,w-x)};return d.push(C),C};return g(0),u.forEach(m=>g(h.get(m))),d.slice().forEach(m=>{const{view:v}=m;if(!v.byteLength||v.getInt16(0)>=0)return;let x=10,w;do{w=v.getUint16(x);const C=x+2,T=v.getUint16(C);x+=4,Gt.ARG_1_AND_2_ARE_WORDS&w?x+=4:x+=2,Gt.WE_HAVE_A_SCALE&w?x+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&w?x+=4:Gt.WE_HAVE_A_TWO_BY_TWO&w&&(x+=8);const O=g(T);v.setUint16(C,O.glyphIndex)}while(Gt.MORE_COMPONENTS&w)}),d}function En(i,t){const e=Un(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:h}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(y=>{const d=c;return c+=y.view.byteLength,d}),c],r.indexToLocFormat);const a=e.reduce((y,d,g)=>(d.unicodes.forEach(m=>y.set(m,g)),y),new Map);i.cmap=f.Cmap.from(a),i.glyf=f.Glyf.from(e.map(y=>y.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(y=>({advanceWidth:y.advanceWidth,leftSideBearing:y.leftSideBearing}))),h&&(h.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(y=>({advanceHeight:y.advanceHeight,topSideBearing:y.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function rs(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof Mt)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(Mt.is(s))e=new Mt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=En(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return Mt.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return Mt.from(r).view.buffer}}class b{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new b(1/0,1/0)}static get MIN(){return new b(-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,n=this.y-t.y;return e*e+n*n}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,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new b(this.x,this.y)}}class L{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}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],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{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 L(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new b((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new L(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var is=Object.defineProperty,ss=(i,t,e)=>t in i?is(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,os=(i,t,e)=>(ss(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,h=0,c=0,a=1){os(this,"elements",[]),this.set(t,e,n,r,s,o,h,c,a)}set(t,e,n,r,s,o,h,c,a){const l=this.elements;return l[0]=t,l[1]=r,l[2]=h,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],h=n[3],c=n[6],a=n[1],l=n[4],u=n[7],y=n[2],d=n[5],g=n[8],m=r[0],v=r[3],_=r[6],x=r[1],w=r[4],C=r[7],T=r[2],O=r[5],A=r[8];return s[0]=o*m+h*x+c*T,s[3]=o*v+h*w+c*O,s[6]=o*_+h*C+c*A,s[1]=a*m+l*x+u*T,s[4]=a*v+l*w+u*O,s[7]=a*_+l*C+u*A,s[2]=y*m+d*x+g*T,s[5]=y*v+d*w+g*O,s[8]=y*_+d*C+g*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],h=t[5],c=t[6],a=t[7],l=t[8],u=l*o-h*a,y=h*c-l*s,d=a*s-o*c,g=e*u+n*y+r*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(r*a-l*n)*m,t[2]=(h*n-r*o)*m,t[3]=y*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-h*e)*m,t[6]=d*m,t[7]=(n*c-a*e)*m,t[8]=(o*e-n*s)*m,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(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.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),n=Math.sin(t);return this.set(e,-n,0,n,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 n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Fn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function as(i,t,e,n,r,s,o,h){if(t===0||e===0){i.lineTo(h.x,h.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-h.x)/2,a=(o.y-h.y)/2,l=Math.cos(n)*c+Math.sin(n)*a,u=-Math.sin(n)*c+Math.cos(n)*a;let y=t*t,d=e*e;const g=l*l,m=u*u,v=g/y+m/d;if(v>1){const B=Math.sqrt(v);t=B*t,e=B*e,y=t*t,d=e*e}const _=y*m+d*g,x=(y*d-_)/_;let w=Math.sqrt(Math.max(0,x));r===s&&(w=-w);const C=w*t*u/e,T=-w*e*l/t,O=Math.cos(n)*C-Math.sin(n)*T+(o.x+h.x)/2,A=Math.sin(n)*C+Math.cos(n)*T+(o.y+h.y)/2,M=Fn(1,0,(l-C)/t,(u-T)/e),S=Fn((l-C)/t,(u-T)/e,(-l-C)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(O,A,t,e,M,M+S,s===0,n)}function Rt(i,t){return i-(t-i)}function hs(i,t){const e=new b,n=new b,r=new b;let s=!0,o=!1;for(let h=0,c=i.length;h<c;h++){const a=i[h];if(s&&(o=!0,s=!1),a.type==="m"||a.type==="M")a.type==="m"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(a.type==="h"||a.type==="H")a.type==="h"?e.x+=a.x:e.x=a.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="v"||a.type==="V")a.type==="v"?e.y+=a.y:e.y=a.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="l"||a.type==="L")a.type==="l"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="c"||a.type==="C")a.type==="c"?(t.bezierCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="s"||a.type==="S")a.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="q"||a.type==="Q")a.type==="q"?(t.quadraticCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x,e.y+a.y),n.x=e.x+a.x1,n.y=e.y+a.y1,e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),n.x=a.x1,n.y=a.y1,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="t"||a.type==="T"){const l=Rt(e.x,n.x),u=Rt(e.y,n.y);n.x=l,n.y=u,a.type==="t"?(t.quadraticCurveTo(l,u,e.x+a.x,e.y+a.y),e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(l,u,a.x,a.y),e.x=a.x,e.y=a.y),o&&r.copy(e)}else if(a.type==="a"||a.type==="A"){if(a.type==="a"){if(a.x===0&&a.y===0)continue;e.x+=a.x,e.y+=a.y}else{if(a.x===e.x&&a.y===e.y)continue;e.x=a.x,e.y=a.y}const l=e.clone();n.x=e.x,n.y=e.y,as(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,l,e),o&&r.copy(e)}else a.type==="z"||a.type==="Z"?(t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(e.copy(r),t.currentPath.currentPoint.copy(e),s=!0)):console.warn("Unsupported commands",a);o=!1}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function vt(i,t,e=0){let h=0,c=!0,a="",l="";const u=[];function y(v,_,x){const w=new SyntaxError(`Unexpected character "${v}" at index ${_}.`);throw w.partial=x,w}function d(){a!==""&&(l===""?u.push(Number(a)):u.push(Number(a)*10**Number(l))),a="",l=""}let g;const m=i.length;for(let v=0;v<m;v++){if(g=i[v],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(g)){h=1,a=g,d();continue}if(h===0){if(F.WHITESPACE.test(g))continue;if(F.DIGIT.test(g)||F.SIGN.test(g)){h=1,a=g;continue}if(F.POINT.test(g)){h=2,a=g;continue}F.COMMA.test(g)&&(c&&y(g,v,u),c=!0)}if(h===1){if(F.DIGIT.test(g)){a+=g;continue}if(F.POINT.test(g)){a+=g,h=2;continue}if(F.EXP.test(g)){h=3;continue}F.SIGN.test(g)&&a.length===1&&F.SIGN.test(a[0])&&y(g,v,u)}if(h===2){if(F.DIGIT.test(g)){a+=g;continue}if(F.EXP.test(g)){h=3;continue}F.POINT.test(g)&&a[a.length-1]==="."&&y(g,v,u)}if(h===3){if(F.DIGIT.test(g)){l+=g;continue}if(F.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&F.SIGN.test(l)&&y(g,v,u)}}F.WHITESPACE.test(g)?(d(),h=0,c=!1):F.COMMA.test(g)?(d(),h=0,c=!0):F.SIGN.test(g)?(d(),h=1,a=g):F.POINT.test(g)?(d(),h=2,a=g):y(g,v,u)}return d(),u}function cs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ls(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${cs(i[e])} `;return t}const us=/[a-df-z][^a-df-z]*/gi;function fs(i){const t=[],e=i.match(us);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),h=s.slice(1).trim();let c;switch(o){case"m":case"M":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)a===0?t.push({type:o,x:c[a],y:c[a+1]}):t.push({type:o==="m"?"l":"L",x:c[a],y:c[a+1]});break;case"h":case"H":c=vt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,x:c[a]});break;case"v":case"V":c=vt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,y:c[a]});break;case"l":case"L":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"c":case"C":c=vt(h);for(let a=0,l=c.length;a<l;a+=6)t.push({type:o,x1:c[a],y1:c[a+1],x2:c[a+2],y2:c[a+3],x:c[a+4],y:c[a+5]});break;case"s":case"S":c=vt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x2:c[a],y2:c[a+1],x:c[a+2],y:c[a+3]});break;case"q":case"Q":c=vt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x1:c[a],y1:c[a+1],x:c[a+2],y:c[a+3]});break;case"t":case"T":c=vt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"a":case"A":c=vt(h,[3,4],7);for(let a=0,l=c.length;a<l;a+=7)t.push({type:o,rx:c[a],ry:c[a+1],angle:c[a+2],largeArcFlag:c[a+3],sweepFlag:c[a+4],x:c[a+5],y:c[a+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var ps=Object.defineProperty,ys=(i,t,e)=>t in i?ps(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Et{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new b){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/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 n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let h=0,c=s-1,a;for(;h<=c;)if(r=Math.floor(h+(c-h)/2),a=n[r]-o,a<0)h=r+1;else if(a>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],y=n[r+1]-l,d=(o-l)/y;return(r+d)/(s-1)}getTangent(t,e=new b){let r=t-1e-4,s=t+1e-4;return r<0&&(r=0),s>1&&(s=1),e.copy(this.getPoint(s)).sub(this.getPoint(r)).normalize()}getTangentAt(t,e=new b){return this.getTangent(this.getUtoTmapping(t),e)}transform(t){return this}getDivisions(t){return t}getMinMax(t=b.MAX,e=b.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return[]}getData(){return ls(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Bn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,h=i*i,c=i*h;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*h+s*i+e}function ds(i,t){const e=1-i;return e*e*t}function gs(i,t){return 2*(1-i)*i*t}function ms(i,t){return i*i*t}function Nn(i,t,e,n){return ds(i,t)+gs(i,e)+ms(i,n)}function vs(i,t){const e=1-i;return e*e*e*t}function ws(i,t){const e=1-i;return 3*e*e*i*t}function bs(i,t){return 3*(1-i)*i*i*t}function xs(i,t){return i*i*i*t}function Gn(i,t,e,n,r){return vs(i,t)+ws(i,e)+bs(i,n)+xs(i,r)}class _s extends Et{constructor(t=new b,e=new b,n=new b,r=new b){super(),this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new b){const{v0:n,v1:r,v2:s,v3:o}=this;return e.set(Gn(t,n.x,r.x,s.x,o.x),Gn(t,n.y,r.y,s.y,o.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this.v3.applyMatrix3(t),this}getMinMax(t=b.MAX,e=b.MIN){const{v0:n,v1:r,v2:s,v3:o}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,o.x),t.y=Math.min(t.y,n.y,r.y,s.y,o.y),e.x=Math.max(e.x,n.x,r.x,s.x,o.x),e.y=Math.max(e.y,n.y,r.y,s.y,o.y),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n,v3:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{v1:e,v2:n,v3:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}}const Ms=new ct,Rn=new ct,Vn=new ct,ge=new b;class Ss extends Et{constructor(t=0,e=0,n=1,r=1,s=0,o=Math.PI*2,h=!1,c=0){super(),this.x=t,this.y=e,this.radiusX=n,this.radiusY=r,this.startAngle=s,this.endAngle=o,this.clockwise=h,this.rotation=c}getPoint(t,e=new b){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let h=this.x+this.radiusX*Math.cos(o),c=this.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const a=Math.cos(this.rotation),l=Math.sin(this.rotation),u=h-this.x,y=c-this.y;h=u*a-y*l+this.x,c=u*l+y*a+this.y}return e.set(h,c)}getDivisions(t=12){return t*2}getCommands(){const{x:t,y:e,radiusX:n,radiusY:r,startAngle:s,endAngle:o,clockwise:h,rotation:c}=this,a=t+n*Math.cos(s)*Math.cos(c)-r*Math.sin(s)*Math.sin(c),l=e+n*Math.cos(s)*Math.sin(c)+r*Math.sin(s)*Math.cos(c),u=Math.abs(s-o),y=u>Math.PI?1:0,d=h?1:0,g=c*180/Math.PI;if(u>=2*Math.PI){const m=s+Math.PI,v=t+n*Math.cos(m)*Math.cos(c)-r*Math.sin(m)*Math.sin(c),_=e+n*Math.cos(m)*Math.sin(c)+r*Math.sin(m)*Math.cos(c);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:g,largeArcFlag:0,sweepFlag:d,x:v,y:_},{type:"A",rx:n,ry:r,angle:g,largeArcFlag:0,sweepFlag:d,x:a,y:l}]}else{const m=t+n*Math.cos(o)*Math.cos(c)-r*Math.sin(o)*Math.sin(c),v=e+n*Math.cos(o)*Math.sin(c)+r*Math.sin(o)*Math.cos(c);return[{type:"M",x:a,y:l},{type:"A",rx:n,ry:r,angle:g,largeArcFlag:y,sweepFlag:d,x:m,y:v}]}}drawTo(t){const{x:e,y:n,radiusX:r,radiusY:s,rotation:o,startAngle:h,endAngle:c,clockwise:a}=this;return t.ellipse(e,n,r,s,o,h,c,!a),this}transform(t){return ge.set(this.x,this.y),ge.applyMatrix3(t),this.x=ge.x,this.y=ge.y,Ts(t)?Ps(this,t):Cs(this,t),this}getMinMax(t=b.MAX,e=b.MIN){const{x:n,y:r,radiusX:s,radiusY:o,rotation:h}=this,c=Math.cos(h),a=Math.sin(h),l=Math.sqrt(s*s*c*c+o*o*a*a),u=Math.sqrt(s*s*a*a+o*o*c*c);return t.x=Math.min(t.x,n-l),t.y=Math.min(t.y,r-u),e.x=Math.max(e.x,n+l),e.y=Math.max(e.y,r+u),{min:t,max:e}}copy(t){return super.copy(t),this.x=t.x,this.y=t.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 Ps(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new b(e*r,e*s),h=new b(-n*s,n*r),c=o.applyMatrix3(t),a=h.applyMatrix3(t),l=Ms.set(c.x,a.x,0,c.y,a.y,0,0,0,1),u=Rn.copy(l).invert(),g=Vn.copy(u).transpose().multiply(u).elements,m=Os(g[0],g[1],g[4]),v=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(i.radiusX=1/v,i.radiusY=1/_,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const w=Rn.set(v,0,0,0,_,0,0,0,1),C=Vn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=w.multiply(C).multiply(l),O=A=>{const{x:M,y:S}=new b(Math.cos(A),Math.sin(A)).applyMatrix3(T);return Math.atan2(S,M)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),Hn(t)&&(i.clockwise=!i.clockwise)}}function Cs(i,t){const e=zn(t),n=kn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,Hn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Hn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ts(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=zn(i),r=kn(i);return Math.abs(e/(n*r))>Number.EPSILON}function zn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function kn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Os(i,t,e){let n,r,s,o,h;const c=i+e,a=i-e,l=Math.sqrt(a*a+4*t*t);return c>0?(n=.5*(c+l),h=1/n,r=i*h*e-t*h*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),a>0?s=a+l:s=a-l,Math.abs(s)>2*Math.abs(t)?(h=-2*t/s,o=1/Math.sqrt(1+h*h),s=h*o):Math.abs(t)===0?(s=1,o=0):(h=-.5*s/t,s=1/Math.sqrt(1+h*h),o=h*s),a>0&&(h=s,s=-o,o=h),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Et{constructor(t=new b,e=new b){super(),this.v1=t,this.v2=e}getPoint(t,e=new b){return t===1?e.copy(this.v2):(e.copy(this.v2).sub(this.v1),e.multiplyScalar(t).add(this.v1)),e}getPointAt(t,e=new b){return this.getPoint(t,e)}getTangent(t,e=new b){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e=new b){return this.getTangent(t,e)}transform(t){return this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getDivisions(){return 1}getMinMax(t=b.MAX,e=b.MIN){const{v1:n,v2:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.y),{min:t,max:e}}getCommands(){const{v1:t,v2:e}=this;return[{type:"M",x:t.x,y:t.y},{type:"L",x:e.x,y:e.y}]}drawTo(t){const{v2:e}=this;return t.lineTo(e.x,e.y),this}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}class As extends Et{constructor(t=new b,e=new b,n=new b){super(),this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new b){const{v0:n,v1:r,v2:s}=this;return e.set(Nn(t,n.x,r.x,s.x),Nn(t,n.y,r.y,s.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getMinMax(t=b.MAX,e=b.MIN){const{v0:n,v1:r,v2:s}=this,o=.5*(n.x+r.x),h=.5*(n.y+r.y),c=.5*(n.x+s.x),a=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,h,a),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,h,a),{min:t,max:e}}getCommands(){const{v0:t,v1:e,v2:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{v1:e,v2:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.y),this}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}}var $s=Object.defineProperty,Is=(i,t,e)=>t in i?$s(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wn=(i,t,e)=>(Is(i,typeof t!="symbol"?t+"":t,e),e);class Ds extends Et{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,Wn(this,"curves",[]),Wn(this,"pointT",0);const{x:o,y:h}=this.center,c=this.rx,a=this.rx/this.aspectRatio,l=[new b(o-c,h-a),new b(o+c,h-a),new b(o+c,h+a),new b(o-c,h+a)];for(let u=0;u<4;u++)this.curves.push(new qe(l[u].clone(),l[(u+1)%4].clone()))}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}getPoint(t){return this.getCurrentLine(t).getPoint(this.pointT)}getPointAt(t){return this.getPoint(t)}getCurrentLine(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.pointT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.pointT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.pointT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.pointT=(e-2*this.aspectRatio-1)/1),this.curves[n]}getTangent(t){return this.getCurrentLine(t).getTangent(0).normalize()}getNormal(t){const{v1:e,v2:n}=this.getCurrentLine(t);return new b(n.y-e.y,-(n.x-e.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.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 Ls extends Et{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new b){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,h=n[s===0?s:s-1],c=n[s],a=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Bn(o,h.x,c.x,a.x,l.x),Bn(o,h.y,c.y,a.y,l.y)),e}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Us=Object.defineProperty,Es=(i,t,e)=>t in i?Us(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,me=(i,t,e)=>(Es(i,typeof t!="symbol"?t+"":t,e),e);class ve extends Et{constructor(t){super(),me(this,"curves",[]),me(this,"currentPoint",new b),me(this,"autoClose",!1),me(this,"_cacheLengths",[]),t&&this.setFromPoints(t)}addCurve(t){return this.curves.push(t),this}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new qe(e,t)),this}getPoint(t,e=new b){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,h=this.curves[s],c=h.getLength();return h.getPointAt(c===0?0:1-o/c,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],h=o.getPoints(o.getDivisions(t));for(let c=0;c<h.length;c++){const a=h[c];n&&n.equals(a)||(e.push(a),n=a)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}bezierCurveTo(t,e,n,r,s,o){return this.curves.push(new _s(this.currentPoint.clone(),new b(t,e),new b(n,r),new b(s,o))),this.currentPoint.set(s,o),this}lineTo(t,e){return this.curves.push(new qe(this.currentPoint.clone(),new b(t,e))),this.currentPoint.set(t,e),this}moveTo(t,e){return this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){return this.curves.push(new As(this.currentPoint.clone(),new b(t,e),new b(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Ds(new b(t+n/2,e+r/2),n/2,n/r)),this.currentPoint.set(t,e),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t);return this.curves.push(new Ls(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,o=!1){const h=this.currentPoint;return this.absarc(t+h.x,e+h.y,n,r,s,o),this}absarc(t,e,n,r,s,o=!1){return this.absellipse(t,e,n,n,r,s,o),this}ellipse(t,e,n,r,s,o,h=!1,c=0){const a=this.currentPoint;return this.absellipse(t+a.x,e+a.y,n,r,s,o,h,c),this}absellipse(t,e,n,r,s,o,h=!1,c=0){const a=new Ss(t,e,n,r,s,o,h,c);if(this.curves.length>0){const l=a.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(a),this.currentPoint.copy(a.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=b.MAX,e=b.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}var Fs=Object.defineProperty,Bs=(i,t,e)=>t in i?Fs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Bs(i,typeof t!="symbol"?t+"":t,e),e);class pt{constructor(t){je(this,"currentPath",new ve),je(this,"paths",[this.currentPath]),je(this,"userData"),t&&(t instanceof pt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof pt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){return this.currentPath.closePath(),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return(n.x!==t||n.y!==e)&&(r.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,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.absarc(t,e,n,r,s,!o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,h,c){return this.currentPath.absellipse(t,e,n,r,o,h,!c,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return hs(t,this),this}addData(t){return this.addCommands(fs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=b.MAX,e=b.MIN){return this.forEachCurve(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new L(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.paths.flatMap(t=>t.curves.flatMap(e=>e.getCommands()))}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgString(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=1;return`<svg viewBox="${t-s} ${e-s} ${n+s*2} ${r+s*2}" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="currentColor" d="${this.getData()}"></path></svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgString())}`}drawTo(t){this.paths.forEach(e=>{e.drawTo(t)})}strokeTo(t){this.drawTo(t),t.stroke()}fillTo(t){this.drawTo(t),t.fill()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.userData=t.userData,this}toCanvas(t=!0){const e=document.createElement("canvas"),{left:n,top:r,width:s,height:o}=this.getBoundingBox();e.width=s,e.height=o;const h=e.getContext("2d");return h&&(h.translate(-n,-r),t?this.fillTo(h):this.strokeTo(h)),e}clone(){return new this.constructor().copy(this)}}const Ye="px",Xn=90,qn=["mm","cm","in","pt","pc","px"],Ke={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(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=qn.length;n<r;n++){const s=qn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/Xn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*Xn)),e*Number.parseFloat(i)}const Ns=new ct,we=new ct,jn=new ct,Yn=new ct;function Gs(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Rs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Rs(i){const t=new ct,e=Ns;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(D(i.getAttribute("x")),D(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),h=s.length;if(o>0&&o<h){const c=s.slice(0,o),a=vt(s.slice(o+1));switch(e.identity(),c){case"translate":if(a.length>=1){const l=a[0];let u=0;a.length>=2&&(u=a[1]),e.translate(l,u)}break;case"rotate":if(a.length>=1){let l=0,u=0,y=0;l=a[0]*Math.PI/180,a.length>=3&&(u=a[1],y=a[2]),we.makeTranslation(-u,-y),jn.makeRotation(l),Yn.multiplyMatrices(jn,we),we.makeTranslation(u,y),e.multiplyMatrices(we,Yn)}break;case"scale":a.length>=1&&e.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&e.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&e.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&e.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}t.premultiply(e)}}return t}function Vs(i){return new pt().addPath(new ve().absarc(D(i.getAttribute("cx")||0),D(i.getAttribute("cy")||0),D(i.getAttribute("r")||0),0,Math.PI*2))}function Hs(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,h])=>h!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function zs(i){return new pt().addPath(new ve().absellipse(D(i.getAttribute("cx")||0),D(i.getAttribute("cy")||0),D(i.getAttribute("rx")||0),D(i.getAttribute("ry")||0),0,Math.PI*2))}function ks(i){return new pt().moveTo(D(i.getAttribute("x1")||0),D(i.getAttribute("y1")||0)).lineTo(D(i.getAttribute("x2")||0),D(i.getAttribute("y2")||0))}function Ws(i){const t=new pt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Xs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function qs(i){var n;const t=new pt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Xs,(r,s,o)=>{const h=D(s),c=D(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!0,t}const js=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ys(i){var n;const t=new pt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(js,(r,s,o)=>{const h=D(s),c=D(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!1,t}function Ks(i){const t=D(i.getAttribute("x")||0),e=D(i.getAttribute("y")||0),n=D(i.getAttribute("rx")||i.getAttribute("ry")||0),r=D(i.getAttribute("ry")||i.getAttribute("rx")||0),s=D(i.getAttribute("width")),o=D(i.getAttribute("height")),h=1-.551915024494,c=new pt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*h,e,t+s,e+r*h,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*h,t+s-n*h,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*h,e+o,t,e+o-r*h,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*h,t+n*h,e,t+n,e),c}function wt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,e[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(h,c,a){a===void 0&&(a=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(h)&&(t[c]=a(i.getAttribute(h))),n[h]&&(t[c]=a(n[h])),i.style&&i.style[h]!==""&&(t[c]=a(i.style[h]))}function s(h){return Math.max(0,Math.min(1,D(h)))}function o(h){return Math.max(0,D(h))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-dashoffset","strokeDashoffset"),r("stroke-dasharray","strokeDasharray"),r("stroke-linecap","strokeLineCap"),r("stroke-linejoin","strokeLineJoin"),r("stroke-miterlimit","strokeMiterLimit",o),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",o),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=wt(i,t,s);break;case"style":Hs(i,s);break;case"g":t=wt(i,t,s);break;case"path":t=wt(i,t,s),i.hasAttribute("d")&&(r=Ws(i));break;case"rect":t=wt(i,t,s),r=Ks(i);break;case"polygon":t=wt(i,t,s),r=qs(i);break;case"polyline":t=wt(i,t,s),r=Ys(i);break;case"circle":t=wt(i,t,s),r=Vs(i);break;case"ellipse":t=wt(i,t,s),r=zs(i);break;case"line":t=wt(i,t,s),r=ks(i);break;case"defs":n=!0;break;case"use":{t=wt(i,t,s);const y=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(l=i.viewportElement)==null?void 0:l.getElementById(y);d?Qe(d,t,e):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}const o=new ct,h=[],c=Gs(i,o,h);r&&(r.transform(o),e.push(r),r.userData={node:i,style:t});const a=i.childNodes;for(let u=0,y=a.length;u<y;u++){const d=a[u];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Qe(d,t,e)}return c&&(h.pop(),h.length>0?o.copy(h[h.length-1]):o.identity()),e}const Kn="data:image/svg+xml;",Qn=`${Kn}base64,`,Zn=`${Kn}charset=utf8,`;function Jn(i){if(typeof i=="string"){let t;return i.startsWith(Qn)?(i=i.substring(Qn.length,i.length),t=atob(i)):i.startsWith(Zn)?(i=i.substring(Zn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Qs(i){return Qe(Jn(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}function be(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function tr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function er(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function nr(i,t,e=0,n=0,r=0,s=1,o=1){let h=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:a,y:l}=t;return(s!==1||o!==1)&&(h=h.map(u=>er(u,t,s,o))),(n||r)&&(h=h.map(u=>Ze(u,t,n,r))),h=h.map(u=>{const y=u.x-a,d=-(u.y-l);return u=tr({x:y,y:d},c),{x:a+u.x,y:l-u.y}}),h[0]}const Zs=new Set(["©","®","÷"]),Js=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class rr{constructor(t,e,n){$(this,"boundingBox",new L);$(this,"textWidth",0);$(this,"textHeight",0);$(this,"commands",[]);this.content=t,this.index=e,this.parent=n}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 Mt||t instanceof _t)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:n,descender:r,os2:s,post:o}=t,{content:h,computedStyle:c,boundingBox:a,isVertical:l}=this,{left:u,top:y,height:d}=a,{fontSize:g}=c,m=e/g,v=t.getAdvanceWidth(h,g),_=(n+Math.abs(r))/m,x=n/m,w=(n-s.yStrikeoutPosition)/m,C=s.yStrikeoutSize/m,T=(n-o.underlinePosition)/m,O=o.underlineThickness/m;return this.glyphWidth=v,this.glyphHeight=_,this.underlinePosition=T,this.underlineThickness=O,this.yStrikeoutPosition=w,this.yStrikeoutSize=C,this.baseline=x,this.centerDiviation=.5*d-x,this.glyphBox=l?new L(u,y,_,v):new L(u,y,v,_),this.centerPoint=this.glyphBox.getCenterPoint(),this}updateCommands(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:h,baseline:c,glyphHeight:a,glyphWidth:l}=this.updateGlyph(t),{os2:u,ascender:y,descender:d}=t,g=y,m=d,v=u.sTypoAscender,{left:_,top:x}=o,{fontSize:w,fontStyle:C}=h;let T=_,O=x+c,A,M;if(e&&(T+=(a-l)/2,Math.abs(r-s)>.1&&(O-=(g-v)/(g+Math.abs(m))*a),A=void 0),e&&!Zs.has(n)&&(n.codePointAt(0)<=256||Js.has(n))){M=t.getPathCommands(n,T,x+c-(a-l)/2,w)??[];const S={y:x-(a-l)/2+a/2,x:T+l/2};C==="italic"&&(M=this._italic(M,e?{x:S.x,y:x-(a-l)/2+c}:void 0)),M=this._rotation90(M,S)}else A!==void 0?(M=t.glyf.glyphs.get(A).getPathCommands(T,O,w),C==="italic"&&(M=this._italic(M,e?{x:T+l/2,y:x+v/(g+Math.abs(m))*a}:void 0))):(M=t.getPathCommands(n,T,O,w)??[],C==="italic"&&(M=this._italic(M,e?{x:T+a/2,y:O}:void 0)));return M.push(...this._decoration()),this.commands=M,this}update(){return this.updateCommands(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:h,width:c,height:a}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=h+e;break;case"line-through":t?u=o+c/2:u=h+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:h},{type:"L",x:u,y:h+a},{type:"L",x:u+l,y:h+a},{type:"L",x:u+l,y:h},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,h=e||{y:o+n,x:s+r/2};return this._transform(t,(c,a)=>{const l=Ze({x:c,y:a},h,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=nr({x:n,y:r},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}forEachCommand(t){const e=this.commands,n={x:0,y:0},r={x:0,y:0};let s=!0,o=!1;for(let h=0,c=e.length;h<c;h++){s&&(o=!0,s=!1);let a=e[h];switch(a=t(a,h,{last:n,first:r})??a,a.type){case"M":case"L":case"Q":n.x=a.x,n.y=a.y,o&&(r.x=n.x,r.y=n.y);break;case"Z":n.x=r.x,n.y=r.y,s=!0;break}}return this}getMinMax(t=b.MAX,e=b.MIN){let n={x:0,y:0};return this.commands.forEach(r=>{switch(r.type){case"L":case"M":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),n={x:r.x,y:r.y};break;case"Q":{const s=.5*(n.x+r.x1),o=.5*(n.y+r.y1),h=.5*(n.x+r.x),c=.5*(n.y+r.y);t.x=Math.min(t.x,n.x,r.x,s,h),t.y=Math.min(t.y,n.y,r.y,o,c),e.x=Math.max(e.x,n.x,r.x,s,h),e.y=Math.max(e.y,n.y,r.y,o,c),n={x:r.x,y:r.y};break}}}),{min:t,max:e}}drawTo(t,e={}){Se({ctx:t,paths:[new pt(this.commands)],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class ir{constructor(t,e={},n){$(this,"boundingBox",new L);$(this,"highlight");this.content=t,this.style=e,this.parent=n,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 n of this.computedContent)t.push(new rr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){$(this,"boundingBox",new L);$(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 n=new ir(t,e,this);return this.fragments.push(n),n}}class Ft{constructor(t){this._text=t}}class sr extends Ft{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class or extends Ft{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const h=(o.offsetX??0)*s,c=(o.offsetY??0)*s,a=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,y=r.boundingBox.clone();y.left+=h+a-u,y.top+=c+l-u,y.width+=u*2,y.height+=u*2,n.push(y)})}),L.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{yt(o,s,e)}),r.forEach(o=>{n.forEach(h=>{o.drawTo(e,h)})})),this}}class ar extends Ft{constructor(){super(...arguments);$(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new L;const e=b.MAX,n=b.MIN;return this.paths.forEach(r=>r.getMinMax(e,n)),new L(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e,computedStyle:n}=this._text,r=n.fontSize;let s;const o=[];let h;e.forEach(c=>{const a=c.parent.highlight;a!=null&&a.url&&((h==null?void 0:h.url)===a.url?s.push(c):(s=[],s.push(c),o.push(s))),h=a}),this.paths=o.filter(c=>c.length).map(c=>({url:c[0].parent.highlight.url,box:L.from(...c.map(a=>a.boundingBox)),baseline:Math.max(...c.map(a=>a.baseline))})).map(c=>this._parseGroup(c,r)).flat()}_parseSvg(e){const n=Jn(e),r=Qs(n),s=b.MAX,o=b.MIN;r.forEach(y=>y.getMinMax(s,o));const{x:h,y:c,width:a,height:l}=new L(s.x,s.y,o.x-s.x,o.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new L(h,c,a,l),viewBox:new L(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:o}=e,{box:h,viewBox:c,paths:a}=this._parseSvg(r),l=[],u=h.height/c.height>.3?0:1;if(u===0){const y={x:s.left-n*.2,y:s.top},d=(s.width+n*.2*2)/h.width,g=s.height/h.height,m=new ct().translate(-h.x,-h.y).scale(d,g).translate(y.x,y.y);a.forEach(v=>{l.push(v.clone().transform(m))})}else if(u===1){const y=n/h.width*2,d=h.width*y,g=Math.ceil(s.width/d),m=d*g,v={x:s.left+(s.width-m)/2+n*.1,y:s.top+o+n*.1},_=new ct().translate(-h.x,-h.y).scale(y,y).translate(v.x,v.y);for(let x=0;x<g;x++){const w=_.clone().translate(x*d,0);a.forEach(C=>{l.push(C.clone().transform(w))})}}return l}draw({ctx:e}){return Se({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize,fill:!1}),this}}class hr extends Ft{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const h=document.createElement("li");Object.assign(h.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const a=document.createElement("span");Object.assign(a.style,this._styleToDomStyle(c.style)),a.appendChild(document.createTextNode(c.content)),h.appendChild(a)}),s.appendChild(h)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const h=s.getBoundingClientRect();e.push({paragraphIndex:o,left:h.left,top:h.top,width:h.width,height:h.height}),s.querySelectorAll("span").forEach((c,a)=>{var y;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:a,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.firstChild;if(u instanceof window.Text){const d=document.createRange();d.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){d.setStart(u,Math.max(m-1,0)),d.setEnd(u,m);const v=((y=d.getClientRects)==null?void 0:y.call(d))??[d.getBoundingClientRect()];let _=v[v.length-1];v.length>1&&_.width<2&&(_=v[v.length-2]);const x=d.toString();x!==""&&_&&_.width+_.height!==0&&r.push({content:x,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:a,characterIndex:m-1,top:_.top,left:_.left,height:_.height,width:_.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const h=[[]];let c=h[0];const{characters:a}=this._measureDom(t);a.length>0&&(c.push(a[0]),a.reduce((d,g)=>{const m=s?"left":"top";return Math.abs(g[m]-d[m])>4e3/2&&(c=[],h.push(c)),c.push(g),g})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(d=>{const g=e[d.paragraphIndex];g.boundingBox.left=d.left,g.boundingBox.top=d.top,g.boundingBox.width=d.width,g.boundingBox.height=d.height}),l.fragments.forEach(d=>{const g=e[d.paragraphIndex].fragments[d.fragmentIndex];g.boundingBox.left=d.left,g.boundingBox.top=d.top,g.boundingBox.width=d.width,g.boundingBox.height=d.height});const u=[];let y=0;return h.forEach(d=>{d.forEach(g=>{const m=l.characters[y],{paragraphIndex:v,fragmentIndex:_,characterIndex:x}=m;u.push({...m,newParagraphIndex:v,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const w=e[v].fragments[_].characters[x];w.boundingBox.left=u[y].left,w.boundingBox.top=u[y].top,w.boundingBox.width=u[y].width,w.boundingBox.height=u[y].height,w.textWidth=u[y].textWidth,w.textHeight=u[y].textHeight,y++})}),{paragraphs:e,boundingBox:new L(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class cr extends Ft{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:h,highlight:c,...a}=o;if(h!==void 0){const l=s.addFragment(h,a);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,h=new Vt(o,e);s.forEach(c=>{const{content:a,highlight:l,...u}=c;if(a!==void 0){const y=h.addFragment(a,u);y.highlight=l}}),n.push(h)}else if("content"in r){const{content:s,highlight:o,...h}=r;if(s!==void 0){const c=new Vt(h,e),a=c.addFragment(s);a.highlight=o,n.push(c)}}}return n}}class to extends Ft{}class lr extends Ft{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:h,height:c}=r,a=e.canvas;return a.dataset.viewbox=`${s} ${o} ${h} ${c}`,a.dataset.pixelRatio=String(n),a.width=Math.max(1,Math.ceil(h*n)),a.height=Math.max(1,Math.ceil(c*n)),a.style.marginTop=`${o}px`,a.style.marginLeft=`${s}px`,a.style.width=`${h}px`,a.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:h}=s;return yt(r,new L(0,0,o,h),e),n.forEach(c=>{yt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(a=>{yt(a.computedStyle,a.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,h,c,a,l){e.fillStyle=o,e.fillRect(h,c,a,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var h;(h=o.style)!=null&&h.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var a;(a=c.style)!=null&&a.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={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 eo{constructor(t={}){$(this,"content");$(this,"style");$(this,"effects");$(this,"deformation");$(this,"measureDom");$(this,"needsUpdate",!0);$(this,"computedStyle",{...Je});$(this,"paragraphs",[]);$(this,"boundingBox",new L);$(this,"renderBoundingBox",new L);$(this,"_parser",new cr(this));$(this,"_measurer",new hr(this));$(this,"_deformer",new sr(this));$(this,"_effector",new or(this));$(this,"_highlighter",new ar(this));$(this,"_renderer2D",new lr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this._parser.parse();const n=this._measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const n=this.characters;n.forEach(o=>o.update()),this.deformation&&this._deformer.deform(),this._highlighter.highlight();const r=b.MAX,s=b.MIN;return n.forEach(o=>o.getMinMax(r,s)),this.renderBoundingBox=new L(r.x,r.y,s.x-r.x,s.y-r.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=L.from(this.boundingBox,this.renderBoundingBox,this._effector.getBoundingBox(),this._highlighter.getBoundingBox()):this.renderBoundingBox=L.from(this.boundingBox,this.renderBoundingBox,this._highlighter.getBoundingBox()),this._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this._effector.draw({ctx:r}):this._renderer2D.draw({ctx:r}),this):this}}f.Character=rr,f.CmapSubtableFormat0=Ue,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Be,f.CmapSubtableFormat6=It,f.Deformer=sr,f.Effector=or,f.Eot=jr,f.Font=fe,f.Fonts=Dn,f.Fragment=ir,f.Glyph=xn,f.GlyphSet=_n,f.Highlighter=ar,f.Measurer=hr,f.Paragraph=Vt,f.Parser=cr,f.Reflector=to,f.Renderer2D=lr,f.Sfnt=te,f.TableDirectory=Bt,f.Text=eo,f.Ttf=_t,f.Woff=Mt,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Fe,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPaths=Se,f.filterEmpty=be,f.fonts=Ln,f.getPointPosition=nr,f.getRotationPoint=tr,f.getScalePoint=er,f.getSkewPoint=Ze,f.minify=rs,f.minifyGlyphs=Un,f.minifySfnt=En,f.parseColor=z,f.uploadColor=yt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
4
+ }`)),document.head.appendChild(n),this}parse(t){if(_t.is(t))return new _t(t);if(Mt.is(t))return new Mt(t)}get(t){let e;if(t){const n=this._namesUrls.get(t)??t;e=this._loaded.get(n)}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:n,injectFontFace:r=!0,injectStyleTag:s=!0,...o}=e,{family:h,url:c}=t;if(this._loaded.has(c))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(c);let a=this._loading.get(c);return a||(a=this._createRequest(c,o),this._loading.set(c,a)),n&&this._loading.forEach((l,u)=>{l!==a&&(l.cancel(),this._loading.delete(u))}),a.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(c)||(this._loaded.set(c,u),new Set(Array.isArray(h)?h:[h]).forEach(p=>{this._namesUrls.set(p,c),typeof document<"u"&&(r&&this.injectFontFace(p,l),s&&this.injectStyleTag(p,c))})),u}).catch(l=>{if(l instanceof DOMException&&l.message==="The user aborted a request.")return{...t,font:new ArrayBuffer(0)};throw l}).finally(()=>{this._loading.delete(c)})}};re(In,"defaultRequestInit",{cache:"force-cache"});let Dn=In;const Ln=new Dn;function En(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:o}=i,h=e.unicodeGlyphIndexMap,c=n.locations,a=r.metrics,l=s==null?void 0:s.metrics,u=Array.from(new Set(t.split("").map(m=>m.codePointAt(0)).filter(m=>m!==void 0&&h.has(m)))).sort((m,w)=>m-w),p=new Map;u.forEach(m=>{const w=h.get(m)??0;let _=p.get(w);_||p.set(w,_=new Set),_.add(m)});const d=[],g=m=>{const w=a[m],_=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},b=c[m],x=c[m+1]??b,C={...w,..._,rawGlyphIndex:m,glyphIndex:d.length,unicodes:Array.from(p.get(m)??[]),view:new DataView(o.view.buffer,o.view.byteOffset+b,x-b)};return d.push(C),C};return g(0),u.forEach(m=>g(h.get(m))),d.slice().forEach(m=>{const{view:w}=m;if(!w.byteLength||w.getInt16(0)>=0)return;let b=10,x;do{x=w.getUint16(b);const C=b+2,T=w.getUint16(C);b+=4,Gt.ARG_1_AND_2_ARE_WORDS&x?b+=4:b+=2,Gt.WE_HAVE_A_SCALE&x?b+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&x?b+=4:Gt.WE_HAVE_A_TWO_BY_TWO&x&&(b+=8);const O=g(T);w.setUint16(C,O.glyphIndex)}while(Gt.MORE_COMPONENTS&x)}),d}function Un(i,t){const e=En(i,t),n=e.length,{head:r,maxp:s,hhea:o,vhea:h}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let c=0;i.loca=f.Loca.from([...e.map(p=>{const d=c;return c+=p.view.byteLength,d}),c],r.indexToLocFormat);const a=e.reduce((p,d,g)=>(d.unicodes.forEach(m=>p.set(m,g)),p),new Map);i.cmap=f.Cmap.from(a),i.glyf=f.Glyf.from(e.map(p=>p.view)),o.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(p=>({advanceWidth:p.advanceWidth,leftSideBearing:p.leftSideBearing}))),h&&(h.numOfLongVerMetrics=n),i.vmtx&&(i.vmtx=f.Vmtx.from(e.map(p=>({advanceHeight:p.advanceHeight,topSideBearing:p.topSideBearing}))));const u=new f.Post;return u.format=3,u.italicAngle=0,u.underlinePosition=0,u.underlineThickness=0,u.isFixedPitch=0,u.minMemType42=0,u.minMemType42=0,u.minMemType1=0,u.maxMemType1=n,i.post=u,i.delete("GPOS"),i.delete("GSUB"),i.delete("hdmx"),i}function rs(i,t){let e,n;if(i instanceof _t)e=i.sfnt.clone(),n="ttf";else if(i instanceof Mt)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(_t.is(s))e=new _t(s).sfnt,n="ttf-buffer";else if(Mt.is(s))e=new Mt(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Un(e,t);switch(n){case"ttf":return _t.from(r);case"woff":return Mt.from(r);case"ttf-buffer":return _t.from(r).view.buffer;case"woff-buffer":default:return Mt.from(r).view.buffer}}class v{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new v(1/0,1/0)}static get MIN(){return new v(-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,n=this.y-t.y;return e*e+n*n}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,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return this.x===t.x&&this.y===t.y}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}copy(t){return this.x=t.x,this.y=t.y,this}clone(){return new v(this.x,this.y)}}class D{constructor(t=0,e=0,n=0,r=0){this.left=t,this.top=e,this.width=n,this.height=r}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],n=t.slice(1).reduce((r,s)=>(r.left=Math.min(r.left,s.left),r.top=Math.min(r.top,s.top),r.right=Math.max(r.right,s.right),r.bottom=Math.max(r.bottom,s.bottom),r),{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 D(n.left,n.top,n.right-n.left,n.bottom-n.top)}translate(t,e){return this.left+=t,this.top+=e,this}getCenterPoint(){return new v((this.left+this.right)/2,(this.top+this.bottom)/2)}clone(){return new D(this.left,this.top,this.width,this.height)}toArray(){return[this.left,this.top,this.width,this.height]}}var is=Object.defineProperty,ss=(i,t,e)=>t in i?is(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,os=(i,t,e)=>(ss(i,t+"",e),e);class ct{constructor(t=1,e=0,n=0,r=0,s=1,o=0,h=0,c=0,a=1){os(this,"elements",[]),this.set(t,e,n,r,s,o,h,c,a)}set(t,e,n,r,s,o,h,c,a){const l=this.elements;return l[0]=t,l[1]=r,l[2]=h,l[3]=e,l[4]=s,l[5]=c,l[6]=n,l[7]=o,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,s=this.elements,o=n[0],h=n[3],c=n[6],a=n[1],l=n[4],u=n[7],p=n[2],d=n[5],g=n[8],m=r[0],w=r[3],_=r[6],b=r[1],x=r[4],C=r[7],T=r[2],O=r[5],A=r[8];return s[0]=o*m+h*b+c*T,s[3]=o*w+h*x+c*O,s[6]=o*_+h*C+c*A,s[1]=a*m+l*b+u*T,s[4]=a*w+l*x+u*O,s[7]=a*_+l*C+u*A,s[2]=p*m+d*b+g*T,s[5]=p*w+d*x+g*O,s[8]=p*_+d*C+g*A,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],o=t[4],h=t[5],c=t[6],a=t[7],l=t[8],u=l*o-h*a,p=h*c-l*s,d=a*s-o*c,g=e*u+n*p+r*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return t[0]=u*m,t[1]=(r*a-l*n)*m,t[2]=(h*n-r*o)*m,t[3]=p*m,t[4]=(l*e-r*c)*m,t[5]=(r*s-h*e)*m,t[6]=d*m,t[7]=(n*c-a*e)*m,t[8]=(o*e-n*s)*m,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(We.makeScale(t,e)),this}rotate(t){return this.premultiply(We.makeRotation(-t)),this}translate(t,e){return this.premultiply(We.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),n=Math.sin(t);return this.set(e,-n,0,n,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 n=0;n<9;n++)this.elements[n]=t[n+e];return this}clone(){return new this.constructor().fromArray(this.elements)}}const We=new ct;function Fn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let o=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(o=-o),o}function as(i,t,e,n,r,s,o,h){if(t===0||e===0){i.lineTo(h.x,h.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const c=(o.x-h.x)/2,a=(o.y-h.y)/2,l=Math.cos(n)*c+Math.sin(n)*a,u=-Math.sin(n)*c+Math.cos(n)*a;let p=t*t,d=e*e;const g=l*l,m=u*u,w=g/p+m/d;if(w>1){const B=Math.sqrt(w);t=B*t,e=B*e,p=t*t,d=e*e}const _=p*m+d*g,b=(p*d-_)/_;let x=Math.sqrt(Math.max(0,b));r===s&&(x=-x);const C=x*t*u/e,T=-x*e*l/t,O=Math.cos(n)*C-Math.sin(n)*T+(o.x+h.x)/2,A=Math.sin(n)*C+Math.cos(n)*T+(o.y+h.y)/2,M=Fn(1,0,(l-C)/t,(u-T)/e),S=Fn((l-C)/t,(u-T)/e,(-l-C)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(O,A,t,e,M,M+S,s===0,n)}function Rt(i,t){return i-(t-i)}function hs(i,t){const e=new v,n=new v,r=new v;let s=!0,o=!1;for(let h=0,c=i.length;h<c;h++){const a=i[h];if(s&&(o=!0,s=!1),a.type==="m"||a.type==="M")a.type==="m"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(a.type==="h"||a.type==="H")a.type==="h"?e.x+=a.x:e.x=a.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="v"||a.type==="V")a.type==="v"?e.y+=a.y:e.y=a.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="l"||a.type==="L")a.type==="l"?(e.x+=a.x,e.y+=a.y):(e.x=a.x,e.y=a.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),o&&r.copy(e);else if(a.type==="c"||a.type==="C")a.type==="c"?(t.bezierCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(a.x1,a.y1,a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="s"||a.type==="S")a.type==="s"?(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),e.x+a.x2,e.y+a.y2,e.x+a.x,e.y+a.y),n.x=e.x+a.x2,n.y=e.y+a.y2,e.x+=a.x,e.y+=a.y):(t.bezierCurveTo(Rt(e.x,n.x),Rt(e.y,n.y),a.x2,a.y2,a.x,a.y),n.x=a.x2,n.y=a.y2,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="q"||a.type==="Q")a.type==="q"?(t.quadraticCurveTo(e.x+a.x1,e.y+a.y1,e.x+a.x,e.y+a.y),n.x=e.x+a.x1,n.y=e.y+a.y1,e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(a.x1,a.y1,a.x,a.y),n.x=a.x1,n.y=a.y1,e.x=a.x,e.y=a.y),o&&r.copy(e);else if(a.type==="t"||a.type==="T"){const l=Rt(e.x,n.x),u=Rt(e.y,n.y);n.x=l,n.y=u,a.type==="t"?(t.quadraticCurveTo(l,u,e.x+a.x,e.y+a.y),e.x+=a.x,e.y+=a.y):(t.quadraticCurveTo(l,u,a.x,a.y),e.x=a.x,e.y=a.y),o&&r.copy(e)}else if(a.type==="a"||a.type==="A"){if(a.type==="a"){if(a.x===0&&a.y===0)continue;e.x+=a.x,e.y+=a.y}else{if(a.x===e.x&&a.y===e.y)continue;e.x=a.x,e.y=a.y}const l=e.clone();n.x=e.x,n.y=e.y,as(t,a.rx,a.ry,a.angle,a.largeArcFlag,a.sweepFlag,l,e),o&&r.copy(e)}else a.type==="z"||a.type==="Z"?(t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(e.copy(r),t.currentPath.currentPoint.copy(e),s=!0)):console.warn("Unsupported commands",a);o=!1}}const F={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function wt(i,t,e=0){let h=0,c=!0,a="",l="";const u=[];function p(w,_,b){const x=new SyntaxError(`Unexpected character "${w}" at index ${_}.`);throw x.partial=b,x}function d(){a!==""&&(l===""?u.push(Number(a)):u.push(Number(a)*10**Number(l))),a="",l=""}let g;const m=i.length;for(let w=0;w<m;w++){if(g=i[w],Array.isArray(t)&&t.includes(u.length%e)&&F.FLAGS.test(g)){h=1,a=g,d();continue}if(h===0){if(F.WHITESPACE.test(g))continue;if(F.DIGIT.test(g)||F.SIGN.test(g)){h=1,a=g;continue}if(F.POINT.test(g)){h=2,a=g;continue}F.COMMA.test(g)&&(c&&p(g,w,u),c=!0)}if(h===1){if(F.DIGIT.test(g)){a+=g;continue}if(F.POINT.test(g)){a+=g,h=2;continue}if(F.EXP.test(g)){h=3;continue}F.SIGN.test(g)&&a.length===1&&F.SIGN.test(a[0])&&p(g,w,u)}if(h===2){if(F.DIGIT.test(g)){a+=g;continue}if(F.EXP.test(g)){h=3;continue}F.POINT.test(g)&&a[a.length-1]==="."&&p(g,w,u)}if(h===3){if(F.DIGIT.test(g)){l+=g;continue}if(F.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&F.SIGN.test(l)&&p(g,w,u)}}F.WHITESPACE.test(g)?(d(),h=0,c=!1):F.COMMA.test(g)?(d(),h=0,c=!0):F.SIGN.test(g)?(d(),h=1,a=g):F.POINT.test(g)?(d(),h=2,a=g):p(g,w,u)}return d(),u}function cs(i){switch(i.type){case"m":case"M":return`${i.type} ${i.x} ${i.y}`;case"h":case"H":return`${i.type} ${i.x}`;case"v":case"V":return`${i.type} ${i.y}`;case"l":case"L":return`${i.type} ${i.x} ${i.y}`;case"c":case"C":return`${i.type} ${i.x1} ${i.y1} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"s":case"S":return`${i.type} ${i.x2} ${i.y2} ${i.x} ${i.y}`;case"q":case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":case"T":return`${i.type} ${i.x} ${i.y}`;case"a":case"A":return`${i.type} ${i.rx} ${i.ry} ${i.angle} ${i.largeArcFlag} ${i.sweepFlag} ${i.x} ${i.y}`;case"z":case"Z":return i.type;default:return""}}function ls(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${cs(i[e])} `;return t}const us=/[a-df-z][^a-df-z]*/gi;function fs(i){const t=[],e=i.match(us);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],o=s.charAt(0),h=s.slice(1).trim();let c;switch(o){case"m":case"M":c=wt(h);for(let a=0,l=c.length;a<l;a+=2)a===0?t.push({type:o,x:c[a],y:c[a+1]}):t.push({type:o==="m"?"l":"L",x:c[a],y:c[a+1]});break;case"h":case"H":c=wt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,x:c[a]});break;case"v":case"V":c=wt(h);for(let a=0,l=c.length;a<l;a++)t.push({type:o,y:c[a]});break;case"l":case"L":c=wt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"c":case"C":c=wt(h);for(let a=0,l=c.length;a<l;a+=6)t.push({type:o,x1:c[a],y1:c[a+1],x2:c[a+2],y2:c[a+3],x:c[a+4],y:c[a+5]});break;case"s":case"S":c=wt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x2:c[a],y2:c[a+1],x:c[a+2],y:c[a+3]});break;case"q":case"Q":c=wt(h);for(let a=0,l=c.length;a<l;a+=4)t.push({type:o,x1:c[a],y1:c[a+1],x:c[a+2],y:c[a+3]});break;case"t":case"T":c=wt(h);for(let a=0,l=c.length;a<l;a+=2)t.push({type:o,x:c[a],y:c[a+1]});break;case"a":case"A":c=wt(h,[3,4],7);for(let a=0,l=c.length;a<l;a+=7)t.push({type:o,rx:c[a],ry:c[a+1],angle:c[a+2],largeArcFlag:c[a+3],sweepFlag:c[a+4],x:c[a+5],y:c[a+6]});break;case"z":case"Z":t.push({type:o});break;default:console.warn(s)}}return t}var ps=Object.defineProperty,ys=(i,t,e)=>t in i?ps(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e)=>(ys(i,typeof t!="symbol"?t+"":t,e),e);class Ut{constructor(){Xe(this,"arcLengthDivisions",200),Xe(this,"_cacheArcLengths"),Xe(this,"_needsUpdate",!1)}getPointAt(t,e=new v){return this.getPoint(this.getUtoTmapping(t),e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/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 n,r=this.getPoint(0),s=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),s+=n.distanceTo(r),e.push(s),r=n;return this._cacheArcLengths=e,e}updateArcLengths(){this._needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const s=n.length;let o;e?o=e:o=t*n[s-1];let h=0,c=s-1,a;for(;h<=c;)if(r=Math.floor(h+(c-h)/2),a=n[r]-o,a<0)h=r+1;else if(a>0)c=r-1;else{c=r;break}if(r=c,n[r]===o)return r/(s-1);const l=n[r],p=n[r+1]-l,d=(o-l)/p;return(r+d)/(s-1)}getTangent(t,e=new v){const r=Math.max(0,t-1e-4),s=Math.min(1,t+1e-4);return e.copy(this.getPoint(s).sub(this.getPoint(r)).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}getDivisions(t){return t}getMinMax(t=v.MAX,e=v.MIN){return this.getPoints().forEach(n=>{t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x),e.y=Math.max(e.y,n.y)}),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new D(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 ls(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function Bn(i,t,e,n,r){const s=(n-t)*.5,o=(r-e)*.5,h=i*i,c=i*h;return(2*e-2*n+s+o)*c+(-3*e+3*n-2*s-o)*h+s*i+e}function ds(i,t){const e=1-i;return e*e*t}function gs(i,t){return 2*(1-i)*i*t}function ms(i,t){return i*i*t}function Nn(i,t,e,n){return ds(i,t)+gs(i,e)+ms(i,n)}function ws(i,t){const e=1-i;return e*e*e*t}function vs(i,t){const e=1-i;return 3*e*e*i*t}function xs(i,t){return 3*(1-i)*i*i*t}function bs(i,t){return i*i*i*t}function Gn(i,t,e,n,r){return ws(i,t)+vs(i,e)+xs(i,n)+bs(i,r)}class _s extends Ut{constructor(t=new v,e=new v,n=new v,r=new v){super(),this.start=t,this.startControl=e,this.endControl=n,this.end=r}getPoint(t,e=new v){const{start:n,startControl:r,endControl:s,end:o}=this;return e.set(Gn(t,n.x,r.x,s.x,o.x),Gn(t,n.y,r.y,s.y,o.y)),e}transformPoint(t){return t(this.start),t(this.startControl),t(this.endControl),t(this.end),this}getMinMax(t=v.MAX,e=v.MIN){const{start:n,startControl:r,endControl:s,end:o}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,o.x),t.y=Math.min(t.y,n.y,r.y,s.y,o.y),e.x=Math.max(e.x,n.x,r.x,s.x,o.x),e.y=Math.max(e.y,n.y,r.y,s.y,o.y),{min:t,max:e}}getCommands(){const{start:t,startControl:e,endControl:n,end:r}=this;return[{type:"M",x:t.x,y:t.y},{type:"C",x1:e.x,y1:e.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(t){const{startControl:e,endControl:n,end:r}=this;return t.bezierCurveTo(e.x,e.y,n.x,n.y,r.x,r.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 Ms=new ct,Rn=new ct,Vn=new ct,ge=new v;class Ss extends Ut{constructor(t=new v,e=1,n=1,r=0,s=Math.PI*2,o=!1,h=0){super(),this.center=t,this.radiusX=e,this.radiusY=n,this.startAngle=r,this.endAngle=s,this.clockwise=o,this.rotation=h}getPoint(t,e=new v){const n=Math.PI*2;let r=this.endAngle-this.startAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(s?r=0:r=n),this.clockwise&&!s&&(r===n?r=-n:r=r-n);const o=this.startAngle+t*r;let h=this.center.x+this.radiusX*Math.cos(o),c=this.center.y+this.radiusY*Math.sin(o);if(this.rotation!==0){const a=Math.cos(this.rotation),l=Math.sin(this.rotation),u=h-this.center.x,p=c-this.center.y;h=u*a-p*l+this.center.x,c=u*l+p*a+this.center.y}return e.set(h,c)}getDivisions(t=12){return t*2}getCommands(){const{center:t,radiusX:e,radiusY:n,startAngle:r,endAngle:s,clockwise:o,rotation:h}=this,{x:c,y:a}=t,l=c+e*Math.cos(r)*Math.cos(h)-n*Math.sin(r)*Math.sin(h),u=a+e*Math.cos(r)*Math.sin(h)+n*Math.sin(r)*Math.cos(h),p=Math.abs(r-s),d=p>Math.PI?1:0,g=o?1:0,m=h*180/Math.PI;if(p>=2*Math.PI){const w=r+Math.PI,_=c+e*Math.cos(w)*Math.cos(h)-n*Math.sin(w)*Math.sin(h),b=a+e*Math.cos(w)*Math.sin(h)+n*Math.sin(w)*Math.cos(h);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x:_,y:b},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:0,sweepFlag:g,x:l,y:u}]}else{const w=c+e*Math.cos(s)*Math.cos(h)-n*Math.sin(s)*Math.sin(h),_=a+e*Math.cos(s)*Math.sin(h)+n*Math.sin(s)*Math.cos(h);return[{type:"M",x:l,y:u},{type:"A",rx:e,ry:n,angle:m,largeArcFlag:d,sweepFlag:g,x:w,y:_}]}}drawTo(t){const{center:e,radiusX:n,radiusY:r,rotation:s,startAngle:o,endAngle:h,clockwise:c}=this;return t.ellipse(e.x,e.y,n,r,s,o,h,!c),this}transform(t){return ge.set(this.center.x,this.center.y),ge.applyMatrix3(t),this.center.x=ge.x,this.center.y=ge.y,Ts(t)?Ps(this,t):Cs(this,t),this}transformPoint(t){return t(this.center),this}getMinMax(t=v.MAX,e=v.MIN){const{center:n,radiusX:r,radiusY:s,rotation:o}=this,{x:h,y:c}=n,a=Math.cos(o),l=Math.sin(o),u=Math.sqrt(r*r*a*a+s*s*l*l),p=Math.sqrt(r*r*l*l+s*s*a*a);return t.x=Math.min(t.x,h-u),t.y=Math.min(t.y,c-p),e.x=Math.max(e.x,h+u),e.y=Math.max(e.y,c+p),{min:t,max:e}}copy(t){return super.copy(t),this.center.x=t.center.x,this.center.y=t.center.y,this.radiusX=t.radiusX,this.radiusY=t.radiusY,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}}function Ps(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),o=new v(e*r,e*s),h=new v(-n*s,n*r),c=o.applyMatrix3(t),a=h.applyMatrix3(t),l=Ms.set(c.x,a.x,0,c.y,a.y,0,0,0,1),u=Rn.copy(l).invert(),g=Vn.copy(u).transpose().multiply(u).elements,m=Os(g[0],g[1],g[4]),w=Math.sqrt(m.rt1),_=Math.sqrt(m.rt2);if(i.radiusX=1/w,i.radiusY=1/_,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const x=Rn.set(w,0,0,0,_,0,0,0,1),C=Vn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=x.multiply(C).multiply(l),O=A=>{const{x:M,y:S}=new v(Math.cos(A),Math.sin(A)).applyMatrix3(T);return Math.atan2(S,M)};i.startAngle=O(i.startAngle),i.endAngle=O(i.endAngle),Hn(t)&&(i.clockwise=!i.clockwise)}}function Cs(i,t){const e=zn(t),n=kn(t);i.radiusX*=e,i.radiusY*=n;const r=e>Number.EPSILON?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);i.rotation+=r,Hn(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function Hn(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Ts(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=zn(i),r=kn(i);return Math.abs(e/(n*r))>Number.EPSILON}function zn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function kn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Os(i,t,e){let n,r,s,o,h;const c=i+e,a=i-e,l=Math.sqrt(a*a+4*t*t);return c>0?(n=.5*(c+l),h=1/n,r=i*h*e-t*h*t):c<0?r=.5*(c-l):(n=.5*l,r=-.5*l),a>0?s=a+l:s=a-l,Math.abs(s)>2*Math.abs(t)?(h=-2*t/s,o=1/Math.sqrt(1+h*h),s=h*o):Math.abs(t)===0?(s=1,o=0):(h=-.5*s/t,s=1/Math.sqrt(1+h*h),o=h*s),a>0&&(h=s,s=-o,o=h),{rt1:n,rt2:r,cs:s,sn:o}}class qe extends Ut{constructor(t=new v,e=new v){super(),this.start=t,this.end=e}getPoint(t,e=new v){return t===1?e.copy(this.end):e.copy(this.end).sub(this.start).multiplyScalar(t).add(this.start),e}getPointAt(t,e=new v){return this.getPoint(t,e)}getTangent(t,e=new v){return e.subVectors(this.end,this.start).normalize()}getTangentAt(t,e=new v){return this.getTangent(t,e)}getNormal(t,e=new v){const{x:n,y:r}=this.getPoint(t).sub(this.start);return e.set(r,-n).normalize()}transformPoint(t){return t(this.start),t(this.end),this}getDivisions(){return 1}getMinMax(t=v.MAX,e=v.MIN){const{start:n,end:r}=this;return t.x=Math.min(t.x,n.x,r.x),t.y=Math.min(t.y,n.y,r.y),e.x=Math.max(e.x,n.x,r.x),e.y=Math.max(e.y,n.y,r.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 As extends Ut{constructor(t=new v,e=new v,n=new v){super(),this.start=t,this.control=e,this.end=n}getPoint(t,e=new v){const{start:n,control:r,end:s}=this;return e.set(Nn(t,n.x,r.x,s.x),Nn(t,n.y,r.y,s.y)),e}transformPoint(t){return t(this.start),t(this.control),t(this.end),this}getMinMax(t=v.MAX,e=v.MIN){const{start:n,control:r,end:s}=this,o=.5*(n.x+r.x),h=.5*(n.y+r.y),c=.5*(n.x+s.x),a=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,o,c),t.y=Math.min(t.y,n.y,s.y,h,a),e.x=Math.max(e.x,n.x,s.x,o,c),e.y=Math.max(e.y,n.y,s.y,h,a),{min:t,max:e}}getCommands(){const{start:t,control:e,end:n}=this;return[{type:"M",x:t.x,y:t.y},{type:"Q",x1:e.x,y1:e.y,x:n.x,y:n.y}]}drawTo(t){const{control:e,end:n}=this;return t.quadraticCurveTo(e.x,e.y,n.x,n.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 $s=Object.defineProperty,Is=(i,t,e)=>t in i?$s(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wn=(i,t,e)=>(Is(i,typeof t!="symbol"?t+"":t,e),e);class Ds extends Ut{constructor(t,e,n=1,r=0,s=1){super(),this.center=t,this.rx=e,this.aspectRatio=n,this.start=r,this.end=s,Wn(this,"curves",[]),Wn(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,n=this.rx,r=this.rx/this.aspectRatio,s=[new v(t-n,e-r),new v(t+n,e-r),new v(t+n,e+r),new v(t-n,e+r)];for(let o=0;o<4;o++)this.curves.push(new qe(s[o].clone(),s[(o+1)%4].clone()));return this}getCurve(t){let e=(t*(this.end-this.start)+this.start)%1;e<0&&(e+=1),e*=(1+this.aspectRatio)*2;let n;return e<this.aspectRatio?(n=0,this.curveT=e/this.aspectRatio):e<this.aspectRatio+1?(n=1,this.curveT=(e-this.aspectRatio)/1):e<2*this.aspectRatio+1?(n=2,this.curveT=(e-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=(e-2*this.aspectRatio-1)/1),this.curves[n]}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=v.MAX,e=v.MIN){return this.curves.forEach(n=>n.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 Ls extends Ut{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new v){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),o=r-s,h=n[s===0?s:s-1],c=n[s],a=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(Bn(o,h.x,c.x,a.x,l.x),Bn(o,h.y,c.y,a.y,l.y)),e}transformPoint(t){return this.points.forEach(e=>t(e)),this}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++)this.points.push(t.points[e].clone());return this}}var Es=Object.defineProperty,Us=(i,t,e)=>t in i?Es(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,me=(i,t,e)=>(Us(i,typeof t!="symbol"?t+"":t,e),e);class we extends Ut{constructor(t){super(),me(this,"curves",[]),me(this,"currentPoint",new v),me(this,"autoClose",!1),me(this,"_cacheLengths",[]),t&&this.setFromPoints(t)}addCurve(t){return this.curves.push(t),this}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);return t.equals(e)||this.curves.push(new qe(e,t)),this}getPoint(t,e=new v){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,h=this.curves[s],c=h.getLength();return h.getPointAt(c===0?0:1-o/c,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this._cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],h=o.getPoints(o.getDivisions(t));for(let c=0;c<h.length;c++){const a=h[c];n!=null&&n.equals(a)||(e.push(a),n=a)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}bezierCurveTo(t,e,n,r,s,o){return this.curves.push(new _s(this.currentPoint.clone(),new v(t,e),new v(n,r),new v(s,o))),this.currentPoint.set(s,o),this}lineTo(t,e){return this.curves.push(new qe(this.currentPoint.clone(),new v(t,e))),this.currentPoint.set(t,e),this}moveTo(t,e){return this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){return this.curves.push(new As(this.currentPoint.clone(),new v(t,e),new v(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Ds(new v(t+n/2,e+r/2),n/2,n/r)),this.currentPoint.set(t,e),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t);return this.curves.push(new Ls(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,o=!1){const h=this.currentPoint;return this.absarc(t+h.x,e+h.y,n,r,s,o),this}absarc(t,e,n,r,s,o=!1){return this.absellipse(t,e,n,n,r,s,o),this}ellipse(t,e,n,r,s,o,h=!1,c=0){const a=this.currentPoint;return this.absellipse(t+a.x,e+a.y,n,r,s,o,h,c),this}absellipse(t,e,n,r,s,o,h=!1,c=0){const a=new Ss(new v(t,e),n,r,s,o,h,c);if(this.curves.length>0){const l=a.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(a),this.currentPoint.copy(a.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=v.MAX,e=v.MIN){return this.curves.forEach(n=>n.getMinMax(t,e)),{min:t,max:e}}drawTo(t){var n;const e=(n=this.curves[0])==null?void 0:n.getPoint(0);return e&&t.moveTo(e.x,e.y),this.curves.forEach(r=>r.drawTo(t)),this.autoClose&&t.closePath(),this}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++)this.curves.push(t.curves[e].clone());return this.autoClose=t.autoClose,this.currentPoint.copy(t.currentPoint),this}}var Fs=Object.defineProperty,Bs=(i,t,e)=>t in i?Fs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,je=(i,t,e)=>(Bs(i,typeof t!="symbol"?t+"":t,e),e);class lt{constructor(t){je(this,"currentPath",new we),je(this,"paths",[this.currentPath]),je(this,"userData"),t&&(t instanceof lt?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof lt?this.paths.push(...t.paths.map(e=>e.clone())):this.paths.push(t),this}closePath(){return this.currentPath.closePath(),this}moveTo(t,e){const{currentPoint:n,curves:r}=this.currentPath;return(n.x!==t||n.y!==e)&&(r.length?(this.currentPath=new we().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,n,r,s,o){return this.currentPath.bezierCurveTo(t,e,n,r,s,o),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,o){return this.currentPath.absarc(t,e,n,r,s,!o),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,o,h,c){return this.currentPath.absellipse(t,e,n,r,o,h,!c,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return hs(t,this),this}addData(t){return this.addCommands(fs(t)),this}splineThru(t){return this.currentPath.splineThru(t),this}forEachCurve(t){return this.paths.forEach(e=>e.curves.forEach(n=>t(n))),this}transformPoint(t){return this.forEachCurve(e=>e.transformPoint(t)),this}transform(t){return this.forEachCurve(e=>e.transform(t)),this}getMinMax(t=v.MAX,e=v.MIN){return this.forEachCurve(n=>n.getMinMax(t,e)),{min:t,max:e}}getBoundingBox(){const{min:t,max:e}=this.getMinMax();return new D(t.x,t.y,e.x-t.x,e.y-t.y)}getCommands(){return this.paths.flatMap(t=>t.curves.flatMap(e=>e.getCommands()))}getData(){return this.paths.map(t=>t.getData()).join(" ")}getSvgString(){const{x:t,y:e,width:n,height:r}=this.getBoundingBox(),s=1;return`<svg viewBox="${t-s} ${e-s} ${n+s*2} ${r+s*2}" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="currentColor" d="${this.getData()}"></path></svg>`}getSvgDataUri(){return`data:image/svg+xml;base64,${btoa(this.getSvgString())}`}drawTo(t){this.paths.forEach(e=>{e.drawTo(t)})}strokeTo(t){this.drawTo(t),t.stroke()}fillTo(t){this.drawTo(t),t.fill()}copy(t){return this.currentPath=t.currentPath.clone(),this.paths=t.paths.map(e=>e.clone()),this.userData=t.userData,this}toCanvas(t=!0){const e=document.createElement("canvas"),{left:n,top:r,width:s,height:o}=this.getBoundingBox();e.width=s,e.height=o;const h=e.getContext("2d");return h&&(h.translate(-n,-r),t?this.fillTo(h):this.strokeTo(h)),e}clone(){return new this.constructor().copy(this)}}const Ye="px",Xn=90,qn=["mm","cm","in","pt","pc","px"],Ke={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 L(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=qn.length;n<r;n++){const s=qn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ye!=="px"?e=Ke.in[Ye]/Xn:(e=Ke[t][Ye],e<0&&(e=Ke[t].in*Xn)),e*Number.parseFloat(i)}const Ns=new ct,ve=new ct,jn=new ct,Yn=new ct;function Gs(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Rs(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Rs(i){const t=new ct,e=Ns;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(L(i.getAttribute("x")),L(i.getAttribute("y"))),i.hasAttribute("transform")){const n=i.getAttribute("transform").split(")");for(let r=n.length-1;r>=0;r--){const s=n[r].trim();if(s==="")continue;const o=s.indexOf("("),h=s.length;if(o>0&&o<h){const c=s.slice(0,o),a=wt(s.slice(o+1));switch(e.identity(),c){case"translate":if(a.length>=1){const l=a[0];let u=0;a.length>=2&&(u=a[1]),e.translate(l,u)}break;case"rotate":if(a.length>=1){let l=0,u=0,p=0;l=a[0]*Math.PI/180,a.length>=3&&(u=a[1],p=a[2]),ve.makeTranslation(-u,-p),jn.makeRotation(l),Yn.multiplyMatrices(jn,ve),ve.makeTranslation(u,p),e.multiplyMatrices(ve,Yn)}break;case"scale":a.length>=1&&e.scale(a[0],a[1]??a[0]);break;case"skewX":a.length===1&&e.set(1,Math.tan(a[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":a.length===1&&e.set(1,0,0,Math.tan(a[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":a.length===6&&e.set(a[0],a[2],a[4],a[1],a[3],a[5],0,0,1);break}}t.premultiply(e)}}return t}function Vs(i){return new lt().addPath(new we().absarc(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("r")||0),0,Math.PI*2))}function Hs(i,t){if(!(!i.sheet||!i.sheet.cssRules||!i.sheet.cssRules.length))for(let e=0;e<i.sheet.cssRules.length;e++){const n=i.sheet.cssRules[e];if(n.type!==1)continue;const r=n.selectorText.split(/,/g).filter(Boolean).map(s=>s.trim());for(let s=0;s<r.length;s++){const o=Object.fromEntries(Object.entries(n.style).filter(([,h])=>h!==""));t[r[s]]=Object.assign(t[r[s]]||{},o)}}}function zs(i){return new lt().addPath(new we().absellipse(L(i.getAttribute("cx")||0),L(i.getAttribute("cy")||0),L(i.getAttribute("rx")||0),L(i.getAttribute("ry")||0),0,Math.PI*2))}function ks(i){return new lt().moveTo(L(i.getAttribute("x1")||0),L(i.getAttribute("y1")||0)).lineTo(L(i.getAttribute("x2")||0),L(i.getAttribute("y2")||0))}function Ws(i){const t=new lt,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const Xs=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function qs(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Xs,(r,s,o)=>{const h=L(s),c=L(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!0,t}const js=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Ys(i){var n;const t=new lt;let e=0;return(n=i.getAttribute("points"))==null||n.replace(js,(r,s,o)=>{const h=L(s),c=L(o);return e===0?t.moveTo(h,c):t.lineTo(h,c),e++,r}),t.currentPath.autoClose=!1,t}function Ks(i){const t=L(i.getAttribute("x")||0),e=L(i.getAttribute("y")||0),n=L(i.getAttribute("rx")||i.getAttribute("ry")||0),r=L(i.getAttribute("ry")||i.getAttribute("rx")||0),s=L(i.getAttribute("width")),o=L(i.getAttribute("height")),h=1-.551915024494,c=new lt;return c.moveTo(t+n,e),c.lineTo(t+s-n,e),(n!==0||r!==0)&&c.bezierCurveTo(t+s-n*h,e,t+s,e+r*h,t+s,e+r),c.lineTo(t+s,e+o-r),(n!==0||r!==0)&&c.bezierCurveTo(t+s,e+o-r*h,t+s-n*h,e+o,t+s-n,e+o),c.lineTo(t+n,e+o),(n!==0||r!==0)&&c.bezierCurveTo(t+n*h,e+o,t,e+o-r*h,t,e+o-r),c.lineTo(t,e+r),(n!==0||r!==0)&&c.bezierCurveTo(t,e+r*h,t+n*h,e,t+n,e),c}function vt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const h=i.getAttribute("class").split(/\s/).filter(Boolean).map(c=>c.trim());for(let c=0;c<h.length;c++)n=Object.assign(n,e[`.${h[c]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(h,c,a){a===void 0&&(a=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(h)&&(t[c]=a(i.getAttribute(h))),n[h]&&(t[c]=a(n[h])),i.style&&i.style[h]!==""&&(t[c]=a(i.style[h]))}function s(h){return Math.max(0,Math.min(1,L(h)))}function o(h){return Math.max(0,L(h))}return r("fill","fill"),r("fill-opacity","fillOpacity",s),r("fill-rule","fillRule"),r("opacity","opacity",s),r("stroke","stroke"),r("stroke-dashoffset","strokeDashoffset"),r("stroke-dasharray","strokeDasharray"),r("stroke-linecap","strokeLineCap"),r("stroke-linejoin","strokeLineJoin"),r("stroke-miterlimit","strokeMiterLimit",o),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",o),r("visibility","visibility"),t}function Qe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=vt(i,t,s);break;case"style":Hs(i,s);break;case"g":t=vt(i,t,s);break;case"path":t=vt(i,t,s),i.hasAttribute("d")&&(r=Ws(i));break;case"rect":t=vt(i,t,s),r=Ks(i);break;case"polygon":t=vt(i,t,s),r=qs(i);break;case"polyline":t=vt(i,t,s),r=Ys(i);break;case"circle":t=vt(i,t,s),r=Vs(i);break;case"ellipse":t=vt(i,t,s),r=zs(i);break;case"line":t=vt(i,t,s),r=ks(i);break;case"defs":n=!0;break;case"use":{t=vt(i,t,s);const p=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),d=(l=i.viewportElement)==null?void 0:l.getElementById(p);d?Qe(d,t,e):console.warn(`'use node' references non-existent node id: ${p}`);break}default:console.warn(i);break}const o=new ct,h=[],c=Gs(i,o,h);r&&(r.transform(o),e.push(r),r.userData={node:i,style:t});const a=i.childNodes;for(let u=0,p=a.length;u<p;u++){const d=a[u];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Qe(d,t,e)}return c&&(h.pop(),h.length>0?o.copy(h[h.length-1]):o.identity()),e}const Kn="data:image/svg+xml;",Qn=`${Kn}base64,`,Zn=`${Kn}charset=utf8,`;function Jn(i){if(typeof i=="string"){let t;return i.startsWith(Qn)?(i=i.substring(Qn.length,i.length),t=atob(i)):i.startsWith(Zn)?(i=i.substring(Zn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Qs(i){return Qe(Jn(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}function xe(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function tr(i,t){const{x:e,y:n}=i,r=Math.sin(t),s=Math.cos(t);return{x:e*s-n*r,y:e*r+n*s}}function Ze(i,t,e,n){const r=i.x-t.x,s=i.y-t.y;return{x:t.x+(r+Math.tan(e)*s),y:t.y+(s+Math.tan(n)*r)}}function er(i,t,e,n){const r=e<0?t.x-i.x+t.x:i.x,s=n<0?t.y-i.y+t.y:i.y;return{x:r*Math.abs(e),y:s*Math.abs(n)}}function nr(i,t,e=0,n=0,r=0,s=1,o=1){let h=Array.isArray(i)?i:[i];const c=-e/180*Math.PI,{x:a,y:l}=t;return(s!==1||o!==1)&&(h=h.map(u=>er(u,t,s,o))),(n||r)&&(h=h.map(u=>Ze(u,t,n,r))),h=h.map(u=>{const p=u.x-a,d=-(u.y-l);return u=tr({x:p,y:d},c),{x:a+u.x,y:l-u.y}}),h[0]}const Zs=new Set(["©","®","÷"]),Js=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class rr{constructor(t,e,n){$(this,"boundingBox",new D);$(this,"textWidth",0);$(this,"textHeight",0);$(this,"path",new lt);$(this,"commands",[]);this.content=t,this.index=e,this.parent=n}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 Mt||t instanceof _t)return t.sfnt}updateGlyph(t=this._font()){if(!t)return this;const{unitsPerEm:e,ascender:n,descender:r,os2:s,post:o}=t,{content:h,computedStyle:c,boundingBox:a,isVertical:l}=this,{left:u,top:p,height:d}=a,{fontSize:g}=c,m=e/g,w=t.getAdvanceWidth(h,g),_=(n+Math.abs(r))/m,b=n/m,x=(n-s.yStrikeoutPosition)/m,C=s.yStrikeoutSize/m,T=(n-o.underlinePosition)/m,O=o.underlineThickness/m;return this.glyphWidth=w,this.glyphHeight=_,this.underlinePosition=T,this.underlineThickness=O,this.yStrikeoutPosition=x,this.yStrikeoutSize=C,this.baseline=b,this.centerDiviation=.5*d-b,this.glyphBox=l?new D(u,p,_,w):new D(u,p,w,_),this.centerPoint=this.glyphBox.getCenterPoint(),this}updateCommands(){const t=this._font();if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:o,computedStyle:h,baseline:c,glyphHeight:a,glyphWidth:l}=this.updateGlyph(t),{os2:u,ascender:p,descender:d}=t,g=p,m=d,w=u.sTypoAscender,{left:_,top:b}=o,{fontSize:x,fontStyle:C}=h;let T=_,O=b+c,A,M;if(e&&(T+=(a-l)/2,Math.abs(r-s)>.1&&(O-=(g-w)/(g+Math.abs(m))*a),A=void 0),e&&!Zs.has(n)&&(n.codePointAt(0)<=256||Js.has(n))){M=t.getPathCommands(n,T,b+c-(a-l)/2,x)??[];const S={y:b-(a-l)/2+a/2,x:T+l/2};C==="italic"&&(M=this._italic(M,e?{x:S.x,y:b-(a-l)/2+c}:void 0)),M=this._rotation90(M,S)}else A!==void 0?(M=t.glyf.glyphs.get(A).getPathCommands(T,O,x),C==="italic"&&(M=this._italic(M,e?{x:T+l/2,y:b+w/(g+Math.abs(m))*a}:void 0))):(M=t.getPathCommands(n,T,O,x)??[],C==="italic"&&(M=this._italic(M,e?{x:T+a/2,y:O}:void 0)));return M.push(...this._decoration()),this.commands=M,this}updatePath(){var t;return(t=this.path)==null||t.copy(new lt(this.commands)),this}update(){return this.updateCommands().updatePath(),this}_decoration(){const{isVertical:t,underlinePosition:e,yStrikeoutPosition:n}=this,{textDecoration:r,fontSize:s}=this.computedStyle,{left:o,top:h,width:c,height:a}=this.boundingBox,l=.1*s;let u;switch(r){case"underline":t?u=o:u=h+e;break;case"line-through":t?u=o+c/2:u=h+n;break;case"none":default:return[]}return t?[{type:"M",x:u,y:h},{type:"L",x:u,y:h+a},{type:"L",x:u+l,y:h+a},{type:"L",x:u+l,y:h},{type:"Z"}]:[{type:"M",x:o,y:u},{type:"L",x:o+c,y:u},{type:"L",x:o+c,y:u+l},{type:"L",x:o,y:u+l},{type:"Z"}]}_italic(t,e){const{baseline:n,glyphWidth:r}=this,{left:s,top:o}=this.boundingBox,h=e||{y:o+n,x:s+r/2};return this._transform(t,(c,a)=>{const l=Ze({x:c,y:a},h,-.24,0);return[l.x,l.y]})}_rotation90(t,e){return this._transform(t,(n,r)=>{const s=nr({x:n,y:r},e,90);return[s.x,s.y]})}_transform(t,e){return t.map(n=>{const r={...n};switch(r.type){case"L":case"M":[r.x,r.y]=e(r.x,r.y);break;case"Q":[r.x1,r.y1]=e(r.x1,r.y1),[r.x,r.y]=e(r.x,r.y);break}return r})}forEachCommand(t){const e=this.commands,n={x:0,y:0},r={x:0,y:0};let s=!0,o=!1;for(let h=0,c=e.length;h<c;h++){s&&(o=!0,s=!1);let a=e[h];switch(a=t(a,h,{last:n,first:r})??a,a.type){case"M":case"L":case"Q":n.x=a.x,n.y=a.y,o&&(r.x=n.x,r.y=n.y);break;case"Z":n.x=r.x,n.y=r.y,s=!0;break}}return this}getMinMax(t=v.MAX,e=v.MIN){let n={x:0,y:0};return this.commands.forEach(r=>{switch(r.type){case"L":case"M":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),n={x:r.x,y:r.y};break;case"Q":{const s=.5*(n.x+r.x1),o=.5*(n.y+r.y1),h=.5*(n.x+r.x),c=.5*(n.y+r.y);t.x=Math.min(t.x,n.x,r.x,s,h),t.y=Math.min(t.y,n.y,r.y,o,c),e.x=Math.max(e.x,n.x,r.x,s,h),e.y=Math.max(e.y,n.y,r.y,o,c),n={x:r.x,y:r.y};break}}}),{min:t,max:e}}getBoundingBox(){const t=v.MAX,e=v.MIN;return this.getMinMax(t,e),this.path.getMinMax(t,e),new D(t.x,t.y,e.x-t.x,e.y-t.y)}drawTo(t,e={}){Se({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class ir{constructor(t,e={},n){$(this,"boundingBox",new D);$(this,"highlight");this.content=t,this.style=e,this.parent=n,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,...xe(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new rr(n,e++,this));return this.characters=t,this}}class Vt{constructor(t,e){$(this,"boundingBox",new D);$(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...xe(this.parentStyle),...xe(this.style)},this}addFragment(t,e){const n=new ir(t,e,this);return this.fragments.push(n),n}}class Ft{constructor(t){this._text=t}}class sr extends Ft{deform(){var t,e;(e=(t=this._text).deformation)==null||e.call(t)}}class or extends Ft{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(o=>{const h=(o.offsetX??0)*s,c=(o.offsetY??0)*s,a=(o.shadowOffsetX??0)*s,l=(o.shadowOffsetY??0)*s,u=Math.max(.1,o.textStrokeWidth??0)*s,p=r.boundingBox.clone();p.left+=h+a-u,p.top+=c+l-u,p.width+=u*2,p.height+=u*2,n.push(p)})}),D.from(...n)}draw(t){const{ctx:e}=t,{effects:n,characters:r,boundingBox:s}=this._text;return n&&(n.forEach(o=>{yt(o,s,e)}),r.forEach(o=>{n.forEach(h=>{o.drawTo(e,h)})})),this}}class ar extends Ft{constructor(){super(...arguments);$(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new D;const e=v.MAX,n=v.MIN;return this.paths.forEach(r=>r.getMinMax(e,n)),new D(e.x,e.y,n.x-e.x,n.y-e.y)}highlight(){const{characters:e,computedStyle:n}=this._text,r=n.fontSize;let s;const o=[];let h;e.forEach(c=>{const a=c.parent.highlight;a!=null&&a.url&&((h==null?void 0:h.url)===a.url?s.push(c):(s=[],s.push(c),o.push(s))),h=a}),this.paths=o.filter(c=>c.length).map(c=>({url:c[0].parent.highlight.url,box:D.from(...c.map(a=>a.boundingBox)),baseline:Math.max(...c.map(a=>a.baseline))})).map(c=>this._parseGroup(c,r)).flat()}_parseSvg(e){const n=Jn(e),r=Qs(n),s=v.MAX,o=v.MIN;r.forEach(p=>p.getMinMax(s,o));const{x:h,y:c,width:a,height:l}=new D(s.x,s.y,o.x-s.x,o.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new D(h,c,a,l),viewBox:new D(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:o}=e,{box:h,viewBox:c,paths:a}=this._parseSvg(r),l=[],u=h.height/c.height>.3?0:1;if(u===0){const p={x:s.left-n*.2,y:s.top},d=(s.width+n*.2*2)/h.width,g=s.height/h.height,m=new ct().translate(-h.x,-h.y).scale(d,g).translate(p.x,p.y);a.forEach(w=>{l.push(w.clone().transform(m))})}else if(u===1){const p=n/h.width*2,d=h.width*p,g=Math.ceil(s.width/d),m=d*g,w={x:s.left+(s.width-m)/2+n*.1,y:s.top+o+n*.1},_=new ct().translate(-h.x,-h.y).scale(p,p).translate(w.x,w.y);for(let b=0;b<g;b++){const x=_.clone().translate(b*d,0);a.forEach(C=>{l.push(C.clone().transform(x))})}}return l}draw({ctx:e}){return Se({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize,fill:!1}),this}}class hr extends Ft{_styleToDomStyle(t){const e={...t};for(const n in t)["width","height","fontSize","letterSpacing","textStrokeWidth","shadowOffsetX","shadowOffsetY","shadowBlur"].includes(n)?e[n]=`${t[n]}px`:e[n]=t[n];return e}createDom(){const{paragraphs:t,computedStyle:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("section");Object.assign(r.style,{...this._styleToDomStyle(e),position:"absolute",visibility:"hidden"});const s=document.createElement("ul");return Object.assign(s.style,{listStyle:"none",padding:"0",margin:"0"}),t.forEach(o=>{const h=document.createElement("li");Object.assign(h.style,this._styleToDomStyle(o.style)),o.fragments.forEach(c=>{const a=document.createElement("span");Object.assign(a.style,this._styleToDomStyle(c.style)),a.appendChild(document.createTextNode(c.content)),h.appendChild(a)}),s.appendChild(h)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,o)=>{const h=s.getBoundingClientRect();e.push({paragraphIndex:o,left:h.left,top:h.top,width:h.width,height:h.height}),s.querySelectorAll("span").forEach((c,a)=>{var p;const l=s.getBoundingClientRect();n.push({paragraphIndex:o,fragmentIndex:a,left:l.left,top:l.top,width:l.width,height:l.height});const u=c.firstChild;if(u instanceof window.Text){const d=document.createRange();d.selectNodeContents(u);const g=u.data?u.data.length:0;let m=0;for(;m<=g;){d.setStart(u,Math.max(m-1,0)),d.setEnd(u,m);const w=((p=d.getClientRects)==null?void 0:p.call(d))??[d.getBoundingClientRect()];let _=w[w.length-1];w.length>1&&_.width<2&&(_=w[w.length-2]);const b=d.toString();b!==""&&_&&_.width+_.height!==0&&r.push({content:b,newParagraphIndex:-1,paragraphIndex:o,fragmentIndex:a,characterIndex:m-1,top:_.top,left:_.left,height:_.height,width:_.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const{paragraphs:e}=this._text,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),o=r.style.lineHeight;r.style.lineHeight="4000px";const h=[[]];let c=h[0];const{characters:a}=this._measureDom(t);a.length>0&&(c.push(a[0]),a.reduce((d,g)=>{const m=s?"left":"top";return Math.abs(g[m]-d[m])>4e3/2&&(c=[],h.push(c)),c.push(g),g})),r.style.lineHeight=o;const l=this._measureDom(t);l.paragraphs.forEach(d=>{const g=e[d.paragraphIndex];g.boundingBox.left=d.left,g.boundingBox.top=d.top,g.boundingBox.width=d.width,g.boundingBox.height=d.height}),l.fragments.forEach(d=>{const g=e[d.paragraphIndex].fragments[d.fragmentIndex];g.boundingBox.left=d.left,g.boundingBox.top=d.top,g.boundingBox.width=d.width,g.boundingBox.height=d.height});const u=[];let p=0;return h.forEach(d=>{d.forEach(g=>{const m=l.characters[p],{paragraphIndex:w,fragmentIndex:_,characterIndex:b}=m;u.push({...m,newParagraphIndex:w,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const x=e[w].fragments[_].characters[b];x.boundingBox.left=u[p].left,x.boundingBox.top=u[p].top,x.boundingBox.width=u[p].width,x.boundingBox.height=u[p].height,x.textWidth=u[p].textWidth,x.textHeight=u[p].textHeight,p++})}),{paragraphs:e,boundingBox:new D(0,0,n.width,n.height)}}measure(t){let e;t||({dom:t,destory:e}=this.createDom());const n=this.measureDom(t);return e==null||e(),n}}class cr extends Ft{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new Vt({},e);r.addFragment(t),n.push(r)}else{t=Array.isArray(t)?t:[t];for(const r of t)if(typeof r=="string"){const s=new Vt({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new Vt({},e);r.forEach(o=>{if(typeof o=="string")s.addFragment(o);else{const{content:h,highlight:c,...a}=o;if(h!==void 0){const l=s.addFragment(h,a);l.highlight=c}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...o}=r,h=new Vt(o,e);s.forEach(c=>{const{content:a,highlight:l,...u}=c;if(a!==void 0){const p=h.addFragment(a,u);p.highlight=l}}),n.push(h)}else if("content"in r){const{content:s,highlight:o,...h}=r;if(s!==void 0){const c=new Vt(h,e),a=c.addFragment(s);a.highlight=o,n.push(c)}}}return n}}class to extends Ft{}class lr extends Ft{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:o,width:h,height:c}=r,a=e.canvas;return a.dataset.viewbox=`${s} ${o} ${h} ${c}`,a.dataset.pixelRatio=String(n),a.width=Math.max(1,Math.ceil(h*n)),a.height=Math.max(1,Math.ceil(c*n)),a.style.marginTop=`${o}px`,a.style.marginLeft=`${s}px`,a.style.width=`${h}px`,a.style.height=`${c}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-o),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:o,height:h}=s;return yt(r,new D(0,0,o,h),e),n.forEach(c=>{yt(c.computedStyle,c.boundingBox,e),c.fragments.forEach(a=>{yt(a.computedStyle,a.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(o,h,c,a,l){e.fillStyle=o,e.fillRect(h,c,a,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(o=>{var h;(h=o.style)!=null&&h.backgroundColor&&s(o.computedStyle.backgroundColor,...o.boundingBox.toArray()),o.fragments.forEach(c=>{var a;(a=c.style)!=null&&a.backgroundColor&&s(c.computedStyle.backgroundColor,...c.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Je={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 eo{constructor(t={}){$(this,"content");$(this,"style");$(this,"effects");$(this,"deformation");$(this,"measureDom");$(this,"needsUpdate",!0);$(this,"computedStyle",{...Je});$(this,"paragraphs",[]);$(this,"boundingBox",new D);$(this,"renderBoundingBox",new D);$(this,"_parser",new cr(this));$(this,"_measurer",new hr(this));$(this,"_deformer",new sr(this));$(this,"_effector",new or(this));$(this,"_highlighter",new ar(this));$(this,"_renderer2D",new lr(this));const{content:e="",style:n={},effects:r,deformation:s,measureDom:o}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s,this.measureDom=o}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t=this.measureDom){this.computedStyle={...Je,...this.style};const e=this.paragraphs;this.paragraphs=this._parser.parse();const n=this._measurer.measure(t);return this.paragraphs=e,n}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e;const n=this.characters;n.forEach(o=>o.update()),this._highlighter.highlight(),this.deformation&&this._deformer.deform();const r=v.MAX,s=v.MIN;return n.forEach(o=>o.getMinMax(r,s)),this.renderBoundingBox=new D(r.x,r.y,s.x-r.x,s.y-r.y),this}render(t){var s,o;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.needsUpdate&&this.update(),(s=this.effects)!=null&&s.length?this.renderBoundingBox=D.from(this.boundingBox,this.renderBoundingBox,this._effector.getBoundingBox(),this._highlighter.getBoundingBox()):this.renderBoundingBox=D.from(this.boundingBox,this.renderBoundingBox,this._highlighter.getBoundingBox()),this._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),(o=this.effects)!=null&&o.length?this._effector.draw({ctx:r}):this._renderer2D.draw({ctx:r}),this):this}}f.Character=rr,f.CmapSubtableFormat0=Ee,f.CmapSubtableFormat12=Ne,f.CmapSubtableFormat14=Jt,f.CmapSubtableFormat2=Kt,f.CmapSubtableFormat4=Be,f.CmapSubtableFormat6=It,f.Deformer=sr,f.Effector=or,f.Eot=jr,f.Font=fe,f.Fonts=Dn,f.Fragment=ir,f.Glyph=bn,f.GlyphSet=_n,f.Highlighter=ar,f.Measurer=hr,f.Paragraph=Vt,f.Parser=cr,f.Reflector=to,f.Renderer2D=lr,f.Sfnt=te,f.TableDirectory=Bt,f.Text=eo,f.Ttf=_t,f.Woff=Mt,f.WoffTableDirectoryEntry=Et,f.componentFlags=Gt,f.createCmapSegments=Fe,f.defaultTextStyles=Je,f.defineSfntTable=j,f.drawPaths=Se,f.filterEmpty=xe,f.fonts=Ln,f.getPointPosition=nr,f.getRotationPoint=tr,f.getScalePoint=er,f.getSkewPoint=Ze,f.minify=rs,f.minifyGlyphs=En,f.minifySfnt=Un,f.parseColor=z,f.uploadColor=yt,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Point2D, Path2D, parseSvgToDom, parseSvg, Matrix3 } from 'modern-path2d';
1
+ import { BoundingBox, Path2D, Vector2, parseSvgToDom, parseSvg, Matrix3 } from 'modern-path2d';
2
2
  import { fonts, Woff, Ttf } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
@@ -172,6 +172,7 @@ class Character {
172
172
  __publicField$4(this, "boundingBox", new BoundingBox());
173
173
  __publicField$4(this, "textWidth", 0);
174
174
  __publicField$4(this, "textHeight", 0);
175
+ __publicField$4(this, "path", new Path2D());
175
176
  // glyph
176
177
  __publicField$4(this, "commands", []);
177
178
  }
@@ -294,8 +295,12 @@ class Character {
294
295
  this.commands = commands;
295
296
  return this;
296
297
  }
298
+ updatePath() {
299
+ this.path?.copy(new Path2D(this.commands));
300
+ return this;
301
+ }
297
302
  update() {
298
- this.updateCommands();
303
+ this.updateCommands().updatePath();
299
304
  return this;
300
305
  }
301
306
  _decoration() {
@@ -408,7 +413,7 @@ class Character {
408
413
  }
409
414
  return this;
410
415
  }
411
- getMinMax(min = Point2D.MAX, max = Point2D.MIN) {
416
+ getMinMax(min = Vector2.MAX, max = Vector2.MIN) {
412
417
  let last = { x: 0, y: 0 };
413
418
  this.commands.forEach((cmd) => {
414
419
  switch (cmd.type) {
@@ -436,10 +441,17 @@ class Character {
436
441
  });
437
442
  return { min, max };
438
443
  }
444
+ getBoundingBox() {
445
+ const min = Vector2.MAX;
446
+ const max = Vector2.MIN;
447
+ this.getMinMax(min, max);
448
+ this.path.getMinMax(min, max);
449
+ return new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
450
+ }
439
451
  drawTo(ctx, config = {}) {
440
452
  drawPaths({
441
453
  ctx,
442
- paths: [new Path2D(this.commands)],
454
+ paths: [this.path],
443
455
  fontSize: this.computedStyle.fontSize,
444
456
  color: this.computedStyle.color,
445
457
  ...config
@@ -578,8 +590,8 @@ class Highlighter extends Feature {
578
590
  if (!this.paths.length) {
579
591
  return new BoundingBox();
580
592
  }
581
- const min = Point2D.MAX;
582
- const max = Point2D.MIN;
593
+ const min = Vector2.MAX;
594
+ const max = Vector2.MIN;
583
595
  this.paths.forEach((path) => path.getMinMax(min, max));
584
596
  return new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
585
597
  }
@@ -613,8 +625,8 @@ class Highlighter extends Feature {
613
625
  _parseSvg(url) {
614
626
  const svg = parseSvgToDom(url);
615
627
  const paths = parseSvg(svg);
616
- const min = Point2D.MAX;
617
- const max = Point2D.MIN;
628
+ const min = Vector2.MAX;
629
+ const max = Vector2.MIN;
618
630
  paths.forEach((path) => path.getMinMax(min, max));
619
631
  const { x, y, width, height } = new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
620
632
  const viewBox = svg.getAttribute("viewBox").split(" ").map(Number);
@@ -1076,12 +1088,12 @@ class Text {
1076
1088
  this.boundingBox = boundingBox;
1077
1089
  const characters = this.characters;
1078
1090
  characters.forEach((c) => c.update());
1091
+ this._highlighter.highlight();
1079
1092
  if (this.deformation) {
1080
1093
  this._deformer.deform();
1081
1094
  }
1082
- this._highlighter.highlight();
1083
- const min = Point2D.MAX;
1084
- const max = Point2D.MIN;
1095
+ const min = Vector2.MAX;
1096
+ const max = Vector2.MIN;
1085
1097
  characters.forEach((c) => c.getMinMax(min, max));
1086
1098
  this.renderBoundingBox = new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
1087
1099
  return this;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.2.7",
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.1.5",
61
- "modern-path2d": "^0.1.7"
61
+ "modern-path2d": "^0.1.8"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@antfu/eslint-config": "^3.7.3",