modern-text 0.2.0 → 0.2.1

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
@@ -155,7 +155,7 @@ class Highlighter extends Feature {
155
155
  return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
156
156
  }
157
157
  highlight() {
158
- const { characters, style } = this._text;
158
+ const { characters, computedStyle: style } = this._text;
159
159
  const fontSize = style.fontSize;
160
160
  let group;
161
161
  const groups = [];
@@ -234,7 +234,7 @@ class Highlighter extends Feature {
234
234
  drawPaths({
235
235
  ctx,
236
236
  paths: this.paths,
237
- fontSize: this._text.style.fontSize,
237
+ fontSize: this._text.computedStyle.fontSize,
238
238
  fill: false
239
239
  });
240
240
  return this;
@@ -275,7 +275,7 @@ class Measurer extends Feature {
275
275
  * </div>
276
276
  */
277
277
  createDom() {
278
- const { paragraphs, style } = this._text;
278
+ const { paragraphs, computedStyle: style } = this._text;
279
279
  const documentFragment = document.createDocumentFragment();
280
280
  const dom = document.createElement("div");
281
281
  Object.assign(dom.style, this._styleToDomStyle(style));
@@ -371,7 +371,7 @@ class Measurer extends Feature {
371
371
  };
372
372
  }
373
373
  measureDom(dom) {
374
- const paragraphs = this._text.paragraphs;
374
+ const { paragraphs } = this._text;
375
375
  const rect = dom.getBoundingClientRect();
376
376
  const innerEl = dom.querySelector("ul");
377
377
  const isVertical = window.getComputedStyle(dom).writingMode.includes("vertical");
@@ -812,8 +812,8 @@ class Paragraph {
812
812
  }
813
813
 
814
814
  class Parser extends Feature {
815
- parse(content) {
816
- const { style } = this._text;
815
+ parse() {
816
+ let { content, computedStyle: style } = this._text;
817
817
  const paragraphs = [];
818
818
  if (typeof content === "string") {
819
819
  const paragraph = new Paragraph({}, style);
@@ -887,7 +887,7 @@ class Renderer2D extends Feature {
887
887
  }
888
888
  uploadColors(options) {
889
889
  const { ctx } = options;
890
- const { paragraphs, style, renderBoundingBox } = this._text;
890
+ const { paragraphs, computedStyle: style, renderBoundingBox } = this._text;
891
891
  const { width, height } = renderBoundingBox;
892
892
  uploadColor(style, new modernPath2d.BoundingBox(0, 0, width, height), ctx);
893
893
  paragraphs.forEach((paragraph) => {
@@ -900,7 +900,7 @@ class Renderer2D extends Feature {
900
900
  }
901
901
  fillBackground(options) {
902
902
  const { ctx } = options;
903
- const { style, paragraphs } = this._text;
903
+ const { computedStyle: style, paragraphs } = this._text;
904
904
  function fillBackground(color, x, y, width, height) {
905
905
  ctx.fillStyle = color;
906
906
  ctx.fillRect(x, y, width, height);
@@ -962,10 +962,13 @@ const defaultTextStyles = {
962
962
  };
963
963
  class Text {
964
964
  constructor(options) {
965
+ __publicField(this, "content");
965
966
  __publicField(this, "style");
966
- __publicField(this, "paragraphs");
967
967
  __publicField(this, "effects");
968
968
  __publicField(this, "deformation");
969
+ __publicField(this, "needsUpdate", true);
970
+ __publicField(this, "computedStyle", { ...defaultTextStyles });
971
+ __publicField(this, "paragraphs", []);
969
972
  __publicField(this, "boundingBox", new modernPath2d.BoundingBox());
970
973
  __publicField(this, "renderBoundingBox", new modernPath2d.BoundingBox());
971
974
  __publicField(this, "_parser", new Parser(this));
@@ -974,18 +977,24 @@ class Text {
974
977
  __publicField(this, "_effector", new Effector(this));
975
978
  __publicField(this, "_highlighter", new Highlighter(this));
976
979
  __publicField(this, "_renderer2D", new Renderer2D(this));
977
- const { content, style, effects, deformation } = options;
978
- this.style = { ...defaultTextStyles, ...style };
980
+ const { content, style = {}, effects, deformation } = options;
981
+ this.content = content;
982
+ this.style = style;
979
983
  this.effects = effects;
980
984
  this.deformation = deformation;
981
- this.paragraphs = this._parser.parse(content);
982
985
  }
983
986
  get characters() {
984
987
  return this.paragraphs.flatMap((p) => p.fragments.flatMap((f) => f.characters));
985
988
  }
986
989
  measure(dom) {
990
+ this.computedStyle = { ...defaultTextStyles, ...this.style };
991
+ this.paragraphs = this._parser.parse();
987
992
  return this._measurer.measure(dom);
988
993
  }
994
+ requestUpdate() {
995
+ this.needsUpdate = true;
996
+ return this;
997
+ }
989
998
  update() {
990
999
  const { paragraphs, boundingBox } = this.measure();
991
1000
  this.paragraphs = paragraphs;
@@ -1007,7 +1016,9 @@ class Text {
1007
1016
  if (!ctx) {
1008
1017
  return this;
1009
1018
  }
1010
- this.update();
1019
+ if (this.needsUpdate) {
1020
+ this.update();
1021
+ }
1011
1022
  if (this.effects?.length) {
1012
1023
  this.renderBoundingBox = modernPath2d.BoundingBox.from(
1013
1024
  this.boundingBox,
package/dist/index.d.cts CHANGED
@@ -215,7 +215,7 @@ declare class Measurer extends Feature {
215
215
  }
216
216
 
217
217
  declare class Parser extends Feature {
218
- parse(content: TextContent): Paragraph[];
218
+ parse(): Paragraph[];
219
219
  }
220
220
 
221
221
  interface Render2dOptions {
@@ -241,10 +241,36 @@ interface TextOptions {
241
241
  }
242
242
  declare const defaultTextStyles: TextStyle;
243
243
  declare class Text {
244
- style: TextStyle;
245
- paragraphs: Paragraph[];
244
+ content: TextContent;
245
+ style: Partial<TextStyle>;
246
246
  effects?: TextEffect[];
247
247
  deformation?: TextDeformation;
248
+ needsUpdate: boolean;
249
+ computedStyle: {
250
+ writingMode: WritingMode;
251
+ textOrientation: TextOrientation;
252
+ fontSize: number;
253
+ fontWeight: FontWeight;
254
+ fontFamily: string;
255
+ fontStyle: FontStyle;
256
+ fontKerning: FontKerning;
257
+ textWrap: TextWrap;
258
+ textAlign: TextAlign;
259
+ verticalAlign: VerticalAlign;
260
+ textTransform: TextTransform;
261
+ lineHeight: number;
262
+ letterSpacing: number;
263
+ color: string | CanvasGradient | CanvasPattern;
264
+ backgroundColor: string | CanvasGradient | CanvasPattern;
265
+ textStrokeWidth: number;
266
+ textStrokeColor: string | CanvasGradient | CanvasPattern;
267
+ textDecoration: TextDecoration;
268
+ shadowColor: string;
269
+ shadowOffsetX: number;
270
+ shadowOffsetY: number;
271
+ shadowBlur: number;
272
+ };
273
+ paragraphs: Paragraph[];
248
274
  boundingBox: BoundingBox;
249
275
  renderBoundingBox: BoundingBox;
250
276
  protected _parser: Parser;
@@ -256,6 +282,7 @@ declare class Text {
256
282
  get characters(): Character[];
257
283
  constructor(options: TextOptions);
258
284
  measure(dom?: HTMLElement): MeasuredResult;
285
+ requestUpdate(): this;
259
286
  update(): this;
260
287
  render(options: TextRenderOptions): this;
261
288
  }
package/dist/index.d.mts CHANGED
@@ -215,7 +215,7 @@ declare class Measurer extends Feature {
215
215
  }
216
216
 
217
217
  declare class Parser extends Feature {
218
- parse(content: TextContent): Paragraph[];
218
+ parse(): Paragraph[];
219
219
  }
220
220
 
221
221
  interface Render2dOptions {
@@ -241,10 +241,36 @@ interface TextOptions {
241
241
  }
242
242
  declare const defaultTextStyles: TextStyle;
243
243
  declare class Text {
244
- style: TextStyle;
245
- paragraphs: Paragraph[];
244
+ content: TextContent;
245
+ style: Partial<TextStyle>;
246
246
  effects?: TextEffect[];
247
247
  deformation?: TextDeformation;
248
+ needsUpdate: boolean;
249
+ computedStyle: {
250
+ writingMode: WritingMode;
251
+ textOrientation: TextOrientation;
252
+ fontSize: number;
253
+ fontWeight: FontWeight;
254
+ fontFamily: string;
255
+ fontStyle: FontStyle;
256
+ fontKerning: FontKerning;
257
+ textWrap: TextWrap;
258
+ textAlign: TextAlign;
259
+ verticalAlign: VerticalAlign;
260
+ textTransform: TextTransform;
261
+ lineHeight: number;
262
+ letterSpacing: number;
263
+ color: string | CanvasGradient | CanvasPattern;
264
+ backgroundColor: string | CanvasGradient | CanvasPattern;
265
+ textStrokeWidth: number;
266
+ textStrokeColor: string | CanvasGradient | CanvasPattern;
267
+ textDecoration: TextDecoration;
268
+ shadowColor: string;
269
+ shadowOffsetX: number;
270
+ shadowOffsetY: number;
271
+ shadowBlur: number;
272
+ };
273
+ paragraphs: Paragraph[];
248
274
  boundingBox: BoundingBox;
249
275
  renderBoundingBox: BoundingBox;
250
276
  protected _parser: Parser;
@@ -256,6 +282,7 @@ declare class Text {
256
282
  get characters(): Character[];
257
283
  constructor(options: TextOptions);
258
284
  measure(dom?: HTMLElement): MeasuredResult;
285
+ requestUpdate(): this;
259
286
  update(): this;
260
287
  render(options: TextRenderOptions): this;
261
288
  }
package/dist/index.d.ts CHANGED
@@ -215,7 +215,7 @@ declare class Measurer extends Feature {
215
215
  }
216
216
 
217
217
  declare class Parser extends Feature {
218
- parse(content: TextContent): Paragraph[];
218
+ parse(): Paragraph[];
219
219
  }
220
220
 
221
221
  interface Render2dOptions {
@@ -241,10 +241,36 @@ interface TextOptions {
241
241
  }
242
242
  declare const defaultTextStyles: TextStyle;
243
243
  declare class Text {
244
- style: TextStyle;
245
- paragraphs: Paragraph[];
244
+ content: TextContent;
245
+ style: Partial<TextStyle>;
246
246
  effects?: TextEffect[];
247
247
  deformation?: TextDeformation;
248
+ needsUpdate: boolean;
249
+ computedStyle: {
250
+ writingMode: WritingMode;
251
+ textOrientation: TextOrientation;
252
+ fontSize: number;
253
+ fontWeight: FontWeight;
254
+ fontFamily: string;
255
+ fontStyle: FontStyle;
256
+ fontKerning: FontKerning;
257
+ textWrap: TextWrap;
258
+ textAlign: TextAlign;
259
+ verticalAlign: VerticalAlign;
260
+ textTransform: TextTransform;
261
+ lineHeight: number;
262
+ letterSpacing: number;
263
+ color: string | CanvasGradient | CanvasPattern;
264
+ backgroundColor: string | CanvasGradient | CanvasPattern;
265
+ textStrokeWidth: number;
266
+ textStrokeColor: string | CanvasGradient | CanvasPattern;
267
+ textDecoration: TextDecoration;
268
+ shadowColor: string;
269
+ shadowOffsetX: number;
270
+ shadowOffsetY: number;
271
+ shadowBlur: number;
272
+ };
273
+ paragraphs: Paragraph[];
248
274
  boundingBox: BoundingBox;
249
275
  renderBoundingBox: BoundingBox;
250
276
  protected _parser: Parser;
@@ -256,6 +282,7 @@ declare class Text {
256
282
  get characters(): Character[];
257
283
  constructor(options: TextOptions);
258
284
  measure(dom?: HTMLElement): MeasuredResult;
285
+ requestUpdate(): this;
259
286
  update(): this;
260
287
  render(options: TextRenderOptions): this;
261
288
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(f,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(f=typeof globalThis<"u"?globalThis:f||self,w(f.modernText={}))})(this,function(f){"use strict";var eo=Object.defineProperty;var no=(f,w,L)=>w in f?eo(f,w,{enumerable:!0,configurable:!0,writable:!0,value:L}):f[w]=L;var G=(f,w,L)=>no(f,typeof w!="symbol"?w+"":w,L);class w{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new w(1/0,1/0)}static get MIN(){return new w(-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 w(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 w((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 sr=Object.defineProperty,or=(i,t,e)=>t in i?sr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ar=(i,t,e)=>(or(i,t+"",e),e);class ut{constructor(t=1,e=0,n=0,r=0,s=1,a=0,c=0,h=0,o=1){ar(this,"elements",[]),this.set(t,e,n,r,s,a,c,h,o)}set(t,e,n,r,s,a,c,h,o){const l=this.elements;return l[0]=t,l[1]=r,l[2]=c,l[3]=e,l[4]=s,l[5]=h,l[6]=n,l[7]=a,l[8]=o,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,a=n[0],c=n[3],h=n[6],o=n[1],l=n[4],u=n[7],y=n[2],g=n[5],d=n[8],m=r[0],v=r[3],x=r[6],_=r[1],b=r[4],M=r[7],T=r[2],A=r[5],$=r[8];return s[0]=a*m+c*_+h*T,s[3]=a*v+c*b+h*A,s[6]=a*x+c*M+h*$,s[1]=o*m+l*_+u*T,s[4]=o*v+l*b+u*A,s[7]=o*x+l*M+u*$,s[2]=y*m+g*_+d*T,s[5]=y*v+g*b+d*A,s[8]=y*x+g*M+d*$,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],c=t[5],h=t[6],o=t[7],l=t[8],u=l*a-c*o,y=c*h-l*s,g=o*s-a*h,d=e*u+n*y+r*g;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=u*m,t[1]=(r*o-l*n)*m,t[2]=(c*n-r*a)*m,t[3]=y*m,t[4]=(l*e-r*h)*m,t[5]=(r*s-c*e)*m,t[6]=g*m,t[7]=(n*h-o*e)*m,t[8]=(a*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(_e.makeScale(t,e)),this}rotate(t){return this.premultiply(_e.makeRotation(-t)),this}translate(t,e){return this.premultiply(_e.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 _e=new ut;function Je(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(a=-a),a}function hr(i,t,e,n,r,s,a,c){if(t===0||e===0){i.lineTo(c.x,c.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(a.x-c.x)/2,o=(a.y-c.y)/2,l=Math.cos(n)*h+Math.sin(n)*o,u=-Math.sin(n)*h+Math.cos(n)*o;let y=t*t,g=e*e;const d=l*l,m=u*u,v=d/y+m/g;if(v>1){const D=Math.sqrt(v);t=D*t,e=D*e,y=t*t,g=e*e}const x=y*m+g*d,_=(y*g-x)/x;let b=Math.sqrt(Math.max(0,_));r===s&&(b=-b);const M=b*t*u/e,T=-b*e*l/t,A=Math.cos(n)*M-Math.sin(n)*T+(a.x+c.x)/2,$=Math.sin(n)*M+Math.cos(n)*T+(a.y+c.y)/2,C=Je(1,0,(l-M)/t,(u-T)/e),S=Je((l-M)/t,(u-T)/e,(-l-M)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(A,$,t,e,C,C+S,s===0,n)}function Ut(i,t){return i-(t-i)}function cr(i,t){const e=new w,n=new w,r=new w;let s=!0,a=!1;for(let c=0,h=i.length;c<h;c++){const o=i[c];if(s&&(a=!0,s=!1),o.type==="m"||o.type==="M")o.type==="m"?(e.x+=o.x,e.y+=o.y):(e.x=o.x,e.y=o.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?(e.x+=o.x,e.y+=o.y):(e.x=o.x,e.y=o.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.x+=o.x,e.y+=o.y):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Ut(e.x,n.x),Ut(e.y,n.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.x+=o.x,e.y+=o.y):(t.bezierCurveTo(Ut(e.x,n.x),Ut(e.y,n.y),o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),n.x=e.x+o.x1,n.y=e.y+o.y1,e.x+=o.x,e.y+=o.y):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),n.x=o.x1,n.y=o.y1,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="t"||o.type==="T"){const l=Ut(e.x,n.x),u=Ut(e.y,n.y);n.x=l,n.y=u,o.type==="t"?(t.quadraticCurveTo(l,u,e.x+o.x,e.y+o.y),e.x+=o.x,e.y+=o.y):(t.quadraticCurveTo(l,u,o.x,o.y),e.x=o.x,e.y=o.y),a&&r.copy(e)}else if(o.type==="a"||o.type==="A"){if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.x+=o.x,e.y+=o.y}else{if(o.x===e.x&&o.y===e.y)continue;e.x=o.x,e.y=o.y}const l=e.clone();n.x=e.x,n.y=e.y,hr(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,l,e),a&&r.copy(e)}else o.type==="z"||o.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",o);a=!1}}const R={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function dt(i,t,e=0){let c=0,h=!0,o="",l="";const u=[];function y(v,x,_){const b=new SyntaxError(`Unexpected character "${v}" at index ${x}.`);throw b.partial=_,b}function g(){o!==""&&(l===""?u.push(Number(o)):u.push(Number(o)*10**Number(l))),o="",l=""}let d;const m=i.length;for(let v=0;v<m;v++){if(d=i[v],Array.isArray(t)&&t.includes(u.length%e)&&R.FLAGS.test(d)){c=1,o=d,g();continue}if(c===0){if(R.WHITESPACE.test(d))continue;if(R.DIGIT.test(d)||R.SIGN.test(d)){c=1,o=d;continue}if(R.POINT.test(d)){c=2,o=d;continue}R.COMMA.test(d)&&(h&&y(d,v,u),h=!0)}if(c===1){if(R.DIGIT.test(d)){o+=d;continue}if(R.POINT.test(d)){o+=d,c=2;continue}if(R.EXP.test(d)){c=3;continue}R.SIGN.test(d)&&o.length===1&&R.SIGN.test(o[0])&&y(d,v,u)}if(c===2){if(R.DIGIT.test(d)){o+=d;continue}if(R.EXP.test(d)){c=3;continue}R.POINT.test(d)&&o[o.length-1]==="."&&y(d,v,u)}if(c===3){if(R.DIGIT.test(d)){l+=d;continue}if(R.SIGN.test(d)){if(l===""){l+=d;continue}l.length===1&&R.SIGN.test(l)&&y(d,v,u)}}R.WHITESPACE.test(d)?(g(),c=0,h=!1):R.COMMA.test(d)?(g(),c=0,h=!0):R.SIGN.test(d)?(g(),c=1,o=d):R.POINT.test(d)?(g(),c=2,o=d):y(d,v,u)}return g(),u}function lr(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 ur(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${lr(i[e])} `;return t}const fr=/[a-df-z][^a-df-z]*/gi;function pr(i){const t=[],e=i.match(fr);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],a=s.charAt(0),c=s.slice(1).trim();let h;switch(a){case"m":case"M":h=dt(c);for(let o=0,l=h.length;o<l;o+=2)o===0?t.push({type:a,x:h[o],y:h[o+1]}):t.push({type:a==="m"?"l":"L",x:h[o],y:h[o+1]});break;case"h":case"H":h=dt(c);for(let o=0,l=h.length;o<l;o++)t.push({type:a,x:h[o]});break;case"v":case"V":h=dt(c);for(let o=0,l=h.length;o<l;o++)t.push({type:a,y:h[o]});break;case"l":case"L":h=dt(c);for(let o=0,l=h.length;o<l;o+=2)t.push({type:a,x:h[o],y:h[o+1]});break;case"c":case"C":h=dt(c);for(let o=0,l=h.length;o<l;o+=6)t.push({type:a,x1:h[o],y1:h[o+1],x2:h[o+2],y2:h[o+3],x:h[o+4],y:h[o+5]});break;case"s":case"S":h=dt(c);for(let o=0,l=h.length;o<l;o+=4)t.push({type:a,x2:h[o],y2:h[o+1],x:h[o+2],y:h[o+3]});break;case"q":case"Q":h=dt(c);for(let o=0,l=h.length;o<l;o+=4)t.push({type:a,x1:h[o],y1:h[o+1],x:h[o+2],y:h[o+3]});break;case"t":case"T":h=dt(c);for(let o=0,l=h.length;o<l;o+=2)t.push({type:a,x:h[o],y:h[o+1]});break;case"a":case"A":h=dt(c,[3,4],7);for(let o=0,l=h.length;o<l;o+=7)t.push({type:a,rx:h[o],ry:h[o+1],angle:h[o+2],largeArcFlag:h[o+3],sweepFlag:h[o+4],x:h[o+5],y:h[o+6]});break;case"z":case"Z":t.push({type:a});break;default:console.warn(s)}}return t}var yr=Object.defineProperty,gr=(i,t,e)=>t in i?yr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>(gr(i,typeof t!="symbol"?t+"":t,e),e);class Ot{constructor(){Me(this,"arcLengthDivisions",200),Me(this,"_cacheArcLengths"),Me(this,"_needsUpdate",!1)}getPointAt(t,e=new w){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 a=1;a<=t;a++)n=this.getPoint(a/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 a;e?a=e:a=t*n[s-1];let c=0,h=s-1,o;for(;c<=h;)if(r=Math.floor(c+(h-c)/2),o=n[r]-a,o<0)c=r+1;else if(o>0)h=r-1;else{h=r;break}if(r=h,n[r]===a)return r/(s-1);const l=n[r],y=n[r+1]-l,g=(a-l)/y;return(r+g)/(s-1)}getTangent(t,e=new w){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 w){return this.getTangent(this.getUtoTmapping(t),e)}transform(t){return this}getDivisions(t){return t}getMinMax(t=w.MAX,e=w.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 ur(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function tn(i,t,e,n,r){const s=(n-t)*.5,a=(r-e)*.5,c=i*i,h=i*c;return(2*e-2*n+s+a)*h+(-3*e+3*n-2*s-a)*c+s*i+e}function dr(i,t){const e=1-i;return e*e*t}function mr(i,t){return 2*(1-i)*i*t}function vr(i,t){return i*i*t}function en(i,t,e,n){return dr(i,t)+mr(i,e)+vr(i,n)}function wr(i,t){const e=1-i;return e*e*e*t}function br(i,t){const e=1-i;return 3*e*e*i*t}function xr(i,t){return 3*(1-i)*i*i*t}function _r(i,t){return i*i*i*t}function nn(i,t,e,n,r){return wr(i,t)+br(i,e)+xr(i,n)+_r(i,r)}class Mr extends Ot{constructor(t=new w,e=new w,n=new w,r=new w){super(),this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new w){const{v0:n,v1:r,v2:s,v3:a}=this;return e.set(nn(t,n.x,r.x,s.x,a.x),nn(t,n.y,r.y,s.y,a.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this.v3.applyMatrix3(t),this}getMinMax(t=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s,v3:a}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,a.x),t.y=Math.min(t.y,n.y,r.y,s.y,a.y),e.x=Math.max(e.x,n.x,r.x,s.x,a.x),e.y=Math.max(e.y,n.y,r.y,s.y,a.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 Sr=new ut,rn=new ut,sn=new ut,oe=new w;class Pr extends Ot{constructor(t=0,e=0,n=1,r=1,s=0,a=Math.PI*2,c=!1,h=0){super(),this.x=t,this.y=e,this.radiusX=n,this.radiusY=r,this.startAngle=s,this.endAngle=a,this.clockwise=c,this.rotation=h}getPoint(t,e=new w){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 a=this.startAngle+t*r;let c=this.x+this.radiusX*Math.cos(a),h=this.y+this.radiusY*Math.sin(a);if(this.rotation!==0){const o=Math.cos(this.rotation),l=Math.sin(this.rotation),u=c-this.x,y=h-this.y;c=u*o-y*l+this.x,h=u*l+y*o+this.y}return e.set(c,h)}getDivisions(t=12){return t*2}getCommands(){const{x:t,y:e,radiusX:n,radiusY:r,startAngle:s,endAngle:a,clockwise:c,rotation:h}=this,o=t+n*Math.cos(s)*Math.cos(h)-r*Math.sin(s)*Math.sin(h),l=e+n*Math.cos(s)*Math.sin(h)+r*Math.sin(s)*Math.cos(h),u=Math.abs(s-a),y=u>Math.PI?1:0,g=c?1:0,d=h*180/Math.PI;if(u>=2*Math.PI){const m=s+Math.PI,v=t+n*Math.cos(m)*Math.cos(h)-r*Math.sin(m)*Math.sin(h),x=e+n*Math.cos(m)*Math.sin(h)+r*Math.sin(m)*Math.cos(h);return[{type:"M",x:o,y:l},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:g,x:v,y:x},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:0,sweepFlag:g,x:o,y:l}]}else{const m=t+n*Math.cos(a)*Math.cos(h)-r*Math.sin(a)*Math.sin(h),v=e+n*Math.cos(a)*Math.sin(h)+r*Math.sin(a)*Math.cos(h);return[{type:"M",x:o,y:l},{type:"A",rx:n,ry:r,angle:d,largeArcFlag:y,sweepFlag:g,x:m,y:v}]}}drawTo(t){const{x:e,y:n,radiusX:r,radiusY:s,rotation:a,startAngle:c,endAngle:h,clockwise:o}=this;return t.ellipse(e,n,r,s,a,c,h,!o),this}transform(t){return oe.set(this.x,this.y),oe.applyMatrix3(t),this.x=oe.x,this.y=oe.y,Or(t)?Cr(this,t):Tr(this,t),this}getMinMax(t=w.MAX,e=w.MIN){const{x:n,y:r,radiusX:s,radiusY:a,rotation:c}=this,h=Math.cos(c),o=Math.sin(c),l=Math.sqrt(s*s*h*h+a*a*o*o),u=Math.sqrt(s*s*o*o+a*a*h*h);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 Cr(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),a=new w(e*r,e*s),c=new w(-n*s,n*r),h=a.applyMatrix3(t),o=c.applyMatrix3(t),l=Sr.set(h.x,o.x,0,h.y,o.y,0,0,0,1),u=rn.copy(l).invert(),d=sn.copy(u).transpose().multiply(u).elements,m=Ar(d[0],d[1],d[4]),v=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/v,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=rn.set(v,0,0,0,x,0,0,0,1),M=sn.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=b.multiply(M).multiply(l),A=$=>{const{x:C,y:S}=new w(Math.cos($),Math.sin($)).applyMatrix3(T);return Math.atan2(S,C)};i.startAngle=A(i.startAngle),i.endAngle=A(i.endAngle),on(t)&&(i.clockwise=!i.clockwise)}}function Tr(i,t){const e=an(t),n=hn(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,on(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function on(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Or(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=an(i),r=hn(i);return Math.abs(e/(n*r))>Number.EPSILON}function an(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function hn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ar(i,t,e){let n,r,s,a,c;const h=i+e,o=i-e,l=Math.sqrt(o*o+4*t*t);return h>0?(n=.5*(h+l),c=1/n,r=i*c*e-t*c*t):h<0?r=.5*(h-l):(n=.5*l,r=-.5*l),o>0?s=o+l:s=o-l,Math.abs(s)>2*Math.abs(t)?(c=-2*t/s,a=1/Math.sqrt(1+c*c),s=c*a):Math.abs(t)===0?(s=1,a=0):(c=-.5*s/t,s=1/Math.sqrt(1+c*c),a=c*s),o>0&&(c=s,s=-a,a=c),{rt1:n,rt2:r,cs:s,sn:a}}class Se extends Ot{constructor(t=new w,e=new w){super(),this.v1=t,this.v2=e}getPoint(t,e=new w){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 w){return this.getPoint(t,e)}getTangent(t,e=new w){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e=new w){return this.getTangent(t,e)}transform(t){return this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getDivisions(){return 1}getMinMax(t=w.MAX,e=w.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 $r extends Ot{constructor(t=new w,e=new w,n=new w){super(),this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new w){const{v0:n,v1:r,v2:s}=this;return e.set(en(t,n.x,r.x,s.x),en(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=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s}=this,a=.5*(n.x+r.x),c=.5*(n.y+r.y),h=.5*(n.x+s.x),o=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,a,h),t.y=Math.min(t.y,n.y,s.y,c,o),e.x=Math.max(e.x,n.x,s.x,a,h),e.y=Math.max(e.y,n.y,s.y,c,o),{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 Ir=Object.defineProperty,Lr=(i,t,e)=>t in i?Ir(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,cn=(i,t,e)=>(Lr(i,typeof t!="symbol"?t+"":t,e),e);class Dr extends Ot{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,cn(this,"curves",[]),cn(this,"pointT",0);const{x:a,y:c}=this.center,h=this.rx,o=this.rx/this.aspectRatio,l=[new w(a-h,c-o),new w(a+h,c-o),new w(a+h,c+o),new w(a-h,c+o)];for(let u=0;u<4;u++)this.curves.push(new Se(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 w(n.y-e.y,-(n.x-e.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.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 Er extends Ot{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new w){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),a=r-s,c=n[s===0?s:s-1],h=n[s],o=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(tn(a,c.x,h.x,o.x,l.x),tn(a,c.y,h.y,o.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 Ur=Object.defineProperty,Fr=(i,t,e)=>t in i?Ur(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ae=(i,t,e)=>(Fr(i,typeof t!="symbol"?t+"":t,e),e);class he extends Ot{constructor(t){super(),ae(this,"curves",[]),ae(this,"currentPoint",new w),ae(this,"autoClose",!1),ae(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 Se(e,t)),this}getPoint(t,e=new w){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,c=this.curves[s],h=c.getLength();return c.getPointAt(h===0?0:1-a/h,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let 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 a=s[r],c=a.getPoints(a.getDivisions(t));for(let h=0;h<c.length;h++){const o=c[h];n&&n.equals(o)||(e.push(o),n=o)}}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,a){return this.curves.push(new Mr(this.currentPoint.clone(),new w(t,e),new w(n,r),new w(s,a))),this.currentPoint.set(s,a),this}lineTo(t,e){return this.curves.push(new Se(this.currentPoint.clone(),new w(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 $r(this.currentPoint.clone(),new w(t,e),new w(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Dr(new w(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 Er(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,a=!1){const c=this.currentPoint;return this.absarc(t+c.x,e+c.y,n,r,s,a),this}absarc(t,e,n,r,s,a=!1){return this.absellipse(t,e,n,n,r,s,a),this}ellipse(t,e,n,r,s,a,c=!1,h=0){const o=this.currentPoint;return this.absellipse(t+o.x,e+o.y,n,r,s,a,c,h),this}absellipse(t,e,n,r,s,a,c=!1,h=0){const o=new Pr(t,e,n,r,s,a,c,h);if(this.curves.length>0){const l=o.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(o),this.currentPoint.copy(o.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=w.MAX,e=w.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 Br=Object.defineProperty,Nr=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pe=(i,t,e)=>(Nr(i,typeof t!="symbol"?t+"":t,e),e);class ft{constructor(t){Pe(this,"currentPath",new he),Pe(this,"paths",[this.currentPath]),Pe(this,"userData"),t&&(t instanceof ft?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof ft?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 he().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,a){return this.currentPath.bezierCurveTo(t,e,n,r,s,a),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,a){return this.currentPath.absarc(t,e,n,r,s,!a),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,a,c,h){return this.currentPath.absellipse(t,e,n,r,a,c,!h,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return cr(t,this),this}addData(t){return this.addCommands(pr(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=w.MAX,e=w.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:a}=this.getBoundingBox();e.width=s,e.height=a;const c=e.getContext("2d");return c&&(c.translate(-n,-r),t?this.fillTo(c):this.strokeTo(c)),e}clone(){return new this.constructor().copy(this)}}const Ce="px",ln=90,un=["mm","cm","in","pt","pc","px"],Te={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function U(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=un.length;n<r;n++){const s=un[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ce!=="px"?e=Te.in[Ce]/ln:(e=Te[t][Ce],e<0&&(e=Te[t].in*ln)),e*Number.parseFloat(i)}const Gr=new ut,ce=new ut,fn=new ut,pn=new ut;function Rr(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Vr(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Vr(i){const t=new ut,e=Gr;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(U(i.getAttribute("x")),U(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 a=s.indexOf("("),c=s.length;if(a>0&&a<c){const h=s.slice(0,a),o=dt(s.slice(a+1));switch(e.identity(),h){case"translate":if(o.length>=1){const l=o[0];let u=0;o.length>=2&&(u=o[1]),e.translate(l,u)}break;case"rotate":if(o.length>=1){let l=0,u=0,y=0;l=o[0]*Math.PI/180,o.length>=3&&(u=o[1],y=o[2]),ce.makeTranslation(-u,-y),fn.makeRotation(l),pn.multiplyMatrices(fn,ce),ce.makeTranslation(u,y),e.multiplyMatrices(ce,pn)}break;case"scale":o.length>=1&&e.scale(o[0],o[1]??o[0]);break;case"skewX":o.length===1&&e.set(1,Math.tan(o[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":o.length===1&&e.set(1,0,0,Math.tan(o[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":o.length===6&&e.set(o[0],o[2],o[4],o[1],o[3],o[5],0,0,1);break}}t.premultiply(e)}}return t}function Hr(i){return new ft().addPath(new he().absarc(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("r")||0),0,Math.PI*2))}function zr(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 a=Object.fromEntries(Object.entries(n.style).filter(([,c])=>c!==""));t[r[s]]=Object.assign(t[r[s]]||{},a)}}}function Wr(i){return new ft().addPath(new he().absellipse(U(i.getAttribute("cx")||0),U(i.getAttribute("cy")||0),U(i.getAttribute("rx")||0),U(i.getAttribute("ry")||0),0,Math.PI*2))}function kr(i){return new ft().moveTo(U(i.getAttribute("x1")||0),U(i.getAttribute("y1")||0)).lineTo(U(i.getAttribute("x2")||0),U(i.getAttribute("y2")||0))}function Xr(i){const t=new ft,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const qr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function jr(i){var n;const t=new ft;let e=0;return(n=i.getAttribute("points"))==null||n.replace(qr,(r,s,a)=>{const c=U(s),h=U(a);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!0,t}const Yr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Kr(i){var n;const t=new ft;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Yr,(r,s,a)=>{const c=U(s),h=U(a);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!1,t}function Qr(i){const t=U(i.getAttribute("x")||0),e=U(i.getAttribute("y")||0),n=U(i.getAttribute("rx")||i.getAttribute("ry")||0),r=U(i.getAttribute("ry")||i.getAttribute("rx")||0),s=U(i.getAttribute("width")),a=U(i.getAttribute("height")),c=1-.551915024494,h=new ft;return h.moveTo(t+n,e),h.lineTo(t+s-n,e),(n!==0||r!==0)&&h.bezierCurveTo(t+s-n*c,e,t+s,e+r*c,t+s,e+r),h.lineTo(t+s,e+a-r),(n!==0||r!==0)&&h.bezierCurveTo(t+s,e+a-r*c,t+s-n*c,e+a,t+s-n,e+a),h.lineTo(t+n,e+a),(n!==0||r!==0)&&h.bezierCurveTo(t+n*c,e+a,t,e+a-r*c,t,e+a-r),h.lineTo(t,e+r),(n!==0||r!==0)&&h.bezierCurveTo(t,e+r*c,t+n*c,e,t+n,e),h}function mt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,o){o===void 0&&(o=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(c)&&(t[h]=o(i.getAttribute(c))),n[c]&&(t[h]=o(n[c])),i.style&&i.style[c]!==""&&(t[h]=o(i.style[c]))}function s(c){return Math.max(0,Math.min(1,U(c)))}function a(c){return Math.max(0,U(c))}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",a),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("visibility","visibility"),t}function Oe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=mt(i,t,s);break;case"style":zr(i,s);break;case"g":t=mt(i,t,s);break;case"path":t=mt(i,t,s),i.hasAttribute("d")&&(r=Xr(i));break;case"rect":t=mt(i,t,s),r=Qr(i);break;case"polygon":t=mt(i,t,s),r=jr(i);break;case"polyline":t=mt(i,t,s),r=Kr(i);break;case"circle":t=mt(i,t,s),r=Hr(i);break;case"ellipse":t=mt(i,t,s),r=Wr(i);break;case"line":t=mt(i,t,s),r=kr(i);break;case"defs":n=!0;break;case"use":{t=mt(i,t,s);const y=(i.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),g=(l=i.viewportElement)==null?void 0:l.getElementById(y);g?Oe(g,t,e):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}const a=new ut,c=[],h=Rr(i,a,c);r&&(r.transform(a),e.push(r),r.userData={node:i,style:t});const o=i.childNodes;for(let u=0,y=o.length;u<y;u++){const g=o[u];n&&g.nodeName!=="style"&&g.nodeName!=="defs"||Oe(g,t,e)}return h&&(c.pop(),c.length>0?a.copy(c[c.length-1]):a.identity()),e}const yn="data:image/svg+xml;",gn=`${yn}base64,`,dn=`${yn}charset=utf8,`;function mn(i){if(typeof i=="string"){let t;return i.startsWith(gn)?(i=i.substring(gn.length,i.length),t=atob(i)):i.startsWith(dn)?(i=i.substring(dn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Zr(i){return Oe(mn(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}class Ft{constructor(t){this._text=t}}class Jr extends Ft{deform(){}}function Ae(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:a,stops:c}=ti(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(n,r,s,a);return c.forEach(o=>h.addColorStop(o.offset,o.color)),h}return t}function le(i,t,e){i!=null&&i.color&&(i.color=Ae(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=Ae(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=Ae(e,i.textStrokeColor,t))}function ti(i,t,e,n,r){var g;const s=((g=i.match(/linear-gradient\((.+)\)$/))==null?void 0:g[1])??"",a=s.split(",")[0],c=a.includes("deg")?a:"0deg",h=s.replace(c,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(c.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(h).map(d=>{let m=d[2];return m.startsWith("(")?m=m.split(",").length>3?`rgba${m}`:`rgb${m}`:m=`#${m}`,{offset:Number(d[3].replace("%",""))/100,color:m}})}}function vn(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)??{},a=i.color??s.fill??"none",c=i.textStrokeColor??s.stroke??"none";t.fillStyle=a!=="none"?a:"#000",t.strokeStyle=c!=="none"?c:"#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 h=(i.offsetX??0)*n,o=(i.offsetY??0)*n;t.translate(h,o),r.drawTo(t),a!=="none"&&t.fill(),c!=="none"&&t.stroke(),t.restore()})}class ei extends Ft{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(a=>{const c=(a.offsetX??0)*s,h=(a.offsetY??0)*s,o=(a.shadowOffsetX??0)*s,l=(a.shadowOffsetY??0)*s,u=Math.max(.1,a.textStrokeWidth??0)*s,y=r.boundingBox.clone();y.left+=c+o-u,y.top+=h+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(a=>{le(a,s,e)}),r.forEach(a=>{n.forEach(c=>{a.drawTo(e,c)})})),this}}class ni extends Ft{constructor(){super(...arguments);G(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new L;const e=w.MAX,n=w.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,style:n}=this._text,r=n.fontSize;let s;const a=[];let c;e.forEach(h=>{const o=h.parent.highlight;o!=null&&o.url&&((c==null?void 0:c.url)===o.url?s.push(h):(s=[],s.push(h),a.push(s))),c=o}),this.paths=a.filter(h=>h.length).map(h=>({url:h[0].parent.highlight.url,box:L.from(...h.map(o=>o.glyphBox)),baseline:Math.max(...h.map(o=>o.baseline))})).map(h=>this._parseGroup(h,r)).flat()}_parseSvg(e){const n=mn(e),r=Zr(n),s=w.MAX,a=w.MIN;r.forEach(y=>y.getMinMax(s,a));const{x:c,y:h,width:o,height:l}=new L(s.x,s.y,a.x-s.x,a.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new L(c,h,o,l),viewBox:new L(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:a}=e,{box:c,viewBox:h,paths:o}=this._parseSvg(r),l=[],u=c.height/h.height>.3?0:1;if(u===0){const y={x:s.left-n*.2,y:s.top},g=(s.width+n*.2*2)/c.width,d=s.height/c.height,m=new ut().translate(-c.x,-c.y).scale(g,d).translate(y.x,y.y);o.forEach(v=>{l.push(v.clone().transform(m))})}else if(u===1){const y=n/c.width*2,g=c.width*y,d=Math.ceil(s.width/g),m=g*d,v={x:s.left+(s.width-m)/2+n*.1,y:s.top+a+n*.1},x=new ut().translate(-c.x,-c.y).scale(y,y).translate(v.x,v.y);for(let _=0;_<d;_++){const b=x.clone().translate(_*g,0);o.forEach(M=>{l.push(M.clone().transform(b))})}}return l}draw({ctx:e}){return vn({ctx:e,paths:this.paths,fontSize:this._text.style.fontSize,fill:!1}),this}}class ri 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,style:e}=this._text,n=document.createDocumentFragment(),r=document.createElement("div");Object.assign(r.style,this._styleToDomStyle(e)),r.style.position="absolute",r.style.visibility="hidden";const s=document.createElement("ul");return s.style.listStyle="none",s.style.padding="0",s.style.margin="0",t.forEach(a=>{const c=document.createElement("li"),h=document.createElement("div");Object.assign(c.style,this._styleToDomStyle(a.style)),a.fragments.forEach(o=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(o.style)),l.appendChild(document.createTextNode(o.content)),h.appendChild(l)}),s.appendChild(c),c.appendChild(h)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var a;return(a=r.parentNode)==null?void 0:a.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,a)=>{const c=s.getBoundingClientRect();e.push({paragraphIndex:a,left:c.left,top:c.top,width:c.width,height:c.height}),s.querySelectorAll("span").forEach((h,o)=>{var y;const l=s.getBoundingClientRect();n.push({paragraphIndex:a,fragmentIndex:o,left:l.left,top:l.top,width:l.width,height:l.height});const u=h.firstChild;if(u instanceof window.Text){const g=document.createRange();g.selectNodeContents(u);const d=u.data?u.data.length:0;let m=0;for(;m<=d;){g.setStart(u,Math.max(m-1,0)),g.setEnd(u,m);const v=((y=g.getClientRects)==null?void 0:y.call(g))??[g.getBoundingClientRect()];let x=v[v.length-1];v.length>1&&x.width<2&&(x=v[v.length-2]);const _=g.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:a,fragmentIndex:o,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.width,textWidth:-1,textHeight:-1}),m++}}})}),{paragraphs:e,fragments:n,characters:r}}measureDom(t){const e=this._text.paragraphs,n=t.getBoundingClientRect(),r=t.querySelector("ul"),s=window.getComputedStyle(t).writingMode.includes("vertical"),a=r.style.lineHeight;r.style.lineHeight="4000px";const c=[[]];let h=c[0];const{characters:o}=this._measureDom(t);o.length>0&&(h.push(o[0]),o.reduce((g,d)=>{const m=s?"left":"top";return Math.abs(d[m]-g[m])>4e3/2&&(h=[],c.push(h)),h.push(d),d})),r.style.lineHeight=a;const l=this._measureDom(t);l.paragraphs.forEach(g=>{const d=e[g.paragraphIndex];d.boundingBox.left=g.left,d.boundingBox.top=g.top,d.boundingBox.width=g.width,d.boundingBox.height=g.height}),l.fragments.forEach(g=>{const d=e[g.paragraphIndex].fragments[g.fragmentIndex];d.boundingBox.left=g.left,d.boundingBox.top=g.top,d.boundingBox.width=g.width,d.boundingBox.height=g.height});const u=[];let y=0;return c.forEach(g=>{g.forEach(d=>{const m=l.characters[y],{paragraphIndex:v,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:v,textWidth:d.width,textHeight:d.height,left:m.left-n.left,top:m.top-n.top});const b=e[v].fragments[x].characters[_];b.boundingBox.left=u[y].left,b.boundingBox.top=u[y].top,b.boundingBox.width=u[y].width,b.boundingBox.height=u[y].height,b.textWidth=u[y].textWidth,b.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}}var K=Uint8Array,at=Uint16Array,$e=Int32Array,ue=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]),fe=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]),Ie=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wn=function(i,t){for(var e=new at(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new $e(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}},bn=wn(ue,2),xn=bn.b,Le=bn.r;xn[28]=258,Le[258]=28;for(var _n=wn(fe,0),ii=_n.b,Mn=_n.r,De=new at(32768),F=0;F<32768;++F){var Pt=(F&43690)>>1|(F&21845)<<1;Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,De[F]=((Pt&65280)>>8|(Pt&255)<<8)>>1}for(var vt=function(i,t,e){for(var n=i.length,r=0,s=new at(t);r<n;++r)i[r]&&++s[i[r]-1];var a=new at(t);for(r=1;r<t;++r)a[r]=a[r-1]+s[r-1]<<1;var c;if(e){c=new at(1<<t);var h=15-t;for(r=0;r<n;++r)if(i[r])for(var o=r<<4|i[r],l=t-i[r],u=a[i[r]-1]++<<l,y=u|(1<<l)-1;u<=y;++u)c[De[u]>>h]=o}else for(c=new at(n),r=0;r<n;++r)i[r]&&(c[r]=De[a[i[r]-1]++]>>15-i[r]);return c},Ct=new K(288),F=0;F<144;++F)Ct[F]=8;for(var F=144;F<256;++F)Ct[F]=9;for(var F=256;F<280;++F)Ct[F]=7;for(var F=280;F<288;++F)Ct[F]=8;for(var zt=new K(32),F=0;F<32;++F)zt[F]=5;var si=vt(Ct,9,0),oi=vt(Ct,9,1),ai=vt(zt,5,0),hi=vt(zt,5,1),Ee=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},yt=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},Ue=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Fe=function(i){return(i+7)/8|0},Sn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new K(i.subarray(t,e))},ci=["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"],gt=function(i,t,e){var n=new Error(t||ci[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,gt),!e)throw n;return n},li=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new K(0);var a=!e,c=a||t.i!=2,h=t.i;a&&(e=new K(r*3));var o=function(re){var ie=e.length;if(re>ie){var Ht=new K(Math.max(ie*2,re));Ht.set(e),e=Ht}},l=t.f||0,u=t.p||0,y=t.b||0,g=t.l,d=t.d,m=t.m,v=t.n,x=r*8;do{if(!g){l=yt(i,u,1);var _=yt(i,u+1,3);if(u+=3,_)if(_==1)g=oi,d=hi,m=9,v=5;else if(_==2){var A=yt(i,u,31)+257,$=yt(i,u+10,15)+4,C=A+yt(i,u+5,31)+1;u+=14;for(var S=new K(C),D=new K(19),B=0;B<$;++B)D[Ie[B]]=yt(i,u+B*3,7);u+=$*3;for(var z=Ee(D),V=(1<<z)-1,X=vt(D,z,1),B=0;B<C;){var q=X[yt(i,u,V)];u+=q&15;var b=q>>4;if(b<16)S[B++]=b;else{var W=0,O=0;for(b==16?(O=3+yt(i,u,3),u+=2,W=S[B-1]):b==17?(O=3+yt(i,u,7),u+=3):b==18&&(O=11+yt(i,u,127),u+=7);O--;)S[B++]=W}}var E=S.subarray(0,A),I=S.subarray(A);m=Ee(E),v=Ee(I),g=vt(E,m,1),d=vt(I,v,1)}else gt(1);else{var b=Fe(u)+4,M=i[b-4]|i[b-3]<<8,T=b+M;if(T>r){h&&gt(0);break}c&&o(y+M),e.set(i.subarray(b,T),y),t.b=y+=M,t.p=u=T*8,t.f=l;continue}if(u>x){h&&gt(0);break}}c&&o(y+131072);for(var Y=(1<<m)-1,H=(1<<v)-1,pt=u;;pt=u){var W=g[Ue(i,u)&Y],ct=W>>4;if(u+=W&15,u>x){h&&gt(0);break}if(W||gt(2),ct<256)e[y++]=ct;else if(ct==256){pt=u,g=null;break}else{var lt=ct-254;if(ct>264){var B=ct-257,N=ue[B];lt=yt(i,u,(1<<N)-1)+xn[B],u+=N}var xt=d[Ue(i,u)&H],Rt=xt>>4;xt||gt(3),u+=xt&15;var I=ii[Rt];if(Rt>3){var N=fe[Rt];I+=Ue(i,u)&(1<<N)-1,u+=N}if(u>x){h&&gt(0);break}c&&o(y+131072);var Vt=y+lt;if(y<I){var we=s-I,be=Math.min(I,Vt);for(we+y<0&&gt(3);y<be;++y)e[y]=n[we+y]}for(;y<Vt;++y)e[y]=e[y-I]}}t.l=g,t.p=pt,t.b=y,t.f=l,g&&(l=1,t.m=m,t.d=d,t.n=v)}while(!l);return y!=e.length&&a?Sn(e,0,y):e.subarray(0,y)},_t=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Wt=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},Be=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:On,l:0};if(r==1){var a=new K(e[0].s+1);return a[e[0].s]=1,{t:a,l:1}}e.sort(function(T,A){return T.f-A.f}),e.push({s:-1,f:25001});var c=e[0],h=e[1],o=0,l=1,u=2;for(e[0]={s:-1,f:c.f+h.f,l:c,r:h};l!=r-1;)c=e[e[o].f<e[u].f?o++:u++],h=e[o!=l&&e[o].f<e[u].f?o++:u++],e[l++]={s:-1,f:c.f+h.f,l:c,r:h};for(var y=s[0].s,n=1;n<r;++n)s[n].s>y&&(y=s[n].s);var g=new at(y+1),d=Ne(e[l-1],g,0);if(d>t){var n=0,m=0,v=d-t,x=1<<v;for(s.sort(function(A,$){return g[$.s]-g[A.s]||A.f-$.f});n<r;++n){var _=s[n].s;if(g[_]>t)m+=x-(1<<d-g[_]),g[_]=t;else break}for(m>>=v;m>0;){var b=s[n].s;g[b]<t?m-=1<<t-g[b]++-1:++n}for(;n>=0&&m;--n){var M=s[n].s;g[M]==t&&(--g[M],++m)}d=t}return{t:new K(g),l:d}},Ne=function(i,t,e){return i.s==-1?Math.max(Ne(i.l,t,e+1),Ne(i.r,t,e+1)):t[i.s]=e},Pn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new at(++t),n=0,r=i[0],s=1,a=function(h){e[n++]=h},c=1;c<=t;++c)if(i[c]==r&&c!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=i[c]}return{c:e.subarray(0,n),n:t}},kt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},Cn=function(i,t,e){var n=e.length,r=Fe(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},Tn=function(i,t,e,n,r,s,a,c,h,o,l){_t(t,l++,e),++r[256];for(var u=Be(r,15),y=u.t,g=u.l,d=Be(s,15),m=d.t,v=d.l,x=Pn(y),_=x.c,b=x.n,M=Pn(m),T=M.c,A=M.n,$=new at(19),C=0;C<_.length;++C)++$[_[C]&31];for(var C=0;C<T.length;++C)++$[T[C]&31];for(var S=Be($,7),D=S.t,B=S.l,z=19;z>4&&!D[Ie[z-1]];--z);var V=o+5<<3,X=kt(r,Ct)+kt(s,zt)+a,q=kt(r,y)+kt(s,m)+a+14+3*z+kt($,D)+2*$[16]+3*$[17]+7*$[18];if(h>=0&&V<=X&&V<=q)return Cn(t,l,i.subarray(h,h+o));var W,O,E,I;if(_t(t,l,1+(q<X)),l+=2,q<X){W=vt(y,g,0),O=y,E=vt(m,v,0),I=m;var Y=vt(D,B,0);_t(t,l,b-257),_t(t,l+5,A-1),_t(t,l+10,z-4),l+=14;for(var C=0;C<z;++C)_t(t,l+3*C,D[Ie[C]]);l+=3*z;for(var H=[_,T],pt=0;pt<2;++pt)for(var ct=H[pt],C=0;C<ct.length;++C){var lt=ct[C]&31;_t(t,l,Y[lt]),l+=D[lt],lt>15&&(_t(t,l,ct[C]>>5&127),l+=ct[C]>>12)}}else W=si,O=Ct,E=ai,I=zt;for(var C=0;C<c;++C){var N=n[C];if(N>255){var lt=N>>18&31;Wt(t,l,W[lt+257]),l+=O[lt+257],lt>7&&(_t(t,l,N>>23&31),l+=ue[lt]);var xt=N&31;Wt(t,l,E[xt]),l+=I[xt],xt>3&&(Wt(t,l,N>>5&8191),l+=fe[xt])}else Wt(t,l,W[N]),l+=O[N]}return Wt(t,l,W[256]),l+O[256]},ui=new $e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),On=new K(0),fi=function(i,t,e,n,r,s){var a=s.z||i.length,c=new K(n+a+5*(1+Math.ceil(a/7e3))+r),h=c.subarray(n,c.length-r),o=s.l,l=(s.r||0)&7;if(t){l&&(h[0]=s.r>>3);for(var u=ui[t-1],y=u>>13,g=u&8191,d=(1<<e)-1,m=s.p||new at(32768),v=s.h||new at(d+1),x=Math.ceil(e/3),_=2*x,b=function(Qe){return(i[Qe]^i[Qe+1]<<x^i[Qe+2]<<_)&d},M=new $e(25e3),T=new at(288),A=new at(32),$=0,C=0,S=s.i||0,D=0,B=s.w||0,z=0;S+2<a;++S){var V=b(S),X=S&32767,q=v[V];if(m[X]=q,v[V]=X,B<=S){var W=a-S;if(($>7e3||D>24576)&&(W>423||!o)){l=Tn(i,h,0,M,T,A,C,D,z,S-z,l),D=$=C=0,z=S;for(var O=0;O<286;++O)T[O]=0;for(var O=0;O<30;++O)A[O]=0}var E=2,I=0,Y=g,H=X-q&32767;if(W>2&&V==b(S-H))for(var pt=Math.min(y,W)-1,ct=Math.min(32767,S),lt=Math.min(258,W);H<=ct&&--Y&&X!=q;){if(i[S+E]==i[S+E-H]){for(var N=0;N<lt&&i[S+N]==i[S+N-H];++N);if(N>E){if(E=N,I=H,N>pt)break;for(var xt=Math.min(H,N-2),Rt=0,O=0;O<xt;++O){var Vt=S-H+O&32767,we=m[Vt],be=Vt-we&32767;be>Rt&&(Rt=be,q=Vt)}}}X=q,q=m[X],H+=X-q&32767}if(I){M[D++]=268435456|Le[E]<<18|Mn[I];var re=Le[E]&31,ie=Mn[I]&31;C+=ue[re]+fe[ie],++T[257+re],++A[ie],B=S+E,++$}else M[D++]=i[S],++T[i[S]]}}for(S=Math.max(S,B);S<a;++S)M[D++]=i[S],++T[i[S]];l=Tn(i,h,o,M,T,A,C,D,z,S-z,l),o||(s.r=l&7|h[l/8|0]<<3,l-=7,s.h=v,s.p=m,s.i=S,s.w=B)}else{for(var S=s.w||0;S<a+o;S+=65535){var Ht=S+65535;Ht>=a&&(h[l/8|0]=o,Ht=a),l=Cn(h,l+1,i.subarray(S,Ht))}s.i=a}return Sn(c,0,n+Fe(l)+r)},An=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,a=0;a!=s;){for(var c=Math.min(a+2655,s);a<c;++a)r+=n+=e[a];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}}},pi=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new K(s.length+i.length);a.set(s),a.set(i,s.length),i=a,r.w=s.length}return fi(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)},$n=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},yi=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=An();r.p(t.dictionary),$n(i,2,r.d())}},gi=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&gt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&gt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function di(i,t){t||(t={});var e=An();e.p(i);var n=pi(i,t,t.dictionary?6:2,4);return yi(n,t),$n(n,n.length-4,e.d()),n}function mi(i,t){return li(i.subarray(gi(i,t),-4),{i:2},t,t)}var vi=typeof TextDecoder<"u"&&new TextDecoder,wi=0;try{vi.decode(On,{stream:!0}),wi=1}catch{}const bi="modern-font";function Xt(i,t){if(!i)throw new Error(`[${bi}] ${t}`)}function xi(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 In=Object.defineProperty,_i=(i,t,e)=>t in i?In(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,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&In(t,e,r),r},Mi=(i,t,e)=>(_i(i,t+"",e),e);const pe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function Z(){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 j extends DataView{constructor(t,e,n,r){super(xi(t),e,n),this.littleEndian=r,Mi(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/,a=>a.toUpperCase())}`,s=this[r](e,n);return this.cursor+=pe[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/,c=>c.toUpperCase())}`,a=this[s](n,e,r);return this.cursor+=pe[t.toLowerCase()],a}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,a;r<s;++r)a=t.charCodeAt(r)||0,a>127?this.writeUint16(a):this.writeUint8(a);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}}Q([Z()],j.prototype,"readInt8"),Q([Z()],j.prototype,"readInt16"),Q([Z()],j.prototype,"readInt32"),Q([Z()],j.prototype,"readUint8"),Q([Z()],j.prototype,"readUint16"),Q([Z()],j.prototype,"readUint32"),Q([Z()],j.prototype,"readFloat32"),Q([Z()],j.prototype,"readFloat64"),Q([Z()],j.prototype,"writeInt8"),Q([Z()],j.prototype,"writeInt16"),Q([Z()],j.prototype,"writeInt32"),Q([Z()],j.prototype,"writeUint8"),Q([Z()],j.prototype,"writeUint16"),Q([Z()],j.prototype,"writeUint32"),Q([Z()],j.prototype,"writeFloat32"),Q([Z()],j.prototype,"writeFloat64");var Si=Object.defineProperty,Pi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ci=(i,t,e)=>(Pi(i,t+"",e),e);const Ln=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 a=Ln.get(r);a||(a={columns:[],byteLength:0},Ln.set(r,a));const c={...t,name:s,byteLength:e*pe[n],offset:t.offset??a.columns.reduce((h,o)=>h+o.byteLength,0)};a.columns.push(c),a.byteLength=a.columns.reduce((h,o)=>h+pe[o.type]*(o.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(c)},set(h){this.view.setColumn(c,h)},configurable:!0,enumerable:!0})}}class wt{constructor(t,e,n,r){Ci(this,"view"),this.view=new j(t,e,n,r)}}function Ti(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 ye(i){i=Ti(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 Oi(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 Ai(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 $i=Object.defineProperty,Ii=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Li=(i,t,e)=>(Ii(i,t+"",e),e);class ge extends wt{constructor(){super(...arguments),Li(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 Dn=Object.defineProperty,Di=(i,t,e)=>t in i?Dn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Dn(t,e,r),r},Ei=(i,t,e)=>(Di(i,t+"",e),e);const J=class tr extends ge{constructor(){super(...arguments),Ei(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=ye(r.fontFamily||""),a=s.length,c=ye(r.fontStyle||""),h=c.length,o=ye(r.version||""),l=o.length,u=ye(r.fullName||""),y=u.length,g=86+a+4+h+4+l+4+y+2+t.view.byteLength,d=new tr(new ArrayBuffer(g),0,g,!0);d.EOTSize=d.view.byteLength,d.FontDataSize=t.view.byteLength,d.Version=131073,d.Flags=0,d.Charset=1,d.MagicNumber=20556,d.Padding1=0,d.CheckSumAdjustment=e.head.checkSumAdjustment;const m=e.os2;return m&&(d.FontPANOSE=m.fontPANOSE,d.Italic=m.fsSelection,d.Weight=m.usWeightClass,d.fsType=m.fsType,d.UnicodeRange=m.ulUnicodeRange,d.CodePageRange=m.ulCodePageRange),d.view.writeUint16(a),d.view.writeBytes(s),d.view.writeUint16(0),d.view.writeUint16(h),d.view.writeBytes(c),d.view.writeUint16(0),d.view.writeUint16(l),d.view.writeBytes(o),d.view.writeUint16(0),d.view.writeUint16(y),d.view.writeBytes(u),d.view.writeUint16(0),d.view.writeUint16(0),d.view.writeBytes(t.view),d}};nt([p("uint32")],J.prototype,"EOTSize"),nt([p("uint32")],J.prototype,"FontDataSize"),nt([p("uint32")],J.prototype,"Version"),nt([p("uint32")],J.prototype,"Flags"),nt([p({type:"uint8",size:10})],J.prototype,"FontPANOSE"),nt([p("uint8")],J.prototype,"Charset"),nt([p("uint8")],J.prototype,"Italic"),nt([p("uint32")],J.prototype,"Weight"),nt([p("uint16")],J.prototype,"fsType"),nt([p("uint16")],J.prototype,"MagicNumber"),nt([p({type:"uint8",size:16})],J.prototype,"UnicodeRange"),nt([p({type:"uint8",size:8})],J.prototype,"CodePageRange"),nt([p("uint32")],J.prototype,"CheckSumAdjustment"),nt([p({type:"uint8",size:16})],J.prototype,"Reserved"),nt([p("uint16")],J.prototype,"Padding1");let Ui=J;var Fi=Object.defineProperty,de=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Fi(t,e,r),r};class Bt extends wt{constructor(t,e){super(t,e,16)}}de([p({type:"char",size:4})],Bt.prototype,"tag"),de([p("uint32")],Bt.prototype,"checkSum"),de([p("uint32")],Bt.prototype,"offset"),de([p("uint32")],Bt.prototype,"length");var Bi=Object.defineProperty,me=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Bi(t,e,r),r};const qt=class er extends wt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new er;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}};me([p("uint16")],qt.prototype,"format"),me([p("uint16")],qt.prototype,"length"),me([p("uint16")],qt.prototype,"language"),me([p({type:"uint8",size:256})],qt.prototype,"glyphIndexArray");let Ge=qt;var Ni=Object.defineProperty,Re=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Ni(t,e,r),r};class jt extends wt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,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,a=this.glyphIndexArray,c=n.findIndex(o=>o===r);let h=0;for(let o=0;o<256;o++)if(n[o]===0)o>=c||o<s[0].firstCode||o>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(o-s[0].firstCode)>=a.length?h=0:(h=a[s[0].idRangeOffset+(o-s[0].firstCode)],h!==0&&(h=h+s[0].idDelta)),h!==0&&h<t&&e.set(o,h);else{const l=n[o];for(let u=0,y=s[l].entryCount;u<y;u++)if(s[l].idRangeOffset+u>=a.length?h=0:(h=a[s[l].idRangeOffset+u],h!==0&&(h=h+s[l].idDelta)),h!==0&&h<t){const g=(o<<8|u+s[l].firstCode)%65535;e.set(g,h)}}return e}}Re([p("uint16")],jt.prototype,"format"),Re([p("uint16")],jt.prototype,"length"),Re([p("uint16")],jt.prototype,"language");function En(i){return i>32767?i-65536:i<-32767?i+65536:i}function Ve(i,t){let e;const n=[];let r={};return i.forEach((s,a)=>{t&&a>t||((!e||a!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:a,startId:s,delta:En(s-a)}):(r.start=Number(a),r.startId=s,r.delta=En(s-a))),e={unicode:a,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var Gi=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Gi(t,e,r),r};const Tt=class nr extends wt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(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=Ve(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,a=new nr(new ArrayBuffer(24+e.length*8));return a.format=4,a.length=a.view.byteLength,a.language=0,a.segCountX2=n*2,a.searchRange=s,a.entrySelector=r,a.rangeShift=2*n-s,a.endCode=[...e.map(c=>c.end),65535],a.reservedPad=0,a.startCode=[...e.map(c=>c.start),65535],a.idDelta=[...e.map(c=>c.delta),1],a.idRangeOffset=Array.from({length:n},()=>0),a}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,a=this.idRangeOffset,c=this.idDelta,h=this.glyphIndexArray;for(let o=0;o<e;++o)for(let l=r[o],u=s[o];l<=u;++l)if(a[o]===0)t.set(l,(l+c[o])%65536);else{const y=o+a[o]/2+(l-r[o])-n,g=h[y];g!==0?t.set(l,(g+c[o])%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 He=Tt;var Ri=Object.defineProperty,Yt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Ri(t,e,r),r};class It extends wt{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}}Yt([p("uint16")],It.prototype,"format"),Yt([p("uint16")],It.prototype,"length"),Yt([p("uint16")],It.prototype,"language"),Yt([p("uint16")],It.prototype,"firstCode"),Yt([p("uint16")],It.prototype,"entryCount");var Vi=Object.defineProperty,Kt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Vi(t,e,r),r};const Nt=class rr extends wt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Ve(t),n=new rr(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 a=s.startGlyphCode,c=s.startCharCode;const h=s.endCharCode;for(;c<=h;)t.set(c++,a++)}return t}};Kt([p("uint16")],Nt.prototype,"format"),Kt([p("uint16")],Nt.prototype,"reserved"),Kt([p("uint32")],Nt.prototype,"length"),Kt([p("uint32")],Nt.prototype,"language"),Kt([p("uint32")],Nt.prototype,"nGroups");let ze=Nt;var Hi=Object.defineProperty,We=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Hi(t,e,r),r};class Qt extends wt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const 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(a=>{t.set(a.unicodeValue,a.glyphID)})}return t}}We([p("uint16")],Qt.prototype,"format"),We([p("uint32")],Qt.prototype,"length"),We([p("uint32")],Qt.prototype,"numVarSelectorRecords");var zi=Object.defineProperty,Wi=(i,t,e)=>t in i?zi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ke=(i,t,e)=>(Wi(i,typeof t!="symbol"?t+"":t,e),e);function tt(i,t=i){return e=>{Zt.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(Zt.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const Un=class se{constructor(t){ke(this,"tables",new Map),ke(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}),a=e.get(0);for(let c=0;c<r;c+=1)s[c]=e.get(n[c])||a;return s}getPathCommands(t,e,n,r,s){var a;return(a=this.charToGlyph(t))==null?void 0:a.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={},a){const c=1/this.unitsPerEm*r,h=this.textToGlyphs(t);for(let o=0;o<h.length;o+=1){const l=h[o];a.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*c),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new se(this.tableViews)}delete(t){const e=se.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=se.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=se.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}};ke(Un,"tableDefinitions",new Map);let Zt=Un;class rt extends wt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var Fn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Xi=(i,t,e)=>t in i?Fn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e,n)=>{for(var r=n>1?void 0:n?ki(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Fn(t,e,r),r},qi=(i,t,e)=>(Xi(i,t+"",e),e);f.Cmap=class extends rt{constructor(){super(...arguments),qi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=He.from(t),r=Ge.from(t),s=e?ze.from(t):void 0,a=4+(s?32:24),c=a+n.view.byteLength,h=c+r.view.byteLength,o=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:c},{platformID:3,platformSpecificID:1,offset:a},s&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*o.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=o.length,l.view.seek(4),o.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,c),s&&l.view.writeBytes(s.view,h),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 Ge(this.view.buffer,e.offset);break;case 2:r=new jt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new He(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 ze(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Qt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var c,h,o,l,u;const t=this._getSubtables(),e=(c=t.find(y=>y.format===0))==null?void 0:c.view,n=(h=t.find(y=>y.platformID===3&&y.platformSpecificID===3&&y.format===2))==null?void 0:h.view,r=(o=t.find(y=>y.platformID===3&&y.platformSpecificID===1&&y.format===4))==null?void 0:o.view,s=(l=t.find(y=>y.platformID===3&&y.platformSpecificID===10&&y.format===12))==null?void 0:l.view,a=(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())??[],...(a==null?void 0:a.getUnicodeGlyphIndexMap())??[]])}},Xe([p("uint16")],f.Cmap.prototype,"version",2),Xe([p("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Xe([tt("cmap")],f.Cmap);var ji=Object.defineProperty,Yi=(i,t,e)=>t in i?ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t,e)=>(Yi(i,t+"",e),e);class Bn{constructor(t){Ki(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 Xt(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],a={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(a)}return n}_parseGlyphCoordinate(t,e,n,r,s){let a;return(e&r)>0?(a=t.view.readUint8(),e&s||(a=-a),a=n+a):(e&s)>0?a=n:a=n+t.view.readInt16(),a}_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 c=this.endPointIndices=[];for(let m=0;m<r;m++)c.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();Xt(h<5e3,`Bad instructionLength:${h}`);const o=this.instructions=[];for(let m=0;m<h;++m)o.push(t.view.readUint8());const l=t.view.byteOffset,u=c[c.length-1]+1;Xt(u<2e4,`Bad numberOfCoordinates:${l}`);const y=[];let g,d=0;for(;d<u;)if(g=t.view.readUint8(),y.push(g),d++,g&8&&d<u){const m=t.view.readUint8();for(let v=0;v<m;v++)y.push(g),d++}if(Xt(y.length===u,`Bad flags length: ${y.length}, numberOfCoordinates: ${u}`),c.length>0){const m=[];let v;if(u>0){for(let b=0;b<u;b+=1)g=y[b],v={},v.onCurve=!!(g&1),v.lastPointOfContour=c.includes(b),m.push(v);let x=0;for(let b=0;b<u;b+=1)g=y[b],v=m[b],v.x=this._parseGlyphCoordinate(t,g,x,2,16),x=v.x;let _=0;for(let b=0;b<u;b+=1)g=y[b],v=m[b],v.y=this._parseGlyphCoordinate(t,g,_,4,32),_=v.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let c,h=!0;for(;h;){c=t.view.readUint16();const o={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(c&1)>0?(c&2)>0?(o.dx=t.view.readInt16(),o.dy=t.view.readInt16()):o.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(c&2)>0?(o.dx=t.view.readInt8(),o.dy=t.view.readInt8()):o.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(c&8)>0?o.xScale=o.yScale=t.view.readInt16()/16384:(c&64)>0?(o.xScale=t.view.readInt16()/16384,o.yScale=t.view.readInt16()/16384):(c&128)>0&&(o.xScale=t.view.readInt16()/16384,o.scale01=t.view.readInt16()/16384,o.scale10=t.view.readInt16()/16384,o.yScale=t.view.readInt16()/16384),this.components.push(o),h=!!(c&32)}if(c&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let o=0;o<this.instructionLength;o+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let c=0;c<this.components.length;c+=1){const h=this.components[c],o=n.get(h.glyphIndex);if(o.getPathCommands(),o.points){let l;if(h.matchedPoints===void 0)l=this._transformPoints(o.points,h);else{Xt(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>o.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let y=o.points[h.matchedPoints[1]];const g={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.yScale,dx:0,dy:0};y=this._transformPoints([y],g)[0],g.dx=u.x-y.x,g.dy=u.y-y.y,l=this._transformPoints(o.points,g)}this.points=this.points.concat(l)}}const s=[],a=this._parseContours(this.points);for(let c=0,h=a.length;c<h;++c){const o=a[c];let l=o[o.length-1],u=o[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,g=o.length;y<g;++y)if(l=u,u=o[(y+1)%g],l.onCurve)s.push({type:"L",x:l.x,y:l.y});else{let d=u;u.onCurve||(d={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}),s.push({type:"Q",x1:l.x,y1:l.y,x:d.x,y:d.y})}s.push({type:"Z"})}this.pathCommands=s}getPathCommands(t=0,e=0,n=72,r={},s){const a=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:c=a,yScale:h=a}=r,o=this.pathCommands,l=[];for(let u=0,y=o.length;u<y;u+=1){const g=o[u];g.type==="M"?l.push({type:"M",x:t+g.x*c,y:e+-g.y*h}):g.type==="L"?l.push({type:"L",x:t+g.x*c,y:e+-g.y*h}):g.type==="Q"?l.push({type:"Q",x1:t+g.x1*c,y1:e+-g.y1*h,x:t+g.x*c,y:e+-g.y*h}):g.type==="Z"&&l.push({type:"Z"})}return l}}var Qi=Object.defineProperty,Zi=(i,t,e)=>t in i?Qi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ji=(i,t,e)=>(Zi(i,t+"",e),e);class Nn{constructor(t){this._sfnt=t,Ji(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,a=s[t],c=r[t];a&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),c!==r[t+1]&&n._parse(this._sfnt.glyf,c,this),this._items[t]=n}return n}}var Gn=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,es=(i,t,e)=>t in i?Gn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ns=(i,t,e,n)=>{for(var r=n>1?void 0:n?ts(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Gn(t,e,r),r},rs=(i,t,e)=>(es(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 rt{constructor(){super(...arguments),rs(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 Nn(this._sfnt)),this._glyphs}},f.Glyf=ns([tt("glyf")],f.Glyf);var is=Object.defineProperty,ss=Object.getOwnPropertyDescriptor,os=(i,t,e,n)=>{for(var r=n>1?void 0:n?ss(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&is(t,e,r),r};f.Gpos=class extends rt{},f.Gpos=os([tt("GPOS","gpos")],f.Gpos);var as=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,Lt=(i,t,e,n)=>{for(var r=n>1?void 0:n?hs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&as(t,e,r),r};f.Gsub=class extends rt{},Lt([p("uint16")],f.Gsub.prototype,"majorVersion",2),Lt([p("uint16")],f.Gsub.prototype,"minorVersion",2),Lt([p("uint16")],f.Gsub.prototype,"scriptListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"featureListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"lookupListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Lt([tt("GSUB","gsub")],f.Gsub);var cs=Object.defineProperty,ls=Object.getOwnPropertyDescriptor,k=(i,t,e,n)=>{for(var r=n>1?void 0:n?ls(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&cs(t,e,r),r};f.Head=class extends rt{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},k([p("fixed")],f.Head.prototype,"version",2),k([p("fixed")],f.Head.prototype,"fontRevision",2),k([p("uint32")],f.Head.prototype,"checkSumAdjustment",2),k([p("uint32")],f.Head.prototype,"magickNumber",2),k([p("uint16")],f.Head.prototype,"flags",2),k([p("uint16")],f.Head.prototype,"unitsPerEm",2),k([p({type:"longDateTime"})],f.Head.prototype,"created",2),k([p({type:"longDateTime"})],f.Head.prototype,"modified",2),k([p("int16")],f.Head.prototype,"xMin",2),k([p("int16")],f.Head.prototype,"yMin",2),k([p("int16")],f.Head.prototype,"xMax",2),k([p("int16")],f.Head.prototype,"yMax",2),k([p("uint16")],f.Head.prototype,"macStyle",2),k([p("uint16")],f.Head.prototype,"lowestRecPPEM",2),k([p("int16")],f.Head.prototype,"fontDirectionHint",2),k([p("int16")],f.Head.prototype,"indexToLocFormat",2),k([p("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=k([tt("head")],f.Head);var us=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,it=(i,t,e,n)=>{for(var r=n>1?void 0:n?fs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&us(t,e,r),r};f.Hhea=class extends rt{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},it([p("fixed")],f.Hhea.prototype,"version",2),it([p("int16")],f.Hhea.prototype,"ascent",2),it([p("int16")],f.Hhea.prototype,"descent",2),it([p("int16")],f.Hhea.prototype,"lineGap",2),it([p("uint16")],f.Hhea.prototype,"advanceWidthMax",2),it([p("int16")],f.Hhea.prototype,"minLeftSideBearing",2),it([p("int16")],f.Hhea.prototype,"minRightSideBearing",2),it([p("int16")],f.Hhea.prototype,"xMaxExtent",2),it([p("int16")],f.Hhea.prototype,"caretSlopeRise",2),it([p("int16")],f.Hhea.prototype,"caretSlopeRun",2),it([p("int16")],f.Hhea.prototype,"caretOffset",2),it([p({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),it([p("int16")],f.Hhea.prototype,"metricDataFormat",2),it([p("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=it([tt("hhea")],f.Hhea);var Rn=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ys=(i,t,e)=>t in i?Rn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gs=(i,t,e,n)=>{for(var r=n>1?void 0:n?ps(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Rn(t,e,r),r},ds=(i,t,e)=>(ys(i,t+"",e),e);f.Hmtx=class extends rt{constructor(){super(...arguments),ds(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=gs([tt("hmtx")],f.Hmtx);var ms=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,ws=(i,t,e,n)=>{for(var r=n>1?void 0:n?vs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&ms(t,e,r),r};f.Kern=class extends rt{},f.Kern=ws([tt("kern","kern")],f.Kern);var Vn=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,xs=(i,t,e)=>t in i?Vn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_s=(i,t,e,n)=>{for(var r=n>1?void 0:n?bs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Vn(t,e,r),r},Ms=(i,t,e)=>(xs(i,t+"",e),e);f.Loca=class extends rt{constructor(){super(...arguments),Ms(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=_s([tt("loca")],f.Loca);var Ss=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,et=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ps(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Ss(t,e,r),r};f.Maxp=class extends rt{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},et([p("fixed")],f.Maxp.prototype,"version",2),et([p("uint16")],f.Maxp.prototype,"numGlyphs",2),et([p("uint16")],f.Maxp.prototype,"maxPoints",2),et([p("uint16")],f.Maxp.prototype,"maxContours",2),et([p("uint16")],f.Maxp.prototype,"maxComponentPoints",2),et([p("uint16")],f.Maxp.prototype,"maxComponentContours",2),et([p("uint16")],f.Maxp.prototype,"maxZones",2),et([p("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),et([p("uint16")],f.Maxp.prototype,"maxStorage",2),et([p("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),et([p("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),et([p("uint16")],f.Maxp.prototype,"maxStackElements",2),et([p("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),et([p("uint16")],f.Maxp.prototype,"maxComponentElements",2),et([p("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=et([tt("maxp")],f.Maxp);var Cs=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ts(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Cs(t,e,r),r};const Hn={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"},qe={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Os={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},zn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends rt{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let h=0;h<t;++h){const o=e[h];o.name=this.view.readBytes(n+o.offset,o.length)}let r=qe.Macintosh,s=Os.Default,a=0;e.some(h=>h.platform===qe.Microsoft&&h.encoding===zn.UCS2&&h.language===1033)&&(r=qe.Microsoft,s=zn.UCS2,a=1033);const c={};for(let h=0;h<t;++h){const o=e[h];o.platform===r&&o.encoding===s&&o.language===a&&Hn[o.nameId]&&(c[Hn[o.nameId]]=a===0?Oi(o.name):Ai(o.name))}return c}},ve([p("uint16")],f.Name.prototype,"format",2),ve([p("uint16")],f.Name.prototype,"count",2),ve([p("uint16")],f.Name.prototype,"stringOffset",2),f.Name=ve([tt("name")],f.Name);var As=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,P=(i,t,e,n)=>{for(var r=n>1?void 0:n?$s(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&As(t,e,r),r};f.Os2=class extends rt{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([tt("OS/2","os2")],f.Os2);var Is=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,bt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ls(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Is(t,e,r),r};f.Post=class extends rt{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},bt([p("fixed")],f.Post.prototype,"format",2),bt([p("fixed")],f.Post.prototype,"italicAngle",2),bt([p("int16")],f.Post.prototype,"underlinePosition",2),bt([p("int16")],f.Post.prototype,"underlineThickness",2),bt([p("uint32")],f.Post.prototype,"isFixedPitch",2),bt([p("uint32")],f.Post.prototype,"minMemType42",2),bt([p("uint32")],f.Post.prototype,"maxMemType42",2),bt([p("uint32")],f.Post.prototype,"minMemType1",2),bt([p("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=bt([tt("post")],f.Post);var Ds=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,st=(i,t,e,n)=>{for(var r=n>1?void 0:n?Es(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Ds(t,e,r),r};f.Vhea=class extends rt{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},st([p("fixed")],f.Vhea.prototype,"version",2),st([p("int16")],f.Vhea.prototype,"vertTypoAscender",2),st([p("int16")],f.Vhea.prototype,"vertTypoDescender",2),st([p("int16")],f.Vhea.prototype,"vertTypoLineGap",2),st([p("int16")],f.Vhea.prototype,"advanceHeightMax",2),st([p("int16")],f.Vhea.prototype,"minTopSideBearing",2),st([p("int16")],f.Vhea.prototype,"minBottomSideBearing",2),st([p("int16")],f.Vhea.prototype,"yMaxExtent",2),st([p("int16")],f.Vhea.prototype,"caretSlopeRise",2),st([p("int16")],f.Vhea.prototype,"caretSlopeRun",2),st([p("int16")],f.Vhea.prototype,"caretOffset",2),st([p({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),st([p("int16")],f.Vhea.prototype,"metricDataFormat",2),st([p("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=st([tt("vhea")],f.Vhea);var Wn=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,Fs=(i,t,e)=>t in i?Wn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Bs=(i,t,e,n)=>{for(var r=n>1?void 0:n?Us(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Wn(t,e,r),r},Ns=(i,t,e)=>(Fs(i,t+"",e),e);f.Vmtx=class extends rt{constructor(){super(...arguments),Ns(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,a)=>(a<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Bs([tt("vmtx")],f.Vmtx);var kn=Object.defineProperty,Gs=(i,t,e)=>t in i?kn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&kn(t,e,r),r},je=(i,t,e)=>(Gs(i,typeof t!="symbol"?t+"":t,e),e);const Dt=class xe extends ge{constructor(){super(...arguments),je(this,"mimeType","font/ttf"),je(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,a=n/4;s<a;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 xe(new ArrayBuffer(12+n*16+r)),a=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=n*16-s.searchRange;let c=12+n*16,h=0;const o=s.getDirectories();t.tableViews.forEach((u,y)=>{const g=o[h++];g.tag=y,g.checkSum=xe.checksum(u),g.offset=c,g.length=u.byteLength,s.view.writeBytes(u,c),c+=e(g.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-xe.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 Zt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};je(Dt,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),Jt([p("uint32")],Dt.prototype,"scalerType"),Jt([p("uint16")],Dt.prototype,"numTables"),Jt([p("uint16")],Dt.prototype,"searchRange"),Jt([p("uint16")],Dt.prototype,"entrySelector"),Jt([p("uint16")],Dt.prototype,"rangeShift");let Mt=Dt;var Rs=Object.defineProperty,te=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Rs(t,e,r),r};class Et extends wt{constructor(t,e){super(t,e,20)}}te([p({type:"char",size:4})],Et.prototype,"tag"),te([p("uint32")],Et.prototype,"offset"),te([p("uint32")],Et.prototype,"compLength"),te([p("uint32")],Et.prototype,"origLength"),te([p("uint32")],Et.prototype,"origChecksum");var Xn=Object.defineProperty,Vs=(i,t,e)=>t in i?Xn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ht=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Xn(t,e,r),r},Ye=(i,t,e)=>(Vs(i,typeof t!="symbol"?t+"":t,e),e);const ot=class Ze extends ge{constructor(){super(...arguments),Ye(this,"mimeType","font/woff"),Ye(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,a=0;for(;a<r;)s+=e.getUint32(4*a++,!1);let c=n-r*4;if(c){let h=r*4;for(;c>0;)s+=e.getUint8(h)<<c*8,h++,c--}return s%4294967296}static from(t,e=new ArrayBuffer(0)){const n=u=>u+3&-4,r=[];t.tableViews.forEach((u,y)=>{const g=At(di(new Uint8Array(u.buffer,u.byteOffset,u.byteLength)));r.push({tag:y,view:g.byteLength<u.byteLength?g:u,rawView:u})});const s=r.length,a=r.reduce((u,y)=>u+n(y.view.byteLength),0),c=new Ze(new ArrayBuffer(44+20*s+a+e.byteLength));c.signature=2001684038,c.flavor=65536,c.length=c.view.byteLength,c.numTables=s,c.totalSfntSize=12+16*s+r.reduce((u,y)=>u+n(y.rawView.byteLength),0);let h=44+s*20,o=0;const l=c.getDirectories();return r.forEach(u=>{const y=l[o++];y.tag=u.tag,y.offset=h,y.compLength=u.view.byteLength,y.origChecksum=Ze.checkSum(u.rawView),y.origLength=u.rawView.byteLength,c.view.writeBytes(u.view,h),h+=n(y.compLength)}),c.view.writeBytes(e),c}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 Zt(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,a=e.origLength,c=r+s;return t[n]=s>=a?new DataView(this.view.buffer,r,s):new DataView(mi(new Uint8Array(this.view.buffer.slice(r,c))).buffer),t},{}))}};Ye(ot,"FLAGS",new Set([2001684038])),ht([p("uint32")],ot.prototype,"signature"),ht([p("uint32")],ot.prototype,"flavor"),ht([p("uint32")],ot.prototype,"length"),ht([p("uint16")],ot.prototype,"numTables"),ht([p("uint16")],ot.prototype,"reserved"),ht([p("uint32")],ot.prototype,"totalSfntSize"),ht([p("uint16")],ot.prototype,"majorVersion"),ht([p("uint16")],ot.prototype,"minorVersion"),ht([p("uint32")],ot.prototype,"metaOffset"),ht([p("uint32")],ot.prototype,"metaLength"),ht([p("uint32")],ot.prototype,"metaOrigLength"),ht([p("uint32")],ot.prototype,"privOffset"),ht([p("uint32")],ot.prototype,"privLength");let St=ot;var Hs=Object.defineProperty,zs=(i,t,e)=>t in i?Hs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e)=>(zs(i,typeof t!="symbol"?t+"":t,e),e);const qn=class ir{constructor(){ee(this,"fallbackFont"),ee(this,"_loading",new Map),ee(this,"_loaded",new Map),ee(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...ir.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,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(f=typeof globalThis<"u"?globalThis:f||self,w(f.modernText={}))})(this,function(f){"use strict";var eo=Object.defineProperty;var no=(f,w,L)=>w in f?eo(f,w,{enumerable:!0,configurable:!0,writable:!0,value:L}):f[w]=L;var B=(f,w,L)=>no(f,typeof w!="symbol"?w+"":w,L);class w{constructor(t=0,e=0){this.x=t,this.y=e}static get MAX(){return new w(1/0,1/0)}static get MIN(){return new w(-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 w(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 w((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 sr=Object.defineProperty,or=(i,t,e)=>t in i?sr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ar=(i,t,e)=>(or(i,t+"",e),e);class ut{constructor(t=1,e=0,n=0,r=0,s=1,a=0,c=0,h=0,o=1){ar(this,"elements",[]),this.set(t,e,n,r,s,a,c,h,o)}set(t,e,n,r,s,a,c,h,o){const l=this.elements;return l[0]=t,l[1]=r,l[2]=c,l[3]=e,l[4]=s,l[5]=h,l[6]=n,l[7]=a,l[8]=o,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,a=n[0],c=n[3],h=n[6],o=n[1],l=n[4],u=n[7],y=n[2],d=n[5],g=n[8],m=r[0],v=r[3],x=r[6],_=r[1],b=r[4],M=r[7],T=r[2],A=r[5],$=r[8];return s[0]=a*m+c*_+h*T,s[3]=a*v+c*b+h*A,s[6]=a*x+c*M+h*$,s[1]=o*m+l*_+u*T,s[4]=o*v+l*b+u*A,s[7]=o*x+l*M+u*$,s[2]=y*m+d*_+g*T,s[5]=y*v+d*b+g*A,s[8]=y*x+d*M+g*$,this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],s=t[3],a=t[4],c=t[5],h=t[6],o=t[7],l=t[8],u=l*a-c*o,y=c*h-l*s,d=o*s-a*h,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*o-l*n)*m,t[2]=(c*n-r*a)*m,t[3]=y*m,t[4]=(l*e-r*h)*m,t[5]=(r*s-c*e)*m,t[6]=d*m,t[7]=(n*h-o*e)*m,t[8]=(a*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(_e.makeScale(t,e)),this}rotate(t){return this.premultiply(_e.makeRotation(-t)),this}translate(t,e){return this.premultiply(_e.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 _e=new ut;function tn(i,t,e,n){const r=i*e+t*n,s=Math.sqrt(i*i+t*t)*Math.sqrt(e*e+n*n);let a=Math.acos(Math.max(-1,Math.min(1,r/s)));return i*n-t*e<0&&(a=-a),a}function hr(i,t,e,n,r,s,a,c){if(t===0||e===0){i.lineTo(c.x,c.y);return}n=n*Math.PI/180,t=Math.abs(t),e=Math.abs(e);const h=(a.x-c.x)/2,o=(a.y-c.y)/2,l=Math.cos(n)*h+Math.sin(n)*o,u=-Math.sin(n)*h+Math.cos(n)*o;let y=t*t,d=e*e;const g=l*l,m=u*u,v=g/y+m/d;if(v>1){const D=Math.sqrt(v);t=D*t,e=D*e,y=t*t,d=e*e}const x=y*m+d*g,_=(y*d-x)/x;let b=Math.sqrt(Math.max(0,_));r===s&&(b=-b);const M=b*t*u/e,T=-b*e*l/t,A=Math.cos(n)*M-Math.sin(n)*T+(a.x+c.x)/2,$=Math.sin(n)*M+Math.cos(n)*T+(a.y+c.y)/2,C=tn(1,0,(l-M)/t,(u-T)/e),S=tn((l-M)/t,(u-T)/e,(-l-M)/t,(-u-T)/e)%(Math.PI*2);i.currentPath.absellipse(A,$,t,e,C,C+S,s===0,n)}function Et(i,t){return i-(t-i)}function cr(i,t){const e=new w,n=new w,r=new w;let s=!0,a=!1;for(let c=0,h=i.length;c<h;c++){const o=i[c];if(s&&(a=!0,s=!1),o.type==="m"||o.type==="M")o.type==="m"?(e.x+=o.x,e.y+=o.y):(e.x=o.x,e.y=o.y),n.x=e.x,n.y=e.y,t.moveTo(e.x,e.y),r.copy(e);else if(o.type==="h"||o.type==="H")o.type==="h"?e.x+=o.x:e.x=o.x,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="v"||o.type==="V")o.type==="v"?e.y+=o.y:e.y=o.y,n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="l"||o.type==="L")o.type==="l"?(e.x+=o.x,e.y+=o.y):(e.x=o.x,e.y=o.y),n.x=e.x,n.y=e.y,t.lineTo(e.x,e.y),a&&r.copy(e);else if(o.type==="c"||o.type==="C")o.type==="c"?(t.bezierCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.x+=o.x,e.y+=o.y):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="s"||o.type==="S")o.type==="s"?(t.bezierCurveTo(Et(e.x,n.x),Et(e.y,n.y),e.x+o.x2,e.y+o.y2,e.x+o.x,e.y+o.y),n.x=e.x+o.x2,n.y=e.y+o.y2,e.x+=o.x,e.y+=o.y):(t.bezierCurveTo(Et(e.x,n.x),Et(e.y,n.y),o.x2,o.y2,o.x,o.y),n.x=o.x2,n.y=o.y2,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="q"||o.type==="Q")o.type==="q"?(t.quadraticCurveTo(e.x+o.x1,e.y+o.y1,e.x+o.x,e.y+o.y),n.x=e.x+o.x1,n.y=e.y+o.y1,e.x+=o.x,e.y+=o.y):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),n.x=o.x1,n.y=o.y1,e.x=o.x,e.y=o.y),a&&r.copy(e);else if(o.type==="t"||o.type==="T"){const l=Et(e.x,n.x),u=Et(e.y,n.y);n.x=l,n.y=u,o.type==="t"?(t.quadraticCurveTo(l,u,e.x+o.x,e.y+o.y),e.x+=o.x,e.y+=o.y):(t.quadraticCurveTo(l,u,o.x,o.y),e.x=o.x,e.y=o.y),a&&r.copy(e)}else if(o.type==="a"||o.type==="A"){if(o.type==="a"){if(o.x===0&&o.y===0)continue;e.x+=o.x,e.y+=o.y}else{if(o.x===e.x&&o.y===e.y)continue;e.x=o.x,e.y=o.y}const l=e.clone();n.x=e.x,n.y=e.y,hr(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,l,e),a&&r.copy(e)}else o.type==="z"||o.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",o);a=!1}}const R={SEPARATOR:/[ \t\r\n,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function gt(i,t,e=0){let c=0,h=!0,o="",l="";const u=[];function y(v,x,_){const b=new SyntaxError(`Unexpected character "${v}" at index ${x}.`);throw b.partial=_,b}function d(){o!==""&&(l===""?u.push(Number(o)):u.push(Number(o)*10**Number(l))),o="",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)&&R.FLAGS.test(g)){c=1,o=g,d();continue}if(c===0){if(R.WHITESPACE.test(g))continue;if(R.DIGIT.test(g)||R.SIGN.test(g)){c=1,o=g;continue}if(R.POINT.test(g)){c=2,o=g;continue}R.COMMA.test(g)&&(h&&y(g,v,u),h=!0)}if(c===1){if(R.DIGIT.test(g)){o+=g;continue}if(R.POINT.test(g)){o+=g,c=2;continue}if(R.EXP.test(g)){c=3;continue}R.SIGN.test(g)&&o.length===1&&R.SIGN.test(o[0])&&y(g,v,u)}if(c===2){if(R.DIGIT.test(g)){o+=g;continue}if(R.EXP.test(g)){c=3;continue}R.POINT.test(g)&&o[o.length-1]==="."&&y(g,v,u)}if(c===3){if(R.DIGIT.test(g)){l+=g;continue}if(R.SIGN.test(g)){if(l===""){l+=g;continue}l.length===1&&R.SIGN.test(l)&&y(g,v,u)}}R.WHITESPACE.test(g)?(d(),c=0,h=!1):R.COMMA.test(g)?(d(),c=0,h=!0):R.SIGN.test(g)?(d(),c=1,o=g):R.POINT.test(g)?(d(),c=2,o=g):y(g,v,u)}return d(),u}function lr(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 ur(i){let t="";for(let e=0,n=i.length;e<n;e++)t+=`${lr(i[e])} `;return t}const fr=/[a-df-z][^a-df-z]*/gi;function pr(i){const t=[],e=i.match(fr);if(!e)return t;for(let n=0,r=e.length;n<r;n++){const s=e[n],a=s.charAt(0),c=s.slice(1).trim();let h;switch(a){case"m":case"M":h=gt(c);for(let o=0,l=h.length;o<l;o+=2)o===0?t.push({type:a,x:h[o],y:h[o+1]}):t.push({type:a==="m"?"l":"L",x:h[o],y:h[o+1]});break;case"h":case"H":h=gt(c);for(let o=0,l=h.length;o<l;o++)t.push({type:a,x:h[o]});break;case"v":case"V":h=gt(c);for(let o=0,l=h.length;o<l;o++)t.push({type:a,y:h[o]});break;case"l":case"L":h=gt(c);for(let o=0,l=h.length;o<l;o+=2)t.push({type:a,x:h[o],y:h[o+1]});break;case"c":case"C":h=gt(c);for(let o=0,l=h.length;o<l;o+=6)t.push({type:a,x1:h[o],y1:h[o+1],x2:h[o+2],y2:h[o+3],x:h[o+4],y:h[o+5]});break;case"s":case"S":h=gt(c);for(let o=0,l=h.length;o<l;o+=4)t.push({type:a,x2:h[o],y2:h[o+1],x:h[o+2],y:h[o+3]});break;case"q":case"Q":h=gt(c);for(let o=0,l=h.length;o<l;o+=4)t.push({type:a,x1:h[o],y1:h[o+1],x:h[o+2],y:h[o+3]});break;case"t":case"T":h=gt(c);for(let o=0,l=h.length;o<l;o+=2)t.push({type:a,x:h[o],y:h[o+1]});break;case"a":case"A":h=gt(c,[3,4],7);for(let o=0,l=h.length;o<l;o+=7)t.push({type:a,rx:h[o],ry:h[o+1],angle:h[o+2],largeArcFlag:h[o+3],sweepFlag:h[o+4],x:h[o+5],y:h[o+6]});break;case"z":case"Z":t.push({type:a});break;default:console.warn(s)}}return t}var yr=Object.defineProperty,dr=(i,t,e)=>t in i?yr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Me=(i,t,e)=>(dr(i,typeof t!="symbol"?t+"":t,e),e);class Ot{constructor(){Me(this,"arcLengthDivisions",200),Me(this,"_cacheArcLengths"),Me(this,"_needsUpdate",!1)}getPointAt(t,e=new w){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 a=1;a<=t;a++)n=this.getPoint(a/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 a;e?a=e:a=t*n[s-1];let c=0,h=s-1,o;for(;c<=h;)if(r=Math.floor(c+(h-c)/2),o=n[r]-a,o<0)c=r+1;else if(o>0)h=r-1;else{h=r;break}if(r=h,n[r]===a)return r/(s-1);const l=n[r],y=n[r+1]-l,d=(a-l)/y;return(r+d)/(s-1)}getTangent(t,e=new w){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 w){return this.getTangent(this.getUtoTmapping(t),e)}transform(t){return this}getDivisions(t){return t}getMinMax(t=w.MAX,e=w.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 ur(this.getCommands())}drawTo(t){return this}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}clone(){return new this.constructor().copy(this)}}function en(i,t,e,n,r){const s=(n-t)*.5,a=(r-e)*.5,c=i*i,h=i*c;return(2*e-2*n+s+a)*h+(-3*e+3*n-2*s-a)*c+s*i+e}function gr(i,t){const e=1-i;return e*e*t}function mr(i,t){return 2*(1-i)*i*t}function vr(i,t){return i*i*t}function nn(i,t,e,n){return gr(i,t)+mr(i,e)+vr(i,n)}function wr(i,t){const e=1-i;return e*e*e*t}function br(i,t){const e=1-i;return 3*e*e*i*t}function xr(i,t){return 3*(1-i)*i*i*t}function _r(i,t){return i*i*i*t}function rn(i,t,e,n,r){return wr(i,t)+br(i,e)+xr(i,n)+_r(i,r)}class Mr extends Ot{constructor(t=new w,e=new w,n=new w,r=new w){super(),this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new w){const{v0:n,v1:r,v2:s,v3:a}=this;return e.set(rn(t,n.x,r.x,s.x,a.x),rn(t,n.y,r.y,s.y,a.y)),e}transform(t){return this.v0.applyMatrix3(t),this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this.v3.applyMatrix3(t),this}getMinMax(t=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s,v3:a}=this;return t.x=Math.min(t.x,n.x,r.x,s.x,a.x),t.y=Math.min(t.y,n.y,r.y,s.y,a.y),e.x=Math.max(e.x,n.x,r.x,s.x,a.x),e.y=Math.max(e.y,n.y,r.y,s.y,a.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 Sr=new ut,sn=new ut,on=new ut,oe=new w;class Pr extends Ot{constructor(t=0,e=0,n=1,r=1,s=0,a=Math.PI*2,c=!1,h=0){super(),this.x=t,this.y=e,this.radiusX=n,this.radiusY=r,this.startAngle=s,this.endAngle=a,this.clockwise=c,this.rotation=h}getPoint(t,e=new w){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 a=this.startAngle+t*r;let c=this.x+this.radiusX*Math.cos(a),h=this.y+this.radiusY*Math.sin(a);if(this.rotation!==0){const o=Math.cos(this.rotation),l=Math.sin(this.rotation),u=c-this.x,y=h-this.y;c=u*o-y*l+this.x,h=u*l+y*o+this.y}return e.set(c,h)}getDivisions(t=12){return t*2}getCommands(){const{x:t,y:e,radiusX:n,radiusY:r,startAngle:s,endAngle:a,clockwise:c,rotation:h}=this,o=t+n*Math.cos(s)*Math.cos(h)-r*Math.sin(s)*Math.sin(h),l=e+n*Math.cos(s)*Math.sin(h)+r*Math.sin(s)*Math.cos(h),u=Math.abs(s-a),y=u>Math.PI?1:0,d=c?1:0,g=h*180/Math.PI;if(u>=2*Math.PI){const m=s+Math.PI,v=t+n*Math.cos(m)*Math.cos(h)-r*Math.sin(m)*Math.sin(h),x=e+n*Math.cos(m)*Math.sin(h)+r*Math.sin(m)*Math.cos(h);return[{type:"M",x:o,y:l},{type:"A",rx:n,ry:r,angle:g,largeArcFlag:0,sweepFlag:d,x:v,y:x},{type:"A",rx:n,ry:r,angle:g,largeArcFlag:0,sweepFlag:d,x:o,y:l}]}else{const m=t+n*Math.cos(a)*Math.cos(h)-r*Math.sin(a)*Math.sin(h),v=e+n*Math.cos(a)*Math.sin(h)+r*Math.sin(a)*Math.cos(h);return[{type:"M",x:o,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:a,startAngle:c,endAngle:h,clockwise:o}=this;return t.ellipse(e,n,r,s,a,c,h,!o),this}transform(t){return oe.set(this.x,this.y),oe.applyMatrix3(t),this.x=oe.x,this.y=oe.y,Or(t)?Cr(this,t):Tr(this,t),this}getMinMax(t=w.MAX,e=w.MIN){const{x:n,y:r,radiusX:s,radiusY:a,rotation:c}=this,h=Math.cos(c),o=Math.sin(c),l=Math.sqrt(s*s*h*h+a*a*o*o),u=Math.sqrt(s*s*o*o+a*a*h*h);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 Cr(i,t){const e=i.radiusX,n=i.radiusY,r=Math.cos(i.rotation),s=Math.sin(i.rotation),a=new w(e*r,e*s),c=new w(-n*s,n*r),h=a.applyMatrix3(t),o=c.applyMatrix3(t),l=Sr.set(h.x,o.x,0,h.y,o.y,0,0,0,1),u=sn.copy(l).invert(),g=on.copy(u).transpose().multiply(u).elements,m=Ar(g[0],g[1],g[4]),v=Math.sqrt(m.rt1),x=Math.sqrt(m.rt2);if(i.radiusX=1/v,i.radiusY=1/x,i.rotation=Math.atan2(m.sn,m.cs),!((i.endAngle-i.startAngle)%(2*Math.PI)<Number.EPSILON)){const b=sn.set(v,0,0,0,x,0,0,0,1),M=on.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),T=b.multiply(M).multiply(l),A=$=>{const{x:C,y:S}=new w(Math.cos($),Math.sin($)).applyMatrix3(T);return Math.atan2(S,C)};i.startAngle=A(i.startAngle),i.endAngle=A(i.endAngle),an(t)&&(i.clockwise=!i.clockwise)}}function Tr(i,t){const e=hn(t),n=cn(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,an(t)&&(i.startAngle*=-1,i.endAngle*=-1,i.clockwise=!i.clockwise)}function an(i){const t=i.elements;return t[0]*t[4]-t[1]*t[3]<0}function Or(i){const t=i.elements,e=t[0]*t[3]+t[1]*t[4];if(e===0)return!1;const n=hn(i),r=cn(i);return Math.abs(e/(n*r))>Number.EPSILON}function hn(i){const t=i.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function cn(i){const t=i.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function Ar(i,t,e){let n,r,s,a,c;const h=i+e,o=i-e,l=Math.sqrt(o*o+4*t*t);return h>0?(n=.5*(h+l),c=1/n,r=i*c*e-t*c*t):h<0?r=.5*(h-l):(n=.5*l,r=-.5*l),o>0?s=o+l:s=o-l,Math.abs(s)>2*Math.abs(t)?(c=-2*t/s,a=1/Math.sqrt(1+c*c),s=c*a):Math.abs(t)===0?(s=1,a=0):(c=-.5*s/t,s=1/Math.sqrt(1+c*c),a=c*s),o>0&&(c=s,s=-a,a=c),{rt1:n,rt2:r,cs:s,sn:a}}class Se extends Ot{constructor(t=new w,e=new w){super(),this.v1=t,this.v2=e}getPoint(t,e=new w){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 w){return this.getPoint(t,e)}getTangent(t,e=new w){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e=new w){return this.getTangent(t,e)}transform(t){return this.v1.applyMatrix3(t),this.v2.applyMatrix3(t),this}getDivisions(){return 1}getMinMax(t=w.MAX,e=w.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 $r extends Ot{constructor(t=new w,e=new w,n=new w){super(),this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new w){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=w.MAX,e=w.MIN){const{v0:n,v1:r,v2:s}=this,a=.5*(n.x+r.x),c=.5*(n.y+r.y),h=.5*(n.x+s.x),o=.5*(n.y+s.y);return t.x=Math.min(t.x,n.x,s.x,a,h),t.y=Math.min(t.y,n.y,s.y,c,o),e.x=Math.max(e.x,n.x,s.x,a,h),e.y=Math.max(e.y,n.y,s.y,c,o),{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 Ir=Object.defineProperty,Lr=(i,t,e)=>t in i?Ir(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ln=(i,t,e)=>(Lr(i,typeof t!="symbol"?t+"":t,e),e);class Dr extends Ot{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,ln(this,"curves",[]),ln(this,"pointT",0);const{x:a,y:c}=this.center,h=this.rx,o=this.rx/this.aspectRatio,l=[new w(a-h,c-o),new w(a+h,c-o),new w(a+h,c+o),new w(a-h,c+o)];for(let u=0;u<4;u++)this.curves.push(new Se(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 w(n.y-e.y,-(n.x-e.x)).normalize()}transform(t){return this.curves.forEach(e=>e.transform(t)),this}getMinMax(t=w.MAX,e=w.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 Ur extends Ot{constructor(t=[]){super(),this.points=t}getDivisions(t=12){return t*this.points.length}getPoint(t,e=new w){const{points:n}=this,r=(n.length-1)*t,s=Math.floor(r),a=r-s,c=n[s===0?s:s-1],h=n[s],o=n[s>n.length-2?n.length-1:s+1],l=n[s>n.length-3?n.length-1:s+2];return e.set(en(a,c.x,h.x,o.x,l.x),en(a,c.y,h.y,o.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 Er=Object.defineProperty,Fr=(i,t,e)=>t in i?Er(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ae=(i,t,e)=>(Fr(i,typeof t!="symbol"?t+"":t,e),e);class he extends Ot{constructor(t){super(),ae(this,"curves",[]),ae(this,"currentPoint",new w),ae(this,"autoClose",!1),ae(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 Se(e,t)),this}getPoint(t,e=new w){const n=t*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const a=r[s]-n,c=this.curves[s],h=c.getLength();return c.getPointAt(h===0?0:1-a/h,e)}s++}return e}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){super.updateArcLengths(),this._cacheLengths=[],this.getCurveLengths()}getCurveLengths(){if(this._cacheLengths.length===this.curves.length)return this._cacheLengths;const t=[];let e=0;for(let 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 a=s[r],c=a.getPoints(a.getDivisions(t));for(let h=0;h<c.length;h++){const o=c[h];n&&n.equals(o)||(e.push(o),n=o)}}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,a){return this.curves.push(new Mr(this.currentPoint.clone(),new w(t,e),new w(n,r),new w(s,a))),this.currentPoint.set(s,a),this}lineTo(t,e){return this.curves.push(new Se(this.currentPoint.clone(),new w(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 $r(this.currentPoint.clone(),new w(t,e),new w(n,r))),this.currentPoint.set(n,r),this}rect(t,e,n,r){return this.curves.push(new Dr(new w(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 Ur(e)),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,s,a=!1){const c=this.currentPoint;return this.absarc(t+c.x,e+c.y,n,r,s,a),this}absarc(t,e,n,r,s,a=!1){return this.absellipse(t,e,n,n,r,s,a),this}ellipse(t,e,n,r,s,a,c=!1,h=0){const o=this.currentPoint;return this.absellipse(t+o.x,e+o.y,n,r,s,a,c,h),this}absellipse(t,e,n,r,s,a,c=!1,h=0){const o=new Pr(t,e,n,r,s,a,c,h);if(this.curves.length>0){const l=o.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}return this.curves.push(o),this.currentPoint.copy(o.getPoint(1)),this}getCommands(){return this.curves.flatMap(t=>t.getCommands())}getMinMax(t=w.MAX,e=w.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 Br=Object.defineProperty,Nr=(i,t,e)=>t in i?Br(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pe=(i,t,e)=>(Nr(i,typeof t!="symbol"?t+"":t,e),e);class ft{constructor(t){Pe(this,"currentPath",new he),Pe(this,"paths",[this.currentPath]),Pe(this,"userData"),t&&(t instanceof ft?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}addPath(t){return t instanceof ft?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 he().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,a){return this.currentPath.bezierCurveTo(t,e,n,r,s,a),this}quadraticCurveTo(t,e,n,r){return this.currentPath.quadraticCurveTo(t,e,n,r),this}arc(t,e,n,r,s,a){return this.currentPath.absarc(t,e,n,r,s,!a),this}arcTo(t,e,n,r,s){return console.warn("Method arcTo not supported yet"),this}ellipse(t,e,n,r,s,a,c,h){return this.currentPath.absellipse(t,e,n,r,a,c,!h,s),this}rect(t,e,n,r){return this.currentPath.rect(t,e,n,r),this}addCommands(t){return cr(t,this),this}addData(t){return this.addCommands(pr(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=w.MAX,e=w.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:a}=this.getBoundingBox();e.width=s,e.height=a;const c=e.getContext("2d");return c&&(c.translate(-n,-r),t?this.fillTo(c):this.strokeTo(c)),e}clone(){return new this.constructor().copy(this)}}const Ce="px",un=90,fn=["mm","cm","in","pt","pc","px"],Te={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 E(i){let t="px";if(typeof i=="string"||i instanceof String)for(let n=0,r=fn.length;n<r;n++){const s=fn[n];if(i.endsWith(s)){t=s,i=i.substring(0,i.length-s.length);break}}let e;return t==="px"&&Ce!=="px"?e=Te.in[Ce]/un:(e=Te[t][Ce],e<0&&(e=Te[t].in*un)),e*Number.parseFloat(i)}const Gr=new ut,ce=new ut,pn=new ut,yn=new ut;function Rr(i,t,e){if(!(i.hasAttribute("transform")||i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))))return null;const n=Vr(i);return e.length>0&&n.premultiply(e[e.length-1]),t.copy(n),e.push(n),n}function Vr(i){const t=new ut,e=Gr;if(i.nodeName==="use"&&(i.hasAttribute("x")||i.hasAttribute("y"))&&t.translate(E(i.getAttribute("x")),E(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 a=s.indexOf("("),c=s.length;if(a>0&&a<c){const h=s.slice(0,a),o=gt(s.slice(a+1));switch(e.identity(),h){case"translate":if(o.length>=1){const l=o[0];let u=0;o.length>=2&&(u=o[1]),e.translate(l,u)}break;case"rotate":if(o.length>=1){let l=0,u=0,y=0;l=o[0]*Math.PI/180,o.length>=3&&(u=o[1],y=o[2]),ce.makeTranslation(-u,-y),pn.makeRotation(l),yn.multiplyMatrices(pn,ce),ce.makeTranslation(u,y),e.multiplyMatrices(ce,yn)}break;case"scale":o.length>=1&&e.scale(o[0],o[1]??o[0]);break;case"skewX":o.length===1&&e.set(1,Math.tan(o[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":o.length===1&&e.set(1,0,0,Math.tan(o[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":o.length===6&&e.set(o[0],o[2],o[4],o[1],o[3],o[5],0,0,1);break}}t.premultiply(e)}}return t}function Hr(i){return new ft().addPath(new he().absarc(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("r")||0),0,Math.PI*2))}function zr(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 a=Object.fromEntries(Object.entries(n.style).filter(([,c])=>c!==""));t[r[s]]=Object.assign(t[r[s]]||{},a)}}}function Wr(i){return new ft().addPath(new he().absellipse(E(i.getAttribute("cx")||0),E(i.getAttribute("cy")||0),E(i.getAttribute("rx")||0),E(i.getAttribute("ry")||0),0,Math.PI*2))}function kr(i){return new ft().moveTo(E(i.getAttribute("x1")||0),E(i.getAttribute("y1")||0)).lineTo(E(i.getAttribute("x2")||0),E(i.getAttribute("y2")||0))}function Xr(i){const t=new ft,e=i.getAttribute("d");return!e||e==="none"?null:(t.addData(e),t)}const qr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function jr(i){var n;const t=new ft;let e=0;return(n=i.getAttribute("points"))==null||n.replace(qr,(r,s,a)=>{const c=E(s),h=E(a);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!0,t}const Yr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function Kr(i){var n;const t=new ft;let e=0;return(n=i.getAttribute("points"))==null||n.replace(Yr,(r,s,a)=>{const c=E(s),h=E(a);return e===0?t.moveTo(c,h):t.lineTo(c,h),e++,r}),t.currentPath.autoClose=!1,t}function Qr(i){const t=E(i.getAttribute("x")||0),e=E(i.getAttribute("y")||0),n=E(i.getAttribute("rx")||i.getAttribute("ry")||0),r=E(i.getAttribute("ry")||i.getAttribute("rx")||0),s=E(i.getAttribute("width")),a=E(i.getAttribute("height")),c=1-.551915024494,h=new ft;return h.moveTo(t+n,e),h.lineTo(t+s-n,e),(n!==0||r!==0)&&h.bezierCurveTo(t+s-n*c,e,t+s,e+r*c,t+s,e+r),h.lineTo(t+s,e+a-r),(n!==0||r!==0)&&h.bezierCurveTo(t+s,e+a-r*c,t+s-n*c,e+a,t+s-n,e+a),h.lineTo(t+n,e+a),(n!==0||r!==0)&&h.bezierCurveTo(t+n*c,e+a,t,e+a-r*c,t,e+a-r),h.lineTo(t,e+r),(n!==0||r!==0)&&h.bezierCurveTo(t,e+r*c,t+n*c,e,t+n,e),h}function mt(i,t,e){t=Object.assign({},t);let n={};if(i.hasAttribute("class")){const c=i.getAttribute("class").split(/\s/).filter(Boolean).map(h=>h.trim());for(let h=0;h<c.length;h++)n=Object.assign(n,e[`.${c[h]}`])}i.hasAttribute("id")&&(n=Object.assign(n,e[`#${i.getAttribute("id")}`]));function r(c,h,o){o===void 0&&(o=function(u){return u.startsWith("url")&&console.warn("url access in attributes is not implemented."),u}),i.hasAttribute(c)&&(t[h]=o(i.getAttribute(c))),n[c]&&(t[h]=o(n[c])),i.style&&i.style[c]!==""&&(t[h]=o(i.style[c]))}function s(c){return Math.max(0,Math.min(1,E(c)))}function a(c){return Math.max(0,E(c))}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",a),r("stroke-opacity","strokeOpacity",s),r("stroke-width","strokeWidth",a),r("visibility","visibility"),t}function Oe(i,t,e=[]){var l;if(i.nodeType!==1)return e;let n=!1,r=null;const s={};switch(i.nodeName){case"svg":t=mt(i,t,s);break;case"style":zr(i,s);break;case"g":t=mt(i,t,s);break;case"path":t=mt(i,t,s),i.hasAttribute("d")&&(r=Xr(i));break;case"rect":t=mt(i,t,s),r=Qr(i);break;case"polygon":t=mt(i,t,s),r=jr(i);break;case"polyline":t=mt(i,t,s),r=Kr(i);break;case"circle":t=mt(i,t,s),r=Hr(i);break;case"ellipse":t=mt(i,t,s),r=Wr(i);break;case"line":t=mt(i,t,s),r=kr(i);break;case"defs":n=!0;break;case"use":{t=mt(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?Oe(d,t,e):console.warn(`'use node' references non-existent node id: ${y}`);break}default:console.warn(i);break}const a=new ut,c=[],h=Rr(i,a,c);r&&(r.transform(a),e.push(r),r.userData={node:i,style:t});const o=i.childNodes;for(let u=0,y=o.length;u<y;u++){const d=o[u];n&&d.nodeName!=="style"&&d.nodeName!=="defs"||Oe(d,t,e)}return h&&(c.pop(),c.length>0?a.copy(c[c.length-1]):a.identity()),e}const dn="data:image/svg+xml;",gn=`${dn}base64,`,mn=`${dn}charset=utf8,`;function vn(i){if(typeof i=="string"){let t;return i.startsWith(gn)?(i=i.substring(gn.length,i.length),t=atob(i)):i.startsWith(mn)?(i=i.substring(mn.length,i.length),t=decodeURIComponent(i)):t=i,new DOMParser().parseFromString(t,"image/svg+xml").documentElement}else return i}function Zr(i){return Oe(vn(i),{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4})}class Ft{constructor(t){this._text=t}}class Jr extends Ft{deform(){}}function Ae(i,t,e){if(typeof t=="string"&&t.startsWith("linear-gradient")){const{x0:n,y0:r,x1:s,y1:a,stops:c}=ti(t,e.left,e.top,e.width,e.height),h=i.createLinearGradient(n,r,s,a);return c.forEach(o=>h.addColorStop(o.offset,o.color)),h}return t}function le(i,t,e){i!=null&&i.color&&(i.color=Ae(e,i.color,t)),i!=null&&i.backgroundColor&&(i.backgroundColor=Ae(e,i.backgroundColor,t)),i!=null&&i.textStrokeColor&&(i.textStrokeColor=Ae(e,i.textStrokeColor,t))}function ti(i,t,e,n,r){var d;const s=((d=i.match(/linear-gradient\((.+)\)$/))==null?void 0:d[1])??"",a=s.split(",")[0],c=a.includes("deg")?a:"0deg",h=s.replace(c,"").matchAll(/(#|rgba|rgb)(.+?) ([\d.]+%)/gi),l=(Number(c.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(h).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 wn(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)??{},a=i.color??s.fill??"none",c=i.textStrokeColor??s.stroke??"none";t.fillStyle=a!=="none"?a:"#000",t.strokeStyle=c!=="none"?c:"#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 h=(i.offsetX??0)*n,o=(i.offsetY??0)*n;t.translate(h,o),r.drawTo(t),a!=="none"&&t.fill(),c!=="none"&&t.stroke(),t.restore()})}class ei extends Ft{getBoundingBox(){const{characters:t,effects:e}=this._text,n=[];return t.forEach(r=>{const s=r.computedStyle.fontSize;e==null||e.forEach(a=>{const c=(a.offsetX??0)*s,h=(a.offsetY??0)*s,o=(a.shadowOffsetX??0)*s,l=(a.shadowOffsetY??0)*s,u=Math.max(.1,a.textStrokeWidth??0)*s,y=r.boundingBox.clone();y.left+=c+o-u,y.top+=h+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(a=>{le(a,s,e)}),r.forEach(a=>{n.forEach(c=>{a.drawTo(e,c)})})),this}}class ni extends Ft{constructor(){super(...arguments);B(this,"paths",[])}getBoundingBox(){if(!this.paths.length)return new L;const e=w.MAX,n=w.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 a=[];let c;e.forEach(h=>{const o=h.parent.highlight;o!=null&&o.url&&((c==null?void 0:c.url)===o.url?s.push(h):(s=[],s.push(h),a.push(s))),c=o}),this.paths=a.filter(h=>h.length).map(h=>({url:h[0].parent.highlight.url,box:L.from(...h.map(o=>o.glyphBox)),baseline:Math.max(...h.map(o=>o.baseline))})).map(h=>this._parseGroup(h,r)).flat()}_parseSvg(e){const n=vn(e),r=Zr(n),s=w.MAX,a=w.MIN;r.forEach(y=>y.getMinMax(s,a));const{x:c,y:h,width:o,height:l}=new L(s.x,s.y,a.x-s.x,a.y-s.y),u=n.getAttribute("viewBox").split(" ").map(Number);return{paths:r,box:new L(c,h,o,l),viewBox:new L(...u)}}_parseGroup(e,n){const{url:r,box:s,baseline:a}=e,{box:c,viewBox:h,paths:o}=this._parseSvg(r),l=[],u=c.height/h.height>.3?0:1;if(u===0){const y={x:s.left-n*.2,y:s.top},d=(s.width+n*.2*2)/c.width,g=s.height/c.height,m=new ut().translate(-c.x,-c.y).scale(d,g).translate(y.x,y.y);o.forEach(v=>{l.push(v.clone().transform(m))})}else if(u===1){const y=n/c.width*2,d=c.width*y,g=Math.ceil(s.width/d),m=d*g,v={x:s.left+(s.width-m)/2+n*.1,y:s.top+a+n*.1},x=new ut().translate(-c.x,-c.y).scale(y,y).translate(v.x,v.y);for(let _=0;_<g;_++){const b=x.clone().translate(_*d,0);o.forEach(M=>{l.push(M.clone().transform(b))})}}return l}draw({ctx:e}){return wn({ctx:e,paths:this.paths,fontSize:this._text.computedStyle.fontSize,fill:!1}),this}}class ri 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("div");Object.assign(r.style,this._styleToDomStyle(e)),r.style.position="absolute",r.style.visibility="hidden";const s=document.createElement("ul");return s.style.listStyle="none",s.style.padding="0",s.style.margin="0",t.forEach(a=>{const c=document.createElement("li"),h=document.createElement("div");Object.assign(c.style,this._styleToDomStyle(a.style)),a.fragments.forEach(o=>{const l=document.createElement("span");Object.assign(l.style,this._styleToDomStyle(o.style)),l.appendChild(document.createTextNode(o.content)),h.appendChild(l)}),s.appendChild(c),c.appendChild(h)}),r.appendChild(s),n.appendChild(r),document.body.appendChild(n),{dom:r,destory:()=>{var a;return(a=r.parentNode)==null?void 0:a.removeChild(r)}}}_measureDom(t){const e=[],n=[],r=[];return t.querySelectorAll("li").forEach((s,a)=>{const c=s.getBoundingClientRect();e.push({paragraphIndex:a,left:c.left,top:c.top,width:c.width,height:c.height}),s.querySelectorAll("span").forEach((h,o)=>{var y;const l=s.getBoundingClientRect();n.push({paragraphIndex:a,fragmentIndex:o,left:l.left,top:l.top,width:l.width,height:l.height});const u=h.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 x=v[v.length-1];v.length>1&&x.width<2&&(x=v[v.length-2]);const _=d.toString();_!==""&&x&&x.width+x.height!==0&&r.push({content:_,newParagraphIndex:-1,paragraphIndex:a,fragmentIndex:o,characterIndex:m-1,top:x.top,left:x.left,height:x.height,width:x.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"),a=r.style.lineHeight;r.style.lineHeight="4000px";const c=[[]];let h=c[0];const{characters:o}=this._measureDom(t);o.length>0&&(h.push(o[0]),o.reduce((d,g)=>{const m=s?"left":"top";return Math.abs(g[m]-d[m])>4e3/2&&(h=[],c.push(h)),h.push(g),g})),r.style.lineHeight=a;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 c.forEach(d=>{d.forEach(g=>{const m=l.characters[y],{paragraphIndex:v,fragmentIndex:x,characterIndex:_}=m;u.push({...m,newParagraphIndex:v,textWidth:g.width,textHeight:g.height,left:m.left-n.left,top:m.top-n.top});const b=e[v].fragments[x].characters[_];b.boundingBox.left=u[y].left,b.boundingBox.top=u[y].top,b.boundingBox.width=u[y].width,b.boundingBox.height=u[y].height,b.textWidth=u[y].textWidth,b.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}}var K=Uint8Array,at=Uint16Array,$e=Int32Array,ue=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]),fe=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]),Ie=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bn=function(i,t){for(var e=new at(31),n=0;n<31;++n)e[n]=t+=1<<i[n-1];for(var r=new $e(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}},xn=bn(ue,2),_n=xn.b,Le=xn.r;_n[28]=258,Le[258]=28;for(var Mn=bn(fe,0),ii=Mn.b,Sn=Mn.r,De=new at(32768),F=0;F<32768;++F){var Pt=(F&43690)>>1|(F&21845)<<1;Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,De[F]=((Pt&65280)>>8|(Pt&255)<<8)>>1}for(var vt=function(i,t,e){for(var n=i.length,r=0,s=new at(t);r<n;++r)i[r]&&++s[i[r]-1];var a=new at(t);for(r=1;r<t;++r)a[r]=a[r-1]+s[r-1]<<1;var c;if(e){c=new at(1<<t);var h=15-t;for(r=0;r<n;++r)if(i[r])for(var o=r<<4|i[r],l=t-i[r],u=a[i[r]-1]++<<l,y=u|(1<<l)-1;u<=y;++u)c[De[u]>>h]=o}else for(c=new at(n),r=0;r<n;++r)i[r]&&(c[r]=De[a[i[r]-1]++]>>15-i[r]);return c},Ct=new K(288),F=0;F<144;++F)Ct[F]=8;for(var F=144;F<256;++F)Ct[F]=9;for(var F=256;F<280;++F)Ct[F]=7;for(var F=280;F<288;++F)Ct[F]=8;for(var zt=new K(32),F=0;F<32;++F)zt[F]=5;var si=vt(Ct,9,0),oi=vt(Ct,9,1),ai=vt(zt,5,0),hi=vt(zt,5,1),Ue=function(i){for(var t=i[0],e=1;e<i.length;++e)i[e]>t&&(t=i[e]);return t},yt=function(i,t,e){var n=t/8|0;return(i[n]|i[n+1]<<8)>>(t&7)&e},Ee=function(i,t){var e=t/8|0;return(i[e]|i[e+1]<<8|i[e+2]<<16)>>(t&7)},Fe=function(i){return(i+7)/8|0},Pn=function(i,t,e){return(e==null||e>i.length)&&(e=i.length),new K(i.subarray(t,e))},ci=["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"],dt=function(i,t,e){var n=new Error(t||ci[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,dt),!e)throw n;return n},li=function(i,t,e,n){var r=i.length,s=0;if(!r||t.f&&!t.l)return e||new K(0);var a=!e,c=a||t.i!=2,h=t.i;a&&(e=new K(r*3));var o=function(re){var ie=e.length;if(re>ie){var Ht=new K(Math.max(ie*2,re));Ht.set(e),e=Ht}},l=t.f||0,u=t.p||0,y=t.b||0,d=t.l,g=t.d,m=t.m,v=t.n,x=r*8;do{if(!d){l=yt(i,u,1);var _=yt(i,u+1,3);if(u+=3,_)if(_==1)d=oi,g=hi,m=9,v=5;else if(_==2){var A=yt(i,u,31)+257,$=yt(i,u+10,15)+4,C=A+yt(i,u+5,31)+1;u+=14;for(var S=new K(C),D=new K(19),N=0;N<$;++N)D[Ie[N]]=yt(i,u+N*3,7);u+=$*3;for(var z=Ue(D),V=(1<<z)-1,X=vt(D,z,1),N=0;N<C;){var q=X[yt(i,u,V)];u+=q&15;var b=q>>4;if(b<16)S[N++]=b;else{var W=0,O=0;for(b==16?(O=3+yt(i,u,3),u+=2,W=S[N-1]):b==17?(O=3+yt(i,u,7),u+=3):b==18&&(O=11+yt(i,u,127),u+=7);O--;)S[N++]=W}}var U=S.subarray(0,A),I=S.subarray(A);m=Ue(U),v=Ue(I),d=vt(U,m,1),g=vt(I,v,1)}else dt(1);else{var b=Fe(u)+4,M=i[b-4]|i[b-3]<<8,T=b+M;if(T>r){h&&dt(0);break}c&&o(y+M),e.set(i.subarray(b,T),y),t.b=y+=M,t.p=u=T*8,t.f=l;continue}if(u>x){h&&dt(0);break}}c&&o(y+131072);for(var Y=(1<<m)-1,H=(1<<v)-1,pt=u;;pt=u){var W=d[Ee(i,u)&Y],ct=W>>4;if(u+=W&15,u>x){h&&dt(0);break}if(W||dt(2),ct<256)e[y++]=ct;else if(ct==256){pt=u,d=null;break}else{var lt=ct-254;if(ct>264){var N=ct-257,G=ue[N];lt=yt(i,u,(1<<G)-1)+_n[N],u+=G}var xt=g[Ee(i,u)&H],Rt=xt>>4;xt||dt(3),u+=xt&15;var I=ii[Rt];if(Rt>3){var G=fe[Rt];I+=Ee(i,u)&(1<<G)-1,u+=G}if(u>x){h&&dt(0);break}c&&o(y+131072);var Vt=y+lt;if(y<I){var we=s-I,be=Math.min(I,Vt);for(we+y<0&&dt(3);y<be;++y)e[y]=n[we+y]}for(;y<Vt;++y)e[y]=e[y-I]}}t.l=d,t.p=pt,t.b=y,t.f=l,d&&(l=1,t.m=m,t.d=g,t.n=v)}while(!l);return y!=e.length&&a?Pn(e,0,y):e.subarray(0,y)},_t=function(i,t,e){e<<=t&7;var n=t/8|0;i[n]|=e,i[n+1]|=e>>8},Wt=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},Be=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:An,l:0};if(r==1){var a=new K(e[0].s+1);return a[e[0].s]=1,{t:a,l:1}}e.sort(function(T,A){return T.f-A.f}),e.push({s:-1,f:25001});var c=e[0],h=e[1],o=0,l=1,u=2;for(e[0]={s:-1,f:c.f+h.f,l:c,r:h};l!=r-1;)c=e[e[o].f<e[u].f?o++:u++],h=e[o!=l&&e[o].f<e[u].f?o++:u++],e[l++]={s:-1,f:c.f+h.f,l:c,r:h};for(var y=s[0].s,n=1;n<r;++n)s[n].s>y&&(y=s[n].s);var d=new at(y+1),g=Ne(e[l-1],d,0);if(g>t){var n=0,m=0,v=g-t,x=1<<v;for(s.sort(function(A,$){return d[$.s]-d[A.s]||A.f-$.f});n<r;++n){var _=s[n].s;if(d[_]>t)m+=x-(1<<g-d[_]),d[_]=t;else break}for(m>>=v;m>0;){var b=s[n].s;d[b]<t?m-=1<<t-d[b]++-1:++n}for(;n>=0&&m;--n){var M=s[n].s;d[M]==t&&(--d[M],++m)}g=t}return{t:new K(d),l:g}},Ne=function(i,t,e){return i.s==-1?Math.max(Ne(i.l,t,e+1),Ne(i.r,t,e+1)):t[i.s]=e},Cn=function(i){for(var t=i.length;t&&!i[--t];);for(var e=new at(++t),n=0,r=i[0],s=1,a=function(h){e[n++]=h},c=1;c<=t;++c)if(i[c]==r&&c!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=i[c]}return{c:e.subarray(0,n),n:t}},kt=function(i,t){for(var e=0,n=0;n<t.length;++n)e+=i[n]*t[n];return e},Tn=function(i,t,e){var n=e.length,r=Fe(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},On=function(i,t,e,n,r,s,a,c,h,o,l){_t(t,l++,e),++r[256];for(var u=Be(r,15),y=u.t,d=u.l,g=Be(s,15),m=g.t,v=g.l,x=Cn(y),_=x.c,b=x.n,M=Cn(m),T=M.c,A=M.n,$=new at(19),C=0;C<_.length;++C)++$[_[C]&31];for(var C=0;C<T.length;++C)++$[T[C]&31];for(var S=Be($,7),D=S.t,N=S.l,z=19;z>4&&!D[Ie[z-1]];--z);var V=o+5<<3,X=kt(r,Ct)+kt(s,zt)+a,q=kt(r,y)+kt(s,m)+a+14+3*z+kt($,D)+2*$[16]+3*$[17]+7*$[18];if(h>=0&&V<=X&&V<=q)return Tn(t,l,i.subarray(h,h+o));var W,O,U,I;if(_t(t,l,1+(q<X)),l+=2,q<X){W=vt(y,d,0),O=y,U=vt(m,v,0),I=m;var Y=vt(D,N,0);_t(t,l,b-257),_t(t,l+5,A-1),_t(t,l+10,z-4),l+=14;for(var C=0;C<z;++C)_t(t,l+3*C,D[Ie[C]]);l+=3*z;for(var H=[_,T],pt=0;pt<2;++pt)for(var ct=H[pt],C=0;C<ct.length;++C){var lt=ct[C]&31;_t(t,l,Y[lt]),l+=D[lt],lt>15&&(_t(t,l,ct[C]>>5&127),l+=ct[C]>>12)}}else W=si,O=Ct,U=ai,I=zt;for(var C=0;C<c;++C){var G=n[C];if(G>255){var lt=G>>18&31;Wt(t,l,W[lt+257]),l+=O[lt+257],lt>7&&(_t(t,l,G>>23&31),l+=ue[lt]);var xt=G&31;Wt(t,l,U[xt]),l+=I[xt],xt>3&&(Wt(t,l,G>>5&8191),l+=fe[xt])}else Wt(t,l,W[G]),l+=O[G]}return Wt(t,l,W[256]),l+O[256]},ui=new $e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),An=new K(0),fi=function(i,t,e,n,r,s){var a=s.z||i.length,c=new K(n+a+5*(1+Math.ceil(a/7e3))+r),h=c.subarray(n,c.length-r),o=s.l,l=(s.r||0)&7;if(t){l&&(h[0]=s.r>>3);for(var u=ui[t-1],y=u>>13,d=u&8191,g=(1<<e)-1,m=s.p||new at(32768),v=s.h||new at(g+1),x=Math.ceil(e/3),_=2*x,b=function(Ze){return(i[Ze]^i[Ze+1]<<x^i[Ze+2]<<_)&g},M=new $e(25e3),T=new at(288),A=new at(32),$=0,C=0,S=s.i||0,D=0,N=s.w||0,z=0;S+2<a;++S){var V=b(S),X=S&32767,q=v[V];if(m[X]=q,v[V]=X,N<=S){var W=a-S;if(($>7e3||D>24576)&&(W>423||!o)){l=On(i,h,0,M,T,A,C,D,z,S-z,l),D=$=C=0,z=S;for(var O=0;O<286;++O)T[O]=0;for(var O=0;O<30;++O)A[O]=0}var U=2,I=0,Y=d,H=X-q&32767;if(W>2&&V==b(S-H))for(var pt=Math.min(y,W)-1,ct=Math.min(32767,S),lt=Math.min(258,W);H<=ct&&--Y&&X!=q;){if(i[S+U]==i[S+U-H]){for(var G=0;G<lt&&i[S+G]==i[S+G-H];++G);if(G>U){if(U=G,I=H,G>pt)break;for(var xt=Math.min(H,G-2),Rt=0,O=0;O<xt;++O){var Vt=S-H+O&32767,we=m[Vt],be=Vt-we&32767;be>Rt&&(Rt=be,q=Vt)}}}X=q,q=m[X],H+=X-q&32767}if(I){M[D++]=268435456|Le[U]<<18|Sn[I];var re=Le[U]&31,ie=Sn[I]&31;C+=ue[re]+fe[ie],++T[257+re],++A[ie],N=S+U,++$}else M[D++]=i[S],++T[i[S]]}}for(S=Math.max(S,N);S<a;++S)M[D++]=i[S],++T[i[S]];l=On(i,h,o,M,T,A,C,D,z,S-z,l),o||(s.r=l&7|h[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<a+o;S+=65535){var Ht=S+65535;Ht>=a&&(h[l/8|0]=o,Ht=a),l=Tn(h,l+1,i.subarray(S,Ht))}s.i=a}return Pn(c,0,n+Fe(l)+r)},$n=function(){var i=1,t=0;return{p:function(e){for(var n=i,r=t,s=e.length|0,a=0;a!=s;){for(var c=Math.min(a+2655,s);a<c;++a)r+=n+=e[a];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}}},pi=function(i,t,e,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new K(s.length+i.length);a.set(s),a.set(i,s.length),i=a,r.w=s.length}return fi(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)},In=function(i,t,e){for(;e;++t)i[t]=e,e>>>=8},yi=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=$n();r.p(t.dictionary),In(i,2,r.d())}},di=function(i,t){return((i[0]&15)!=8||i[0]>>4>7||(i[0]<<8|i[1])%31)&&dt(6,"invalid zlib data"),(i[1]>>5&1)==+!t&&dt(6,"invalid zlib data: "+(i[1]&32?"need":"unexpected")+" dictionary"),(i[1]>>3&4)+2};function gi(i,t){t||(t={});var e=$n();e.p(i);var n=pi(i,t,t.dictionary?6:2,4);return yi(n,t),In(n,n.length-4,e.d()),n}function mi(i,t){return li(i.subarray(di(i,t),-4),{i:2},t,t)}var vi=typeof TextDecoder<"u"&&new TextDecoder,wi=0;try{vi.decode(An,{stream:!0}),wi=1}catch{}const bi="modern-font";function Xt(i,t){if(!i)throw new Error(`[${bi}] ${t}`)}function xi(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 Ln=Object.defineProperty,_i=(i,t,e)=>t in i?Ln(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,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Ln(t,e,r),r},Mi=(i,t,e)=>(_i(i,t+"",e),e);const pe={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1};function Z(){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 j extends DataView{constructor(t,e,n,r){super(xi(t),e,n),this.littleEndian=r,Mi(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/,a=>a.toUpperCase())}`,s=this[r](e,n);return this.cursor+=pe[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/,c=>c.toUpperCase())}`,a=this[s](n,e,r);return this.cursor+=pe[t.toLowerCase()],a}writeString(t="",e=this.cursor){const n=t.replace(/[^\x00-\xFF]/g,"11").length;this.seek(e);for(let r=0,s=t.length,a;r<s;++r)a=t.charCodeAt(r)||0,a>127?this.writeUint16(a):this.writeUint8(a);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}}Q([Z()],j.prototype,"readInt8"),Q([Z()],j.prototype,"readInt16"),Q([Z()],j.prototype,"readInt32"),Q([Z()],j.prototype,"readUint8"),Q([Z()],j.prototype,"readUint16"),Q([Z()],j.prototype,"readUint32"),Q([Z()],j.prototype,"readFloat32"),Q([Z()],j.prototype,"readFloat64"),Q([Z()],j.prototype,"writeInt8"),Q([Z()],j.prototype,"writeInt16"),Q([Z()],j.prototype,"writeInt32"),Q([Z()],j.prototype,"writeUint8"),Q([Z()],j.prototype,"writeUint16"),Q([Z()],j.prototype,"writeUint32"),Q([Z()],j.prototype,"writeFloat32"),Q([Z()],j.prototype,"writeFloat64");var Si=Object.defineProperty,Pi=(i,t,e)=>t in i?Si(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ci=(i,t,e)=>(Pi(i,t+"",e),e);const Dn=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 a=Dn.get(r);a||(a={columns:[],byteLength:0},Dn.set(r,a));const c={...t,name:s,byteLength:e*pe[n],offset:t.offset??a.columns.reduce((h,o)=>h+o.byteLength,0)};a.columns.push(c),a.byteLength=a.columns.reduce((h,o)=>h+pe[o.type]*(o.size??1),0),Object.defineProperty(r.constructor.prototype,s,{get(){return this.view.getColumn(c)},set(h){this.view.setColumn(c,h)},configurable:!0,enumerable:!0})}}class wt{constructor(t,e,n,r){Ci(this,"view"),this.view=new j(t,e,n,r)}}function Ti(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 ye(i){i=Ti(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 Oi(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 Ai(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 $i=Object.defineProperty,Ii=(i,t,e)=>t in i?$i(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Li=(i,t,e)=>(Ii(i,t+"",e),e);class de extends wt{constructor(){super(...arguments),Li(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 Un=Object.defineProperty,Di=(i,t,e)=>t in i?Un(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,nt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Un(t,e,r),r},Ui=(i,t,e)=>(Di(i,t+"",e),e);const J=class tr extends de{constructor(){super(...arguments),Ui(this,"mimeType","application/vnd.ms-fontobject")}static from(t){const e=t.sfnt,r=e.name.getNames(),s=ye(r.fontFamily||""),a=s.length,c=ye(r.fontStyle||""),h=c.length,o=ye(r.version||""),l=o.length,u=ye(r.fullName||""),y=u.length,d=86+a+4+h+4+l+4+y+2+t.view.byteLength,g=new tr(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(a),g.view.writeBytes(s),g.view.writeUint16(0),g.view.writeUint16(h),g.view.writeBytes(c),g.view.writeUint16(0),g.view.writeUint16(l),g.view.writeBytes(o),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}};nt([p("uint32")],J.prototype,"EOTSize"),nt([p("uint32")],J.prototype,"FontDataSize"),nt([p("uint32")],J.prototype,"Version"),nt([p("uint32")],J.prototype,"Flags"),nt([p({type:"uint8",size:10})],J.prototype,"FontPANOSE"),nt([p("uint8")],J.prototype,"Charset"),nt([p("uint8")],J.prototype,"Italic"),nt([p("uint32")],J.prototype,"Weight"),nt([p("uint16")],J.prototype,"fsType"),nt([p("uint16")],J.prototype,"MagicNumber"),nt([p({type:"uint8",size:16})],J.prototype,"UnicodeRange"),nt([p({type:"uint8",size:8})],J.prototype,"CodePageRange"),nt([p("uint32")],J.prototype,"CheckSumAdjustment"),nt([p({type:"uint8",size:16})],J.prototype,"Reserved"),nt([p("uint16")],J.prototype,"Padding1");let Ei=J;var Fi=Object.defineProperty,ge=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Fi(t,e,r),r};class Bt extends wt{constructor(t,e){super(t,e,16)}}ge([p({type:"char",size:4})],Bt.prototype,"tag"),ge([p("uint32")],Bt.prototype,"checkSum"),ge([p("uint32")],Bt.prototype,"offset"),ge([p("uint32")],Bt.prototype,"length");var Bi=Object.defineProperty,me=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Bi(t,e,r),r};const qt=class er extends wt{constructor(t=new ArrayBuffer(262),e){super(t,e,262)}static from(t){const e=new er;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}};me([p("uint16")],qt.prototype,"format"),me([p("uint16")],qt.prototype,"length"),me([p("uint16")],qt.prototype,"language"),me([p({type:"uint8",size:256})],qt.prototype,"glyphIndexArray");let Ge=qt;var Ni=Object.defineProperty,Re=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Ni(t,e,r),r};class jt extends wt{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((t,e)=>Math.max(t,e),0)}get subHeaders(){const t=this.maxSubHeaderKey;return this.view.seek(6+256*2),Array.from({length:t},(e,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,a=this.glyphIndexArray,c=n.findIndex(o=>o===r);let h=0;for(let o=0;o<256;o++)if(n[o]===0)o>=c||o<s[0].firstCode||o>=s[0].firstCode+s[0].entryCount||s[0].idRangeOffset+(o-s[0].firstCode)>=a.length?h=0:(h=a[s[0].idRangeOffset+(o-s[0].firstCode)],h!==0&&(h=h+s[0].idDelta)),h!==0&&h<t&&e.set(o,h);else{const l=n[o];for(let u=0,y=s[l].entryCount;u<y;u++)if(s[l].idRangeOffset+u>=a.length?h=0:(h=a[s[l].idRangeOffset+u],h!==0&&(h=h+s[l].idDelta)),h!==0&&h<t){const d=(o<<8|u+s[l].firstCode)%65535;e.set(d,h)}}return e}}Re([p("uint16")],jt.prototype,"format"),Re([p("uint16")],jt.prototype,"length"),Re([p("uint16")],jt.prototype,"language");function En(i){return i>32767?i-65536:i<-32767?i+65536:i}function Ve(i,t){let e;const n=[];let r={};return i.forEach((s,a)=>{t&&a>t||((!e||a!==e.unicode+1||s!==e.glyphIndex+1)&&(e?(r.end=e.unicode,n.push(r),r={start:a,startId:s,delta:En(s-a)}):(r.start=Number(a),r.startId=s,r.delta=En(s-a))),e={unicode:a,glyphIndex:s})}),e&&(r.end=e.unicode,n.push(r)),n}var Gi=Object.defineProperty,$t=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Gi(t,e,r),r};const Tt=class nr extends wt{get endCode(){const t=this.segCountX2;return this.view.seek(14),Array.from({length:t/2},()=>this.view.readUint16())}set endCode(t){this.view.seek(14),t.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(t){this.view.writeUint16(t,14+this.segCountX2)}get startCode(){const t=this.segCountX2;return this.view.seek(14+t+2),Array.from({length:t/2},()=>this.view.readUint16())}set startCode(t){this.view.seek(14+this.segCountX2+2),t.forEach(e=>this.view.writeUint16(e))}get idDelta(){const t=this.segCountX2;return this.view.seek(14+t+2+t),Array.from({length:t/2},()=>this.view.readUint16())}set idDelta(t){const e=this.segCountX2;this.view.seek(14+e+2+e),t.forEach(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=Ve(t,65535),n=e.length+1,r=Math.floor(Math.log(n)/Math.LN2),s=2*2**r,a=new nr(new ArrayBuffer(24+e.length*8));return a.format=4,a.length=a.view.byteLength,a.language=0,a.segCountX2=n*2,a.searchRange=s,a.entrySelector=r,a.rangeShift=2*n-s,a.endCode=[...e.map(c=>c.end),65535],a.reservedPad=0,a.startCode=[...e.map(c=>c.start),65535],a.idDelta=[...e.map(c=>c.delta),1],a.idRangeOffset=Array.from({length:n},()=>0),a}getUnicodeGlyphIndexMap(){const t=new Map,e=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,s=this.endCode,a=this.idRangeOffset,c=this.idDelta,h=this.glyphIndexArray;for(let o=0;o<e;++o)for(let l=r[o],u=s[o];l<=u;++l)if(a[o]===0)t.set(l,(l+c[o])%65536);else{const y=o+a[o]/2+(l-r[o])-n,d=h[y];d!==0?t.set(l,(d+c[o])%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 He=Tt;var Ri=Object.defineProperty,Yt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Ri(t,e,r),r};class It extends wt{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}}Yt([p("uint16")],It.prototype,"format"),Yt([p("uint16")],It.prototype,"length"),Yt([p("uint16")],It.prototype,"language"),Yt([p("uint16")],It.prototype,"firstCode"),Yt([p("uint16")],It.prototype,"entryCount");var Vi=Object.defineProperty,Kt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Vi(t,e,r),r};const Nt=class rr extends wt{get groups(){const t=this.nGroups;return this.view.seek(16),Array.from({length:t},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){const e=Ve(t),n=new rr(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 a=s.startGlyphCode,c=s.startCharCode;const h=s.endCharCode;for(;c<=h;)t.set(c++,a++)}return t}};Kt([p("uint16")],Nt.prototype,"format"),Kt([p("uint16")],Nt.prototype,"reserved"),Kt([p("uint32")],Nt.prototype,"length"),Kt([p("uint32")],Nt.prototype,"language"),Kt([p("uint32")],Nt.prototype,"nGroups");let ze=Nt;var Hi=Object.defineProperty,We=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Hi(t,e,r),r};class Qt extends wt{getVarSelectorRecords(){const t=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:t},()=>{const e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);const 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(a=>{t.set(a.unicodeValue,a.glyphID)})}return t}}We([p("uint16")],Qt.prototype,"format"),We([p("uint32")],Qt.prototype,"length"),We([p("uint32")],Qt.prototype,"numVarSelectorRecords");var zi=Object.defineProperty,Wi=(i,t,e)=>t in i?zi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ke=(i,t,e)=>(Wi(i,typeof t!="symbol"?t+"":t,e),e);function tt(i,t=i){return e=>{Zt.tableDefinitions.set(i,{tag:i,prop:t,class:e}),Object.defineProperty(Zt.prototype,t,{get(){return this.get(i)},set(n){return this.set(i,n)},configurable:!0,enumerable:!0})}}const Fn=class se{constructor(t){ke(this,"tables",new Map),ke(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}),a=e.get(0);for(let c=0;c<r;c+=1)s[c]=e.get(n[c])||a;return s}getPathCommands(t,e,n,r,s){var a;return(a=this.charToGlyph(t))==null?void 0:a.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={},a){const c=1/this.unitsPerEm*r,h=this.textToGlyphs(t);for(let o=0;o<h.length;o+=1){const l=h[o];a.call(this,l,e,n,r,s),l.advanceWidth&&(e+=l.advanceWidth*c),s.letterSpacing?e+=s.letterSpacing*r:s.tracking&&(e+=s.tracking/1e3*r)}return e}clone(){return new se(this.tableViews)}delete(t){const e=se.tableDefinitions.get(t);return e?(this.tableViews.delete(t),this.tables.delete(e.prop),this):this}set(t,e){const n=se.tableDefinitions.get(t);return n&&this.tables.set(n.prop,e),this.tableViews.set(t,e.view),this}get(t){const e=se.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}};ke(Fn,"tableDefinitions",new Map);let Zt=Fn;class rt extends wt{setSfnt(t){return this._sfnt=t,this}getSfnt(){return this._sfnt}}var Bn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Xi=(i,t,e)=>t in i?Bn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xe=(i,t,e,n)=>{for(var r=n>1?void 0:n?ki(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Bn(t,e,r),r},qi=(i,t,e)=>(Xi(i,t+"",e),e);f.Cmap=class extends rt{constructor(){super(...arguments),qi(this,"_unicodeGlyphIndexMap")}static from(t){const e=Array.from(t.keys()).some(u=>u>65535),n=He.from(t),r=Ge.from(t),s=e?ze.from(t):void 0,a=4+(s?32:24),c=a+n.view.byteLength,h=c+r.view.byteLength,o=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:c},{platformID:3,platformSpecificID:1,offset:a},s&&{platformID:3,platformSpecificID:10,offset:h}].filter(Boolean),l=new f.Cmap(new ArrayBuffer(4+8*o.length+n.view.byteLength+r.view.byteLength+((s==null?void 0:s.view.byteLength)??0)));return l.numberSubtables=o.length,l.view.seek(4),o.forEach(u=>{l.view.writeUint16(u.platformID),l.view.writeUint16(u.platformSpecificID),l.view.writeUint32(u.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,c),s&&l.view.writeBytes(s.view,h),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 Ge(this.view.buffer,e.offset);break;case 2:r=new jt(this.view.buffer,e.offset,this.view.readUint16());break;case 4:r=new He(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 ze(this.view.buffer,e.offset,this.view.readUint32(e.offset+4));break;case 14:default:r=new Qt(this.view.buffer,e.offset,this.view.readUint32());break}return{...e,format:n,view:r}})}_getUnicodeGlyphIndexMap(){var c,h,o,l,u;const t=this._getSubtables(),e=(c=t.find(y=>y.format===0))==null?void 0:c.view,n=(h=t.find(y=>y.platformID===3&&y.platformSpecificID===3&&y.format===2))==null?void 0:h.view,r=(o=t.find(y=>y.platformID===3&&y.platformSpecificID===1&&y.format===4))==null?void 0:o.view,s=(l=t.find(y=>y.platformID===3&&y.platformSpecificID===10&&y.format===12))==null?void 0:l.view,a=(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())??[],...(a==null?void 0:a.getUnicodeGlyphIndexMap())??[]])}},Xe([p("uint16")],f.Cmap.prototype,"version",2),Xe([p("uint16")],f.Cmap.prototype,"numberSubtables",2),f.Cmap=Xe([tt("cmap")],f.Cmap);var ji=Object.defineProperty,Yi=(i,t,e)=>t in i?ji(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ki=(i,t,e)=>(Yi(i,t+"",e),e);class Nn{constructor(t){Ki(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 Xt(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],a={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(a)}return n}_parseGlyphCoordinate(t,e,n,r,s){let a;return(e&r)>0?(a=t.view.readUint8(),e&s||(a=-a),a=n+a):(e&s)>0?a=n:a=n+t.view.readInt16(),a}_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 c=this.endPointIndices=[];for(let m=0;m<r;m++)c.push(t.view.readUint16());const h=this.instructionLength=t.view.readUint16();Xt(h<5e3,`Bad instructionLength:${h}`);const o=this.instructions=[];for(let m=0;m<h;++m)o.push(t.view.readUint8());const l=t.view.byteOffset,u=c[c.length-1]+1;Xt(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(Xt(y.length===u,`Bad flags length: ${y.length}, numberOfCoordinates: ${u}`),c.length>0){const m=[];let v;if(u>0){for(let b=0;b<u;b+=1)d=y[b],v={},v.onCurve=!!(d&1),v.lastPointOfContour=c.includes(b),m.push(v);let x=0;for(let b=0;b<u;b+=1)d=y[b],v=m[b],v.x=this._parseGlyphCoordinate(t,d,x,2,16),x=v.x;let _=0;for(let b=0;b<u;b+=1)d=y[b],v=m[b],v.y=this._parseGlyphCoordinate(t,d,_,4,32),_=v.y}this.points=m}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let c,h=!0;for(;h;){c=t.view.readUint16();const o={glyphIndex:t.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(c&1)>0?(c&2)>0?(o.dx=t.view.readInt16(),o.dy=t.view.readInt16()):o.matchedPoints=[t.view.readUint16(),t.view.readUint16()]:(c&2)>0?(o.dx=t.view.readInt8(),o.dy=t.view.readInt8()):o.matchedPoints=[t.view.readUint8(),t.view.readUint8()],(c&8)>0?o.xScale=o.yScale=t.view.readInt16()/16384:(c&64)>0?(o.xScale=t.view.readInt16()/16384,o.yScale=t.view.readInt16()/16384):(c&128)>0&&(o.xScale=t.view.readInt16()/16384,o.scale01=t.view.readInt16()/16384,o.scale10=t.view.readInt16()/16384,o.yScale=t.view.readInt16()/16384),this.components.push(o),h=!!(c&32)}if(c&256){this.instructionLength=t.view.readUint16(),this.instructions=[];for(let o=0;o<this.instructionLength;o+=1)this.instructions.push(t.view.readUint8())}}if(this.isComposite)for(let c=0;c<this.components.length;c+=1){const h=this.components[c],o=n.get(h.glyphIndex);if(o.getPathCommands(),o.points){let l;if(h.matchedPoints===void 0)l=this._transformPoints(o.points,h);else{Xt(h.matchedPoints[0]>this.points.length-1||h.matchedPoints[1]>o.points.length-1,`Matched points out of range in ${this.name}`);const u=this.points[h.matchedPoints[0]];let y=o.points[h.matchedPoints[1]];const d={xScale:h.xScale,scale01:h.scale01,scale10:h.scale10,yScale:h.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(o.points,d)}this.points=this.points.concat(l)}}const s=[],a=this._parseContours(this.points);for(let c=0,h=a.length;c<h;++c){const o=a[c];let l=o[o.length-1],u=o[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=o.length;y<d;++y)if(l=u,u=o[(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 a=1/((s==null?void 0:s.unitsPerEm)??1e3)*n,{xScale:c=a,yScale:h=a}=r,o=this.pathCommands,l=[];for(let u=0,y=o.length;u<y;u+=1){const d=o[u];d.type==="M"?l.push({type:"M",x:t+d.x*c,y:e+-d.y*h}):d.type==="L"?l.push({type:"L",x:t+d.x*c,y:e+-d.y*h}):d.type==="Q"?l.push({type:"Q",x1:t+d.x1*c,y1:e+-d.y1*h,x:t+d.x*c,y:e+-d.y*h}):d.type==="Z"&&l.push({type:"Z"})}return l}}var Qi=Object.defineProperty,Zi=(i,t,e)=>t in i?Qi(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ji=(i,t,e)=>(Zi(i,t+"",e),e);class Gn{constructor(t){this._sfnt=t,Ji(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 Nn({index:t});const r=this._sfnt.loca.locations,s=this._sfnt.hmtx.metrics,a=s[t],c=r[t];a&&(n.advanceWidth=s[t].advanceWidth,n.leftSideBearing=s[t].leftSideBearing),c!==r[t+1]&&n._parse(this._sfnt.glyf,c,this),this._items[t]=n}return n}}var Rn=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,es=(i,t,e)=>t in i?Rn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ns=(i,t,e,n)=>{for(var r=n>1?void 0:n?ts(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Rn(t,e,r),r},rs=(i,t,e)=>(es(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 rt{constructor(){super(...arguments),rs(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 Gn(this._sfnt)),this._glyphs}},f.Glyf=ns([tt("glyf")],f.Glyf);var is=Object.defineProperty,ss=Object.getOwnPropertyDescriptor,os=(i,t,e,n)=>{for(var r=n>1?void 0:n?ss(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&is(t,e,r),r};f.Gpos=class extends rt{},f.Gpos=os([tt("GPOS","gpos")],f.Gpos);var as=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,Lt=(i,t,e,n)=>{for(var r=n>1?void 0:n?hs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&as(t,e,r),r};f.Gsub=class extends rt{},Lt([p("uint16")],f.Gsub.prototype,"majorVersion",2),Lt([p("uint16")],f.Gsub.prototype,"minorVersion",2),Lt([p("uint16")],f.Gsub.prototype,"scriptListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"featureListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"lookupListOffset",2),Lt([p("uint16")],f.Gsub.prototype,"featureVariationsOffset",2),f.Gsub=Lt([tt("GSUB","gsub")],f.Gsub);var cs=Object.defineProperty,ls=Object.getOwnPropertyDescriptor,k=(i,t,e,n)=>{for(var r=n>1?void 0:n?ls(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&cs(t,e,r),r};f.Head=class extends rt{constructor(t=new ArrayBuffer(54),e){super(t,e,54)}},k([p("fixed")],f.Head.prototype,"version",2),k([p("fixed")],f.Head.prototype,"fontRevision",2),k([p("uint32")],f.Head.prototype,"checkSumAdjustment",2),k([p("uint32")],f.Head.prototype,"magickNumber",2),k([p("uint16")],f.Head.prototype,"flags",2),k([p("uint16")],f.Head.prototype,"unitsPerEm",2),k([p({type:"longDateTime"})],f.Head.prototype,"created",2),k([p({type:"longDateTime"})],f.Head.prototype,"modified",2),k([p("int16")],f.Head.prototype,"xMin",2),k([p("int16")],f.Head.prototype,"yMin",2),k([p("int16")],f.Head.prototype,"xMax",2),k([p("int16")],f.Head.prototype,"yMax",2),k([p("uint16")],f.Head.prototype,"macStyle",2),k([p("uint16")],f.Head.prototype,"lowestRecPPEM",2),k([p("int16")],f.Head.prototype,"fontDirectionHint",2),k([p("int16")],f.Head.prototype,"indexToLocFormat",2),k([p("int16")],f.Head.prototype,"glyphDataFormat",2),f.Head=k([tt("head")],f.Head);var us=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,it=(i,t,e,n)=>{for(var r=n>1?void 0:n?fs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&us(t,e,r),r};f.Hhea=class extends rt{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},it([p("fixed")],f.Hhea.prototype,"version",2),it([p("int16")],f.Hhea.prototype,"ascent",2),it([p("int16")],f.Hhea.prototype,"descent",2),it([p("int16")],f.Hhea.prototype,"lineGap",2),it([p("uint16")],f.Hhea.prototype,"advanceWidthMax",2),it([p("int16")],f.Hhea.prototype,"minLeftSideBearing",2),it([p("int16")],f.Hhea.prototype,"minRightSideBearing",2),it([p("int16")],f.Hhea.prototype,"xMaxExtent",2),it([p("int16")],f.Hhea.prototype,"caretSlopeRise",2),it([p("int16")],f.Hhea.prototype,"caretSlopeRun",2),it([p("int16")],f.Hhea.prototype,"caretOffset",2),it([p({type:"int16",size:4})],f.Hhea.prototype,"reserved",2),it([p("int16")],f.Hhea.prototype,"metricDataFormat",2),it([p("uint16")],f.Hhea.prototype,"numOfLongHorMetrics",2),f.Hhea=it([tt("hhea")],f.Hhea);var Vn=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,ys=(i,t,e)=>t in i?Vn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ds=(i,t,e,n)=>{for(var r=n>1?void 0:n?ps(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Vn(t,e,r),r},gs=(i,t,e)=>(ys(i,t+"",e),e);f.Hmtx=class extends rt{constructor(){super(...arguments),gs(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=ds([tt("hmtx")],f.Hmtx);var ms=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,ws=(i,t,e,n)=>{for(var r=n>1?void 0:n?vs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&ms(t,e,r),r};f.Kern=class extends rt{},f.Kern=ws([tt("kern","kern")],f.Kern);var Hn=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,xs=(i,t,e)=>t in i?Hn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_s=(i,t,e,n)=>{for(var r=n>1?void 0:n?bs(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Hn(t,e,r),r},Ms=(i,t,e)=>(xs(i,t+"",e),e);f.Loca=class extends rt{constructor(){super(...arguments),Ms(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=_s([tt("loca")],f.Loca);var Ss=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,et=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ps(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Ss(t,e,r),r};f.Maxp=class extends rt{constructor(t=new ArrayBuffer(32),e){super(t,e,32)}},et([p("fixed")],f.Maxp.prototype,"version",2),et([p("uint16")],f.Maxp.prototype,"numGlyphs",2),et([p("uint16")],f.Maxp.prototype,"maxPoints",2),et([p("uint16")],f.Maxp.prototype,"maxContours",2),et([p("uint16")],f.Maxp.prototype,"maxComponentPoints",2),et([p("uint16")],f.Maxp.prototype,"maxComponentContours",2),et([p("uint16")],f.Maxp.prototype,"maxZones",2),et([p("uint16")],f.Maxp.prototype,"maxTwilightPoints",2),et([p("uint16")],f.Maxp.prototype,"maxStorage",2),et([p("uint16")],f.Maxp.prototype,"maxFunctionDefs",2),et([p("uint16")],f.Maxp.prototype,"maxInstructionDefs",2),et([p("uint16")],f.Maxp.prototype,"maxStackElements",2),et([p("uint16")],f.Maxp.prototype,"maxSizeOfInstructions",2),et([p("uint16")],f.Maxp.prototype,"maxComponentElements",2),et([p("uint16")],f.Maxp.prototype,"maxComponentDepth",2),f.Maxp=et([tt("maxp")],f.Maxp);var Cs=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ve=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ts(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Cs(t,e,r),r};const zn={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"},qe={Unicode:0,Macintosh:1,reserved:2,Microsoft:3},Os={Default:0,"Version1.1":1,ISO10646:2,UnicodeBMP:3,UnicodenonBMP:4,UnicodeVariationSequences:5,FullUnicodecoverage:6},Wn={Symbol:0,UCS2:1,ShiftJIS:2,PRC:3,BigFive:4,Johab:5,UCS4:6};f.Name=class extends rt{getNames(){const t=this.count;this.view.seek(6);const e=[];for(let h=0;h<t;++h)e.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});const n=this.stringOffset;for(let h=0;h<t;++h){const o=e[h];o.name=this.view.readBytes(n+o.offset,o.length)}let r=qe.Macintosh,s=Os.Default,a=0;e.some(h=>h.platform===qe.Microsoft&&h.encoding===Wn.UCS2&&h.language===1033)&&(r=qe.Microsoft,s=Wn.UCS2,a=1033);const c={};for(let h=0;h<t;++h){const o=e[h];o.platform===r&&o.encoding===s&&o.language===a&&zn[o.nameId]&&(c[zn[o.nameId]]=a===0?Oi(o.name):Ai(o.name))}return c}},ve([p("uint16")],f.Name.prototype,"format",2),ve([p("uint16")],f.Name.prototype,"count",2),ve([p("uint16")],f.Name.prototype,"stringOffset",2),f.Name=ve([tt("name")],f.Name);var As=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,P=(i,t,e,n)=>{for(var r=n>1?void 0:n?$s(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&As(t,e,r),r};f.Os2=class extends rt{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([tt("OS/2","os2")],f.Os2);var Is=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,bt=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ls(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Is(t,e,r),r};f.Post=class extends rt{constructor(t=new ArrayBuffer(32),e,n){super(t,e,n)}},bt([p("fixed")],f.Post.prototype,"format",2),bt([p("fixed")],f.Post.prototype,"italicAngle",2),bt([p("int16")],f.Post.prototype,"underlinePosition",2),bt([p("int16")],f.Post.prototype,"underlineThickness",2),bt([p("uint32")],f.Post.prototype,"isFixedPitch",2),bt([p("uint32")],f.Post.prototype,"minMemType42",2),bt([p("uint32")],f.Post.prototype,"maxMemType42",2),bt([p("uint32")],f.Post.prototype,"minMemType1",2),bt([p("uint32")],f.Post.prototype,"maxMemType1",2),f.Post=bt([tt("post")],f.Post);var Ds=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,st=(i,t,e,n)=>{for(var r=n>1?void 0:n?Us(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&Ds(t,e,r),r};f.Vhea=class extends rt{constructor(t=new ArrayBuffer(36),e){super(t,e,36)}},st([p("fixed")],f.Vhea.prototype,"version",2),st([p("int16")],f.Vhea.prototype,"vertTypoAscender",2),st([p("int16")],f.Vhea.prototype,"vertTypoDescender",2),st([p("int16")],f.Vhea.prototype,"vertTypoLineGap",2),st([p("int16")],f.Vhea.prototype,"advanceHeightMax",2),st([p("int16")],f.Vhea.prototype,"minTopSideBearing",2),st([p("int16")],f.Vhea.prototype,"minBottomSideBearing",2),st([p("int16")],f.Vhea.prototype,"yMaxExtent",2),st([p("int16")],f.Vhea.prototype,"caretSlopeRise",2),st([p("int16")],f.Vhea.prototype,"caretSlopeRun",2),st([p("int16")],f.Vhea.prototype,"caretOffset",2),st([p({type:"int16",size:4})],f.Vhea.prototype,"reserved",2),st([p("int16")],f.Vhea.prototype,"metricDataFormat",2),st([p("int16")],f.Vhea.prototype,"numOfLongVerMetrics",2),f.Vhea=st([tt("vhea")],f.Vhea);var kn=Object.defineProperty,Es=Object.getOwnPropertyDescriptor,Fs=(i,t,e)=>t in i?kn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Bs=(i,t,e,n)=>{for(var r=n>1?void 0:n?Es(t,e):t,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=(n?a(t,e,r):a(r))||r);return n&&r&&kn(t,e,r),r},Ns=(i,t,e)=>(Fs(i,t+"",e),e);f.Vmtx=class extends rt{constructor(){super(...arguments),Ns(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,a)=>(a<e&&(n=this.view.readUint16()),{advanceHeight:n,topSideBearing:this.view.readUint8()}))}},f.Vmtx=Bs([tt("vmtx")],f.Vmtx);var Xn=Object.defineProperty,Gs=(i,t,e)=>t in i?Xn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Jt=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Xn(t,e,r),r},je=(i,t,e)=>(Gs(i,typeof t!="symbol"?t+"":t,e),e);const Dt=class xe extends de{constructor(){super(...arguments),je(this,"mimeType","font/ttf"),je(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,a=n/4;s<a;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 xe(new ArrayBuffer(12+n*16+r)),a=Math.log(2);s.scalerType=65536,s.numTables=n,s.searchRange=Math.floor(Math.log(n)/a)*16,s.entrySelector=Math.floor(s.searchRange/a),s.rangeShift=n*16-s.searchRange;let c=12+n*16,h=0;const o=s.getDirectories();t.tableViews.forEach((u,y)=>{const d=o[h++];d.tag=y,d.checkSum=xe.checksum(u),d.offset=c,d.length=u.byteLength,s.view.writeBytes(u,c),c+=e(d.length)});const l=s.createSfnt().head;return l.checkSumAdjustment=0,l.checkSumAdjustment=2981146554-xe.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 Zt(this.getDirectories().reduce((t,e)=>(t[e.tag]=new DataView(this.view.buffer,this.view.byteOffset+e.offset,e.length),t),{}))}};je(Dt,"FLAGS",new Set([65536,1953658213,1954115633,1330926671])),Jt([p("uint32")],Dt.prototype,"scalerType"),Jt([p("uint16")],Dt.prototype,"numTables"),Jt([p("uint16")],Dt.prototype,"searchRange"),Jt([p("uint16")],Dt.prototype,"entrySelector"),Jt([p("uint16")],Dt.prototype,"rangeShift");let Mt=Dt;var Rs=Object.defineProperty,te=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&Rs(t,e,r),r};class Ut extends wt{constructor(t,e){super(t,e,20)}}te([p({type:"char",size:4})],Ut.prototype,"tag"),te([p("uint32")],Ut.prototype,"offset"),te([p("uint32")],Ut.prototype,"compLength"),te([p("uint32")],Ut.prototype,"origLength"),te([p("uint32")],Ut.prototype,"origChecksum");var qn=Object.defineProperty,Vs=(i,t,e)=>t in i?qn(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ht=(i,t,e,n)=>{for(var r=void 0,s=i.length-1,a;s>=0;s--)(a=i[s])&&(r=a(t,e,r)||r);return r&&qn(t,e,r),r},Ye=(i,t,e)=>(Vs(i,typeof t!="symbol"?t+"":t,e),e);const ot=class Je extends de{constructor(){super(...arguments),Ye(this,"mimeType","font/woff"),Ye(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,a=0;for(;a<r;)s+=e.getUint32(4*a++,!1);let c=n-r*4;if(c){let h=r*4;for(;c>0;)s+=e.getUint8(h)<<c*8,h++,c--}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(gi(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,a=r.reduce((u,y)=>u+n(y.view.byteLength),0),c=new Je(new ArrayBuffer(44+20*s+a+e.byteLength));c.signature=2001684038,c.flavor=65536,c.length=c.view.byteLength,c.numTables=s,c.totalSfntSize=12+16*s+r.reduce((u,y)=>u+n(y.rawView.byteLength),0);let h=44+s*20,o=0;const l=c.getDirectories();return r.forEach(u=>{const y=l[o++];y.tag=u.tag,y.offset=h,y.compLength=u.view.byteLength,y.origChecksum=Je.checkSum(u.rawView),y.origLength=u.rawView.byteLength,c.view.writeBytes(u.view,h),h+=n(y.compLength)}),c.view.writeBytes(e),c}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 Zt(this.getDirectories().reduce((t,e)=>{const n=e.tag,r=this.view.byteOffset+e.offset,s=e.compLength,a=e.origLength,c=r+s;return t[n]=s>=a?new DataView(this.view.buffer,r,s):new DataView(mi(new Uint8Array(this.view.buffer.slice(r,c))).buffer),t},{}))}};Ye(ot,"FLAGS",new Set([2001684038])),ht([p("uint32")],ot.prototype,"signature"),ht([p("uint32")],ot.prototype,"flavor"),ht([p("uint32")],ot.prototype,"length"),ht([p("uint16")],ot.prototype,"numTables"),ht([p("uint16")],ot.prototype,"reserved"),ht([p("uint32")],ot.prototype,"totalSfntSize"),ht([p("uint16")],ot.prototype,"majorVersion"),ht([p("uint16")],ot.prototype,"minorVersion"),ht([p("uint32")],ot.prototype,"metaOffset"),ht([p("uint32")],ot.prototype,"metaLength"),ht([p("uint32")],ot.prototype,"metaOrigLength"),ht([p("uint32")],ot.prototype,"privOffset"),ht([p("uint32")],ot.prototype,"privLength");let St=ot;var Hs=Object.defineProperty,zs=(i,t,e)=>t in i?Hs(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t,e)=>(zs(i,typeof t!="symbol"?t+"":t,e),e);const jn=class ir{constructor(){ee(this,"fallbackFont"),ee(this,"_loading",new Map),ee(this,"_loaded",new Map),ee(this,"_namesUrls",new Map)}_createRequest(t,e){const n=new AbortController;return{url:t,when:fetch(t,{...ir.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(Mt.is(t))return new Mt(t);if(St.is(t))return new St(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,...a}=e,{family:c,url:h}=t;if(this._loaded.has(h))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(h);let o=this._loading.get(h);return o||(o=this._createRequest(h,a),this._loading.set(h,o)),n&&this._loading.forEach((l,u)=>{l!==o&&(l.cancel(),this._loading.delete(u))}),o.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(c)?c:[c]).forEach(y=>{this._namesUrls.set(y,h),typeof document<"u"&&(r&&this.injectFontFace(y,l),s&&this.injectStyleTag(y,h))})),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(h)})}};ee(qn,"defaultRequestInit",{cache:"force-cache"});let jn=qn;const Yn=new jn;function Kn(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:a}=i,c=e.unicodeGlyphIndexMap,h=n.locations,o=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&&c.has(m)))).sort((m,v)=>m-v),y=new Map;u.forEach(m=>{const v=c.get(m)??0;let x=y.get(v);x||y.set(v,x=new Set),x.add(m)});const g=[],d=m=>{const v=o[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=h[m],b=h[m+1]??_,M={...v,...x,rawGlyphIndex:m,glyphIndex:g.length,unicodes:Array.from(y.get(m)??[]),view:new DataView(a.view.buffer,a.view.byteOffset+_,b-_)};return g.push(M),M};return d(0),u.forEach(m=>d(c.get(m))),g.slice().forEach(m=>{const{view:v}=m;if(!v.byteLength||v.getInt16(0)>=0)return;let _=10,b;do{b=v.getUint16(_);const M=_+2,T=v.getUint16(M);_+=4,Gt.ARG_1_AND_2_ARE_WORDS&b?_+=4:_+=2,Gt.WE_HAVE_A_SCALE&b?_+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&b?_+=4:Gt.WE_HAVE_A_TWO_BY_TWO&b&&(_+=8);const A=d(T);v.setUint16(M,A.glyphIndex)}while(Gt.MORE_COMPONENTS&b)}),g}function Qn(i,t){const e=Kn(i,t),n=e.length,{head:r,maxp:s,hhea:a,vhea:c}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let h=0;i.loca=f.Loca.from([...e.map(y=>{const g=h;return h+=y.view.byteLength,g}),h],r.indexToLocFormat);const o=e.reduce((y,g,d)=>(g.unicodes.forEach(m=>y.set(m,d)),y),new Map);i.cmap=f.Cmap.from(o),i.glyf=f.Glyf.from(e.map(y=>y.view)),a.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(y=>({advanceWidth:y.advanceWidth,leftSideBearing:y.leftSideBearing}))),c&&(c.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 Ws(i,t){let e,n;if(i instanceof Mt)e=i.sfnt.clone(),n="ttf";else if(i instanceof St)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(Mt.is(s))e=new Mt(s).sfnt,n="ttf-buffer";else if(St.is(s))e=new St(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Qn(e,t);switch(n){case"ttf":return Mt.from(r);case"woff":return St.from(r);case"ttf-buffer":return Mt.from(r).view.buffer;case"woff-buffer":default:return St.from(r).view.buffer}}function Ke(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function ks(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 Zn(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 Xs(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 qs(i,t,e=0,n=0,r=0,s=1,a=1){let c=Array.isArray(i)?i:[i];const h=-e/180*Math.PI,{x:o,y:l}=t;return(s!==1||a!==1)&&(c=c.map(u=>Xs(u,t,s,a))),(n||r)&&(c=c.map(u=>Zn(u,t,n,r))),c=c.map(u=>{const y=u.x-o,g=-(u.y-l);return u=ks({x:y,y:g},h),{x:o+u.x,y:l-u.y}}),c[0]}const js=new Set(["©","®","÷"]),Ys=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class Ks{constructor(t,e,n){G(this,"boundingBox",new L);G(this,"path",new ft);G(this,"textWidth",0);G(this,"textHeight",0);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}_updateFont(){var e;const t=(e=Yn.get(this.computedStyle.fontFamily))==null?void 0:e.font;return(t instanceof St||t instanceof Mt)&&(this.font=t.sfnt),this}_updateGlyph(t){const{content:e,computedStyle:n,boundingBox:r,isVertical:s}=this,{left:a,top:c,height:h}=r,{fontSize:o}=n,{unitsPerEm:l,ascender:u,descender:y,os2:g,post:d}=t,m=l/o,v=t.getAdvanceWidth(e,o),x=(u+Math.abs(y))/m,_=u/m,b=(u-g.yStrikeoutPosition)/m,M=g.yStrikeoutSize/m,T=(u-d.underlinePosition)/m,A=d.underlineThickness/m;return this.glyphWidth=v,this.glyphHeight=x,this.underlinePosition=T,this.underlineThickness=A,this.yStrikeoutPosition=b,this.yStrikeoutSize=M,this.baseline=_,this.centerDiviation=.5*h-_,this.glyphBox=s?new L(a,c,x,v):new L(a,c,v,x),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._updateFont().font;if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:a,computedStyle:c,baseline:h,glyphHeight:o,glyphWidth:l,yStrikeoutPosition:u,underlinePosition:y}=this._updateGlyph(t),{os2:g,ascender:d,descender:m}=t,v=d,x=m,_=g.sTypoAscender,{left:b,top:M,width:T,height:A}=a,{fontSize:$,fontStyle:C,textDecoration:S}=c;let D=b,B=M+h,z,V;if(e&&(D+=(o-l)/2,Math.abs(r-s)>.1&&(B-=(v-_)/(v+Math.abs(x))*o),z=void 0),e&&!js.has(n)&&(n.codePointAt(0)<=256||Ys.has(n))){V=t.getPathCommands(n,D,M+h-(o-l)/2,$)??[];const O={y:M-(o-l)/2+o/2,x:D+l/2};C==="italic"&&q(V,e?{x:O.x,y:M-(o-l)/2+h}:null),W(V,O)}else z!==void 0?(V=t.glyf.glyphs.get(z).getPathCommands(D,B,$),C==="italic"&&q(V,e?{x:D+l/2,y:M+_/(v+Math.abs(x))*o}:null)):(V=t.getPathCommands(n,D,B,$)??[],C==="italic"&&q(V,e?{x:D+o/2,y:B}:null));const X=.1*$;if(e){const O=(E,I)=>[{type:"M",x:E,y:M},{type:"L",x:E,y:M+A},{type:"L",x:E+I,y:M+A},{type:"L",x:E+I,y:M},{type:"Z"}];switch(S){case"underline":V.push(...O(b,X));break;case"line-through":V.push(...O(b+T/2,X));break}}else{const O=(E,I)=>[{type:"M",x:b,y:E},{type:"L",x:b+T,y:E},{type:"L",x:b+T,y:E+I},{type:"L",x:b,y:E+I},{type:"Z"}];switch(S){case"underline":V.push(...O(M+y,X));break;case"line-through":V.push(...O(M+u,X));break}}return this.path=new ft(V),this;function q(O,E){const I=E||{y:M+h,x:b+l/2};O.forEach(Y=>{["","1","2"].forEach(H=>{if(Y[`x${H}`]){const pt=Zn({x:Y[`x${H}`],y:Y[`y${H}`]},I,-.24,0);Y[`x${H}`]=pt.x,Y[`y${H}`]=pt.y}})})}function W(O,E){O.forEach(I=>{["","1","2"].forEach(Y=>{if(I[`x${Y}`]){const H=qs({x:I[`x${Y}`],y:I[`y${Y}`]},E,90);I[`x${Y}`]=H.x,I[`y${Y}`]=H.y}})})}}update(){return this.updatePath(),this}drawTo(t,e={}){vn({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Qs{constructor(t,e={},n){G(this,"boundingBox",new L);G(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,...Ke(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new Ks(n,e++,this));return this.characters=t,this}}class ne{constructor(t,e){G(this,"boundingBox",new L);G(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ke(this.parentStyle),...Ke(this.style)},this}addFragment(t,e){const n=new Qs(t,e,this);return this.fragments.push(n),n}}class Zs extends Ft{parse(t){const{style:e}=this._text,n=[];if(typeof t=="string"){const r=new ne({},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 ne({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new ne({},e);r.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:c,highlight:h,...o}=a;if(c!==void 0){const l=s.addFragment(c,o);l.highlight=h}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...a}=r,c=new ne(a,e);s.forEach(h=>{const{content:o,highlight:l,...u}=h;if(o!==void 0){const y=c.addFragment(o,u);y.highlight=l}}),n.push(c)}else if("content"in r){const{content:s,highlight:a,...c}=r;if(s!==void 0){const h=new ne(c,e),o=h.addFragment(s);o.highlight=a,n.push(h)}}}return n}}class Js extends Ft{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:a,width:c,height:h}=r,o=e.canvas;return o.dataset.viewbox=`${s} ${a} ${c} ${h}`,o.dataset.pixelRatio=String(n),o.width=Math.max(1,Math.ceil(c*n)),o.height=Math.max(1,Math.ceil(h*n)),o.style.marginTop=`${a}px`,o.style.marginLeft=`${s}px`,o.style.width=`${c}px`,o.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-a),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,style:r,renderBoundingBox:s}=this._text,{width:a,height:c}=s;return le(r,new L(0,0,a,c),e),n.forEach(h=>{le(h.computedStyle,h.boundingBox,e),h.fragments.forEach(o=>{le(o.computedStyle,o.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{style:n,paragraphs:r}=this._text;function s(a,c,h,o,l){e.fillStyle=a,e.fillRect(c,h,o,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(a=>{var c;(c=a.style)!=null&&c.backgroundColor&&s(a.computedStyle.backgroundColor,...a.boundingBox.toArray()),a.fragments.forEach(h=>{var o;(o=h.style)!=null&&o.backgroundColor&&s(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Jn={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 to{constructor(t){G(this,"style");G(this,"paragraphs");G(this,"effects");G(this,"deformation");G(this,"boundingBox",new L);G(this,"renderBoundingBox",new L);G(this,"_parser",new Zs(this));G(this,"_measurer",new ri(this));G(this,"_deformer",new Jr(this));G(this,"_effector",new ei(this));G(this,"_highlighter",new ni(this));G(this,"_renderer2D",new Js(this));const{content:e,style:n,effects:r,deformation:s}=t;this.style={...Jn,...n},this.effects=r,this.deformation=s,this.paragraphs=this._parser.parse(e)}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t){return this._measurer.measure(t)}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e,this.characters.forEach(s=>s.update()),this.deformation&&this._deformer.deform(),this._highlighter.highlight();const n=w.MAX,r=w.MIN;return this.characters.forEach(s=>s.path.getMinMax(n,r)),this.renderBoundingBox=new L(n.x,n.y,r.x-n.x,r.y-n.y),this}render(t){var s;const{view:e,pixelRatio:n=2}=t,r=e.getContext("2d");return r?(this.update(),(s=this.effects)!=null&&s.length?(this.renderBoundingBox=L.from(this.boundingBox,this.renderBoundingBox,this._effector.getBoundingBox(),this._highlighter.getBoundingBox()),this._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),this._effector.draw({ctx:r})):(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}),this._renderer2D.draw({ctx:r})),this):this}}f.CmapSubtableFormat0=Ge,f.CmapSubtableFormat12=ze,f.CmapSubtableFormat14=Qt,f.CmapSubtableFormat2=jt,f.CmapSubtableFormat4=He,f.CmapSubtableFormat6=It,f.Eot=Ui,f.Font=ge,f.Fonts=jn,f.Glyph=Bn,f.GlyphSet=Nn,f.Sfnt=Zt,f.TableDirectory=Bt,f.Text=to,f.Ttf=Mt,f.Woff=St,f.WoffTableDirectoryEntry=Et,f.componentFlags=Gt,f.createCmapSegments=Ve,f.defaultTextStyles=Jn,f.defineSfntTable=tt,f.fonts=Yn,f.minify=Ws,f.minifyGlyphs=Kn,f.minifySfnt=Qn,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
4
+ }`)),document.head.appendChild(n),this}parse(t){if(Mt.is(t))return new Mt(t);if(St.is(t))return new St(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,...a}=e,{family:c,url:h}=t;if(this._loaded.has(h))return n&&(this._loading.forEach(l=>l.cancel()),this._loading.clear()),this._loaded.get(h);let o=this._loading.get(h);return o||(o=this._createRequest(h,a),this._loading.set(h,o)),n&&this._loading.forEach((l,u)=>{l!==o&&(l.cancel(),this._loading.delete(u))}),o.when.then(l=>{const u={...t,font:this.parse(l)??l};return this._loaded.has(h)||(this._loaded.set(h,u),new Set(Array.isArray(c)?c:[c]).forEach(y=>{this._namesUrls.set(y,h),typeof document<"u"&&(r&&this.injectFontFace(y,l),s&&this.injectStyleTag(y,h))})),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(h)})}};ee(jn,"defaultRequestInit",{cache:"force-cache"});let Yn=jn;const Kn=new Yn;function Qn(i,t){const{cmap:e,loca:n,hmtx:r,vmtx:s,glyf:a}=i,c=e.unicodeGlyphIndexMap,h=n.locations,o=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&&c.has(m)))).sort((m,v)=>m-v),y=new Map;u.forEach(m=>{const v=c.get(m)??0;let x=y.get(v);x||y.set(v,x=new Set),x.add(m)});const d=[],g=m=>{const v=o[m],x=(l==null?void 0:l[m])??{advanceHeight:0,topSideBearing:0},_=h[m],b=h[m+1]??_,M={...v,...x,rawGlyphIndex:m,glyphIndex:d.length,unicodes:Array.from(y.get(m)??[]),view:new DataView(a.view.buffer,a.view.byteOffset+_,b-_)};return d.push(M),M};return g(0),u.forEach(m=>g(c.get(m))),d.slice().forEach(m=>{const{view:v}=m;if(!v.byteLength||v.getInt16(0)>=0)return;let _=10,b;do{b=v.getUint16(_);const M=_+2,T=v.getUint16(M);_+=4,Gt.ARG_1_AND_2_ARE_WORDS&b?_+=4:_+=2,Gt.WE_HAVE_A_SCALE&b?_+=2:Gt.WE_HAVE_AN_X_AND_Y_SCALE&b?_+=4:Gt.WE_HAVE_A_TWO_BY_TWO&b&&(_+=8);const A=g(T);v.setUint16(M,A.glyphIndex)}while(Gt.MORE_COMPONENTS&b)}),d}function Zn(i,t){const e=Qn(i,t),n=e.length,{head:r,maxp:s,hhea:a,vhea:c}=i;r.checkSumAdjustment=0,r.magickNumber=1594834165,r.indexToLocFormat=1,s.numGlyphs=n;let h=0;i.loca=f.Loca.from([...e.map(y=>{const d=h;return h+=y.view.byteLength,d}),h],r.indexToLocFormat);const o=e.reduce((y,d,g)=>(d.unicodes.forEach(m=>y.set(m,g)),y),new Map);i.cmap=f.Cmap.from(o),i.glyf=f.Glyf.from(e.map(y=>y.view)),a.numOfLongHorMetrics=n,i.hmtx=f.Hmtx.from(e.map(y=>({advanceWidth:y.advanceWidth,leftSideBearing:y.leftSideBearing}))),c&&(c.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 Ws(i,t){let e,n;if(i instanceof Mt)e=i.sfnt.clone(),n="ttf";else if(i instanceof St)e=i.sfnt.clone(),n="woff";else{const s=At(i);if(Mt.is(s))e=new Mt(s).sfnt,n="ttf-buffer";else if(St.is(s))e=new St(s).sfnt,n="woff-buffer";else throw new Error("Failed to minify, only support ttf、woff source")}const r=Zn(e,t);switch(n){case"ttf":return Mt.from(r);case"woff":return St.from(r);case"ttf-buffer":return Mt.from(r).view.buffer;case"woff-buffer":default:return St.from(r).view.buffer}}function Ke(i){if(!i)return i;const t={};for(const e in i)i[e]!==""&&i[e]!==void 0&&(t[e]=i[e]);return t}function ks(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 Jn(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 Xs(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 qs(i,t,e=0,n=0,r=0,s=1,a=1){let c=Array.isArray(i)?i:[i];const h=-e/180*Math.PI,{x:o,y:l}=t;return(s!==1||a!==1)&&(c=c.map(u=>Xs(u,t,s,a))),(n||r)&&(c=c.map(u=>Jn(u,t,n,r))),c=c.map(u=>{const y=u.x-o,d=-(u.y-l);return u=ks({x:y,y:d},h),{x:o+u.x,y:l-u.y}}),c[0]}const js=new Set(["©","®","÷"]),Ys=new Set(["—","…","“","”","﹏","﹋","﹌","‘","’","˜"]);class Ks{constructor(t,e,n){B(this,"boundingBox",new L);B(this,"path",new ft);B(this,"textWidth",0);B(this,"textHeight",0);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}_updateFont(){var e;const t=(e=Kn.get(this.computedStyle.fontFamily))==null?void 0:e.font;return(t instanceof St||t instanceof Mt)&&(this.font=t.sfnt),this}_updateGlyph(t){const{content:e,computedStyle:n,boundingBox:r,isVertical:s}=this,{left:a,top:c,height:h}=r,{fontSize:o}=n,{unitsPerEm:l,ascender:u,descender:y,os2:d,post:g}=t,m=l/o,v=t.getAdvanceWidth(e,o),x=(u+Math.abs(y))/m,_=u/m,b=(u-d.yStrikeoutPosition)/m,M=d.yStrikeoutSize/m,T=(u-g.underlinePosition)/m,A=g.underlineThickness/m;return this.glyphWidth=v,this.glyphHeight=x,this.underlinePosition=T,this.underlineThickness=A,this.yStrikeoutPosition=b,this.yStrikeoutSize=M,this.baseline=_,this.centerDiviation=.5*h-_,this.glyphBox=s?new L(a,c,x,v):new L(a,c,v,x),this.centerPoint=this.glyphBox.getCenterPoint(),this}updatePath(){const t=this._updateFont().font;if(!t)return this;const{isVertical:e,content:n,textWidth:r,textHeight:s,boundingBox:a,computedStyle:c,baseline:h,glyphHeight:o,glyphWidth:l,yStrikeoutPosition:u,underlinePosition:y}=this._updateGlyph(t),{os2:d,ascender:g,descender:m}=t,v=g,x=m,_=d.sTypoAscender,{left:b,top:M,width:T,height:A}=a,{fontSize:$,fontStyle:C,textDecoration:S}=c;let D=b,N=M+h,z,V;if(e&&(D+=(o-l)/2,Math.abs(r-s)>.1&&(N-=(v-_)/(v+Math.abs(x))*o),z=void 0),e&&!js.has(n)&&(n.codePointAt(0)<=256||Ys.has(n))){V=t.getPathCommands(n,D,M+h-(o-l)/2,$)??[];const O={y:M-(o-l)/2+o/2,x:D+l/2};C==="italic"&&q(V,e?{x:O.x,y:M-(o-l)/2+h}:null),W(V,O)}else z!==void 0?(V=t.glyf.glyphs.get(z).getPathCommands(D,N,$),C==="italic"&&q(V,e?{x:D+l/2,y:M+_/(v+Math.abs(x))*o}:null)):(V=t.getPathCommands(n,D,N,$)??[],C==="italic"&&q(V,e?{x:D+o/2,y:N}:null));const X=.1*$;if(e){const O=(U,I)=>[{type:"M",x:U,y:M},{type:"L",x:U,y:M+A},{type:"L",x:U+I,y:M+A},{type:"L",x:U+I,y:M},{type:"Z"}];switch(S){case"underline":V.push(...O(b,X));break;case"line-through":V.push(...O(b+T/2,X));break}}else{const O=(U,I)=>[{type:"M",x:b,y:U},{type:"L",x:b+T,y:U},{type:"L",x:b+T,y:U+I},{type:"L",x:b,y:U+I},{type:"Z"}];switch(S){case"underline":V.push(...O(M+y,X));break;case"line-through":V.push(...O(M+u,X));break}}return this.path=new ft(V),this;function q(O,U){const I=U||{y:M+h,x:b+l/2};O.forEach(Y=>{["","1","2"].forEach(H=>{if(Y[`x${H}`]){const pt=Jn({x:Y[`x${H}`],y:Y[`y${H}`]},I,-.24,0);Y[`x${H}`]=pt.x,Y[`y${H}`]=pt.y}})})}function W(O,U){O.forEach(I=>{["","1","2"].forEach(Y=>{if(I[`x${Y}`]){const H=qs({x:I[`x${Y}`],y:I[`y${Y}`]},U,90);I[`x${Y}`]=H.x,I[`y${Y}`]=H.y}})})}}update(){return this.updatePath(),this}drawTo(t,e={}){wn({ctx:t,paths:[this.path],fontSize:this.computedStyle.fontSize,color:this.computedStyle.color,...e})}}class Qs{constructor(t,e={},n){B(this,"boundingBox",new L);B(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,...Ke(this.style)},this}initCharacters(){const t=[];let e=0;for(const n of this.computedContent)t.push(new Ks(n,e++,this));return this.characters=t,this}}class ne{constructor(t,e){B(this,"boundingBox",new L);B(this,"fragments",[]);this.style=t,this.parentStyle=e,this.updateComputedStyle()}updateComputedStyle(){return this.computedStyle={...Ke(this.parentStyle),...Ke(this.style)},this}addFragment(t,e){const n=new Qs(t,e,this);return this.fragments.push(n),n}}class Zs extends Ft{parse(){let{content:t,computedStyle:e}=this._text;const n=[];if(typeof t=="string"){const r=new ne({},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 ne({},e);s.addFragment(r),n.push(s)}else if(Array.isArray(r)){const s=new ne({},e);r.forEach(a=>{if(typeof a=="string")s.addFragment(a);else{const{content:c,highlight:h,...o}=a;if(c!==void 0){const l=s.addFragment(c,o);l.highlight=h}}}),n.push(s)}else if("fragments"in r){const{fragments:s,...a}=r,c=new ne(a,e);s.forEach(h=>{const{content:o,highlight:l,...u}=h;if(o!==void 0){const y=c.addFragment(o,u);y.highlight=l}}),n.push(c)}else if("content"in r){const{content:s,highlight:a,...c}=r;if(s!==void 0){const h=new ne(c,e),o=h.addFragment(s);o.highlight=a,n.push(h)}}}return n}}class Js extends Ft{setupView(t){const{ctx:e,pixelRatio:n}=t,{renderBoundingBox:r}=this._text,{left:s,top:a,width:c,height:h}=r,o=e.canvas;return o.dataset.viewbox=`${s} ${a} ${c} ${h}`,o.dataset.pixelRatio=String(n),o.width=Math.max(1,Math.ceil(c*n)),o.height=Math.max(1,Math.ceil(h*n)),o.style.marginTop=`${a}px`,o.style.marginLeft=`${s}px`,o.style.width=`${c}px`,o.style.height=`${h}px`,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.scale(n,n),e.translate(-s,-a),this}uploadColors(t){const{ctx:e}=t,{paragraphs:n,computedStyle:r,renderBoundingBox:s}=this._text,{width:a,height:c}=s;return le(r,new L(0,0,a,c),e),n.forEach(h=>{le(h.computedStyle,h.boundingBox,e),h.fragments.forEach(o=>{le(o.computedStyle,o.boundingBox,e)})}),this}fillBackground(t){const{ctx:e}=t,{computedStyle:n,paragraphs:r}=this._text;function s(a,c,h,o,l){e.fillStyle=a,e.fillRect(c,h,o,l)}return n!=null&&n.backgroundColor&&s(n.backgroundColor,0,0,e.canvas.width,e.canvas.height),r.forEach(a=>{var c;(c=a.style)!=null&&c.backgroundColor&&s(a.computedStyle.backgroundColor,...a.boundingBox.toArray()),a.fragments.forEach(h=>{var o;(o=h.style)!=null&&o.backgroundColor&&s(h.computedStyle.backgroundColor,...h.boundingBox.toArray())})}),this}draw(t){const{ctx:e}=t,{characters:n}=this._text;return n.forEach(r=>{r.drawTo(e)}),this}}const Qe={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 to{constructor(t){B(this,"content");B(this,"style");B(this,"effects");B(this,"deformation");B(this,"needsUpdate",!0);B(this,"computedStyle",{...Qe});B(this,"paragraphs",[]);B(this,"boundingBox",new L);B(this,"renderBoundingBox",new L);B(this,"_parser",new Zs(this));B(this,"_measurer",new ri(this));B(this,"_deformer",new Jr(this));B(this,"_effector",new ei(this));B(this,"_highlighter",new ni(this));B(this,"_renderer2D",new Js(this));const{content:e,style:n={},effects:r,deformation:s}=t;this.content=e,this.style=n,this.effects=r,this.deformation=s}get characters(){return this.paragraphs.flatMap(t=>t.fragments.flatMap(e=>e.characters))}measure(t){return this.computedStyle={...Qe,...this.style},this.paragraphs=this._parser.parse(),this._measurer.measure(t)}requestUpdate(){return this.needsUpdate=!0,this}update(){const{paragraphs:t,boundingBox:e}=this.measure();this.paragraphs=t,this.boundingBox=e,this.characters.forEach(s=>s.update()),this.deformation&&this._deformer.deform(),this._highlighter.highlight();const n=w.MAX,r=w.MIN;return this.characters.forEach(s=>s.path.getMinMax(n,r)),this.renderBoundingBox=new L(n.x,n.y,r.x-n.x,r.y-n.y),this}render(t){var s;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._renderer2D.setupView({pixelRatio:n,ctx:r}),this._renderer2D.uploadColors({ctx:r}),this._highlighter.draw({ctx:r}),this._effector.draw({ctx:r})):(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}),this._renderer2D.draw({ctx:r})),this):this}}f.CmapSubtableFormat0=Ge,f.CmapSubtableFormat12=ze,f.CmapSubtableFormat14=Qt,f.CmapSubtableFormat2=jt,f.CmapSubtableFormat4=He,f.CmapSubtableFormat6=It,f.Eot=Ei,f.Font=de,f.Fonts=Yn,f.Glyph=Nn,f.GlyphSet=Gn,f.Sfnt=Zt,f.TableDirectory=Bt,f.Text=to,f.Ttf=Mt,f.Woff=St,f.WoffTableDirectoryEntry=Ut,f.componentFlags=Gt,f.createCmapSegments=Ve,f.defaultTextStyles=Qe,f.defineSfntTable=tt,f.fonts=Kn,f.minify=Ws,f.minifyGlyphs=Qn,f.minifySfnt=Zn,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -154,7 +154,7 @@ class Highlighter extends Feature {
154
154
  return new BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
155
155
  }
156
156
  highlight() {
157
- const { characters, style } = this._text;
157
+ const { characters, computedStyle: style } = this._text;
158
158
  const fontSize = style.fontSize;
159
159
  let group;
160
160
  const groups = [];
@@ -233,7 +233,7 @@ class Highlighter extends Feature {
233
233
  drawPaths({
234
234
  ctx,
235
235
  paths: this.paths,
236
- fontSize: this._text.style.fontSize,
236
+ fontSize: this._text.computedStyle.fontSize,
237
237
  fill: false
238
238
  });
239
239
  return this;
@@ -274,7 +274,7 @@ class Measurer extends Feature {
274
274
  * </div>
275
275
  */
276
276
  createDom() {
277
- const { paragraphs, style } = this._text;
277
+ const { paragraphs, computedStyle: style } = this._text;
278
278
  const documentFragment = document.createDocumentFragment();
279
279
  const dom = document.createElement("div");
280
280
  Object.assign(dom.style, this._styleToDomStyle(style));
@@ -370,7 +370,7 @@ class Measurer extends Feature {
370
370
  };
371
371
  }
372
372
  measureDom(dom) {
373
- const paragraphs = this._text.paragraphs;
373
+ const { paragraphs } = this._text;
374
374
  const rect = dom.getBoundingClientRect();
375
375
  const innerEl = dom.querySelector("ul");
376
376
  const isVertical = window.getComputedStyle(dom).writingMode.includes("vertical");
@@ -811,8 +811,8 @@ class Paragraph {
811
811
  }
812
812
 
813
813
  class Parser extends Feature {
814
- parse(content) {
815
- const { style } = this._text;
814
+ parse() {
815
+ let { content, computedStyle: style } = this._text;
816
816
  const paragraphs = [];
817
817
  if (typeof content === "string") {
818
818
  const paragraph = new Paragraph({}, style);
@@ -886,7 +886,7 @@ class Renderer2D extends Feature {
886
886
  }
887
887
  uploadColors(options) {
888
888
  const { ctx } = options;
889
- const { paragraphs, style, renderBoundingBox } = this._text;
889
+ const { paragraphs, computedStyle: style, renderBoundingBox } = this._text;
890
890
  const { width, height } = renderBoundingBox;
891
891
  uploadColor(style, new BoundingBox(0, 0, width, height), ctx);
892
892
  paragraphs.forEach((paragraph) => {
@@ -899,7 +899,7 @@ class Renderer2D extends Feature {
899
899
  }
900
900
  fillBackground(options) {
901
901
  const { ctx } = options;
902
- const { style, paragraphs } = this._text;
902
+ const { computedStyle: style, paragraphs } = this._text;
903
903
  function fillBackground(color, x, y, width, height) {
904
904
  ctx.fillStyle = color;
905
905
  ctx.fillRect(x, y, width, height);
@@ -961,10 +961,13 @@ const defaultTextStyles = {
961
961
  };
962
962
  class Text {
963
963
  constructor(options) {
964
+ __publicField(this, "content");
964
965
  __publicField(this, "style");
965
- __publicField(this, "paragraphs");
966
966
  __publicField(this, "effects");
967
967
  __publicField(this, "deformation");
968
+ __publicField(this, "needsUpdate", true);
969
+ __publicField(this, "computedStyle", { ...defaultTextStyles });
970
+ __publicField(this, "paragraphs", []);
968
971
  __publicField(this, "boundingBox", new BoundingBox());
969
972
  __publicField(this, "renderBoundingBox", new BoundingBox());
970
973
  __publicField(this, "_parser", new Parser(this));
@@ -973,18 +976,24 @@ class Text {
973
976
  __publicField(this, "_effector", new Effector(this));
974
977
  __publicField(this, "_highlighter", new Highlighter(this));
975
978
  __publicField(this, "_renderer2D", new Renderer2D(this));
976
- const { content, style, effects, deformation } = options;
977
- this.style = { ...defaultTextStyles, ...style };
979
+ const { content, style = {}, effects, deformation } = options;
980
+ this.content = content;
981
+ this.style = style;
978
982
  this.effects = effects;
979
983
  this.deformation = deformation;
980
- this.paragraphs = this._parser.parse(content);
981
984
  }
982
985
  get characters() {
983
986
  return this.paragraphs.flatMap((p) => p.fragments.flatMap((f) => f.characters));
984
987
  }
985
988
  measure(dom) {
989
+ this.computedStyle = { ...defaultTextStyles, ...this.style };
990
+ this.paragraphs = this._parser.parse();
986
991
  return this._measurer.measure(dom);
987
992
  }
993
+ requestUpdate() {
994
+ this.needsUpdate = true;
995
+ return this;
996
+ }
988
997
  update() {
989
998
  const { paragraphs, boundingBox } = this.measure();
990
999
  this.paragraphs = paragraphs;
@@ -1006,7 +1015,9 @@ class Text {
1006
1015
  if (!ctx) {
1007
1016
  return this;
1008
1017
  }
1009
- this.update();
1018
+ if (this.needsUpdate) {
1019
+ this.update();
1020
+ }
1010
1021
  if (this.effects?.length) {
1011
1022
  this.renderBoundingBox = BoundingBox.from(
1012
1023
  this.boundingBox,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
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",