@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.
@@ -1195,7 +1195,7 @@ class Wi {
1195
1195
  * Copyright 2010-2024 Three.js Authors
1196
1196
  * SPDX-License-Identifier: MIT
1197
1197
  */
1198
- const hh = "172", Vr = 0, iu = 1, za = 1, Ha = 100, Ga = 204, Va = 205, Wa = 3, ru = 0, lh = 300, qa = 1e3, Os = 1001, ja = 1002, au = 1006, ou = 1008, cu = 1009, hu = 1015, lu = 1023, uh = "", re = "srgb", Xa = "srgb-linear", Ya = "linear", qi = "srgb", bn = 7680, $a = 519, Za = 35044, _s = 2e3, Ja = 2001;
1198
+ const hh = "172", Vr = 0, iu = 1, za = 1, Ha = 100, Ga = 204, Va = 205, Wa = 3, ru = 0, lh = 300, qa = 1e3, Os = 1001, ja = 1002, au = 1006, ou = 1008, cu = 1009, hu = 1015, lu = 1023, uh = "", ae = "srgb", Xa = "srgb-linear", Ya = "linear", qi = "srgb", bn = 7680, $a = 519, Za = 35044, _s = 2e3, Ja = 2001;
1199
1199
  class Ii {
1200
1200
  addEventListener(t, e) {
1201
1201
  this._listeners === void 0 && (this._listeners = {});
@@ -1751,17 +1751,17 @@ function pu() {
1751
1751
  toXYZ: Qa,
1752
1752
  fromXYZ: to,
1753
1753
  luminanceCoefficients: e,
1754
- workingColorSpaceConfig: { unpackColorSpace: re },
1755
- outputColorSpaceConfig: { drawingBufferColorSpace: re }
1754
+ workingColorSpaceConfig: { unpackColorSpace: ae },
1755
+ outputColorSpaceConfig: { drawingBufferColorSpace: ae }
1756
1756
  },
1757
- [re]: {
1757
+ [ae]: {
1758
1758
  primaries: t,
1759
1759
  whitePoint: s,
1760
1760
  transfer: qi,
1761
1761
  toXYZ: Qa,
1762
1762
  fromXYZ: to,
1763
1763
  luminanceCoefficients: e,
1764
- outputColorSpaceConfig: { drawingBufferColorSpace: re }
1764
+ outputColorSpaceConfig: { drawingBufferColorSpace: ae }
1765
1765
  }
1766
1766
  }), n;
1767
1767
  }
@@ -3134,8 +3134,8 @@ class mt {
3134
3134
  return this.multiplyMatrices(t, this);
3135
3135
  }
3136
3136
  multiplyMatrices(t, e) {
3137
- const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[4], c = s[8], h = s[12], l = s[1], u = s[5], f = s[9], p = s[13], d = s[2], g = s[6], x = s[10], b = s[14], S = s[3], v = s[7], w = s[11], F = s[15], M = i[0], O = i[4], I = i[8], H = i[12], R = i[1], W = i[5], J = i[9], D = i[13], U = i[2], P = i[6], Q = i[10], yt = i[14], Pt = i[3], Ct = i[7], ut = i[11], j = i[15];
3138
- return r[0] = a * M + o * R + c * U + h * Pt, r[4] = a * O + o * W + c * P + h * Ct, r[8] = a * I + o * J + c * Q + h * ut, r[12] = a * H + o * D + c * yt + h * j, r[1] = l * M + u * R + f * U + p * Pt, r[5] = l * O + u * W + f * P + p * Ct, r[9] = l * I + u * J + f * Q + p * ut, r[13] = l * H + u * D + f * yt + p * j, r[2] = d * M + g * R + x * U + b * Pt, r[6] = d * O + g * W + x * P + b * Ct, r[10] = d * I + g * J + x * Q + b * ut, r[14] = d * H + g * D + x * yt + b * j, r[3] = S * M + v * R + w * U + F * Pt, r[7] = S * O + v * W + w * P + F * Ct, r[11] = S * I + v * J + w * Q + F * ut, r[15] = S * H + v * D + w * yt + F * j, this;
3137
+ const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[4], c = s[8], h = s[12], l = s[1], u = s[5], f = s[9], p = s[13], d = s[2], g = s[6], x = s[10], b = s[14], S = s[3], v = s[7], w = s[11], F = s[15], M = i[0], O = i[4], I = i[8], H = i[12], R = i[1], W = i[5], J = i[9], D = i[13], U = i[2], P = i[6], Q = i[10], yt = i[14], Pt = i[3], Tt = i[7], ut = i[11], j = i[15];
3138
+ return r[0] = a * M + o * R + c * U + h * Pt, r[4] = a * O + o * W + c * P + h * Tt, r[8] = a * I + o * J + c * Q + h * ut, r[12] = a * H + o * D + c * yt + h * j, r[1] = l * M + u * R + f * U + p * Pt, r[5] = l * O + u * W + f * P + p * Tt, r[9] = l * I + u * J + f * Q + p * ut, r[13] = l * H + u * D + f * yt + p * j, r[2] = d * M + g * R + x * U + b * Pt, r[6] = d * O + g * W + x * P + b * Tt, r[10] = d * I + g * J + x * Q + b * ut, r[14] = d * H + g * D + x * yt + b * j, r[3] = S * M + v * R + w * U + F * Pt, r[7] = S * O + v * W + w * P + F * Tt, r[11] = S * I + v * J + w * Q + F * ut, r[15] = S * H + v * D + w * yt + F * j, this;
3139
3139
  }
3140
3140
  multiplyScalar(t) {
3141
3141
  const e = this.elements;
@@ -3803,7 +3803,7 @@ Xt.DEFAULT_UP = /* @__PURE__ */ new E(0, 1, 0);
3803
3803
  Xt.DEFAULT_MATRIX_AUTO_UPDATE = !0;
3804
3804
  Xt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
3805
3805
  const ie = /* @__PURE__ */ new E(), Ee = /* @__PURE__ */ new E(), nr = /* @__PURE__ */ new E(), Me = /* @__PURE__ */ new E(), kn = /* @__PURE__ */ new E(), En = /* @__PURE__ */ new E(), ho = /* @__PURE__ */ new E(), sr = /* @__PURE__ */ new E(), ir = /* @__PURE__ */ new E(), rr = /* @__PURE__ */ new E(), ar = /* @__PURE__ */ new Ss(), or = /* @__PURE__ */ new Ss(), cr = /* @__PURE__ */ new Ss();
3806
- class ce {
3806
+ class he {
3807
3807
  constructor(t = new E(), e = new E(), s = new E()) {
3808
3808
  this.a = t, this.b = e, this.c = s;
3809
3809
  }
@@ -3856,22 +3856,22 @@ class ce {
3856
3856
  return t.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
3857
3857
  }
3858
3858
  getNormal(t) {
3859
- return ce.getNormal(this.a, this.b, this.c, t);
3859
+ return he.getNormal(this.a, this.b, this.c, t);
3860
3860
  }
3861
3861
  getPlane(t) {
3862
3862
  return t.setFromCoplanarPoints(this.a, this.b, this.c);
3863
3863
  }
3864
3864
  getBarycoord(t, e) {
3865
- return ce.getBarycoord(t, this.a, this.b, this.c, e);
3865
+ return he.getBarycoord(t, this.a, this.b, this.c, e);
3866
3866
  }
3867
3867
  getInterpolation(t, e, s, i, r) {
3868
- return ce.getInterpolation(t, this.a, this.b, this.c, e, s, i, r);
3868
+ return he.getInterpolation(t, this.a, this.b, this.c, e, s, i, r);
3869
3869
  }
3870
3870
  containsPoint(t) {
3871
- return ce.containsPoint(t, this.a, this.b, this.c);
3871
+ return he.containsPoint(t, this.a, this.b, this.c);
3872
3872
  }
3873
3873
  isFrontFacing(t) {
3874
- return ce.isFrontFacing(this.a, this.b, this.c, t);
3874
+ return he.isFrontFacing(this.a, this.b, this.c, t);
3875
3875
  }
3876
3876
  intersectsBox(t) {
3877
3877
  return t.intersectsTriangle(this);
@@ -4075,7 +4075,7 @@ class $n {
4075
4075
  setScalar(t) {
4076
4076
  return this.r = t, this.g = t, this.b = t, this;
4077
4077
  }
4078
- setHex(t, e = re) {
4078
+ setHex(t, e = ae) {
4079
4079
  return t = Math.floor(t), this.r = (t >> 16 & 255) / 255, this.g = (t >> 8 & 255) / 255, this.b = (t & 255) / 255, ee.toWorkingColorSpace(this, e), this;
4080
4080
  }
4081
4081
  setRGB(t, e, s, i = ee.workingColorSpace) {
@@ -4090,7 +4090,7 @@ class $n {
4090
4090
  }
4091
4091
  return ee.toWorkingColorSpace(this, i), this;
4092
4092
  }
4093
- setStyle(t, e = re) {
4093
+ setStyle(t, e = ae) {
4094
4094
  function s(r) {
4095
4095
  r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + t + " will be ignored.");
4096
4096
  }
@@ -4145,7 +4145,7 @@ class $n {
4145
4145
  return this.setColorName(t, e);
4146
4146
  return this;
4147
4147
  }
4148
- setColorName(t, e = re) {
4148
+ setColorName(t, e = ae) {
4149
4149
  const s = ph[t.toLowerCase()];
4150
4150
  return s !== void 0 ? this.setHex(s, e) : console.warn("THREE.Color: Unknown color " + t), this;
4151
4151
  }
@@ -4167,10 +4167,10 @@ class $n {
4167
4167
  convertLinearToSRGB() {
4168
4168
  return this.copyLinearToSRGB(this), this;
4169
4169
  }
4170
- getHex(t = re) {
4170
+ getHex(t = ae) {
4171
4171
  return ee.fromWorkingColorSpace(Lt.copy(this), t), Math.round(Z(Lt.r * 255, 0, 255)) * 65536 + Math.round(Z(Lt.g * 255, 0, 255)) * 256 + Math.round(Z(Lt.b * 255, 0, 255));
4172
4172
  }
4173
- getHexString(t = re) {
4173
+ getHexString(t = ae) {
4174
4174
  return ("000000" + this.getHex(t).toString(16)).slice(-6);
4175
4175
  }
4176
4176
  getHSL(t, e = ee.workingColorSpace) {
@@ -4200,10 +4200,10 @@ class $n {
4200
4200
  getRGB(t, e = ee.workingColorSpace) {
4201
4201
  return ee.fromWorkingColorSpace(Lt.copy(this), e), t.r = Lt.r, t.g = Lt.g, t.b = Lt.b, t;
4202
4202
  }
4203
- getStyle(t = re) {
4203
+ getStyle(t = ae) {
4204
4204
  ee.fromWorkingColorSpace(Lt.copy(this), t);
4205
4205
  const e = Lt.r, s = Lt.g, i = Lt.b;
4206
- return t !== re ? `color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})` : `rgb(${Math.round(e * 255)},${Math.round(s * 255)},${Math.round(i * 255)})`;
4206
+ return t !== ae ? `color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})` : `rgb(${Math.round(e * 255)},${Math.round(s * 255)},${Math.round(i * 255)})`;
4207
4207
  }
4208
4208
  offsetHSL(t, e, s) {
4209
4209
  return this.getHSL(He), this.setHSL(He.h + t, He.s + e, He.l + s);
@@ -4362,7 +4362,7 @@ class gh extends dh {
4362
4362
  }
4363
4363
  }
4364
4364
  const xt = /* @__PURE__ */ new E(), zs = /* @__PURE__ */ new X();
4365
- class le {
4365
+ class ue {
4366
4366
  constructor(t, e, s = !1) {
4367
4367
  if (Array.isArray(t))
4368
4368
  throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
@@ -4481,17 +4481,17 @@ class le {
4481
4481
  return this.name !== "" && (t.name = this.name), this.usage !== Za && (t.usage = this.usage), t;
4482
4482
  }
4483
4483
  }
4484
- class ku extends le {
4484
+ class ku extends ue {
4485
4485
  constructor(t, e, s) {
4486
4486
  super(new Uint16Array(t), e, s);
4487
4487
  }
4488
4488
  }
4489
- class Eu extends le {
4489
+ class Eu extends ue {
4490
4490
  constructor(t, e, s) {
4491
4491
  super(new Uint32Array(t), e, s);
4492
4492
  }
4493
4493
  }
4494
- class un extends le {
4494
+ class un extends ue {
4495
4495
  constructor(t, e, s) {
4496
4496
  super(new Float32Array(t), e, s);
4497
4497
  }
@@ -4647,7 +4647,7 @@ class Dt extends Ii {
4647
4647
  return;
4648
4648
  }
4649
4649
  const s = e.position, i = e.normal, r = e.uv;
4650
- this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new le(new Float32Array(4 * s.count), 4));
4650
+ this.hasAttribute("tangent") === !1 && this.setAttribute("tangent", new ue(new Float32Array(4 * s.count), 4));
4651
4651
  const a = this.getAttribute("tangent"), o = [], c = [];
4652
4652
  for (let I = 0; I < s.count; I++)
4653
4653
  o[I] = new E(), c[I] = new E();
@@ -4690,7 +4690,7 @@ class Dt extends Ii {
4690
4690
  if (e !== void 0) {
4691
4691
  let s = this.getAttribute("normal");
4692
4692
  if (s === void 0)
4693
- s = new le(new Float32Array(e.count * 3), 3), this.setAttribute("normal", s);
4693
+ s = new ue(new Float32Array(e.count * 3), 3), this.setAttribute("normal", s);
4694
4694
  else
4695
4695
  for (let f = 0, p = s.count; f < p; f++)
4696
4696
  s.setXYZ(f, 0, 0, 0);
@@ -4720,7 +4720,7 @@ class Dt extends Ii {
4720
4720
  for (let b = 0; b < l; b++)
4721
4721
  f[d++] = h[p++];
4722
4722
  }
4723
- return new le(f, l, u);
4723
+ return new ue(f, l, u);
4724
4724
  }
4725
4725
  if (this.index === null)
4726
4726
  return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
@@ -4918,7 +4918,7 @@ function Xs(n, t, e, s, i, r, a, o, c, h) {
4918
4918
  const l = Ou(n, t, e, s, Gs, Vs, Ws, fo);
4919
4919
  if (l) {
4920
4920
  const u = new E();
4921
- ce.getBarycoord(fo, Gs, Vs, Ws, u), i && (l.uv = ce.getInterpolatedAttribute(i, o, c, h, u, new X())), r && (l.uv1 = ce.getInterpolatedAttribute(r, o, c, h, u, new X())), a && (l.normal = ce.getInterpolatedAttribute(a, o, c, h, u, new E()), l.normal.dot(s.direction) > 0 && l.normal.multiplyScalar(-1));
4921
+ he.getBarycoord(fo, Gs, Vs, Ws, u), i && (l.uv = he.getInterpolatedAttribute(i, o, c, h, u, new X())), r && (l.uv1 = he.getInterpolatedAttribute(r, o, c, h, u, new X())), a && (l.normal = he.getInterpolatedAttribute(a, o, c, h, u, new E()), l.normal.dot(s.direction) > 0 && l.normal.multiplyScalar(-1));
4922
4922
  const f = {
4923
4923
  a: o,
4924
4924
  b: c,
@@ -4926,7 +4926,7 @@ function Xs(n, t, e, s, i, r, a, o, c, h) {
4926
4926
  normal: new E(),
4927
4927
  materialIndex: 0
4928
4928
  };
4929
- ce.getNormal(Gs, Vs, Ws, f.normal), l.face = f, l.barycoord = u;
4929
+ he.getNormal(Gs, Vs, Ws, f.normal), l.face = f, l.barycoord = u;
4930
4930
  }
4931
4931
  return l;
4932
4932
  }
@@ -8900,7 +8900,7 @@ const on = {
8900
8900
  }
8901
8901
  };
8902
8902
  jt.DATABASE_NAME = "mlightcad", jt.DATABASE_VERSION = xr[xr.length - 1].version;
8903
- let ge = jt;
8903
+ let re = jt;
8904
8904
  const np = 512;
8905
8905
  function sp(n, t) {
8906
8906
  return (n + t) * np;
@@ -8918,6 +8918,8 @@ const Qr = {
8918
8918
  r12r14: ["txt", "simplex", "romans", "gbcbig", "simsun"],
8919
8919
  // Mesh/TTF first so missing style fonts (e.g. "标准") get correct Latin metrics.
8920
8920
  // BIGFONT SHX stays available via glyph fallback for CJK coverage.
8921
+ // Korean/Japanese faces are not in this preset — load on demand via style
8922
+ // names (e.g. `malgun`) or switch to the `korean` / `cjk` presets.
8921
8923
  modern: ["simsun", "hztxt"],
8922
8924
  international: ["txt", "simplex", "romans", "simsun"],
8923
8925
  // Full CJK: mesh faces for CN/KR/JP, then matching SHX big fonts.
@@ -8976,7 +8978,7 @@ var Nh = new ys(), zh = new ys(), ma = new Uint8Array(30), ya = new Uint16Array(
8976
8978
  14,
8977
8979
  1,
8978
8980
  15
8979
- ]), Uo = new ys(), de = new Uint8Array(320);
8981
+ ]), Uo = new ys(), ge = new Uint8Array(320);
8980
8982
  function Vh(n, t, e, s) {
8981
8983
  var i, r;
8982
8984
  for (i = 0; i < e; ++i) n[i] = 0;
@@ -9028,33 +9030,33 @@ function ta(n, t) {
9028
9030
  }
9029
9031
  function lp(n, t, e) {
9030
9032
  var s, i, r, a, o, c;
9031
- for (s = ye(n, 5, 257), i = ye(n, 5, 1), r = ye(n, 4, 4), a = 0; a < 19; ++a) de[a] = 0;
9033
+ for (s = ye(n, 5, 257), i = ye(n, 5, 1), r = ye(n, 4, 4), a = 0; a < 19; ++a) ge[a] = 0;
9032
9034
  for (a = 0; a < r; ++a) {
9033
9035
  var h = ye(n, 3, 0);
9034
- de[op[a]] = h;
9036
+ ge[op[a]] = h;
9035
9037
  }
9036
- for (vr(Uo, de, 0, 19), o = 0; o < s + i; ) {
9038
+ for (vr(Uo, ge, 0, 19), o = 0; o < s + i; ) {
9037
9039
  var l = ta(n, Uo);
9038
9040
  switch (l) {
9039
9041
  case 16:
9040
- var u = de[o - 1];
9042
+ var u = ge[o - 1];
9041
9043
  for (c = ye(n, 2, 3); c; --c)
9042
- de[o++] = u;
9044
+ ge[o++] = u;
9043
9045
  break;
9044
9046
  case 17:
9045
9047
  for (c = ye(n, 3, 3); c; --c)
9046
- de[o++] = 0;
9048
+ ge[o++] = 0;
9047
9049
  break;
9048
9050
  case 18:
9049
9051
  for (c = ye(n, 7, 11); c; --c)
9050
- de[o++] = 0;
9052
+ ge[o++] = 0;
9051
9053
  break;
9052
9054
  default:
9053
- de[o++] = l;
9055
+ ge[o++] = l;
9054
9056
  break;
9055
9057
  }
9056
9058
  }
9057
- vr(t, de, 0, s), vr(e, de, s, i);
9059
+ vr(t, ge, 0, s), vr(e, ge, s, i);
9058
9060
  }
9059
9061
  function No(n, t, e) {
9060
9062
  for (; ; ) {
@@ -9448,7 +9450,7 @@ function zo(n, t) {
9448
9450
  n || Yh(t);
9449
9451
  }
9450
9452
  var V = { fail: Yh, argument: zo, assert: zo }, Ho = 32768, Go = 2147483648, dp = -32768, gp = 32767 + 1 / 65536, Wn = {}, N = {}, q = {};
9451
- function pe(n) {
9453
+ function de(n) {
9452
9454
  return function() {
9453
9455
  return n;
9454
9456
  };
@@ -9456,11 +9458,11 @@ function pe(n) {
9456
9458
  N.BYTE = function(n) {
9457
9459
  return V.argument(n >= 0 && n <= 255, "Byte value should be between 0 and 255."), [n];
9458
9460
  };
9459
- q.BYTE = pe(1);
9461
+ q.BYTE = de(1);
9460
9462
  N.CHAR = function(n) {
9461
9463
  return [n.charCodeAt(0)];
9462
9464
  };
9463
- q.CHAR = pe(1);
9465
+ q.CHAR = de(1);
9464
9466
  N.CHARARRAY = function(n) {
9465
9467
  (n === null || typeof n > "u") && (n = "", console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));
9466
9468
  const t = [];
@@ -9474,23 +9476,23 @@ q.CHARARRAY = function(n) {
9474
9476
  N.USHORT = function(n) {
9475
9477
  return [n >> 8 & 255, n & 255];
9476
9478
  };
9477
- q.USHORT = pe(2);
9479
+ q.USHORT = de(2);
9478
9480
  N.SHORT = function(n) {
9479
9481
  return n >= Ho && (n = -(2 * Ho - n)), [n >> 8 & 255, n & 255];
9480
9482
  };
9481
- q.SHORT = pe(2);
9483
+ q.SHORT = de(2);
9482
9484
  N.UINT24 = function(n) {
9483
9485
  return [n >> 16 & 255, n >> 8 & 255, n & 255];
9484
9486
  };
9485
- q.UINT24 = pe(3);
9487
+ q.UINT24 = de(3);
9486
9488
  N.ULONG = function(n) {
9487
9489
  return [n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, n & 255];
9488
9490
  };
9489
- q.ULONG = pe(4);
9491
+ q.ULONG = de(4);
9490
9492
  N.LONG = function(n) {
9491
9493
  return n >= Go && (n = -(2 * Go - n)), [n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, n & 255];
9492
9494
  };
9493
- q.LONG = pe(4);
9495
+ q.LONG = de(4);
9494
9496
  N.FLOAT = function(n) {
9495
9497
  if (n > gp || n < dp)
9496
9498
  throw new Error(`Value ${n} is outside the range of representable values in 16.16 format`);
@@ -9511,7 +9513,7 @@ q.F2DOT14 = q.USHORT;
9511
9513
  N.LONGDATETIME = function(n) {
9512
9514
  return [0, 0, 0, 0, n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, n & 255];
9513
9515
  };
9514
- q.LONGDATETIME = pe(8);
9516
+ q.LONGDATETIME = de(8);
9515
9517
  N.TAG = function(n) {
9516
9518
  return V.argument(n.length === 4, "Tag should be exactly 4 ASCII characters."), [
9517
9519
  n.charCodeAt(0),
@@ -9520,7 +9522,7 @@ N.TAG = function(n) {
9520
9522
  n.charCodeAt(3)
9521
9523
  ];
9522
9524
  };
9523
- q.TAG = pe(4);
9525
+ q.TAG = de(4);
9524
9526
  N.Card8 = N.BYTE;
9525
9527
  q.Card8 = q.BYTE;
9526
9528
  N.Card16 = N.USHORT;
@@ -9538,11 +9540,11 @@ q.NUMBER = function(n) {
9538
9540
  N.NUMBER16 = function(n) {
9539
9541
  return [28, n >> 8 & 255, n & 255];
9540
9542
  };
9541
- q.NUMBER16 = pe(3);
9543
+ q.NUMBER16 = de(3);
9542
9544
  N.NUMBER32 = function(n) {
9543
9545
  return [29, n >> 24 & 255, n >> 16 & 255, n >> 8 & 255, n & 255];
9544
9546
  };
9545
- q.NUMBER32 = pe(5);
9547
+ q.NUMBER32 = de(5);
9546
9548
  N.REAL = function(n) {
9547
9549
  let t = n.toString();
9548
9550
  const e = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);
@@ -13467,7 +13469,7 @@ function Sa(n, t, e = 0, s = "hexa") {
13467
13469
  const a = rl(i.colorRecords[r]);
13468
13470
  return s === "bgra" ? a : Xn(a, s);
13469
13471
  }
13470
- function ae(n) {
13472
+ function oe(n) {
13471
13473
  return ("0" + parseInt(n).toString(16)).slice(-2);
13472
13474
  }
13473
13475
  function td(n) {
@@ -13509,7 +13511,7 @@ function ed(n) {
13509
13511
  };
13510
13512
  }
13511
13513
  function al(n) {
13512
- return parseInt(`0x${ae(n.b)}${ae(n.g)}${ae(n.r)}${ae(n.a * 255)}`, 16);
13514
+ return parseInt(`0x${oe(n.b)}${oe(n.g)}${oe(n.r)}${oe(n.a * 255)}`, 16);
13513
13515
  }
13514
13516
  function Mi(n, t = "hexa") {
13515
13517
  const e = t == "raw" || t == "cpal", s = Number.isInteger(n);
@@ -13608,11 +13610,11 @@ function Xn(n, t = "hexa") {
13608
13610
  case "hex":
13609
13611
  case "hex6":
13610
13612
  case "hex-6":
13611
- return `#${ae(n.r)}${ae(n.g)}${ae(n.b)}`;
13613
+ return `#${oe(n.r)}${oe(n.g)}${oe(n.b)}`;
13612
13614
  case "hexa":
13613
13615
  case "hex8":
13614
13616
  case "hex-8":
13615
- return `#${ae(n.r)}${ae(n.g)}${ae(n.b)}${ae(n.a * 255)}`;
13617
+ return `#${oe(n.r)}${oe(n.g)}${oe(n.b)}${oe(n.a * 255)}`;
13616
13618
  case "hsl":
13617
13619
  return `hsl(${e.h.toFixed(2)}, ${e.s.toFixed(2)}%, ${e.l.toFixed(2)}%)`;
13618
13620
  case "hsla":
@@ -14198,7 +14200,7 @@ function ra(n, t, e, s, i) {
14198
14200
  U = (l.length & 1) !== 0, U && !f && (R = l.shift() + v), u += l.length >> 1, l.length = 0, f = !0;
14199
14201
  }
14200
14202
  function D(U) {
14201
- let P, Q, yt, Pt, Ct, ut, j, rt, bt, kt, St, Tt, ht = 0;
14203
+ let P, Q, yt, Pt, Tt, ut, j, rt, bt, kt, St, Ft, ht = 0;
14202
14204
  for (; ht < U.length; ) {
14203
14205
  let Mt = U[ht];
14204
14206
  switch (ht += 1, Mt) {
@@ -14228,7 +14230,7 @@ function ra(n, t, e, s, i) {
14228
14230
  r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c + l.shift(), h.curveTo(r, a, o, c, d, g);
14229
14231
  break;
14230
14232
  case 10:
14231
- if (Ct = l.pop() + b, ut = x[Ct], ut) {
14233
+ if (Tt = l.pop() + b, ut = x[Tt], ut) {
14232
14234
  if (O >= Xo) {
14233
14235
  console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");
14234
14236
  break;
@@ -14245,16 +14247,16 @@ function ra(n, t, e, s, i) {
14245
14247
  case 12:
14246
14248
  switch (Mt = U[ht], ht += 1, Mt) {
14247
14249
  case 35:
14248
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c + l.shift(), bt = j + l.shift(), kt = rt + l.shift(), St = bt + l.shift(), Tt = kt + l.shift(), d = St + l.shift(), g = Tt + l.shift(), l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Tt, d, g);
14250
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c + l.shift(), bt = j + l.shift(), kt = rt + l.shift(), St = bt + l.shift(), Ft = kt + l.shift(), d = St + l.shift(), g = Ft + l.shift(), l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Ft, d, g);
14249
14251
  break;
14250
14252
  case 34:
14251
- r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c, bt = j + l.shift(), kt = c, St = bt + l.shift(), Tt = g, d = St + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Tt, d, g);
14253
+ r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c, bt = j + l.shift(), kt = c, St = bt + l.shift(), Ft = g, d = St + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Ft, d, g);
14252
14254
  break;
14253
14255
  case 36:
14254
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c, bt = j + l.shift(), kt = c, St = bt + l.shift(), Tt = kt + l.shift(), d = St + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Tt, d, g);
14256
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c, bt = j + l.shift(), kt = c, St = bt + l.shift(), Ft = kt + l.shift(), d = St + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Ft, d, g);
14255
14257
  break;
14256
14258
  case 37:
14257
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c + l.shift(), bt = j + l.shift(), kt = rt + l.shift(), St = bt + l.shift(), Tt = kt + l.shift(), Math.abs(St - d) > Math.abs(Tt - g) ? d = St + l.shift() : g = Tt + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Tt, d, g);
14259
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c + l.shift(), bt = j + l.shift(), kt = rt + l.shift(), St = bt + l.shift(), Ft = kt + l.shift(), Math.abs(St - d) > Math.abs(Ft - g) ? d = St + l.shift() : g = Ft + l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, kt, St, Ft, d, g);
14258
14260
  break;
14259
14261
  default:
14260
14262
  console.log("Glyph " + t.index + ": unknown operator 1200" + Mt), l.length = 0;
@@ -14351,7 +14353,7 @@ function ra(n, t, e, s, i) {
14351
14353
  P = U[ht], Q = U[ht + 1], l.push((P << 24 | Q << 16) >> 16), ht += 2;
14352
14354
  break;
14353
14355
  case 29:
14354
- if (Ct = l.pop() + n.gsubrsBias, ut = n.gsubrs[Ct], ut) {
14356
+ if (Tt = l.pop() + n.gsubrsBias, ut = n.gsubrs[Tt], ut) {
14355
14357
  if (O >= Xo) {
14356
14358
  console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");
14357
14359
  break;
@@ -15101,8 +15103,8 @@ function Xd(n) {
15101
15103
  { name: "maxMemType1", type: "ULONG", value: c }
15102
15104
  ]);
15103
15105
  }
15104
- var bl = { parse: jd, make: Xd }, ue = new Array(9);
15105
- ue[1] = function() {
15106
+ var bl = { parse: jd, make: Xd }, fe = new Array(9);
15107
+ fe[1] = function() {
15106
15108
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
15107
15109
  if (e === 1)
15108
15110
  return {
@@ -15118,7 +15120,7 @@ ue[1] = function() {
15118
15120
  };
15119
15121
  V.assert(!1, "0x" + t.toString(16) + ": lookup type 1 format must be 1 or 2.");
15120
15122
  };
15121
- ue[2] = function() {
15123
+ fe[2] = function() {
15122
15124
  const t = this.parseUShort();
15123
15125
  return V.argument(t === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
15124
15126
  substFormat: t,
@@ -15126,7 +15128,7 @@ ue[2] = function() {
15126
15128
  sequences: this.parseListOfLists()
15127
15129
  };
15128
15130
  };
15129
- ue[3] = function() {
15131
+ fe[3] = function() {
15130
15132
  const t = this.parseUShort();
15131
15133
  return V.argument(t === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
15132
15134
  substFormat: t,
@@ -15134,7 +15136,7 @@ ue[3] = function() {
15134
15136
  alternateSets: this.parseListOfLists()
15135
15137
  };
15136
15138
  };
15137
- ue[4] = function() {
15139
+ fe[4] = function() {
15138
15140
  const t = this.parseUShort();
15139
15141
  return V.argument(t === 1, "GSUB ligature table identifier-format must be 1"), {
15140
15142
  substFormat: t,
@@ -15151,7 +15153,7 @@ var Nn = {
15151
15153
  sequenceIndex: A.uShort,
15152
15154
  lookupListIndex: A.uShort
15153
15155
  };
15154
- ue[5] = function() {
15156
+ fe[5] = function() {
15155
15157
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
15156
15158
  if (e === 1)
15157
15159
  return {
@@ -15188,7 +15190,7 @@ ue[5] = function() {
15188
15190
  }
15189
15191
  V.assert(!1, "0x" + t.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
15190
15192
  };
15191
- ue[6] = function() {
15193
+ fe[6] = function() {
15192
15194
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
15193
15195
  if (e === 1)
15194
15196
  return {
@@ -15229,17 +15231,17 @@ ue[6] = function() {
15229
15231
  };
15230
15232
  V.assert(!1, "0x" + t.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
15231
15233
  };
15232
- ue[7] = function() {
15234
+ fe[7] = function() {
15233
15235
  const t = this.parseUShort();
15234
15236
  V.argument(t === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
15235
15237
  const e = this.parseUShort(), s = new A(this.data, this.offset + this.parseULong());
15236
15238
  return {
15237
15239
  substFormat: 1,
15238
15240
  lookupType: e,
15239
- extension: ue[e].call(s)
15241
+ extension: fe[e].call(s)
15240
15242
  };
15241
15243
  };
15242
- ue[8] = function() {
15244
+ fe[8] = function() {
15243
15245
  const t = this.parseUShort();
15244
15246
  return V.argument(t === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
15245
15247
  substFormat: t,
@@ -15256,12 +15258,12 @@ function Yd(n, t) {
15256
15258
  version: s,
15257
15259
  scripts: e.parseScriptList(),
15258
15260
  features: e.parseFeatureList(),
15259
- lookups: e.parseLookupList(ue)
15261
+ lookups: e.parseLookupList(fe)
15260
15262
  } : {
15261
15263
  version: s,
15262
15264
  scripts: e.parseScriptList(),
15263
15265
  features: e.parseFeatureList(),
15264
- lookups: e.parseLookupList(ue),
15266
+ lookups: e.parseLookupList(fe),
15265
15267
  variations: e.parseFeatureVariationsList()
15266
15268
  };
15267
15269
  }
@@ -16047,7 +16049,7 @@ function F0(n) {
16047
16049
  unitsPerEm: n.unitsPerEm,
16048
16050
  fontBBox: [0, d.yMin, d.ascender, d.advanceWidthMax],
16049
16051
  topDict: n.tables.cff && n.tables.cff.topDict || {}
16050
- }), Ct = n.metas && Object.keys(n.metas).length > 0 ? Sl.make(n.metas) : void 0, ut = [x, b, S, v, P, F, yt, Pt, w];
16052
+ }), Tt = n.metas && Object.keys(n.metas).length > 0 ? Sl.make(n.metas) : void 0, ut = [x, b, S, v, P, F, yt, Pt, w];
16051
16053
  Q && ut.push(Q);
16052
16054
  const j = {
16053
16055
  gsub: vl,
@@ -16071,12 +16073,12 @@ function F0(n) {
16071
16073
  Nt && ut.push(Nt);
16072
16074
  }
16073
16075
  }
16074
- Ct && ut.push(Ct);
16075
- const bt = Ol(ut), kt = bt.encode(), St = Fa(kt), Tt = bt.fields;
16076
+ Tt && ut.push(Tt);
16077
+ const bt = Ol(ut), kt = bt.encode(), St = Fa(kt), Ft = bt.fields;
16076
16078
  let ht = !1;
16077
- for (let tt = 0; tt < Tt.length; tt += 1)
16078
- if (Tt[tt].name === "head table") {
16079
- Tt[tt].value.checkSumAdjustment = 2981146554 - St, ht = !0;
16079
+ for (let tt = 0; tt < Ft.length; tt += 1)
16080
+ if (Ft[tt].name === "head table") {
16081
+ Ft[tt].value.checkSumAdjustment = 2981146554 - St, ht = !0;
16080
16082
  break;
16081
16083
  }
16082
16084
  if (!ht)
@@ -20641,8 +20643,8 @@ function Gm(n, t) {
20641
20643
  };
20642
20644
  return s >= 1.2 && (i.markGlyphSets = e.parsePointer(Hm)), i;
20643
20645
  }
20644
- var Vm = { parse: Gm }, fe = new Array(10);
20645
- fe[1] = function() {
20646
+ var Vm = { parse: Gm }, pe = new Array(10);
20647
+ pe[1] = function() {
20646
20648
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
20647
20649
  if (e === 1)
20648
20650
  return {
@@ -20658,7 +20660,7 @@ fe[1] = function() {
20658
20660
  };
20659
20661
  V.assert(!1, "0x" + t.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
20660
20662
  };
20661
- fe[2] = function() {
20663
+ pe[2] = function() {
20662
20664
  const t = this.offset + this.relativeOffset, e = this.parseUShort();
20663
20665
  V.assert(e === 1 || e === 2, "0x" + t.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
20664
20666
  const s = this.parsePointer(A.coverage), i = this.parseUShort(), r = this.parseUShort();
@@ -20698,25 +20700,25 @@ fe[2] = function() {
20698
20700
  };
20699
20701
  }
20700
20702
  };
20701
- fe[3] = function() {
20703
+ pe[3] = function() {
20702
20704
  return { error: "GPOS Lookup 3 not supported" };
20703
20705
  };
20704
- fe[4] = function() {
20706
+ pe[4] = function() {
20705
20707
  return { error: "GPOS Lookup 4 not supported" };
20706
20708
  };
20707
- fe[5] = function() {
20709
+ pe[5] = function() {
20708
20710
  return { error: "GPOS Lookup 5 not supported" };
20709
20711
  };
20710
- fe[6] = function() {
20712
+ pe[6] = function() {
20711
20713
  return { error: "GPOS Lookup 6 not supported" };
20712
20714
  };
20713
- fe[7] = function() {
20715
+ pe[7] = function() {
20714
20716
  return { error: "GPOS Lookup 7 not supported" };
20715
20717
  };
20716
- fe[8] = function() {
20718
+ pe[8] = function() {
20717
20719
  return { error: "GPOS Lookup 8 not supported" };
20718
20720
  };
20719
- fe[9] = function() {
20721
+ pe[9] = function() {
20720
20722
  return { error: "GPOS Lookup 9 not supported" };
20721
20723
  };
20722
20724
  function Wm(n, t) {
@@ -20726,12 +20728,12 @@ function Wm(n, t) {
20726
20728
  version: s,
20727
20729
  scripts: e.parseScriptList(),
20728
20730
  features: e.parseFeatureList(),
20729
- lookups: e.parseLookupList(fe)
20731
+ lookups: e.parseLookupList(pe)
20730
20732
  } : {
20731
20733
  version: s,
20732
20734
  scripts: e.parseScriptList(),
20733
20735
  features: e.parseFeatureList(),
20734
- lookups: e.parseLookupList(fe),
20736
+ lookups: e.parseLookupList(pe),
20735
20737
  variations: e.parseFeatureVariationsList()
20736
20738
  };
20737
20739
  }
@@ -21119,7 +21121,7 @@ function Mc(n) {
21119
21121
  return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
21120
21122
  r += l.count * e;
21121
21123
  }
21122
- const a = new t(r), o = new le(a, e, s);
21124
+ const a = new t(r), o = new ue(a, e, s);
21123
21125
  let c = 0;
21124
21126
  for (let h = 0; h < n.length; ++h) {
21125
21127
  const l = n[h];
@@ -22049,7 +22051,7 @@ Oa.write = function(n, t, e, s, i, r) {
22049
22051
  for (C || (C = "utf8"); ; )
22050
22052
  switch (C) {
22051
22053
  case "hex":
22052
- return Ct(this, m, y);
22054
+ return Tt(this, m, y);
22053
22055
  case "utf8":
22054
22056
  case "utf-8":
22055
22057
  return U(this, m, y);
@@ -22297,7 +22299,7 @@ Oa.write = function(n, t, e, s, i, r) {
22297
22299
  T += String.fromCharCode(C[k]);
22298
22300
  return T;
22299
22301
  }
22300
- function Ct(C, m, y) {
22302
+ function Tt(C, m, y) {
22301
22303
  var T = C.length;
22302
22304
  (!m || m < 0) && (m = 0), (!y || y < 0 || y > T) && (y = T);
22303
22305
  for (var k = "", _ = m; _ < y; ++_)
@@ -22496,9 +22498,9 @@ Oa.write = function(n, t, e, s, i, r) {
22496
22498
  }
22497
22499
  return this;
22498
22500
  };
22499
- var Tt = /[^+/0-9A-Za-z-_]/g;
22501
+ var Ft = /[^+/0-9A-Za-z-_]/g;
22500
22502
  function ht(C) {
22501
- if (C = C.split("=")[0], C = C.trim().replace(Tt, ""), C.length < 2) return "";
22503
+ if (C = C.split("=")[0], C = C.trim().replace(Ft, ""), C.length < 2) return "";
22502
22504
  for (; C.length % 4 !== 0; )
22503
22505
  C = C + "=";
22504
22506
  return C;
@@ -33078,7 +33080,7 @@ class be {
33078
33080
  throw new Error("Unsupported font data type");
33079
33081
  }
33080
33082
  }
33081
- class he {
33083
+ class le {
33082
33084
  constructor() {
33083
33085
  this.fontMapping = {}, this.loadedFontMap = /* @__PURE__ */ new Map(), this.unsupportedChars = {}, this.missedFonts = {}, this.enableFontCache = !0, this.lazyFontLoading = !0, this.awaitFontsBeforeDraw = !1, this.defaultFonts = /* @__PURE__ */ new Set(["simsun"]), this.symbolFonts = /* @__PURE__ */ new Set(["simplex", "amgdt"]), this.events = {
33084
33086
  /** Event triggered when a font cannot be found */
@@ -33092,7 +33094,7 @@ class he {
33092
33094
  * @returns The FontManager instance
33093
33095
  */
33094
33096
  static get instance() {
33095
- return he._instance || (he._instance = new he()), he._instance;
33097
+ return le._instance || (le._instance = new le()), le._instance;
33096
33098
  }
33097
33099
  /**
33098
33100
  * Base URL to load fonts
@@ -33169,7 +33171,7 @@ class he {
33169
33171
  const r = qe(i.file).toLowerCase();
33170
33172
  e.set(r, { ...i, source: "remote" });
33171
33173
  }
33172
- const s = await ge.instance.getAll();
33174
+ const s = await re.instance.getAll();
33173
33175
  for (const i of s) {
33174
33176
  const r = i.name.toLowerCase();
33175
33177
  e.has(r) || e.set(r, this.cachedFontDataToFontInfo(i));
@@ -33228,7 +33230,7 @@ class he {
33228
33230
  const s = this.fontRequestInFlight.get(e);
33229
33231
  if (s)
33230
33232
  return s;
33231
- const i = this.loadEpoch, r = this.loadFontsByNames(e).then((a) => (i !== this.loadEpoch || (this.isFontLoaded(e) ? this.fontRequestFailed.delete(e) : this.fontRequestFailed.add(e)), a)).catch(() => (i === this.loadEpoch && this.fontRequestFailed.add(e), [
33233
+ const i = this.loadEpoch, r = this.loadFontsByNames(e).then((a) => (i !== this.loadEpoch || (this.isFontLoaded(e) ? this.fontRequestFailed.delete(e) : a.some((c) => c.status === "FailedToLoad") && this.fontRequestFailed.add(e)), a)).catch(() => (i === this.loadEpoch && this.fontRequestFailed.add(e), [
33232
33234
  {
33233
33235
  fontName: e,
33234
33236
  url: "",
@@ -33254,7 +33256,7 @@ class he {
33254
33256
  return "";
33255
33257
  let e = String(t);
33256
33258
  const s = e.lastIndexOf(".");
33257
- return (s > 0 && s == e.length - 4 || s == e.length - 5) && (e = e.substring(0, s)), e.toLowerCase();
33259
+ return s > 0 && (s === e.length - 4 || s === e.length - 5) && (e = e.substring(0, s)), e.toLowerCase();
33258
33260
  }
33259
33261
  /**
33260
33262
  * Parses a user-uploaded font file, registers it for rendering, and stores
@@ -33305,7 +33307,7 @@ class he {
33305
33307
  };
33306
33308
  try {
33307
33309
  const u = be.instance.createFont(l);
33308
- return h.forEach((f) => u.names.add(f)), this.registerFontInMap(o, u), this.enableFontCache && await ge.instance.set(o, l), this.events.fontLoaded.dispatch({ fontName: o }), {
33310
+ return h.forEach((f) => u.names.add(f)), this.registerFontInMap(o, u), this.enableFontCache && await re.instance.set(o, l), this.events.fontLoaded.dispatch({ fontName: o }), {
33309
33311
  fontName: o,
33310
33312
  url: "",
33311
33313
  status: "Success"
@@ -33332,7 +33334,7 @@ class he {
33332
33334
  const e = qe(t).toLowerCase();
33333
33335
  if (this.isFontLoaded(e))
33334
33336
  return !0;
33335
- const s = await ge.instance.find(t);
33337
+ const s = await re.instance.find(t);
33336
33338
  if (!s)
33337
33339
  return !1;
33338
33340
  try {
@@ -33357,12 +33359,12 @@ class he {
33357
33359
  i.forEach((r, a) => {
33358
33360
  const o = t[a].url, c = qe(
33359
33361
  t[a].file || o
33360
- ).toLowerCase(), h = r.status === "fulfilled" && this.isFontLoaded(c);
33362
+ ).toLowerCase(), h = t[a].name ?? [], l = r.status === "fulfilled" && (this.isFontLoaded(c) || h.some((u) => this.isFontLoaded(u)));
33361
33363
  s.push({
33362
33364
  fontName: c,
33363
33365
  url: o,
33364
- status: h ? "Success" : "FailedToLoad"
33365
- }), h && this.fileNames.push(c);
33366
+ status: l ? "Success" : "FailedToLoad"
33367
+ }), l && this.fileNames.push(c);
33366
33368
  });
33367
33369
  }), s;
33368
33370
  }
@@ -33386,7 +33388,7 @@ class he {
33386
33388
  return i = this.loadedFontMap.get(c.toLowerCase()), !i && this.lazyFontLoading && this.requestFont(c), this.recordMissedFonts(s, !1), c;
33387
33389
  }
33388
33390
  if (i)
33389
- return e;
33391
+ return s || e;
33390
33392
  this.recordMissedFonts(s, !0);
33391
33393
  const r = this.pickLoadedDefaultFont(!0);
33392
33394
  if (r)
@@ -33421,7 +33423,7 @@ class he {
33421
33423
  getFontByName(t, e = !0) {
33422
33424
  t == null && (t = "");
33423
33425
  const s = t.lastIndexOf(".");
33424
- (s > 0 && s == t.length - 4 || s == t.length - 5) && (t = t.substring(0, s));
33426
+ s > 0 && (s === t.length - 4 || s === t.length - 5) && (t = t.substring(0, s));
33425
33427
  const i = this.loadedFontMap.get(t.toLowerCase());
33426
33428
  if (!i) {
33427
33429
  e && this.recordMissedFonts(t);
@@ -33502,7 +33504,7 @@ class he {
33502
33504
  * @returns The scale factor for the font, or 1 if the font is not found
33503
33505
  */
33504
33506
  getFontScaleFactor(t) {
33505
- const e = this.loadedFontMap.get(t.toLowerCase());
33507
+ const e = this.getFontByName(t, !1);
33506
33508
  return e ? e.getScaleFactor() : 1;
33507
33509
  }
33508
33510
  /**
@@ -33511,8 +33513,8 @@ class he {
33511
33513
  * @returns The type of the font. If the specified font can't be found, `undefined` is returned
33512
33514
  */
33513
33515
  getFontType(t) {
33514
- const e = this.loadedFontMap.get(t.toLowerCase());
33515
- return e == null ? void 0 : e.type;
33516
+ var e;
33517
+ return (e = this.getFontByName(t, !1)) == null ? void 0 : e.type;
33516
33518
  }
33517
33519
  /**
33518
33520
  * Gets the type of the SHX font. Such as BIGFONT, SHAPES, UNIFONT.
@@ -33520,7 +33522,7 @@ class he {
33520
33522
  * @returns The type of the SHX font, or undefined if the specified font is not a SHX font
33521
33523
  */
33522
33524
  getShxFontType(t) {
33523
- const e = this.loadedFontMap.get(t.toLowerCase());
33525
+ const e = this.getFontByName(t, !1);
33524
33526
  return (e == null ? void 0 : e.type) === "shx" ? e.data.header.fontType : void 0;
33525
33527
  }
33526
33528
  /**
@@ -33540,7 +33542,8 @@ class he {
33540
33542
  * @returns True if the font is loaded, false otherwise
33541
33543
  */
33542
33544
  isFontLoaded(t) {
33543
- return this.loadedFontMap.has(t.toLowerCase());
33545
+ const e = this.normalizeFontName(t);
33546
+ return !!e && this.loadedFontMap.has(e);
33544
33547
  }
33545
33548
  /**
33546
33549
  * Applies a missed-font report from another isolate (e.g. a web worker).
@@ -33587,7 +33590,7 @@ class he {
33587
33590
  if (!t)
33588
33591
  return t;
33589
33592
  const e = t.lastIndexOf(".");
33590
- return e > 0 && e == t.length - 4 || e == t.length - 5 ? t.substring(0, e) : t;
33593
+ return e > 0 && (e === t.length - 4 || e === t.length - 5) ? t.substring(0, e) : t;
33591
33594
  }
33592
33595
  /**
33593
33596
  * Removes {@link missedFonts} entries whose name matches `fontName`
@@ -33634,13 +33637,13 @@ class he {
33634
33637
  async persistCatalogAliases(t, e) {
33635
33638
  if (!this.enableFontCache)
33636
33639
  return;
33637
- const s = await ge.instance.get(t);
33640
+ const s = await re.instance.get(t);
33638
33641
  if (!s)
33639
33642
  return;
33640
33643
  const i = [
33641
33644
  .../* @__PURE__ */ new Set([...s.alias ?? [], ...e, t])
33642
33645
  ], r = s.alias ?? [];
33643
- i.length === r.length && i.every((a) => r.includes(a)) || await ge.instance.set(t, {
33646
+ i.length === r.length && i.every((a) => r.includes(a)) || await re.instance.set(t, {
33644
33647
  ...s,
33645
33648
  alias: i
33646
33649
  });
@@ -33666,32 +33669,41 @@ class he {
33666
33669
  this.ensureCatalogAliases(i, r), this.clearRequestStateForNames([i, ...r]), await this.persistCatalogAliases(i, r);
33667
33670
  return;
33668
33671
  }
33669
- const a = this.loadEpoch, o = await ge.instance.get(i);
33670
- if (a === this.loadEpoch) {
33671
- if (o) {
33672
- if (await new Promise((h) => setTimeout(h, 0)), a !== this.loadEpoch)
33673
- return;
33674
- if (this.isFontLoaded(i)) {
33675
- this.ensureCatalogAliases(i, r), this.clearRequestStateForNames([i, ...r]), await this.persistCatalogAliases(i, r);
33676
- return;
33677
- }
33678
- const c = be.instance.createFont(o);
33679
- c && (this.applyCatalogNames(c, r), this.registerFontInMap(i, c), await this.persistCatalogAliases(i, r));
33680
- } else {
33681
- const c = await this.loader.loadAsync(t.url);
33682
- if (a !== this.loadEpoch || (s.data = c, await new Promise((l) => setTimeout(l, 0)), a !== this.loadEpoch))
33683
- return;
33684
- if (this.isFontLoaded(i)) {
33685
- this.ensureCatalogAliases(i, r), this.clearRequestStateForNames([i, ...r]), await this.persistCatalogAliases(i, r);
33686
- return;
33672
+ const a = this.loadEpoch, o = this.enableFontCache ? await re.instance.get(i) : void 0;
33673
+ if (a !== this.loadEpoch)
33674
+ return;
33675
+ let c = !1;
33676
+ if (o) {
33677
+ if (await new Promise((h) => setTimeout(h, 0)), a !== this.loadEpoch)
33678
+ return;
33679
+ if (this.isFontLoaded(i)) {
33680
+ this.ensureCatalogAliases(i, r), this.clearRequestStateForNames([i, ...r]), await this.persistCatalogAliases(i, r);
33681
+ return;
33682
+ }
33683
+ try {
33684
+ const h = be.instance.createFont(o);
33685
+ h && (this.applyCatalogNames(h, r), this.registerFontInMap(i, h), await this.persistCatalogAliases(i, r), c = !0);
33686
+ } catch {
33687
+ try {
33688
+ await re.instance.delete(i);
33689
+ } catch {
33687
33690
  }
33688
- const h = be.instance.createFont(s);
33689
- h && (this.applyCatalogNames(h, r), this.registerFontInMap(i, h), this.enableFontCache && await ge.instance.set(i, s));
33690
33691
  }
33691
- a !== this.loadEpoch || !this.isFontLoaded(i) || (this.clearRequestStateForNames([i, ...r]), this.events.fontLoaded.dispatch({
33692
- fontName: i
33693
- }));
33694
33692
  }
33693
+ if (!c && !this.isFontLoaded(i)) {
33694
+ const h = await this.loader.loadAsync(t.url);
33695
+ if (a !== this.loadEpoch || (s.data = h, await new Promise((u) => setTimeout(u, 0)), a !== this.loadEpoch))
33696
+ return;
33697
+ if (this.isFontLoaded(i)) {
33698
+ this.ensureCatalogAliases(i, r), this.clearRequestStateForNames([i, ...r]), await this.persistCatalogAliases(i, r);
33699
+ return;
33700
+ }
33701
+ const l = be.instance.createFont(s);
33702
+ l && (this.applyCatalogNames(l, r), this.registerFontInMap(i, l), this.enableFontCache && await re.instance.set(i, s));
33703
+ }
33704
+ a !== this.loadEpoch || !this.isFontLoaded(i) || (this.clearRequestStateForNames([i, ...r]), this.events.fontLoaded.dispatch({
33705
+ fontName: i
33706
+ }));
33695
33707
  }
33696
33708
  fontInfoToFontData(t) {
33697
33709
  const e = qe(t.file).toLowerCase(), s = ["ttf", "otf", "woff"].includes(t.type) ? "mesh" : t.type;
@@ -33708,7 +33720,7 @@ class he {
33708
33720
  async getAllFontsFromCache() {
33709
33721
  if (this.loadedFontMap.size !== 0)
33710
33722
  return;
33711
- const t = await ge.instance.getAll();
33723
+ const t = await re.instance.getAll();
33712
33724
  for (const e of t) {
33713
33725
  const { name: s } = e;
33714
33726
  if (this.fileNames && !this.fileNames.includes(s))
@@ -33801,7 +33813,9 @@ class he {
33801
33813
  const e = /* @__PURE__ */ new Set();
33802
33814
  for (const a of this.loadedFontMap.values())
33803
33815
  e.add(a);
33804
- const s = Array.from(e).map((a) => a.estimateMemoryUsage()), i = (t == null ? void 0 : t.materials) ?? Uh(), r = s.reduce((a, o) => a + o.estimatedBytes, 0);
33816
+ const s = Array.from(e).map(
33817
+ (a) => a.estimateMemoryUsage()
33818
+ ), i = (t == null ? void 0 : t.materials) ?? Uh(), r = s.reduce((a, o) => a + o.estimatedBytes, 0);
33805
33819
  return {
33806
33820
  id: (t == null ? void 0 : t.id) ?? "main",
33807
33821
  inFlightRequests: t == null ? void 0 : t.inFlightRequests,
@@ -33816,7 +33830,7 @@ class rx {
33816
33830
  * Creates a new instance of DefaultFontLoader
33817
33831
  */
33818
33832
  constructor() {
33819
- this._availableFontsPromise = null, this._avaiableFonts = [], this._avaiableFontMap = /* @__PURE__ */ new Map(), this._baseUrl = "https://cdn.jsdelivr.net/gh/mlightcad/cad-data/fonts/";
33833
+ this._availableFontsPromise = null, this._catalogRefreshAttempted = !1, this._avaiableFonts = [], this._avaiableFontMap = /* @__PURE__ */ new Map(), this._baseUrl = "https://cdn.jsdelivr.net/gh/mlightcad/cad-data/fonts/";
33820
33834
  }
33821
33835
  /**
33822
33836
  * Base URL to load fonts
@@ -33825,7 +33839,7 @@ class rx {
33825
33839
  return this._baseUrl;
33826
33840
  }
33827
33841
  set baseUrl(t) {
33828
- this._baseUrl !== t && (this._baseUrl = t, this._avaiableFonts = [], this._avaiableFontMap.clear(), this._availableFontsPromise = null, this.onFontUrlChanged(t));
33842
+ this._baseUrl !== t && (this._baseUrl = t, this.clearAvailableFontsCache(), this._catalogRefreshAttempted = !1, this.onFontUrlChanged(t));
33829
33843
  }
33830
33844
  /**
33831
33845
  * Gets the list of available fonts
@@ -33868,81 +33882,99 @@ class rx {
33868
33882
  async load(t) {
33869
33883
  if (t == null || t.length === 0)
33870
33884
  return [];
33871
- await this.getAvailableFonts();
33872
- const e = [], s = [], i = /* @__PURE__ */ new Map();
33873
- t.forEach((c) => {
33874
- const h = c.toLowerCase(), l = this._avaiableFontMap.get(h);
33875
- l && (i.set(h, l), he.instance.isFontLoaded(h) && e.push({
33876
- fontName: h,
33877
- url: l.url,
33885
+ await this.getAvailableFonts(), t.some(
33886
+ (h) => !this._avaiableFontMap.has(h.toLowerCase())
33887
+ ) && !this._catalogRefreshAttempted && (this._catalogRefreshAttempted = !0, await this.refreshAvailableFontsFromNetwork());
33888
+ const s = [], i = [], r = /* @__PURE__ */ new Map();
33889
+ t.forEach((h) => {
33890
+ const l = h.toLowerCase(), u = this._avaiableFontMap.get(l);
33891
+ u && (r.set(l, u), le.instance.isFontLoaded(l) && s.push({
33892
+ fontName: l,
33893
+ url: u.url,
33878
33894
  status: "Success"
33879
- }), s.push(l));
33895
+ }), i.push(u));
33880
33896
  });
33881
- const r = await he.instance.loadFonts(s), a = {};
33882
- [...e, ...r].forEach((c) => {
33883
- a[c.fontName] = c;
33897
+ const a = await le.instance.loadFonts(i), o = {};
33898
+ [...s, ...a].forEach((h) => {
33899
+ o[h.fontName] = h;
33884
33900
  });
33885
- const o = [];
33886
- for (const c of t) {
33887
- const h = c.toLowerCase(), l = a[h];
33888
- if (l) {
33889
- o.push(l);
33901
+ const c = [];
33902
+ for (const h of t) {
33903
+ const l = h.toLowerCase(), u = o[l];
33904
+ if (u) {
33905
+ c.push(u);
33890
33906
  continue;
33891
33907
  }
33892
- const u = i.get(h);
33893
- if (u) {
33894
- if (he.instance.isFontLoaded(h)) {
33895
- o.push({
33896
- fontName: h,
33897
- url: u.url,
33908
+ const f = r.get(l);
33909
+ if (f) {
33910
+ if (le.instance.isFontLoaded(l)) {
33911
+ c.push({
33912
+ fontName: l,
33913
+ url: f.url,
33898
33914
  status: "Success"
33899
33915
  });
33900
33916
  continue;
33901
33917
  }
33902
- const f = qe(
33903
- u.file
33904
- ).toLowerCase(), p = a[f];
33905
- if (p) {
33906
- o.push({
33907
- fontName: h,
33908
- url: u.url,
33909
- status: p.status
33918
+ const p = qe(
33919
+ f.file
33920
+ ).toLowerCase(), d = o[p];
33921
+ if (d) {
33922
+ c.push({
33923
+ fontName: l,
33924
+ url: f.url,
33925
+ status: d.status
33910
33926
  });
33911
33927
  continue;
33912
33928
  }
33913
33929
  }
33914
- if (await he.instance.loadFontFromCache(c)) {
33915
- o.push({
33916
- fontName: h,
33930
+ if (await le.instance.loadFontFromCache(h)) {
33931
+ c.push({
33932
+ fontName: l,
33917
33933
  url: "",
33918
33934
  status: "Success"
33919
33935
  });
33920
33936
  continue;
33921
33937
  }
33922
- o.push({
33923
- fontName: h,
33938
+ c.push({
33939
+ fontName: l,
33924
33940
  url: "",
33925
33941
  status: "NotFound"
33926
33942
  });
33927
33943
  }
33928
- return o;
33944
+ return c;
33945
+ }
33946
+ clearAvailableFontsCache() {
33947
+ this._avaiableFonts = [], this._avaiableFontMap.clear(), this._availableFontsPromise = null;
33948
+ }
33949
+ /**
33950
+ * Drops the in-memory catalog and refetches `fonts.json`, bypassing the HTTP
33951
+ * cache so CDN updates are visible after a miss.
33952
+ */
33953
+ async refreshAvailableFontsFromNetwork() {
33954
+ this.clearAvailableFontsCache();
33955
+ const t = this._baseUrl, e = this.fetchAvailableFonts(t, {
33956
+ bypassHttpCache: !0
33957
+ }).finally(() => {
33958
+ this._availableFontsPromise === e && (this._availableFontsPromise = null);
33959
+ });
33960
+ return this._availableFontsPromise = e, e;
33929
33961
  }
33930
33962
  /**
33931
33963
  * Fetches and caches remote font metadata for the given base URL.
33932
33964
  */
33933
- async fetchAvailableFonts(t) {
33934
- const e = t + "fonts.json";
33935
- let s;
33965
+ async fetchAvailableFonts(t, e) {
33966
+ const s = t + "fonts.json";
33967
+ let i;
33936
33968
  try {
33937
- s = await (await fetch(e)).json();
33938
- } catch (i) {
33969
+ i = await (e != null && e.bypassHttpCache ? await fetch(s, { cache: "no-cache" }) : await fetch(s)).json();
33970
+ } catch (r) {
33939
33971
  throw new Error(
33940
- `Filed to get avaiable font from '${e}' due to ${i}!`
33972
+ `Filed to get avaiable font from '${s}' due to ${r}!`
33941
33973
  );
33942
33974
  }
33943
- return this._baseUrl !== t ? this.getAvailableFonts() : (s.forEach((i) => {
33944
- i.url = t + i.file;
33945
- }), this._avaiableFonts = s, this.buildFontMap(), this._avaiableFonts);
33975
+ return this._baseUrl !== t ? this.getAvailableFonts() : (i.forEach((r) => {
33976
+ r.url = t + r.file;
33977
+ }), this._avaiableFonts = i, this.buildFontMap(), this._avaiableFonts);
33946
33978
  }
33947
33979
  /**
33948
33980
  * Build one font map. The key is font name. The value is font info.
@@ -34021,7 +34053,7 @@ class cx {
34021
34053
  return e && t.layer ? `layer_${t.layer}_${s}` : `entity_${s}`;
34022
34054
  }
34023
34055
  }
34024
- var oe = /* @__PURE__ */ ((n) => (n[n.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", n[n.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", n[n.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", n[n.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", n[n.BY_STYLE = 5] = "BY_STYLE", n))(oe || {}), nt = /* @__PURE__ */ ((n) => (n[n.TopLeft = 1] = "TopLeft", n[n.TopCenter = 2] = "TopCenter", n[n.TopRight = 3] = "TopRight", n[n.MiddleLeft = 4] = "MiddleLeft", n[n.MiddleCenter = 5] = "MiddleCenter", n[n.MiddleRight = 6] = "MiddleRight", n[n.BottomLeft = 7] = "BottomLeft", n[n.BottomCenter = 8] = "BottomCenter", n[n.BottomRight = 9] = "BottomRight", n[n.BaselineLeft = 10] = "BaselineLeft", n[n.BaselineCenter = 11] = "BaselineCenter", n[n.BaselineRight = 12] = "BaselineRight", n))(nt || {}), dt = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.STACK = "STACK", n))(dt || {});
34056
+ var ce = /* @__PURE__ */ ((n) => (n[n.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", n[n.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", n[n.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", n[n.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", n[n.BY_STYLE = 5] = "BY_STYLE", n))(ce || {}), nt = /* @__PURE__ */ ((n) => (n[n.TopLeft = 1] = "TopLeft", n[n.TopCenter = 2] = "TopCenter", n[n.TopRight = 3] = "TopRight", n[n.MiddleLeft = 4] = "MiddleLeft", n[n.MiddleCenter = 5] = "MiddleCenter", n[n.MiddleRight = 6] = "MiddleRight", n[n.BottomLeft = 7] = "BottomLeft", n[n.BottomCenter = 8] = "BottomCenter", n[n.BottomRight = 9] = "BottomRight", n[n.BaselineLeft = 10] = "BaselineLeft", n[n.BaselineCenter = 11] = "BaselineCenter", n[n.BaselineRight = 12] = "BaselineRight", n))(nt || {}), dt = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.STACK = "STACK", n))(dt || {});
34025
34057
  const di = "", hx = () => ({
34026
34058
  byLayerColor: 16777215,
34027
34059
  byBlockColor: 16777215,
@@ -34122,7 +34154,7 @@ class hn {
34122
34154
  i
34123
34155
  );
34124
34156
  const r = new Dt();
34125
- return r.setAttribute("position", new le(s, 3)), r;
34157
+ return r.setAttribute("position", new ue(s, 3)), r;
34126
34158
  }
34127
34159
  /**
34128
34160
  * Counts how many line segments a geometry represents.
@@ -34152,7 +34184,7 @@ class hn {
34152
34184
  0
34153
34185
  );
34154
34186
  const r = new Dt();
34155
- return r.setAttribute("position", new le(i, 3)), r;
34187
+ return r.setAttribute("position", new ue(i, 3)), r;
34156
34188
  }
34157
34189
  /**
34158
34190
  * Writes transformed line-segment vertices from a source geometry into a flat position buffer.
@@ -34642,7 +34674,7 @@ class sh {
34642
34674
  if (!s)
34643
34675
  return;
34644
34676
  this._lineBatchEntries = [];
34645
- const i = [], r = [], a = [], o = [], c = this.flowDirection === oe.BOTTOM_TO_TOP ? 0 : -this.currentLayoutFontSize, h = this.buildShapeGeometry(
34677
+ const i = [], r = [], a = [], o = [], c = this.flowDirection === ce.BOTTOM_TO_TOP ? 0 : -this.currentLayoutFontSize, h = this.buildShapeGeometry(
34646
34678
  s.shape,
34647
34679
  s.label,
34648
34680
  0,
@@ -34786,7 +34818,7 @@ class sh {
34786
34818
  */
34787
34819
  pushDecorationLine(t, e) {
34788
34820
  const s = new Dt();
34789
- s.setAttribute("position", new le(new Float32Array(e), 3)), s.setIndex([0, 1]), s.userData = { isDecoration: !0 }, t.push(s);
34821
+ s.setAttribute("position", new ue(new Float32Array(e), 3)), s.setIndex([0, 1]), s.userData = { isDecoration: !0 }, t.push(s);
34790
34822
  }
34791
34823
  /**
34792
34824
  * Render the specified texts
@@ -35025,7 +35057,7 @@ class sh {
35025
35057
  P
35026
35058
  );
35027
35059
  e.push(...J), s.push(...D), i.push(...U), r.push(...P);
35028
- const Q = [], yt = [], Pt = [], Ct = [];
35060
+ const Q = [], yt = [], Pt = [], Tt = [];
35029
35061
  this._hOffset = h + I, this._vOffset = R;
35030
35062
  for (const ut of o)
35031
35063
  this.processChar(
@@ -35033,9 +35065,9 @@ class sh {
35033
35065
  Q,
35034
35066
  yt,
35035
35067
  Pt,
35036
- Ct
35068
+ Tt
35037
35069
  );
35038
- e.push(...Q), s.push(...yt), i.push(...Pt), r.push(...Ct), this._hOffset = h + M, F && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
35070
+ e.push(...Q), s.push(...yt), i.push(...Pt), r.push(...Tt), this._hOffset = h + M, F && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
35039
35071
  }
35040
35072
  } else {
35041
35073
  const v = [], w = [], F = [], M = [];
@@ -35082,7 +35114,7 @@ class sh {
35082
35114
  ]);
35083
35115
  W.setAttribute(
35084
35116
  "position",
35085
- new le(J, 3)
35117
+ new ue(J, 3)
35086
35118
  ), W.setIndex([0, 1]), W.userData = { isDecoration: !0 }, s.push(W);
35087
35119
  }
35088
35120
  this._hOffset = h + x;
@@ -35138,7 +35170,7 @@ class sh {
35138
35170
  */
35139
35171
  processBlank(t, e) {
35140
35172
  if (this._options.collectCharBoxes !== !1) {
35141
- const s = this._hOffset, i = this.flowDirection == oe.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.currentLayoutFontSize, r = new At(
35173
+ const s = this._hOffset, i = this.flowDirection == ce.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.currentLayoutFontSize, r = new At(
35142
35174
  new E(s, i, 0),
35143
35175
  new E(
35144
35176
  s + this.currentBlankAdvance,
@@ -35178,7 +35210,7 @@ class sh {
35178
35210
  * Appends vertical layout metadata for the current visual line to {@link _lineLayouts}.
35179
35211
  */
35180
35212
  recordCurrentLineLayout() {
35181
- const t = this.flowDirection == oe.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, e = this.currentLineHeight;
35213
+ const t = this.flowDirection == ce.BOTTOM_TO_TOP ? this._vOffset : this._vOffset - this.defaultFontSize, e = this.currentLineHeight;
35182
35214
  this._lineLayouts.push({
35183
35215
  y: t + e / 2,
35184
35216
  height: e
@@ -35228,7 +35260,7 @@ class sh {
35228
35260
  return;
35229
35261
  }
35230
35262
  this._lineHasRenderableChar || this.applyPendingEmptyLineYAdjust(), this.hOffset > (this.maxLineWidth || 1 / 0) && (this.recordVisualLineBreak(i, r), this.advanceToNextLine(!1));
35231
- const h = this.hOffset, l = this.flowDirection == oe.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentLayoutFontSize, u = this.currentLayoutFontSize, f = c.width * this.currentWidthFactor, { matrix: p, obliqueExtraAdvance: d } = this.buildCharTransformMatrix(
35263
+ const h = this.hOffset, l = this.flowDirection == ce.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentLayoutFontSize, u = this.currentLayoutFontSize, f = c.width * this.currentWidthFactor, { matrix: p, obliqueExtraAdvance: d } = this.buildCharTransformMatrix(
35232
35264
  h,
35233
35265
  l,
35234
35266
  u
@@ -35415,7 +35447,7 @@ class sh {
35415
35447
  * @param collectBreakIndex When `true`, records a char index for automatic wrapping.
35416
35448
  */
35417
35449
  advanceToNextLine(t = !0) {
35418
- t && this.recordVisualLineBreak(), this.captureCurrentLineAdvance(), this.recordCurrentLineLayout(), this._hOffset = 0, this._lineHasRenderableChar ? this._pendingEmptyLineFontSizeAdjust = void 0 : this._pendingEmptyLineFontSizeAdjust = this.currentFontSize, this.flowDirection == oe.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;
35450
+ t && this.recordVisualLineBreak(), this.captureCurrentLineAdvance(), this.recordCurrentLineLayout(), this._hOffset = 0, this._lineHasRenderableChar ? this._pendingEmptyLineFontSizeAdjust = void 0 : this._pendingEmptyLineFontSizeAdjust = this.currentFontSize, this.flowDirection == ce.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;
35419
35451
  }
35420
35452
  /**
35421
35453
  * Updates {@link _maxLineAdvance} from the current line's horizontal pen position.
@@ -35457,7 +35489,7 @@ class sh {
35457
35489
  applyPendingEmptyLineYAdjust() {
35458
35490
  if (this._pendingEmptyLineFontSizeAdjust === void 0) return;
35459
35491
  const t = this.currentFontSize - this._pendingEmptyLineFontSizeAdjust;
35460
- t !== 0 && (this.flowDirection == oe.BOTTOM_TO_TOP ? this._vOffset += t : this._vOffset -= t), this._pendingEmptyLineFontSizeAdjust = void 0;
35492
+ t !== 0 && (this.flowDirection == ce.BOTTOM_TO_TOP ? this._vOffset += t : this._vOffset -= t), this._pendingEmptyLineFontSizeAdjust = void 0;
35461
35493
  }
35462
35494
  /**
35463
35495
  * Chooses whether subsequent char boxes should attach to mesh or line geometry owners.
@@ -35742,7 +35774,15 @@ class Da extends Xt {
35742
35774
  }
35743
35775
  }
35744
35776
  const s = (t == null ? void 0 : t.awaitFonts) ?? (!this._fontManager.lazyFontLoading || this._fontManager.awaitFontsBeforeDraw), i = s ? [.../* @__PURE__ */ new Set([...e, ...this._fontManager.getFontsToLoad()])] : e;
35745
- i.length > 0 && (this._fontManager.lazyFontLoading ? s ? await this._fontManager.requestFonts(i) : this._fontManager.requestFonts(i) : await this._fontManager.loadFontsByNames(i), e.length > 0 && (this._fontsInStyleLoaded = !0)), this.syncDraw();
35777
+ if (i.length > 0 && (this._fontManager.lazyFontLoading ? s ? await this._fontManager.requestFonts(i) : this._fontManager.requestFonts(i) : await this._fontManager.loadFontsByNames(i), e.length > 0)) {
35778
+ const r = [
35779
+ this._style.font ? this.getFontName(this._style.font) : void 0,
35780
+ this._style.bigFont ? this.getFontName(this._style.bigFont) : void 0,
35781
+ this._style.extendedFont ? this.getFontName(this._style.extendedFont) : void 0
35782
+ ].filter((o) => !!o);
35783
+ (r.length === 0 || r.every((o) => this._fontManager.isFontLoaded(o))) && (this._fontsInStyleLoaded = !0);
35784
+ }
35785
+ this.syncDraw();
35746
35786
  }
35747
35787
  /**
35748
35788
  * Draw the MText object. This method assumes that fonts needed are loaded. If font needed
@@ -35850,18 +35890,15 @@ class Da extends Xt {
35850
35890
  position: t.position,
35851
35891
  rotation: t.rotation,
35852
35892
  directionVector: t.directionVector,
35853
- drawingDirection: oe.BOTTOM_TO_TOP,
35893
+ drawingDirection: ce.BOTTOM_TO_TOP,
35854
35894
  collectCharBoxes: !1
35855
35895
  };
35856
- return this.finalizePlacement(
35857
- s,
35858
- r,
35859
- i,
35860
- { shxFontType: this._fontManager.getShxFontType(e.font) }
35861
- );
35896
+ return this.finalizePlacement(s, r, i, {
35897
+ shxFontType: this._fontManager.getShxFontType(e.font)
35898
+ });
35862
35899
  }
35863
35900
  /**
35864
- *
35901
+ *
35865
35902
  * @param options.shxFontType The type of SHX font.
35866
35903
  */
35867
35904
  finalizePlacement(t, e, s, i) {
@@ -35881,7 +35918,10 @@ class Da extends Xt {
35881
35918
  e.drawingDirection
35882
35919
  );
35883
35920
  let c = { x: 0, y: 0 };
35884
- (i == null ? void 0 : i.shxFontType) === K.SHAPES ? c = { x: 0, y: 0 } : c = this.calculateAnchorPoint(o, e.attachmentPoint), t.userData.logicalBounds = {
35921
+ (i == null ? void 0 : i.shxFontType) === K.SHAPES ? c = { x: 0, y: 0 } : c = this.calculateAnchorPoint(
35922
+ o,
35923
+ e.attachmentPoint
35924
+ ), t.userData.logicalBounds = {
35885
35925
  minX: o.minX + c.x,
35886
35926
  maxX: o.maxX + c.x,
35887
35927
  minY: o.minY + c.y,
@@ -35926,7 +35966,7 @@ class Da extends Xt {
35926
35966
  lineSpaceFactor: Zc,
35927
35967
  horizontalAlignment: ct.LEFT,
35928
35968
  maxWidth: 0,
35929
- flowDirection: oe.BOTTOM_TO_TOP,
35969
+ flowDirection: ce.BOTTOM_TO_TOP,
35930
35970
  byBlockColor: this._colorSettings.byBlockColor,
35931
35971
  byLayerColor: this._colorSettings.byLayerColor,
35932
35972
  removeFontExtension: !0,
@@ -35985,7 +36025,7 @@ class Da extends Xt {
35985
36025
  nt.MiddleCenter,
35986
36026
  nt.MiddleRight
35987
36027
  ].includes(t.attachmentPoint) ? a = Ye.MIDDLE : a = Ye.BOTTOM);
35988
- const o = t.height || e.fixedTextHeight || 0, c = t.widthFactor || e.widthFactor || 1, h = t.lineSpaceFactor ?? Zc, l = t.drawingDirection ?? oe.LEFT_TO_RIGHT, u = {
36028
+ const o = t.height || e.fixedTextHeight || 0, c = t.widthFactor || e.widthFactor || 1, h = t.lineSpaceFactor ?? Zc, l = t.drawingDirection ?? ce.LEFT_TO_RIGHT, u = {
35989
36029
  fontSize: o,
35990
36030
  widthFactor: c,
35991
36031
  lineSpaceFactor: h,
@@ -36067,7 +36107,7 @@ class Da extends Xt {
36067
36107
  let l = 0, u = Number.isFinite(e) && e > 0 ? e : 0;
36068
36108
  u <= l && !i.isEmpty() && (l = i.min.x, u = i.max.x);
36069
36109
  let f = 0, p = 0;
36070
- r == oe.BOTTOM_TO_TOP ? (f = i.isEmpty() ? 0 : i.min.y, p = f + h) : (p = i.isEmpty() ? 0 : i.max.y, f = p - h);
36110
+ r == ce.BOTTOM_TO_TOP ? (f = i.isEmpty() ? 0 : i.min.y, p = f + h) : (p = i.isEmpty() ? 0 : i.max.y, f = p - h);
36071
36111
  const d = a.hasLine ? a.baselineY : f;
36072
36112
  return { minX: l, maxX: u, minY: f, maxY: p, baselineY: d };
36073
36113
  }
@@ -36284,8 +36324,8 @@ class Da extends Xt {
36284
36324
  }
36285
36325
  }
36286
36326
  }
36287
- const Ft = he.instance, rh = new cx();
36288
- Ft.events.fontLoaded.addEventListener((n) => {
36327
+ const Ct = le.instance, rh = new cx();
36328
+ Ct.events.fontLoaded.addEventListener((n) => {
36289
36329
  self.postMessage({
36290
36330
  type: "fontLoaded",
36291
36331
  id: "",
@@ -36293,7 +36333,7 @@ Ft.events.fontLoaded.addEventListener((n) => {
36293
36333
  data: { fontName: n == null ? void 0 : n.fontName }
36294
36334
  });
36295
36335
  });
36296
- Ft.events.fontNotFound.addEventListener((n) => {
36336
+ Ct.events.fontNotFound.addEventListener((n) => {
36297
36337
  self.postMessage({
36298
36338
  type: "fontNotFound",
36299
36339
  id: "",
@@ -36312,7 +36352,7 @@ self.addEventListener("message", async (n) => {
36312
36352
  i,
36313
36353
  r,
36314
36354
  rh,
36315
- Ft,
36355
+ Ct,
36316
36356
  o
36317
36357
  );
36318
36358
  await c.asyncDraw(), c.updateMatrixWorld(!0);
@@ -36331,8 +36371,8 @@ self.addEventListener("message", async (n) => {
36331
36371
  case "loadFonts": {
36332
36372
  if (!s) throw new Error("Missing data for loadFonts message");
36333
36373
  const { fonts: i } = s;
36334
- await Ft.loadFontsByNames(i);
36335
- const r = i.filter((a) => Ft.isFontLoaded(a));
36374
+ await Ct.loadFontsByNames(i);
36375
+ const r = i.filter((a) => Ct.isFontLoaded(a));
36336
36376
  self.postMessage({
36337
36377
  type: "loadFonts",
36338
36378
  id: e,
@@ -36344,13 +36384,13 @@ self.addEventListener("message", async (n) => {
36344
36384
  case "setDefaultFonts": {
36345
36385
  if (!s) throw new Error("Missing data for setDefaultFonts message");
36346
36386
  const { fonts: i, symbolFonts: r } = s;
36347
- Ft.setDefaultFonts(i), Ft.setSymbolFonts(r), self.postMessage({
36387
+ Ct.setDefaultFonts(i), Ct.setSymbolFonts(r), self.postMessage({
36348
36388
  type: "setDefaultFonts",
36349
36389
  id: e,
36350
36390
  success: !0,
36351
36391
  data: {
36352
- fonts: [...Ft.defaultFonts],
36353
- symbolFonts: [...Ft.symbolFonts]
36392
+ fonts: [...Ct.defaultFonts],
36393
+ symbolFonts: [...Ct.symbolFonts]
36354
36394
  }
36355
36395
  });
36356
36396
  break;
@@ -36358,11 +36398,11 @@ self.addEventListener("message", async (n) => {
36358
36398
  case "setLazyFontLoading": {
36359
36399
  if (!s) throw new Error("Missing data for setLazyFontLoading message");
36360
36400
  const { enabled: i } = s;
36361
- Ft.lazyFontLoading = i, self.postMessage({
36401
+ Ct.lazyFontLoading = i, self.postMessage({
36362
36402
  type: "setLazyFontLoading",
36363
36403
  id: e,
36364
36404
  success: !0,
36365
- data: { enabled: Ft.lazyFontLoading }
36405
+ data: { enabled: Ct.lazyFontLoading }
36366
36406
  });
36367
36407
  break;
36368
36408
  }
@@ -36370,18 +36410,23 @@ self.addEventListener("message", async (n) => {
36370
36410
  if (!s)
36371
36411
  throw new Error("Missing data for setAwaitFontsBeforeDraw message");
36372
36412
  const { enabled: i } = s;
36373
- Ft.awaitFontsBeforeDraw = i, self.postMessage({
36413
+ Ct.awaitFontsBeforeDraw = i, self.postMessage({
36374
36414
  type: "setAwaitFontsBeforeDraw",
36375
36415
  id: e,
36376
36416
  success: !0,
36377
- data: { enabled: Ft.awaitFontsBeforeDraw }
36417
+ data: { enabled: Ct.awaitFontsBeforeDraw }
36378
36418
  });
36379
36419
  break;
36380
36420
  }
36381
36421
  case "setFontUrl": {
36382
36422
  if (!s) throw new Error("Missing data for setFontUrl message");
36383
36423
  const { url: i } = s;
36384
- Ft.baseUrl = i, self.postMessage({
36424
+ Ct.baseUrl = i;
36425
+ try {
36426
+ await Ct.getAvailableFonts();
36427
+ } catch {
36428
+ }
36429
+ self.postMessage({
36385
36430
  type: "setFontUrl",
36386
36431
  id: e,
36387
36432
  success: !0,
@@ -36391,16 +36436,16 @@ self.addEventListener("message", async (n) => {
36391
36436
  }
36392
36437
  case "setMissedFonts": {
36393
36438
  const { missedFonts: i } = s ?? {};
36394
- Ft.replaceMissedFonts(i ?? {}), self.postMessage({
36439
+ Ct.replaceMissedFonts(i ?? {}), self.postMessage({
36395
36440
  type: "setMissedFonts",
36396
36441
  id: e,
36397
36442
  success: !0,
36398
- data: { missedFonts: { ...Ft.missedFonts } }
36443
+ data: { missedFonts: { ...Ct.missedFonts } }
36399
36444
  });
36400
36445
  break;
36401
36446
  }
36402
36447
  case "getAvailableFonts": {
36403
- const i = await he.instance.getAvailableFonts();
36448
+ const i = await le.instance.getAvailableFonts();
36404
36449
  self.postMessage({
36405
36450
  type: "getAvailableFonts",
36406
36451
  id: e,
@@ -36411,7 +36456,7 @@ self.addEventListener("message", async (n) => {
36411
36456
  }
36412
36457
  case "getMemoryStats": {
36413
36458
  const i = ox(
36414
- Ft,
36459
+ Ct,
36415
36460
  {
36416
36461
  id: "worker",
36417
36462
  styleManager: rh