@mlightcad/mtext-renderer 0.11.4 → 0.11.6

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.
@@ -3112,8 +3112,8 @@ class Tt {
3112
3112
  return this.multiplyMatrices(t, this);
3113
3113
  }
3114
3114
  multiplyMatrices(t, e) {
3115
- 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], V = i[12], D = i[1], W = i[5], J = i[9], B = i[13], U = i[2], P = i[6], Q = i[10], gt = i[14], Dt = i[3], St = i[7], rt = i[11], j = i[15];
3116
- return r[0] = a * M + o * D + c * U + h * Dt, r[4] = a * O + o * W + c * P + h * St, r[8] = a * I + o * J + c * Q + h * rt, r[12] = a * V + o * B + c * gt + h * j, r[1] = l * M + u * D + f * U + p * Dt, r[5] = l * O + u * W + f * P + p * St, r[9] = l * I + u * J + f * Q + p * rt, r[13] = l * V + u * B + f * gt + p * j, r[2] = d * M + g * D + x * U + b * Dt, r[6] = d * O + g * W + x * P + b * St, r[10] = d * I + g * J + x * Q + b * rt, r[14] = d * V + g * B + x * gt + b * j, r[3] = S * M + v * D + w * U + F * Dt, r[7] = S * O + v * W + w * P + F * St, r[11] = S * I + v * J + w * Q + F * rt, r[15] = S * V + v * B + w * gt + F * j, this;
3115
+ 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], V = i[12], D = i[1], W = i[5], J = i[9], B = i[13], U = i[2], P = i[6], K = i[10], gt = i[14], Dt = i[3], wt = i[7], rt = i[11], j = i[15];
3116
+ return r[0] = a * M + o * D + c * U + h * Dt, r[4] = a * O + o * W + c * P + h * wt, r[8] = a * I + o * J + c * K + h * rt, r[12] = a * V + o * B + c * gt + h * j, r[1] = l * M + u * D + f * U + p * Dt, r[5] = l * O + u * W + f * P + p * wt, r[9] = l * I + u * J + f * K + p * rt, r[13] = l * V + u * B + f * gt + p * j, r[2] = d * M + g * D + x * U + b * Dt, r[6] = d * O + g * W + x * P + b * wt, r[10] = d * I + g * J + x * K + b * rt, r[14] = d * V + g * B + x * gt + b * j, r[3] = S * M + v * D + w * U + F * Dt, r[7] = S * O + v * W + w * P + F * wt, r[11] = S * I + v * J + w * K + F * rt, r[15] = S * V + v * B + w * gt + F * j, this;
3117
3117
  }
3118
3118
  multiplyScalar(t) {
3119
3119
  const e = this.elements;
@@ -4475,7 +4475,7 @@ class un extends he {
4475
4475
  }
4476
4476
  }
4477
4477
  let nu = 0;
4478
- const Yt = /* @__PURE__ */ new Tt(), ar = /* @__PURE__ */ new jt(), Mn = /* @__PURE__ */ new E(), Wt = /* @__PURE__ */ new _t(), Kn = /* @__PURE__ */ new _t(), vt = /* @__PURE__ */ new E();
4478
+ const Yt = /* @__PURE__ */ new Tt(), ar = /* @__PURE__ */ new jt(), Mn = /* @__PURE__ */ new E(), Wt = /* @__PURE__ */ new _t(), Kn = /* @__PURE__ */ new _t(), St = /* @__PURE__ */ new E();
4479
4479
  class Ht extends _i {
4480
4480
  constructor() {
4481
4481
  super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: nu++ }), this.uuid = qn(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};
@@ -4585,7 +4585,7 @@ class Ht extends _i {
4585
4585
  if (this.boundingBox.setFromBufferAttribute(t), e)
4586
4586
  for (let s = 0, i = e.length; s < i; s++) {
4587
4587
  const r = e[s];
4588
- Wt.setFromBufferAttribute(r), this.morphTargetsRelative ? (vt.addVectors(this.boundingBox.min, Wt.min), this.boundingBox.expandByPoint(vt), vt.addVectors(this.boundingBox.max, Wt.max), this.boundingBox.expandByPoint(vt)) : (this.boundingBox.expandByPoint(Wt.min), this.boundingBox.expandByPoint(Wt.max));
4588
+ Wt.setFromBufferAttribute(r), this.morphTargetsRelative ? (St.addVectors(this.boundingBox.min, Wt.min), this.boundingBox.expandByPoint(St), St.addVectors(this.boundingBox.max, Wt.max), this.boundingBox.expandByPoint(St)) : (this.boundingBox.expandByPoint(Wt.min), this.boundingBox.expandByPoint(Wt.max));
4589
4589
  }
4590
4590
  } else
4591
4591
  this.boundingBox.makeEmpty();
@@ -4603,17 +4603,17 @@ class Ht extends _i {
4603
4603
  if (Wt.setFromBufferAttribute(t), e)
4604
4604
  for (let r = 0, a = e.length; r < a; r++) {
4605
4605
  const o = e[r];
4606
- Kn.setFromBufferAttribute(o), this.morphTargetsRelative ? (vt.addVectors(Wt.min, Kn.min), Wt.expandByPoint(vt), vt.addVectors(Wt.max, Kn.max), Wt.expandByPoint(vt)) : (Wt.expandByPoint(Kn.min), Wt.expandByPoint(Kn.max));
4606
+ Kn.setFromBufferAttribute(o), this.morphTargetsRelative ? (St.addVectors(Wt.min, Kn.min), Wt.expandByPoint(St), St.addVectors(Wt.max, Kn.max), Wt.expandByPoint(St)) : (Wt.expandByPoint(Kn.min), Wt.expandByPoint(Kn.max));
4607
4607
  }
4608
4608
  Wt.getCenter(s);
4609
4609
  let i = 0;
4610
4610
  for (let r = 0, a = t.count; r < a; r++)
4611
- vt.fromBufferAttribute(t, r), i = Math.max(i, s.distanceToSquared(vt));
4611
+ St.fromBufferAttribute(t, r), i = Math.max(i, s.distanceToSquared(St));
4612
4612
  if (e)
4613
4613
  for (let r = 0, a = e.length; r < a; r++) {
4614
4614
  const o = e[r], c = this.morphTargetsRelative;
4615
4615
  for (let h = 0, l = o.count; h < l; h++)
4616
- vt.fromBufferAttribute(o, h), c && (Mn.fromBufferAttribute(t, h), vt.add(Mn)), i = Math.max(i, s.distanceToSquared(vt));
4616
+ St.fromBufferAttribute(o, h), c && (Mn.fromBufferAttribute(t, h), St.add(Mn)), i = Math.max(i, s.distanceToSquared(St));
4617
4617
  }
4618
4618
  this.boundingSphere.radius = Math.sqrt(i), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this);
4619
4619
  }
@@ -4687,7 +4687,7 @@ class Ht extends _i {
4687
4687
  normalizeNormals() {
4688
4688
  const t = this.attributes.normal;
4689
4689
  for (let e = 0, s = t.count; e < s; e++)
4690
- vt.fromBufferAttribute(t, e), vt.normalize(), t.setXYZ(e, vt.x, vt.y, vt.z);
4690
+ St.fromBufferAttribute(t, e), St.normalize(), t.setXYZ(e, St.x, St.y, St.z);
4691
4691
  }
4692
4692
  toNonIndexed() {
4693
4693
  function t(o, c) {
@@ -7237,7 +7237,7 @@ mn.prototype.addQuad = function(n, t, e, s, i, r) {
7237
7237
  this.addBezier(n, t, a, o, c, h, i, r);
7238
7238
  };
7239
7239
  var yh = mn;
7240
- function xt() {
7240
+ function bt() {
7241
7241
  this.commands = [], this.fill = "black", this.stroke = null, this.strokeWidth = 1;
7242
7242
  }
7243
7243
  var ts = {};
@@ -7277,7 +7277,7 @@ function cf(n) {
7277
7277
  flipYBase: void 0
7278
7278
  }, n);
7279
7279
  }
7280
- xt.prototype.fromSVG = function(n, t = {}) {
7280
+ bt.prototype.fromSVG = function(n, t = {}) {
7281
7281
  typeof SVGPathElement < "u" && n instanceof SVGPathElement && (n = n.getAttribute("d")), t = of(t), this.commands = [];
7282
7282
  const e = "0123456789", s = "MmLlQqCcZzHhVv", i = "SsTtAa", r = "-+";
7283
7283
  let a = {}, o = [""], c = !1;
@@ -7373,24 +7373,24 @@ xt.prototype.fromSVG = function(n, t = {}) {
7373
7373
  }
7374
7374
  return this;
7375
7375
  };
7376
- xt.fromSVG = function(n, t) {
7377
- return new xt().fromSVG(n, t);
7376
+ bt.fromSVG = function(n, t) {
7377
+ return new bt().fromSVG(n, t);
7378
7378
  };
7379
- xt.prototype.moveTo = function(n, t) {
7379
+ bt.prototype.moveTo = function(n, t) {
7380
7380
  this.commands.push({
7381
7381
  type: "M",
7382
7382
  x: n,
7383
7383
  y: t
7384
7384
  });
7385
7385
  };
7386
- xt.prototype.lineTo = function(n, t) {
7386
+ bt.prototype.lineTo = function(n, t) {
7387
7387
  this.commands.push({
7388
7388
  type: "L",
7389
7389
  x: n,
7390
7390
  y: t
7391
7391
  });
7392
7392
  };
7393
- xt.prototype.curveTo = xt.prototype.bezierCurveTo = function(n, t, e, s, i, r) {
7393
+ bt.prototype.curveTo = bt.prototype.bezierCurveTo = function(n, t, e, s, i, r) {
7394
7394
  this.commands.push({
7395
7395
  type: "C",
7396
7396
  x1: n,
@@ -7401,7 +7401,7 @@ xt.prototype.curveTo = xt.prototype.bezierCurveTo = function(n, t, e, s, i, r) {
7401
7401
  y: r
7402
7402
  });
7403
7403
  };
7404
- xt.prototype.quadTo = xt.prototype.quadraticCurveTo = function(n, t, e, s) {
7404
+ bt.prototype.quadTo = bt.prototype.quadraticCurveTo = function(n, t, e, s) {
7405
7405
  this.commands.push({
7406
7406
  type: "Q",
7407
7407
  x1: n,
@@ -7410,12 +7410,12 @@ xt.prototype.quadTo = xt.prototype.quadraticCurveTo = function(n, t, e, s) {
7410
7410
  y: s
7411
7411
  });
7412
7412
  };
7413
- xt.prototype.close = xt.prototype.closePath = function() {
7413
+ bt.prototype.close = bt.prototype.closePath = function() {
7414
7414
  this.commands.push({
7415
7415
  type: "Z"
7416
7416
  });
7417
7417
  };
7418
- xt.prototype.extend = function(n) {
7418
+ bt.prototype.extend = function(n) {
7419
7419
  if (n.commands)
7420
7420
  n = n.commands;
7421
7421
  else if (n instanceof yh) {
@@ -7425,7 +7425,7 @@ xt.prototype.extend = function(n) {
7425
7425
  }
7426
7426
  Array.prototype.push.apply(this.commands, n);
7427
7427
  };
7428
- xt.prototype.getBoundingBox = function() {
7428
+ bt.prototype.getBoundingBox = function() {
7429
7429
  const n = new yh();
7430
7430
  let t = 0, e = 0, s = 0, i = 0;
7431
7431
  for (let r = 0; r < this.commands.length; r++) {
@@ -7452,7 +7452,7 @@ xt.prototype.getBoundingBox = function() {
7452
7452
  }
7453
7453
  return n.isEmpty() && n.addPoint(0, 0), n;
7454
7454
  };
7455
- xt.prototype.draw = function(n) {
7455
+ bt.prototype.draw = function(n) {
7456
7456
  const t = this._layers;
7457
7457
  if (t && t.length) {
7458
7458
  for (let s = 0; s < t.length; s++)
@@ -7471,7 +7471,7 @@ xt.prototype.draw = function(n) {
7471
7471
  }
7472
7472
  this.fill && (n.fillStyle = this.fill, n.fill()), this.stroke && (n.strokeStyle = this.stroke, n.lineWidth = this.strokeWidth, n.stroke());
7473
7473
  };
7474
- xt.prototype.toPathData = function(n) {
7474
+ bt.prototype.toPathData = function(n) {
7475
7475
  n = cf(n);
7476
7476
  function t(o) {
7477
7477
  const c = xh(o, n.decimalPlaces);
@@ -7490,7 +7490,7 @@ xt.prototype.toPathData = function(n) {
7490
7490
  const i = n.flipY;
7491
7491
  let r = n.flipYBase;
7492
7492
  if (i === !0 && r === void 0) {
7493
- const o = new xt();
7493
+ const o = new bt();
7494
7494
  o.extend(s);
7495
7495
  const c = o.getBoundingBox();
7496
7496
  r = c.y1 + c.y2;
@@ -7520,17 +7520,17 @@ xt.prototype.toPathData = function(n) {
7520
7520
  }
7521
7521
  return a;
7522
7522
  };
7523
- xt.prototype.toSVG = function(n, t) {
7523
+ bt.prototype.toSVG = function(n, t) {
7524
7524
  this._layers && this._layers.length && console.warn("toSVG() does not support colr font layers yet"), this._image && console.warn("toSVG() does not support SVG glyphs yet"), t || (t = this.toPathData(n));
7525
7525
  let e = '<path d="';
7526
7526
  return e += t, e += '"', this.fill !== void 0 && this.fill !== "black" && (this.fill === null ? e += ' fill="none"' : e += ' fill="' + this.fill + '"'), this.stroke && (e += ' stroke="' + this.stroke + '" stroke-width="' + this.strokeWidth + '"'), e += "/>", e;
7527
7527
  };
7528
- xt.prototype.toDOMElement = function(n, t) {
7528
+ bt.prototype.toDOMElement = function(n, t) {
7529
7529
  this._layers && this._layers.length && console.warn("toDOMElement() does not support colr font layers yet"), t || (t = this.toPathData(n));
7530
7530
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
7531
7531
  return e.setAttribute("d", t), this.fill !== void 0 && this.fill !== "black" && (this.fill === null ? e.setAttribute("fill", "none") : e.setAttribute("fill", this.fill)), this.stroke && (e.setAttribute("stroke", this.stroke), e.setAttribute("stroke-width", this.strokeWidth)), e;
7532
7532
  };
7533
- var Nn = xt;
7533
+ var Nn = bt;
7534
7534
  function vh(n) {
7535
7535
  throw new Error(n);
7536
7536
  }
@@ -12288,7 +12288,7 @@ function Qr(n, t, e, s, i) {
12288
12288
  U = (l.length & 1) !== 0, U && !f && (D = l.shift() + v), u += l.length >> 1, l.length = 0, f = !0;
12289
12289
  }
12290
12290
  function B(U) {
12291
- let P, Q, gt, Dt, St, rt, j, it, yt, Ft, bt, wt, ct = 0;
12291
+ let P, K, gt, Dt, wt, rt, j, it, yt, Ft, vt, Ct, ct = 0;
12292
12292
  for (; ct < U.length; ) {
12293
12293
  let At = U[ct];
12294
12294
  switch (ct += 1, At) {
@@ -12318,7 +12318,7 @@ function Qr(n, t, e, s, i) {
12318
12318
  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);
12319
12319
  break;
12320
12320
  case 10:
12321
- if (St = l.pop() + b, rt = x[St], rt) {
12321
+ if (wt = l.pop() + b, rt = x[wt], rt) {
12322
12322
  if (O >= Io) {
12323
12323
  console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");
12324
12324
  break;
@@ -12335,16 +12335,16 @@ function Qr(n, t, e, s, i) {
12335
12335
  case 12:
12336
12336
  switch (At = U[ct], ct += 1, At) {
12337
12337
  case 35:
12338
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c + l.shift(), yt = j + l.shift(), Ft = it + l.shift(), bt = yt + l.shift(), wt = Ft + l.shift(), d = bt + l.shift(), g = wt + l.shift(), l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, bt, wt, d, g);
12338
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c + l.shift(), yt = j + l.shift(), Ft = it + l.shift(), vt = yt + l.shift(), Ct = Ft + l.shift(), d = vt + l.shift(), g = Ct + l.shift(), l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, vt, Ct, d, g);
12339
12339
  break;
12340
12340
  case 34:
12341
- r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c, yt = j + l.shift(), Ft = c, bt = yt + l.shift(), wt = g, d = bt + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, bt, wt, d, g);
12341
+ r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c, yt = j + l.shift(), Ft = c, vt = yt + l.shift(), Ct = g, d = vt + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, vt, Ct, d, g);
12342
12342
  break;
12343
12343
  case 36:
12344
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c, yt = j + l.shift(), Ft = c, bt = yt + l.shift(), wt = Ft + l.shift(), d = bt + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, bt, wt, d, g);
12344
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c, yt = j + l.shift(), Ft = c, vt = yt + l.shift(), Ct = Ft + l.shift(), d = vt + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, vt, Ct, d, g);
12345
12345
  break;
12346
12346
  case 37:
12347
- r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c + l.shift(), yt = j + l.shift(), Ft = it + l.shift(), bt = yt + l.shift(), wt = Ft + l.shift(), Math.abs(bt - d) > Math.abs(wt - g) ? d = bt + l.shift() : g = wt + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, bt, wt, d, g);
12347
+ r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), it = c + l.shift(), yt = j + l.shift(), Ft = it + l.shift(), vt = yt + l.shift(), Ct = Ft + l.shift(), Math.abs(vt - d) > Math.abs(Ct - g) ? d = vt + l.shift() : g = Ct + l.shift(), h.curveTo(r, a, o, c, j, it), h.curveTo(yt, Ft, vt, Ct, d, g);
12348
12348
  break;
12349
12349
  default:
12350
12350
  console.log("Glyph " + t.index + ": unknown operator 1200" + At), l.length = 0;
@@ -12392,9 +12392,9 @@ function Qr(n, t, e, s, i) {
12392
12392
  break;
12393
12393
  }
12394
12394
  M || (M = n.variation && i && n.variation.process.getBlendVector(F, w, i));
12395
- var tt = l.pop(), kt = M ? M.length : F.itemVariationSubtables[w].regionIndexes.length, Ut = tt * kt, Pt = l.length - Ut, zt = Pt - tt;
12395
+ var Q = l.pop(), kt = M ? M.length : F.itemVariationSubtables[w].regionIndexes.length, Ut = Q * kt, Pt = l.length - Ut, zt = Pt - Q;
12396
12396
  if (M)
12397
- for (let we = 0; we < tt; we++) {
12397
+ for (let we = 0; we < Q; we++) {
12398
12398
  var Gt = l[zt + we];
12399
12399
  for (let C = 0; C < kt; C++)
12400
12400
  Gt += M[C] * l[Pt++];
@@ -12438,10 +12438,10 @@ function Qr(n, t, e, s, i) {
12438
12438
  r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c, h.curveTo(r, a, o, c, d, g);
12439
12439
  break;
12440
12440
  case 28:
12441
- P = U[ct], Q = U[ct + 1], l.push((P << 24 | Q << 16) >> 16), ct += 2;
12441
+ P = U[ct], K = U[ct + 1], l.push((P << 24 | K << 16) >> 16), ct += 2;
12442
12442
  break;
12443
12443
  case 29:
12444
- if (St = l.pop() + n.gsubrsBias, rt = n.gsubrs[St], rt) {
12444
+ if (wt = l.pop() + n.gsubrsBias, rt = n.gsubrs[wt], rt) {
12445
12445
  if (O >= Io) {
12446
12446
  console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");
12447
12447
  break;
@@ -12458,14 +12458,14 @@ function Qr(n, t, e, s, i) {
12458
12458
  r = d, a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c + (l.length === 1 ? l.shift() : 0), h.curveTo(r, a, o, c, d, g);
12459
12459
  break;
12460
12460
  default:
12461
- At < 32 ? console.log("Glyph " + t.index + ": unknown operator " + At) : At < 247 ? l.push(At - 139) : At < 251 ? (P = U[ct], ct += 1, l.push((At - 247) * 256 + P + 108)) : At < 255 ? (P = U[ct], ct += 1, l.push(-(At - 251) * 256 - P - 108)) : (P = U[ct], Q = U[ct + 1], gt = U[ct + 2], Dt = U[ct + 3], ct += 4, l.push((P << 24 | Q << 16 | gt << 8 | Dt) / 65536));
12461
+ At < 32 ? console.log("Glyph " + t.index + ": unknown operator " + At) : At < 247 ? l.push(At - 139) : At < 251 ? (P = U[ct], ct += 1, l.push((At - 247) * 256 + P + 108)) : At < 255 ? (P = U[ct], ct += 1, l.push(-(At - 251) * 256 - P - 108)) : (P = U[ct], K = U[ct + 1], gt = U[ct + 2], Dt = U[ct + 3], ct += 4, l.push((P << 24 | K << 16 | gt << 8 | Dt) / 65536));
12462
12462
  }
12463
12463
  }
12464
12464
  }
12465
12465
  return B(e), n.variation && i && (h.commands = h.commands.map((U) => {
12466
12466
  const P = Object.keys(U);
12467
- for (let Q = 0; Q < P.length; Q++) {
12468
- const gt = P[Q];
12467
+ for (let K = 0; K < P.length; K++) {
12468
+ const gt = P[K];
12469
12469
  gt !== "type" && (U[gt] = Math.round(U[gt]));
12470
12470
  }
12471
12471
  return U;
@@ -14034,10 +14034,10 @@ function bd(n) {
14034
14034
  function vd(n) {
14035
14035
  const t = [], e = [], s = [], i = [], r = [], a = [], o = [];
14036
14036
  let c, h = 0, l = 0, u = 0, f = 0, p = 0;
14037
- for (let tt = 0; tt < n.glyphs.length; tt += 1) {
14038
- const kt = n.glyphs.get(tt), Ut = kt.unicode | 0;
14037
+ for (let Q = 0; Q < n.glyphs.length; Q += 1) {
14038
+ const kt = n.glyphs.get(Q), Ut = kt.unicode | 0;
14039
14039
  if (isNaN(kt.advanceWidth))
14040
- throw new Error("Glyph " + kt.name + " (" + tt + "): advanceWidth is not a number.");
14040
+ throw new Error("Glyph " + kt.name + " (" + Q + "): advanceWidth is not a number.");
14041
14041
  (c > Ut || c === void 0) && Ut > 0 && (c = Ut), h < Ut && (h = Ut);
14042
14042
  const Pt = na.getUnicodeRange(Ut);
14043
14043
  if (Pt < 32)
@@ -14116,19 +14116,19 @@ function vd(n) {
14116
14116
  let V = n.getEnglishName("postScriptName");
14117
14117
  V || (V = M.replace(/\s/g, "") + "-" + O);
14118
14118
  const D = {};
14119
- for (let tt in n.names)
14120
- D[tt] = n.names[tt];
14119
+ for (let Q in n.names)
14120
+ D[Q] = n.names[Q];
14121
14121
  D.unicode = D.unicode || {}, D.macintosh = D.macintosh || {}, D.windows = D.windows || {};
14122
14122
  const W = n.names.unicode || {}, J = n.names.macintosh || {}, B = n.names.windows || {};
14123
- for (const tt in D) {
14124
- if (D[tt] = D[tt] || {}, !D[tt].uniqueID) {
14123
+ for (const Q in D) {
14124
+ if (D[Q] = D[Q] || {}, !D[Q].uniqueID) {
14125
14125
  const kt = n.getEnglishName("manufacturer") || "";
14126
- D[tt].uniqueID = { en: `${kt}: ${I}` };
14126
+ D[Q].uniqueID = { en: `${kt}: ${I}` };
14127
14127
  }
14128
- D[tt].postScriptName || (D[tt].postScriptName = { en: V });
14128
+ D[Q].postScriptName || (D[Q].postScriptName = { en: V });
14129
14129
  }
14130
14130
  D.unicode.preferredFamily || (D.unicode.preferredFamily = W.fontFamily || J.fontFamily || B.fontFamily), D.macintosh.preferredFamily || (D.macintosh.preferredFamily = J.fontFamily || W.fontFamily || B.fontFamily), D.windows.preferredFamily || (D.windows.preferredFamily = B.fontFamily || W.fontFamily || J.fontFamily), D.unicode.preferredSubfamily || (D.unicode.preferredSubfamily = W.fontSubfamily || J.fontSubfamily || B.fontSubfamily), D.macintosh.preferredSubfamily || (D.macintosh.preferredSubfamily = J.fontSubfamily || W.fontSubfamily || B.fontSubfamily), D.windows.preferredSubfamily || (D.windows.preferredSubfamily = B.fontSubfamily || W.fontSubfamily || J.fontSubfamily);
14131
- const U = [], P = kh.make(D, U), Q = U.length > 0 ? Vh.make(U) : void 0, gt = qh.make(n), Dt = ta.make(n.glyphs, {
14131
+ const U = [], P = kh.make(D, U), K = U.length > 0 ? Vh.make(U) : void 0, gt = qh.make(n), Dt = ta.make(n.glyphs, {
14132
14132
  version: n.getEnglishName("version"),
14133
14133
  fullName: I,
14134
14134
  familyName: M,
@@ -14137,8 +14137,8 @@ function vd(n) {
14137
14137
  unitsPerEm: n.unitsPerEm,
14138
14138
  fontBBox: [0, d.yMin, d.ascender, d.advanceWidthMax],
14139
14139
  topDict: n.tables.cff && n.tables.cff.topDict || {}
14140
- }), St = n.metas && Object.keys(n.metas).length > 0 ? $h.make(n.metas) : void 0, rt = [x, b, S, v, P, F, gt, Dt, w];
14141
- Q && rt.push(Q);
14140
+ }), wt = n.metas && Object.keys(n.metas).length > 0 ? $h.make(n.metas) : void 0, rt = [x, b, S, v, P, F, gt, Dt, w];
14141
+ K && rt.push(K);
14142
14142
  const j = {
14143
14143
  gsub: jh,
14144
14144
  cpal: Ih,
@@ -14154,19 +14154,19 @@ function vd(n) {
14154
14154
  avar: [n.tables.fvar],
14155
14155
  fvar: [n.names]
14156
14156
  };
14157
- for (let tt in j) {
14158
- const kt = n.tables[tt];
14157
+ for (let Q in j) {
14158
+ const kt = n.tables[Q];
14159
14159
  if (kt) {
14160
- const Ut = j[tt].make.call(n, kt, ...it[tt] || []);
14160
+ const Ut = j[Q].make.call(n, kt, ...it[Q] || []);
14161
14161
  Ut && rt.push(Ut);
14162
14162
  }
14163
14163
  }
14164
- St && rt.push(St);
14165
- const yt = nl(rt), Ft = yt.encode(), bt = ya(Ft), wt = yt.fields;
14164
+ wt && rt.push(wt);
14165
+ const yt = nl(rt), Ft = yt.encode(), vt = ya(Ft), Ct = yt.fields;
14166
14166
  let ct = !1;
14167
- for (let tt = 0; tt < wt.length; tt += 1)
14168
- if (wt[tt].name === "head table") {
14169
- wt[tt].value.checkSumAdjustment = 2981146554 - bt, ct = !0;
14167
+ for (let Q = 0; Q < Ct.length; Q += 1)
14168
+ if (Ct[Q].name === "head table") {
14169
+ Ct[Q].value.checkSumAdjustment = 2981146554 - vt, ct = !0;
14170
14170
  break;
14171
14171
  }
14172
14172
  if (!ct)
@@ -18905,7 +18905,7 @@ function Yg(n, t) {
18905
18905
  }
18906
18906
  return e;
18907
18907
  }
18908
- function et(n, t) {
18908
+ function tt(n, t) {
18909
18909
  if (t.compression === "WOFF") {
18910
18910
  const e = new Uint8Array(n.buffer, t.offset + 2, t.compressedLength - 2), s = new Uint8Array(t.length);
18911
18911
  if (mh(e, s), s.byteLength !== t.length)
@@ -18948,10 +18948,10 @@ function Zg(n, t = {}) {
18948
18948
  g = U;
18949
18949
  break;
18950
18950
  case "cmap":
18951
- P = et(r, U), i.tables.cmap = Ah.parse(P.data, P.offset), i.encoding = new Mh(i.tables.cmap);
18951
+ P = tt(r, U), i.tables.cmap = Ah.parse(P.data, P.offset), i.encoding = new Mh(i.tables.cmap);
18952
18952
  break;
18953
18953
  case "cvt ":
18954
- P = et(r, U), D = new N.Parser(P.data, P.offset), i.tables.cvt = D.parseShortList(U.length / 2);
18954
+ P = tt(r, U), D = new N.Parser(P.data, P.offset), i.tables.cvt = D.parseShortList(U.length / 2);
18955
18955
  break;
18956
18956
  case "fvar":
18957
18957
  u = U;
@@ -18966,13 +18966,13 @@ function Zg(n, t = {}) {
18966
18966
  d = U;
18967
18967
  break;
18968
18968
  case "fpgm":
18969
- P = et(r, U), D = new N.Parser(P.data, P.offset), i.tables.fpgm = D.parseByteList(U.length);
18969
+ P = tt(r, U), D = new N.Parser(P.data, P.offset), i.tables.fpgm = D.parseByteList(U.length);
18970
18970
  break;
18971
18971
  case "head":
18972
- P = et(r, U), i.tables.head = Nh.parse(P.data, P.offset), i.unitsPerEm = i.tables.head.unitsPerEm, e = i.tables.head.indexToLocFormat;
18972
+ P = tt(r, U), i.tables.head = Nh.parse(P.data, P.offset), i.unitsPerEm = i.tables.head.unitsPerEm, e = i.tables.head.indexToLocFormat;
18973
18973
  break;
18974
18974
  case "hhea":
18975
- P = et(r, U), i.tables.hhea = Hh.parse(P.data, P.offset), i.ascender = i.tables.hhea.ascender, i.descender = i.tables.hhea.descender, i.numberOfHMetrics = i.tables.hhea.numberOfHMetrics;
18975
+ P = tt(r, U), i.tables.hhea = Hh.parse(P.data, P.offset), i.ascender = i.tables.hhea.ascender, i.descender = i.tables.hhea.descender, i.numberOfHMetrics = i.tables.hhea.numberOfHMetrics;
18976
18976
  break;
18977
18977
  case "HVAR":
18978
18978
  F = U;
@@ -18981,28 +18981,28 @@ function Zg(n, t = {}) {
18981
18981
  w = U;
18982
18982
  break;
18983
18983
  case "ltag":
18984
- P = et(r, U), s = Vh.parse(P.data, P.offset);
18984
+ P = tt(r, U), s = Vh.parse(P.data, P.offset);
18985
18985
  break;
18986
18986
  case "COLR":
18987
- P = et(r, U), i.tables.colr = Xh.parse(P.data, P.offset);
18987
+ P = tt(r, U), i.tables.colr = Xh.parse(P.data, P.offset);
18988
18988
  break;
18989
18989
  case "CPAL":
18990
- P = et(r, U), i.tables.cpal = Ih.parse(P.data, P.offset);
18990
+ P = tt(r, U), i.tables.cpal = Ih.parse(P.data, P.offset);
18991
18991
  break;
18992
18992
  case "maxp":
18993
- P = et(r, U), i.tables.maxp = Wh.parse(P.data, P.offset), i.numGlyphs = i.tables.maxp.numGlyphs;
18993
+ P = tt(r, U), i.tables.maxp = Wh.parse(P.data, P.offset), i.numGlyphs = i.tables.maxp.numGlyphs;
18994
18994
  break;
18995
18995
  case "name":
18996
18996
  I = U;
18997
18997
  break;
18998
18998
  case "OS/2":
18999
- P = et(r, U), i.tables.os2 = na.parse(P.data, P.offset);
18999
+ P = tt(r, U), i.tables.os2 = na.parse(P.data, P.offset);
19000
19000
  break;
19001
19001
  case "post":
19002
- P = et(r, U), i.tables.post = qh.parse(P.data, P.offset), i.glyphNames = new fa(i.tables.post);
19002
+ P = tt(r, U), i.tables.post = qh.parse(P.data, P.offset), i.glyphNames = new fa(i.tables.post);
19003
19003
  break;
19004
19004
  case "prep":
19005
- P = et(r, U), D = new N.Parser(P.data, P.offset), i.tables.prep = D.parseByteList(U.length);
19005
+ P = tt(r, U), D = new N.Parser(P.data, P.offset), i.tables.prep = D.parseByteList(U.length);
19006
19006
  break;
19007
19007
  case "glyf":
19008
19008
  x = U;
@@ -19033,76 +19033,76 @@ function Zg(n, t = {}) {
19033
19033
  break;
19034
19034
  case "gasp":
19035
19035
  try {
19036
- P = et(r, U), i.tables.gasp = tl.parse(P.data, P.offset);
19037
- } catch (Q) {
19038
- console.warn("Failed to parse gasp table, skipping."), console.warn(Q);
19036
+ P = tt(r, U), i.tables.gasp = tl.parse(P.data, P.offset);
19037
+ } catch (K) {
19038
+ console.warn("Failed to parse gasp table, skipping."), console.warn(K);
19039
19039
  }
19040
19040
  break;
19041
19041
  case "SVG ":
19042
- P = et(r, U), i.tables.svg = el.parse(P.data, P.offset);
19042
+ P = tt(r, U), i.tables.svg = el.parse(P.data, P.offset);
19043
19043
  break;
19044
19044
  }
19045
19045
  }
19046
- const W = et(r, I);
19046
+ const W = tt(r, I);
19047
19047
  if (i.tables.name = kh.parse(W.data, W.offset, s), i.names = i.tables.name, x && O) {
19048
- const B = e === 0, U = et(r, O), P = Xg.parse(U.data, U.offset, i.numGlyphs, B), Q = et(r, x);
19049
- i.glyphs = cl.parse(Q.data, Q.offset, P, i, t);
19048
+ const B = e === 0, U = tt(r, O), P = Xg.parse(U.data, U.offset, i.numGlyphs, B), K = tt(r, x);
19049
+ i.glyphs = cl.parse(K.data, K.offset, P, i, t);
19050
19050
  } else if (h) {
19051
- const B = et(r, h);
19051
+ const B = tt(r, h);
19052
19052
  ta.parse(B.data, B.offset, i, t);
19053
19053
  } else if (l) {
19054
- const B = et(r, l);
19054
+ const B = tt(r, l);
19055
19055
  ta.parse(B.data, B.offset, i, t);
19056
19056
  } else
19057
19057
  throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");
19058
- const J = et(r, w);
19058
+ const J = tt(r, w);
19059
19059
  if (Gh.parse(i, J.data, J.offset, i.numberOfHMetrics, i.numGlyphs, i.glyphs, t), qf(i, t), M) {
19060
- const B = et(r, M);
19060
+ const B = tt(r, M);
19061
19061
  i.kerningPairs = jg.parse(B.data, B.offset);
19062
19062
  } else
19063
19063
  i.kerningPairs = {};
19064
19064
  if (b) {
19065
- const B = et(r, b);
19065
+ const B = tt(r, b);
19066
19066
  i.tables.gdef = Pg.parse(B.data, B.offset);
19067
19067
  }
19068
19068
  if (S) {
19069
- const B = et(r, S);
19069
+ const B = tt(r, S);
19070
19070
  i.tables.gpos = Gg.parse(B.data, B.offset), i.position.init();
19071
19071
  }
19072
19072
  if (v) {
19073
- const B = et(r, v);
19073
+ const B = tt(r, v);
19074
19074
  i.tables.gsub = jh.parse(B.data, B.offset);
19075
19075
  }
19076
19076
  if (u) {
19077
- const B = et(r, u);
19077
+ const B = tt(r, u);
19078
19078
  i.tables.fvar = Yh.parse(B.data, B.offset, i.names);
19079
19079
  }
19080
19080
  if (f) {
19081
- const B = et(r, f);
19081
+ const B = tt(r, f);
19082
19082
  i.tables.stat = Zh.parse(B.data, B.offset, i.tables.fvar);
19083
19083
  }
19084
19084
  if (p) {
19085
19085
  u || console.warn("This font provides a gvar table, but no fvar table, which is required for variable fonts."), x || console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");
19086
- const B = et(r, p);
19086
+ const B = tt(r, p);
19087
19087
  i.tables.gvar = Qh.parse(B.data, B.offset, i.tables.fvar, i.glyphs);
19088
19088
  }
19089
19089
  if (d) {
19090
19090
  u || console.warn("This font provides a cvar table, but no fvar table, which is required for variable fonts."), i.tables.cvt || console.warn("This font provides a cvar table, but no cvt table which could be made variable."), x || console.warn("This font provides a gvar table, but no glyf table. Glyph variation only works with TrueType outlines.");
19091
- const B = et(r, d);
19091
+ const B = tt(r, d);
19092
19092
  i.tables.cvar = Kh.parse(B.data, B.offset, i.tables.fvar, i.tables.cvt || []);
19093
19093
  }
19094
19094
  if (g) {
19095
19095
  u || console.warn("This font provides an avar table, but no fvar table, which is required for variable fonts.");
19096
- const B = et(r, g);
19096
+ const B = tt(r, g);
19097
19097
  i.tables.avar = Jh.parse(B.data, B.offset, i.tables.fvar);
19098
19098
  }
19099
19099
  if (F) {
19100
19100
  u || console.warn("This font provides an HVAR table, but no fvar table, which is required for variable fonts."), w || console.warn("This font provides an HVAR table, but no hmtx table to vary.");
19101
- const B = et(r, F);
19101
+ const B = tt(r, F);
19102
19102
  i.tables.hvar = _g.parse(B.data, B.offset, i.tables.fvar);
19103
19103
  }
19104
19104
  if (V) {
19105
- const B = et(r, V);
19105
+ const B = tt(r, V);
19106
19106
  i.tables.meta = $h.parse(B.data, B.offset), i.metas = i.tables.meta;
19107
19107
  }
19108
19108
  return i.palettes = new rl(i), i;
@@ -19239,8 +19239,8 @@ function Jg(n, t = 1e-4) {
19239
19239
  for (let B = 0; B < D; B++) {
19240
19240
  const U = u[B], P = f[B];
19241
19241
  if (W[P](a, I[U](v)), V)
19242
- for (let Q = 0, gt = V.length; Q < gt; Q++)
19243
- J[Q][P](a, V[Q][U](v));
19242
+ for (let K = 0, gt = V.length; K < gt; K++)
19243
+ J[K][P](a, V[K][U](v));
19244
19244
  }
19245
19245
  }
19246
19246
  e[w] = a, l.push(a), a++;
@@ -19562,7 +19562,8 @@ function hm(n, t = 32) {
19562
19562
  u.has(p) || f(p);
19563
19563
  return l;
19564
19564
  }
19565
- class lm {
19565
+ const lm = 61440;
19566
+ class um {
19566
19567
  constructor(t = 512) {
19567
19568
  this.maxSize = t, this.map = /* @__PURE__ */ new Map();
19568
19569
  }
@@ -19586,13 +19587,13 @@ class lm {
19586
19587
  this.map.clear();
19587
19588
  }
19588
19589
  }
19589
- class um extends ih {
19590
+ class fm extends ih {
19590
19591
  /**
19591
19592
  * Creates a new instance of MeshFont.
19592
19593
  * @param fontData - Either a MeshFontData object containing font information or an ArrayBuffer containing raw font data
19593
19594
  */
19594
19595
  constructor(t) {
19595
- super(t), this.type = "mesh", this.glyphCache = new lm(512);
19596
+ super(t), this.type = "mesh", this.glyphCache = new um(512);
19596
19597
  const e = t.data;
19597
19598
  if (e instanceof ArrayBuffer) {
19598
19599
  const s = this.parseMeshFont(e);
@@ -19632,6 +19633,23 @@ class um extends ih {
19632
19633
  };
19633
19634
  return { font: e, data: a };
19634
19635
  }
19636
+ /**
19637
+ * Resolves the opentype lookup character for a drawing character.
19638
+ * Tries Unicode first, then Symbol encoding (0xF000 + ASCII) for GDT fonts.
19639
+ */
19640
+ opentypeLookupChar(t) {
19641
+ if (!this.opentypeFont || t.length !== 1)
19642
+ return t;
19643
+ const e = t.charCodeAt(0), s = this.opentypeFont.charToGlyphIndex(t);
19644
+ if (s != null && s > 0)
19645
+ return t;
19646
+ if (e >= 32 && e <= 126) {
19647
+ const i = String.fromCharCode(lm + e), r = this.opentypeFont.charToGlyphIndex(i);
19648
+ if (r != null && r > 0)
19649
+ return i;
19650
+ }
19651
+ return t;
19652
+ }
19635
19653
  /**
19636
19654
  * Whether opentype maps the character to a real glyph (not .notdef at index 0).
19637
19655
  *
@@ -19642,8 +19660,8 @@ class um extends ih {
19642
19660
  */
19643
19661
  opentypeHasGlyph(t) {
19644
19662
  if (!this.opentypeFont) return !1;
19645
- const e = this.opentypeFont.charToGlyphIndex(t);
19646
- return e != null && e > 0;
19663
+ const e = this.opentypeLookupChar(t), s = this.opentypeFont.charToGlyphIndex(e);
19664
+ return s != null && s > 0;
19647
19665
  }
19648
19666
  /**
19649
19667
  * Return true if this font contains glyph of the specified character. Otherwise, return false.
@@ -19674,18 +19692,18 @@ class um extends ih {
19674
19692
  return;
19675
19693
  }
19676
19694
  if (this.opentypeHasGlyph(t)) {
19677
- const s = this.opentypeFont.charToGlyph(t);
19678
- if (!s || !s.path) return;
19679
- const i = Math.round, r = {
19680
- ha: i(s.advanceWidth ?? 0),
19681
- x_min: i(s.xMin ?? 0),
19682
- x_max: i(s.xMax ?? 0),
19695
+ const s = this.opentypeLookupChar(t), i = this.opentypeFont.charToGlyph(s);
19696
+ if (!i || !i.path) return;
19697
+ const r = Math.round, a = {
19698
+ ha: r(i.advanceWidth ?? 0),
19699
+ x_min: r(i.xMin ?? 0),
19700
+ x_max: r(i.xMax ?? 0),
19683
19701
  o: ""
19684
19702
  };
19685
- s.path.commands.forEach((a) => {
19686
- let o = a.type.toLowerCase();
19687
- o === "c" && (o = "b"), r.o += o + " ", a.x !== void 0 && a.y !== void 0 && (r.o += i(a.x) + " " + i(a.y) + " "), a.x1 !== void 0 && a.y1 !== void 0 && (r.o += i(a.x1) + " " + i(a.y1) + " "), a.x2 !== void 0 && a.y2 !== void 0 && (r.o += i(a.x2) + " " + i(a.y2) + " ");
19688
- }), this.data.glyphs[t] = r, this.glyphCache.set(t, r);
19703
+ i.path.commands.forEach((o) => {
19704
+ let c = o.type.toLowerCase();
19705
+ c === "c" && (c = "b"), a.o += c + " ", o.x !== void 0 && o.y !== void 0 && (a.o += r(o.x) + " " + r(o.y) + " "), o.x1 !== void 0 && o.y1 !== void 0 && (a.o += r(o.x1) + " " + r(o.y1) + " "), o.x2 !== void 0 && o.y2 !== void 0 && (a.o += r(o.x2) + " " + r(o.y2) + " ");
19706
+ }), this.data.glyphs[t] = a, this.glyphCache.set(t, a);
19689
19707
  }
19690
19708
  }
19691
19709
  /**
@@ -19895,11 +19913,11 @@ class Rt {
19895
19913
  );
19896
19914
  }
19897
19915
  }
19898
- var Ct = /* @__PURE__ */ ((n) => (n.SHAPES = "shapes", n.BIGFONT = "bigfont", n.UNIFONT = "unifont", n))(Ct || {});
19899
- class fm {
19916
+ var xt = /* @__PURE__ */ ((n) => (n.SHAPES = "shapes", n.BIGFONT = "bigfont", n.UNIFONT = "unifont", n))(xt || {});
19917
+ class pm {
19900
19918
  parse(t) {
19901
19919
  const e = this.parseHeader(t).split(" "), s = e[1].toLocaleLowerCase();
19902
- if (!Object.values(Ct).includes(s))
19920
+ if (!Object.values(xt).includes(s))
19903
19921
  throw new Error(`Invalid font type: ${s}`);
19904
19922
  return {
19905
19923
  fileHeader: e[0],
@@ -19923,12 +19941,12 @@ class fm {
19923
19941
  return e.trim();
19924
19942
  }
19925
19943
  }
19926
- const Qt = 10, pm = [13, 10, 0];
19944
+ const Qt = 10, dm = [13, 10, 0];
19927
19945
  function ml(n) {
19928
19946
  const t = n.indexOf(0);
19929
19947
  return t < 0 ? { name: null, bytecode: n } : { name: t > 0 ? new TextDecoder("ascii").decode(n.subarray(0, t)) : null, bytecode: n.subarray(t + 1) };
19930
19948
  }
19931
- class dm {
19949
+ class gm {
19932
19950
  parse(t) {
19933
19951
  try {
19934
19952
  t.readBytes(4);
@@ -19973,7 +19991,7 @@ class dm {
19973
19991
  const c = r[0];
19974
19992
  try {
19975
19993
  const h = new TextDecoder().decode(c);
19976
- let l = c.findIndex((u) => pm.includes(u));
19994
+ let l = c.findIndex((u) => dm.includes(u));
19977
19995
  l >= 0 && (o.info = h.substring(0, l), l + 3 < c.length && (o.baseUp = c[l + 1], o.baseDown = c[l + 2], o.height = o.baseDown + o.baseUp, o.width = o.height, o.orientation = c[l + 3] === 0 ? "horizontal" : "vertical"));
19978
19996
  } catch {
19979
19997
  console.warn("Failed to parse font info block");
@@ -19994,7 +20012,7 @@ class dm {
19994
20012
  }
19995
20013
  }
19996
20014
  }
19997
- class gm {
20015
+ class mm {
19998
20016
  parse(t) {
19999
20017
  try {
20000
20018
  t.readInt16();
@@ -20085,7 +20103,7 @@ class gm {
20085
20103
  return { text: e, pos: s };
20086
20104
  }
20087
20105
  }
20088
- class mm {
20106
+ class ym {
20089
20107
  parse(t) {
20090
20108
  try {
20091
20109
  const e = t.readInt32();
@@ -20138,15 +20156,15 @@ class mm {
20138
20156
  }
20139
20157
  }
20140
20158
  }
20141
- class ym {
20159
+ class xm {
20142
20160
  static createParser(t) {
20143
20161
  switch (t) {
20144
- case Ct.SHAPES:
20145
- return new dm();
20146
- case Ct.BIGFONT:
20162
+ case xt.SHAPES:
20147
20163
  return new gm();
20148
- case Ct.UNIFONT:
20164
+ case xt.BIGFONT:
20149
20165
  return new mm();
20166
+ case xt.UNIFONT:
20167
+ return new ym();
20150
20168
  default:
20151
20169
  throw new Error(`Unsupported font type: ${t}`);
20152
20170
  }
@@ -20405,16 +20423,16 @@ class os {
20405
20423
  return `<svg width="100%" height="100%" viewBox="${r}" preserveAspectRatio="xMidYMid meet">${a}</svg>`;
20406
20424
  }
20407
20425
  }
20408
- const xm = Math.PI / 18;
20409
- class bm {
20426
+ const bm = Math.PI / 18;
20427
+ class vm {
20410
20428
  constructor(t) {
20411
- this.shapeCache = /* @__PURE__ */ new Map(), this.shapeData = /* @__PURE__ */ new Map(), this.fontData = t;
20429
+ this.shapeCache = /* @__PURE__ */ new Map(), this.subshapeCache = /* @__PURE__ */ new Map(), this.shapeData = /* @__PURE__ */ new Map(), this.fontData = t;
20412
20430
  }
20413
20431
  /**
20414
20432
  * Releases parsed shapes and cached shapes
20415
20433
  */
20416
20434
  release() {
20417
- this.shapeCache.clear(), this.shapeData.clear();
20435
+ this.shapeCache.clear(), this.subshapeCache.clear(), this.shapeData.clear();
20418
20436
  }
20419
20437
  /**
20420
20438
  * Parses a character's shape with the given font size.
@@ -20442,7 +20460,7 @@ class bm {
20442
20460
  const i = this.fontData.content.data;
20443
20461
  if (i[t]) {
20444
20462
  const r = i[t];
20445
- s = this.parseShape(r), this.shapeData.set(t, s), this.shapeCache.set(t, s);
20463
+ s = this.parseShape(r, { flushOnEnd: !0 }), this.shapeData.set(t, s), this.shapeCache.set(t, s);
20446
20464
  }
20447
20465
  }
20448
20466
  if (s) {
@@ -20507,10 +20525,10 @@ class bm {
20507
20525
  sp: a,
20508
20526
  isPenDown: o,
20509
20527
  scale: 1,
20510
- // Only flush a pen-down polyline on shape end when parsing a unifont
20511
- // subshape with inherited pen (amgdt %%132). Global flush regresses bigfont
20512
- // subshape caches (e.g. gbcbig.shx CJK glyphs).
20513
- flushEndPolyline: e.initialPenDown ?? !1
20528
+ // Top-level glyphs flush trailing pen-down strokes at 0x00. Subshape
20529
+ // primitives and inherited-pen unifont subshapes (amgdt %%132) opt in
20530
+ // via flushOnEnd; bigfont subshape cache keeps flush off to avoid regressions.
20531
+ flushEndPolyline: e.flushOnEnd ?? !1
20514
20532
  };
20515
20533
  for (let h = 0; h < t.length; h++) {
20516
20534
  const l = t[h];
@@ -20648,18 +20666,18 @@ class bm {
20648
20666
  let i = e, r = 0, a, o = s.scale * this.fontData.content.height, c = o;
20649
20667
  const h = s.currentPoint.clone();
20650
20668
  switch (s.currentPolyline.length > 1 && (s.polylines.push(s.currentPolyline.slice()), s.currentPolyline = []), this.fontData.header.fontType) {
20651
- case Ct.SHAPES:
20669
+ case xt.SHAPES:
20652
20670
  i++, r = t[i];
20653
20671
  break;
20654
- case Ct.BIGFONT:
20672
+ case xt.BIGFONT:
20655
20673
  i++, r = t[i], r === 0 && (i++, r = t[i++] << 8 | t[i++], h.x = Rt.byteToSByte(t[i++]) * s.scale, h.y = Rt.byteToSByte(t[i++]) * s.scale, this.fontData.content.isExtended && (c = t[i++] * s.scale), o = t[i] * s.scale);
20656
20674
  break;
20657
- case Ct.UNIFONT:
20675
+ case xt.UNIFONT:
20658
20676
  i++, r = t[i++] << 8 | t[i++];
20659
20677
  break;
20660
20678
  }
20661
20679
  if (r !== 0)
20662
- if (this.fontData.header.fontType === Ct.UNIFONT) {
20680
+ if (this.fontData.header.fontType === xt.UNIFONT) {
20663
20681
  const l = s.isPenDown;
20664
20682
  a = this.getScaledSubshapeAtInsertPoint(
20665
20683
  r,
@@ -20710,7 +20728,7 @@ class bm {
20710
20728
  let f = l & 7;
20711
20729
  f === 0 && (f = 8), a !== 0 && f--;
20712
20730
  const p = Math.PI / 4;
20713
- let d = p * f, g = xm, x = 1;
20731
+ let d = p * f, g = bm, x = 1;
20714
20732
  l < 0 && (g = -g, d = -d, x = -1);
20715
20733
  let b = p * u, S = b + d;
20716
20734
  b += p * r / 256 * x, S += p * a / 256 * x;
@@ -20784,13 +20802,13 @@ class bm {
20784
20802
  break;
20785
20803
  case 7:
20786
20804
  switch (this.fontData.header.fontType) {
20787
- case Ct.SHAPES:
20805
+ case xt.SHAPES:
20788
20806
  e++;
20789
20807
  break;
20790
- case Ct.BIGFONT:
20808
+ case xt.BIGFONT:
20791
20809
  e++, t[e] === 0 && (e += this.fontData.content.isExtended ? 6 : 5);
20792
20810
  break;
20793
- case Ct.UNIFONT:
20811
+ case xt.UNIFONT:
20794
20812
  e += 2;
20795
20813
  break;
20796
20814
  }
@@ -20831,12 +20849,12 @@ class bm {
20831
20849
  const c = this.fontData.content.data[t];
20832
20850
  if (!c)
20833
20851
  return;
20834
- a = this.parseShape(c, { initialPenDown: !0 });
20835
- } else if (a = this.shapeCache.get(t), !a) {
20852
+ a = this.parseShape(c, { initialPenDown: !0, flushOnEnd: !0 });
20853
+ } else if (a = this.subshapeCache.get(t), !a) {
20836
20854
  const c = this.fontData.content.data[t];
20837
20855
  if (!c)
20838
20856
  return;
20839
- a = this.parseShape(c), this.shapeData.set(t, a), this.shapeCache.set(t, a);
20857
+ a = this.parseShape(c, { flushOnEnd: !1 }), this.shapeData.set(t, a), this.subshapeCache.set(t, a);
20840
20858
  }
20841
20859
  const o = a.normalizeToOrigin(!0);
20842
20860
  return this.scaleShapeByHeightAndWidth(o, s, e).offset(i, !1);
@@ -20864,7 +20882,7 @@ class bm {
20864
20882
  return o.add(e), o;
20865
20883
  }
20866
20884
  }
20867
- class vm {
20885
+ class Sm {
20868
20886
  /**
20869
20887
  * Creates a new ShxFont instance.
20870
20888
  * @param data - Either raw binary data of the SHX font file (ArrayBuffer) or pre-parsed font data (ShxFontData)
@@ -20872,14 +20890,14 @@ class vm {
20872
20890
  */
20873
20891
  constructor(t) {
20874
20892
  if (t instanceof ArrayBuffer) {
20875
- const e = new Rt(t), s = new fm().parse(e), i = ym.createParser(s.fontType).parse(e);
20893
+ const e = new Rt(t), s = new pm().parse(e), i = xm.createParser(s.fontType).parse(e);
20876
20894
  this.fontData = {
20877
20895
  header: s,
20878
20896
  content: i
20879
20897
  };
20880
20898
  } else
20881
20899
  this.fontData = t;
20882
- this.shapeParser = new bm(this.fontData);
20900
+ this.shapeParser = new vm(this.fontData);
20883
20901
  }
20884
20902
  /**
20885
20903
  * Return true if this font contains glyph of the specified character. Otherwise, return false.
@@ -20941,7 +20959,7 @@ class vm {
20941
20959
  */
20942
20960
  getCharShape(t, e) {
20943
20961
  let s = this.shapeParser.getCharShape(t, e);
20944
- return s && this.fontData.header.fontType === Ct.BIGFONT && s.bbox.minY <= e * 0.5 && (s = s.normalizeToOrigin()), s;
20962
+ return s && this.fontData.header.fontType === xt.BIGFONT && s.bbox.minY <= e * 0.5 && (s = s.normalizeToOrigin()), s;
20945
20963
  }
20946
20964
  /**
20947
20965
  * Releases resources used by the font.
@@ -20951,10 +20969,10 @@ class vm {
20951
20969
  this.shapeParser.release();
20952
20970
  }
20953
20971
  }
20954
- function Sm(n) {
20972
+ function wm(n) {
20955
20973
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
20956
20974
  }
20957
- function wm(n) {
20975
+ function Cm(n) {
20958
20976
  if (n.__esModule) return n;
20959
20977
  var t = n.default;
20960
20978
  if (typeof t == "function") {
@@ -20974,11 +20992,11 @@ function wm(n) {
20974
20992
  }), e;
20975
20993
  }
20976
20994
  var yl = { exports: {} }, Sa = {}, Pi = {};
20977
- Pi.byteLength = Fm;
20978
- Pi.toByteArray = Am;
20979
- Pi.fromByteArray = Om;
20980
- var ye = [], Zt = [], Cm = typeof Uint8Array < "u" ? Uint8Array : Array, kr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
20981
- for (var In = 0, Tm = kr.length; In < Tm; ++In)
20995
+ Pi.byteLength = km;
20996
+ Pi.toByteArray = Em;
20997
+ Pi.fromByteArray = _m;
20998
+ var ye = [], Zt = [], Tm = typeof Uint8Array < "u" ? Uint8Array : Array, kr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
20999
+ for (var In = 0, Fm = kr.length; In < Fm; ++In)
20982
21000
  ye[In] = kr[In], Zt[kr.charCodeAt(In)] = In;
20983
21001
  Zt[45] = 62;
20984
21002
  Zt[95] = 63;
@@ -20991,30 +21009,30 @@ function xl(n) {
20991
21009
  var s = e === t ? 0 : 4 - e % 4;
20992
21010
  return [e, s];
20993
21011
  }
20994
- function Fm(n) {
21012
+ function km(n) {
20995
21013
  var t = xl(n), e = t[0], s = t[1];
20996
21014
  return (e + s) * 3 / 4 - s;
20997
21015
  }
20998
- function km(n, t, e) {
21016
+ function Am(n, t, e) {
20999
21017
  return (t + e) * 3 / 4 - e;
21000
21018
  }
21001
- function Am(n) {
21002
- var t, e = xl(n), s = e[0], i = e[1], r = new Cm(km(n, s, i)), a = 0, o = i > 0 ? s - 4 : s, c;
21019
+ function Em(n) {
21020
+ var t, e = xl(n), s = e[0], i = e[1], r = new Tm(Am(n, s, i)), a = 0, o = i > 0 ? s - 4 : s, c;
21003
21021
  for (c = 0; c < o; c += 4)
21004
21022
  t = Zt[n.charCodeAt(c)] << 18 | Zt[n.charCodeAt(c + 1)] << 12 | Zt[n.charCodeAt(c + 2)] << 6 | Zt[n.charCodeAt(c + 3)], r[a++] = t >> 16 & 255, r[a++] = t >> 8 & 255, r[a++] = t & 255;
21005
21023
  return i === 2 && (t = Zt[n.charCodeAt(c)] << 2 | Zt[n.charCodeAt(c + 1)] >> 4, r[a++] = t & 255), i === 1 && (t = Zt[n.charCodeAt(c)] << 10 | Zt[n.charCodeAt(c + 1)] << 4 | Zt[n.charCodeAt(c + 2)] >> 2, r[a++] = t >> 8 & 255, r[a++] = t & 255), r;
21006
21024
  }
21007
- function Em(n) {
21025
+ function Mm(n) {
21008
21026
  return ye[n >> 18 & 63] + ye[n >> 12 & 63] + ye[n >> 6 & 63] + ye[n & 63];
21009
21027
  }
21010
- function Mm(n, t, e) {
21028
+ function Om(n, t, e) {
21011
21029
  for (var s, i = [], r = t; r < e; r += 3)
21012
- s = (n[r] << 16 & 16711680) + (n[r + 1] << 8 & 65280) + (n[r + 2] & 255), i.push(Em(s));
21030
+ s = (n[r] << 16 & 16711680) + (n[r + 1] << 8 & 65280) + (n[r + 2] & 255), i.push(Mm(s));
21013
21031
  return i.join("");
21014
21032
  }
21015
- function Om(n) {
21033
+ function _m(n) {
21016
21034
  for (var t, e = n.length, s = e % 3, i = [], r = 16383, a = 0, o = e - s; a < o; a += r)
21017
- i.push(Mm(n, a, a + r > o ? o : a + r));
21035
+ i.push(Om(n, a, a + r > o ? o : a + r));
21018
21036
  return s === 1 ? (t = n[e - 1], i.push(
21019
21037
  ye[t >> 2] + ye[t << 4 & 63] + "=="
21020
21038
  )) : s === 2 && (t = (n[e - 2] << 8) + n[e - 1], i.push(
@@ -21272,7 +21290,7 @@ wa.write = function(n, t, e, s, i, r) {
21272
21290
  return y;
21273
21291
  case "utf8":
21274
21292
  case "utf-8":
21275
- return tt(C).length;
21293
+ return Q(C).length;
21276
21294
  case "ucs2":
21277
21295
  case "ucs-2":
21278
21296
  case "utf16le":
@@ -21284,7 +21302,7 @@ wa.write = function(n, t, e, s, i, r) {
21284
21302
  return Pt(C).length;
21285
21303
  default:
21286
21304
  if (A)
21287
- return T ? -1 : tt(C).length;
21305
+ return T ? -1 : Q(C).length;
21288
21306
  m = ("" + m).toLowerCase(), A = !0;
21289
21307
  }
21290
21308
  }
@@ -21296,7 +21314,7 @@ wa.write = function(n, t, e, s, i, r) {
21296
21314
  for (C || (C = "utf8"); ; )
21297
21315
  switch (C) {
21298
21316
  case "hex":
21299
- return St(this, m, y);
21317
+ return wt(this, m, y);
21300
21318
  case "utf8":
21301
21319
  case "utf-8":
21302
21320
  return U(this, m, y);
@@ -21437,7 +21455,7 @@ wa.write = function(n, t, e, s, i, r) {
21437
21455
  return R;
21438
21456
  }
21439
21457
  function V(C, m, y, T) {
21440
- return zt(tt(m, C.length - y), C, y, T);
21458
+ return zt(Q(m, C.length - y), C, y, T);
21441
21459
  }
21442
21460
  function D(C, m, y, T) {
21443
21461
  return zt(kt(m), C, y, T);
@@ -21516,10 +21534,10 @@ wa.write = function(n, t, e, s, i, r) {
21516
21534
  }
21517
21535
  R === null ? (R = 65533, Y = 1) : R > 65535 && (R -= 65536, T.push(R >>> 10 & 1023 | 55296), R = 56320 | R & 1023), T.push(R), A += Y;
21518
21536
  }
21519
- return Q(T);
21537
+ return K(T);
21520
21538
  }
21521
21539
  var P = 4096;
21522
- function Q(C) {
21540
+ function K(C) {
21523
21541
  var m = C.length;
21524
21542
  if (m <= P)
21525
21543
  return String.fromCharCode.apply(String, C);
@@ -21544,7 +21562,7 @@ wa.write = function(n, t, e, s, i, r) {
21544
21562
  T += String.fromCharCode(C[A]);
21545
21563
  return T;
21546
21564
  }
21547
- function St(C, m, y) {
21565
+ function wt(C, m, y) {
21548
21566
  var T = C.length;
21549
21567
  (!m || m < 0) && (m = 0), (!y || y < 0 || y > T) && (y = T);
21550
21568
  for (var A = "", _ = m; _ < y; ++_)
@@ -21693,13 +21711,13 @@ wa.write = function(n, t, e, s, i, r) {
21693
21711
  }, o.prototype.writeFloatBE = function(m, y, T) {
21694
21712
  return Ft(this, m, y, !1, T);
21695
21713
  };
21696
- function bt(C, m, y, T, A) {
21714
+ function vt(C, m, y, T, A) {
21697
21715
  return m = +m, y = y >>> 0, A || yt(C, m, y, 8), e.write(C, m, y, T, 52, 8), y + 8;
21698
21716
  }
21699
21717
  o.prototype.writeDoubleLE = function(m, y, T) {
21700
- return bt(this, m, y, !0, T);
21718
+ return vt(this, m, y, !0, T);
21701
21719
  }, o.prototype.writeDoubleBE = function(m, y, T) {
21702
- return bt(this, m, y, !1, T);
21720
+ return vt(this, m, y, !1, T);
21703
21721
  }, o.prototype.copy = function(m, y, T, A) {
21704
21722
  if (!o.isBuffer(m)) throw new TypeError("argument should be a Buffer");
21705
21723
  if (T || (T = 0), !A && A !== 0 && (A = this.length), y >= m.length && (y = m.length), y || (y = 0), A > 0 && A < T && (A = T), A === T || m.length === 0 || this.length === 0) return 0;
@@ -21743,14 +21761,14 @@ wa.write = function(n, t, e, s, i, r) {
21743
21761
  }
21744
21762
  return this;
21745
21763
  };
21746
- var wt = /[^+/0-9A-Za-z-_]/g;
21764
+ var Ct = /[^+/0-9A-Za-z-_]/g;
21747
21765
  function ct(C) {
21748
- if (C = C.split("=")[0], C = C.trim().replace(wt, ""), C.length < 2) return "";
21766
+ if (C = C.split("=")[0], C = C.trim().replace(Ct, ""), C.length < 2) return "";
21749
21767
  for (; C.length % 4 !== 0; )
21750
21768
  C = C + "=";
21751
21769
  return C;
21752
21770
  }
21753
- function tt(C, m) {
21771
+ function Q(C, m) {
21754
21772
  m = m || 1 / 0;
21755
21773
  for (var y, T = C.length, A = null, _ = [], R = 0; R < T; ++R) {
21756
21774
  if (y = C.charCodeAt(R), y > 55295 && y < 57344) {
@@ -21883,15 +21901,15 @@ Fa.prototype.write = function(n) {
21883
21901
  Fa.prototype.end = function() {
21884
21902
  return this.decoder.end();
21885
21903
  };
21886
- var _m = typeof Object.hasOwn > "u" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
21887
- function Lm(n, t) {
21904
+ var Lm = typeof Object.hasOwn > "u" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
21905
+ function Im(n, t) {
21888
21906
  for (var e in t)
21889
- _m(t, e) && (n[e] = t[e]);
21907
+ Lm(t, e) && (n[e] = t[e]);
21890
21908
  }
21891
- var vl = Lm, Ar = {}, Er = {}, ei = { exports: {} };
21909
+ var vl = Im, Ar = {}, Er = {}, ei = { exports: {} };
21892
21910
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
21893
21911
  var vc;
21894
- function Im() {
21912
+ function Rm() {
21895
21913
  return vc || (vc = 1, function(n, t) {
21896
21914
  var e = Sa, s = e.Buffer;
21897
21915
  function i(a, o) {
@@ -21923,10 +21941,10 @@ function Im() {
21923
21941
  }(ei, ei.exports)), ei.exports;
21924
21942
  }
21925
21943
  var Sc;
21926
- function Rm() {
21944
+ function Bm() {
21927
21945
  if (Sc) return Er;
21928
21946
  Sc = 1;
21929
- var n = Im().Buffer, t = n.isEncoding || function(b) {
21947
+ var n = Rm().Buffer, t = n.isEncoding || function(b) {
21930
21948
  switch (b = "" + b, b && b.toLowerCase()) {
21931
21949
  case "hex":
21932
21950
  case "utf8":
@@ -22081,7 +22099,7 @@ function Rm() {
22081
22099
  return Er;
22082
22100
  }
22083
22101
  var Mr, wc;
22084
- function Bm() {
22102
+ function Dm() {
22085
22103
  if (wc) return Mr;
22086
22104
  wc = 1;
22087
22105
  var n = tn.Buffer;
@@ -22102,7 +22120,7 @@ function Bm() {
22102
22120
  this.enc = h.encodingName, this.bomAware = h.bomAware, this.enc === "base64" ? this.encoder = r : this.enc === "utf8" ? this.encoder = c : this.enc === "cesu8" && (this.enc = "utf8", this.encoder = a, n.from("eda0bdedb2a9", "hex").toString() !== "💩" && (this.decoder = o, this.defaultCharUnicode = l.defaultCharUnicode));
22103
22121
  }
22104
22122
  t.prototype.encoder = i, t.prototype.decoder = s;
22105
- var e = Rm().StringDecoder;
22123
+ var e = Bm().StringDecoder;
22106
22124
  function s(h, l) {
22107
22125
  this.decoder = new e(l.enc);
22108
22126
  }
@@ -22168,7 +22186,7 @@ function Bm() {
22168
22186
  }, Mr;
22169
22187
  }
22170
22188
  var Me = {}, Cc;
22171
- function Dm() {
22189
+ function Um() {
22172
22190
  if (Cc) return Me;
22173
22191
  Cc = 1;
22174
22192
  var n = tn.Buffer;
@@ -22287,7 +22305,7 @@ function Dm() {
22287
22305
  return Me;
22288
22306
  }
22289
22307
  var ni = {}, Tc;
22290
- function Um() {
22308
+ function Pm() {
22291
22309
  if (Tc) return ni;
22292
22310
  Tc = 1;
22293
22311
  var n = tn.Buffer;
@@ -22373,7 +22391,7 @@ function Um() {
22373
22391
  return ni;
22374
22392
  }
22375
22393
  var es = {}, Fc;
22376
- function Pm() {
22394
+ function zm() {
22377
22395
  if (Fc) return es;
22378
22396
  Fc = 1;
22379
22397
  var n = tn.Buffer;
@@ -22469,7 +22487,7 @@ function Pm() {
22469
22487
  }, es;
22470
22488
  }
22471
22489
  var Or = {}, kc;
22472
- function zm() {
22490
+ function Nm() {
22473
22491
  if (kc) return Or;
22474
22492
  kc = 1;
22475
22493
  var n = tn.Buffer;
@@ -22510,7 +22528,7 @@ function zm() {
22510
22528
  }, Or;
22511
22529
  }
22512
22530
  var _r, Ac;
22513
- function Nm() {
22531
+ function Hm() {
22514
22532
  return Ac || (Ac = 1, _r = {
22515
22533
  // Not supported by iconv, not sure why.
22516
22534
  10029: "maccenteuro",
@@ -22659,7 +22677,7 @@ function Nm() {
22659
22677
  }), _r;
22660
22678
  }
22661
22679
  var Lr, Ec;
22662
- function Hm() {
22680
+ function Gm() {
22663
22681
  return Ec || (Ec = 1, Lr = {
22664
22682
  437: "cp437",
22665
22683
  737: "cp737",
@@ -23115,7 +23133,7 @@ function Hm() {
23115
23133
  }), Lr;
23116
23134
  }
23117
23135
  var Ir = {}, Mc;
23118
- function Gm() {
23136
+ function Vm() {
23119
23137
  if (Mc) return Ir;
23120
23138
  Mc = 1;
23121
23139
  var n = tn.Buffer;
@@ -23355,7 +23373,7 @@ function Gm() {
23355
23373
  }
23356
23374
  return Ir;
23357
23375
  }
23358
- const Vm = [
23376
+ const Wm = [
23359
23377
  [
23360
23378
  "0",
23361
23379
  "\0",
@@ -23900,7 +23918,7 @@ const Vm = [
23900
23918
  "fc40",
23901
23919
  "髜魵魲鮏鮱鮻鰀鵰鵫鶴鸙黑"
23902
23920
  ]
23903
- ], Wm = [
23921
+ ], qm = [
23904
23922
  [
23905
23923
  "0",
23906
23924
  "\0",
@@ -27598,7 +27616,7 @@ const Vm = [
27598
27616
  "8135f437",
27599
27617
  ""
27600
27618
  ]
27601
- ], qm = [
27619
+ ], jm = [
27602
27620
  128,
27603
27621
  165,
27604
27622
  169,
@@ -27806,7 +27824,7 @@ const Vm = [
27806
27824
  65375,
27807
27825
  65510,
27808
27826
  65536
27809
- ], jm = [
27827
+ ], $m = [
27810
27828
  0,
27811
27829
  36,
27812
27830
  38,
@@ -28014,10 +28032,10 @@ const Vm = [
28014
28032
  39265,
28015
28033
  39394,
28016
28034
  189e3
28017
- ], $m = {
28018
- uChars: qm,
28019
- gbChars: jm
28020
- }, Xm = [
28035
+ ], Xm = {
28036
+ uChars: jm,
28037
+ gbChars: $m
28038
+ }, Ym = [
28021
28039
  [
28022
28040
  "0",
28023
28041
  "\0",
@@ -31120,7 +31138,7 @@ const Vm = [
31120
31138
  "f9a1",
31121
31139
  "龤灨灥糷虪蠾蠽蠿讞貜躩軉靋顳顴飌饡馫驤驦驧鬤鸕鸗齈戇欞爧虌躨钂钀钁驩驨鬮鸙爩虋讟钃鱹麷癵驫鱺鸝灩灪麤齾齉龘碁銹裏墻恒粧嫺╔╦╗╠╬╣╚╩╝╒╤╕╞╪╡╘╧╛╓╥╖╟╫╢╙╨╜║═╭╮╰╯▓"
31122
31140
  ]
31123
- ], Ym = [
31141
+ ], Zm = [
31124
31142
  [
31125
31143
  "8740",
31126
31144
  "䏰䰲䘃䖦䕸𧉧䵷䖳𧲱䳢𧳅㮕䜶䝄䱇䱀𤊿𣘗𧍒𦺋𧃒䱗𪍑䝏䗚䲅𧱬䴇䪤䚡𦬣爥𥩔𡩣𣸆𣽡晍囻"
@@ -31625,7 +31643,7 @@ const Vm = [
31625
31643
  ]
31626
31644
  ];
31627
31645
  var Br, Lc;
31628
- function Zm() {
31646
+ function Jm() {
31629
31647
  return Lc || (Lc = 1, Br = {
31630
31648
  // == Japanese/ShiftJIS ====================================================
31631
31649
  // All japanese encodings are based on JIS X set of standards:
@@ -31660,7 +31678,7 @@ function Zm() {
31660
31678
  shiftjis: {
31661
31679
  type: "_dbcs",
31662
31680
  table: function() {
31663
- return Vm;
31681
+ return Wm;
31664
31682
  },
31665
31683
  encodeAdd: { "¥": 92, "‾": 126 },
31666
31684
  encodeSkipVals: [{ from: 60736, to: 63808 }]
@@ -31678,7 +31696,7 @@ function Zm() {
31678
31696
  eucjp: {
31679
31697
  type: "_dbcs",
31680
31698
  table: function() {
31681
- return Wm;
31699
+ return qm;
31682
31700
  },
31683
31701
  encodeAdd: { "¥": 92, "‾": 126 }
31684
31702
  },
@@ -31725,7 +31743,7 @@ function Zm() {
31725
31743
  return Rr.concat(Oc);
31726
31744
  },
31727
31745
  gb18030: function() {
31728
- return $m;
31746
+ return Xm;
31729
31747
  },
31730
31748
  encodeSkipVals: [128],
31731
31749
  encodeAdd: { "€": 41699 }
@@ -31739,7 +31757,7 @@ function Zm() {
31739
31757
  cp949: {
31740
31758
  type: "_dbcs",
31741
31759
  table: function() {
31742
- return Xm;
31760
+ return Ym;
31743
31761
  }
31744
31762
  },
31745
31763
  cseuckr: "cp949",
@@ -31786,7 +31804,7 @@ function Zm() {
31786
31804
  big5hkscs: {
31787
31805
  type: "_dbcs",
31788
31806
  table: function() {
31789
- return _c.concat(Ym);
31807
+ return _c.concat(Zm);
31790
31808
  },
31791
31809
  encodeSkipVals: [
31792
31810
  // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of
@@ -31868,10 +31886,9 @@ function Zm() {
31868
31886
  }), Br;
31869
31887
  }
31870
31888
  var Ic;
31871
- function Jm() {
31889
+ function Km() {
31872
31890
  return Ic || (Ic = 1, function(n) {
31873
31891
  for (var t = vl, e = [
31874
- Bm(),
31875
31892
  Dm(),
31876
31893
  Um(),
31877
31894
  Pm(),
@@ -31879,7 +31896,8 @@ function Jm() {
31879
31896
  Nm(),
31880
31897
  Hm(),
31881
31898
  Gm(),
31882
- Zm()
31899
+ Vm(),
31900
+ Jm()
31883
31901
  ], s = 0; s < e.length; s++) {
31884
31902
  var i = e[s];
31885
31903
  t(n, i);
@@ -31887,7 +31905,7 @@ function Jm() {
31887
31905
  }(Ar)), Ar;
31888
31906
  }
31889
31907
  var Dr, Rc;
31890
- function Km() {
31908
+ function Qm() {
31891
31909
  if (Rc) return Dr;
31892
31910
  Rc = 1;
31893
31911
  var n = tn.Buffer;
@@ -31956,10 +31974,10 @@ function Km() {
31956
31974
  };
31957
31975
  }, Dr;
31958
31976
  }
31959
- const Qm = {}, ty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31977
+ const ty = {}, ey = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31960
31978
  __proto__: null,
31961
- default: Qm
31962
- }, Symbol.toStringTag, { value: "Module" })), ey = /* @__PURE__ */ wm(ty);
31979
+ default: ty
31980
+ }, Symbol.toStringTag, { value: "Module" })), ny = /* @__PURE__ */ Cm(ey);
31963
31981
  (function(n) {
31964
31982
  var t = tn.Buffer, e = Ca, s = vl, i = n.exports;
31965
31983
  i.encodings = null, i.defaultCharUnicode = "�", i.defaultCharSingleByte = "?", i.encode = function(o, c, h) {
@@ -31978,7 +31996,7 @@ const Qm = {}, ty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
31978
31996
  }
31979
31997
  }, i.toEncoding = i.encode, i.fromEncoding = i.decode, i._codecDataCache = { __proto__: null }, i.getCodec = function(o) {
31980
31998
  if (!i.encodings) {
31981
- var c = Jm();
31999
+ var c = Km();
31982
32000
  i.encodings = { __proto__: null }, s(i.encodings, c);
31983
32001
  }
31984
32002
  for (var h = i._canonicalizeEncoding(o), l = {}; ; ) {
@@ -32011,7 +32029,7 @@ const Qm = {}, ty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
32011
32029
  return h.bomAware && !(c && c.stripBOM === !1) && (l = new e.StripBOM(l, c)), l;
32012
32030
  }, i.enableStreamingAPI = function(o) {
32013
32031
  if (!i.supportsStreams) {
32014
- var c = Km()(o);
32032
+ var c = Qm()(o);
32015
32033
  i.IconvLiteEncoderStream = c.IconvLiteEncoderStream, i.IconvLiteDecoderStream = c.IconvLiteDecoderStream, i.encodeStream = function(l, u) {
32016
32034
  return new i.IconvLiteEncoderStream(i.getEncoder(l, u), u);
32017
32035
  }, i.decodeStream = function(l, u) {
@@ -32021,15 +32039,15 @@ const Qm = {}, ty = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
32021
32039
  };
32022
32040
  var r;
32023
32041
  try {
32024
- r = ey;
32042
+ r = ny;
32025
32043
  } catch {
32026
32044
  }
32027
32045
  r && r.Transform ? i.enableStreamingAPI(r) : i.encodeStream = i.decodeStream = function() {
32028
32046
  throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
32029
32047
  };
32030
32048
  })(yl);
32031
- var ny = yl.exports;
32032
- const sy = /* @__PURE__ */ Sm(ny);
32049
+ var sy = yl.exports;
32050
+ const iy = /* @__PURE__ */ wm(sy);
32033
32051
  class Mi extends rh {
32034
32052
  /**
32035
32053
  * Creates a new instance of ShxTextShape
@@ -32051,9 +32069,9 @@ class Mi extends rh {
32051
32069
  resolveAdvanceWidth(t) {
32052
32070
  var h;
32053
32071
  const e = this.calcWidth(), s = ((h = t.lastPoint) == null ? void 0 : h.x) ?? 0, i = t.bbox.maxX, r = this.font.data.header.fontType, { width: a, height: o } = this.font.data.content, c = o > 0 ? a / o * this.fontSize : 0;
32054
- if (r === Ct.BIGFONT)
32072
+ if (r === xt.BIGFONT)
32055
32073
  return Math.max(e, s, c);
32056
- if (r === Ct.UNIFONT) {
32074
+ if (r === xt.UNIFONT) {
32057
32075
  const l = Math.max(e, i);
32058
32076
  let u = Math.max(s, l);
32059
32077
  return l > s + 1e-6 && (u = Math.max(u, c)), u;
@@ -32099,7 +32117,7 @@ class Mi extends rh {
32099
32117
  }
32100
32118
  class Oi extends ih {
32101
32119
  constructor(t) {
32102
- super(t), this.type = "shx", this.font = new vm(t.data), this.data = this.font.fontData;
32120
+ super(t), this.type = "shx", this.font = new Sm(t.data), this.data = this.font.fontData;
32103
32121
  }
32104
32122
  /**
32105
32123
  * Return true if this font contains glyph of the specified character. Otherwise, return false.
@@ -32198,7 +32216,7 @@ class Oi extends ih {
32198
32216
  * For an unsupported char, use "?" as a replacement.
32199
32217
  */
32200
32218
  getNotFoundTextShape(t) {
32201
- const e = this.font.fontData.header.fontType === Ct.BIGFONT ? "?" : "?";
32219
+ const e = this.font.fontData.header.fontType === xt.BIGFONT ? "?" : "?";
32202
32220
  return this.getCharShape(e, t);
32203
32221
  }
32204
32222
  /**
@@ -32207,8 +32225,8 @@ class Oi extends ih {
32207
32225
  * @returns Returns encoded code of the specified character
32208
32226
  */
32209
32227
  getCode(t) {
32210
- if (this.font.fontData.header.fontType === Ct.BIGFONT && this.encoding) {
32211
- const s = sy.encode(t[0], this.encoding);
32228
+ if (this.font.fontData.header.fontType === xt.BIGFONT && this.encoding) {
32229
+ const s = iy.encode(t[0], this.encoding);
32212
32230
  return s.length === 1 ? s[0] : s[0] << 8 | s[1];
32213
32231
  } else
32214
32232
  return t.charCodeAt(0);
@@ -32236,7 +32254,7 @@ class xe {
32236
32254
  if (t.type === "shx")
32237
32255
  return new Oi(t);
32238
32256
  if (t.type === "mesh")
32239
- return new um(t);
32257
+ return new fm(t);
32240
32258
  throw new Error("Unsupported font data type");
32241
32259
  }
32242
32260
  }
@@ -32247,7 +32265,7 @@ class le {
32247
32265
  fontNotFound: new mo(),
32248
32266
  /** Event triggered when a font is successfully loaded */
32249
32267
  fontLoaded: new mo()
32250
- }, this.loader = new Pu(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new iy();
32268
+ }, this.loader = new Pu(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new ry();
32251
32269
  }
32252
32270
  /**
32253
32271
  * Gets the singleton instance of the FontManager
@@ -32593,6 +32611,15 @@ class le {
32593
32611
  const e = this.loadedFontMap.get(t.toLowerCase());
32594
32612
  return e == null ? void 0 : e.type;
32595
32613
  }
32614
+ /**
32615
+ * Gets the type of the SHX font. Such as BIGFONT, SHAPES, UNIFONT.
32616
+ * @param fontName - The name of the font
32617
+ * @returns The type of the SHX font, or undefined if the specified font is not a SHX font
32618
+ */
32619
+ getShxFontType(t) {
32620
+ const e = this.loadedFontMap.get(t.toLowerCase());
32621
+ return (e == null ? void 0 : e.type) === "shx" ? e.data.header.fontType : void 0;
32622
+ }
32596
32623
  /**
32597
32624
  * Gets the shape to display when a character is not found
32598
32625
  * @param size - The size of the shape
@@ -32734,7 +32761,7 @@ class le {
32734
32761
  return !0;
32735
32762
  }
32736
32763
  }
32737
- class iy {
32764
+ class ry {
32738
32765
  /**
32739
32766
  * Creates a new instance of DefaultFontLoader
32740
32767
  */
@@ -32874,7 +32901,7 @@ function li(n) {
32874
32901
  const t = n.color, e = t.aci;
32875
32902
  return e === 0 ? si(n.byBlockColor) : e === 256 ? si(n.byLayerColor) : e != null ? oh(e) : t.rgbValue !== null ? si(t.rgbValue) : si(n.byLayerColor);
32876
32903
  }
32877
- class ry {
32904
+ class ay {
32878
32905
  constructor() {
32879
32906
  this.lineBasicMaterials = {}, this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
32880
32907
  }
@@ -32907,14 +32934,14 @@ class ry {
32907
32934
  return e && t.layer ? `layer_${t.layer}_${s}` : `entity_${s}`;
32908
32935
  }
32909
32936
  }
32910
- 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 || {}), K = /* @__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))(K || {}), ht = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.STACK = "STACK", n))(ht || {});
32911
- const ui = "", ay = () => ({
32937
+ 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 || {}), et = /* @__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))(et || {}), ht = /* @__PURE__ */ ((n) => (n.CHAR = "CHAR", n.STACK = "STACK", n))(ht || {});
32938
+ const ui = "", oy = () => ({
32912
32939
  byLayerColor: 16777215,
32913
32940
  byBlockColor: 16777215,
32914
32941
  layer: "0",
32915
32942
  color: new Xe()
32916
32943
  });
32917
- function oy(n) {
32944
+ function cy(n) {
32918
32945
  if (!(!n || [
32919
32946
  n.min.x,
32920
32947
  n.min.y,
@@ -32928,7 +32955,7 @@ function oy(n) {
32928
32955
  function Bc(n, t, e) {
32929
32956
  const s = [];
32930
32957
  if (n.filter((f) => f.char !== ui).forEach((f) => {
32931
- const p = oy(
32958
+ const p = cy(
32932
32959
  new _t().copy(f.box).applyMatrix4(t)
32933
32960
  );
32934
32961
  p && s.push({
@@ -32961,43 +32988,43 @@ function Bc(n, t, e) {
32961
32988
  ...h
32962
32989
  ];
32963
32990
  }
32964
- const cy = 1.5, hy = 0.8, ly = 1e6, uy = 1e4;
32991
+ const hy = 1.5, ly = 0.8, uy = 1e6, fy = 1e4;
32965
32992
  function Dc(n, t) {
32966
32993
  return Math.max(
32967
32994
  1,
32968
32995
  ...String(n ?? "").replace(/\\P/g, `
32969
32996
  `).replace(/[{}]/g, "").split(/\r?\n/).map((s) => s.length)
32970
- ) * t * hy;
32997
+ ) * t * ly;
32971
32998
  }
32972
32999
  function Uc(n) {
32973
33000
  const t = n.width, e = n.height;
32974
33001
  if (!Number.isFinite(t) || !Number.isFinite(e) || e <= 0 || t <= 0)
32975
33002
  return t;
32976
- const s = e * cy;
33003
+ const s = e * hy;
32977
33004
  if (t < s)
32978
33005
  return Dc(n.text, e);
32979
33006
  const i = Dc(n.text, e), r = t / e, a = t / Math.max(i, Number.EPSILON);
32980
- return r > ly || a > uy ? i : t;
33007
+ return r > uy || a > fy ? i : t;
32981
33008
  }
32982
- const fy = 1.666666, ii = 0.3, py = {
33009
+ const py = 1.666666, ii = 0.3, dy = {
32983
33010
  /** %%c — circle diameter dimensioning symbol (legacy SHX position) */
32984
33011
  c: [129],
32985
33012
  /** %%d — degree symbol (126/176 in amgdt.shx; avoid legacy 127) */
32986
33013
  d: [126, 176],
32987
33014
  /** %%p — plus/minus tolerance symbol (177 in amgdt.shx; avoid legacy 128) */
32988
33015
  p: [177]
32989
- }, dy = {
33016
+ }, gy = {
32990
33017
  c: [8709],
32991
33018
  // ∅ — AutoCAD .NET diameter; present in amgdt.shx
32992
33019
  d: [],
32993
33020
  p: []
32994
33021
  };
32995
- function gy(n) {
33022
+ function my(n) {
32996
33023
  switch (n.kind) {
32997
33024
  case "named":
32998
33025
  return [
32999
- ...py[n.code],
33000
- ...dy[n.code]
33026
+ ...dy[n.code],
33027
+ ...gy[n.code]
33001
33028
  ];
33002
33029
  case "numeric":
33003
33030
  return [n.charCode];
@@ -33007,7 +33034,7 @@ function gy(n) {
33007
33034
  return n;
33008
33035
  }
33009
33036
  }
33010
- const my = /* @__PURE__ */ new E();
33037
+ const yy = /* @__PURE__ */ new E();
33011
33038
  class ka extends ys {
33012
33039
  /**
33013
33040
  * Creates a new RenderContext instance with optional initial values.
@@ -33162,7 +33189,7 @@ class Pc {
33162
33189
  * The height of current line of texts
33163
33190
  */
33164
33191
  get currentLineHeight() {
33165
- const t = this.defaultLineSpaceFactor * this.currentFontSize * fy, e = this.currentMaxFontSize > 0 ? this.currentMaxFontSize : this.currentFontSize;
33192
+ const t = this.defaultLineSpaceFactor * this.currentFontSize * py, e = this.currentMaxFontSize > 0 ? this.currentMaxFontSize : this.currentFontSize;
33166
33193
  return t + e;
33167
33194
  }
33168
33195
  /**
@@ -33699,17 +33726,17 @@ class Pc {
33699
33726
  P
33700
33727
  );
33701
33728
  e.push(...J), s.push(...B), i.push(...U), r.push(...P);
33702
- const Q = [], gt = [], Dt = [], St = [];
33729
+ const K = [], gt = [], Dt = [], wt = [];
33703
33730
  this._hOffset = h + I, this._vOffset = D;
33704
33731
  for (let rt = 0; rt < o.length; rt++)
33705
33732
  this.processChar(
33706
33733
  o[rt],
33707
- Q,
33734
+ K,
33708
33735
  gt,
33709
33736
  Dt,
33710
- St
33737
+ wt
33711
33738
  );
33712
- e.push(...Q), s.push(...gt), i.push(...Dt), r.push(...St), this._hOffset = h + M, F && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
33739
+ e.push(...K), s.push(...gt), i.push(...Dt), r.push(...wt), this._hOffset = h + M, F && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
33713
33740
  }
33714
33741
  } else {
33715
33742
  const v = [], w = [], F = [], M = [];
@@ -33985,7 +34012,7 @@ class Pc {
33985
34012
  return typeof t.toGeometry != "function" ? t.width > 0 : (((r = t.toGeometry().getAttribute("position")) == null ? void 0 : r.count) ?? 0) > 0 ? !0 : e === " " && t.width > 0;
33986
34013
  }
33987
34014
  resolvePercentSymbolShape(t) {
33988
- for (const e of gy(t)) {
34015
+ for (const e of my(t)) {
33989
34016
  const s = this.fontManager.getCodeShapeFromSymbolFonts(
33990
34017
  e,
33991
34018
  this.currentFontSize
@@ -34067,7 +34094,7 @@ class Pc {
34067
34094
  if (t.forEach((o, c) => {
34068
34095
  o.geometry.boundingBox || o.geometry.computeBoundingBox(), c === 0 ? e = o.geometry.boundingBox : e.union(o.geometry.boundingBox);
34069
34096
  }), !e) return;
34070
- const s = e, i = s.getSize(my), r = (o, c) => {
34097
+ const s = e, i = s.getSize(yy), r = (o, c) => {
34071
34098
  var l, u;
34072
34099
  const h = (u = (l = o.userData) == null ? void 0 : l.layout) == null ? void 0 : u.chars;
34073
34100
  if (h && h.length > 0) {
@@ -34190,20 +34217,20 @@ class Pc {
34190
34217
  };
34191
34218
  }
34192
34219
  }
34193
- const yy = [
34220
+ const xy = [
34194
34221
  [/%%koff/gi, "\\k"],
34195
34222
  [/%%kon/gi, "\\K"],
34196
34223
  [/%%ooff/gi, "\\o"],
34197
34224
  [/%%oon/gi, "\\O"],
34198
34225
  [/%%uoff/gi, "\\l"],
34199
34226
  [/%%uon/gi, "\\L"]
34200
- ], xy = /%%([kou])/gi;
34201
- function by(n) {
34227
+ ], by = /%%([kou])/gi;
34228
+ function vy(n) {
34202
34229
  let t = n;
34203
- for (const [r, a] of yy)
34230
+ for (const [r, a] of xy)
34204
34231
  t = t.replace(r, a);
34205
34232
  let e = !1, s = !1, i = !1;
34206
- return t.replace(xy, (r, a) => {
34233
+ return t.replace(by, (r, a) => {
34207
34234
  switch (a.toLowerCase()) {
34208
34235
  case "k":
34209
34236
  return e = !e, e ? "\\K" : "\\k";
@@ -34244,7 +34271,7 @@ class Aa extends jt {
34244
34271
  * @param fontManager - The font manager instance
34245
34272
  * @param colorSettings - Color settings used to decided font color
34246
34273
  */
34247
- constructor(t, e, s, i, r = ay()) {
34274
+ constructor(t, e, s, i, r = oy()) {
34248
34275
  super(), this._style = e, this._styleManager = s, this._fontManager = i, this._colorSettings = {
34249
34276
  byLayerColor: r.byLayerColor,
34250
34277
  byBlockColor: r.byBlockColor,
@@ -34393,68 +34420,74 @@ class Aa extends jt {
34393
34420
  position: t.position,
34394
34421
  rotation: t.rotation,
34395
34422
  directionVector: t.directionVector,
34396
- attachmentPoint: K.BaselineLeft,
34397
34423
  drawingDirection: oe.BOTTOM_TO_TOP,
34398
34424
  collectCharBoxes: !1
34399
34425
  };
34400
- return this.finalizePlacement(s, r, i);
34426
+ return this.finalizePlacement(
34427
+ s,
34428
+ r,
34429
+ i,
34430
+ { shxFontType: this._fontManager.getShxFontType(e.font) }
34431
+ );
34401
34432
  }
34402
- finalizePlacement(t, e, s) {
34403
- var f;
34404
- let i = Uc(e);
34433
+ /**
34434
+ *
34435
+ * @param options.shxFontType The type of SHX font.
34436
+ */
34437
+ finalizePlacement(t, e, s, i) {
34438
+ var p;
34439
+ let r = Uc(e);
34405
34440
  t.updateWorldMatrix(!0, !0);
34406
- const r = new _t().setFromObject(t);
34407
- if (!Number.isFinite(i)) {
34408
- const p = (f = t.userData) == null ? void 0 : f.logicalAdvanceWidth, d = typeof p == "number" && p > 0 ? p : r.max.x - r.min.x;
34409
- i = Number.isFinite(d) && d > 0 ? d : 0;
34441
+ const a = new _t().setFromObject(t);
34442
+ if (!Number.isFinite(r)) {
34443
+ const d = (p = t.userData) == null ? void 0 : p.logicalAdvanceWidth, g = typeof d == "number" && d > 0 ? d : a.max.x - a.min.x;
34444
+ r = Number.isFinite(g) && g > 0 ? g : 0;
34410
34445
  }
34411
- const a = this.measureAnchorMetrics(
34446
+ const o = this.measureAnchorMetrics(
34412
34447
  t,
34413
- i,
34414
- s,
34415
34448
  r,
34416
- e.drawingDirection
34417
- ), o = this.calculateAnchorPoint(
34449
+ s,
34418
34450
  a,
34419
- e.attachmentPoint
34451
+ e.drawingDirection
34420
34452
  );
34421
- t.userData.logicalBounds = {
34422
- minX: a.minX + o.x,
34423
- maxX: a.maxX + o.x,
34424
- minY: a.minY + o.y,
34425
- maxY: a.maxY + o.y
34453
+ let c = { x: 0, y: 0 };
34454
+ (i == null ? void 0 : i.shxFontType) === xt.SHAPES ? c = { x: 0, y: 0 } : c = this.calculateAnchorPoint(o, e.attachmentPoint), t.userData.logicalBounds = {
34455
+ minX: o.minX + c.x,
34456
+ maxX: o.maxX + c.x,
34457
+ minY: o.minY + c.y,
34458
+ maxY: o.maxY + c.y
34426
34459
  };
34427
- const c = (p) => {
34428
- if (!p || p.length === 0) return;
34429
- const d = new E(o.x, o.y, 0), g = (x) => {
34430
- var b;
34431
- (b = x.box) == null || b.translate(d), x.children && x.children.length > 0 && x.children.forEach(g);
34460
+ const h = (d) => {
34461
+ if (!d || d.length === 0) return;
34462
+ const g = new E(c.x, c.y, 0), x = (b) => {
34463
+ var S;
34464
+ (S = b.box) == null || S.translate(g), b.children && b.children.length > 0 && b.children.forEach(x);
34432
34465
  };
34433
- p.forEach(g);
34434
- }, h = (p) => {
34435
- !p || p.length === 0 || p.forEach((d) => {
34436
- d.y += o.y;
34466
+ d.forEach(x);
34467
+ }, l = (d) => {
34468
+ !d || d.length === 0 || d.forEach((g) => {
34469
+ g.y += c.y;
34437
34470
  });
34438
34471
  };
34439
- t.traverse((p) => {
34440
- var d, g, x;
34441
- if ("geometry" in p) {
34442
- const b = p.geometry;
34443
- Number.isFinite(o.x) && Number.isFinite(o.y) && b.translate(o.x, o.y, 0);
34472
+ t.traverse((d) => {
34473
+ var g, x, b;
34474
+ if ("geometry" in d) {
34475
+ const S = d.geometry;
34476
+ Number.isFinite(c.x) && Number.isFinite(c.y) && S.translate(c.x, c.y, 0);
34444
34477
  }
34445
- c(
34446
- (g = (d = p.userData) == null ? void 0 : d.layout) == null ? void 0 : g.chars
34447
- ), h(
34448
- (x = p.userData) == null ? void 0 : x.lineLayouts
34449
- ), p.layers.enableAll();
34478
+ h(
34479
+ (x = (g = d.userData) == null ? void 0 : g.layout) == null ? void 0 : x.chars
34480
+ ), l(
34481
+ (b = d.userData) == null ? void 0 : b.lineLayouts
34482
+ ), d.layers.enableAll();
34450
34483
  });
34451
- let l = e.rotation || 0;
34452
- if (e.directionVector) {
34453
- const p = e.directionVector, d = new E(p.x, p.y, p.z), g = d.clone().cross(zc), x = zc.angleTo(d);
34454
- l = g.z > 0 ? -x : x;
34484
+ let u = e.rotation || 0;
34485
+ if (e.directionVector && (i == null ? void 0 : i.shxFontType) !== xt.SHAPES) {
34486
+ const d = e.directionVector, g = new E(d.x, d.y, d.z), x = g.clone().cross(zc), b = zc.angleTo(g);
34487
+ u = x.z > 0 ? -b : b;
34455
34488
  }
34456
- const u = e.position;
34457
- return t.position.set((u == null ? void 0 : u.x) ?? 0, (u == null ? void 0 : u.y) ?? 0, (u == null ? void 0 : u.z) ?? 0), t.quaternion.setFromAxisAngle(new E(0, 0, 1), l), t.scale.set(1, 1, 1), t.updateMatrix(), t.updateMatrixWorld(!0), t;
34489
+ const f = e.position;
34490
+ return t.position.set((f == null ? void 0 : f.x) ?? 0, (f == null ? void 0 : f.y) ?? 0, (f == null ? void 0 : f.z) ?? 0), t.quaternion.setFromAxisAngle(new E(0, 0, 1), u), t.scale.set(1, 1, 1), t.updateMatrix(), t.updateMatrixWorld(!0), t;
34458
34491
  }
34459
34492
  createShapeGroup(t, e) {
34460
34493
  const s = t.size || e.fixedTextHeight || 0, i = t.widthFactor ?? e.widthFactor ?? 1, r = {
@@ -34497,30 +34530,30 @@ class Aa extends jt {
34497
34530
  const s = Uc(t) || 0, i = Number.isFinite(s) && s > 0;
34498
34531
  let r = ot.LEFT;
34499
34532
  i && t.attachmentPoint && ([
34500
- K.TopLeft,
34501
- K.MiddleLeft,
34502
- K.BottomLeft,
34503
- K.BaselineLeft
34533
+ et.TopLeft,
34534
+ et.MiddleLeft,
34535
+ et.BottomLeft,
34536
+ et.BaselineLeft
34504
34537
  ].includes(t.attachmentPoint) ? r = ot.LEFT : [
34505
- K.TopCenter,
34506
- K.MiddleCenter,
34507
- K.BottomCenter,
34508
- K.BaselineCenter
34538
+ et.TopCenter,
34539
+ et.MiddleCenter,
34540
+ et.BottomCenter,
34541
+ et.BaselineCenter
34509
34542
  ].includes(t.attachmentPoint) ? r = ot.CENTER : [
34510
- K.TopRight,
34511
- K.MiddleRight,
34512
- K.BottomRight,
34513
- K.BaselineRight
34543
+ et.TopRight,
34544
+ et.MiddleRight,
34545
+ et.BottomRight,
34546
+ et.BaselineRight
34514
34547
  ].includes(t.attachmentPoint) && (r = ot.RIGHT));
34515
34548
  let a = je.BOTTOM;
34516
34549
  t.attachmentPoint && ([
34517
- K.TopLeft,
34518
- K.TopCenter,
34519
- K.TopRight
34550
+ et.TopLeft,
34551
+ et.TopCenter,
34552
+ et.TopRight
34520
34553
  ].includes(t.attachmentPoint) ? a = je.TOP : [
34521
- K.MiddleLeft,
34522
- K.MiddleCenter,
34523
- K.MiddleRight
34554
+ et.MiddleLeft,
34555
+ et.MiddleCenter,
34556
+ et.MiddleRight
34524
34557
  ].includes(t.attachmentPoint) ? a = je.MIDDLE : a = je.BOTTOM);
34525
34558
  const o = t.height || e.fixedTextHeight || 0, c = t.widthFactor || e.widthFactor || 1, h = t.lineSpaceFactor || 0.3, l = t.drawingDirection ?? oe.LEFT_TO_RIGHT, u = {
34526
34559
  fontSize: o,
@@ -34547,7 +34580,7 @@ class Aa extends jt {
34547
34580
  this.styleManager,
34548
34581
  this.fontManager,
34549
34582
  u
34550
- ), g = new Ol(by(t.text), f, {
34583
+ ), g = new Ol(vy(t.text), f, {
34551
34584
  resetParagraphParameters: !0,
34552
34585
  yieldPropertyCommands: !0,
34553
34586
  yieldPercentSymbols: !0
@@ -34626,40 +34659,40 @@ class Aa extends jt {
34626
34659
  let r = 0, a = 0;
34627
34660
  switch (e) {
34628
34661
  case void 0:
34629
- case K.TopLeft:
34662
+ case et.TopLeft:
34630
34663
  r = -t.minX, a = -t.maxY;
34631
34664
  break;
34632
- case K.TopCenter:
34665
+ case et.TopCenter:
34633
34666
  r = -s, a = -t.maxY;
34634
34667
  break;
34635
- case K.TopRight:
34668
+ case et.TopRight:
34636
34669
  r = -t.maxX, a = -t.maxY;
34637
34670
  break;
34638
- case K.MiddleLeft:
34671
+ case et.MiddleLeft:
34639
34672
  r = -t.minX, a = -i;
34640
34673
  break;
34641
- case K.MiddleCenter:
34674
+ case et.MiddleCenter:
34642
34675
  r = -s, a = -i;
34643
34676
  break;
34644
- case K.MiddleRight:
34677
+ case et.MiddleRight:
34645
34678
  r = -t.maxX, a = -i;
34646
34679
  break;
34647
- case K.BottomLeft:
34680
+ case et.BottomLeft:
34648
34681
  r = -t.minX, a = -t.minY;
34649
34682
  break;
34650
- case K.BottomCenter:
34683
+ case et.BottomCenter:
34651
34684
  r = -s, a = -t.minY;
34652
34685
  break;
34653
- case K.BottomRight:
34686
+ case et.BottomRight:
34654
34687
  r = -t.maxX, a = -t.minY;
34655
34688
  break;
34656
- case K.BaselineLeft:
34689
+ case et.BaselineLeft:
34657
34690
  r = -t.minX, a = -t.baselineY;
34658
34691
  break;
34659
- case K.BaselineCenter:
34692
+ case et.BaselineCenter:
34660
34693
  r = -s, a = -t.baselineY;
34661
34694
  break;
34662
- case K.BaselineRight:
34695
+ case et.BaselineRight:
34663
34696
  r = -t.maxX, a = -t.baselineY;
34664
34697
  break;
34665
34698
  }
@@ -34817,23 +34850,23 @@ class Aa extends jt {
34817
34850
  }
34818
34851
  }
34819
34852
  }
34820
- const an = le.instance, vy = new ry();
34853
+ const an = le.instance, Sy = new ay();
34821
34854
  self.addEventListener("message", async (n) => {
34822
34855
  const { type: t, id: e, data: s } = n.data;
34823
34856
  try {
34824
34857
  switch (t) {
34825
34858
  case "render": {
34826
34859
  if (!s) throw new Error("Missing data for render message");
34827
- const { mtextContent: i, textStyle: r, colorSettings: a } = s, o = Sy(a);
34860
+ const { mtextContent: i, textStyle: r, colorSettings: a } = s, o = wy(a);
34828
34861
  let c = new Aa(
34829
34862
  i,
34830
34863
  r,
34831
- vy,
34864
+ Sy,
34832
34865
  an,
34833
34866
  o
34834
34867
  );
34835
34868
  await c.asyncDraw(), c.updateMatrixWorld(!0);
34836
- const { data: h, transferableObjects: l } = wy(c);
34869
+ const { data: h, transferableObjects: l } = Cy(c);
34837
34870
  self.postMessage(
34838
34871
  {
34839
34872
  type: "render",
@@ -34903,7 +34936,7 @@ self.addEventListener("message", async (n) => {
34903
34936
  });
34904
34937
  }
34905
34938
  });
34906
- function Sy(n) {
34939
+ function wy(n) {
34907
34940
  const t = {
34908
34941
  byLayerColor: 16777215,
34909
34942
  byBlockColor: 16777215,
@@ -34924,10 +34957,10 @@ function Sy(n) {
34924
34957
  color: i
34925
34958
  };
34926
34959
  }
34927
- function wy(n) {
34960
+ function Cy(n) {
34928
34961
  const e = n.children[0] ?? n, s = e.matrixWorld.clone(), i = new E(), r = new gn(), a = new E();
34929
34962
  s.decompose(i, r, a);
34930
- const o = n.box.clone(), { children: c, transferableObjects: h } = Cy(e);
34963
+ const o = n.box.clone(), { children: c, transferableObjects: h } = Ty(e);
34931
34964
  return { data: {
34932
34965
  // Basic properties
34933
34966
  type: "MText",
@@ -34964,7 +34997,7 @@ function wy(n) {
34964
34997
  }, transferableObjects: h };
34965
34998
  }
34966
34999
  const Nc = /* @__PURE__ */ new Tt(), Hc = /* @__PURE__ */ new Tt();
34967
- function Cy(n) {
35000
+ function Ty(n) {
34968
35001
  const t = [], e = [];
34969
35002
  return n.updateWorldMatrix(!0, !0), Nc.copy(n.matrixWorld).invert(), n.traverse((s) => {
34970
35003
  var i, r, a, o;
@@ -35037,7 +35070,7 @@ function Cy(n) {
35037
35070
  },
35038
35071
  material: g,
35039
35072
  charBoxType: (i = s.userData) == null ? void 0 : i.charBoxType,
35040
- lineLayouts: Array.isArray((r = s.userData) == null ? void 0 : r.lineLayouts) ? Ty(s.userData.lineLayouts) : void 0,
35073
+ lineLayouts: Array.isArray((r = s.userData) == null ? void 0 : r.lineLayouts) ? Fy(s.userData.lineLayouts) : void 0,
35041
35074
  charBoxes: Array.isArray((o = (a = s.userData) == null ? void 0 : a.layout) == null ? void 0 : o.chars) ? Sl(s.userData.layout.chars) : void 0
35042
35075
  };
35043
35076
  t.push(x);
@@ -35064,7 +35097,7 @@ function Sl(n) {
35064
35097
  children: Sl(t.children ?? [])
35065
35098
  }));
35066
35099
  }
35067
- function Ty(n) {
35100
+ function Fy(n) {
35068
35101
  return n.map((t) => ({
35069
35102
  y: t.y,
35070
35103
  height: t.height,