@mlightcad/mtext-renderer 0.12.10 → 0.12.11

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.js CHANGED
@@ -522,7 +522,7 @@ class aa extends I.Shape {
522
522
  return this.width > 0;
523
523
  }
524
524
  }
525
- class Fe {
525
+ class Te {
526
526
  /**
527
527
  * Converts an unsigned byte to a signed byte as used in SHX format.
528
528
  * Values > 127 are converted to their signed equivalent (-128 to -1).
@@ -1005,7 +1005,7 @@ class Vo {
1005
1005
  return !1;
1006
1006
  }
1007
1007
  }
1008
- class Fn extends Vo {
1008
+ class Tn extends Vo {
1009
1009
  constructor(e = ms) {
1010
1010
  super(), this.cellWidthFactor = e;
1011
1011
  }
@@ -1027,17 +1027,17 @@ class Fn extends Vo {
1027
1027
  if (!e.polylines.some((a) => a.length >= 2))
1028
1028
  return n * r;
1029
1029
  const s = n * r, { maxX: i } = e.bbox;
1030
- return Fn.isCenterOriginGlyph(e) ? Math.max(i, n / 2) + s : i + s;
1030
+ return Tn.isCenterOriginGlyph(e) ? Math.max(i, n / 2) + s : i + s;
1031
1031
  }
1032
1032
  resolve(e, n) {
1033
1033
  var r;
1034
- return e.hasExplicitAdvance ? ((r = e.lastPoint) == null ? void 0 : r.x) ?? 0 : Fn.computeAdvance(e, n, this.cellWidthFactor);
1034
+ return e.hasExplicitAdvance ? ((r = e.lastPoint) == null ? void 0 : r.x) ?? 0 : Tn.computeAdvance(e, n, this.cellWidthFactor);
1035
1035
  }
1036
1036
  markAlignedAdvanceExplicit(e) {
1037
1037
  return !0;
1038
1038
  }
1039
1039
  }
1040
- const Nn = new Fn();
1040
+ const Nn = new Tn();
1041
1041
  class se {
1042
1042
  /**
1043
1043
  * Creates a new Point instance.
@@ -1271,7 +1271,7 @@ class Bt {
1271
1271
  } = i, y = ua(i), m = this.bbox;
1272
1272
  let b = y;
1273
1273
  u && qo(m) && !jo(y, m) && (b = $o(y, m));
1274
- const v = b.maxX - b.minX, w = b.maxY - b.minY, C = v * l, T = w * l, E = b.minX - C, R = b.maxX + C, P = b.minY - T, W = b.maxY + T;
1274
+ const v = b.maxX - b.minX, w = b.maxY - b.minY, C = v * l, F = w * l, E = b.minX - C, R = b.maxX + C, P = b.minY - F, W = b.maxY + F;
1275
1275
  o = c((N) => ({
1276
1276
  x: N.x,
1277
1277
  y: -N.y
@@ -1837,7 +1837,7 @@ class ac {
1837
1837
  return s;
1838
1838
  if (this.isVerticalDualBigfontMarker(e, s, "close"))
1839
1839
  return s + 1;
1840
- i = e[s], i === 0 && (s++, i = e[s++] << 8 | e[s++], l.x = Fe.byteToSByte(e[s++]) * r.scale, l.y = Fe.byteToSByte(e[s++]) * r.scale, this.fontData.content.isExtended ? (c = e[s++] * r.scale, o = e[s] * r.scale) : (o = e[s] * r.scale, c = o));
1840
+ i = e[s], i === 0 && (s++, i = e[s++] << 8 | e[s++], l.x = Te.byteToSByte(e[s++]) * r.scale, l.y = Te.byteToSByte(e[s++]) * r.scale, this.fontData.content.isExtended ? (c = e[s++] * r.scale, o = e[s] * r.scale) : (o = e[s] * r.scale, c = o));
1841
1841
  break;
1842
1842
  case K.UNIFONT:
1843
1843
  s++, i = e[s++] << 8 | e[s++], s--;
@@ -1877,13 +1877,13 @@ class ac {
1877
1877
  handleXYDisplacement(e, n, r) {
1878
1878
  let s = n;
1879
1879
  const i = new se();
1880
- return i.x = Fe.byteToSByte(e[++s]), i.y = Fe.byteToSByte(e[++s]), r.currentPoint.add(i.multiply(r.scale)), r.isPenDown ? r.currentPolyline.push(r.currentPoint.clone()) : this.notePenUpPositioning(r), s;
1880
+ return i.x = Te.byteToSByte(e[++s]), i.y = Te.byteToSByte(e[++s]), r.currentPoint.add(i.multiply(r.scale)), r.isPenDown ? r.currentPolyline.push(r.currentPoint.clone()) : this.notePenUpPositioning(r), s;
1881
1881
  }
1882
1882
  handleMultipleXYDisplacements(e, n, r) {
1883
1883
  let s = n;
1884
1884
  for (; !(s + 1 >= e.length); ) {
1885
1885
  const i = new se();
1886
- if (i.x = Fe.byteToSByte(e[++s]), i.y = Fe.byteToSByte(e[++s]), i.x === 0 && i.y === 0)
1886
+ if (i.x = Te.byteToSByte(e[++s]), i.y = Te.byteToSByte(e[++s]), i.x === 0 && i.y === 0)
1887
1887
  break;
1888
1888
  r.currentPoint.add(i.multiply(r.scale)), r.isPenDown ? r.currentPolyline.push(r.currentPoint.clone()) : this.notePenUpPositioning(r);
1889
1889
  }
@@ -1891,14 +1891,14 @@ class ac {
1891
1891
  }
1892
1892
  handleOctantArc(e, n, r) {
1893
1893
  let s = n;
1894
- const i = e[++s] * r.scale, a = Fe.byteToSByte(e[++s]), o = (a & 112) >> 4;
1894
+ const i = e[++s] * r.scale, a = Te.byteToSByte(e[++s]), o = (a & 112) >> 4;
1895
1895
  let c = a & 7;
1896
1896
  const l = a < 0, u = Math.PI / 4 * o, f = r.currentPoint.clone().subtract(new se(Math.cos(u) * i, Math.sin(u) * i)), h = Zt.fromOctant(f, i, o, c, l).tessellate();
1897
1897
  return r.isPenDown && (r.currentPolyline.pop(), r.currentPolyline.push(...h.slice())), r.currentPoint = h[h.length - 1].clone(), s;
1898
1898
  }
1899
1899
  handleFractionalArc(e, n, r) {
1900
1900
  let s = n;
1901
- const i = e[++s], a = e[++s], o = e[++s], c = e[++s], l = (o * 255 + c) * r.scale, u = Fe.byteToSByte(e[++s]), f = (u & 112) >> 4;
1901
+ const i = e[++s], a = e[++s], o = e[++s], c = e[++s], l = (o * 255 + c) * r.scale, u = Te.byteToSByte(e[++s]), f = (u & 112) >> 4;
1902
1902
  let h = u & 7;
1903
1903
  h === 0 && (h = 8), a !== 0 && h--;
1904
1904
  const p = Math.PI / 4;
@@ -1908,19 +1908,19 @@ class ac {
1908
1908
  v += p * i / 256 * b, w += p * a / 256 * b;
1909
1909
  const C = r.currentPoint.clone().subtract(new se(l * Math.cos(v), l * Math.sin(v)));
1910
1910
  if (r.currentPoint = C.clone().add(new se(l * Math.cos(w), l * Math.sin(w))), r.isPenDown) {
1911
- let T = v;
1911
+ let F = v;
1912
1912
  const E = [];
1913
1913
  if (E.push(
1914
- C.clone().add(new se(l * Math.cos(T), l * Math.sin(T)))
1914
+ C.clone().add(new se(l * Math.cos(F), l * Math.sin(F)))
1915
1915
  ), m > 0)
1916
- for (; T + m < w; )
1917
- T += m, E.push(
1918
- C.clone().add(new se(l * Math.cos(T), l * Math.sin(T)))
1916
+ for (; F + m < w; )
1917
+ F += m, E.push(
1918
+ C.clone().add(new se(l * Math.cos(F), l * Math.sin(F)))
1919
1919
  );
1920
1920
  else
1921
- for (; T + m > w; )
1922
- T += m, E.push(
1923
- C.clone().add(new se(l * Math.cos(T), l * Math.sin(T)))
1921
+ for (; F + m > w; )
1922
+ F += m, E.push(
1923
+ C.clone().add(new se(l * Math.cos(F), l * Math.sin(F)))
1924
1924
  );
1925
1925
  E.push(C.clone().add(new se(l * Math.cos(w), l * Math.sin(w)))), r.currentPolyline.push(...E);
1926
1926
  }
@@ -1929,8 +1929,8 @@ class ac {
1929
1929
  handleBulgeArc(e, n, r) {
1930
1930
  let s = n;
1931
1931
  const i = new se();
1932
- i.x = Fe.byteToSByte(e[++s]), i.y = Fe.byteToSByte(e[++s]);
1933
- const a = Fe.byteToSByte(e[++s]);
1932
+ i.x = Te.byteToSByte(e[++s]), i.y = Te.byteToSByte(e[++s]);
1933
+ const a = Te.byteToSByte(e[++s]);
1934
1934
  return r.currentPoint = this.handleArcSegment(
1935
1935
  r.currentPoint,
1936
1936
  i,
@@ -1944,9 +1944,9 @@ class ac {
1944
1944
  let s = n;
1945
1945
  for (; !(s + 1 >= e.length); ) {
1946
1946
  const i = new se();
1947
- if (i.x = Fe.byteToSByte(e[++s]), i.y = Fe.byteToSByte(e[++s]), i.x === 0 && i.y === 0 || s + 1 >= e.length)
1947
+ if (i.x = Te.byteToSByte(e[++s]), i.y = Te.byteToSByte(e[++s]), i.x === 0 && i.y === 0 || s + 1 >= e.length)
1948
1948
  break;
1949
- const a = Fe.byteToSByte(e[++s]);
1949
+ const a = Te.byteToSByte(e[++s]);
1950
1950
  r.currentPoint = this.handleArcSegment(
1951
1951
  r.currentPoint,
1952
1952
  i,
@@ -2078,7 +2078,7 @@ class oc {
2078
2078
  */
2079
2079
  constructor(e) {
2080
2080
  if (e instanceof ArrayBuffer) {
2081
- const n = new Fe(e), r = new Po().parse(n), s = Wo.createParser(r.fontType).parse(n);
2081
+ const n = new Te(e), r = new Po().parse(n), s = Wo.createParser(r.fontType).parse(n);
2082
2082
  this.fontData = {
2083
2083
  header: r,
2084
2084
  content: s
@@ -2245,13 +2245,13 @@ function uc() {
2245
2245
  IDBCursor.prototype.continuePrimaryKey
2246
2246
  ]);
2247
2247
  }
2248
- const Tr = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Hn = /* @__PURE__ */ new WeakMap();
2248
+ const Fr = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Hn = /* @__PURE__ */ new WeakMap();
2249
2249
  function hc(t) {
2250
2250
  const e = new Promise((n, r) => {
2251
2251
  const s = () => {
2252
2252
  t.removeEventListener("success", i), t.removeEventListener("error", a);
2253
2253
  }, i = () => {
2254
- n(Tt(t.result)), s();
2254
+ n(Ft(t.result)), s();
2255
2255
  }, a = () => {
2256
2256
  r(t.error), s();
2257
2257
  };
@@ -2260,7 +2260,7 @@ function hc(t) {
2260
2260
  return Hn.set(e, t), e;
2261
2261
  }
2262
2262
  function fc(t) {
2263
- if (Tr.has(t))
2263
+ if (Fr.has(t))
2264
2264
  return;
2265
2265
  const e = new Promise((n, r) => {
2266
2266
  const s = () => {
@@ -2272,17 +2272,17 @@ function fc(t) {
2272
2272
  };
2273
2273
  t.addEventListener("complete", i), t.addEventListener("error", a), t.addEventListener("abort", a);
2274
2274
  });
2275
- Tr.set(t, e);
2275
+ Fr.set(t, e);
2276
2276
  }
2277
- let Fr = {
2277
+ let Tr = {
2278
2278
  get(t, e, n) {
2279
2279
  if (t instanceof IDBTransaction) {
2280
2280
  if (e === "done")
2281
- return Tr.get(t);
2281
+ return Fr.get(t);
2282
2282
  if (e === "store")
2283
2283
  return n.objectStoreNames[1] ? void 0 : n.objectStore(n.objectStoreNames[0]);
2284
2284
  }
2285
- return Tt(t[e]);
2285
+ return Ft(t[e]);
2286
2286
  },
2287
2287
  set(t, e, n) {
2288
2288
  return t[e] = n, !0;
@@ -2292,19 +2292,19 @@ let Fr = {
2292
2292
  }
2293
2293
  };
2294
2294
  function fa(t) {
2295
- Fr = t(Fr);
2295
+ Tr = t(Tr);
2296
2296
  }
2297
2297
  function pc(t) {
2298
2298
  return uc().includes(t) ? function(...e) {
2299
- return t.apply(kr(this), e), Tt(this.request);
2299
+ return t.apply(kr(this), e), Ft(this.request);
2300
2300
  } : function(...e) {
2301
- return Tt(t.apply(kr(this), e));
2301
+ return Ft(t.apply(kr(this), e));
2302
2302
  };
2303
2303
  }
2304
2304
  function dc(t) {
2305
- return typeof t == "function" ? pc(t) : (t instanceof IDBTransaction && fc(t), Cr(t, lc()) ? new Proxy(t, Fr) : t);
2305
+ return typeof t == "function" ? pc(t) : (t instanceof IDBTransaction && fc(t), Cr(t, lc()) ? new Proxy(t, Tr) : t);
2306
2306
  }
2307
- function Tt(t) {
2307
+ function Ft(t) {
2308
2308
  if (t instanceof IDBRequest)
2309
2309
  return hc(t);
2310
2310
  if (Yn.has(t))
@@ -2314,9 +2314,9 @@ function Tt(t) {
2314
2314
  }
2315
2315
  const kr = (t) => Hn.get(t);
2316
2316
  function gc(t, e, { blocked: n, upgrade: r, blocking: s, terminated: i } = {}) {
2317
- const a = indexedDB.open(t, e), o = Tt(a);
2317
+ const a = indexedDB.open(t, e), o = Ft(a);
2318
2318
  return r && a.addEventListener("upgradeneeded", (c) => {
2319
- r(Tt(a.result), c.oldVersion, c.newVersion, Tt(a.transaction), c);
2319
+ r(Ft(a.result), c.oldVersion, c.newVersion, Ft(a.transaction), c);
2320
2320
  }), n && a.addEventListener("blocked", (c) => n(
2321
2321
  // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
2322
2322
  c.oldVersion,
@@ -2354,12 +2354,12 @@ fa((t) => ({
2354
2354
  get: (e, n, r) => Cs(e, n) || t.get(e, n, r),
2355
2355
  has: (e, n) => !!Cs(e, n) || t.has(e, n)
2356
2356
  }));
2357
- const bc = ["continue", "continuePrimaryKey", "advance"], Ts = {}, Er = /* @__PURE__ */ new WeakMap(), pa = /* @__PURE__ */ new WeakMap(), xc = {
2357
+ const bc = ["continue", "continuePrimaryKey", "advance"], Fs = {}, Er = /* @__PURE__ */ new WeakMap(), pa = /* @__PURE__ */ new WeakMap(), xc = {
2358
2358
  get(t, e) {
2359
2359
  if (!bc.includes(e))
2360
2360
  return t[e];
2361
- let n = Ts[e];
2362
- return n || (n = Ts[e] = function(...r) {
2361
+ let n = Fs[e];
2362
+ return n || (n = Fs[e] = function(...r) {
2363
2363
  Er.set(this, pa.get(this)[e](...r));
2364
2364
  }), n;
2365
2365
  }
@@ -2373,16 +2373,16 @@ async function* vc(...t) {
2373
2373
  for (pa.set(n, e), Hn.set(n, kr(e)); e; )
2374
2374
  yield n, e = await (Er.get(n) || e.continue()), Er.delete(n);
2375
2375
  }
2376
- function Fs(t, e) {
2376
+ function Ts(t, e) {
2377
2377
  return e === Symbol.asyncIterator && Cr(t, [IDBIndex, IDBObjectStore, IDBCursor]) || e === "iterate" && Cr(t, [IDBIndex, IDBObjectStore]);
2378
2378
  }
2379
2379
  fa((t) => ({
2380
2380
  ...t,
2381
2381
  get(e, n, r) {
2382
- return Fs(e, n) ? vc : t.get(e, n, r);
2382
+ return Ts(e, n) ? vc : t.get(e, n, r);
2383
2383
  },
2384
2384
  has(e, n) {
2385
- return Fs(e, n) || t.has(e, n);
2385
+ return Ts(e, n) || t.has(e, n);
2386
2386
  }
2387
2387
  }));
2388
2388
  const St = {
@@ -2560,12 +2560,12 @@ const St = {
2560
2560
  }
2561
2561
  };
2562
2562
  Be.DATABASE_NAME = "mlightcad", Be.DATABASE_VERSION = Kn[Kn.length - 1].version;
2563
- let ze = Be;
2563
+ let Ue = Be;
2564
2564
  const Sc = 512;
2565
2565
  function wc(t, e) {
2566
2566
  return (t + e) * Sc;
2567
2567
  }
2568
- const Cc = 2.5, Tc = 1.5;
2568
+ const Cc = 2.5, Fc = 1.5;
2569
2569
  function da() {
2570
2570
  return {
2571
2571
  meshCount: 0,
@@ -2578,6 +2578,8 @@ const Ar = {
2578
2578
  r12r14: ["txt", "simplex", "romans", "gbcbig", "simsun"],
2579
2579
  // Mesh/TTF first so missing style fonts (e.g. "标准") get correct Latin metrics.
2580
2580
  // BIGFONT SHX stays available via glyph fallback for CJK coverage.
2581
+ // Korean/Japanese faces are not in this preset — load on demand via style
2582
+ // names (e.g. `malgun`) or switch to the `korean` / `cjk` presets.
2581
2583
  modern: ["simsun", "hztxt"],
2582
2584
  international: ["txt", "simplex", "romans", "simsun"],
2583
2585
  // Full CJK: mesh faces for CN/KR/JP, then matching SHX big fonts.
@@ -2613,7 +2615,7 @@ var Wr = 0, ga = -3;
2613
2615
  function Jt() {
2614
2616
  this.table = new Uint16Array(16), this.trans = new Uint16Array(288);
2615
2617
  }
2616
- function Fc(t, e) {
2618
+ function Tc(t, e) {
2617
2619
  this.source = t, this.sourceIndex = 0, this.tag = 0, this.bitcount = 0, this.dest = e, this.destLen = 0, this.ltree = new Jt(), this.dtree = new Jt();
2618
2620
  }
2619
2621
  var ma = new Jt(), ya = new Jt(), Vr = new Uint8Array(30), qr = new Uint16Array(30), ba = new Uint8Array(30), xa = new Uint16Array(30), kc = new Uint8Array([
@@ -2740,7 +2742,7 @@ function Lc(t) {
2740
2742
  return t.bitcount = 0, Wr;
2741
2743
  }
2742
2744
  function Sa(t, e) {
2743
- var n = new Fc(t, e), r, s, i;
2745
+ var n = new Tc(t, e), r, s, i;
2744
2746
  do {
2745
2747
  switch (r = Ac(n), s = Xe(n, 2, 0), s) {
2746
2748
  case 0:
@@ -2820,7 +2822,7 @@ function Ca(t, e) {
2820
2822
  const s = +(Math.round(r + "e+" + e) + "e-" + e);
2821
2823
  return Vt[e][r] = s, n + s;
2822
2824
  }
2823
- function Ta(t) {
2825
+ function Fa(t) {
2824
2826
  let e = [[]], n = 0, r = 0;
2825
2827
  for (let s = 0; s < t.length; s += 1) {
2826
2828
  const i = e[e.length - 1], a = t[s], o = i[0], c = i[1], l = i[i.length - 1], u = t[s + 1];
@@ -2883,14 +2885,14 @@ de.prototype.fromSVG = function(t, e = {}) {
2883
2885
  break;
2884
2886
  case "V":
2885
2887
  for (let C = 0; C < b.length; C++) {
2886
- let T = 0;
2887
- m && (T = this.commands.length && this.commands[this.commands.length - 1].y || 0), this.lineTo(v, b[C] + T);
2888
+ let F = 0;
2889
+ m && (F = this.commands.length && this.commands[this.commands.length - 1].y || 0), this.lineTo(v, b[C] + F);
2888
2890
  }
2889
2891
  break;
2890
2892
  case "H":
2891
2893
  for (let C = 0; C < b.length; C++) {
2892
- let T = 0;
2893
- m && (T = this.commands.length && this.commands[this.commands.length - 1].x || 0), this.lineTo(b[C] + T, w);
2894
+ let F = 0;
2895
+ m && (F = this.commands.length && this.commands[this.commands.length - 1].x || 0), this.lineTo(b[C] + F, w);
2894
2896
  }
2895
2897
  break;
2896
2898
  case "C":
@@ -2929,7 +2931,7 @@ de.prototype.fromSVG = function(t, e = {}) {
2929
2931
  if (c)
2930
2932
  throw new Error("Unexpected character: " + m + " at offset " + y);
2931
2933
  }
2932
- f.apply(this), e.optimize && (this.commands = Ta(this.commands));
2934
+ f.apply(this), e.optimize && (this.commands = Fa(this.commands));
2933
2935
  const h = e.flipY;
2934
2936
  let p = e.flipYBase;
2935
2937
  if (h === !0 && e.flipYBase === void 0) {
@@ -3056,7 +3058,7 @@ de.prototype.toPathData = function(t) {
3056
3058
  return o;
3057
3059
  }
3058
3060
  let r = this.commands;
3059
- t.optimize && (r = JSON.parse(JSON.stringify(this.commands)), r = Ta(r));
3061
+ t.optimize && (r = JSON.parse(JSON.stringify(this.commands)), r = Fa(r));
3060
3062
  const s = t.flipY;
3061
3063
  let i = t.flipYBase;
3062
3064
  if (s === !0 && i === void 0) {
@@ -3101,13 +3103,13 @@ de.prototype.toDOMElement = function(t, e) {
3101
3103
  return n.setAttribute("d", e), this.fill !== void 0 && this.fill !== "black" && (this.fill === null ? n.setAttribute("fill", "none") : n.setAttribute("fill", this.fill)), this.stroke && (n.setAttribute("stroke", this.stroke), n.setAttribute("stroke-width", this.strokeWidth)), n;
3102
3104
  };
3103
3105
  var Pt = de;
3104
- function Fa(t) {
3106
+ function Ta(t) {
3105
3107
  throw new Error(t);
3106
3108
  }
3107
3109
  function Ls(t, e) {
3108
- t || Fa(e);
3110
+ t || Ta(e);
3109
3111
  }
3110
- var H = { fail: Fa, argument: Ls, assert: Ls }, Is = 32768, Rs = 2147483648, Bc = -32768, Mc = 32767 + 1 / 65536, Nt = {}, B = {}, z = {};
3112
+ var H = { fail: Ta, argument: Ls, assert: Ls }, Is = 32768, Rs = 2147483648, Bc = -32768, Mc = 32767 + 1 / 65536, Nt = {}, B = {}, z = {};
3111
3113
  function je(t) {
3112
3114
  return function() {
3113
3115
  return t;
@@ -3763,51 +3765,51 @@ var qc = {
3763
3765
  INNER_INDEX_BIT_COUNT_MASK: 15,
3764
3766
  MAP_ENTRY_SIZE_MASK: 48
3765
3767
  };
3766
- function F(t, e) {
3768
+ function T(t, e) {
3767
3769
  this.data = t, this.offset = e, this.relativeOffset = 0;
3768
3770
  }
3769
- F.prototype.parseByte = function() {
3771
+ T.prototype.parseByte = function() {
3770
3772
  const t = this.data.getUint8(this.offset + this.relativeOffset);
3771
3773
  return this.relativeOffset += 1, t;
3772
3774
  };
3773
- F.prototype.parseChar = function() {
3775
+ T.prototype.parseChar = function() {
3774
3776
  const t = this.data.getInt8(this.offset + this.relativeOffset);
3775
3777
  return this.relativeOffset += 1, t;
3776
3778
  };
3777
- F.prototype.parseCard8 = F.prototype.parseByte;
3778
- F.prototype.parseUShort = function() {
3779
+ T.prototype.parseCard8 = T.prototype.parseByte;
3780
+ T.prototype.parseUShort = function() {
3779
3781
  const t = this.data.getUint16(this.offset + this.relativeOffset);
3780
3782
  return this.relativeOffset += 2, t;
3781
3783
  };
3782
- F.prototype.parseCard16 = F.prototype.parseUShort;
3783
- F.prototype.parseSID = F.prototype.parseUShort;
3784
- F.prototype.parseOffset16 = F.prototype.parseUShort;
3785
- F.prototype.parseShort = function() {
3784
+ T.prototype.parseCard16 = T.prototype.parseUShort;
3785
+ T.prototype.parseSID = T.prototype.parseUShort;
3786
+ T.prototype.parseOffset16 = T.prototype.parseUShort;
3787
+ T.prototype.parseShort = function() {
3786
3788
  const t = this.data.getInt16(this.offset + this.relativeOffset);
3787
3789
  return this.relativeOffset += 2, t;
3788
3790
  };
3789
- F.prototype.parseF2Dot14 = function() {
3791
+ T.prototype.parseF2Dot14 = function() {
3790
3792
  const t = this.data.getInt16(this.offset + this.relativeOffset) / 16384;
3791
3793
  return this.relativeOffset += 2, t;
3792
3794
  };
3793
- F.prototype.parseUInt24 = function() {
3795
+ T.prototype.parseUInt24 = function() {
3794
3796
  const t = ka(this.data, this.offset + this.relativeOffset);
3795
3797
  return this.relativeOffset += 3, t;
3796
3798
  };
3797
- F.prototype.parseULong = function() {
3799
+ T.prototype.parseULong = function() {
3798
3800
  const t = jr(this.data, this.offset + this.relativeOffset);
3799
3801
  return this.relativeOffset += 4, t;
3800
3802
  };
3801
- F.prototype.parseLong = function() {
3803
+ T.prototype.parseLong = function() {
3802
3804
  const t = Gc(this.data, this.offset + this.relativeOffset);
3803
3805
  return this.relativeOffset += 4, t;
3804
3806
  };
3805
- F.prototype.parseOffset32 = F.prototype.parseULong;
3806
- F.prototype.parseFixed = function() {
3807
+ T.prototype.parseOffset32 = T.prototype.parseULong;
3808
+ T.prototype.parseFixed = function() {
3807
3809
  const t = Ea(this.data, this.offset + this.relativeOffset);
3808
3810
  return this.relativeOffset += 4, t;
3809
3811
  };
3810
- F.prototype.parseString = function(t) {
3812
+ T.prototype.parseString = function(t) {
3811
3813
  const e = this.data, n = this.offset + this.relativeOffset;
3812
3814
  let r = "";
3813
3815
  this.relativeOffset += t;
@@ -3815,21 +3817,21 @@ F.prototype.parseString = function(t) {
3815
3817
  r += String.fromCharCode(e.getUint8(n + s));
3816
3818
  return r;
3817
3819
  };
3818
- F.prototype.parseTag = function() {
3820
+ T.prototype.parseTag = function() {
3819
3821
  return this.parseString(4);
3820
3822
  };
3821
- F.prototype.parseLongDateTime = function() {
3823
+ T.prototype.parseLongDateTime = function() {
3822
3824
  let t = jr(this.data, this.offset + this.relativeOffset + 4);
3823
3825
  return t -= 2082844800, this.relativeOffset += 8, t;
3824
3826
  };
3825
- F.prototype.parseVersion = function(t) {
3827
+ T.prototype.parseVersion = function(t) {
3826
3828
  const e = Rn(this.data, this.offset + this.relativeOffset), n = Rn(this.data, this.offset + this.relativeOffset + 2);
3827
3829
  return this.relativeOffset += 4, t === void 0 && (t = 4096), e + n / t / 10;
3828
3830
  };
3829
- F.prototype.skip = function(t, e) {
3831
+ T.prototype.skip = function(t, e) {
3830
3832
  e === void 0 && (e = 1), this.relativeOffset += qc[t] * e;
3831
3833
  };
3832
- F.prototype.parseULongList = function(t) {
3834
+ T.prototype.parseULongList = function(t) {
3833
3835
  t === void 0 && (t = this.parseULong());
3834
3836
  const e = new Array(t), n = this.data;
3835
3837
  let r = this.offset + this.relativeOffset;
@@ -3837,7 +3839,7 @@ F.prototype.parseULongList = function(t) {
3837
3839
  e[s] = n.getUint32(r), r += 4;
3838
3840
  return this.relativeOffset += t * 4, e;
3839
3841
  };
3840
- F.prototype.parseOffset16List = F.prototype.parseUShortList = function(t) {
3842
+ T.prototype.parseOffset16List = T.prototype.parseUShortList = function(t) {
3841
3843
  t === void 0 && (t = this.parseUShort());
3842
3844
  const e = new Array(t), n = this.data;
3843
3845
  let r = this.offset + this.relativeOffset;
@@ -3845,35 +3847,35 @@ F.prototype.parseOffset16List = F.prototype.parseUShortList = function(t) {
3845
3847
  e[s] = n.getUint16(r), r += 2;
3846
3848
  return this.relativeOffset += t * 2, e;
3847
3849
  };
3848
- F.prototype.parseShortList = function(t) {
3850
+ T.prototype.parseShortList = function(t) {
3849
3851
  const e = new Array(t), n = this.data;
3850
3852
  let r = this.offset + this.relativeOffset;
3851
3853
  for (let s = 0; s < t; s++)
3852
3854
  e[s] = n.getInt16(r), r += 2;
3853
3855
  return this.relativeOffset += t * 2, e;
3854
3856
  };
3855
- F.prototype.parseByteList = function(t) {
3857
+ T.prototype.parseByteList = function(t) {
3856
3858
  const e = new Array(t), n = this.data;
3857
3859
  let r = this.offset + this.relativeOffset;
3858
3860
  for (let s = 0; s < t; s++)
3859
3861
  e[s] = n.getUint8(r++);
3860
3862
  return this.relativeOffset += t, e;
3861
3863
  };
3862
- F.prototype.parseList = function(t, e) {
3864
+ T.prototype.parseList = function(t, e) {
3863
3865
  e || (e = t, t = this.parseUShort());
3864
3866
  const n = new Array(t);
3865
3867
  for (let r = 0; r < t; r++)
3866
3868
  n[r] = e.call(this);
3867
3869
  return n;
3868
3870
  };
3869
- F.prototype.parseList32 = function(t, e) {
3871
+ T.prototype.parseList32 = function(t, e) {
3870
3872
  e || (e = t, t = this.parseULong());
3871
3873
  const n = new Array(t);
3872
3874
  for (let r = 0; r < t; r++)
3873
3875
  n[r] = e.call(this);
3874
3876
  return n;
3875
3877
  };
3876
- F.prototype.parseRecordList = function(t, e) {
3878
+ T.prototype.parseRecordList = function(t, e) {
3877
3879
  e || (e = t, t = this.parseUShort());
3878
3880
  const n = new Array(t), r = Object.keys(e);
3879
3881
  for (let s = 0; s < t; s++) {
@@ -3886,7 +3888,7 @@ F.prototype.parseRecordList = function(t, e) {
3886
3888
  }
3887
3889
  return n;
3888
3890
  };
3889
- F.prototype.parseRecordList32 = function(t, e) {
3891
+ T.prototype.parseRecordList32 = function(t, e) {
3890
3892
  e || (e = t, t = this.parseULong());
3891
3893
  const n = new Array(t), r = Object.keys(e);
3892
3894
  for (let s = 0; s < t; s++) {
@@ -3899,7 +3901,7 @@ F.prototype.parseRecordList32 = function(t, e) {
3899
3901
  }
3900
3902
  return n;
3901
3903
  };
3902
- F.prototype.parseTupleRecords = function(t, e) {
3904
+ T.prototype.parseTupleRecords = function(t, e) {
3903
3905
  let n = [];
3904
3906
  for (let r = 0; r < t; r++) {
3905
3907
  let s = [];
@@ -3909,7 +3911,7 @@ F.prototype.parseTupleRecords = function(t, e) {
3909
3911
  }
3910
3912
  return n;
3911
3913
  };
3912
- F.prototype.parseStruct = function(t) {
3914
+ T.prototype.parseStruct = function(t) {
3913
3915
  if (typeof t == "function")
3914
3916
  return t.call(this);
3915
3917
  {
@@ -3921,29 +3923,29 @@ F.prototype.parseStruct = function(t) {
3921
3923
  return n;
3922
3924
  }
3923
3925
  };
3924
- F.prototype.parseValueRecord = function(t) {
3926
+ T.prototype.parseValueRecord = function(t) {
3925
3927
  if (t === void 0 && (t = this.parseUShort()), t === 0)
3926
3928
  return;
3927
3929
  const e = {};
3928
3930
  return t & 1 && (e.xPlacement = this.parseShort()), t & 2 && (e.yPlacement = this.parseShort()), t & 4 && (e.xAdvance = this.parseShort()), t & 8 && (e.yAdvance = this.parseShort()), t & 16 && (e.xPlaDevice = void 0, this.parseShort()), t & 32 && (e.yPlaDevice = void 0, this.parseShort()), t & 64 && (e.xAdvDevice = void 0, this.parseShort()), t & 128 && (e.yAdvDevice = void 0, this.parseShort()), e;
3929
3931
  };
3930
- F.prototype.parseValueRecordList = function() {
3932
+ T.prototype.parseValueRecordList = function() {
3931
3933
  const t = this.parseUShort(), e = this.parseUShort(), n = new Array(e);
3932
3934
  for (let r = 0; r < e; r++)
3933
3935
  n[r] = this.parseValueRecord(t);
3934
3936
  return n;
3935
3937
  };
3936
- F.prototype.parsePointer = function(t) {
3938
+ T.prototype.parsePointer = function(t) {
3937
3939
  const e = this.parseOffset16();
3938
3940
  if (e > 0)
3939
- return new F(this.data, this.offset + e).parseStruct(t);
3941
+ return new T(this.data, this.offset + e).parseStruct(t);
3940
3942
  };
3941
- F.prototype.parsePointer32 = function(t) {
3943
+ T.prototype.parsePointer32 = function(t) {
3942
3944
  const e = this.parseOffset32();
3943
3945
  if (e > 0)
3944
- return new F(this.data, this.offset + e).parseStruct(t);
3946
+ return new T(this.data, this.offset + e).parseStruct(t);
3945
3947
  };
3946
- F.prototype.parseListOfLists = function(t) {
3948
+ T.prototype.parseListOfLists = function(t) {
3947
3949
  const e = this.parseOffset16List(), n = e.length, r = this.relativeOffset, s = new Array(n);
3948
3950
  for (let i = 0; i < n; i++) {
3949
3951
  const a = e[i];
@@ -3961,7 +3963,7 @@ F.prototype.parseListOfLists = function(t) {
3961
3963
  }
3962
3964
  return this.relativeOffset = r, s;
3963
3965
  };
3964
- F.prototype.parseCoverage = function() {
3966
+ T.prototype.parseCoverage = function() {
3965
3967
  const t = this.offset + this.relativeOffset, e = this.parseUShort(), n = this.parseUShort();
3966
3968
  if (e === 1)
3967
3969
  return {
@@ -3983,7 +3985,7 @@ F.prototype.parseCoverage = function() {
3983
3985
  }
3984
3986
  throw new Error("0x" + t.toString(16) + ": Coverage format must be 1 or 2.");
3985
3987
  };
3986
- F.prototype.parseClassDef = function() {
3988
+ T.prototype.parseClassDef = function() {
3987
3989
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
3988
3990
  return e === 1 ? {
3989
3991
  format: 1,
@@ -3992,111 +3994,111 @@ F.prototype.parseClassDef = function() {
3992
3994
  } : e === 2 ? {
3993
3995
  format: 2,
3994
3996
  ranges: this.parseRecordList({
3995
- start: F.uShort,
3996
- end: F.uShort,
3997
- classId: F.uShort
3997
+ start: T.uShort,
3998
+ end: T.uShort,
3999
+ classId: T.uShort
3998
4000
  })
3999
4001
  } : (console.warn(`0x${t.toString(16)}: This font file uses an invalid ClassDef format of ${e}. It might be corrupted and should be reacquired if it doesn't display as intended.`), {
4000
4002
  format: e
4001
4003
  });
4002
4004
  };
4003
- F.list = function(t, e) {
4005
+ T.list = function(t, e) {
4004
4006
  return function() {
4005
4007
  return this.parseList(t, e);
4006
4008
  };
4007
4009
  };
4008
- F.list32 = function(t, e) {
4010
+ T.list32 = function(t, e) {
4009
4011
  return function() {
4010
4012
  return this.parseList32(t, e);
4011
4013
  };
4012
4014
  };
4013
- F.recordList = function(t, e) {
4015
+ T.recordList = function(t, e) {
4014
4016
  return function() {
4015
4017
  return this.parseRecordList(t, e);
4016
4018
  };
4017
4019
  };
4018
- F.recordList32 = function(t, e) {
4020
+ T.recordList32 = function(t, e) {
4019
4021
  return function() {
4020
4022
  return this.parseRecordList32(t, e);
4021
4023
  };
4022
4024
  };
4023
- F.pointer = function(t) {
4025
+ T.pointer = function(t) {
4024
4026
  return function() {
4025
4027
  return this.parsePointer(t);
4026
4028
  };
4027
4029
  };
4028
- F.pointer32 = function(t) {
4030
+ T.pointer32 = function(t) {
4029
4031
  return function() {
4030
4032
  return this.parsePointer32(t);
4031
4033
  };
4032
4034
  };
4033
- F.tag = F.prototype.parseTag;
4034
- F.byte = F.prototype.parseByte;
4035
- F.uShort = F.offset16 = F.prototype.parseUShort;
4036
- F.uShortList = F.prototype.parseUShortList;
4037
- F.uInt24 = F.prototype.parseUInt24;
4038
- F.uLong = F.offset32 = F.prototype.parseULong;
4039
- F.uLongList = F.prototype.parseULongList;
4040
- F.fixed = F.prototype.parseFixed;
4041
- F.f2Dot14 = F.prototype.parseF2Dot14;
4042
- F.struct = F.prototype.parseStruct;
4043
- F.coverage = F.prototype.parseCoverage;
4044
- F.classDef = F.prototype.parseClassDef;
4035
+ T.tag = T.prototype.parseTag;
4036
+ T.byte = T.prototype.parseByte;
4037
+ T.uShort = T.offset16 = T.prototype.parseUShort;
4038
+ T.uShortList = T.prototype.parseUShortList;
4039
+ T.uInt24 = T.prototype.parseUInt24;
4040
+ T.uLong = T.offset32 = T.prototype.parseULong;
4041
+ T.uLongList = T.prototype.parseULongList;
4042
+ T.fixed = T.prototype.parseFixed;
4043
+ T.f2Dot14 = T.prototype.parseF2Dot14;
4044
+ T.struct = T.prototype.parseStruct;
4045
+ T.coverage = T.prototype.parseCoverage;
4046
+ T.classDef = T.prototype.parseClassDef;
4045
4047
  var Ms = {
4046
- reserved: F.uShort,
4047
- reqFeatureIndex: F.uShort,
4048
- featureIndexes: F.uShortList
4049
- };
4050
- F.prototype.parseScriptList = function() {
4051
- return this.parsePointer(F.recordList({
4052
- tag: F.tag,
4053
- script: F.pointer({
4054
- defaultLangSys: F.pointer(Ms),
4055
- langSysRecords: F.recordList({
4056
- tag: F.tag,
4057
- langSys: F.pointer(Ms)
4048
+ reserved: T.uShort,
4049
+ reqFeatureIndex: T.uShort,
4050
+ featureIndexes: T.uShortList
4051
+ };
4052
+ T.prototype.parseScriptList = function() {
4053
+ return this.parsePointer(T.recordList({
4054
+ tag: T.tag,
4055
+ script: T.pointer({
4056
+ defaultLangSys: T.pointer(Ms),
4057
+ langSysRecords: T.recordList({
4058
+ tag: T.tag,
4059
+ langSys: T.pointer(Ms)
4058
4060
  })
4059
4061
  })
4060
4062
  })) || [];
4061
4063
  };
4062
- F.prototype.parseFeatureList = function() {
4063
- return this.parsePointer(F.recordList({
4064
- tag: F.tag,
4065
- feature: F.pointer({
4066
- featureParams: F.offset16,
4067
- lookupListIndexes: F.uShortList
4064
+ T.prototype.parseFeatureList = function() {
4065
+ return this.parsePointer(T.recordList({
4066
+ tag: T.tag,
4067
+ feature: T.pointer({
4068
+ featureParams: T.offset16,
4069
+ lookupListIndexes: T.uShortList
4068
4070
  })
4069
4071
  })) || [];
4070
4072
  };
4071
- F.prototype.parseLookupList = function(t) {
4072
- return this.parsePointer(F.list(F.pointer(function() {
4073
+ T.prototype.parseLookupList = function(t) {
4074
+ return this.parsePointer(T.list(T.pointer(function() {
4073
4075
  const e = this.parseUShort();
4074
4076
  H.argument(1 <= e && e <= 9, "GPOS/GSUB lookup type " + e + " unknown.");
4075
4077
  const n = this.parseUShort(), r = n & 16;
4076
4078
  return {
4077
4079
  lookupType: e,
4078
4080
  lookupFlag: n,
4079
- subtables: this.parseList(F.pointer(t[e])),
4081
+ subtables: this.parseList(T.pointer(t[e])),
4080
4082
  markFilteringSet: r ? this.parseUShort() : void 0
4081
4083
  };
4082
4084
  }))) || [];
4083
4085
  };
4084
- F.prototype.parseFeatureVariationsList = function() {
4086
+ T.prototype.parseFeatureVariationsList = function() {
4085
4087
  return this.parsePointer32(function() {
4086
4088
  const t = this.parseUShort(), e = this.parseUShort();
4087
4089
  return H.argument(t === 1 && e < 1, "GPOS/GSUB feature variations table unknown."), this.parseRecordList32({
4088
- conditionSetOffset: F.offset32,
4089
- featureTableSubstitutionOffset: F.offset32
4090
+ conditionSetOffset: T.offset32,
4091
+ featureTableSubstitutionOffset: T.offset32
4090
4092
  });
4091
4093
  }) || [];
4092
4094
  };
4093
- F.prototype.parseVariationStore = function() {
4095
+ T.prototype.parseVariationStore = function() {
4094
4096
  const t = this.relativeOffset, e = this.parseUShort(), n = {
4095
4097
  itemVariationStore: this.parseItemVariationStore()
4096
4098
  };
4097
4099
  return this.relativeOffset = t + e + 2, n;
4098
4100
  };
4099
- F.prototype.parseItemVariationStore = function() {
4101
+ T.prototype.parseItemVariationStore = function() {
4100
4102
  const t = this.relativeOffset, e = {
4101
4103
  format: this.parseUShort(),
4102
4104
  variationRegions: [],
@@ -4109,24 +4111,24 @@ F.prototype.parseItemVariationStore = function() {
4109
4111
  }
4110
4112
  return e;
4111
4113
  };
4112
- F.prototype.parseVariationRegionList = function() {
4114
+ T.prototype.parseVariationRegionList = function() {
4113
4115
  const t = this.parseUShort(), e = this.parseUShort();
4114
4116
  return this.parseRecordList(e, {
4115
- regionAxes: F.recordList(t, {
4116
- startCoord: F.f2Dot14,
4117
- peakCoord: F.f2Dot14,
4118
- endCoord: F.f2Dot14
4117
+ regionAxes: T.recordList(t, {
4118
+ startCoord: T.f2Dot14,
4119
+ peakCoord: T.f2Dot14,
4120
+ endCoord: T.f2Dot14
4119
4121
  })
4120
4122
  });
4121
4123
  };
4122
- F.prototype.parseItemVariationSubtable = function() {
4124
+ T.prototype.parseItemVariationSubtable = function() {
4123
4125
  const t = this.parseUShort(), e = this.parseUShort(), n = this.parseUShortList(), r = n.length;
4124
4126
  return {
4125
4127
  regionIndexes: n,
4126
4128
  deltaSets: t && r ? this.parseDeltaSets(t, e, r) : []
4127
4129
  };
4128
4130
  };
4129
- F.prototype.parseDeltaSetIndexMap = function() {
4131
+ T.prototype.parseDeltaSetIndexMap = function() {
4130
4132
  const t = this.parseByte(), e = this.parseByte(), n = [];
4131
4133
  let r = 0;
4132
4134
  switch (t) {
@@ -4165,7 +4167,7 @@ F.prototype.parseDeltaSetIndexMap = function() {
4165
4167
  map: n
4166
4168
  };
4167
4169
  };
4168
- F.prototype.parseDeltaSets = function(t, e, n) {
4170
+ T.prototype.parseDeltaSets = function(t, e, n) {
4169
4171
  const r = Array.from({ length: t }, () => []), s = e & we.LONG_WORDS, i = e & we.WORD_DELTA_COUNT_MASK;
4170
4172
  if (i > n)
4171
4173
  throw Error("wordCount must be less than or equal to regionIndexCount");
@@ -4175,7 +4177,7 @@ F.prototype.parseDeltaSets = function(t, e, n) {
4175
4177
  l < i ? r[c].push(a()) : r[c].push(o());
4176
4178
  return r;
4177
4179
  };
4178
- F.prototype.parseTupleVariationStoreList = function(t, e, n) {
4180
+ T.prototype.parseTupleVariationStoreList = function(t, e, n) {
4179
4181
  const r = this.parseUShort(), i = this.parseUShort() & 1, a = this.parseOffset32(), o = (i ? this.parseULong : this.parseUShort).bind(this), c = {};
4180
4182
  let l = o();
4181
4183
  i || (l *= 2);
@@ -4193,7 +4195,7 @@ F.prototype.parseTupleVariationStoreList = function(t, e, n) {
4193
4195
  }
4194
4196
  return c;
4195
4197
  };
4196
- F.prototype.parseTupleVariationStore = function(t, e, n, r, s) {
4198
+ T.prototype.parseTupleVariationStore = function(t, e, n, r, s) {
4197
4199
  const i = this.relativeOffset;
4198
4200
  this.relativeOffset = t, n === "cvar" && (this.relativeOffset += 4);
4199
4201
  const a = this.parseUShort(), o = !!(a & we.SHARED_POINT_NUMBERS), c = a & we.COUNT_MASK;
@@ -4210,7 +4212,7 @@ F.prototype.parseTupleVariationStore = function(t, e, n, r, s) {
4210
4212
  const m = u[y];
4211
4213
  m.privatePoints = [], this.relativeOffset = h, n === "cvar" && !m.peakTuple && console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."), m.flags.privatePointNumbers && (m.privatePoints = this.parsePackedPointNumbers()), delete m.flags;
4212
4214
  const b = this.offset, v = this.relativeOffset, w = (C) => {
4213
- let T, E;
4215
+ let F, E;
4214
4216
  const R = () => {
4215
4217
  let P = 0;
4216
4218
  if (n === "gvar") {
@@ -4219,15 +4221,15 @@ F.prototype.parseTupleVariationStore = function(t, e, n, r, s) {
4219
4221
  W.path, P = W.points.length, P += 4;
4220
4222
  }
4221
4223
  } else n === "cvar" && (P = r.length);
4222
- this.offset = b, this.relativeOffset = v, T = this.parsePackedDeltas(P), n === "gvar" && (E = this.parsePackedDeltas(P));
4224
+ this.offset = b, this.relativeOffset = v, F = this.parsePackedDeltas(P), n === "gvar" && (E = this.parsePackedDeltas(P));
4223
4225
  };
4224
4226
  return {
4225
4227
  configurable: !0,
4226
4228
  get: function() {
4227
- return T === void 0 && R(), C === "deltasY" ? E : T;
4229
+ return F === void 0 && R(), C === "deltasY" ? E : F;
4228
4230
  },
4229
4231
  set: function(P) {
4230
- T === void 0 && R(), C === "deltasY" ? E = P : T = P;
4232
+ F === void 0 && R(), C === "deltasY" ? E = P : F = P;
4231
4233
  }
4232
4234
  };
4233
4235
  };
@@ -4239,7 +4241,7 @@ F.prototype.parseTupleVariationStore = function(t, e, n, r, s) {
4239
4241
  };
4240
4242
  return p.sharedPoints = f, p;
4241
4243
  };
4242
- F.prototype.parseTupleVariationHeader = function(t, e) {
4244
+ T.prototype.parseTupleVariationHeader = function(t, e) {
4243
4245
  const n = this.parseUShort(), r = this.parseUShort(), s = !!(r & we.EMBEDDED_PEAK_TUPLE), i = !!(r & we.INTERMEDIATE_REGION), a = !!(r & we.PRIVATE_POINT_NUMBERS), o = s ? void 0 : r & we.TUPLE_INDEX_MASK, c = s ? this.parseTupleRecords(1, t)[0] : void 0, l = i ? this.parseTupleRecords(1, t)[0] : void 0, u = i ? this.parseTupleRecords(1, t)[0] : void 0, f = {
4244
4246
  variationDataSize: n,
4245
4247
  peakTuple: c,
@@ -4253,7 +4255,7 @@ F.prototype.parseTupleVariationHeader = function(t, e) {
4253
4255
  };
4254
4256
  return e === "gvar" && (f.sharedTupleRecordsIndex = o), f;
4255
4257
  };
4256
- F.prototype.parsePackedPointNumbers = function() {
4258
+ T.prototype.parsePackedPointNumbers = function() {
4257
4259
  const t = this.parseByte(), e = [];
4258
4260
  let n = t;
4259
4261
  if (t >= 128) {
@@ -4271,7 +4273,7 @@ F.prototype.parsePackedPointNumbers = function() {
4271
4273
  }
4272
4274
  return e;
4273
4275
  };
4274
- F.prototype.parsePackedDeltas = function(t) {
4276
+ T.prototype.parsePackedDeltas = function(t) {
4275
4277
  const e = [];
4276
4278
  for (; e.length < t; ) {
4277
4279
  const n = this.parseByte(), r = !!(n & we.DELTAS_ARE_ZERO), s = !!(n & we.DELTAS_ARE_WORDS), i = (n & we.DELTA_RUN_COUNT_MASK) + 1;
@@ -4293,7 +4295,7 @@ var D = {
4293
4295
  getOffset: zc,
4294
4296
  getBytes: Wc,
4295
4297
  bytesToString: Vc,
4296
- Parser: F
4298
+ Parser: T
4297
4299
  }, Bn = [
4298
4300
  "copyright",
4299
4301
  // 0
@@ -5047,10 +5049,10 @@ function Zc(t, e, n) {
5047
5049
  if (v !== void 0 && b !== void 0 && w !== void 0) {
5048
5050
  let C;
5049
5051
  if (v === Rr ? C = Nt.UTF16(t, o + m, y) : C = Nt.MACSTRING(t, o + m, y, v), C) {
5050
- let T = r[w];
5051
- T === void 0 && (T = r[w] = {});
5052
- let E = T[p];
5053
- E === void 0 && (E = T[p] = {}), E[b] = C;
5052
+ let F = r[w];
5053
+ F === void 0 && (F = r[w] = {});
5054
+ let E = F[p];
5055
+ E === void 0 && (E = F[p] = {}), E[b] = C;
5054
5056
  }
5055
5057
  }
5056
5058
  }
@@ -5113,8 +5115,8 @@ function Qc(t, e) {
5113
5115
  const v = m[b];
5114
5116
  if (p === 1 || p === 0) {
5115
5117
  let w = r[b], C = jc[w];
5116
- const T = $r(p, C, w);
5117
- let E = B.MACSTRING(v, T);
5118
+ const F = $r(p, C, w);
5119
+ let E = B.MACSTRING(v, F);
5118
5120
  if (p === 0 && (w = e.indexOf(b), w < 0 && (w = e.length, e.push(b)), C = 4, E = B.UTF16(v)), E !== void 0) {
5119
5121
  const R = _s(E, a);
5120
5122
  i.push(Ds(
@@ -5130,14 +5132,14 @@ function Qc(t, e) {
5130
5132
  if (p === 3) {
5131
5133
  const w = s[b];
5132
5134
  if (w !== void 0) {
5133
- const C = B.UTF16(v), T = _s(C, a);
5135
+ const C = B.UTF16(v), F = _s(C, a);
5134
5136
  i.push(Ds(
5135
5137
  3,
5136
5138
  1,
5137
5139
  w,
5138
5140
  l,
5139
5141
  C.length,
5140
- T
5142
+ F
5141
5143
  ));
5142
5144
  }
5143
5145
  }
@@ -7085,7 +7087,7 @@ function ml(t, e, n, r, s) {
7085
7087
  }
7086
7088
  var vt = { line: ml };
7087
7089
  function yl(t, e) {
7088
- const n = new F(t, e), r = n.parseShort();
7090
+ const n = new T(t, e), r = n.parseShort();
7089
7091
  r !== 0 && console.warn("Only CPALv0 is currently fully supported.");
7090
7092
  const s = n.parseShort(), i = n.parseShort(), a = n.parseShort(), o = n.parseOffset32(), c = n.parseUShortList(i);
7091
7093
  n.relativeOffset = o;
@@ -7516,7 +7518,7 @@ function Cl(t, e, n, r, s, i) {
7516
7518
  }, Lt(a, "numberOfContours", "_numberOfContours"), Lt(a, "xMin", "_xMin"), Lt(a, "xMax", "_xMax"), Lt(a, "yMin", "_yMin"), Lt(a, "yMax", "_yMax"), Lt(a, "points", "_points"), a;
7517
7519
  };
7518
7520
  }
7519
- function Tl(t, e, n, r, s) {
7521
+ function Fl(t, e, n, r, s) {
7520
7522
  return function() {
7521
7523
  const i = new Qt({ index: e, font: t });
7522
7524
  return i.path = function() {
@@ -7525,7 +7527,7 @@ function Tl(t, e, n, r, s) {
7525
7527
  }, i;
7526
7528
  };
7527
7529
  }
7528
- var Qe = { GlyphSet: zn, glyphLoader: wl, ttfGlyphLoader: Cl, cffGlyphLoader: Tl };
7530
+ var Qe = { GlyphSet: zn, glyphLoader: wl, ttfGlyphLoader: Cl, cffGlyphLoader: Fl };
7529
7531
  function Na(t, e) {
7530
7532
  if (t === e)
7531
7533
  return !0;
@@ -7562,7 +7564,7 @@ function Ye(t, e, n, r) {
7562
7564
  }
7563
7565
  return { objects: i, startOffset: e, endOffset: l };
7564
7566
  }
7565
- function Fl(t, e, n) {
7567
+ function Tl(t, e, n) {
7566
7568
  const r = [], s = n > 1 ? D.getULong(t, e) : D.getCard16(t, e), i = n > 1 ? 4 : 2;
7567
7569
  let a, o;
7568
7570
  if (s !== 0) {
@@ -7839,13 +7841,13 @@ function za(t, e) {
7839
7841
  function Mr(t, e, n, r, s) {
7840
7842
  let i, a, o, c;
7841
7843
  const l = new Pt(), u = [];
7842
- let f = 0, h = !1, p = !1, y = 0, m = 0, b, v, w, C, T = 0, E = [], R, P = 0;
7844
+ let f = 0, h = !1, p = !1, y = 0, m = 0, b, v, w, C, F = 0, E = [], R, P = 0;
7843
7845
  const W = t.tables.cff2 || t.tables.cff;
7844
7846
  if (w = W.topDict._defaultWidthX, C = W.topDict._nominalWidthX, s = s || t.variation && t.variation.get(), e.getBlendPath || (e.getBlendPath = function(M) {
7845
7847
  return Mr(t, e, n, r, M);
7846
7848
  }), t.isCIDFont || r > 1) {
7847
7849
  const M = W.topDict._fdSelect ? W.topDict._fdSelect[e.index] : 0, _ = W.topDict._fdArray[M];
7848
- b = _._subrs, v = _._subrsBias, r > 1 ? (E = W.topDict._vstore.itemVariationStore, T = _._privateDict.vsindex) : (w = _._defaultWidthX, C = _._nominalWidthX);
7850
+ b = _._subrs, v = _._subrsBias, r > 1 ? (E = W.topDict._vstore.itemVariationStore, F = _._privateDict.vsindex) : (w = _._defaultWidthX, C = _._nominalWidthX);
7849
7851
  } else
7850
7852
  b = W.topDict._subrs, v = W.topDict._subrsBias;
7851
7853
  const j = za(t, l);
@@ -7858,7 +7860,7 @@ function Mr(t, e, n, r, s) {
7858
7860
  M = (u.length & 1) !== 0, M && !h && (N = u.shift() + C), f += u.length >> 1, u.length = 0, h = !0;
7859
7861
  }
7860
7862
  function U(M) {
7861
- let _, re, Te, et, _e, me, Y, ne, pe, be, ge, ye, ce = 0;
7863
+ let _, re, Fe, et, _e, me, Y, ne, pe, be, ge, ye, ce = 0;
7862
7864
  for (; ce < M.length; ) {
7863
7865
  let ve = M[ce];
7864
7866
  switch (ce += 1, ve) {
@@ -7954,15 +7956,15 @@ function Mr(t, e, n, r, s) {
7954
7956
  console.error("CFF2 CharString operator vsindex (15) is not supported in CFF");
7955
7957
  break;
7956
7958
  }
7957
- T = u.pop();
7959
+ F = u.pop();
7958
7960
  break;
7959
7961
  case 16:
7960
7962
  if (r < 2) {
7961
7963
  console.error("CFF2 CharString operator blend (16) is not supported in CFF");
7962
7964
  break;
7963
7965
  }
7964
- R || (R = t.variation && s && t.variation.process.getBlendVector(E, T, s));
7965
- var Z = u.pop(), xe = R ? R.length : E.itemVariationSubtables[T].regionIndexes.length, Ee = Z * xe, Ae = u.length - Ee, Oe = Ae - Z;
7966
+ R || (R = t.variation && s && t.variation.process.getBlendVector(E, F, s));
7967
+ var Z = u.pop(), xe = R ? R.length : E.itemVariationSubtables[F].regionIndexes.length, Ee = Z * xe, Ae = u.length - Ee, Oe = Ae - Z;
7966
7968
  if (R)
7967
7969
  for (let tt = 0; tt < Z; tt++) {
7968
7970
  var Re = u[Oe + tt];
@@ -8028,15 +8030,15 @@ function Mr(t, e, n, r, s) {
8028
8030
  i = y, a = m + u.shift(), o = i + u.shift(), c = a + u.shift(), y = o + u.shift(), m = c + (u.length === 1 ? u.shift() : 0), l.curveTo(i, a, o, c, y, m);
8029
8031
  break;
8030
8032
  default:
8031
- ve < 32 ? console.log("Glyph " + e.index + ": unknown operator " + ve) : ve < 247 ? u.push(ve - 139) : ve < 251 ? (_ = M[ce], ce += 1, u.push((ve - 247) * 256 + _ + 108)) : ve < 255 ? (_ = M[ce], ce += 1, u.push(-(ve - 251) * 256 - _ - 108)) : (_ = M[ce], re = M[ce + 1], Te = M[ce + 2], et = M[ce + 3], ce += 4, u.push((_ << 24 | re << 16 | Te << 8 | et) / 65536));
8033
+ ve < 32 ? console.log("Glyph " + e.index + ": unknown operator " + ve) : ve < 247 ? u.push(ve - 139) : ve < 251 ? (_ = M[ce], ce += 1, u.push((ve - 247) * 256 + _ + 108)) : ve < 255 ? (_ = M[ce], ce += 1, u.push(-(ve - 251) * 256 - _ - 108)) : (_ = M[ce], re = M[ce + 1], Fe = M[ce + 2], et = M[ce + 3], ce += 4, u.push((_ << 24 | re << 16 | Fe << 8 | et) / 65536));
8032
8034
  }
8033
8035
  }
8034
8036
  }
8035
8037
  return U(n), t.variation && s && (l.commands = l.commands.map((M) => {
8036
8038
  const _ = Object.keys(M);
8037
8039
  for (let re = 0; re < _.length; re++) {
8038
- const Te = _[re];
8039
- Te !== "type" && (M[Te] = Math.round(M[Te]));
8040
+ const Fe = _[re];
8041
+ Fe !== "type" && (M[Fe] = Math.round(M[Fe]));
8040
8042
  }
8041
8043
  return M;
8042
8044
  })), h && (e.advanceWidth = N), l;
@@ -8111,7 +8113,7 @@ function Gl(t, e, n, r) {
8111
8113
  n.subrs = [], n.subrsBias = 0;
8112
8114
  }
8113
8115
  let f;
8114
- if (r.lowMemory ? (f = Fl(t, e + u.charStrings, i.formatMajor), n.nGlyphs = f.offsets.length - (i.formatMajor > 1 ? 1 : 0)) : (f = Ye(t, e + u.charStrings, null, i.formatMajor), n.nGlyphs = f.objects.length), i.formatMajor > 1 && n.tables.maxp && n.nGlyphs !== n.tables.maxp.numGlyphs && console.error(`Glyph count in the CFF2 table (${n.nGlyphs}) must correspond to the glyph count in the maxp table (${n.tables.maxp.numGlyphs})`), i.formatMajor < 2) {
8116
+ if (r.lowMemory ? (f = Tl(t, e + u.charStrings, i.formatMajor), n.nGlyphs = f.offsets.length - (i.formatMajor > 1 ? 1 : 0)) : (f = Ye(t, e + u.charStrings, null, i.formatMajor), n.nGlyphs = f.objects.length), i.formatMajor > 1 && n.tables.maxp && n.nGlyphs !== n.tables.maxp.numGlyphs && console.error(`Glyph count in the CFF2 table (${n.nGlyphs}) must correspond to the glyph count in the maxp table (${n.tables.maxp.numGlyphs})`), i.formatMajor < 2) {
8115
8117
  let h = [], p = [];
8116
8118
  u.charset === 0 ? h = ll : u.charset === 1 ? h = ul : u.charset === 2 ? h = hl : h = Ul(t, e + u.charset, n.nGlyphs, c.objects, n.isCIDFont), u.encoding === 0 ? p = Br : u.encoding === 1 ? p = fl : p = Pl(t, e + u.encoding), n.cffEncoding = new Da(p, h), n.encoding = n.encoding || n.cffEncoding;
8117
8119
  }
@@ -8767,13 +8769,13 @@ Ve[1] = function() {
8767
8769
  if (n === 1)
8768
8770
  return {
8769
8771
  substFormat: 1,
8770
- coverage: this.parsePointer(F.coverage),
8772
+ coverage: this.parsePointer(T.coverage),
8771
8773
  deltaGlyphId: this.parseShort()
8772
8774
  };
8773
8775
  if (n === 2)
8774
8776
  return {
8775
8777
  substFormat: 2,
8776
- coverage: this.parsePointer(F.coverage),
8778
+ coverage: this.parsePointer(T.coverage),
8777
8779
  substitute: this.parseOffset16List()
8778
8780
  };
8779
8781
  H.assert(!1, "0x" + e.toString(16) + ": lookup type 1 format must be 1 or 2.");
@@ -8782,7 +8784,7 @@ Ve[2] = function() {
8782
8784
  const e = this.parseUShort();
8783
8785
  return H.argument(e === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
8784
8786
  substFormat: e,
8785
- coverage: this.parsePointer(F.coverage),
8787
+ coverage: this.parsePointer(T.coverage),
8786
8788
  sequences: this.parseListOfLists()
8787
8789
  };
8788
8790
  };
@@ -8790,7 +8792,7 @@ Ve[3] = function() {
8790
8792
  const e = this.parseUShort();
8791
8793
  return H.argument(e === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
8792
8794
  substFormat: e,
8793
- coverage: this.parsePointer(F.coverage),
8795
+ coverage: this.parsePointer(T.coverage),
8794
8796
  alternateSets: this.parseListOfLists()
8795
8797
  };
8796
8798
  };
@@ -8798,7 +8800,7 @@ Ve[4] = function() {
8798
8800
  const e = this.parseUShort();
8799
8801
  return H.argument(e === 1, "GSUB ligature table identifier-format must be 1"), {
8800
8802
  substFormat: e,
8801
- coverage: this.parsePointer(F.coverage),
8803
+ coverage: this.parsePointer(T.coverage),
8802
8804
  ligatureSets: this.parseListOfLists(function() {
8803
8805
  return {
8804
8806
  ligGlyph: this.parseUShort(),
@@ -8808,15 +8810,15 @@ Ve[4] = function() {
8808
8810
  };
8809
8811
  };
8810
8812
  var Mt = {
8811
- sequenceIndex: F.uShort,
8812
- lookupListIndex: F.uShort
8813
+ sequenceIndex: T.uShort,
8814
+ lookupListIndex: T.uShort
8813
8815
  };
8814
8816
  Ve[5] = function() {
8815
8817
  const e = this.offset + this.relativeOffset, n = this.parseUShort();
8816
8818
  if (n === 1)
8817
8819
  return {
8818
8820
  substFormat: n,
8819
- coverage: this.parsePointer(F.coverage),
8821
+ coverage: this.parsePointer(T.coverage),
8820
8822
  ruleSets: this.parseListOfLists(function() {
8821
8823
  const r = this.parseUShort(), s = this.parseUShort();
8822
8824
  return {
@@ -8828,8 +8830,8 @@ Ve[5] = function() {
8828
8830
  if (n === 2)
8829
8831
  return {
8830
8832
  substFormat: n,
8831
- coverage: this.parsePointer(F.coverage),
8832
- classDef: this.parsePointer(F.classDef),
8833
+ coverage: this.parsePointer(T.coverage),
8834
+ classDef: this.parsePointer(T.classDef),
8833
8835
  classSets: this.parseListOfLists(function() {
8834
8836
  const r = this.parseUShort(), s = this.parseUShort();
8835
8837
  return {
@@ -8842,7 +8844,7 @@ Ve[5] = function() {
8842
8844
  const r = this.parseUShort(), s = this.parseUShort();
8843
8845
  return {
8844
8846
  substFormat: n,
8845
- coverages: this.parseList(r, F.pointer(F.coverage)),
8847
+ coverages: this.parseList(r, T.pointer(T.coverage)),
8846
8848
  lookupRecords: this.parseRecordList(s, Mt)
8847
8849
  };
8848
8850
  }
@@ -8853,7 +8855,7 @@ Ve[6] = function() {
8853
8855
  if (n === 1)
8854
8856
  return {
8855
8857
  substFormat: 1,
8856
- coverage: this.parsePointer(F.coverage),
8858
+ coverage: this.parsePointer(T.coverage),
8857
8859
  chainRuleSets: this.parseListOfLists(function() {
8858
8860
  return {
8859
8861
  backtrack: this.parseUShortList(),
@@ -8866,10 +8868,10 @@ Ve[6] = function() {
8866
8868
  if (n === 2)
8867
8869
  return {
8868
8870
  substFormat: 2,
8869
- coverage: this.parsePointer(F.coverage),
8870
- backtrackClassDef: this.parsePointer(F.classDef),
8871
- inputClassDef: this.parsePointer(F.classDef),
8872
- lookaheadClassDef: this.parsePointer(F.classDef),
8871
+ coverage: this.parsePointer(T.coverage),
8872
+ backtrackClassDef: this.parsePointer(T.classDef),
8873
+ inputClassDef: this.parsePointer(T.classDef),
8874
+ lookaheadClassDef: this.parsePointer(T.classDef),
8873
8875
  chainClassSet: this.parseListOfLists(function() {
8874
8876
  return {
8875
8877
  backtrack: this.parseUShortList(),
@@ -8882,9 +8884,9 @@ Ve[6] = function() {
8882
8884
  if (n === 3)
8883
8885
  return {
8884
8886
  substFormat: 3,
8885
- backtrackCoverage: this.parseList(F.pointer(F.coverage)),
8886
- inputCoverage: this.parseList(F.pointer(F.coverage)),
8887
- lookaheadCoverage: this.parseList(F.pointer(F.coverage)),
8887
+ backtrackCoverage: this.parseList(T.pointer(T.coverage)),
8888
+ inputCoverage: this.parseList(T.pointer(T.coverage)),
8889
+ lookaheadCoverage: this.parseList(T.pointer(T.coverage)),
8888
8890
  lookupRecords: this.parseRecordList(Mt)
8889
8891
  };
8890
8892
  H.assert(!1, "0x" + e.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
@@ -8892,7 +8894,7 @@ Ve[6] = function() {
8892
8894
  Ve[7] = function() {
8893
8895
  const e = this.parseUShort();
8894
8896
  H.argument(e === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
8895
- const n = this.parseUShort(), r = new F(this.data, this.offset + this.parseULong());
8897
+ const n = this.parseUShort(), r = new T(this.data, this.offset + this.parseULong());
8896
8898
  return {
8897
8899
  substFormat: 1,
8898
8900
  lookupType: n,
@@ -8903,15 +8905,15 @@ Ve[8] = function() {
8903
8905
  const e = this.parseUShort();
8904
8906
  return H.argument(e === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
8905
8907
  substFormat: e,
8906
- coverage: this.parsePointer(F.coverage),
8907
- backtrackCoverage: this.parseList(F.pointer(F.coverage)),
8908
- lookaheadCoverage: this.parseList(F.pointer(F.coverage)),
8908
+ coverage: this.parsePointer(T.coverage),
8909
+ backtrackCoverage: this.parseList(T.pointer(T.coverage)),
8910
+ lookaheadCoverage: this.parseList(T.pointer(T.coverage)),
8909
8911
  substitutes: this.parseUShortList()
8910
8912
  };
8911
8913
  };
8912
8914
  function pu(t, e) {
8913
8915
  e = e || 0;
8914
- const n = new F(t, e), r = n.parseVersion(1);
8916
+ const n = new T(t, e), r = n.parseVersion(1);
8915
8917
  return H.argument(r === 1 || r === 1.1, "Unsupported GSUB table version."), r === 1 ? {
8916
8918
  version: r,
8917
8919
  scripts: n.parseScriptList(),
@@ -9101,19 +9103,19 @@ function mu(t) {
9101
9103
  }
9102
9104
  var Ja = { parse: gu, make: mu };
9103
9105
  function yu(t, e) {
9104
- const n = new F(t, e), r = n.parseUShort();
9106
+ const n = new T(t, e), r = n.parseUShort();
9105
9107
  r !== 0 && console.warn("Only COLRv0 is currently fully supported. A subset of color glyphs might be available in this font if provided in the v0 format.");
9106
9108
  const s = n.parseUShort(), i = n.parseOffset32(), a = n.parseOffset32(), o = n.parseUShort();
9107
9109
  n.relativeOffset = i;
9108
9110
  const c = n.parseRecordList(s, {
9109
- glyphID: F.uShort,
9110
- firstLayerIndex: F.uShort,
9111
- numLayers: F.uShort
9111
+ glyphID: T.uShort,
9112
+ firstLayerIndex: T.uShort,
9113
+ numLayers: T.uShort
9112
9114
  });
9113
9115
  n.relativeOffset = a;
9114
9116
  const l = n.parseRecordList(o, {
9115
- glyphID: F.uShort,
9116
- paletteIndex: F.uShort
9117
+ glyphID: T.uShort,
9118
+ paletteIndex: T.uShort
9117
9119
  });
9118
9120
  return {
9119
9121
  version: r,
@@ -9215,7 +9217,7 @@ function Cu(t, e) {
9215
9217
  ));
9216
9218
  return n;
9217
9219
  }
9218
- function Tu(t, e, n) {
9220
+ function Fu(t, e, n) {
9219
9221
  const r = new D.Parser(t, e), s = r.parseULong();
9220
9222
  H.argument(s === 65536, "Unsupported fvar table version.");
9221
9223
  const i = r.parseOffset16();
@@ -9228,10 +9230,10 @@ function Tu(t, e, n) {
9228
9230
  f.push(wu(t, h + p * l, u, n, l));
9229
9231
  return { axes: u, instances: f };
9230
9232
  }
9231
- var eo = { make: Cu, parse: Tu }, Fu = {
9232
- tag: F.tag,
9233
- nameID: F.uShort,
9234
- ordering: F.uShort
9233
+ var eo = { make: Cu, parse: Fu }, Tu = {
9234
+ tag: T.tag,
9235
+ nameID: T.uShort,
9236
+ ordering: T.uShort
9235
9237
  }, nn = new Array(5);
9236
9238
  nn[1] = function() {
9237
9239
  return {
@@ -9290,7 +9292,7 @@ function Eu(t, e, n) {
9290
9292
  n !== void 0 && H.argument(c >= n.axes.length, "STAT axis count must be greater than or equal to fvar axis count"), u > 0 && H.argument(c >= 0, "STAT axis count must be greater than 0 if STAT axis value count is greater than 0");
9291
9293
  const p = [];
9292
9294
  for (let b = 0; b < c; b++)
9293
- r.offset = e + l, r.relativeOffset = b * o, p.push(r.parseStruct(Fu));
9295
+ r.offset = e + l, r.relativeOffset = b * o, p.push(r.parseStruct(Tu));
9294
9296
  r.offset = e, r.relativeOffset = f;
9295
9297
  const y = r.parseUShortList(u), m = [];
9296
9298
  for (let b = 0; b < u; b++)
@@ -9422,7 +9424,7 @@ function Bu(t, e) {
9422
9424
  }
9423
9425
  function Mu(t, e, n) {
9424
9426
  e || (e = 0);
9425
- const r = new F(t, e), s = r.parseUShort(), i = r.parseUShort();
9427
+ const r = new T(t, e), s = r.parseUShort(), i = r.parseUShort();
9426
9428
  s !== 1 && console.warn(`Unsupported avar table version ${s}.${i}`), r.skip("uShort", 1);
9427
9429
  const a = r.parseUShort();
9428
9430
  H.argument(a === n.axes.length, "avar axis count must correspond to fvar axis count");
@@ -9501,7 +9503,7 @@ function Gu(t) {
9501
9503
  }
9502
9504
  var io = { parse: Nu, make: Gu };
9503
9505
  function Hu(t, e) {
9504
- const n = /* @__PURE__ */ new Map(), r = t.buffer, s = new F(t, e);
9506
+ const n = /* @__PURE__ */ new Map(), r = t.buffer, s = new T(t, e);
9505
9507
  if (s.parseUShort() !== 0) return n;
9506
9508
  s.relativeOffset = s.parseOffset32();
9507
9509
  const a = t.byteOffset + e + s.relativeOffset, o = s.parseUShort(), c = /* @__PURE__ */ new Map();
@@ -9682,7 +9684,7 @@ function Vu(t) {
9682
9684
  // Use space as the default character, if available.
9683
9685
  usBreakChar: t.hasChar(" ") ? 32 : 0
9684
9686
  // Use space as the break character, if available.
9685
- }, t.tables.os2)), T = $a.make(t.glyphs), E = Ra.make(t.glyphs), R = t.getEnglishName("fontFamily"), P = t.getEnglishName("fontSubfamily"), W = R + " " + P;
9687
+ }, t.tables.os2)), F = $a.make(t.glyphs), E = Ra.make(t.glyphs), R = t.getEnglishName("fontFamily"), P = t.getEnglishName("fontSubfamily"), W = R + " " + P;
9686
9688
  let j = t.getEnglishName("postScriptName");
9687
9689
  j || (j = R.replace(/\s/g, "") + "-" + P);
9688
9690
  const N = {};
@@ -9698,7 +9700,7 @@ function Vu(t) {
9698
9700
  N[Z].postScriptName || (N[Z].postScriptName = { en: j });
9699
9701
  }
9700
9702
  N.unicode.preferredFamily || (N.unicode.preferredFamily = X.fontFamily || ie.fontFamily || U.fontFamily), N.macintosh.preferredFamily || (N.macintosh.preferredFamily = ie.fontFamily || X.fontFamily || U.fontFamily), N.windows.preferredFamily || (N.windows.preferredFamily = U.fontFamily || X.fontFamily || ie.fontFamily), N.unicode.preferredSubfamily || (N.unicode.preferredSubfamily = X.fontSubfamily || ie.fontSubfamily || U.fontSubfamily), N.macintosh.preferredSubfamily || (N.macintosh.preferredSubfamily = ie.fontSubfamily || X.fontSubfamily || U.fontSubfamily), N.windows.preferredSubfamily || (N.windows.preferredSubfamily = U.fontSubfamily || X.fontSubfamily || ie.fontSubfamily);
9701
- const M = [], _ = Ia.make(N, M), re = M.length > 0 ? Ya.make(M) : void 0, Te = Ka.make(t), et = Dr.make(t.glyphs, {
9703
+ const M = [], _ = Ia.make(N, M), re = M.length > 0 ? Ya.make(M) : void 0, Fe = Ka.make(t), et = Dr.make(t.glyphs, {
9702
9704
  version: t.getEnglishName("version"),
9703
9705
  fullName: W,
9704
9706
  familyName: R,
@@ -9707,7 +9709,7 @@ function Vu(t) {
9707
9709
  unitsPerEm: t.unitsPerEm,
9708
9710
  fontBBox: [0, y.yMin, y.ascender, y.advanceWidthMax],
9709
9711
  topDict: t.tables.cff && t.tables.cff.topDict || {}
9710
- }), _e = t.metas && Object.keys(t.metas).length > 0 ? Ja.make(t.metas) : void 0, me = [b, v, w, C, _, E, Te, et, T];
9712
+ }), _e = t.metas && Object.keys(t.metas).length > 0 ? Ja.make(t.metas) : void 0, me = [b, v, w, C, _, E, Fe, et, F];
9711
9713
  re && me.push(re);
9712
9714
  const Y = {
9713
9715
  gsub: Za,
@@ -11356,7 +11358,7 @@ var po = { getPath: ts, parse: fh }, ph = class {
11356
11358
  hvar() {
11357
11359
  return this.font.tables.hvar;
11358
11360
  }
11359
- }, Ys = 1e6, Un = 64, Pn = 1e4, go, Ft, mo, Pr;
11361
+ }, Ys = 1e6, Un = 64, Pn = 1e4, go, Tt, mo, Pr;
11360
11362
  function yo(t) {
11361
11363
  this.font = t, this.getCommands = function(e) {
11362
11364
  return po.getPath(e).commands;
@@ -11586,7 +11588,7 @@ yo.prototype.exec = function(t, e) {
11586
11588
  if (!s) {
11587
11589
  pt.prototype = vh, s = this._fpgmState = new pt("fpgm", n.tables.fpgm), s.funcs = [], s.font = n, s.instructionCount = 0, s.callDepth = 0;
11588
11590
  try {
11589
- Ft(s);
11591
+ Tt(s);
11590
11592
  } catch (a) {
11591
11593
  console.log("Hinting error in FPGM:" + a), this._errorState = 3;
11592
11594
  return;
@@ -11601,7 +11603,7 @@ yo.prototype.exec = function(t, e) {
11601
11603
  } else
11602
11604
  r.cvt = [];
11603
11605
  try {
11604
- Ft(r);
11606
+ Tt(r);
11605
11607
  } catch (a) {
11606
11608
  this._errorState < 2 && console.log("Hinting error in PREP:" + a), this._errorState = 2;
11607
11609
  }
@@ -11638,7 +11640,7 @@ mo = function(t, e) {
11638
11640
  t.instructions && !o.inhibitGridFit && (o = new pt("glyf", t.instructions), o.gZone = o.z0 = o.z1 = o.z2 = a, o.contours = i, a.push(
11639
11641
  new at(0, 0),
11640
11642
  new at(Math.round(t.advanceWidth * n), 0)
11641
- ), Ft(o), a.length -= 2);
11643
+ ), Tt(o), a.length -= 2);
11642
11644
  }
11643
11645
  return a;
11644
11646
  };
@@ -11658,9 +11660,9 @@ Pr = function(t, e, n, r) {
11658
11660
  e.inhibitGridFit || (a.push(
11659
11661
  new at(0, 0),
11660
11662
  new at(Math.round(t.advanceWidth * n), 0)
11661
- ), Ft(e), a.length -= 2);
11663
+ ), Tt(e), a.length -= 2);
11662
11664
  };
11663
- Ft = function(t) {
11665
+ Tt = function(t) {
11664
11666
  let e = t.prog;
11665
11667
  if (!e) return;
11666
11668
  const n = e.length;
@@ -11734,16 +11736,16 @@ function Ch(t) {
11734
11736
  const e = t.stack, n = t.pv;
11735
11737
  e.push(n.x * 16384), e.push(n.y * 16384);
11736
11738
  }
11737
- function Th(t) {
11739
+ function Fh(t) {
11738
11740
  const e = t.stack, n = t.fv;
11739
11741
  e.push(n.x * 16384), e.push(n.y * 16384);
11740
11742
  }
11741
- function Fh(t) {
11743
+ function Th(t) {
11742
11744
  t.fv = t.pv;
11743
11745
  }
11744
11746
  function kh(t) {
11745
- const e = t.stack, n = e.pop(), r = e.pop(), s = e.pop(), i = e.pop(), a = e.pop(), o = t.z0, c = t.z1, l = o[n], u = o[r], f = c[s], h = c[i], p = t.z2[a], y = l.x, m = l.y, b = u.x, v = u.y, w = f.x, C = f.y, T = h.x, E = h.y, R = (y - b) * (C - E) - (m - v) * (w - T), P = y * v - m * b, W = w * E - C * T;
11746
- p.x = (P * (w - T) - W * (y - b)) / R, p.y = (P * (C - E) - W * (m - v)) / R;
11747
+ const e = t.stack, n = e.pop(), r = e.pop(), s = e.pop(), i = e.pop(), a = e.pop(), o = t.z0, c = t.z1, l = o[n], u = o[r], f = c[s], h = c[i], p = t.z2[a], y = l.x, m = l.y, b = u.x, v = u.y, w = f.x, C = f.y, F = h.x, E = h.y, R = (y - b) * (C - E) - (m - v) * (w - F), P = y * v - m * b, W = w * E - C * F;
11748
+ p.x = (P * (w - F) - W * (y - b)) / R, p.y = (P * (C - E) - W * (m - v)) / R;
11747
11749
  }
11748
11750
  function Eh(t) {
11749
11751
  t.rp0 = t.stack.pop();
@@ -11856,7 +11858,7 @@ function qh(t) {
11856
11858
  const s = t.ip, i = t.prog;
11857
11859
  t.prog = t.funcs[n];
11858
11860
  for (let a = 0; a < r; a++)
11859
- Ft(t);
11861
+ Tt(t);
11860
11862
  t.ip = s, t.prog = i, t.callDepth--;
11861
11863
  }
11862
11864
  function jh(t) {
@@ -11864,7 +11866,7 @@ function jh(t) {
11864
11866
  if (++t.callDepth > Un)
11865
11867
  throw new Error("Hinting call depth exceeded maximum of " + Un);
11866
11868
  const n = t.ip, r = t.prog;
11867
- t.prog = t.funcs[e], Ft(t), t.ip = n, t.prog = r, t.callDepth--;
11869
+ t.prog = t.funcs[e], Tt(t), t.ip = n, t.prog = r, t.callDepth--;
11868
11870
  }
11869
11871
  function $h(t) {
11870
11872
  const e = t.stack, n = e.pop();
@@ -12088,11 +12090,11 @@ function Cf(t) {
12088
12090
  const n = t.stack.pop();
12089
12091
  t.deltaShift = Math.pow(0.5, n);
12090
12092
  }
12091
- function Tf(t) {
12093
+ function Ff(t) {
12092
12094
  const e = t.stack, n = e.pop(), r = e.pop();
12093
12095
  e.push(r + n);
12094
12096
  }
12095
- function Ff(t) {
12097
+ function Tf(t) {
12096
12098
  const e = t.stack, n = e.pop(), r = e.pop();
12097
12099
  e.push(r - n);
12098
12100
  }
@@ -12309,9 +12311,9 @@ go = [
12309
12311
  /* 0x0C */
12310
12312
  Ch,
12311
12313
  /* 0x0D */
12312
- Th,
12313
- /* 0x0E */
12314
12314
  Fh,
12315
+ /* 0x0E */
12316
+ Th,
12315
12317
  /* 0x0F */
12316
12318
  kh,
12317
12319
  /* 0x10 */
@@ -12484,9 +12486,9 @@ go = [
12484
12486
  /* 0x5F */
12485
12487
  Cf,
12486
12488
  /* 0x60 */
12487
- Tf,
12488
- /* 0x61 */
12489
12489
  Ff,
12490
+ /* 0x61 */
12491
+ Tf,
12490
12492
  /* 0x62 */
12491
12493
  kf,
12492
12494
  /* 0x63 */
@@ -13154,15 +13156,15 @@ function Jf(t, e) {
13154
13156
  for (let p = 0; p < e.lookupRecords.length; p++) {
13155
13157
  const y = e.lookupRecords[p], m = y.lookupListIndex, b = this.getLookupByIndex(m);
13156
13158
  for (let v = 0; v < b.subtables.length; v++) {
13157
- let w = b.subtables[v], C, T = this.getSubstitutionType(b, w);
13158
- if (T === "71" ? (T = this.getSubstitutionType(w, w.extension), C = this.getLookupMethod(w, w.extension), w = w.extension) : C = this.getLookupMethod(b, w), T === "12") {
13159
+ let w = b.subtables[v], C, F = this.getSubstitutionType(b, w);
13160
+ if (F === "71" ? (F = this.getSubstitutionType(w, w.extension), C = this.getLookupMethod(w, w.extension), w = w.extension) : C = this.getLookupMethod(b, w), F === "12") {
13159
13161
  const E = t.get(y.sequenceIndex), R = C(E);
13160
13162
  R && h.push(R);
13161
- } else if (T === "21") {
13163
+ } else if (F === "21") {
13162
13164
  const E = t.get(y.sequenceIndex), R = C(E);
13163
13165
  R && h.push(R);
13164
13166
  } else
13165
- throw new Error(`Substitution type ${T} is not supported in chaining substitution`);
13167
+ throw new Error(`Substitution type ${F} is not supported in chaining substitution`);
13166
13168
  }
13167
13169
  }
13168
13170
  return h;
@@ -13634,8 +13636,8 @@ function Cp(t) {
13634
13636
  }
13635
13637
  }
13636
13638
  }
13637
- var Tp = Cp;
13638
- function Fp(t) {
13639
+ var Fp = Cp;
13640
+ function Tp(t) {
13639
13641
  const e = t.current, n = t.get(-1);
13640
13642
  return (
13641
13643
  // ? latin first char
@@ -13652,7 +13654,7 @@ function kp(t) {
13652
13654
  );
13653
13655
  }
13654
13656
  var Ep = {
13655
- startCheck: Fp,
13657
+ startCheck: Tp,
13656
13658
  endCheck: kp
13657
13659
  };
13658
13660
  function pi(t, e) {
@@ -13807,13 +13809,13 @@ function zp(t) {
13807
13809
  }
13808
13810
  }
13809
13811
  var Wp = zp;
13810
- function He(t) {
13812
+ function ze(t) {
13811
13813
  this.baseDir = t || "ltr", this.tokenizer = new Yf(), this.featuresTags = {};
13812
13814
  }
13813
- He.prototype.setText = function(t) {
13815
+ ze.prototype.setText = function(t) {
13814
13816
  this.text = t;
13815
13817
  };
13816
- He.prototype.contextChecks = {
13818
+ ze.prototype.contextChecks = {
13817
13819
  ccmpReplacementCheck: wp,
13818
13820
  latinWordCheck: Ep,
13819
13821
  arabicWordCheck: ap,
@@ -13844,13 +13846,13 @@ function qp() {
13844
13846
  );
13845
13847
  }
13846
13848
  }
13847
- He.prototype.registerFeatures = function(t, e) {
13849
+ ze.prototype.registerFeatures = function(t, e) {
13848
13850
  const n = e.filter(
13849
13851
  (r) => this.query.supports({ script: t, tag: r })
13850
13852
  );
13851
13853
  Object.prototype.hasOwnProperty.call(this.featuresTags, t) ? this.featuresTags[t] = this.featuresTags[t].concat(n) : this.featuresTags[t] = n;
13852
13854
  };
13853
- He.prototype.applyFeatures = function(t, e) {
13855
+ ze.prototype.applyFeatures = function(t, e) {
13854
13856
  if (!t) throw new Error(
13855
13857
  "No valid font was provided to apply features"
13856
13858
  );
@@ -13860,7 +13862,7 @@ He.prototype.applyFeatures = function(t, e) {
13860
13862
  this.query.supports({ script: r.script }) && this.registerFeatures(r.script, r.tags);
13861
13863
  }
13862
13864
  };
13863
- He.prototype.registerModifier = function(t, e, n) {
13865
+ ze.prototype.registerModifier = function(t, e, n) {
13864
13866
  this.tokenizer.registerModifier(t, e, n);
13865
13867
  };
13866
13868
  function cn() {
@@ -13883,7 +13885,7 @@ function $p() {
13883
13885
  const t = this.tokenizer.getContextRanges("ccmpReplacement");
13884
13886
  for (let e = 0; e < t.length; e++) {
13885
13887
  const n = t[e];
13886
- Tp.call(this, n);
13888
+ Fp.call(this, n);
13887
13889
  }
13888
13890
  }
13889
13891
  function Yp() {
@@ -13919,22 +13921,22 @@ function Zp() {
13919
13921
  this.hasFeatureEnabled("thai", "liga") && _p.call(this, n), this.hasFeatureEnabled("thai", "rlig") && Pp.call(this, n), this.hasFeatureEnabled("thai", "ccmp") && Mp.call(this, n);
13920
13922
  }
13921
13923
  }
13922
- He.prototype.checkContextReady = function(t) {
13924
+ ze.prototype.checkContextReady = function(t) {
13923
13925
  return !!this.tokenizer.getContext(t);
13924
13926
  };
13925
- He.prototype.applyFeaturesToContexts = function() {
13927
+ ze.prototype.applyFeaturesToContexts = function() {
13926
13928
  this.checkContextReady("ccmpReplacement") && $p.call(this), this.checkContextReady("arabicWord") && (jp.call(this), Yp.call(this)), this.checkContextReady("latinWord") && Xp.call(this), this.checkContextReady("arabicSentence") && qp.call(this), this.checkContextReady("thaiWord") && Zp.call(this), this.checkContextReady("unicodeVariationSequence") && Kp.call(this);
13927
13929
  };
13928
- He.prototype.hasFeatureEnabled = function(t, e) {
13930
+ ze.prototype.hasFeatureEnabled = function(t, e) {
13929
13931
  return (this.featuresTags[t] || []).indexOf(e) !== -1;
13930
13932
  };
13931
- He.prototype.processText = function(t) {
13933
+ ze.prototype.processText = function(t) {
13932
13934
  (!this.text || this.text !== t) && (this.setText(t), Vp.call(this), this.applyFeaturesToContexts());
13933
13935
  };
13934
- He.prototype.getBidiText = function(t) {
13936
+ ze.prototype.getBidiText = function(t) {
13935
13937
  return this.processText(t), this.tokenizer.getText();
13936
13938
  };
13937
- He.prototype.getTextGlyphs = function(t) {
13939
+ ze.prototype.getTextGlyphs = function(t) {
13938
13940
  this.processText(t);
13939
13941
  let e = [];
13940
13942
  for (let n = 0; n < this.tokenizer.tokens.length; n++) {
@@ -13945,7 +13947,7 @@ He.prototype.getTextGlyphs = function(t) {
13945
13947
  }
13946
13948
  return e;
13947
13949
  };
13948
- var Jp = He;
13950
+ var Jp = ze;
13949
13951
  function or(t) {
13950
13952
  return {
13951
13953
  fontFamily: { en: t.familyName || " " },
@@ -14261,8 +14263,8 @@ function td() {
14261
14263
  }
14262
14264
  var nd = { make: td, parse: ed }, rd = function() {
14263
14265
  return {
14264
- coverage: this.parsePointer(F.coverage),
14265
- attachPoints: this.parseList(F.pointer(F.uShortList))
14266
+ coverage: this.parsePointer(T.coverage),
14267
+ attachPoints: this.parseList(T.pointer(T.uShortList))
14266
14268
  };
14267
14269
  }, sd = function() {
14268
14270
  var t = this.parseUShort();
@@ -14276,28 +14278,28 @@ var nd = { make: td, parse: ed }, rd = function() {
14276
14278
  if (t === 3)
14277
14279
  return { coordinate: this.parseShort() };
14278
14280
  }, id = function() {
14279
- return this.parseList(F.pointer(sd));
14281
+ return this.parseList(T.pointer(sd));
14280
14282
  }, ad = function() {
14281
14283
  return {
14282
- coverage: this.parsePointer(F.coverage),
14283
- ligGlyphs: this.parseList(F.pointer(id))
14284
+ coverage: this.parsePointer(T.coverage),
14285
+ ligGlyphs: this.parseList(T.pointer(id))
14284
14286
  };
14285
14287
  }, od = function() {
14286
- return this.parseUShort(), this.parseList(F.pointer(F.coverage));
14288
+ return this.parseUShort(), this.parseList(T.pointer(T.coverage));
14287
14289
  };
14288
14290
  function cd(t, e) {
14289
14291
  e = e || 0;
14290
- const n = new F(t, e), r = n.parseVersion(1);
14292
+ const n = new T(t, e), r = n.parseVersion(1);
14291
14293
  H.argument(
14292
14294
  r === 1 || r === 1.2 || r === 1.3,
14293
14295
  "Unsupported GDEF table version."
14294
14296
  );
14295
14297
  var s = {
14296
14298
  version: r,
14297
- classDef: n.parsePointer(F.classDef),
14299
+ classDef: n.parsePointer(T.classDef),
14298
14300
  attachList: n.parsePointer(rd),
14299
14301
  ligCaretList: n.parsePointer(ad),
14300
- markAttachClassDef: n.parsePointer(F.classDef)
14302
+ markAttachClassDef: n.parsePointer(T.classDef)
14301
14303
  };
14302
14304
  return r >= 1.2 && (s.markGlyphSets = n.parsePointer(od)), s;
14303
14305
  }
@@ -14307,13 +14309,13 @@ qe[1] = function() {
14307
14309
  if (n === 1)
14308
14310
  return {
14309
14311
  posFormat: 1,
14310
- coverage: this.parsePointer(F.coverage),
14312
+ coverage: this.parsePointer(T.coverage),
14311
14313
  value: this.parseValueRecord()
14312
14314
  };
14313
14315
  if (n === 2)
14314
14316
  return {
14315
14317
  posFormat: 2,
14316
- coverage: this.parsePointer(F.coverage),
14318
+ coverage: this.parsePointer(T.coverage),
14317
14319
  values: this.parseValueRecordList()
14318
14320
  };
14319
14321
  H.assert(!1, "0x" + e.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
@@ -14321,14 +14323,14 @@ qe[1] = function() {
14321
14323
  qe[2] = function() {
14322
14324
  const e = this.offset + this.relativeOffset, n = this.parseUShort();
14323
14325
  H.assert(n === 1 || n === 2, "0x" + e.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
14324
- const r = this.parsePointer(F.coverage), s = this.parseUShort(), i = this.parseUShort();
14326
+ const r = this.parsePointer(T.coverage), s = this.parseUShort(), i = this.parseUShort();
14325
14327
  if (n === 1)
14326
14328
  return {
14327
14329
  posFormat: n,
14328
14330
  coverage: r,
14329
14331
  valueFormat1: s,
14330
14332
  valueFormat2: i,
14331
- pairSets: this.parseList(F.pointer(F.list(function() {
14333
+ pairSets: this.parseList(T.pointer(T.list(function() {
14332
14334
  return {
14333
14335
  // pairValueRecord
14334
14336
  secondGlyph: this.parseUShort(),
@@ -14338,7 +14340,7 @@ qe[2] = function() {
14338
14340
  })))
14339
14341
  };
14340
14342
  if (n === 2) {
14341
- const a = this.parsePointer(F.classDef), o = this.parsePointer(F.classDef), c = this.parseUShort(), l = this.parseUShort();
14343
+ const a = this.parsePointer(T.classDef), o = this.parsePointer(T.classDef), c = this.parseUShort(), l = this.parseUShort();
14342
14344
  return {
14343
14345
  // Class Pair Adjustment
14344
14346
  posFormat: n,
@@ -14349,7 +14351,7 @@ qe[2] = function() {
14349
14351
  classDef2: o,
14350
14352
  class1Count: c,
14351
14353
  class2Count: l,
14352
- classRecords: this.parseList(c, F.list(l, function() {
14354
+ classRecords: this.parseList(c, T.list(l, function() {
14353
14355
  return {
14354
14356
  value1: this.parseValueRecord(s),
14355
14357
  value2: this.parseValueRecord(i)
@@ -14381,7 +14383,7 @@ qe[9] = function() {
14381
14383
  };
14382
14384
  function ud(t, e) {
14383
14385
  e = e || 0;
14384
- const n = new F(t, e), r = n.parseVersion(1);
14386
+ const n = new T(t, e), r = n.parseVersion(1);
14385
14387
  return H.argument(r === 1 || r === 1.1, "Unsupported GPOS table version " + r), r === 1 ? {
14386
14388
  version: r,
14387
14389
  scripts: n.parseScriptList(),
@@ -14509,7 +14511,7 @@ function Sd(t, e = {}) {
14509
14511
  throw new Error("WOFF2 require an external decompressor library, see examples at: " + U);
14510
14512
  } else
14511
14513
  throw new Error("Unsupported OpenType signature " + c);
14512
- let l, u, f, h, p, y, m, b, v, w, C, T, E, R, P, W, j, N;
14514
+ let l, u, f, h, p, y, m, b, v, w, C, F, E, R, P, W, j, N;
14513
14515
  for (let U = 0; U < a; U += 1) {
14514
14516
  const M = o[U];
14515
14517
  let _;
@@ -14548,7 +14550,7 @@ function Sd(t, e = {}) {
14548
14550
  E = M;
14549
14551
  break;
14550
14552
  case "hmtx":
14551
- T = M;
14553
+ F = M;
14552
14554
  break;
14553
14555
  case "ltag":
14554
14556
  _ = J(i, M), r = Ya.parse(_.data, _.offset);
@@ -14625,7 +14627,7 @@ function Sd(t, e = {}) {
14625
14627
  Dr.parse(U.data, U.offset, s, e);
14626
14628
  } else
14627
14629
  throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");
14628
- const ie = J(i, T);
14630
+ const ie = J(i, F);
14629
14631
  if ($a.parse(s, ie.data, ie.offset, s.numberOfHMetrics, s.numGlyphs, s.glyphs, e), gl(s, e), R) {
14630
14632
  const U = J(i, R);
14631
14633
  s.kerningPairs = yd.parse(U.data, U.offset);
@@ -14667,7 +14669,7 @@ function Sd(t, e = {}) {
14667
14669
  s.tables.avar = no.parse(U.data, U.offset, s.tables.fvar);
14668
14670
  }
14669
14671
  if (E) {
14670
- f || console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."), T || console.warn("This font provides an HVAR table, but no hmtx table to vary.");
14672
+ f || console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."), F || console.warn("This font provides an HVAR table, but no hmtx table to vary.");
14671
14673
  const U = J(i, E);
14672
14674
  s.tables.hvar = nd.parse(U.data, U.offset, s.tables.fvar);
14673
14675
  }
@@ -14677,12 +14679,12 @@ function Sd(t, e = {}) {
14677
14679
  }
14678
14680
  return s.palettes = new uo(s), s;
14679
14681
  }
14680
- const wd = 1.15, Cd = 0.9, Td = ["国", "中", "永"];
14682
+ const wd = 1.15, Cd = 0.9, Fd = ["国", "中", "永"];
14681
14683
  function bi(t, e) {
14682
14684
  const n = t.charToGlyphIndex(e);
14683
14685
  return n != null && n > 0;
14684
14686
  }
14685
- function Fd(t) {
14687
+ function Td(t) {
14686
14688
  var a;
14687
14689
  const e = t.unitsPerEm || 1e3;
14688
14690
  if (!bi(t, "A"))
@@ -14692,7 +14694,7 @@ function Fd(t) {
14692
14694
  return 1;
14693
14695
  const s = e / r;
14694
14696
  let i = 0;
14695
- for (const o of Td)
14697
+ for (const o of Fd)
14696
14698
  if (bi(t, o)) {
14697
14699
  i = ((a = t.charToGlyph(o)) == null ? void 0 : a.advanceWidth) ?? 0;
14698
14700
  break;
@@ -14802,40 +14804,40 @@ function Ed(t, e = 1e-4) {
14802
14804
  let a = 0;
14803
14805
  const o = Object.keys(t.attributes), c = {}, l = {}, u = [], f = ["getX", "getY", "getZ", "getW"], h = ["setX", "setY", "setZ", "setW"];
14804
14806
  for (let w = 0, C = o.length; w < C; w++) {
14805
- const T = o[w], E = t.attributes[T];
14806
- c[T] = new E.constructor(
14807
+ const F = o[w], E = t.attributes[F];
14808
+ c[F] = new E.constructor(
14807
14809
  new E.array.constructor(E.count * E.itemSize),
14808
14810
  E.itemSize,
14809
14811
  E.normalized
14810
14812
  );
14811
- const R = t.morphAttributes[T];
14812
- R && (l[T] || (l[T] = []), R.forEach((P, W) => {
14813
+ const R = t.morphAttributes[F];
14814
+ R && (l[F] || (l[F] = []), R.forEach((P, W) => {
14813
14815
  const j = new P.array.constructor(P.count * P.itemSize);
14814
- l[T][W] = new P.constructor(j, P.itemSize, P.normalized);
14816
+ l[F][W] = new P.constructor(j, P.itemSize, P.normalized);
14815
14817
  }));
14816
14818
  }
14817
14819
  const p = e * 0.5, y = Math.log10(1 / e), m = Math.pow(10, y), b = p * m;
14818
14820
  for (let w = 0; w < i; w++) {
14819
14821
  const C = r ? r.getX(w) : w;
14820
- let T = "";
14822
+ let F = "";
14821
14823
  for (let E = 0, R = o.length; E < R; E++) {
14822
14824
  const P = o[E], W = t.getAttribute(P), j = W.itemSize;
14823
14825
  for (let N = 0; N < j; N++)
14824
- T += `${~~(W[f[N]](C) * m + b)},`;
14826
+ F += `${~~(W[f[N]](C) * m + b)},`;
14825
14827
  }
14826
- if (T in n)
14827
- u.push(n[T]);
14828
+ if (F in n)
14829
+ u.push(n[F]);
14828
14830
  else {
14829
14831
  for (let E = 0, R = o.length; E < R; E++) {
14830
14832
  const P = o[E], W = t.getAttribute(P), j = t.morphAttributes[P], N = W.itemSize, X = c[P], ie = l[P];
14831
14833
  for (let U = 0; U < N; U++) {
14832
14834
  const M = f[U], _ = h[U];
14833
14835
  if (X[_](a, W[M](C)), j)
14834
- for (let re = 0, Te = j.length; re < Te; re++)
14836
+ for (let re = 0, Fe = j.length; re < Fe; re++)
14835
14837
  ie[re][_](a, j[re][M](C));
14836
14838
  }
14837
14839
  }
14838
- n[T] = a, u.push(a), a++;
14840
+ n[F] = a, u.push(a), a++;
14839
14841
  }
14840
14842
  }
14841
14843
  const v = t.clone();
@@ -14846,9 +14848,9 @@ function Ed(t, e = 1e-4) {
14846
14848
  C.itemSize,
14847
14849
  C.normalized
14848
14850
  )), w in l)
14849
- for (let T = 0; T < l[w].length; T++) {
14850
- const E = l[w][T];
14851
- v.morphAttributes[w][T] = new E.constructor(
14851
+ for (let F = 0; F < l[w].length; F++) {
14852
+ const E = l[w][F];
14853
+ v.morphAttributes[w][F] = new E.constructor(
14852
14854
  E.array.slice(0, a * E.itemSize),
14853
14855
  E.itemSize,
14854
14856
  E.normalized
@@ -15187,7 +15189,7 @@ class zd extends ia {
15187
15189
  * @returns An object containing the opentype font and parsed metadata
15188
15190
  */
15189
15191
  parseMeshFont(e) {
15190
- const n = Sd(e), r = Math.round, s = Fd(n), i = {
15192
+ const n = Sd(e), r = Math.round, s = Td(n), i = {
15191
15193
  glyphs: {},
15192
15194
  // Lazy loaded later
15193
15195
  familyName: n.getEnglishName("fullName"),
@@ -15390,11 +15392,11 @@ var wo = { exports: {} }, rs = {}, jn = {};
15390
15392
  jn.byteLength = $d;
15391
15393
  jn.toByteArray = Xd;
15392
15394
  jn.fromByteArray = Jd;
15393
- var Ke = [], Ue = [], qd = typeof Uint8Array < "u" ? Uint8Array : Array, cr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
15395
+ var Ke = [], Pe = [], qd = typeof Uint8Array < "u" ? Uint8Array : Array, cr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
15394
15396
  for (var Rt = 0, jd = cr.length; Rt < jd; ++Rt)
15395
- Ke[Rt] = cr[Rt], Ue[cr.charCodeAt(Rt)] = Rt;
15396
- Ue[45] = 62;
15397
- Ue[95] = 63;
15397
+ Ke[Rt] = cr[Rt], Pe[cr.charCodeAt(Rt)] = Rt;
15398
+ Pe[45] = 62;
15399
+ Pe[95] = 63;
15398
15400
  function Co(t) {
15399
15401
  var e = t.length;
15400
15402
  if (e % 4 > 0)
@@ -15414,8 +15416,8 @@ function Yd(t, e, n) {
15414
15416
  function Xd(t) {
15415
15417
  var e, n = Co(t), r = n[0], s = n[1], i = new qd(Yd(t, r, s)), a = 0, o = s > 0 ? r - 4 : r, c;
15416
15418
  for (c = 0; c < o; c += 4)
15417
- e = Ue[t.charCodeAt(c)] << 18 | Ue[t.charCodeAt(c + 1)] << 12 | Ue[t.charCodeAt(c + 2)] << 6 | Ue[t.charCodeAt(c + 3)], i[a++] = e >> 16 & 255, i[a++] = e >> 8 & 255, i[a++] = e & 255;
15418
- return s === 2 && (e = Ue[t.charCodeAt(c)] << 2 | Ue[t.charCodeAt(c + 1)] >> 4, i[a++] = e & 255), s === 1 && (e = Ue[t.charCodeAt(c)] << 10 | Ue[t.charCodeAt(c + 1)] << 4 | Ue[t.charCodeAt(c + 2)] >> 2, i[a++] = e >> 8 & 255, i[a++] = e & 255), i;
15419
+ e = Pe[t.charCodeAt(c)] << 18 | Pe[t.charCodeAt(c + 1)] << 12 | Pe[t.charCodeAt(c + 2)] << 6 | Pe[t.charCodeAt(c + 3)], i[a++] = e >> 16 & 255, i[a++] = e >> 8 & 255, i[a++] = e & 255;
15420
+ return s === 2 && (e = Pe[t.charCodeAt(c)] << 2 | Pe[t.charCodeAt(c + 1)] >> 4, i[a++] = e & 255), s === 1 && (e = Pe[t.charCodeAt(c)] << 10 | Pe[t.charCodeAt(c + 1)] << 4 | Pe[t.charCodeAt(c + 2)] >> 2, i[a++] = e >> 8 & 255, i[a++] = e & 255), i;
15419
15421
  }
15420
15422
  function Kd(t) {
15421
15423
  return Ke[t >> 18 & 63] + Ke[t >> 12 & 63] + Ke[t >> 6 & 63] + Ke[t & 63];
@@ -15702,7 +15704,7 @@ ss.write = function(t, e, n, r, s, i) {
15702
15704
  }
15703
15705
  }
15704
15706
  o.byteLength = C;
15705
- function T(x, d, g) {
15707
+ function F(x, d, g) {
15706
15708
  var S = !1;
15707
15709
  if ((d === void 0 || d < 0) && (d = 0), d > this.length || ((g === void 0 || g > this.length) && (g = this.length), g <= 0) || (g >>>= 0, d >>>= 0, g <= d))
15708
15710
  return "";
@@ -15714,7 +15716,7 @@ ss.write = function(t, e, n, r, s, i) {
15714
15716
  case "utf-8":
15715
15717
  return M(this, d, g);
15716
15718
  case "ascii":
15717
- return Te(this, d, g);
15719
+ return Fe(this, d, g);
15718
15720
  case "latin1":
15719
15721
  case "binary":
15720
15722
  return et(this, d, g);
@@ -15758,7 +15760,7 @@ ss.write = function(t, e, n, r, s, i) {
15758
15760
  return this;
15759
15761
  }, o.prototype.toString = function() {
15760
15762
  var d = this.length;
15761
- return d === 0 ? "" : arguments.length === 0 ? M(this, 0, d) : T.apply(this, arguments);
15763
+ return d === 0 ? "" : arguments.length === 0 ? M(this, 0, d) : F.apply(this, arguments);
15762
15764
  }, o.prototype.toLocaleString = o.prototype.toString, o.prototype.equals = function(d) {
15763
15765
  if (!o.isBuffer(d)) throw new TypeError("Argument must be a Buffer");
15764
15766
  return this === d ? !0 : o.compare(this, d) === 0;
@@ -15943,7 +15945,7 @@ ss.write = function(t, e, n, r, s, i) {
15943
15945
  );
15944
15946
  return g;
15945
15947
  }
15946
- function Te(x, d, g) {
15948
+ function Fe(x, d, g) {
15947
15949
  var S = "";
15948
15950
  g = Math.min(x.length, g);
15949
15951
  for (var k = d; k < g; ++k)
@@ -16244,13 +16246,13 @@ ss.write = function(t, e, n, r, s, i) {
16244
16246
  return d;
16245
16247
  }();
16246
16248
  })(rs);
16247
- var Cn = rs, Dt = Cn.Buffer, Pe = {}, Ne;
16248
- for (Ne in Cn)
16249
- Cn.hasOwnProperty(Ne) && (Ne === "SlowBuffer" || Ne === "Buffer" || (Pe[Ne] = Cn[Ne]));
16250
- var _t = Pe.Buffer = {};
16251
- for (Ne in Dt)
16252
- Dt.hasOwnProperty(Ne) && (Ne === "allocUnsafe" || Ne === "allocUnsafeSlow" || (_t[Ne] = Dt[Ne]));
16253
- Pe.Buffer.prototype = Dt.prototype;
16249
+ var Cn = rs, Dt = Cn.Buffer, Ne = {}, Ge;
16250
+ for (Ge in Cn)
16251
+ Cn.hasOwnProperty(Ge) && (Ge === "SlowBuffer" || Ge === "Buffer" || (Ne[Ge] = Cn[Ge]));
16252
+ var _t = Ne.Buffer = {};
16253
+ for (Ge in Dt)
16254
+ Dt.hasOwnProperty(Ge) && (Ge === "allocUnsafe" || Ge === "allocUnsafeSlow" || (_t[Ge] = Dt[Ge]));
16255
+ Ne.Buffer.prototype = Dt.prototype;
16254
16256
  (!_t.from || _t.from === Uint8Array.from) && (_t.from = function(t, e, n) {
16255
16257
  if (typeof t == "number")
16256
16258
  throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof t);
@@ -16266,21 +16268,21 @@ _t.alloc || (_t.alloc = function(t, e, n) {
16266
16268
  var r = Dt(t);
16267
16269
  return !e || e.length === 0 ? r.fill(0) : typeof n == "string" ? r.fill(e, n) : r.fill(e), r;
16268
16270
  });
16269
- if (!Pe.kStringMaxLength)
16271
+ if (!Ne.kStringMaxLength)
16270
16272
  try {
16271
- Pe.kStringMaxLength = process.binding("buffer").kStringMaxLength;
16273
+ Ne.kStringMaxLength = process.binding("buffer").kStringMaxLength;
16272
16274
  } catch {
16273
16275
  }
16274
- Pe.constants || (Pe.constants = {
16275
- MAX_LENGTH: Pe.kMaxLength
16276
- }, Pe.kStringMaxLength && (Pe.constants.MAX_STRING_LENGTH = Pe.kStringMaxLength));
16277
- var xt = Pe, is = {}, To = "\uFEFF";
16276
+ Ne.constants || (Ne.constants = {
16277
+ MAX_LENGTH: Ne.kMaxLength
16278
+ }, Ne.kStringMaxLength && (Ne.constants.MAX_STRING_LENGTH = Ne.kStringMaxLength));
16279
+ var xt = Ne, is = {}, Fo = "\uFEFF";
16278
16280
  is.PrependBOM = as;
16279
16281
  function as(t, e) {
16280
16282
  this.encoder = t, this.addBOM = !0;
16281
16283
  }
16282
16284
  as.prototype.write = function(t) {
16283
- return this.addBOM && (t = To + t, this.addBOM = !1), this.encoder.write(t);
16285
+ return this.addBOM && (t = Fo + t, this.addBOM = !1), this.encoder.write(t);
16284
16286
  };
16285
16287
  as.prototype.end = function() {
16286
16288
  return this.encoder.end();
@@ -16291,7 +16293,7 @@ function os(t, e) {
16291
16293
  }
16292
16294
  os.prototype.write = function(t) {
16293
16295
  var e = this.decoder.write(t);
16294
- return this.pass || !e || (e[0] === To && (e = e.slice(1), typeof this.options.stripBOM == "function" && this.options.stripBOM()), this.pass = !0), e;
16296
+ return this.pass || !e || (e[0] === Fo && (e = e.slice(1), typeof this.options.stripBOM == "function" && this.options.stripBOM()), this.pass = !0), e;
16295
16297
  };
16296
16298
  os.prototype.end = function() {
16297
16299
  return this.decoder.end();
@@ -16301,7 +16303,7 @@ function e0(t, e) {
16301
16303
  for (var n in e)
16302
16304
  Qd(e, n) && (t[n] = e[n]);
16303
16305
  }
16304
- var Fo = e0, lr = {}, ur = {}, mn = { exports: {} };
16306
+ var To = e0, lr = {}, ur = {}, mn = { exports: {} };
16305
16307
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
16306
16308
  var wi;
16307
16309
  function t0() {
@@ -16424,10 +16426,10 @@ function n0() {
16424
16426
  return v <= 127 ? 0 : v >> 5 === 6 ? 2 : v >> 4 === 14 ? 3 : v >> 3 === 30 ? 4 : v >> 6 === 2 ? -1 : -2;
16425
16427
  }
16426
16428
  function a(v, w, C) {
16427
- var T = w.length - 1;
16428
- if (T < C) return 0;
16429
- var E = i(w[T]);
16430
- return E >= 0 ? (E > 0 && (v.lastNeed = E - 1), E) : --T < C || E === -2 ? 0 : (E = i(w[T]), E >= 0 ? (E > 0 && (v.lastNeed = E - 2), E) : --T < C || E === -2 ? 0 : (E = i(w[T]), E >= 0 ? (E > 0 && (E === 2 ? E = 0 : v.lastNeed = E - 3), E) : 0));
16429
+ var F = w.length - 1;
16430
+ if (F < C) return 0;
16431
+ var E = i(w[F]);
16432
+ return E >= 0 ? (E > 0 && (v.lastNeed = E - 1), E) : --F < C || E === -2 ? 0 : (E = i(w[F]), E >= 0 ? (E > 0 && (v.lastNeed = E - 2), E) : --F < C || E === -2 ? 0 : (E = i(w[F]), E >= 0 ? (E > 0 && (E === 2 ? E = 0 : v.lastNeed = E - 3), E) : 0));
16431
16433
  }
16432
16434
  function o(v, w, C) {
16433
16435
  if ((w[0] & 192) !== 128)
@@ -16450,8 +16452,8 @@ function n0() {
16450
16452
  var C = a(this, v, w);
16451
16453
  if (!this.lastNeed) return v.toString("utf8", w);
16452
16454
  this.lastTotal = C;
16453
- var T = v.length - (C - this.lastNeed);
16454
- return v.copy(this.lastChar, 0, T), v.toString("utf8", w, T);
16455
+ var F = v.length - (C - this.lastNeed);
16456
+ return v.copy(this.lastChar, 0, F), v.toString("utf8", w, F);
16455
16457
  }
16456
16458
  function u(v) {
16457
16459
  var w = v && v.length ? this.write(v) : "";
@@ -16461,8 +16463,8 @@ function n0() {
16461
16463
  if ((v.length - w) % 2 === 0) {
16462
16464
  var C = v.toString("utf16le", w);
16463
16465
  if (C) {
16464
- var T = C.charCodeAt(C.length - 1);
16465
- if (T >= 55296 && T <= 56319)
16466
+ var F = C.charCodeAt(C.length - 1);
16467
+ if (F >= 55296 && F <= 56319)
16466
16468
  return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = v[v.length - 2], this.lastChar[1] = v[v.length - 1], C.slice(0, -1);
16467
16469
  }
16468
16470
  return C;
@@ -16493,10 +16495,10 @@ function n0() {
16493
16495
  }
16494
16496
  return ur;
16495
16497
  }
16496
- var hr, Ti;
16498
+ var hr, Fi;
16497
16499
  function r0() {
16498
- if (Ti) return hr;
16499
- Ti = 1;
16500
+ if (Fi) return hr;
16501
+ Fi = 1;
16500
16502
  var t = xt.Buffer;
16501
16503
  hr = {
16502
16504
  // Encodings
@@ -16580,10 +16582,10 @@ function r0() {
16580
16582
  }
16581
16583
  }, hr;
16582
16584
  }
16583
- var nt = {}, Fi;
16585
+ var nt = {}, Ti;
16584
16586
  function s0() {
16585
- if (Fi) return nt;
16586
- Fi = 1;
16587
+ if (Ti) return nt;
16588
+ Ti = 1;
16587
16589
  var t = xt.Buffer;
16588
16590
  nt._utf32 = e;
16589
16591
  function e(l, u) {
@@ -16812,17 +16814,17 @@ function a0() {
16812
16814
  a[o] = i.test(String.fromCharCode(o));
16813
16815
  var c = 43, l = 45, u = 38;
16814
16816
  s.prototype.write = function(m) {
16815
- for (var b = "", v = 0, w = this.inBase64, C = this.base64Accum, T = 0; T < m.length; T++)
16817
+ for (var b = "", v = 0, w = this.inBase64, C = this.base64Accum, F = 0; F < m.length; F++)
16816
16818
  if (!w)
16817
- m[T] == c && (b += this.iconv.decode(m.slice(v, T), "ascii"), v = T + 1, w = !0);
16818
- else if (!a[m[T]]) {
16819
- if (T == v && m[T] == l)
16819
+ m[F] == c && (b += this.iconv.decode(m.slice(v, F), "ascii"), v = F + 1, w = !0);
16820
+ else if (!a[m[F]]) {
16821
+ if (F == v && m[F] == l)
16820
16822
  b += "+";
16821
16823
  else {
16822
- var E = C + this.iconv.decode(m.slice(v, T), "ascii");
16824
+ var E = C + this.iconv.decode(m.slice(v, F), "ascii");
16823
16825
  b += this.iconv.decode(t.from(E, "base64"), "utf16-be");
16824
16826
  }
16825
- m[T] != l && T--, v = T + 1, w = !1, C = "";
16827
+ m[F] != l && F--, v = F + 1, w = !1, C = "";
16826
16828
  }
16827
16829
  if (!w)
16828
16830
  b += this.iconv.decode(m.slice(v), "ascii");
@@ -16843,11 +16845,11 @@ function a0() {
16843
16845
  this.iconv = b.iconv, this.inBase64 = !1, this.base64Accum = t.alloc(6), this.base64AccumIdx = 0;
16844
16846
  }
16845
16847
  h.prototype.write = function(m) {
16846
- for (var b = this.inBase64, v = this.base64Accum, w = this.base64AccumIdx, C = t.alloc(m.length * 5 + 10), T = 0, E = 0; E < m.length; E++) {
16848
+ for (var b = this.inBase64, v = this.base64Accum, w = this.base64AccumIdx, C = t.alloc(m.length * 5 + 10), F = 0, E = 0; E < m.length; E++) {
16847
16849
  var R = m.charCodeAt(E);
16848
- R >= 32 && R <= 126 ? (b && (w > 0 && (T += C.write(v.slice(0, w).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), T), w = 0), C[T++] = l, b = !1), b || (C[T++] = R, R === u && (C[T++] = l))) : (b || (C[T++] = u, b = !0), b && (v[w++] = R >> 8, v[w++] = R & 255, w == v.length && (T += C.write(v.toString("base64").replace(/\//g, ","), T), w = 0)));
16850
+ R >= 32 && R <= 126 ? (b && (w > 0 && (F += C.write(v.slice(0, w).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), F), w = 0), C[F++] = l, b = !1), b || (C[F++] = R, R === u && (C[F++] = l))) : (b || (C[F++] = u, b = !0), b && (v[w++] = R >> 8, v[w++] = R & 255, w == v.length && (F += C.write(v.toString("base64").replace(/\//g, ","), F), w = 0)));
16849
16851
  }
16850
- return this.inBase64 = b, this.base64AccumIdx = w, C.slice(0, T);
16852
+ return this.inBase64 = b, this.base64AccumIdx = w, C.slice(0, F);
16851
16853
  }, h.prototype.end = function() {
16852
16854
  var m = t.alloc(10), b = 0;
16853
16855
  return this.inBase64 && (this.base64AccumIdx > 0 && (b += m.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), b), this.base64AccumIdx = 0), m[b++] = l, this.inBase64 = !1), m.slice(0, b);
@@ -16857,17 +16859,17 @@ function a0() {
16857
16859
  }
16858
16860
  var y = a.slice();
16859
16861
  return y[44] = !0, p.prototype.write = function(m) {
16860
- for (var b = "", v = 0, w = this.inBase64, C = this.base64Accum, T = 0; T < m.length; T++)
16862
+ for (var b = "", v = 0, w = this.inBase64, C = this.base64Accum, F = 0; F < m.length; F++)
16861
16863
  if (!w)
16862
- m[T] == u && (b += this.iconv.decode(m.slice(v, T), "ascii"), v = T + 1, w = !0);
16863
- else if (!y[m[T]]) {
16864
- if (T == v && m[T] == l)
16864
+ m[F] == u && (b += this.iconv.decode(m.slice(v, F), "ascii"), v = F + 1, w = !0);
16865
+ else if (!y[m[F]]) {
16866
+ if (F == v && m[F] == l)
16865
16867
  b += "&";
16866
16868
  else {
16867
- var E = C + this.iconv.decode(m.slice(v, T), "ascii").replace(/,/g, "/");
16869
+ var E = C + this.iconv.decode(m.slice(v, F), "ascii").replace(/,/g, "/");
16868
16870
  b += this.iconv.decode(t.from(E, "base64"), "utf16-be");
16869
16871
  }
16870
- m[T] != l && T--, v = T + 1, w = !1, C = "";
16872
+ m[F] != l && F--, v = F + 1, w = !1, C = "";
16871
16873
  }
16872
16874
  if (!w)
16873
16875
  b += this.iconv.decode(m.slice(v), "ascii");
@@ -17551,12 +17553,12 @@ function u0() {
17551
17553
  var v = this.decodeTables.length;
17552
17554
  this.decodeTables.push(i.slice(0));
17553
17555
  for (var w = this.decodeTables[0], m = 129; m <= 254; m++)
17554
- for (var C = this.decodeTables[s - w[m]], T = 48; T <= 57; T++) {
17555
- if (C[T] === e)
17556
- C[T] = s - b;
17557
- else if (C[T] > s)
17556
+ for (var C = this.decodeTables[s - w[m]], F = 48; F <= 57; F++) {
17557
+ if (C[F] === e)
17558
+ C[F] = s - b;
17559
+ else if (C[F] > s)
17558
17560
  throw new Error("gb18030 decode tables conflict at byte 2");
17559
- for (var E = this.decodeTables[s - C[T]], R = 129; R <= 254; R++) {
17561
+ for (var E = this.decodeTables[s - C[F]], R = 129; R <= 254; R++) {
17560
17562
  if (E[R] === e)
17561
17563
  E[R] = s - v;
17562
17564
  else {
@@ -17578,8 +17580,8 @@ function u0() {
17578
17580
  if (typeof N == "number")
17579
17581
  j[N] = !0;
17580
17582
  else
17581
- for (var T = N.from; T <= N.to; T++)
17582
- j[T] = !0;
17583
+ for (var F = N.from; F <= N.to; F++)
17584
+ j[F] = !0;
17583
17585
  }
17584
17586
  if (this._fillEncodeTable(0, 0, j), h.encodeAdd)
17585
17587
  for (var X in h.encodeAdd)
@@ -17615,7 +17617,7 @@ function u0() {
17615
17617
  else
17616
17618
  throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + h[0]);
17617
17619
  } else if (w > 4080 && w <= 4095) {
17618
- for (var T = 4095 - w + 2, E = [], R = 0; R < T; R++)
17620
+ for (var F = 4095 - w + 2, E = [], R = 0; R < F; R++)
17619
17621
  E.push(b.charCodeAt(v++));
17620
17622
  y[p++] = r - this.decodeTableSeq.length, this.decodeTableSeq.push(E);
17621
17623
  } else
@@ -17645,17 +17647,17 @@ function u0() {
17645
17647
  y = h[h.length - 1], v[y] = p;
17646
17648
  }, c.prototype._fillEncodeTable = function(h, p, y) {
17647
17649
  for (var m = this.decodeTables[h], b = !1, v = {}, w = 0; w < 256; w++) {
17648
- var C = m[w], T = p + w;
17649
- if (!y[T])
17650
+ var C = m[w], F = p + w;
17651
+ if (!y[F])
17650
17652
  if (C >= 0)
17651
- this._setEncodeChar(C, T), b = !0;
17653
+ this._setEncodeChar(C, F), b = !0;
17652
17654
  else if (C <= s) {
17653
17655
  var E = s - C;
17654
17656
  if (!v[E]) {
17655
- var R = T << 8 >>> 0;
17657
+ var R = F << 8 >>> 0;
17656
17658
  this._fillEncodeTable(E, R, y) ? b = !0 : v[E] = !0;
17657
17659
  }
17658
- } else C <= r && (this._setEncodeSequence(this.decodeTableSeq[r - C], T), b = !0);
17660
+ } else C <= r && (this._setEncodeSequence(this.decodeTableSeq[r - C], F), b = !0);
17659
17661
  }
17660
17662
  return b;
17661
17663
  };
@@ -17681,30 +17683,30 @@ function u0() {
17681
17683
  else
17682
17684
  y !== -1 ? (C = 65536 + (y - 55296) * 1024 + (C - 56320), y = -1) : C = e;
17683
17685
  else y !== -1 && (b = C, C = e, y = -1);
17684
- var T = e;
17686
+ var F = e;
17685
17687
  if (m !== void 0 && C != e) {
17686
17688
  var E = m[C];
17687
17689
  if (typeof E == "object") {
17688
17690
  m = E;
17689
17691
  continue;
17690
- } else typeof E == "number" ? T = E : E == null && (E = m[a], E !== void 0 && (T = E, b = C));
17692
+ } else typeof E == "number" ? F = E : E == null && (E = m[a], E !== void 0 && (F = E, b = C));
17691
17693
  m = void 0;
17692
17694
  } else if (C >= 0) {
17693
17695
  var R = this.encodeTable[C >> 8];
17694
- if (R !== void 0 && (T = R[C & 255]), T <= r) {
17695
- m = this.encodeTableSeq[r - T];
17696
+ if (R !== void 0 && (F = R[C & 255]), F <= r) {
17697
+ m = this.encodeTableSeq[r - F];
17696
17698
  continue;
17697
17699
  }
17698
- if (T == e && this.gb18030) {
17700
+ if (F == e && this.gb18030) {
17699
17701
  var P = f(this.gb18030.uChars, C);
17700
17702
  if (P != -1) {
17701
- var T = this.gb18030.gbChars[P] + (C - this.gb18030.uChars[P]);
17702
- p[w++] = 129 + Math.floor(T / 12600), T = T % 12600, p[w++] = 48 + Math.floor(T / 1260), T = T % 1260, p[w++] = 129 + Math.floor(T / 10), T = T % 10, p[w++] = 48 + T;
17703
+ var F = this.gb18030.gbChars[P] + (C - this.gb18030.uChars[P]);
17704
+ p[w++] = 129 + Math.floor(F / 12600), F = F % 12600, p[w++] = 48 + Math.floor(F / 1260), F = F % 1260, p[w++] = 129 + Math.floor(F / 10), F = F % 10, p[w++] = 48 + F;
17703
17705
  continue;
17704
17706
  }
17705
17707
  }
17706
17708
  }
17707
- T === e && (T = this.defaultCharSingleByte), T < 256 ? p[w++] = T : T < 65536 ? (p[w++] = T >> 8, p[w++] = T & 255) : T < 16777216 ? (p[w++] = T >> 16, p[w++] = T >> 8 & 255, p[w++] = T & 255) : (p[w++] = T >>> 24, p[w++] = T >>> 16 & 255, p[w++] = T >>> 8 & 255, p[w++] = T & 255);
17709
+ F === e && (F = this.defaultCharSingleByte), F < 256 ? p[w++] = F : F < 65536 ? (p[w++] = F >> 8, p[w++] = F & 255) : F < 16777216 ? (p[w++] = F >> 16, p[w++] = F >> 8 & 255, p[w++] = F & 255) : (p[w++] = F >>> 24, p[w++] = F >>> 16 & 255, p[w++] = F >>> 8 & 255, p[w++] = F & 255);
17708
17710
  }
17709
17711
  return this.seqObj = m, this.leadSurrogate = y, p.slice(0, w);
17710
17712
  }, l.prototype.end = function() {
@@ -17721,7 +17723,7 @@ function u0() {
17721
17723
  this.nodeIdx = 0, this.prevBytes = [], this.decodeTables = p.decodeTables, this.decodeTableSeq = p.decodeTableSeq, this.defaultCharUnicode = p.defaultCharUnicode, this.gb18030 = p.gb18030;
17722
17724
  }
17723
17725
  u.prototype.write = function(h) {
17724
- for (var p = t.alloc(h.length * 2), y = this.nodeIdx, m = this.prevBytes, b = this.prevBytes.length, v = -this.prevBytes.length, w, C = 0, T = 0; C < h.length; C++) {
17726
+ for (var p = t.alloc(h.length * 2), y = this.nodeIdx, m = this.prevBytes, b = this.prevBytes.length, v = -this.prevBytes.length, w, C = 0, F = 0; C < h.length; C++) {
17725
17727
  var E = C >= 0 ? h[C] : m[C + b], w = this.decodeTables[y][E];
17726
17728
  if (!(w >= 0)) if (w === e)
17727
17729
  w = this.defaultCharUnicode.charCodeAt(0), C = v;
@@ -17737,18 +17739,18 @@ function u0() {
17737
17739
  continue;
17738
17740
  } else if (w <= r) {
17739
17741
  for (var W = this.decodeTableSeq[r - w], j = 0; j < W.length - 1; j++)
17740
- w = W[j], p[T++] = w & 255, p[T++] = w >> 8;
17742
+ w = W[j], p[F++] = w & 255, p[F++] = w >> 8;
17741
17743
  w = W[W.length - 1];
17742
17744
  } else
17743
17745
  throw new Error("iconv-lite internal error: invalid decoding table value " + w + " at " + y + "/" + E);
17744
17746
  if (w >= 65536) {
17745
17747
  w -= 65536;
17746
17748
  var N = 55296 | w >> 10;
17747
- p[T++] = N & 255, p[T++] = N >> 8, w = 56320 | w & 1023;
17749
+ p[F++] = N & 255, p[F++] = N >> 8, w = 56320 | w & 1023;
17748
17750
  }
17749
- p[T++] = w & 255, p[T++] = w >> 8, y = 0, v = C + 1;
17751
+ p[F++] = w & 255, p[F++] = w >> 8, y = 0, v = C + 1;
17750
17752
  }
17751
- return this.nodeIdx = y, this.prevBytes = v >= 0 ? Array.prototype.slice.call(h, v) : m.slice(v + b).concat(Array.prototype.slice.call(h)), p.slice(0, T).toString("ucs2");
17753
+ return this.nodeIdx = y, this.prevBytes = v >= 0 ? Array.prototype.slice.call(h, v) : m.slice(v + b).concat(Array.prototype.slice.call(h)), p.slice(0, F).toString("ucs2");
17752
17754
  }, u.prototype.end = function() {
17753
17755
  for (var h = ""; this.prevBytes.length > 0; ) {
17754
17756
  h += this.defaultCharUnicode;
@@ -26283,7 +26285,7 @@ function b0() {
26283
26285
  var Di;
26284
26286
  function x0() {
26285
26287
  return Di || (Di = 1, function(t) {
26286
- for (var e = Fo, n = [
26288
+ for (var e = To, n = [
26287
26289
  r0(),
26288
26290
  s0(),
26289
26291
  i0(),
@@ -26374,7 +26376,7 @@ const S0 = {}, w0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
26374
26376
  default: S0
26375
26377
  }, Symbol.toStringTag, { value: "Module" })), C0 = /* @__PURE__ */ Vd(w0);
26376
26378
  (function(t) {
26377
- var e = xt.Buffer, n = is, r = Fo, s = t.exports;
26379
+ var e = xt.Buffer, n = is, r = To, s = t.exports;
26378
26380
  s.encodings = null, s.defaultCharUnicode = "�", s.defaultCharSingleByte = "?", s.encode = function(o, c, l) {
26379
26381
  o = "" + (o || "");
26380
26382
  var u = s.getEncoder(c, l), f = u.write(o), h = u.end();
@@ -26441,8 +26443,8 @@ const S0 = {}, w0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
26441
26443
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
26442
26444
  };
26443
26445
  })(wo);
26444
- var T0 = wo.exports;
26445
- const Ui = /* @__PURE__ */ Wd(T0);
26446
+ var F0 = wo.exports;
26447
+ const Ui = /* @__PURE__ */ Wd(F0);
26446
26448
  class cs extends aa {
26447
26449
  /**
26448
26450
  * Creates a new SHX text shape wrapper.
@@ -26647,7 +26649,7 @@ const ft = class ft extends ia {
26647
26649
  maxEntries: this.layoutShapeCache.capacity,
26648
26650
  estimatedBytes: n
26649
26651
  }, s = Math.round(
26650
- this.sourceByteLength * Tc
26652
+ this.sourceByteLength * Fc
26651
26653
  ), i = s + e.estimatedBytes + r.estimatedBytes;
26652
26654
  return {
26653
26655
  names: Array.from(this.names),
@@ -26745,7 +26747,7 @@ class $ {
26745
26747
  fontNotFound: new gs(),
26746
26748
  /** Event triggered when a font is successfully loaded */
26747
26749
  fontLoaded: new gs()
26748
- }, this.fontRequestInFlight = /* @__PURE__ */ new Map(), this.fontRequestFailed = /* @__PURE__ */ new Set(), this.loadEpoch = 0, this.loader = new I.FileLoader(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new F0();
26750
+ }, this.fontRequestInFlight = /* @__PURE__ */ new Map(), this.fontRequestFailed = /* @__PURE__ */ new Set(), this.loadEpoch = 0, this.loader = new I.FileLoader(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new T0();
26749
26751
  }
26750
26752
  /**
26751
26753
  * Gets the singleton instance of the FontManager
@@ -26829,7 +26831,7 @@ class $ {
26829
26831
  const i = lt(s.file).toLowerCase();
26830
26832
  n.set(i, { ...s, source: "remote" });
26831
26833
  }
26832
- const r = await ze.instance.getAll();
26834
+ const r = await Ue.instance.getAll();
26833
26835
  for (const s of r) {
26834
26836
  const i = s.name.toLowerCase();
26835
26837
  n.has(i) || n.set(i, this.cachedFontDataToFontInfo(s));
@@ -26888,7 +26890,7 @@ class $ {
26888
26890
  const r = this.fontRequestInFlight.get(n);
26889
26891
  if (r)
26890
26892
  return r;
26891
- const s = this.loadEpoch, i = this.loadFontsByNames(n).then((a) => (s !== this.loadEpoch || (this.isFontLoaded(n) ? this.fontRequestFailed.delete(n) : this.fontRequestFailed.add(n)), a)).catch(() => (s === this.loadEpoch && this.fontRequestFailed.add(n), [
26893
+ const s = this.loadEpoch, i = this.loadFontsByNames(n).then((a) => (s !== this.loadEpoch || (this.isFontLoaded(n) ? this.fontRequestFailed.delete(n) : a.some((c) => c.status === "FailedToLoad") && this.fontRequestFailed.add(n)), a)).catch(() => (s === this.loadEpoch && this.fontRequestFailed.add(n), [
26892
26894
  {
26893
26895
  fontName: n,
26894
26896
  url: "",
@@ -26914,7 +26916,7 @@ class $ {
26914
26916
  return "";
26915
26917
  let n = String(e);
26916
26918
  const r = n.lastIndexOf(".");
26917
- return (r > 0 && r == n.length - 4 || r == n.length - 5) && (n = n.substring(0, r)), n.toLowerCase();
26919
+ return r > 0 && (r === n.length - 4 || r === n.length - 5) && (n = n.substring(0, r)), n.toLowerCase();
26918
26920
  }
26919
26921
  /**
26920
26922
  * Parses a user-uploaded font file, registers it for rendering, and stores
@@ -26965,7 +26967,7 @@ class $ {
26965
26967
  };
26966
26968
  try {
26967
26969
  const f = Ze.instance.createFont(u);
26968
- return l.forEach((h) => f.names.add(h)), this.registerFontInMap(o, f), this.enableFontCache && await ze.instance.set(o, u), this.events.fontLoaded.dispatch({ fontName: o }), {
26970
+ return l.forEach((h) => f.names.add(h)), this.registerFontInMap(o, f), this.enableFontCache && await Ue.instance.set(o, u), this.events.fontLoaded.dispatch({ fontName: o }), {
26969
26971
  fontName: o,
26970
26972
  url: "",
26971
26973
  status: "Success"
@@ -26992,7 +26994,7 @@ class $ {
26992
26994
  const n = lt(e).toLowerCase();
26993
26995
  if (this.isFontLoaded(n))
26994
26996
  return !0;
26995
- const r = await ze.instance.find(e);
26997
+ const r = await Ue.instance.find(e);
26996
26998
  if (!r)
26997
26999
  return !1;
26998
27000
  try {
@@ -27017,12 +27019,12 @@ class $ {
27017
27019
  s.forEach((i, a) => {
27018
27020
  const o = e[a].url, c = lt(
27019
27021
  e[a].file || o
27020
- ).toLowerCase(), l = i.status === "fulfilled" && this.isFontLoaded(c);
27022
+ ).toLowerCase(), l = e[a].name ?? [], u = i.status === "fulfilled" && (this.isFontLoaded(c) || l.some((f) => this.isFontLoaded(f)));
27021
27023
  r.push({
27022
27024
  fontName: c,
27023
27025
  url: o,
27024
- status: l ? "Success" : "FailedToLoad"
27025
- }), l && this.fileNames.push(c);
27026
+ status: u ? "Success" : "FailedToLoad"
27027
+ }), u && this.fileNames.push(c);
27026
27028
  });
27027
27029
  }), r;
27028
27030
  }
@@ -27046,7 +27048,7 @@ class $ {
27046
27048
  return s = this.loadedFontMap.get(c.toLowerCase()), !s && this.lazyFontLoading && this.requestFont(c), this.recordMissedFonts(r, !1), c;
27047
27049
  }
27048
27050
  if (s)
27049
- return n;
27051
+ return r || n;
27050
27052
  this.recordMissedFonts(r, !0);
27051
27053
  const i = this.pickLoadedDefaultFont(!0);
27052
27054
  if (i)
@@ -27081,7 +27083,7 @@ class $ {
27081
27083
  getFontByName(e, n = !0) {
27082
27084
  e == null && (e = "");
27083
27085
  const r = e.lastIndexOf(".");
27084
- (r > 0 && r == e.length - 4 || r == e.length - 5) && (e = e.substring(0, r));
27086
+ r > 0 && (r === e.length - 4 || r === e.length - 5) && (e = e.substring(0, r));
27085
27087
  const s = this.loadedFontMap.get(e.toLowerCase());
27086
27088
  if (!s) {
27087
27089
  n && this.recordMissedFonts(e);
@@ -27162,7 +27164,7 @@ class $ {
27162
27164
  * @returns The scale factor for the font, or 1 if the font is not found
27163
27165
  */
27164
27166
  getFontScaleFactor(e) {
27165
- const n = this.loadedFontMap.get(e.toLowerCase());
27167
+ const n = this.getFontByName(e, !1);
27166
27168
  return n ? n.getScaleFactor() : 1;
27167
27169
  }
27168
27170
  /**
@@ -27171,8 +27173,8 @@ class $ {
27171
27173
  * @returns The type of the font. If the specified font can't be found, `undefined` is returned
27172
27174
  */
27173
27175
  getFontType(e) {
27174
- const n = this.loadedFontMap.get(e.toLowerCase());
27175
- return n == null ? void 0 : n.type;
27176
+ var n;
27177
+ return (n = this.getFontByName(e, !1)) == null ? void 0 : n.type;
27176
27178
  }
27177
27179
  /**
27178
27180
  * Gets the type of the SHX font. Such as BIGFONT, SHAPES, UNIFONT.
@@ -27180,7 +27182,7 @@ class $ {
27180
27182
  * @returns The type of the SHX font, or undefined if the specified font is not a SHX font
27181
27183
  */
27182
27184
  getShxFontType(e) {
27183
- const n = this.loadedFontMap.get(e.toLowerCase());
27185
+ const n = this.getFontByName(e, !1);
27184
27186
  return (n == null ? void 0 : n.type) === "shx" ? n.data.header.fontType : void 0;
27185
27187
  }
27186
27188
  /**
@@ -27200,7 +27202,8 @@ class $ {
27200
27202
  * @returns True if the font is loaded, false otherwise
27201
27203
  */
27202
27204
  isFontLoaded(e) {
27203
- return this.loadedFontMap.has(e.toLowerCase());
27205
+ const n = this.normalizeFontName(e);
27206
+ return !!n && this.loadedFontMap.has(n);
27204
27207
  }
27205
27208
  /**
27206
27209
  * Applies a missed-font report from another isolate (e.g. a web worker).
@@ -27247,7 +27250,7 @@ class $ {
27247
27250
  if (!e)
27248
27251
  return e;
27249
27252
  const n = e.lastIndexOf(".");
27250
- return n > 0 && n == e.length - 4 || n == e.length - 5 ? e.substring(0, n) : e;
27253
+ return n > 0 && (n === e.length - 4 || n === e.length - 5) ? e.substring(0, n) : e;
27251
27254
  }
27252
27255
  /**
27253
27256
  * Removes {@link missedFonts} entries whose name matches `fontName`
@@ -27294,13 +27297,13 @@ class $ {
27294
27297
  async persistCatalogAliases(e, n) {
27295
27298
  if (!this.enableFontCache)
27296
27299
  return;
27297
- const r = await ze.instance.get(e);
27300
+ const r = await Ue.instance.get(e);
27298
27301
  if (!r)
27299
27302
  return;
27300
27303
  const s = [
27301
27304
  .../* @__PURE__ */ new Set([...r.alias ?? [], ...n, e])
27302
27305
  ], i = r.alias ?? [];
27303
- s.length === i.length && s.every((a) => i.includes(a)) || await ze.instance.set(e, {
27306
+ s.length === i.length && s.every((a) => i.includes(a)) || await Ue.instance.set(e, {
27304
27307
  ...r,
27305
27308
  alias: s
27306
27309
  });
@@ -27326,32 +27329,41 @@ class $ {
27326
27329
  this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
27327
27330
  return;
27328
27331
  }
27329
- const a = this.loadEpoch, o = await ze.instance.get(s);
27330
- if (a === this.loadEpoch) {
27331
- if (o) {
27332
- if (await new Promise((l) => setTimeout(l, 0)), a !== this.loadEpoch)
27333
- return;
27334
- if (this.isFontLoaded(s)) {
27335
- this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
27336
- return;
27337
- }
27338
- const c = Ze.instance.createFont(o);
27339
- c && (this.applyCatalogNames(c, i), this.registerFontInMap(s, c), await this.persistCatalogAliases(s, i));
27340
- } else {
27341
- const c = await this.loader.loadAsync(e.url);
27342
- if (a !== this.loadEpoch || (r.data = c, await new Promise((u) => setTimeout(u, 0)), a !== this.loadEpoch))
27343
- return;
27344
- if (this.isFontLoaded(s)) {
27345
- this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
27346
- return;
27332
+ const a = this.loadEpoch, o = this.enableFontCache ? await Ue.instance.get(s) : void 0;
27333
+ if (a !== this.loadEpoch)
27334
+ return;
27335
+ let c = !1;
27336
+ if (o) {
27337
+ if (await new Promise((l) => setTimeout(l, 0)), a !== this.loadEpoch)
27338
+ return;
27339
+ if (this.isFontLoaded(s)) {
27340
+ this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
27341
+ return;
27342
+ }
27343
+ try {
27344
+ const l = Ze.instance.createFont(o);
27345
+ l && (this.applyCatalogNames(l, i), this.registerFontInMap(s, l), await this.persistCatalogAliases(s, i), c = !0);
27346
+ } catch {
27347
+ try {
27348
+ await Ue.instance.delete(s);
27349
+ } catch {
27347
27350
  }
27348
- const l = Ze.instance.createFont(r);
27349
- l && (this.applyCatalogNames(l, i), this.registerFontInMap(s, l), this.enableFontCache && await ze.instance.set(s, r));
27350
27351
  }
27351
- a !== this.loadEpoch || !this.isFontLoaded(s) || (this.clearRequestStateForNames([s, ...i]), this.events.fontLoaded.dispatch({
27352
- fontName: s
27353
- }));
27354
27352
  }
27353
+ if (!c && !this.isFontLoaded(s)) {
27354
+ const l = await this.loader.loadAsync(e.url);
27355
+ if (a !== this.loadEpoch || (r.data = l, await new Promise((f) => setTimeout(f, 0)), a !== this.loadEpoch))
27356
+ return;
27357
+ if (this.isFontLoaded(s)) {
27358
+ this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
27359
+ return;
27360
+ }
27361
+ const u = Ze.instance.createFont(r);
27362
+ u && (this.applyCatalogNames(u, i), this.registerFontInMap(s, u), this.enableFontCache && await Ue.instance.set(s, r));
27363
+ }
27364
+ a !== this.loadEpoch || !this.isFontLoaded(s) || (this.clearRequestStateForNames([s, ...i]), this.events.fontLoaded.dispatch({
27365
+ fontName: s
27366
+ }));
27355
27367
  }
27356
27368
  fontInfoToFontData(e) {
27357
27369
  const n = lt(e.file).toLowerCase(), r = ["ttf", "otf", "woff"].includes(e.type) ? "mesh" : e.type;
@@ -27368,7 +27380,7 @@ class $ {
27368
27380
  async getAllFontsFromCache() {
27369
27381
  if (this.loadedFontMap.size !== 0)
27370
27382
  return;
27371
- const e = await ze.instance.getAll();
27383
+ const e = await Ue.instance.getAll();
27372
27384
  for (const n of e) {
27373
27385
  const { name: r } = n;
27374
27386
  if (this.fileNames && !this.fileNames.includes(r))
@@ -27461,7 +27473,9 @@ class $ {
27461
27473
  const n = /* @__PURE__ */ new Set();
27462
27474
  for (const a of this.loadedFontMap.values())
27463
27475
  n.add(a);
27464
- const r = Array.from(n).map((a) => a.estimateMemoryUsage()), s = (e == null ? void 0 : e.materials) ?? da(), i = r.reduce((a, o) => a + o.estimatedBytes, 0);
27476
+ const r = Array.from(n).map(
27477
+ (a) => a.estimateMemoryUsage()
27478
+ ), s = (e == null ? void 0 : e.materials) ?? da(), i = r.reduce((a, o) => a + o.estimatedBytes, 0);
27465
27479
  return {
27466
27480
  id: (e == null ? void 0 : e.id) ?? "main",
27467
27481
  inFlightRequests: e == null ? void 0 : e.inFlightRequests,
@@ -27471,12 +27485,12 @@ class $ {
27471
27485
  };
27472
27486
  }
27473
27487
  }
27474
- class F0 {
27488
+ class T0 {
27475
27489
  /**
27476
27490
  * Creates a new instance of DefaultFontLoader
27477
27491
  */
27478
27492
  constructor() {
27479
- this._availableFontsPromise = null, this._avaiableFonts = [], this._avaiableFontMap = /* @__PURE__ */ new Map(), this._baseUrl = "https://cdn.jsdelivr.net/gh/mlightcad/cad-data/fonts/";
27493
+ this._availableFontsPromise = null, this._catalogRefreshAttempted = !1, this._avaiableFonts = [], this._avaiableFontMap = /* @__PURE__ */ new Map(), this._baseUrl = "https://cdn.jsdelivr.net/gh/mlightcad/cad-data/fonts/";
27480
27494
  }
27481
27495
  /**
27482
27496
  * Base URL to load fonts
@@ -27485,7 +27499,7 @@ class F0 {
27485
27499
  return this._baseUrl;
27486
27500
  }
27487
27501
  set baseUrl(e) {
27488
- this._baseUrl !== e && (this._baseUrl = e, this._avaiableFonts = [], this._avaiableFontMap.clear(), this._availableFontsPromise = null, this.onFontUrlChanged(e));
27502
+ this._baseUrl !== e && (this._baseUrl = e, this.clearAvailableFontsCache(), this._catalogRefreshAttempted = !1, this.onFontUrlChanged(e));
27489
27503
  }
27490
27504
  /**
27491
27505
  * Gets the list of available fonts
@@ -27528,81 +27542,99 @@ class F0 {
27528
27542
  async load(e) {
27529
27543
  if (e == null || e.length === 0)
27530
27544
  return [];
27531
- await this.getAvailableFonts();
27532
- const n = [], r = [], s = /* @__PURE__ */ new Map();
27533
- e.forEach((c) => {
27534
- const l = c.toLowerCase(), u = this._avaiableFontMap.get(l);
27535
- u && (s.set(l, u), $.instance.isFontLoaded(l) && n.push({
27536
- fontName: l,
27537
- url: u.url,
27545
+ await this.getAvailableFonts(), e.some(
27546
+ (l) => !this._avaiableFontMap.has(l.toLowerCase())
27547
+ ) && !this._catalogRefreshAttempted && (this._catalogRefreshAttempted = !0, await this.refreshAvailableFontsFromNetwork());
27548
+ const r = [], s = [], i = /* @__PURE__ */ new Map();
27549
+ e.forEach((l) => {
27550
+ const u = l.toLowerCase(), f = this._avaiableFontMap.get(u);
27551
+ f && (i.set(u, f), $.instance.isFontLoaded(u) && r.push({
27552
+ fontName: u,
27553
+ url: f.url,
27538
27554
  status: "Success"
27539
- }), r.push(u));
27555
+ }), s.push(f));
27540
27556
  });
27541
- const i = await $.instance.loadFonts(r), a = {};
27542
- [...n, ...i].forEach((c) => {
27543
- a[c.fontName] = c;
27557
+ const a = await $.instance.loadFonts(s), o = {};
27558
+ [...r, ...a].forEach((l) => {
27559
+ o[l.fontName] = l;
27544
27560
  });
27545
- const o = [];
27546
- for (const c of e) {
27547
- const l = c.toLowerCase(), u = a[l];
27548
- if (u) {
27549
- o.push(u);
27561
+ const c = [];
27562
+ for (const l of e) {
27563
+ const u = l.toLowerCase(), f = o[u];
27564
+ if (f) {
27565
+ c.push(f);
27550
27566
  continue;
27551
27567
  }
27552
- const f = s.get(l);
27553
- if (f) {
27554
- if ($.instance.isFontLoaded(l)) {
27555
- o.push({
27556
- fontName: l,
27557
- url: f.url,
27568
+ const h = i.get(u);
27569
+ if (h) {
27570
+ if ($.instance.isFontLoaded(u)) {
27571
+ c.push({
27572
+ fontName: u,
27573
+ url: h.url,
27558
27574
  status: "Success"
27559
27575
  });
27560
27576
  continue;
27561
27577
  }
27562
- const h = lt(
27563
- f.file
27564
- ).toLowerCase(), p = a[h];
27565
- if (p) {
27566
- o.push({
27567
- fontName: l,
27568
- url: f.url,
27569
- status: p.status
27578
+ const p = lt(
27579
+ h.file
27580
+ ).toLowerCase(), y = o[p];
27581
+ if (y) {
27582
+ c.push({
27583
+ fontName: u,
27584
+ url: h.url,
27585
+ status: y.status
27570
27586
  });
27571
27587
  continue;
27572
27588
  }
27573
27589
  }
27574
- if (await $.instance.loadFontFromCache(c)) {
27575
- o.push({
27576
- fontName: l,
27590
+ if (await $.instance.loadFontFromCache(l)) {
27591
+ c.push({
27592
+ fontName: u,
27577
27593
  url: "",
27578
27594
  status: "Success"
27579
27595
  });
27580
27596
  continue;
27581
27597
  }
27582
- o.push({
27583
- fontName: l,
27598
+ c.push({
27599
+ fontName: u,
27584
27600
  url: "",
27585
27601
  status: "NotFound"
27586
27602
  });
27587
27603
  }
27588
- return o;
27604
+ return c;
27605
+ }
27606
+ clearAvailableFontsCache() {
27607
+ this._avaiableFonts = [], this._avaiableFontMap.clear(), this._availableFontsPromise = null;
27608
+ }
27609
+ /**
27610
+ * Drops the in-memory catalog and refetches `fonts.json`, bypassing the HTTP
27611
+ * cache so CDN updates are visible after a miss.
27612
+ */
27613
+ async refreshAvailableFontsFromNetwork() {
27614
+ this.clearAvailableFontsCache();
27615
+ const e = this._baseUrl, n = this.fetchAvailableFonts(e, {
27616
+ bypassHttpCache: !0
27617
+ }).finally(() => {
27618
+ this._availableFontsPromise === n && (this._availableFontsPromise = null);
27619
+ });
27620
+ return this._availableFontsPromise = n, n;
27589
27621
  }
27590
27622
  /**
27591
27623
  * Fetches and caches remote font metadata for the given base URL.
27592
27624
  */
27593
- async fetchAvailableFonts(e) {
27594
- const n = e + "fonts.json";
27595
- let r;
27625
+ async fetchAvailableFonts(e, n) {
27626
+ const r = e + "fonts.json";
27627
+ let s;
27596
27628
  try {
27597
- r = await (await fetch(n)).json();
27598
- } catch (s) {
27629
+ s = await (n != null && n.bypassHttpCache ? await fetch(r, { cache: "no-cache" }) : await fetch(r)).json();
27630
+ } catch (i) {
27599
27631
  throw new Error(
27600
- `Filed to get avaiable font from '${n}' due to ${s}!`
27632
+ `Filed to get avaiable font from '${r}' due to ${i}!`
27601
27633
  );
27602
27634
  }
27603
- return this._baseUrl !== e ? this.getAvailableFonts() : (r.forEach((s) => {
27604
- s.url = e + s.file;
27605
- }), this._avaiableFonts = r, this.buildFontMap(), this._avaiableFonts);
27635
+ return this._baseUrl !== e ? this.getAvailableFonts() : (s.forEach((i) => {
27636
+ i.url = e + i.file;
27637
+ }), this._avaiableFonts = s, this.buildFontMap(), this._avaiableFonts);
27606
27638
  }
27607
27639
  /**
27608
27640
  * Build one font map. The key is font name. The value is font info.
@@ -28931,8 +28963,8 @@ function P0(t, e, n, r) {
28931
28963
  };
28932
28964
  }
28933
28965
  const N0 = 5 / 3, Gi = 1, bn = 0.3;
28934
- var Ge = /* @__PURE__ */ ((t) => (t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t[t.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", t[t.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", t[t.BY_STYLE = 5] = "BY_STYLE", t))(Ge || {}), Q = /* @__PURE__ */ ((t) => (t[t.TopLeft = 1] = "TopLeft", t[t.TopCenter = 2] = "TopCenter", t[t.TopRight = 3] = "TopRight", t[t.MiddleLeft = 4] = "MiddleLeft", t[t.MiddleCenter = 5] = "MiddleCenter", t[t.MiddleRight = 6] = "MiddleRight", t[t.BottomLeft = 7] = "BottomLeft", t[t.BottomCenter = 8] = "BottomCenter", t[t.BottomRight = 9] = "BottomRight", t[t.BaselineLeft = 10] = "BaselineLeft", t[t.BaselineCenter = 11] = "BaselineCenter", t[t.BaselineRight = 12] = "BaselineRight", t))(Q || {}), ue = /* @__PURE__ */ ((t) => (t.CHAR = "CHAR", t.STACK = "STACK", t))(ue || {});
28935
- const Tn = "", Ie = () => ({
28966
+ var He = /* @__PURE__ */ ((t) => (t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t[t.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", t[t.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", t[t.BY_STYLE = 5] = "BY_STYLE", t))(He || {}), Q = /* @__PURE__ */ ((t) => (t[t.TopLeft = 1] = "TopLeft", t[t.TopCenter = 2] = "TopCenter", t[t.TopRight = 3] = "TopRight", t[t.MiddleLeft = 4] = "MiddleLeft", t[t.MiddleCenter = 5] = "MiddleCenter", t[t.MiddleRight = 6] = "MiddleRight", t[t.BottomLeft = 7] = "BottomLeft", t[t.BottomCenter = 8] = "BottomCenter", t[t.BottomRight = 9] = "BottomRight", t[t.BaselineLeft = 10] = "BaselineLeft", t[t.BaselineCenter = 11] = "BaselineCenter", t[t.BaselineRight = 12] = "BaselineRight", t))(Q || {}), ue = /* @__PURE__ */ ((t) => (t.CHAR = "CHAR", t.STACK = "STACK", t))(ue || {});
28967
+ const Fn = "", Ie = () => ({
28936
28968
  byLayerColor: 16777215,
28937
28969
  byBlockColor: 16777215,
28938
28970
  layer: "0",
@@ -28951,7 +28983,7 @@ function G0(t) {
28951
28983
  }
28952
28984
  function Hr(t, e, n) {
28953
28985
  const r = [];
28954
- if (t.filter((h) => h.char !== Tn).forEach((h) => {
28986
+ if (t.filter((h) => h.char !== Fn).forEach((h) => {
28955
28987
  const p = G0(
28956
28988
  new I.Box3().copy(h.box).applyMatrix4(e)
28957
28989
  );
@@ -29552,7 +29584,7 @@ class $i {
29552
29584
  if (!r)
29553
29585
  return;
29554
29586
  this._lineBatchEntries = [];
29555
- const s = [], i = [], a = [], o = [], c = this.flowDirection === Ge.BOTTOM_TO_TOP ? 0 : -this.currentLayoutFontSize, l = this.buildShapeGeometry(
29587
+ const s = [], i = [], a = [], o = [], c = this.flowDirection === He.BOTTOM_TO_TOP ? 0 : -this.currentLayoutFontSize, l = this.buildShapeGeometry(
29556
29588
  r.shape,
29557
29589
  r.label,
29558
29590
  0,
@@ -29878,20 +29910,20 @@ class $i {
29878
29910
  this._hOffset = l, this._currentContext.charTrackingFactor = { value: 1, isRelative: !1 };
29879
29911
  let y = 0;
29880
29912
  for (const C of a) {
29881
- const T = this.getCharShape(C);
29882
- T && (y += T.width * this.currentWidthFactor);
29913
+ const F = this.getCharShape(C);
29914
+ F && (y += F.width * this.currentWidthFactor);
29883
29915
  }
29884
29916
  this._hOffset = l;
29885
29917
  let m = 0;
29886
29918
  for (const C of o) {
29887
- const T = this.getCharShape(C);
29888
- T && (m += T.width * this.currentWidthFactor);
29919
+ const F = this.getCharShape(C);
29920
+ F && (m += F.width * this.currentWidthFactor);
29889
29921
  }
29890
29922
  const b = Math.max(y, m), v = (b - y) / 2, w = (b - m) / 2;
29891
29923
  if (c === "^") {
29892
29924
  if (a && !o) {
29893
29925
  this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams();
29894
- const C = [], T = [], E = [], R = [];
29926
+ const C = [], F = [], E = [], R = [];
29895
29927
  this._hOffset = l, this._vOffset = this.convertTopAlignedVOffset(
29896
29928
  u + h * 0.1,
29897
29929
  this.currentFontSize
@@ -29900,14 +29932,14 @@ class $i {
29900
29932
  this.processChar(
29901
29933
  P,
29902
29934
  C,
29903
- T,
29935
+ F,
29904
29936
  E,
29905
29937
  R
29906
29938
  );
29907
- n.push(...C), r.push(...T), s.push(...E), i.push(...R), this._hOffset = l + y, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
29939
+ n.push(...C), r.push(...F), s.push(...E), i.push(...R), this._hOffset = l + y, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
29908
29940
  } else if (!a && o) {
29909
29941
  this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams();
29910
- const C = [], T = [], E = [], R = [];
29942
+ const C = [], F = [], E = [], R = [];
29911
29943
  this._hOffset = l, this._vOffset = this.convertTopAlignedVOffset(
29912
29944
  u - h * 0.6,
29913
29945
  this.currentFontSize
@@ -29916,15 +29948,15 @@ class $i {
29916
29948
  this.processChar(
29917
29949
  P,
29918
29950
  C,
29919
- T,
29951
+ F,
29920
29952
  E,
29921
29953
  R
29922
29954
  );
29923
- n.push(...C), r.push(...T), s.push(...E), i.push(...R), this._hOffset = l + m, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
29955
+ n.push(...C), r.push(...F), s.push(...E), i.push(...R), this._hOffset = l + m, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
29924
29956
  } else if (a && o) {
29925
- const C = this._currentContext.fontScaleFactor || 1, T = (this._maxFontSize || this.currentFontSize) / C, E = Math.abs(this.currentLayoutFontSize - T) < 1e-6;
29957
+ const C = this._currentContext.fontScaleFactor || 1, F = (this._maxFontSize || this.currentFontSize) / C, E = Math.abs(this.currentLayoutFontSize - F) < 1e-6;
29926
29958
  E && (this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams());
29927
- const R = Math.max(y, m), P = 0, W = 0, j = this.currentLayoutFontSize, N = u - T + j, X = N + this.currentFontSize, ie = [], U = [], M = [], _ = [];
29959
+ const R = Math.max(y, m), P = 0, W = 0, j = this.currentLayoutFontSize, N = u - F + j, X = N + this.currentFontSize, ie = [], U = [], M = [], _ = [];
29928
29960
  this._hOffset = l + P, this._vOffset = X;
29929
29961
  for (const me of a)
29930
29962
  this.processChar(
@@ -29935,20 +29967,20 @@ class $i {
29935
29967
  _
29936
29968
  );
29937
29969
  n.push(...ie), r.push(...U), s.push(...M), i.push(..._);
29938
- const re = [], Te = [], et = [], _e = [];
29970
+ const re = [], Fe = [], et = [], _e = [];
29939
29971
  this._hOffset = l + W, this._vOffset = N;
29940
29972
  for (const me of o)
29941
29973
  this.processChar(
29942
29974
  me,
29943
29975
  re,
29944
- Te,
29976
+ Fe,
29945
29977
  et,
29946
29978
  _e
29947
29979
  );
29948
- n.push(...re), r.push(...Te), s.push(...et), i.push(..._e), this._hOffset = l + R, E && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
29980
+ n.push(...re), r.push(...Fe), s.push(...et), i.push(..._e), this._hOffset = l + R, E && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
29949
29981
  }
29950
29982
  } else {
29951
- const C = [], T = [], E = [], R = [];
29983
+ const C = [], F = [], E = [], R = [];
29952
29984
  this._hOffset = l + v, this._vOffset = this.convertTopAlignedVOffset(
29953
29985
  u + this.currentFontSize * 0.3,
29954
29986
  this.currentFontSize
@@ -29957,11 +29989,11 @@ class $i {
29957
29989
  this.processChar(
29958
29990
  X,
29959
29991
  C,
29960
- T,
29992
+ F,
29961
29993
  E,
29962
29994
  R
29963
29995
  );
29964
- n.push(...C), r.push(...T), s.push(...E), i.push(...R), (c === "/" || c === "#") && this.recordStackDivider(
29996
+ n.push(...C), r.push(...F), s.push(...E), i.push(...R), (c === "/" || c === "#") && this.recordStackDivider(
29965
29997
  l,
29966
29998
  u,
29967
29999
  b,
@@ -30020,12 +30052,12 @@ class $i {
30020
30052
  this.resolveCharBoxTarget(s, i) === "mesh" ? s.push({
30021
30053
  type: ue.CHAR,
30022
30054
  box: o,
30023
- char: Tn,
30055
+ char: Fn,
30024
30056
  children: []
30025
30057
  }) : i.push({
30026
30058
  type: ue.CHAR,
30027
30059
  box: o,
30028
- char: Tn,
30060
+ char: Fn,
30029
30061
  children: []
30030
30062
  });
30031
30063
  }
@@ -30048,7 +30080,7 @@ class $i {
30048
30080
  */
30049
30081
  processBlank(e, n) {
30050
30082
  if (this._options.collectCharBoxes !== !1) {
30051
- const r = this._hOffset, s = this.flowDirection == Ge.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.currentLayoutFontSize, i = new I.Box3(
30083
+ const r = this._hOffset, s = this.flowDirection == He.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.currentLayoutFontSize, i = new I.Box3(
30052
30084
  new I.Vector3(r, s, 0),
30053
30085
  new I.Vector3(
30054
30086
  r + this.currentBlankAdvance,
@@ -30088,7 +30120,7 @@ class $i {
30088
30120
  * Appends vertical layout metadata for the current visual line to {@link _lineLayouts}.
30089
30121
  */
30090
30122
  recordCurrentLineLayout() {
30091
- const e = this.flowDirection == Ge.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, n = this.currentLineHeight;
30123
+ const e = this.flowDirection == He.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, n = this.currentLineHeight;
30092
30124
  this._lineLayouts.push({
30093
30125
  y: e + n / 2,
30094
30126
  height: n
@@ -30138,7 +30170,7 @@ class $i {
30138
30170
  return;
30139
30171
  }
30140
30172
  this._lineHasRenderableChar || this.applyPendingEmptyLineYAdjust(), this.hOffset > (this.maxLineWidth || 1 / 0) && (this.recordVisualLineBreak(s, i), this.advanceToNextLine(!1));
30141
- const l = this.hOffset, u = this.flowDirection == Ge.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentLayoutFontSize, f = this.currentLayoutFontSize, h = c.width * this.currentWidthFactor, { matrix: p, obliqueExtraAdvance: y } = this.buildCharTransformMatrix(
30173
+ const l = this.hOffset, u = this.flowDirection == He.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentLayoutFontSize, f = this.currentLayoutFontSize, h = c.width * this.currentWidthFactor, { matrix: p, obliqueExtraAdvance: y } = this.buildCharTransformMatrix(
30142
30174
  l,
30143
30175
  u,
30144
30176
  f
@@ -30325,7 +30357,7 @@ class $i {
30325
30357
  * @param collectBreakIndex When `true`, records a char index for automatic wrapping.
30326
30358
  */
30327
30359
  advanceToNextLine(e = !0) {
30328
- e && this.recordVisualLineBreak(), this.captureCurrentLineAdvance(), this.recordCurrentLineLayout(), this._hOffset = 0, this._lineHasRenderableChar ? this._pendingEmptyLineFontSizeAdjust = void 0 : this._pendingEmptyLineFontSizeAdjust = this.currentFontSize, this.flowDirection == Ge.BOTTOM_TO_TOP ? this._vOffset += this.currentLineHeight : this._vOffset -= this.currentLineHeight, this._lineCount++, this.processAlignment(), this._currentLineObjects = [], this._lineCount == 2 ? this._totalHeight = this.currentMaxFontSize : this._totalHeight = this._totalHeight + this.currentLineHeight, this._maxFontSize = 0, this._lineHasRenderableChar = !1;
30360
+ e && this.recordVisualLineBreak(), this.captureCurrentLineAdvance(), this.recordCurrentLineLayout(), this._hOffset = 0, this._lineHasRenderableChar ? this._pendingEmptyLineFontSizeAdjust = void 0 : this._pendingEmptyLineFontSizeAdjust = this.currentFontSize, this.flowDirection == He.BOTTOM_TO_TOP ? this._vOffset += this.currentLineHeight : this._vOffset -= this.currentLineHeight, this._lineCount++, this.processAlignment(), this._currentLineObjects = [], this._lineCount == 2 ? this._totalHeight = this.currentMaxFontSize : this._totalHeight = this._totalHeight + this.currentLineHeight, this._maxFontSize = 0, this._lineHasRenderableChar = !1;
30329
30361
  }
30330
30362
  /**
30331
30363
  * Updates {@link _maxLineAdvance} from the current line's horizontal pen position.
@@ -30345,7 +30377,7 @@ class $i {
30345
30377
  */
30346
30378
  countFinalCharBoxes(e, n, r) {
30347
30379
  const s = [...e, ...n].filter(
30348
- (f) => f.char !== Tn
30380
+ (f) => f.char !== Fn
30349
30381
  );
30350
30382
  if (r !== ue.STACK)
30351
30383
  return s.length;
@@ -30367,7 +30399,7 @@ class $i {
30367
30399
  applyPendingEmptyLineYAdjust() {
30368
30400
  if (this._pendingEmptyLineFontSizeAdjust === void 0) return;
30369
30401
  const e = this.currentFontSize - this._pendingEmptyLineFontSizeAdjust;
30370
- e !== 0 && (this.flowDirection == Ge.BOTTOM_TO_TOP ? this._vOffset += e : this._vOffset -= e), this._pendingEmptyLineFontSizeAdjust = void 0;
30402
+ e !== 0 && (this.flowDirection == He.BOTTOM_TO_TOP ? this._vOffset += e : this._vOffset -= e), this._pendingEmptyLineFontSizeAdjust = void 0;
30371
30403
  }
30372
30404
  /**
30373
30405
  * Chooses whether subsequent char boxes should attach to mesh or line geometry owners.
@@ -30652,7 +30684,15 @@ class tn extends I.Object3D {
30652
30684
  }
30653
30685
  }
30654
30686
  const r = (e == null ? void 0 : e.awaitFonts) ?? (!this._fontManager.lazyFontLoading || this._fontManager.awaitFontsBeforeDraw), s = r ? [.../* @__PURE__ */ new Set([...n, ...this._fontManager.getFontsToLoad()])] : n;
30655
- s.length > 0 && (this._fontManager.lazyFontLoading ? r ? await this._fontManager.requestFonts(s) : this._fontManager.requestFonts(s) : await this._fontManager.loadFontsByNames(s), n.length > 0 && (this._fontsInStyleLoaded = !0)), this.syncDraw();
30687
+ if (s.length > 0 && (this._fontManager.lazyFontLoading ? r ? await this._fontManager.requestFonts(s) : this._fontManager.requestFonts(s) : await this._fontManager.loadFontsByNames(s), n.length > 0)) {
30688
+ const i = [
30689
+ this._style.font ? this.getFontName(this._style.font) : void 0,
30690
+ this._style.bigFont ? this.getFontName(this._style.bigFont) : void 0,
30691
+ this._style.extendedFont ? this.getFontName(this._style.extendedFont) : void 0
30692
+ ].filter((o) => !!o);
30693
+ (i.length === 0 || i.every((o) => this._fontManager.isFontLoaded(o))) && (this._fontsInStyleLoaded = !0);
30694
+ }
30695
+ this.syncDraw();
30656
30696
  }
30657
30697
  /**
30658
30698
  * Draw the MText object. This method assumes that fonts needed are loaded. If font needed
@@ -30760,18 +30800,15 @@ class tn extends I.Object3D {
30760
30800
  position: e.position,
30761
30801
  rotation: e.rotation,
30762
30802
  directionVector: e.directionVector,
30763
- drawingDirection: Ge.BOTTOM_TO_TOP,
30803
+ drawingDirection: He.BOTTOM_TO_TOP,
30764
30804
  collectCharBoxes: !1
30765
30805
  };
30766
- return this.finalizePlacement(
30767
- r,
30768
- i,
30769
- s,
30770
- { shxFontType: this._fontManager.getShxFontType(n.font) }
30771
- );
30806
+ return this.finalizePlacement(r, i, s, {
30807
+ shxFontType: this._fontManager.getShxFontType(n.font)
30808
+ });
30772
30809
  }
30773
30810
  /**
30774
- *
30811
+ *
30775
30812
  * @param options.shxFontType The type of SHX font.
30776
30813
  */
30777
30814
  finalizePlacement(e, n, r, s) {
@@ -30791,7 +30828,10 @@ class tn extends I.Object3D {
30791
30828
  n.drawingDirection
30792
30829
  );
30793
30830
  let c = { x: 0, y: 0 };
30794
- (s == null ? void 0 : s.shxFontType) === K.SHAPES ? c = { x: 0, y: 0 } : c = this.calculateAnchorPoint(o, n.attachmentPoint), e.userData.logicalBounds = {
30831
+ (s == null ? void 0 : s.shxFontType) === K.SHAPES ? c = { x: 0, y: 0 } : c = this.calculateAnchorPoint(
30832
+ o,
30833
+ n.attachmentPoint
30834
+ ), e.userData.logicalBounds = {
30795
30835
  minX: o.minX + c.x,
30796
30836
  maxX: o.maxX + c.x,
30797
30837
  minY: o.minY + c.y,
@@ -30836,7 +30876,7 @@ class tn extends I.Object3D {
30836
30876
  lineSpaceFactor: Gi,
30837
30877
  horizontalAlignment: oe.LEFT,
30838
30878
  maxWidth: 0,
30839
- flowDirection: Ge.BOTTOM_TO_TOP,
30879
+ flowDirection: He.BOTTOM_TO_TOP,
30840
30880
  byBlockColor: this._colorSettings.byBlockColor,
30841
30881
  byLayerColor: this._colorSettings.byLayerColor,
30842
30882
  removeFontExtension: !0,
@@ -30895,7 +30935,7 @@ class tn extends I.Object3D {
30895
30935
  Q.MiddleCenter,
30896
30936
  Q.MiddleRight
30897
30937
  ].includes(e.attachmentPoint) ? a = dt.MIDDLE : a = dt.BOTTOM);
30898
- const o = e.height || n.fixedTextHeight || 0, c = e.widthFactor || n.widthFactor || 1, l = e.lineSpaceFactor ?? Gi, u = e.drawingDirection ?? Ge.LEFT_TO_RIGHT, f = {
30938
+ const o = e.height || n.fixedTextHeight || 0, c = e.widthFactor || n.widthFactor || 1, l = e.lineSpaceFactor ?? Gi, u = e.drawingDirection ?? He.LEFT_TO_RIGHT, f = {
30899
30939
  fontSize: o,
30900
30940
  widthFactor: c,
30901
30941
  lineSpaceFactor: l,
@@ -30969,15 +31009,15 @@ class tn extends I.Object3D {
30969
31009
  var v;
30970
31010
  const b = (v = m.userData) == null ? void 0 : v.lineLayouts;
30971
31011
  !b || b.length === 0 || b.forEach((w) => {
30972
- const C = w.y - w.height / 2, T = w.y + w.height / 2;
30973
- a.hasLine = !0, a.minY = Math.min(a.minY, C), a.maxY = Math.max(a.maxY, T), o || (a.baselineY = C, o = !0);
31012
+ const C = w.y - w.height / 2, F = w.y + w.height / 2;
31013
+ a.hasLine = !0, a.minY = Math.min(a.minY, C), a.maxY = Math.max(a.maxY, F), o || (a.baselineY = C, o = !0);
30974
31014
  });
30975
31015
  });
30976
31016
  const c = s.isEmpty() ? 0 : s.max.y - s.min.y, l = Number.isFinite(c) && c > 0 ? c : Number.isFinite(r) && r > 0 ? r : 0;
30977
31017
  let u = 0, f = Number.isFinite(n) && n > 0 ? n : 0;
30978
31018
  f <= u && !s.isEmpty() && (u = s.min.x, f = s.max.x);
30979
31019
  let h = 0, p = 0;
30980
- i == Ge.BOTTOM_TO_TOP ? (h = s.isEmpty() ? 0 : s.min.y, p = h + l) : (p = s.isEmpty() ? 0 : s.max.y, h = p - l);
31020
+ i == He.BOTTOM_TO_TOP ? (h = s.isEmpty() ? 0 : s.min.y, p = h + l) : (p = s.isEmpty() ? 0 : s.max.y, h = p - l);
30981
31021
  const y = a.hasLine ? a.baselineY : h;
30982
31022
  return { minX: u, maxX: f, minY: h, maxY: p, baselineY: y };
30983
31023
  }
@@ -31223,7 +31263,9 @@ class Xi extends I.Object3D {
31223
31263
  a && n.push(a);
31224
31264
  }
31225
31265
  const r = (e == null ? void 0 : e.awaitFonts) ?? (!this._fontManager.lazyFontLoading || this._fontManager.awaitFontsBeforeDraw), s = r ? [.../* @__PURE__ */ new Set([...n, ...this._fontManager.getFontsToLoad()])] : n;
31226
- s.length > 0 && (this._fontManager.lazyFontLoading ? r ? await this._fontManager.requestFonts(s) : this._fontManager.requestFonts(s) : await this._fontManager.loadFontsByNames(s), n.length > 0 && (this._fontsInStyleLoaded = !0)), this.syncDraw();
31266
+ s.length > 0 && (this._fontManager.lazyFontLoading ? r ? await this._fontManager.requestFonts(s) : this._fontManager.requestFonts(s) : await this._fontManager.loadFontsByNames(s), n.length > 0 && n.every(
31267
+ (a) => this._fontManager.isFontLoaded(a)
31268
+ ) && (this._fontsInStyleLoaded = !0)), this.syncDraw();
31227
31269
  }
31228
31270
  syncDraw() {
31229
31271
  const n = new tn(
@@ -31248,7 +31290,7 @@ class Xi extends I.Object3D {
31248
31290
  position: this._shapeData.position,
31249
31291
  rotation: this._shapeData.rotation,
31250
31292
  directionVector: this._shapeData.directionVector,
31251
- drawingDirection: Ge.BOTTOM_TO_TOP,
31293
+ drawingDirection: He.BOTTOM_TO_TOP,
31252
31294
  collectCharBoxes: !1
31253
31295
  };
31254
31296
  }
@@ -31781,6 +31823,10 @@ class t1 {
31781
31823
  */
31782
31824
  async setFontUrl(e) {
31783
31825
  this.fontManager.baseUrl = e;
31826
+ try {
31827
+ await this.fontManager.getAvailableFonts();
31828
+ } catch {
31829
+ }
31784
31830
  }
31785
31831
  /**
31786
31832
  * Render MText directly in the main thread asynchronously. Fonts referenced by
@@ -31861,7 +31907,13 @@ class t1 {
31861
31907
  destroy() {
31862
31908
  }
31863
31909
  async ensureInitialized() {
31864
- this.isInitialized || (this.fontManager.lazyFontLoading || await this.loadFonts(this.fontManager.getFontsToLoad()), this.isInitialized = !0);
31910
+ if (!this.isInitialized) {
31911
+ try {
31912
+ await this.fontManager.getAvailableFonts();
31913
+ } catch {
31914
+ }
31915
+ this.fontManager.lazyFontLoading || await this.loadFonts(this.fontManager.getFontsToLoad()), this.isInitialized = !0;
31916
+ }
31865
31917
  }
31866
31918
  }
31867
31919
  class c1 {
@@ -31873,7 +31925,7 @@ class c1 {
31873
31925
  * when render mode is 'worker'.
31874
31926
  */
31875
31927
  constructor(e = "main", n = {}) {
31876
- this.webWorkerRenderer = null, this.webWorkerConfigured = !1, this.workerLazyFontLoading = null, this.workerAwaitFontsBeforeDraw = null, this.defaultMode = e, this.workerConfig = n, this.mainThreadRenderer = new t1(), this.renderer = this.mainThreadRenderer, e === "worker" && (this.renderer = this.ensureWebWorkerRenderer());
31928
+ this.webWorkerRenderer = null, this.webWorkerConfigured = !1, this.workerLazyFontLoading = null, this.workerAwaitFontsBeforeDraw = null, this.workerFontUrl = null, this.defaultMode = e, this.workerConfig = n, this.mainThreadRenderer = new t1(), this.renderer = this.mainThreadRenderer, e === "worker" && (this.renderer = this.ensureWebWorkerRenderer());
31877
31929
  }
31878
31930
  ensureWebWorkerRenderer() {
31879
31931
  return this.webWorkerRenderer || (this.webWorkerRenderer = new e1(this.workerConfig), this.webWorkerRenderer.styleManager = this.mainThreadRenderer.styleManager, this.webWorkerConfigured = !1), this.webWorkerRenderer;
@@ -31884,10 +31936,12 @@ class c1 {
31884
31936
  [...$.instance.defaultFonts],
31885
31937
  [...$.instance.symbolFonts]
31886
31938
  ), this.webWorkerConfigured = !0);
31887
- const n = $.instance.lazyFontLoading;
31888
- this.workerLazyFontLoading !== n && (await e.setLazyFontLoading(n), this.workerLazyFontLoading = n);
31889
- const r = $.instance.awaitFontsBeforeDraw;
31890
- return this.workerAwaitFontsBeforeDraw !== r && (await e.setAwaitFontsBeforeDraw(r), this.workerAwaitFontsBeforeDraw = r), e;
31939
+ const n = $.instance.baseUrl;
31940
+ n && this.workerFontUrl !== n && (await e.setFontUrl(n), this.workerFontUrl = n);
31941
+ const r = $.instance.lazyFontLoading;
31942
+ this.workerLazyFontLoading !== r && (await e.setLazyFontLoading(r), this.workerLazyFontLoading = r);
31943
+ const s = $.instance.awaitFontsBeforeDraw;
31944
+ return this.workerAwaitFontsBeforeDraw !== s && (await e.setAwaitFontsBeforeDraw(s), this.workerAwaitFontsBeforeDraw = s), e;
31891
31945
  }
31892
31946
  /**
31893
31947
  * Sets one new style manager to override the default style manager.
@@ -31913,8 +31967,8 @@ class c1 {
31913
31967
  * Set URL to load fonts
31914
31968
  * @param value - URL to load fonts
31915
31969
  */
31916
- setFontUrl(e) {
31917
- return this.renderer.setFontUrl(e);
31970
+ async setFontUrl(e) {
31971
+ await this.mainThreadRenderer.setFontUrl(e), this.webWorkerRenderer && (await this.webWorkerRenderer.setFontUrl(e), this.workerFontUrl = e);
31918
31972
  }
31919
31973
  /**
31920
31974
  * Get the default rendering mode
@@ -32046,7 +32100,7 @@ class c1 {
32046
32100
  fonts: []
32047
32101
  };
32048
32102
  try {
32049
- r = await ze.instance.getStorageStats();
32103
+ r = await Ue.instance.getStorageStats();
32050
32104
  } catch {
32051
32105
  }
32052
32106
  const s = e.totalEstimatedBytes + n.reduce((i, a) => i + a.totalEstimatedBytes, 0);
@@ -32076,7 +32130,7 @@ class c1 {
32076
32130
  */
32077
32131
  terminateWorkers() {
32078
32132
  var e;
32079
- (e = this.webWorkerRenderer) == null || e.terminate(), this.webWorkerRenderer = null, this.webWorkerConfigured = !1, this.workerLazyFontLoading = null, this.renderer = this.mainThreadRenderer;
32133
+ (e = this.webWorkerRenderer) == null || e.terminate(), this.webWorkerRenderer = null, this.webWorkerConfigured = !1, this.workerLazyFontLoading = null, this.workerAwaitFontsBeforeDraw = null, this.workerFontUrl = null, this.renderer = this.mainThreadRenderer;
32080
32134
  }
32081
32135
  /**
32082
32136
  * Clean up resources
@@ -32092,7 +32146,7 @@ export {
32092
32146
  ue as CharBoxType,
32093
32147
  Ar as DEFAULT_FONTS_PRESETS,
32094
32148
  Gi as DEFAULT_LINE_SPACE_FACTOR,
32095
- F0 as DefaultFontLoader,
32149
+ T0 as DefaultFontLoader,
32096
32150
  gs as EventManager,
32097
32151
  Ze as FontFactory,
32098
32152
  $ as FontManager,
@@ -32106,15 +32160,15 @@ export {
32106
32160
  Q as MTextAttachmentPoint,
32107
32161
  bt as MTextColor,
32108
32162
  ln as MTextContext,
32109
- Ge as MTextFlowDirection,
32163
+ He as MTextFlowDirection,
32110
32164
  dt as MTextLineAlignment,
32111
32165
  oe as MTextParagraphAlignment,
32112
32166
  _0 as MTextParser,
32113
32167
  ht as MTextStroke,
32114
32168
  vr as MTextToken,
32115
32169
  t1 as MainThreadRenderer,
32116
- Tc as SHX_PARSED_FONT_OVERHEAD,
32117
- Tn as STACK_DIVIDER_CHAR,
32170
+ Fc as SHX_PARSED_FONT_OVERHEAD,
32171
+ Fn as STACK_DIVIDER_CHAR,
32118
32172
  bn as STACK_VERTICAL_SHIFT_FACTOR,
32119
32173
  Zn as SYMBOL_FONTS_PRESETS,
32120
32174
  Xi as Shape,