@mlightcad/cad-simple-viewer 1.1.4 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { AcDbLayout as Hs, AcCmEventManager as ne, AcGePoint2d as H, AcGeBox2d as ue, AcCmColor as Ws, AcGeBox3d as js, AcDbDatabase as oo, AcDbFileType as en, AcGeMathUtil as ao, AcGeVector3d as Zt, AcGeGeometryUtil as co, AcGeVector2d as Vn, acdbHostApplicationServices as Xs, AcDbViewport as qs, AcDbRasterImage as $s, AcDbRay as Ys, AcDbXline as Zs, AcDbDatabaseConverter as lo, createWorkerApi as ho, AcDbLinetypeTableRecord as uo, AcDbTextStyleTableRecord as po, AcDbDimStyleTableRecord as fo, AcDbLayerTableRecord as go, AcDbViewportTableRecord as mo, AcDbBlockTableRecord as yo, AcDbBatchProcessing as vo, AcDbRasterImageDef as bo, AcDbArc as xo, AcDbCircle as wo, AcDbEllipse as So, AcDbLine as _o, AcGePoint3d as Tr, AcDbSpline as Cr, AcDbPoint as To, AcDbTrace as Co, AcDbPolyline as kr, AcDbHatch as ko, AcGePolyline2d as Io, AcGeLoop2d as Mo, AcGeLine2d as Eo, AcGeCircArc2d as Bo, AcGeEllipseArc2d as Ao, AcGeSpline3d as Ir, AcDbTable as Lo, AcDbText as Oo, AcDbMText as Do, AcDbLeader as Ro, AcDbAlignedDimension as Fo, AcDb3PointAngularDimension as Uo, AcDbOrdinateDimension as Po, AcDbRadialDimension as Go, AcDbDiametricDimension as zo, AcDbWipeout as No, AcDbBlockReference as Vo, AcDbDxfConverter as Ho, AcDbDatabaseConverterManager as Mr } from "@mlightcad/data-model";
1
+ import { AcDbLayout as Hs, AcCmEventManager as ne, AcGePoint2d as H, AcGeBox2d as de, AcCmColor as Ws, AcGeBox3d as js, AcDbDatabase as oo, AcDbFileType as en, AcGeMathUtil as ao, AcGeVector3d as Zt, AcGeGeometryUtil as co, AcGeVector2d as Vn, acdbHostApplicationServices as Xs, AcDbViewport as qs, AcDbRasterImage as $s, AcDbRay as Ys, AcDbXline as Zs, AcDbDatabaseConverter as lo, createWorkerApi as ho, AcDbLinetypeTableRecord as uo, AcDbTextStyleTableRecord as po, AcDbDimStyleTableRecord as fo, AcDbLayerTableRecord as go, AcDbViewportTableRecord as mo, AcDbBlockTableRecord as yo, AcDbBatchProcessing as vo, AcDbRasterImageDef as bo, AcDbArc as xo, AcDbCircle as wo, AcDbEllipse as So, AcDbLine as _o, AcGePoint3d as Tr, AcDbSpline as Cr, AcDbPoint as To, AcDbTrace as Co, AcDbPolyline as kr, AcDbHatch as ko, AcGePolyline2d as Io, AcGeLoop2d as Mo, AcGeLine2d as Eo, AcGeCircArc2d as Bo, AcGeEllipseArc2d as Lo, AcGeSpline3d as Ir, AcDbTable as Ao, AcDbText as Oo, AcDbMText as Do, AcDbLeader as Ro, AcDbAlignedDimension as Fo, AcDb3PointAngularDimension as Uo, AcDbOrdinateDimension as Po, AcDbRadialDimension as Go, AcDbDiametricDimension as No, AcDbWipeout as zo, AcDbBlockReference as Vo, AcDbDxfConverter as Ho, AcDbDatabaseConverterManager as Mr } from "@mlightcad/data-model";
2
2
  import * as g from "three";
3
3
  import { BufferGeometry as tn, ExtrudeGeometry as Wo, BufferAttribute as jo, ShapePath as Xo } from "three";
4
4
  import { mergeGeometries as qo } from "three/examples/jsm/utils/BufferGeometryUtils.js";
5
5
  import { OrbitControls as $o } from "three/examples/jsm/controls/OrbitControls";
6
6
  import { find as Yo, findIndex as Zo, defaults as Qo } from "lodash-es";
7
- import Ko from "three/examples/jsm/libs/stats.module";
8
- class Jo {
7
+ import Jo from "three/examples/jsm/libs/stats.module";
8
+ class Ko {
9
9
  /**
10
10
  * Creates a new application context that binds a document with its view.
11
11
  *
@@ -23,6 +23,8 @@ class Jo {
23
23
  this.view.addEntity(n.entity);
24
24
  }), t.database.events.entityModified.addEventListener((n) => {
25
25
  this.view.updateEntity(n.entity);
26
+ }), t.database.events.layerAppended.addEventListener((n) => {
27
+ this._view.addLayer(n.layer);
26
28
  }), t.database.events.layerModified.addEventListener((n) => {
27
29
  this._view.updateLayer(n.layer);
28
30
  }), t.database.events.headerSysVarChanged.addEventListener((n) => {
@@ -335,7 +337,7 @@ const Se = class Se {
335
337
  }
336
338
  };
337
339
  Se.SYSTEMT_COMMAND_GROUP_NAME = "ACAD", Se.DEFAUT_COMMAND_GROUP_NAME = "USER";
338
- let ce = Se;
340
+ let le = Se;
339
341
  function ta(r) {
340
342
  return { all: r = r || /* @__PURE__ */ new Map(), on: function(e, t) {
341
343
  var n = r.get(e);
@@ -353,7 +355,7 @@ function ta(r) {
353
355
  } };
354
356
  }
355
357
  const Fe = ta();
356
- function Dp(r) {
358
+ function Op(r) {
357
359
  Fe.emit("message", {
358
360
  message: r,
359
361
  type: "warning"
@@ -715,7 +717,7 @@ class aa extends or {
715
717
  ), i = new H(
716
718
  Math.max(this.mouseDownPositionX, n.x),
717
719
  Math.max(this.mouseDownPositionY, n.y)
718
- ), o = new ue(s, i);
720
+ ), o = new de(s, i);
719
721
  this.resolve(this.toWcs(o));
720
722
  }
721
723
  this.mouseDown = !1, this.mouseMove = !1, this.mouseDownPositionX = -1, this.mouseDownPositionY = -1;
@@ -780,7 +782,7 @@ class aa extends or {
780
782
  * @returns The selection box in world coordinates
781
783
  */
782
784
  toWcs(e) {
783
- const t = new ue(), n = new H(e.min.x, e.min.y), s = new H(e.max.x, e.max.y);
785
+ const t = new de(), n = new H(e.min.x, e.min.y), s = new H(e.max.x, e.max.y);
784
786
  return t.expandByPoint(this.view.cwcs2Wcs(n)), t.expandByPoint(this.view.cwcs2Wcs(s)), t;
785
787
  }
786
788
  }
@@ -1307,9 +1309,9 @@ class da {
1307
1309
  }
1308
1310
  }
1309
1311
  }
1310
- class pn {
1312
+ class dn {
1311
1313
  constructor() {
1312
- this._objectId = "", this._ownerId = "", this._layerName = "", this._visible = !0, this._userData = {}, this._box = new ue(), this._svg = "";
1314
+ this._objectId = "", this._ownerId = "", this._layerName = "", this._visible = !0, this._userData = {}, this._box = new de(), this._svg = "";
1313
1315
  }
1314
1316
  /**
1315
1317
  * The bounding box of this object
@@ -1401,7 +1403,7 @@ class pn {
1401
1403
  return this;
1402
1404
  }
1403
1405
  }
1404
- class pa extends pn {
1406
+ class pa extends dn {
1405
1407
  constructor(e) {
1406
1408
  if (super(), e.closed)
1407
1409
  this.svg = `
@@ -1415,7 +1417,7 @@ class pa extends pn {
1415
1417
  this._box.min.copy(t.min), this._box.max.copy(t.max);
1416
1418
  }
1417
1419
  }
1418
- class fa extends pn {
1420
+ let fa = class extends dn {
1419
1421
  constructor(e) {
1420
1422
  if (super(), e.closed)
1421
1423
  this.svg = `
@@ -1430,8 +1432,7 @@ class fa extends pn {
1430
1432
  const t = e.box;
1431
1433
  this._box.min.copy(t.min), this._box.max.copy(t.max);
1432
1434
  }
1433
- }
1434
- let ga = class extends pn {
1435
+ }, ga = class extends dn {
1435
1436
  constructor(e) {
1436
1437
  super();
1437
1438
  const t = e.reduce(
@@ -1443,7 +1444,7 @@ let ga = class extends pn {
1443
1444
  };
1444
1445
  class ma {
1445
1446
  constructor() {
1446
- this._container = new Array(), this._bbox = new ue();
1447
+ this._container = new Array(), this._bbox = new de();
1447
1448
  }
1448
1449
  /**
1449
1450
  * @inheritdoc
@@ -1534,7 +1535,7 @@ class ma {
1534
1535
  </svg>`;
1535
1536
  }
1536
1537
  }
1537
- const qe = /* @__PURE__ */ new pn();
1538
+ const qe = /* @__PURE__ */ new dn();
1538
1539
  class ya {
1539
1540
  /**
1540
1541
  * Converts the current CAD drawing to SVG format and initiates download.
@@ -1552,7 +1553,7 @@ class ya {
1552
1553
  * ```
1553
1554
  */
1554
1555
  convert() {
1555
- const e = le.instance.curDocument.database.tables.blockTable.modelSpace.newIterator(), t = new ma();
1556
+ const e = he.instance.curDocument.database.tables.blockTable.modelSpace.newIterator(), t = new ma();
1556
1557
  for (const n of e)
1557
1558
  n.draw(t);
1558
1559
  this.createFileAndDownloadIt(t.export());
@@ -1613,7 +1614,7 @@ class xa extends Xe {
1613
1614
  * @param _context - The application context (unused in this command)
1614
1615
  */
1615
1616
  execute(e) {
1616
- le.instance.openUrl("https://cdn.jsdelivr.net/gh/mlight-lee/cad-data/templates/" + "acadiso.dxf");
1617
+ he.instance.openUrl("https://cdn.jsdelivr.net/gh/mlight-lee/cad-data/templates/" + "acadiso.dxf");
1617
1618
  }
1618
1619
  }
1619
1620
  class wa extends Xe {
@@ -1640,7 +1641,7 @@ class Sa extends Xe {
1640
1641
  */
1641
1642
  execute(e) {
1642
1643
  const t = e.doc.database;
1643
- e.view.zoomTo(new ue(t.extmin, t.extmax), 1.1);
1644
+ e.view.zoomTo(new de(t.extmin, t.extmax), 1.1);
1644
1645
  }
1645
1646
  }
1646
1647
  class _a extends sa {
@@ -1661,7 +1662,7 @@ class _a extends sa {
1661
1662
  * @returns Promise that resolves when the zoom operation completes
1662
1663
  */
1663
1664
  async sampler() {
1664
- await le.instance.editor.getSelection().then((e) => this.view.zoomTo(e, 1));
1665
+ await he.instance.editor.getSelection().then((e) => this.view.zoomTo(e, 1));
1665
1666
  }
1666
1667
  }
1667
1668
  class Ta extends Xe {
@@ -1794,7 +1795,7 @@ class Qs {
1794
1795
  this.unsupportedChars[e] || (this.unsupportedChars[e] = 0), this.unsupportedChars[e]++;
1795
1796
  }
1796
1797
  }
1797
- class Ks extends g.Shape {
1798
+ class Js extends g.Shape {
1798
1799
  /**
1799
1800
  * Creates a new instance of BaseTextShape
1800
1801
  * @param char - The character this shape represents */
@@ -1803,7 +1804,7 @@ class Ks extends g.Shape {
1803
1804
  }
1804
1805
  }
1805
1806
  const Hn = (r, e) => e.some((t) => r instanceof t);
1806
- let Br, Ar;
1807
+ let Br, Lr;
1807
1808
  function Ia() {
1808
1809
  return Br || (Br = [
1809
1810
  IDBDatabase,
@@ -1814,13 +1815,13 @@ function Ia() {
1814
1815
  ]);
1815
1816
  }
1816
1817
  function Ma() {
1817
- return Ar || (Ar = [
1818
+ return Lr || (Lr = [
1818
1819
  IDBCursor.prototype.advance,
1819
1820
  IDBCursor.prototype.continue,
1820
1821
  IDBCursor.prototype.continuePrimaryKey
1821
1822
  ]);
1822
1823
  }
1823
- const Wn = /* @__PURE__ */ new WeakMap(), xn = /* @__PURE__ */ new WeakMap(), fn = /* @__PURE__ */ new WeakMap();
1824
+ const Wn = /* @__PURE__ */ new WeakMap(), xn = /* @__PURE__ */ new WeakMap(), pn = /* @__PURE__ */ new WeakMap();
1824
1825
  function Ea(r) {
1825
1826
  const e = new Promise((t, n) => {
1826
1827
  const s = () => {
@@ -1832,7 +1833,7 @@ function Ea(r) {
1832
1833
  };
1833
1834
  r.addEventListener("success", i), r.addEventListener("error", o);
1834
1835
  });
1835
- return fn.set(e, r), e;
1836
+ return pn.set(e, r), e;
1836
1837
  }
1837
1838
  function Ba(r) {
1838
1839
  if (Wn.has(r))
@@ -1866,28 +1867,28 @@ let jn = {
1866
1867
  return r instanceof IDBTransaction && (e === "done" || e === "store") ? !0 : e in r;
1867
1868
  }
1868
1869
  };
1869
- function Js(r) {
1870
+ function Ks(r) {
1870
1871
  jn = r(jn);
1871
1872
  }
1872
- function Aa(r) {
1873
+ function La(r) {
1873
1874
  return Ma().includes(r) ? function(...e) {
1874
1875
  return r.apply(Xn(this), e), We(this.request);
1875
1876
  } : function(...e) {
1876
1877
  return We(r.apply(Xn(this), e));
1877
1878
  };
1878
1879
  }
1879
- function La(r) {
1880
- return typeof r == "function" ? Aa(r) : (r instanceof IDBTransaction && Ba(r), Hn(r, Ia()) ? new Proxy(r, jn) : r);
1880
+ function Aa(r) {
1881
+ return typeof r == "function" ? La(r) : (r instanceof IDBTransaction && Ba(r), Hn(r, Ia()) ? new Proxy(r, jn) : r);
1881
1882
  }
1882
1883
  function We(r) {
1883
1884
  if (r instanceof IDBRequest)
1884
1885
  return Ea(r);
1885
1886
  if (xn.has(r))
1886
1887
  return xn.get(r);
1887
- const e = La(r);
1888
- return e !== r && (xn.set(r, e), fn.set(e, r)), e;
1888
+ const e = Aa(r);
1889
+ return e !== r && (xn.set(r, e), pn.set(e, r)), e;
1889
1890
  }
1890
- const Xn = (r) => fn.get(r);
1891
+ const Xn = (r) => pn.get(r);
1891
1892
  function Oa(r, e, { blocked: t, upgrade: n, blocking: s, terminated: i } = {}) {
1892
1893
  const o = indexedDB.open(r, e), a = We(o);
1893
1894
  return n && o.addEventListener("upgradeneeded", (c) => {
@@ -1903,7 +1904,7 @@ function Oa(r, e, { blocked: t, upgrade: n, blocking: s, terminated: i } = {}) {
1903
1904
  }), a;
1904
1905
  }
1905
1906
  const Da = ["get", "getKey", "getAll", "getAllKeys", "count"], Ra = ["put", "add", "delete", "clear"], wn = /* @__PURE__ */ new Map();
1906
- function Lr(r, e) {
1907
+ function Ar(r, e) {
1907
1908
  if (!(r instanceof IDBDatabase && !(e in r) && typeof e == "string"))
1908
1909
  return;
1909
1910
  if (wn.get(e))
@@ -1924,10 +1925,10 @@ function Lr(r, e) {
1924
1925
  };
1925
1926
  return wn.set(e, i), i;
1926
1927
  }
1927
- Js((r) => ({
1928
+ Ks((r) => ({
1928
1929
  ...r,
1929
- get: (e, t, n) => Lr(e, t) || r.get(e, t, n),
1930
- has: (e, t) => !!Lr(e, t) || r.has(e, t)
1930
+ get: (e, t, n) => Ar(e, t) || r.get(e, t, n),
1931
+ has: (e, t) => !!Ar(e, t) || r.has(e, t)
1931
1932
  }));
1932
1933
  const Fa = ["continue", "continuePrimaryKey", "advance"], Or = {}, qn = /* @__PURE__ */ new WeakMap(), ei = /* @__PURE__ */ new WeakMap(), Ua = {
1933
1934
  get(r, e) {
@@ -1945,13 +1946,13 @@ async function* Pa(...r) {
1945
1946
  return;
1946
1947
  e = e;
1947
1948
  const t = new Proxy(e, Ua);
1948
- for (ei.set(t, e), fn.set(t, Xn(e)); e; )
1949
+ for (ei.set(t, e), pn.set(t, Xn(e)); e; )
1949
1950
  yield t, e = await (qn.get(t) || e.continue()), qn.delete(t);
1950
1951
  }
1951
1952
  function Dr(r, e) {
1952
1953
  return e === Symbol.asyncIterator && Hn(r, [IDBIndex, IDBObjectStore, IDBCursor]) || e === "iterate" && Hn(r, [IDBIndex, IDBObjectStore]);
1953
1954
  }
1954
- Js((r) => ({
1955
+ Ks((r) => ({
1955
1956
  ...r,
1956
1957
  get(e, t, n) {
1957
1958
  return Dr(e, t) ? Pa : r.get(e, t, n);
@@ -2100,7 +2101,7 @@ const Ga = (r) => r.substring(r.lastIndexOf(".") + 1), ti = (r) => r.split("/").
2100
2101
  return t === -1 ? e : e.substring(0, t);
2101
2102
  }
2102
2103
  return r;
2103
- }, za = [
2104
+ }, Na = [
2104
2105
  0,
2105
2106
  16711680,
2106
2107
  16776960,
@@ -2358,7 +2359,7 @@ const Ga = (r) => r.substring(r.lastIndexOf(".") + 1), ti = (r) => r.split("/").
2358
2359
  14079702,
2359
2360
  16777215,
2360
2361
  0
2361
- ], Na = (r) => za[r];
2362
+ ], za = (r) => Na[r];
2362
2363
  let Va = class {
2363
2364
  constructor(r) {
2364
2365
  this.isFont = !0, this.type = "Font", this.data = r;
@@ -2608,7 +2609,7 @@ ai(cr, lr, 4, 3);
2608
2609
  ai(ii, oi, 2, 1);
2609
2610
  cr[28] = 0;
2610
2611
  lr[28] = 258;
2611
- var Ka = Qa;
2612
+ var Ja = Qa;
2612
2613
  function $e(r, e, t, n, s) {
2613
2614
  return Math.pow(1 - s, 3) * r + 3 * Math.pow(1 - s, 2) * s * e + 3 * (1 - s) * Math.pow(s, 2) * t + Math.pow(s, 3) * n;
2614
2615
  }
@@ -2769,7 +2770,7 @@ function ci(r) {
2769
2770
  function Gr(r, e) {
2770
2771
  r || ci(e);
2771
2772
  }
2772
- var B = { fail: ci, argument: Gr, assert: Gr }, zr = 32768, Nr = 2147483648, ct = {}, C = {}, A = {};
2773
+ var B = { fail: ci, argument: Gr, assert: Gr }, Nr = 32768, zr = 2147483648, ct = {}, C = {}, L = {};
2773
2774
  function me(r) {
2774
2775
  return function() {
2775
2776
  return r;
@@ -2778,50 +2779,50 @@ function me(r) {
2778
2779
  C.BYTE = function(r) {
2779
2780
  return B.argument(r >= 0 && r <= 255, "Byte value should be between 0 and 255."), [r];
2780
2781
  };
2781
- A.BYTE = me(1);
2782
+ L.BYTE = me(1);
2782
2783
  C.CHAR = function(r) {
2783
2784
  return [r.charCodeAt(0)];
2784
2785
  };
2785
- A.CHAR = me(1);
2786
+ L.CHAR = me(1);
2786
2787
  C.CHARARRAY = function(r) {
2787
2788
  typeof r > "u" && (r = "", console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));
2788
2789
  for (var e = [], t = 0; t < r.length; t += 1)
2789
2790
  e[t] = r.charCodeAt(t);
2790
2791
  return e;
2791
2792
  };
2792
- A.CHARARRAY = function(r) {
2793
+ L.CHARARRAY = function(r) {
2793
2794
  return typeof r > "u" ? 0 : r.length;
2794
2795
  };
2795
2796
  C.USHORT = function(r) {
2796
2797
  return [r >> 8 & 255, r & 255];
2797
2798
  };
2798
- A.USHORT = me(2);
2799
+ L.USHORT = me(2);
2799
2800
  C.SHORT = function(r) {
2800
- return r >= zr && (r = -(2 * zr - r)), [r >> 8 & 255, r & 255];
2801
+ return r >= Nr && (r = -(2 * Nr - r)), [r >> 8 & 255, r & 255];
2801
2802
  };
2802
- A.SHORT = me(2);
2803
+ L.SHORT = me(2);
2803
2804
  C.UINT24 = function(r) {
2804
2805
  return [r >> 16 & 255, r >> 8 & 255, r & 255];
2805
2806
  };
2806
- A.UINT24 = me(3);
2807
+ L.UINT24 = me(3);
2807
2808
  C.ULONG = function(r) {
2808
2809
  return [r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, r & 255];
2809
2810
  };
2810
- A.ULONG = me(4);
2811
+ L.ULONG = me(4);
2811
2812
  C.LONG = function(r) {
2812
- return r >= Nr && (r = -(2 * Nr - r)), [r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, r & 255];
2813
+ return r >= zr && (r = -(2 * zr - r)), [r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, r & 255];
2813
2814
  };
2814
- A.LONG = me(4);
2815
+ L.LONG = me(4);
2815
2816
  C.FIXED = C.ULONG;
2816
- A.FIXED = A.ULONG;
2817
+ L.FIXED = L.ULONG;
2817
2818
  C.FWORD = C.SHORT;
2818
- A.FWORD = A.SHORT;
2819
+ L.FWORD = L.SHORT;
2819
2820
  C.UFWORD = C.USHORT;
2820
- A.UFWORD = A.USHORT;
2821
+ L.UFWORD = L.USHORT;
2821
2822
  C.LONGDATETIME = function(r) {
2822
2823
  return [0, 0, 0, 0, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, r & 255];
2823
2824
  };
2824
- A.LONGDATETIME = me(8);
2825
+ L.LONGDATETIME = me(8);
2825
2826
  C.TAG = function(r) {
2826
2827
  return B.argument(r.length === 4, "Tag should be exactly 4 ASCII characters."), [
2827
2828
  r.charCodeAt(0),
@@ -2830,29 +2831,29 @@ C.TAG = function(r) {
2830
2831
  r.charCodeAt(3)
2831
2832
  ];
2832
2833
  };
2833
- A.TAG = me(4);
2834
+ L.TAG = me(4);
2834
2835
  C.Card8 = C.BYTE;
2835
- A.Card8 = A.BYTE;
2836
+ L.Card8 = L.BYTE;
2836
2837
  C.Card16 = C.USHORT;
2837
- A.Card16 = A.USHORT;
2838
+ L.Card16 = L.USHORT;
2838
2839
  C.OffSize = C.BYTE;
2839
- A.OffSize = A.BYTE;
2840
+ L.OffSize = L.BYTE;
2840
2841
  C.SID = C.USHORT;
2841
- A.SID = A.USHORT;
2842
+ L.SID = L.USHORT;
2842
2843
  C.NUMBER = function(r) {
2843
2844
  return r >= -107 && r <= 107 ? [r + 139] : r >= 108 && r <= 1131 ? (r = r - 108, [(r >> 8) + 247, r & 255]) : r >= -1131 && r <= -108 ? (r = -r - 108, [(r >> 8) + 251, r & 255]) : r >= -32768 && r <= 32767 ? C.NUMBER16(r) : C.NUMBER32(r);
2844
2845
  };
2845
- A.NUMBER = function(r) {
2846
+ L.NUMBER = function(r) {
2846
2847
  return C.NUMBER(r).length;
2847
2848
  };
2848
2849
  C.NUMBER16 = function(r) {
2849
2850
  return [28, r >> 8 & 255, r & 255];
2850
2851
  };
2851
- A.NUMBER16 = me(3);
2852
+ L.NUMBER16 = me(3);
2852
2853
  C.NUMBER32 = function(r) {
2853
2854
  return [29, r >> 24 & 255, r >> 16 & 255, r >> 8 & 255, r & 255];
2854
2855
  };
2855
- A.NUMBER32 = me(5);
2856
+ L.NUMBER32 = me(5);
2856
2857
  C.REAL = function(r) {
2857
2858
  var e = r.toString(), t = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);
2858
2859
  if (t) {
@@ -2868,13 +2869,13 @@ C.REAL = function(r) {
2868
2869
  c.push(parseInt(s.substr(l, 2), 16));
2869
2870
  return c;
2870
2871
  };
2871
- A.REAL = function(r) {
2872
+ L.REAL = function(r) {
2872
2873
  return C.REAL(r).length;
2873
2874
  };
2874
2875
  C.NAME = C.CHARARRAY;
2875
- A.NAME = A.CHARARRAY;
2876
+ L.NAME = L.CHARARRAY;
2876
2877
  C.STRING = C.CHARARRAY;
2877
- A.STRING = A.CHARARRAY;
2878
+ L.STRING = L.CHARARRAY;
2878
2879
  ct.UTF8 = function(r, e, t) {
2879
2880
  for (var n = [], s = t, i = 0; i < s; i++, e += 1)
2880
2881
  n[i] = r.getUint8(e);
@@ -2892,7 +2893,7 @@ C.UTF16 = function(r) {
2892
2893
  }
2893
2894
  return e;
2894
2895
  };
2895
- A.UTF16 = function(r) {
2896
+ L.UTF16 = function(r) {
2896
2897
  return r.length * 2;
2897
2898
  };
2898
2899
  var Qn = {
@@ -2947,7 +2948,7 @@ ct.MACSTRING = function(r, e, t, n) {
2947
2948
  return i;
2948
2949
  }
2949
2950
  };
2950
- var Pt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap(), Gt, Ja = function(r) {
2951
+ var Pt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap(), Gt, Ka = function(r) {
2951
2952
  if (!Gt) {
2952
2953
  Gt = {};
2953
2954
  for (var e in Qn)
@@ -2969,7 +2970,7 @@ var Pt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap(), Gt, Ja =
2969
2970
  }
2970
2971
  };
2971
2972
  C.MACSTRING = function(r, e) {
2972
- var t = Ja(e);
2973
+ var t = Ka(e);
2973
2974
  if (t !== void 0) {
2974
2975
  for (var n = [], s = 0; s < r.length; s++) {
2975
2976
  var i = r.charCodeAt(s);
@@ -2980,11 +2981,11 @@ C.MACSTRING = function(r, e) {
2980
2981
  return n;
2981
2982
  }
2982
2983
  };
2983
- A.MACSTRING = function(r, e) {
2984
+ L.MACSTRING = function(r, e) {
2984
2985
  var t = C.MACSTRING(r, e);
2985
2986
  return t !== void 0 ? t.length : 0;
2986
2987
  };
2987
- function Kn(r) {
2988
+ function Jn(r) {
2988
2989
  return r >= -128 && r <= 127;
2989
2990
  }
2990
2991
  function ec(r, e, t) {
@@ -2995,7 +2996,7 @@ function ec(r, e, t) {
2995
2996
  function tc(r, e, t) {
2996
2997
  for (var n = 0, s = r.length, i = e; i < s && n < 64; ) {
2997
2998
  var o = r[i];
2998
- if (!Kn(o) || o === 0 && i + 1 < s && r[i + 1] === 0)
2999
+ if (!Jn(o) || o === 0 && i + 1 < s && r[i + 1] === 0)
2999
3000
  break;
3000
3001
  ++i, ++n;
3001
3002
  }
@@ -3007,7 +3008,7 @@ function tc(r, e, t) {
3007
3008
  function nc(r, e, t) {
3008
3009
  for (var n = 0, s = r.length, i = e; i < s && n < 64; ) {
3009
3010
  var o = r[i];
3010
- if (o === 0 || Kn(o) && i + 1 < s && Kn(r[i + 1]))
3011
+ if (o === 0 || Jn(o) && i + 1 < s && Jn(r[i + 1]))
3011
3012
  break;
3012
3013
  ++i, ++n;
3013
3014
  }
@@ -3043,7 +3044,7 @@ C.INDEX = function(r) {
3043
3044
  n
3044
3045
  );
3045
3046
  };
3046
- A.INDEX = function(r) {
3047
+ L.INDEX = function(r) {
3047
3048
  return C.INDEX(r).length;
3048
3049
  };
3049
3050
  C.DICT = function(r) {
@@ -3053,7 +3054,7 @@ C.DICT = function(r) {
3053
3054
  }
3054
3055
  return e;
3055
3056
  };
3056
- A.DICT = function(r) {
3057
+ L.DICT = function(r) {
3057
3058
  return C.DICT(r).length;
3058
3059
  };
3059
3060
  C.OPERATOR = function(r) {
@@ -3077,11 +3078,11 @@ C.OPERAND = function(r, e) {
3077
3078
  return t;
3078
3079
  };
3079
3080
  C.OP = C.BYTE;
3080
- A.OP = A.BYTE;
3081
- var zt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap();
3081
+ L.OP = L.BYTE;
3082
+ var Nt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap();
3082
3083
  C.CHARSTRING = function(r) {
3083
- if (zt) {
3084
- var e = zt.get(r);
3084
+ if (Nt) {
3085
+ var e = Nt.get(r);
3085
3086
  if (e !== void 0)
3086
3087
  return e;
3087
3088
  }
@@ -3089,17 +3090,17 @@ C.CHARSTRING = function(r) {
3089
3090
  var i = r[s];
3090
3091
  t = t.concat(C[i.type](i.value));
3091
3092
  }
3092
- return zt && zt.set(r, t), t;
3093
+ return Nt && Nt.set(r, t), t;
3093
3094
  };
3094
- A.CHARSTRING = function(r) {
3095
+ L.CHARSTRING = function(r) {
3095
3096
  return C.CHARSTRING(r).length;
3096
3097
  };
3097
3098
  C.OBJECT = function(r) {
3098
3099
  var e = C[r.type];
3099
3100
  return B.argument(e !== void 0, "No encoding function for type " + r.type), e(r.value);
3100
3101
  };
3101
- A.OBJECT = function(r) {
3102
- var e = A[r.type];
3102
+ L.OBJECT = function(r) {
3103
+ var e = L[r.type];
3103
3104
  return B.argument(e !== void 0, "No sizeOf function for type " + r.type), e(r.value);
3104
3105
  };
3105
3106
  C.TABLE = function(r) {
@@ -3117,9 +3118,9 @@ C.TABLE = function(r) {
3117
3118
  }
3118
3119
  return e;
3119
3120
  };
3120
- A.TABLE = function(r) {
3121
+ L.TABLE = function(r) {
3121
3122
  for (var e = 0, t = r.fields.length, n = 0; n < t; n += 1) {
3122
- var s = r.fields[n], i = A[s.type];
3123
+ var s = r.fields[n], i = L[s.type];
3123
3124
  B.argument(i !== void 0, "No sizeOf function for field type " + s.type + " (" + s.name + ")");
3124
3125
  var o = r[s.name];
3125
3126
  o === void 0 && (o = s.value), e += i(o), s.type === "TABLE" && (e += 2);
@@ -3127,11 +3128,11 @@ A.TABLE = function(r) {
3127
3128
  return e;
3128
3129
  };
3129
3130
  C.RECORD = C.TABLE;
3130
- A.RECORD = A.TABLE;
3131
+ L.RECORD = L.TABLE;
3131
3132
  C.LITERAL = function(r) {
3132
3133
  return r;
3133
3134
  };
3134
- A.LITERAL = function(r) {
3135
+ L.LITERAL = function(r) {
3135
3136
  return r.length;
3136
3137
  };
3137
3138
  function q(r, e, t) {
@@ -3150,7 +3151,7 @@ q.prototype.encode = function() {
3150
3151
  return C.TABLE(this);
3151
3152
  };
3152
3153
  q.prototype.sizeOf = function() {
3153
- return A.TABLE(this);
3154
+ return L.TABLE(this);
3154
3155
  };
3155
3156
  function Tt(r, e, t) {
3156
3157
  t === void 0 && (t = e.length);
@@ -3160,7 +3161,7 @@ function Tt(r, e, t) {
3160
3161
  n[s + 1] = { name: r + s, type: "USHORT", value: e[s] };
3161
3162
  return n;
3162
3163
  }
3163
- function Jn(r, e, t) {
3164
+ function Kn(r, e, t) {
3164
3165
  var n = e.length, s = new Array(n + 1);
3165
3166
  s[0] = { name: r + "Count", type: "USHORT", value: n };
3166
3167
  for (var i = 0; i < n; i++)
@@ -3240,12 +3241,12 @@ function sn(r) {
3240
3241
  sn.prototype = Object.create(q.prototype);
3241
3242
  sn.prototype.constructor = sn;
3242
3243
  function on(r, e) {
3243
- q.call(this, "lookupListTable", Jn("lookup", r, function(t) {
3244
+ q.call(this, "lookupListTable", Kn("lookup", r, function(t) {
3244
3245
  var n = e[t.lookupType];
3245
3246
  return B.assert(!!n, "Unable to write GSUB lookup type " + t.lookupType + " tables."), new q("lookupTable", [
3246
3247
  { name: "lookupType", type: "USHORT", value: t.lookupType },
3247
3248
  { name: "lookupFlag", type: "USHORT", value: t.lookupFlag }
3248
- ].concat(Jn("subtable", t.subtables, n)));
3249
+ ].concat(Kn("subtable", t.subtables, n)));
3249
3250
  }));
3250
3251
  }
3251
3252
  on.prototype = Object.create(q.prototype);
@@ -3258,7 +3259,7 @@ var I = {
3258
3259
  FeatureList: sn,
3259
3260
  LookupList: on,
3260
3261
  ushortList: Tt,
3261
- tableList: Jn,
3262
+ tableList: Kn,
3262
3263
  recordList: Ct
3263
3264
  };
3264
3265
  function Vr(r, e) {
@@ -4976,19 +4977,19 @@ function wc(r, e) {
4976
4977
  }
4977
4978
  };
4978
4979
  }
4979
- function ae(r) {
4980
+ function ce(r) {
4980
4981
  this.bindConstructorValues(r);
4981
4982
  }
4982
- ae.prototype.bindConstructorValues = function(r) {
4983
+ ce.prototype.bindConstructorValues = function(r) {
4983
4984
  this.index = r.index || 0, this.name = r.name || null, this.unicode = r.unicode || void 0, this.unicodes = r.unicodes || r.unicode !== void 0 ? [r.unicode] : [], "xMin" in r && (this.xMin = r.xMin), "yMin" in r && (this.yMin = r.yMin), "xMax" in r && (this.xMax = r.xMax), "yMax" in r && (this.yMax = r.yMax), "advanceWidth" in r && (this.advanceWidth = r.advanceWidth), Object.defineProperty(this, "path", wc(this, r.path));
4984
4985
  };
4985
- ae.prototype.addUnicode = function(r) {
4986
+ ce.prototype.addUnicode = function(r) {
4986
4987
  this.unicodes.length === 0 && (this.unicode = r), this.unicodes.push(r);
4987
4988
  };
4988
- ae.prototype.getBoundingBox = function() {
4989
+ ce.prototype.getBoundingBox = function() {
4989
4990
  return this.path.getBoundingBox();
4990
4991
  };
4991
- ae.prototype.getPath = function(r, e, t, n, s) {
4992
+ ce.prototype.getPath = function(r, e, t, n, s) {
4992
4993
  r = r !== void 0 ? r : 0, e = e !== void 0 ? e : 0, t = t !== void 0 ? t : 72;
4993
4994
  var i, o;
4994
4995
  n || (n = {});
@@ -5018,7 +5019,7 @@ ae.prototype.getPath = function(r, e, t, n, s) {
5018
5019
  }
5019
5020
  return h;
5020
5021
  };
5021
- ae.prototype.getContours = function() {
5022
+ ce.prototype.getContours = function() {
5022
5023
  if (this.points === void 0)
5023
5024
  return [];
5024
5025
  for (var r = [], e = [], t = 0; t < this.points.length; t += 1) {
@@ -5027,7 +5028,7 @@ ae.prototype.getContours = function() {
5027
5028
  }
5028
5029
  return B.argument(e.length === 0, "There are still points left in the current contour."), r;
5029
5030
  };
5030
- ae.prototype.getMetrics = function() {
5031
+ ce.prototype.getMetrics = function() {
5031
5032
  for (var r = this.path.commands, e = [], t = [], n = 0; n < r.length; n += 1) {
5032
5033
  var s = r[n];
5033
5034
  s.type !== "Z" && (e.push(s.x), t.push(s.y)), (s.type === "Q" || s.type === "C") && (e.push(s.x1), t.push(s.y1)), s.type === "C" && (e.push(s.x2), t.push(s.y2));
@@ -5041,10 +5042,10 @@ ae.prototype.getMetrics = function() {
5041
5042
  };
5042
5043
  return isFinite(i.xMin) || (i.xMin = 0), isFinite(i.xMax) || (i.xMax = this.advanceWidth), isFinite(i.yMin) || (i.yMin = 0), isFinite(i.yMax) || (i.yMax = 0), i.rightSideBearing = this.advanceWidth - i.leftSideBearing - (i.xMax - i.xMin), i;
5043
5044
  };
5044
- ae.prototype.draw = function(r, e, t, n, s) {
5045
+ ce.prototype.draw = function(r, e, t, n, s) {
5045
5046
  this.getPath(e, t, n, s).draw(r);
5046
5047
  };
5047
- ae.prototype.drawPoints = function(r, e, t, n) {
5048
+ ce.prototype.drawPoints = function(r, e, t, n) {
5048
5049
  function s(d, u, p, f) {
5049
5050
  r.beginPath();
5050
5051
  for (var m = 0; m < d.length; m += 1)
@@ -5058,13 +5059,13 @@ ae.prototype.drawPoints = function(r, e, t, n) {
5058
5059
  }
5059
5060
  r.fillStyle = "blue", s(o, e, t, i), r.fillStyle = "red", s(a, e, t, i);
5060
5061
  };
5061
- ae.prototype.drawMetrics = function(r, e, t, n) {
5062
+ ce.prototype.drawMetrics = function(r, e, t, n) {
5062
5063
  var s;
5063
5064
  e = e !== void 0 ? e : 0, t = t !== void 0 ? t : 0, n = n !== void 0 ? n : 24, s = 1 / this.path.unitsPerEm * n, r.lineWidth = 1, r.strokeStyle = "black", Ge.line(r, e, -1e4, e, 1e4), Ge.line(r, -1e4, t, 1e4, t);
5064
5065
  var i = this.xMin || 0, o = this.yMin || 0, a = this.xMax || 0, c = this.yMax || 0, l = this.advanceWidth || 0;
5065
5066
  r.strokeStyle = "blue", Ge.line(r, e + i * s, -1e4, e + i * s, 1e4), Ge.line(r, e + a * s, -1e4, e + a * s, 1e4), Ge.line(r, -1e4, t + -o * s, 1e4, t + -o * s), Ge.line(r, -1e4, t + -c * s, 1e4, t + -c * s), r.strokeStyle = "green", Ge.line(r, e + l * s, -1e4, e + l * s, 1e4);
5066
5067
  };
5067
- function Nt(r, e, t) {
5068
+ function zt(r, e, t) {
5068
5069
  Object.defineProperty(r, e, {
5069
5070
  get: function() {
5070
5071
  return r.path, r[t];
@@ -5100,21 +5101,21 @@ dr.prototype.push = function(r, e) {
5100
5101
  this.glyphs[r] = e, this.length++;
5101
5102
  };
5102
5103
  function Sc(r, e) {
5103
- return new ae({ index: e, font: r });
5104
+ return new ce({ index: e, font: r });
5104
5105
  }
5105
5106
  function _c(r, e, t, n, s, i) {
5106
5107
  return function() {
5107
- var o = new ae({ index: e, font: r });
5108
+ var o = new ce({ index: e, font: r });
5108
5109
  return o.path = function() {
5109
5110
  t(o, n, s);
5110
5111
  var a = i(r.glyphs, o);
5111
5112
  return a.unitsPerEm = r.unitsPerEm, a;
5112
- }, Nt(o, "xMin", "_xMin"), Nt(o, "xMax", "_xMax"), Nt(o, "yMin", "_yMin"), Nt(o, "yMax", "_yMax"), o;
5113
+ }, zt(o, "xMin", "_xMin"), zt(o, "xMax", "_xMax"), zt(o, "yMin", "_yMin"), zt(o, "yMax", "_yMax"), o;
5113
5114
  };
5114
5115
  }
5115
5116
  function Tc(r, e, t, n) {
5116
5117
  return function() {
5117
- var s = new ae({ index: e, font: r });
5118
+ var s = new ce({ index: e, font: r });
5118
5119
  return s.path = function() {
5119
5120
  var i = t(r, s, n);
5120
5121
  return i.unitsPerEm = r.unitsPerEm, i;
@@ -5281,7 +5282,7 @@ var mi = [
5281
5282
  { name: "defaultWidthX", op: 20, type: "number", value: 0 },
5282
5283
  { name: "nominalWidthX", op: 21, type: "number", value: 0 }
5283
5284
  ];
5284
- function Ac(r, e) {
5285
+ function Lc(r, e) {
5285
5286
  var t = fi(r, 0, r.byteLength);
5286
5287
  return gi(t, mi, e);
5287
5288
  }
@@ -5291,7 +5292,7 @@ function vi(r, e, t, n) {
5291
5292
  }
5292
5293
  function Wr(r, e, t, n) {
5293
5294
  for (var s = [], i = 0; i < t.length; i += 1) {
5294
- var o = new DataView(new Uint8Array(t[i]).buffer), a = Ac(o, n);
5295
+ var o = new DataView(new Uint8Array(t[i]).buffer), a = Lc(o, n);
5295
5296
  a._subrs = [], a._subrsBias = 0, a._defaultWidthX = 0, a._nominalWidthX = 0;
5296
5297
  var c = a.private[0], l = a.private[1];
5297
5298
  if (c !== 0 && l !== 0) {
@@ -5306,7 +5307,7 @@ function Wr(r, e, t, n) {
5306
5307
  }
5307
5308
  return s;
5308
5309
  }
5309
- function Lc(r, e, t, n) {
5310
+ function Ac(r, e, t, n) {
5310
5311
  var s, i, o = new E.Parser(r, e);
5311
5312
  t -= 1;
5312
5313
  var a = [".notdef"], c = o.parseCard8();
@@ -5355,19 +5356,19 @@ function jr(r, e, t) {
5355
5356
  function S(k, O) {
5356
5357
  d && a.closePath(), a.moveTo(k, O), d = !0;
5357
5358
  }
5358
- function L() {
5359
+ function A() {
5359
5360
  var k;
5360
5361
  k = c.length % 2 !== 0, k && !h && (_ = c.shift() + v), l += c.length >> 1, c.length = 0, h = !0;
5361
5362
  }
5362
5363
  function T(k) {
5363
- for (var O, G, Q, te, $, F, z, U, W, Y, X, K, R = 0; R < k.length; ) {
5364
+ for (var O, G, Q, te, $, F, N, U, W, Y, X, J, R = 0; R < k.length; ) {
5364
5365
  var Z = k[R];
5365
5366
  switch (R += 1, Z) {
5366
5367
  case 1:
5367
- L();
5368
+ A();
5368
5369
  break;
5369
5370
  case 3:
5370
- L();
5371
+ A();
5371
5372
  break;
5372
5373
  case 4:
5373
5374
  c.length > 1 && !h && (_ = c.shift() + v, h = !0), p += c.pop(), S(u, p);
@@ -5396,16 +5397,16 @@ function jr(r, e, t) {
5396
5397
  case 12:
5397
5398
  switch (Z = k[R], R += 1, Z) {
5398
5399
  case 35:
5399
- n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), z = i + c.shift(), U = o + c.shift(), W = z + c.shift(), Y = U + c.shift(), X = W + c.shift(), K = Y + c.shift(), u = X + c.shift(), p = K + c.shift(), c.shift(), a.curveTo(n, s, i, o, z, U), a.curveTo(W, Y, X, K, u, p);
5400
+ n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), N = i + c.shift(), U = o + c.shift(), W = N + c.shift(), Y = U + c.shift(), X = W + c.shift(), J = Y + c.shift(), u = X + c.shift(), p = J + c.shift(), c.shift(), a.curveTo(n, s, i, o, N, U), a.curveTo(W, Y, X, J, u, p);
5400
5401
  break;
5401
5402
  case 34:
5402
- n = u + c.shift(), s = p, i = n + c.shift(), o = s + c.shift(), z = i + c.shift(), U = o, W = z + c.shift(), Y = o, X = W + c.shift(), K = p, u = X + c.shift(), a.curveTo(n, s, i, o, z, U), a.curveTo(W, Y, X, K, u, p);
5403
+ n = u + c.shift(), s = p, i = n + c.shift(), o = s + c.shift(), N = i + c.shift(), U = o, W = N + c.shift(), Y = o, X = W + c.shift(), J = p, u = X + c.shift(), a.curveTo(n, s, i, o, N, U), a.curveTo(W, Y, X, J, u, p);
5403
5404
  break;
5404
5405
  case 36:
5405
- n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), z = i + c.shift(), U = o, W = z + c.shift(), Y = o, X = W + c.shift(), K = Y + c.shift(), u = X + c.shift(), a.curveTo(n, s, i, o, z, U), a.curveTo(W, Y, X, K, u, p);
5406
+ n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), N = i + c.shift(), U = o, W = N + c.shift(), Y = o, X = W + c.shift(), J = Y + c.shift(), u = X + c.shift(), a.curveTo(n, s, i, o, N, U), a.curveTo(W, Y, X, J, u, p);
5406
5407
  break;
5407
5408
  case 37:
5408
- n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), z = i + c.shift(), U = o + c.shift(), W = z + c.shift(), Y = U + c.shift(), X = W + c.shift(), K = Y + c.shift(), Math.abs(X - u) > Math.abs(K - p) ? u = X + c.shift() : p = K + c.shift(), a.curveTo(n, s, i, o, z, U), a.curveTo(W, Y, X, K, u, p);
5409
+ n = u + c.shift(), s = p + c.shift(), i = n + c.shift(), o = s + c.shift(), N = i + c.shift(), U = o + c.shift(), W = N + c.shift(), Y = U + c.shift(), X = W + c.shift(), J = Y + c.shift(), Math.abs(X - u) > Math.abs(J - p) ? u = X + c.shift() : p = J + c.shift(), a.curveTo(n, s, i, o, N, U), a.curveTo(W, Y, X, J, u, p);
5409
5410
  break;
5410
5411
  default:
5411
5412
  console.log("Glyph " + e.index + ": unknown operator 1200" + Z), c.length = 0;
@@ -5415,11 +5416,11 @@ function jr(r, e, t) {
5415
5416
  c.length > 0 && !h && (_ = c.shift() + v, h = !0), d && (a.closePath(), d = !1);
5416
5417
  break;
5417
5418
  case 18:
5418
- L();
5419
+ A();
5419
5420
  break;
5420
5421
  case 19:
5421
5422
  case 20:
5422
- L(), R += l + 7 >> 3;
5423
+ A(), R += l + 7 >> 3;
5423
5424
  break;
5424
5425
  case 21:
5425
5426
  c.length > 2 && !h && (_ = c.shift() + v, h = !0), p += c.pop(), u += c.pop(), S(u, p);
@@ -5428,7 +5429,7 @@ function jr(r, e, t) {
5428
5429
  c.length > 1 && !h && (_ = c.shift() + v, h = !0), u += c.pop(), S(u, p);
5429
5430
  break;
5430
5431
  case 23:
5431
- L();
5432
+ A();
5432
5433
  break;
5433
5434
  case 24:
5434
5435
  for (; c.length > 2; )
@@ -5520,7 +5521,7 @@ function Rc(r, e, t, n) {
5520
5521
  t.subrs = [], t.subrsBias = 0;
5521
5522
  var x;
5522
5523
  n.lowMemory ? (x = Cc(r, e + h.charStrings), t.nGlyphs = x.offsets.length) : (x = Be(r, e + h.charStrings), t.nGlyphs = x.objects.length);
5523
- var _ = Lc(r, e + h.charset, t.nGlyphs, a.objects);
5524
+ var _ = Ac(r, e + h.charset, t.nGlyphs, a.objects);
5524
5525
  if (h.encoding === 0 ? t.cffEncoding = new cn(gc, _) : h.encoding === 1 ? t.cffEncoding = new cn(mc, _) : t.cffEncoding = Oc(r, e + h.encoding, _), t.encoding = t.encoding || t.cffEncoding, t.glyphs = new Ce.GlyphSet(t), n.lowMemory)
5525
5526
  t._push = function(T) {
5526
5527
  var k = kc(T, x.offsets, r, e + h.charStrings);
@@ -5528,8 +5529,8 @@ function Rc(r, e, t, n) {
5528
5529
  };
5529
5530
  else
5530
5531
  for (var S = 0; S < t.nGlyphs; S += 1) {
5531
- var L = x.objects[S];
5532
- t.glyphs.push(S, Ce.cffGlyphLoader(t, S, jr, L));
5532
+ var A = x.objects[S];
5533
+ t.glyphs.push(S, Ce.cffGlyphLoader(t, S, jr, A));
5533
5534
  }
5534
5535
  }
5535
5536
  function bi(r, e) {
@@ -5586,7 +5587,7 @@ function Gc() {
5586
5587
  { name: "subrs", type: "INDEX", value: [] }
5587
5588
  ]);
5588
5589
  }
5589
- function zc(r, e) {
5590
+ function Nc(r, e) {
5590
5591
  for (var t = new I.Record("Charsets", [
5591
5592
  { name: "format", type: "Card8", value: 0 }
5592
5593
  ]), n = 0; n < r.length; n += 1) {
@@ -5595,7 +5596,7 @@ function zc(r, e) {
5595
5596
  }
5596
5597
  return t;
5597
5598
  }
5598
- function Nc(r) {
5599
+ function zc(r) {
5599
5600
  var e = [], t = r.path;
5600
5601
  e.push({ name: "width", type: "NUMBER", value: r.advanceWidth });
5601
5602
  for (var n = 0, s = 0, i = 0; i < t.commands.length; i += 1) {
@@ -5627,7 +5628,7 @@ function Vc(r) {
5627
5628
  for (var e = new I.Record("CharStrings INDEX", [
5628
5629
  { name: "charStrings", type: "INDEX", value: [] }
5629
5630
  ]), t = 0; t < r.length; t += 1) {
5630
- var n = r.get(t), s = Nc(n);
5631
+ var n = r.get(t), s = zc(n);
5631
5632
  e.charStrings.push({ name: n.name, type: "CHARSTRING", value: s });
5632
5633
  }
5633
5634
  return e;
@@ -5664,7 +5665,7 @@ function Wc(r, e) {
5664
5665
  var l = [];
5665
5666
  t.header = Fc(), t.nameIndex = Uc([e.postScriptName]);
5666
5667
  var h = Xr(s, l);
5667
- t.topDictIndex = qr(h), t.globalSubrIndex = Gc(), t.charsets = zc(o, l), t.charStringsIndex = Vc(r), t.privateDict = Hc(i, l), t.stringIndex = Pc(l);
5668
+ t.topDictIndex = qr(h), t.globalSubrIndex = Gc(), t.charsets = Nc(o, l), t.charStringsIndex = Vc(r), t.privateDict = Hc(i, l), t.stringIndex = Pc(l);
5668
5669
  var d = t.header.sizeOf() + t.nameIndex.sizeOf() + t.topDictIndex.sizeOf() + t.stringIndex.sizeOf() + t.globalSubrIndex.sizeOf();
5669
5670
  return s.charset = d, s.encoding = 0, s.charStrings = s.charset + t.charsets.sizeOf(), s.private[1] = s.charStrings + t.charStringsIndex.sizeOf(), h = Xr(s, l), t.topDictIndex = qr(h), t;
5670
5671
  }
@@ -5740,15 +5741,15 @@ function Zc(r, e, t, n, s) {
5740
5741
  function Qc(r, e, t, n, s, i, o) {
5741
5742
  o.lowMemory ? Zc(r, e, t, n, s) : Yc(e, t, n, s, i);
5742
5743
  }
5743
- function Kc(r) {
5744
+ function Jc(r) {
5744
5745
  for (var e = new I.Table("hmtx", []), t = 0; t < r.length; t += 1) {
5745
5746
  var n = r.get(t), s = n.advanceWidth || 0, i = n.leftSideBearing || 0;
5746
5747
  e.fields.push({ name: "advanceWidth_" + t, type: "USHORT", value: s }), e.fields.push({ name: "leftSideBearing_" + t, type: "SHORT", value: i });
5747
5748
  }
5748
5749
  return e;
5749
5750
  }
5750
- var Ti = { parse: Qc, make: Kc };
5751
- function Jc(r) {
5751
+ var Ti = { parse: Qc, make: Jc };
5752
+ function Kc(r) {
5752
5753
  for (var e = new I.Table("ltag", [
5753
5754
  { name: "version", type: "ULONG", value: 1 },
5754
5755
  { name: "flags", type: "ULONG", value: 0 },
@@ -5769,7 +5770,7 @@ function el(r, e) {
5769
5770
  }
5770
5771
  return i;
5771
5772
  }
5772
- var Ci = { make: Jc, parse: el };
5773
+ var Ci = { make: Kc, parse: el };
5773
5774
  function tl(r, e) {
5774
5775
  var t = {}, n = new E.Parser(r, e);
5775
5776
  return t.version = n.parseVersion(), t.numGlyphs = n.parseUShort(), t.version === 1 && (t.maxPoints = n.parseUShort(), t.maxContours = n.parseUShort(), t.maxCompositePoints = n.parseUShort(), t.maxCompositeContours = n.parseUShort(), t.maxZones = n.parseUShort(), t.maxTwilightPoints = n.parseUShort(), t.maxStorage = n.parseUShort(), t.maxFunctionDefs = n.parseUShort(), t.maxInstructionDefs = n.parseUShort(), t.maxStackElements = n.parseUShort(), t.maxSizeOfInstructions = n.parseUShort(), t.maxComponentElements = n.parseUShort(), t.maxComponentDepth = n.parseUShort()), t;
@@ -6590,13 +6591,13 @@ function ll(r, e) {
6590
6591
  _.length,
6591
6592
  S
6592
6593
  ));
6593
- var L = l[f];
6594
- if (L !== void 0) {
6594
+ var A = l[f];
6595
+ if (A !== void 0) {
6595
6596
  var T = C.UTF16(m), k = Yr(T, d);
6596
6597
  h.push($r(
6597
6598
  3,
6598
6599
  1,
6599
- L,
6600
+ A,
6600
6601
  t,
6601
6602
  T.length,
6602
6603
  k
@@ -6615,7 +6616,7 @@ function ll(r, e) {
6615
6616
  O.fields.push({ name: "record_" + G, type: "RECORD", value: h[G] });
6616
6617
  return O.fields.push({ name: "strings", type: "LITERAL", value: d }), O;
6617
6618
  }
6618
- var Ai = { parse: al, make: ll }, nr = [
6619
+ var Li = { parse: al, make: ll }, nr = [
6619
6620
  { begin: 0, end: 127 },
6620
6621
  // Basic Latin
6621
6622
  { begin: 128, end: 255 },
@@ -6967,8 +6968,8 @@ function fl() {
6967
6968
  { name: "maxMemType1", type: "ULONG", value: 0 }
6968
6969
  ]);
6969
6970
  }
6970
- var Li = { parse: pl, make: fl }, de = new Array(9);
6971
- de[1] = function() {
6971
+ var Ai = { parse: pl, make: fl }, pe = new Array(9);
6972
+ pe[1] = function() {
6972
6973
  var r = this.offset + this.relativeOffset, e = this.parseUShort();
6973
6974
  if (e === 1)
6974
6975
  return {
@@ -6984,7 +6985,7 @@ de[1] = function() {
6984
6985
  };
6985
6986
  B.assert(!1, "0x" + r.toString(16) + ": lookup type 1 format must be 1 or 2.");
6986
6987
  };
6987
- de[2] = function() {
6988
+ pe[2] = function() {
6988
6989
  var r = this.parseUShort();
6989
6990
  return B.argument(r === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
6990
6991
  substFormat: r,
@@ -6992,7 +6993,7 @@ de[2] = function() {
6992
6993
  sequences: this.parseListOfLists()
6993
6994
  };
6994
6995
  };
6995
- de[3] = function() {
6996
+ pe[3] = function() {
6996
6997
  var r = this.parseUShort();
6997
6998
  return B.argument(r === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
6998
6999
  substFormat: r,
@@ -7000,7 +7001,7 @@ de[3] = function() {
7000
7001
  alternateSets: this.parseListOfLists()
7001
7002
  };
7002
7003
  };
7003
- de[4] = function() {
7004
+ pe[4] = function() {
7004
7005
  var r = this.parseUShort();
7005
7006
  return B.argument(r === 1, "GSUB ligature table identifier-format must be 1"), {
7006
7007
  substFormat: r,
@@ -7017,7 +7018,7 @@ var ot = {
7017
7018
  sequenceIndex: b.uShort,
7018
7019
  lookupListIndex: b.uShort
7019
7020
  };
7020
- de[5] = function() {
7021
+ pe[5] = function() {
7021
7022
  var r = this.offset + this.relativeOffset, e = this.parseUShort();
7022
7023
  if (e === 1)
7023
7024
  return {
@@ -7054,7 +7055,7 @@ de[5] = function() {
7054
7055
  }
7055
7056
  B.assert(!1, "0x" + r.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
7056
7057
  };
7057
- de[6] = function() {
7058
+ pe[6] = function() {
7058
7059
  var r = this.offset + this.relativeOffset, e = this.parseUShort();
7059
7060
  if (e === 1)
7060
7061
  return {
@@ -7095,17 +7096,17 @@ de[6] = function() {
7095
7096
  };
7096
7097
  B.assert(!1, "0x" + r.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
7097
7098
  };
7098
- de[7] = function() {
7099
+ pe[7] = function() {
7099
7100
  var r = this.parseUShort();
7100
7101
  B.argument(r === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
7101
7102
  var e = this.parseUShort(), t = new b(this.data, this.offset + this.parseULong());
7102
7103
  return {
7103
7104
  substFormat: 1,
7104
7105
  lookupType: e,
7105
- extension: de[e].call(t)
7106
+ extension: pe[e].call(t)
7106
7107
  };
7107
7108
  };
7108
- de[8] = function() {
7109
+ pe[8] = function() {
7109
7110
  var r = this.parseUShort();
7110
7111
  return B.argument(r === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
7111
7112
  substFormat: r,
@@ -7122,12 +7123,12 @@ function gl(r, e) {
7122
7123
  version: n,
7123
7124
  scripts: t.parseScriptList(),
7124
7125
  features: t.parseFeatureList(),
7125
- lookups: t.parseLookupList(de)
7126
+ lookups: t.parseLookupList(pe)
7126
7127
  } : {
7127
7128
  version: n,
7128
7129
  scripts: t.parseScriptList(),
7129
7130
  features: t.parseFeatureList(),
7130
- lookups: t.parseLookupList(de),
7131
+ lookups: t.parseLookupList(pe),
7131
7132
  variations: t.parseFeatureVariationsList()
7132
7133
  };
7133
7134
  }
@@ -7279,7 +7280,7 @@ function Ri(r) {
7279
7280
  return h.value.tag > d.value.tag ? 1 : -1;
7280
7281
  }), e.fields = e.fields.concat(n), e.fields = e.fields.concat(s), e;
7281
7282
  }
7282
- function Kr(r, e, t) {
7283
+ function Jr(r, e, t) {
7283
7284
  for (var n = 0; n < e.length; n += 1) {
7284
7285
  var s = r.charToGlyphIndex(e[n]);
7285
7286
  if (s > 0) {
@@ -7346,7 +7347,7 @@ function xl(r) {
7346
7347
  minRightSideBearing: x.minRightSideBearing,
7347
7348
  xMaxExtent: x.maxLeftSideBearing + (x.xMax - x.xMin),
7348
7349
  numberOfHMetrics: r.glyphs.length
7349
- }), L = ki.make(r.glyphs.length), T = rr.make(Object.assign({
7350
+ }), A = ki.make(r.glyphs.length), T = rr.make(Object.assign({
7350
7351
  xAvgCharWidth: Math.round(x.advanceWidthAvg),
7351
7352
  usFirstCharIndex: c,
7352
7353
  usLastCharIndex: l,
@@ -7365,8 +7366,8 @@ function xl(r) {
7365
7366
  usWinDescent: Math.abs(x.yMin),
7366
7367
  ulCodePageRange1: 1,
7367
7368
  // FIXME: hard-code Latin 1 support for now
7368
- sxHeight: Kr(r, "xyvw", { yMax: Math.round(x.ascender / 2) }).yMax,
7369
- sCapHeight: Kr(r, "HIKLEFJMNTZBDPRAGOQSUVWXY", x).yMax,
7369
+ sxHeight: Jr(r, "xyvw", { yMax: Math.round(x.ascender / 2) }).yMax,
7370
+ sCapHeight: Jr(r, "HIKLEFJMNTZBDPRAGOQSUVWXY", x).yMax,
7370
7371
  usDefaultChar: r.hasChar(" ") ? 32 : 0,
7371
7372
  // Use space as the default character, if available.
7372
7373
  usBreakChar: r.hasChar(" ") ? 32 : 0
@@ -7374,10 +7375,10 @@ function xl(r) {
7374
7375
  }, r.tables.os2)), k = Ti.make(r.glyphs), O = hi.make(r.glyphs), G = r.getEnglishName("fontFamily"), Q = r.getEnglishName("fontSubfamily"), te = G + " " + Q, $ = r.getEnglishName("postScriptName");
7375
7376
  $ || ($ = G.replace(/\s/g, "") + "-" + Q);
7376
7377
  var F = {};
7377
- for (var z in r.names)
7378
- F[z] = r.names[z];
7378
+ for (var N in r.names)
7379
+ F[N] = r.names[N];
7379
7380
  F.uniqueID || (F.uniqueID = { en: r.getEnglishName("manufacturer") + ":" + te }), F.postScriptName || (F.postScriptName = { en: $ }), F.preferredFamily || (F.preferredFamily = r.names.fontFamily), F.preferredSubfamily || (F.preferredSubfamily = r.names.fontSubfamily);
7380
- var U = [], W = Ai.make(F, U), Y = U.length > 0 ? Ci.make(U) : void 0, X = Li.make(), K = wi.make(r.glyphs, {
7381
+ var U = [], W = Li.make(F, U), Y = U.length > 0 ? Ci.make(U) : void 0, X = Ai.make(), J = wi.make(r.glyphs, {
7381
7382
  version: r.getEnglishName("version"),
7382
7383
  fullName: te,
7383
7384
  familyName: G,
@@ -7385,7 +7386,7 @@ function xl(r) {
7385
7386
  postScriptName: $,
7386
7387
  unitsPerEm: r.unitsPerEm,
7387
7388
  fontBBox: [0, x.yMin, x.ascender, x.advanceWidthMax]
7388
- }), R = r.metas && Object.keys(r.metas).length > 0 ? Di.make(r.metas) : void 0, Z = [_, S, L, T, W, O, X, K, k];
7389
+ }), R = r.metas && Object.keys(r.metas).length > 0 ? Di.make(r.metas) : void 0, Z = [_, S, A, T, W, O, X, J, k];
7389
7390
  Y && Z.push(Y), r.tables.gsub && Z.push(Oi.make(r.tables.gsub)), R && Z.push(R);
7390
7391
  for (var vn = Ri(Z), so = vn.encode(), io = pr(so), bn = vn.fields, _r = !1, Ut = 0; Ut < bn.length; Ut += 1)
7391
7392
  if (bn[Ut].name === "head table") {
@@ -7406,7 +7407,7 @@ function Cn(r, e) {
7406
7407
  }
7407
7408
  return -t - 1;
7408
7409
  }
7409
- function Jr(r, e) {
7410
+ function Kr(r, e) {
7410
7411
  for (var t = 0, n = r.length - 1; t <= n; ) {
7411
7412
  var s = t + n >>> 1, i = r[s];
7412
7413
  if (i === e)
@@ -7450,7 +7451,7 @@ Bt.prototype = {
7450
7451
  * @param {number} value
7451
7452
  * @return {number}
7452
7453
  */
7453
- binSearch: Jr,
7454
+ binSearch: Kr,
7454
7455
  /**
7455
7456
  * Get or create the Layout table (GSUB, GPOS etc).
7456
7457
  * @param {boolean} create - Whether to create a new one.
@@ -7619,7 +7620,7 @@ Bt.prototype = {
7619
7620
  getCoverageIndex: function(r, e) {
7620
7621
  switch (r.format) {
7621
7622
  case 1:
7622
- var t = Jr(r.glyphs, e);
7623
+ var t = Kr(r.glyphs, e);
7623
7624
  return t >= 0 ? t : -1;
7624
7625
  case 2:
7625
7626
  var n = es(r.ranges, e);
@@ -7643,15 +7644,15 @@ Bt.prototype = {
7643
7644
  return e;
7644
7645
  }
7645
7646
  };
7646
- function At(r) {
7647
+ function Lt(r) {
7647
7648
  Bt.call(this, r, "gpos");
7648
7649
  }
7649
- At.prototype = Bt.prototype;
7650
- At.prototype.init = function() {
7650
+ Lt.prototype = Bt.prototype;
7651
+ Lt.prototype.init = function() {
7651
7652
  var r = this.getDefaultScriptName();
7652
7653
  this.defaultKerningTables = this.getKerningTables(r);
7653
7654
  };
7654
- At.prototype.getKerningValue = function(r, e, t) {
7655
+ Lt.prototype.getKerningValue = function(r, e, t) {
7655
7656
  for (var n = 0; n < r.length; n++)
7656
7657
  for (var s = r[n].subtables, i = 0; i < s.length; i++) {
7657
7658
  var o = s[i], a = this.getCoverageIndex(o.coverage, e);
@@ -7671,11 +7672,11 @@ At.prototype.getKerningValue = function(r, e, t) {
7671
7672
  }
7672
7673
  return 0;
7673
7674
  };
7674
- At.prototype.getKerningTables = function(r, e) {
7675
+ Lt.prototype.getKerningTables = function(r, e) {
7675
7676
  if (this.font.tables.gpos)
7676
7677
  return this.getLookupTables(r, e, "kern", 2);
7677
7678
  };
7678
- function ie(r) {
7679
+ function oe(r) {
7679
7680
  Bt.call(this, r, "gsub");
7680
7681
  }
7681
7682
  function Sl(r, e) {
@@ -7696,8 +7697,8 @@ function fr(r, e, t) {
7696
7697
  if (t)
7697
7698
  return n.push(t), t;
7698
7699
  }
7699
- ie.prototype = Bt.prototype;
7700
- ie.prototype.createDefaultTable = function() {
7700
+ oe.prototype = Bt.prototype;
7701
+ oe.prototype.createDefaultTable = function() {
7701
7702
  return {
7702
7703
  version: 1,
7703
7704
  scripts: [{
@@ -7711,7 +7712,7 @@ ie.prototype.createDefaultTable = function() {
7711
7712
  lookups: []
7712
7713
  };
7713
7714
  };
7714
- ie.prototype.getSingle = function(r, e, t) {
7715
+ oe.prototype.getSingle = function(r, e, t) {
7715
7716
  for (var n = [], s = this.getLookupTables(e, t, r, 1), i = 0; i < s.length; i++)
7716
7717
  for (var o = s[i].subtables, a = 0; a < o.length; a++) {
7717
7718
  var c = o[a], l = this.expandCoverage(c.coverage), h = void 0;
@@ -7729,7 +7730,7 @@ ie.prototype.getSingle = function(r, e, t) {
7729
7730
  }
7730
7731
  return n;
7731
7732
  };
7732
- ie.prototype.getMultiple = function(r, e, t) {
7733
+ oe.prototype.getMultiple = function(r, e, t) {
7733
7734
  for (var n = [], s = this.getLookupTables(e, t, r, 2), i = 0; i < s.length; i++)
7734
7735
  for (var o = s[i].subtables, a = 0; a < o.length; a++) {
7735
7736
  var c = o[a], l = this.expandCoverage(c.coverage), h = void 0;
@@ -7740,14 +7741,14 @@ ie.prototype.getMultiple = function(r, e, t) {
7740
7741
  }
7741
7742
  return n;
7742
7743
  };
7743
- ie.prototype.getAlternates = function(r, e, t) {
7744
+ oe.prototype.getAlternates = function(r, e, t) {
7744
7745
  for (var n = [], s = this.getLookupTables(e, t, r, 3), i = 0; i < s.length; i++)
7745
7746
  for (var o = s[i].subtables, a = 0; a < o.length; a++)
7746
7747
  for (var c = o[a], l = this.expandCoverage(c.coverage), h = c.alternateSets, d = 0; d < l.length; d++)
7747
7748
  n.push({ sub: l[d], by: h[d] });
7748
7749
  return n;
7749
7750
  };
7750
- ie.prototype.getLigatures = function(r, e, t) {
7751
+ oe.prototype.getLigatures = function(r, e, t) {
7751
7752
  for (var n = [], s = this.getLookupTables(e, t, r, 4), i = 0; i < s.length; i++)
7752
7753
  for (var o = s[i].subtables, a = 0; a < o.length; a++)
7753
7754
  for (var c = o[a], l = this.expandCoverage(c.coverage), h = c.ligatureSets, d = 0; d < l.length; d++)
@@ -7760,7 +7761,7 @@ ie.prototype.getLigatures = function(r, e, t) {
7760
7761
  }
7761
7762
  return n;
7762
7763
  };
7763
- ie.prototype.addSingle = function(r, e, t, n) {
7764
+ oe.prototype.addSingle = function(r, e, t, n) {
7764
7765
  var s = this.getLookupTables(t, n, r, 1, !0)[0], i = fr(s, 2, {
7765
7766
  // lookup type 1 subtable, format 2, coverage format 1
7766
7767
  substFormat: 2,
@@ -7771,7 +7772,7 @@ ie.prototype.addSingle = function(r, e, t, n) {
7771
7772
  var o = e.sub, a = this.binSearch(i.coverage.glyphs, o);
7772
7773
  a < 0 && (a = -1 - a, i.coverage.glyphs.splice(a, 0, o), i.substitute.splice(a, 0, 0)), i.substitute[a] = e.by;
7773
7774
  };
7774
- ie.prototype.addMultiple = function(r, e, t, n) {
7775
+ oe.prototype.addMultiple = function(r, e, t, n) {
7775
7776
  B.assert(e.by instanceof Array && e.by.length > 1, 'Multiple: "by" must be an array of two or more ids');
7776
7777
  var s = this.getLookupTables(t, n, r, 2, !0)[0], i = fr(s, 1, {
7777
7778
  // lookup type 2 subtable, format 1, coverage format 1
@@ -7783,7 +7784,7 @@ ie.prototype.addMultiple = function(r, e, t, n) {
7783
7784
  var o = e.sub, a = this.binSearch(i.coverage.glyphs, o);
7784
7785
  a < 0 && (a = -1 - a, i.coverage.glyphs.splice(a, 0, o), i.sequences.splice(a, 0, 0)), i.sequences[a] = e.by;
7785
7786
  };
7786
- ie.prototype.addAlternate = function(r, e, t, n) {
7787
+ oe.prototype.addAlternate = function(r, e, t, n) {
7787
7788
  var s = this.getLookupTables(t, n, r, 3, !0)[0], i = fr(s, 1, {
7788
7789
  // lookup type 3 subtable, format 1, coverage format 1
7789
7790
  substFormat: 1,
@@ -7794,7 +7795,7 @@ ie.prototype.addAlternate = function(r, e, t, n) {
7794
7795
  var o = e.sub, a = this.binSearch(i.coverage.glyphs, o);
7795
7796
  a < 0 && (a = -1 - a, i.coverage.glyphs.splice(a, 0, o), i.alternateSets.splice(a, 0, 0)), i.alternateSets[a] = e.by;
7796
7797
  };
7797
- ie.prototype.addLigature = function(r, e, t, n) {
7798
+ oe.prototype.addLigature = function(r, e, t, n) {
7798
7799
  var s = this.getLookupTables(t, n, r, 4, !0)[0], i = s.subtables[0];
7799
7800
  i || (i = {
7800
7801
  // lookup type 4 subtable, format 1, coverage format 1
@@ -7814,7 +7815,7 @@ ie.prototype.addLigature = function(r, e, t, n) {
7814
7815
  } else
7815
7816
  l = -1 - l, i.coverage.glyphs.splice(l, 0, o), i.ligatureSets.splice(l, 0, [c]);
7816
7817
  };
7817
- ie.prototype.getFeature = function(r, e, t) {
7818
+ oe.prototype.getFeature = function(r, e, t) {
7818
7819
  if (/ss\d\d/.test(r))
7819
7820
  return this.getSingle(r, e, t);
7820
7821
  switch (r) {
@@ -7831,7 +7832,7 @@ ie.prototype.getFeature = function(r, e, t) {
7831
7832
  return this.getMultiple(r, e, t);
7832
7833
  }
7833
7834
  };
7834
- ie.prototype.add = function(r, e, t, n) {
7835
+ oe.prototype.add = function(r, e, t, n) {
7835
7836
  if (/ss\d\d/.test(r))
7836
7837
  return this.addSingle(r, e, t, n);
7837
7838
  switch (r) {
@@ -7910,7 +7911,7 @@ function Fi(r, e, t) {
7910
7911
  }
7911
7912
  if (s & 256) {
7912
7913
  r.instructionLength = n.parseUShort(), r.instructions = [];
7913
- for (var L = 0; L < r.instructionLength; L += 1)
7914
+ for (var A = 0; A < r.instructionLength; A += 1)
7914
7915
  r.instructions.push(n.parseByte());
7915
7916
  }
7916
7917
  }
@@ -8002,7 +8003,7 @@ function Il(r, e, t, n) {
8002
8003
  function Ml(r, e, t, n, s) {
8003
8004
  return s.lowMemory ? Il(r, e, t, n) : kl(r, e, t, n);
8004
8005
  }
8005
- var Gi = { getPath: Ui, parse: Ml }, zi, je, Ni, sr;
8006
+ var Gi = { getPath: Ui, parse: Ml }, Ni, je, zi, sr;
8006
8007
  function Vi(r) {
8007
8008
  this.font = r, this.getCommands = function(e) {
8008
8009
  return Gi.getPath(e).commands;
@@ -8017,10 +8018,10 @@ function Hi(r) {
8017
8018
  function Bl(r) {
8018
8019
  return Math.sign(r) * Math.round(Math.abs(r * 2)) / 2;
8019
8020
  }
8020
- function Al(r) {
8021
+ function Ll(r) {
8021
8022
  return Math.sign(r) * (Math.round(Math.abs(r) + 0.5) - 0.5);
8022
8023
  }
8023
- function Ll(r) {
8024
+ function Al(r) {
8024
8025
  return Math.sign(r) * Math.ceil(Math.abs(r));
8025
8026
  }
8026
8027
  function Ol(r) {
@@ -8160,13 +8161,13 @@ var Wi = function(r) {
8160
8161
  };
8161
8162
  Object.freeze(Te);
8162
8163
  Object.freeze(ke);
8163
- function Lt(r, e) {
8164
+ function At(r, e) {
8164
8165
  this.x = r, this.y = e, this.axis = void 0, this.slope = e / r, this.normalSlope = -r / e, Object.freeze(this);
8165
8166
  }
8166
- Lt.prototype.distance = function(r, e, t, n) {
8167
+ At.prototype.distance = function(r, e, t, n) {
8167
8168
  return this.x * Te.distance(r, e, t, n) + this.y * ke.distance(r, e, t, n);
8168
8169
  };
8169
- Lt.prototype.interpolate = function(r, e, t, n) {
8170
+ At.prototype.interpolate = function(r, e, t, n) {
8170
8171
  var s, i, o, a, c, l, h;
8171
8172
  if (o = n.distance(r, e, !0, !0), a = n.distance(r, t, !0, !0), s = n.distance(e, e, !1, !0), i = n.distance(t, t, !1, !0), c = Math.abs(o), l = Math.abs(a), h = c + l, h === 0) {
8172
8173
  this.setRelative(r, r, (s + i) / 2, n, !0);
@@ -8174,17 +8175,17 @@ Lt.prototype.interpolate = function(r, e, t, n) {
8174
8175
  }
8175
8176
  this.setRelative(r, r, (s * l + i * c) / h, n, !0);
8176
8177
  };
8177
- Lt.prototype.setRelative = function(r, e, t, n, s) {
8178
+ At.prototype.setRelative = function(r, e, t, n, s) {
8178
8179
  n = n || this;
8179
8180
  var i = s ? e.xo : e.x, o = s ? e.yo : e.y, a = i + t * n.x, c = o + t * n.y, l = n.normalSlope, h = this.slope, d = r.x, u = r.y;
8180
8181
  r.x = (h * d - l * a + c - u) / (h - l), r.y = h * (r.x - d) + u;
8181
8182
  };
8182
- Lt.prototype.touch = function(r) {
8183
+ At.prototype.touch = function(r) {
8183
8184
  r.xTouched = !0, r.yTouched = !0;
8184
8185
  };
8185
8186
  function Ot(r, e) {
8186
8187
  var t = Math.sqrt(r * r + e * e);
8187
- return r /= t, e /= t, r === 1 && e === 0 ? Te : r === 0 && e === 1 ? ke : new Lt(r, e);
8188
+ return r /= t, e /= t, r === 1 && e === 0 ? Te : r === 0 && e === 1 ? ke : new At(r, e);
8188
8189
  }
8189
8190
  function Ie(r, e, t, n) {
8190
8191
  this.x = this.xo = Math.round(r * 64) / 64, this.y = this.yo = Math.round(e * 64) / 64, this.lastPointOfContour = t, this.onCurve = n, this.prevPointOnContour = void 0, this.nextPointOnContour = void 0, this.xTouched = !1, this.yTouched = !1, Object.preventExtensions(this);
@@ -8210,7 +8211,7 @@ var kt = Object.freeze(new Ie(0, 0)), Dl = {
8210
8211
  // minimum distance
8211
8212
  autoFlip: !0
8212
8213
  };
8213
- function Ae(r, e) {
8214
+ function Le(r, e) {
8214
8215
  switch (this.env = r, this.stack = [], this.prog = e, r) {
8215
8216
  case "glyf":
8216
8217
  this.zp0 = this.zp1 = this.zp2 = 1, this.rp0 = this.rp1 = this.rp2 = 0;
@@ -8226,7 +8227,7 @@ Vi.prototype.exec = function(r, e) {
8226
8227
  if (!n || n.ppem !== e) {
8227
8228
  var s = this._fpgmState;
8228
8229
  if (!s) {
8229
- Ae.prototype = Dl, s = this._fpgmState = new Ae("fpgm", t.tables.fpgm), s.funcs = [], s.font = t, exports.DEBUG && (console.log("---EXEC FPGM---"), s.step = -1);
8230
+ Le.prototype = Dl, s = this._fpgmState = new Le("fpgm", t.tables.fpgm), s.funcs = [], s.font = t, exports.DEBUG && (console.log("---EXEC FPGM---"), s.step = -1);
8230
8231
  try {
8231
8232
  je(s);
8232
8233
  } catch (l) {
@@ -8234,7 +8235,7 @@ Vi.prototype.exec = function(r, e) {
8234
8235
  return;
8235
8236
  }
8236
8237
  }
8237
- Ae.prototype = s, n = this._prepState = new Ae("prep", t.tables.prep), n.ppem = e;
8238
+ Le.prototype = s, n = this._prepState = new Le("prep", t.tables.prep), n.ppem = e;
8238
8239
  var i = t.tables.cvt;
8239
8240
  if (i)
8240
8241
  for (var o = n.cvt = new Array(i.length), a = e / t.unitsPerEm, c = 0; c < i.length; c++)
@@ -8250,23 +8251,23 @@ Vi.prototype.exec = function(r, e) {
8250
8251
  }
8251
8252
  if (!(this._errorState > 1))
8252
8253
  try {
8253
- return Ni(r, n);
8254
+ return zi(r, n);
8254
8255
  } catch (l) {
8255
8256
  this._errorState < 1 && (console.log("Hinting error:" + l), console.log("Note: further hinting errors are silenced")), this._errorState = 1;
8256
8257
  return;
8257
8258
  }
8258
8259
  }
8259
8260
  };
8260
- Ni = function(r, e) {
8261
+ zi = function(r, e) {
8261
8262
  var t = e.ppem / e.font.unitsPerEm, n = t, s = r.components, i, o, a;
8262
- if (Ae.prototype = e, !s)
8263
- a = new Ae("glyf", r.instructions), exports.DEBUG && (console.log("---EXEC GLYPH---"), a.step = -1), sr(r, a, t, n), o = a.gZone;
8263
+ if (Le.prototype = e, !s)
8264
+ a = new Le("glyf", r.instructions), exports.DEBUG && (console.log("---EXEC GLYPH---"), a.step = -1), sr(r, a, t, n), o = a.gZone;
8264
8265
  else {
8265
8266
  var c = e.font;
8266
8267
  o = [], i = [];
8267
8268
  for (var l = 0; l < s.length; l++) {
8268
8269
  var h = s[l], d = c.glyphs.get(h.glyphIndex);
8269
- a = new Ae("glyf", d.instructions), exports.DEBUG && (console.log("---EXEC COMP " + l + "---"), a.step = -1), sr(d, a, t, n);
8270
+ a = new Le("glyf", d.instructions), exports.DEBUG && (console.log("---EXEC COMP " + l + "---"), a.step = -1), sr(d, a, t, n);
8270
8271
  for (var u = Math.round(h.dx * t), p = Math.round(h.dy * n), f = a.gZone, m = a.contours, y = 0; y < f.length; y++) {
8271
8272
  var v = f[y];
8272
8273
  v.xTouched = v.yTouched = !1, v.xo = v.x = v.x + u, v.yo = v.y = v.y + p;
@@ -8276,7 +8277,7 @@ Ni = function(r, e) {
8276
8277
  for (var x = 0; x < m.length; x++)
8277
8278
  i.push(m[x] + w);
8278
8279
  }
8279
- r.instructions && !a.inhibitGridFit && (a = new Ae("glyf", r.instructions), a.gZone = a.z0 = a.z1 = a.z2 = o, a.contours = i, o.push(
8280
+ r.instructions && !a.inhibitGridFit && (a = new Le("glyf", r.instructions), a.gZone = a.z0 = a.z1 = a.z2 = o, a.contours = i, o.push(
8280
8281
  new Ie(0, 0),
8281
8282
  new Ie(Math.round(r.advanceWidth * t), 0)
8282
8283
  ), exports.DEBUG && (console.log("---EXEC COMPOSITE---"), a.step = -1), je(a), o.length -= 2);
@@ -8314,7 +8315,7 @@ je = function(r) {
8314
8315
  if (e) {
8315
8316
  var t = e.length, n;
8316
8317
  for (r.ip = 0; r.ip < t; r.ip++) {
8317
- if (exports.DEBUG && r.step++, n = zi[e[r.ip]], !n)
8318
+ if (exports.DEBUG && r.step++, n = Ni[e[r.ip]], !n)
8318
8319
  throw new Error(
8319
8320
  "unknown instruction: 0x" + Number(e[r.ip]).toString(16)
8320
8321
  );
@@ -8322,7 +8323,7 @@ je = function(r) {
8322
8323
  }
8323
8324
  }
8324
8325
  };
8325
- function gn(r) {
8326
+ function fn(r) {
8326
8327
  for (var e = r.tZone = new Array(r.gZone.length), t = 0; t < e.length; t++)
8327
8328
  e[t] = new Ie(0, 0);
8328
8329
  }
@@ -8386,13 +8387,13 @@ function Pl(r) {
8386
8387
  function Gl(r) {
8387
8388
  r.fv = r.pv, exports.DEBUG && console.log(r.step, "SFVTPV[]");
8388
8389
  }
8389
- function zl(r) {
8390
+ function Nl(r) {
8390
8391
  var e = r.stack, t = e.pop(), n = e.pop(), s = e.pop(), i = e.pop(), o = e.pop(), a = r.z0, c = r.z1, l = a[t], h = a[n], d = c[s], u = c[i], p = r.z2[o];
8391
8392
  exports.DEBUG && console.log("ISECT[], ", t, n, s, i, o);
8392
- var f = l.x, m = l.y, y = h.x, v = h.y, w = d.x, x = d.y, _ = u.x, S = u.y, L = (f - y) * (x - S) - (m - v) * (w - _), T = f * v - m * y, k = w * S - x * _;
8393
- p.x = (T * (w - _) - k * (f - y)) / L, p.y = (T * (x - S) - k * (m - v)) / L;
8393
+ var f = l.x, m = l.y, y = h.x, v = h.y, w = d.x, x = d.y, _ = u.x, S = u.y, A = (f - y) * (x - S) - (m - v) * (w - _), T = f * v - m * y, k = w * S - x * _;
8394
+ p.x = (T * (w - _) - k * (f - y)) / A, p.y = (T * (x - S) - k * (m - v)) / A;
8394
8395
  }
8395
- function Nl(r) {
8396
+ function zl(r) {
8396
8397
  r.rp0 = r.stack.pop(), exports.DEBUG && console.log(r.step, "SRP0[]", r.rp0);
8397
8398
  }
8398
8399
  function Vl(r) {
@@ -8405,7 +8406,7 @@ function Wl(r) {
8405
8406
  var e = r.stack.pop();
8406
8407
  switch (exports.DEBUG && console.log(r.step, "SZP0[]", e), r.zp0 = e, e) {
8407
8408
  case 0:
8408
- r.tZone || gn(r), r.z0 = r.tZone;
8409
+ r.tZone || fn(r), r.z0 = r.tZone;
8409
8410
  break;
8410
8411
  case 1:
8411
8412
  r.z0 = r.gZone;
@@ -8418,7 +8419,7 @@ function jl(r) {
8418
8419
  var e = r.stack.pop();
8419
8420
  switch (exports.DEBUG && console.log(r.step, "SZP1[]", e), r.zp1 = e, e) {
8420
8421
  case 0:
8421
- r.tZone || gn(r), r.z1 = r.tZone;
8422
+ r.tZone || fn(r), r.z1 = r.tZone;
8422
8423
  break;
8423
8424
  case 1:
8424
8425
  r.z1 = r.gZone;
@@ -8431,7 +8432,7 @@ function Xl(r) {
8431
8432
  var e = r.stack.pop();
8432
8433
  switch (exports.DEBUG && console.log(r.step, "SZP2[]", e), r.zp2 = e, e) {
8433
8434
  case 0:
8434
- r.tZone || gn(r), r.z2 = r.tZone;
8435
+ r.tZone || fn(r), r.z2 = r.tZone;
8435
8436
  break;
8436
8437
  case 1:
8437
8438
  r.z2 = r.gZone;
@@ -8444,7 +8445,7 @@ function ql(r) {
8444
8445
  var e = r.stack.pop();
8445
8446
  switch (exports.DEBUG && console.log(r.step, "SZPS[]", e), r.zp0 = r.zp1 = r.zp2 = e, e) {
8446
8447
  case 0:
8447
- r.tZone || gn(r), r.z0 = r.z1 = r.z2 = r.tZone;
8448
+ r.tZone || fn(r), r.z0 = r.z1 = r.z2 = r.tZone;
8448
8449
  break;
8449
8450
  case 1:
8450
8451
  r.z0 = r.z1 = r.z2 = r.gZone;
@@ -8460,16 +8461,16 @@ function Yl(r) {
8460
8461
  exports.DEBUG && console.log(r.step, "RTG[]"), r.round = Hi;
8461
8462
  }
8462
8463
  function Zl(r) {
8463
- exports.DEBUG && console.log(r.step, "RTHG[]"), r.round = Al;
8464
+ exports.DEBUG && console.log(r.step, "RTHG[]"), r.round = Ll;
8464
8465
  }
8465
8466
  function Ql(r) {
8466
8467
  var e = r.stack.pop();
8467
8468
  exports.DEBUG && console.log(r.step, "SMD[]", e), r.minDis = e / 64;
8468
8469
  }
8469
- function Kl(r) {
8470
+ function Jl(r) {
8470
8471
  exports.DEBUG && console.log(r.step, "ELSE[]"), ji(r, !1);
8471
8472
  }
8472
- function Jl(r) {
8473
+ function Kl(r) {
8473
8474
  var e = r.stack.pop();
8474
8475
  exports.DEBUG && console.log(r.step, "JMPR[]", e), r.ip += e - 1;
8475
8476
  }
@@ -8722,10 +8723,10 @@ function Bh(r) {
8722
8723
  var e = r.stack.pop();
8723
8724
  exports.DEBUG && console.log(r.step, "IF[]", e), e || (ji(r, !0), exports.DEBUG && console.log(r.step, "EIF[]"));
8724
8725
  }
8725
- function Ah(r) {
8726
+ function Lh(r) {
8726
8727
  exports.DEBUG && console.log(r.step, "EIF[]");
8727
8728
  }
8728
- function Lh(r) {
8729
+ function Ah(r) {
8729
8730
  var e = r.stack, t = e.pop(), n = e.pop();
8730
8731
  exports.DEBUG && console.log(r.step, "AND[]", t, n), e.push(t && n ? 1 : 0);
8731
8732
  }
@@ -8770,11 +8771,11 @@ function Gh(r) {
8770
8771
  var e = r.stack, t = e.pop(), n = e.pop();
8771
8772
  exports.DEBUG && console.log(r.step, "DIV[]", t, n), e.push(n * 64 / t);
8772
8773
  }
8773
- function zh(r) {
8774
+ function Nh(r) {
8774
8775
  var e = r.stack, t = e.pop(), n = e.pop();
8775
8776
  exports.DEBUG && console.log(r.step, "MUL[]", t, n), e.push(n * t / 64);
8776
8777
  }
8777
- function Nh(r) {
8778
+ function zh(r) {
8778
8779
  var e = r.stack, t = e.pop();
8779
8780
  exports.DEBUG && console.log(r.step, "ABS[]", t), e.push(Math.abs(t));
8780
8781
  }
@@ -8885,7 +8886,7 @@ function $h(r) {
8885
8886
  exports.DEBUG && console.log(r.step, "ROFF[]"), r.round = El;
8886
8887
  }
8887
8888
  function Yh(r) {
8888
- exports.DEBUG && console.log(r.step, "RUTG[]"), r.round = Ll;
8889
+ exports.DEBUG && console.log(r.step, "RUTG[]"), r.round = Al;
8889
8890
  }
8890
8891
  function Zh(r) {
8891
8892
  exports.DEBUG && console.log(r.step, "RDTG[]"), r.round = Ol;
@@ -8900,11 +8901,11 @@ function ms(r, e) {
8900
8901
  var a, c;
8901
8902
  r ? (a = i.y - o.y, c = o.x - i.x) : (a = o.x - i.x, c = o.y - i.y), e.dpv = Ot(a, c);
8902
8903
  }
8903
- function Kh(r) {
8904
+ function Jh(r) {
8904
8905
  var e = r.stack, t = e.pop(), n = 0;
8905
8906
  exports.DEBUG && console.log(r.step, "GETINFO[]", t), t & 1 && (n = 35), t & 32 && (n |= 4096), e.push(n);
8906
8907
  }
8907
- function Jh(r) {
8908
+ function Kh(r) {
8908
8909
  var e = r.stack, t = e.pop(), n = e.pop(), s = e.pop();
8909
8910
  exports.DEBUG && console.log(r.step, "ROLL[]"), e.push(n), e.push(t), e.push(s);
8910
8911
  }
@@ -8963,7 +8964,7 @@ function M(r, e, t, n, s, i) {
8963
8964
  ")"
8964
8965
  ), i.rp1 = i.rp0, i.rp2 = c, e && (i.rp0 = c);
8965
8966
  }
8966
- zi = [
8967
+ Ni = [
8967
8968
  /* 0x00 */
8968
8969
  ns.bind(void 0, ke),
8969
8970
  /* 0x01 */
@@ -8995,9 +8996,9 @@ zi = [
8995
8996
  /* 0x0E */
8996
8997
  Gl,
8997
8998
  /* 0x0F */
8998
- zl,
8999
- /* 0x10 */
9000
8999
  Nl,
9000
+ /* 0x10 */
9001
+ zl,
9001
9002
  /* 0x11 */
9002
9003
  Vl,
9003
9004
  /* 0x12 */
@@ -9019,9 +9020,9 @@ zi = [
9019
9020
  /* 0x1A */
9020
9021
  Ql,
9021
9022
  /* 0x1B */
9022
- Kl,
9023
- /* 0x1C */
9024
9023
  Jl,
9024
+ /* 0x1C */
9025
+ Kl,
9025
9026
  /* 0x1D */
9026
9027
  eh,
9027
9028
  /* 0x1E */
@@ -9152,9 +9153,9 @@ zi = [
9152
9153
  /* 0x58 */
9153
9154
  Bh,
9154
9155
  /* 0x59 */
9155
- Ah,
9156
- /* 0x5A */
9157
9156
  Lh,
9157
+ /* 0x5A */
9158
+ Ah,
9158
9159
  /* 0x5B */
9159
9160
  Oh,
9160
9161
  /* 0x5C */
@@ -9172,9 +9173,9 @@ zi = [
9172
9173
  /* 0x62 */
9173
9174
  Gh,
9174
9175
  /* 0x63 */
9175
- zh,
9176
- /* 0x64 */
9177
9176
  Nh,
9177
+ /* 0x64 */
9178
+ zh,
9178
9179
  /* 0x65 */
9179
9180
  Vh,
9180
9181
  /* 0x66 */
@@ -9257,12 +9258,12 @@ zi = [
9257
9258
  /* 0x87 */
9258
9259
  ms.bind(void 0, 1),
9259
9260
  /* 0x88 */
9260
- Kh,
9261
+ Jh,
9261
9262
  /* 0x89 */
9262
9263
  void 0,
9263
9264
  // TODO IDEF
9264
9265
  /* 0x8A */
9265
- Jh,
9266
+ Kh,
9266
9267
  /* 0x8B */
9267
9268
  eu,
9268
9269
  /* 0x8C */
@@ -9507,10 +9508,10 @@ function gr(r, e, t) {
9507
9508
  function su(r, e, t) {
9508
9509
  this.contextName = r, this.openRange = null, this.ranges = [], this.checkStart = e, this.checkEnd = t;
9509
9510
  }
9510
- function pe(r, e) {
9511
+ function fe(r, e) {
9511
9512
  this.context = r, this.index = e, this.length = r.length, this.current = r[e], this.backtrack = r.slice(0, e), this.lookahead = r.slice(e + 1);
9512
9513
  }
9513
- function mn(r) {
9514
+ function gn(r) {
9514
9515
  this.eventId = r, this.subscribers = [];
9515
9516
  }
9516
9517
  function iu(r) {
@@ -9531,7 +9532,7 @@ function iu(r) {
9531
9532
  ];
9532
9533
  t.forEach(function(s) {
9533
9534
  Object.defineProperty(e.events, s, {
9534
- value: new mn(s)
9535
+ value: new gn(s)
9535
9536
  });
9536
9537
  }), r && t.forEach(function(s) {
9537
9538
  var i = r[s];
@@ -9631,16 +9632,16 @@ P.prototype.registerModifier = function(r, e, t) {
9631
9632
  }
9632
9633
  }), this.registeredModifiers.push(r);
9633
9634
  };
9634
- mn.prototype.subscribe = function(r) {
9635
+ gn.prototype.subscribe = function(r) {
9635
9636
  return typeof r == "function" ? this.subscribers.push(r) - 1 : { FAIL: "invalid '" + this.eventId + "' event handler" };
9636
9637
  };
9637
- mn.prototype.unsubscribe = function(r) {
9638
+ gn.prototype.unsubscribe = function(r) {
9638
9639
  this.subscribers.splice(r, 1);
9639
9640
  };
9640
- pe.prototype.setCurrentIndex = function(r) {
9641
+ fe.prototype.setCurrentIndex = function(r) {
9641
9642
  this.index = r, this.current = this.context[r], this.backtrack = this.context.slice(0, r), this.lookahead = this.context.slice(r + 1);
9642
9643
  };
9643
- pe.prototype.get = function(r) {
9644
+ fe.prototype.get = function(r) {
9644
9645
  switch (!0) {
9645
9646
  case r === 0:
9646
9647
  return this.current;
@@ -9673,7 +9674,7 @@ P.prototype.on = function(r, e) {
9673
9674
  };
9674
9675
  P.prototype.dispatch = function(r, e) {
9675
9676
  var t = this, n = this.events[r];
9676
- n instanceof mn && n.subscribers.forEach(function(s) {
9677
+ n instanceof gn && n.subscribers.forEach(function(s) {
9677
9678
  s.apply(t, e || []);
9678
9679
  });
9679
9680
  };
@@ -9720,7 +9721,7 @@ P.prototype.updateContextsRanges = function() {
9720
9721
  for (var r = this.tokens.map(function(n) {
9721
9722
  return n.char;
9722
9723
  }), e = 0; e < r.length; e++) {
9723
- var t = new pe(r, e);
9724
+ var t = new fe(r, e);
9724
9725
  this.runContextCheck(t);
9725
9726
  }
9726
9727
  this.dispatch("updateContextsRanges", [this.registeredContexts]);
@@ -9744,7 +9745,7 @@ P.prototype.tokenize = function(r) {
9744
9745
  var e = Array.from(r);
9745
9746
  this.dispatch("start");
9746
9747
  for (var t = 0; t < e.length; t++) {
9747
- var n = e[t], s = new pe(e, t);
9748
+ var n = e[t], s = new fe(e, t);
9748
9749
  this.dispatch("next", [s]), this.runContextCheck(s);
9749
9750
  var i = new ut(n);
9750
9751
  this.tokens.push(i), this.dispatch("newToken", [i, s]);
@@ -9760,13 +9761,13 @@ function Xi(r) {
9760
9761
  function Ue(r) {
9761
9762
  return /[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(r);
9762
9763
  }
9763
- function Kt(r) {
9764
+ function Jt(r) {
9764
9765
  return /[A-z]/.test(r);
9765
9766
  }
9766
9767
  function ou(r) {
9767
9768
  return /\s/.test(r);
9768
9769
  }
9769
- function oe(r) {
9770
+ function ae(r) {
9770
9771
  this.font = r, this.features = {};
9771
9772
  }
9772
9773
  function He(r) {
@@ -9824,7 +9825,7 @@ function lu(r, e) {
9824
9825
  return [];
9825
9826
  for (var i = r.lookahead.slice(s); i.length && Ue(i[0].char); )
9826
9827
  i.shift();
9827
- var o = new pe(i, 0), a = Bn(
9828
+ var o = new fe(i, 0), a = Bn(
9828
9829
  e.lookaheadCoverage,
9829
9830
  o
9830
9831
  ), c = [].concat(r.backtrack);
@@ -9832,7 +9833,7 @@ function lu(r, e) {
9832
9833
  c.shift();
9833
9834
  if (c.length < e.backtrackCoverage.length)
9834
9835
  return [];
9835
- var l = new pe(c, 0), h = Bn(
9836
+ var l = new fe(c, 0), h = Bn(
9836
9837
  e.backtrackCoverage,
9837
9838
  l
9838
9839
  ), d = n.length === e.inputCoverage.length && a.length === e.lookaheadCoverage.length && h.length === e.backtrackCoverage.length, u = [];
@@ -9842,7 +9843,7 @@ function lu(r, e) {
9842
9843
  var w = y.subtables[v], x = this.getLookupMethod(y, w), _ = this.getSubstitutionType(y, w);
9843
9844
  if (_ === "12")
9844
9845
  for (var S = 0; S < n.length; S++) {
9845
- var L = r.get(S), T = x(L);
9846
+ var A = r.get(S), T = x(A);
9846
9847
  T && u.push(T);
9847
9848
  }
9848
9849
  }
@@ -9868,7 +9869,7 @@ function uu(r, e) {
9868
9869
  var t = Dt(r, e.coverage);
9869
9870
  return t === -1 ? null : e.sequences[t];
9870
9871
  }
9871
- oe.prototype.getDefaultScriptFeaturesIndexes = function() {
9872
+ ae.prototype.getDefaultScriptFeaturesIndexes = function() {
9872
9873
  for (var r = this.font.tables.gsub.scripts, e = 0; e < r.length; e++) {
9873
9874
  var t = r[e];
9874
9875
  if (t.tag === "DFLT")
@@ -9876,7 +9877,7 @@ oe.prototype.getDefaultScriptFeaturesIndexes = function() {
9876
9877
  }
9877
9878
  return [];
9878
9879
  };
9879
- oe.prototype.getScriptFeaturesIndexes = function(r) {
9880
+ ae.prototype.getScriptFeaturesIndexes = function(r) {
9880
9881
  var e = this.font.tables;
9881
9882
  if (!e.gsub)
9882
9883
  return [];
@@ -9898,14 +9899,14 @@ oe.prototype.getScriptFeaturesIndexes = function(r) {
9898
9899
  }
9899
9900
  return this.getDefaultScriptFeaturesIndexes();
9900
9901
  };
9901
- oe.prototype.mapTagsToFeatures = function(r, e) {
9902
+ ae.prototype.mapTagsToFeatures = function(r, e) {
9902
9903
  for (var t = {}, n = 0; n < r.length; n++) {
9903
9904
  var s = r[n].tag, i = r[n].feature;
9904
9905
  t[s] = i;
9905
9906
  }
9906
9907
  this.features[e].tags = t;
9907
9908
  };
9908
- oe.prototype.getScriptFeatures = function(r) {
9909
+ ae.prototype.getScriptFeatures = function(r) {
9909
9910
  var e = this.features[r];
9910
9911
  if (this.features.hasOwnProperty(r))
9911
9912
  return e;
@@ -9917,11 +9918,11 @@ oe.prototype.getScriptFeatures = function(r) {
9917
9918
  return n.features[s];
9918
9919
  }), this.features[r] = e, this.mapTagsToFeatures(e, r), e;
9919
9920
  };
9920
- oe.prototype.getSubstitutionType = function(r, e) {
9921
+ ae.prototype.getSubstitutionType = function(r, e) {
9921
9922
  var t = r.lookupType.toString(), n = e.substFormat.toString();
9922
9923
  return t + n;
9923
9924
  };
9924
- oe.prototype.getLookupMethod = function(r, e) {
9925
+ ae.prototype.getLookupMethod = function(r, e) {
9925
9926
  var t = this, n = this.getSubstitutionType(r, e);
9926
9927
  switch (n) {
9927
9928
  case "11":
@@ -9965,7 +9966,7 @@ oe.prototype.getLookupMethod = function(r, e) {
9965
9966
  );
9966
9967
  }
9967
9968
  };
9968
- oe.prototype.lookupFeature = function(r) {
9969
+ ae.prototype.lookupFeature = function(r) {
9969
9970
  var e = r.contextParams, t = e.index, n = this.getFeature({
9970
9971
  tag: r.tag,
9971
9972
  script: r.script
@@ -10014,11 +10015,11 @@ oe.prototype.lookupFeature = function(r) {
10014
10015
  }));
10015
10016
  break;
10016
10017
  }
10017
- e = new pe(i, t), !(Array.isArray(p) && !p.length) && (p = null);
10018
+ e = new fe(i, t), !(Array.isArray(p) && !p.length) && (p = null);
10018
10019
  }
10019
10020
  return i.length ? i : null;
10020
10021
  };
10021
- oe.prototype.supports = function(r) {
10022
+ ae.prototype.supports = function(r) {
10022
10023
  if (!r.script)
10023
10024
  return !1;
10024
10025
  this.getScriptFeatures(r.script);
@@ -10030,17 +10031,17 @@ oe.prototype.supports = function(r) {
10030
10031
  });
10031
10032
  return e && t;
10032
10033
  };
10033
- oe.prototype.getLookupSubtables = function(r) {
10034
+ ae.prototype.getLookupSubtables = function(r) {
10034
10035
  return r.subtables || null;
10035
10036
  };
10036
- oe.prototype.getLookupByIndex = function(r) {
10037
+ ae.prototype.getLookupByIndex = function(r) {
10037
10038
  var e = this.font.tables.gsub.lookups;
10038
10039
  return e[r] || null;
10039
10040
  };
10040
- oe.prototype.getFeatureLookups = function(r) {
10041
+ ae.prototype.getFeatureLookups = function(r) {
10041
10042
  return r.lookupListIndexes.map(this.getLookupByIndex.bind(this));
10042
10043
  };
10043
- oe.prototype.getFeature = function(r) {
10044
+ ae.prototype.getFeature = function(r) {
10044
10045
  if (!this.font)
10045
10046
  return { FAIL: "No font was found" };
10046
10047
  this.features.hasOwnProperty(r.script) || this.getScriptFeatures(r.script);
@@ -10151,14 +10152,14 @@ function _u(r) {
10151
10152
  function Tu(r) {
10152
10153
  var e = this, t = "arab", n = this.featuresTags[t], s = this.tokenizer.getRangeTokens(r);
10153
10154
  if (s.length !== 1) {
10154
- var i = new pe(
10155
+ var i = new fe(
10155
10156
  s.map(
10156
10157
  function(a) {
10157
10158
  return a.getState("glyphIndex");
10158
10159
  }
10159
10160
  ),
10160
10161
  0
10161
- ), o = new pe(
10162
+ ), o = new fe(
10162
10163
  s.map(
10163
10164
  function(a) {
10164
10165
  return a.char;
@@ -10203,7 +10204,7 @@ function vs(r, e) {
10203
10204
  var t = r.map(function(n) {
10204
10205
  return n.activeState.value;
10205
10206
  });
10206
- return new pe(t, 0);
10207
+ return new fe(t, 0);
10207
10208
  }
10208
10209
  function Cu(r) {
10209
10210
  var e = this, t = "arab", n = this.tokenizer.getRangeTokens(r), s = vs(n);
@@ -10225,8 +10226,8 @@ function ku(r) {
10225
10226
  var e = r.current, t = r.get(-1);
10226
10227
  return (
10227
10228
  // ? latin first char
10228
- t === null && Kt(e) || // ? latin char preceded with a non latin char
10229
- !Kt(t) && Kt(e)
10229
+ t === null && Jt(e) || // ? latin char preceded with a non latin char
10230
+ !Jt(t) && Jt(e)
10230
10231
  );
10231
10232
  }
10232
10233
  function Iu(r) {
@@ -10234,7 +10235,7 @@ function Iu(r) {
10234
10235
  return (
10235
10236
  // ? last latin char
10236
10237
  e === null || // ? next char is not latin
10237
- !Kt(e)
10238
+ !Jt(e)
10238
10239
  );
10239
10240
  }
10240
10241
  var Mu = {
@@ -10245,7 +10246,7 @@ function bs(r, e) {
10245
10246
  var t = r.map(function(n) {
10246
10247
  return n.activeState.value;
10247
10248
  });
10248
- return new pe(t, 0);
10249
+ return new fe(t, 0);
10249
10250
  }
10250
10251
  function Eu(r) {
10251
10252
  var e = this, t = "latn", n = this.tokenizer.getRangeTokens(r), s = bs(n);
@@ -10274,7 +10275,7 @@ ye.prototype.contextChecks = {
10274
10275
  arabicWordCheck: fu,
10275
10276
  arabicSentenceCheck: yu
10276
10277
  };
10277
- function An(r) {
10278
+ function Ln(r) {
10278
10279
  var e = this.contextChecks[r + "Check"];
10279
10280
  return this.tokenizer.registerContextChecker(
10280
10281
  r,
@@ -10283,9 +10284,9 @@ function An(r) {
10283
10284
  );
10284
10285
  }
10285
10286
  function Bu() {
10286
- return An.call(this, "latinWord"), An.call(this, "arabicWord"), An.call(this, "arabicSentence"), this.tokenizer.tokenize(this.text);
10287
+ return Ln.call(this, "latinWord"), Ln.call(this, "arabicWord"), Ln.call(this, "arabicSentence"), this.tokenizer.tokenize(this.text);
10287
10288
  }
10288
- function Au() {
10289
+ function Lu() {
10289
10290
  var r = this, e = this.tokenizer.getContextRanges("arabicSentence");
10290
10291
  e.forEach(function(t) {
10291
10292
  var n = r.tokenizer.getRangeTokens(t);
@@ -10309,7 +10310,7 @@ ye.prototype.applyFeatures = function(r, e) {
10309
10310
  throw new Error(
10310
10311
  "No valid font was provided to apply features"
10311
10312
  );
10312
- this.query || (this.query = new oe(r));
10313
+ this.query || (this.query = new ae(r));
10313
10314
  for (var t = 0; t < e.length; t++) {
10314
10315
  var n = e[t];
10315
10316
  this.query.supports({ script: n.script }) && this.registerFeatures(n.script, n.tags);
@@ -10324,7 +10325,7 @@ function yr() {
10324
10325
  "glyphIndex modifier is required to apply arabic presentation features."
10325
10326
  );
10326
10327
  }
10327
- function Lu() {
10328
+ function Au() {
10328
10329
  var r = this, e = "arab";
10329
10330
  if (this.featuresTags.hasOwnProperty(e)) {
10330
10331
  yr.call(this);
@@ -10364,7 +10365,7 @@ ye.prototype.checkContextReady = function(r) {
10364
10365
  return !!this.tokenizer.getContext(r);
10365
10366
  };
10366
10367
  ye.prototype.applyFeaturesToContexts = function() {
10367
- this.checkContextReady("arabicWord") && (Lu.call(this), Ou.call(this)), this.checkContextReady("latinWord") && Du.call(this), this.checkContextReady("arabicSentence") && Au.call(this);
10368
+ this.checkContextReady("arabicWord") && (Au.call(this), Ou.call(this)), this.checkContextReady("latinWord") && Du.call(this), this.checkContextReady("arabicSentence") && Lu.call(this);
10368
10369
  };
10369
10370
  ye.prototype.processText = function(r) {
10370
10371
  (!this.text || this.text !== r) && (this.setText(r), Bu.call(this), this.applyFeaturesToContexts());
@@ -10406,7 +10407,7 @@ function D(r) {
10406
10407
  usWidthClass: r.widthClass || this.usWidthClasses.MEDIUM,
10407
10408
  fsSelection: r.fsSelection || this.fsSelectionValues.REGULAR
10408
10409
  }, r.tables.os2)
10409
- })), this.supported = !0, this.glyphs = new Ce.GlyphSet(this, r.glyphs || []), this.encoding = new ui(this), this.position = new At(this), this.substitution = new ie(this), this.tables = this.tables || {}, this._push = null, this._hmtxTableData = {}, Object.defineProperty(this, "hinting", {
10410
+ })), this.supported = !0, this.glyphs = new Ce.GlyphSet(this, r.glyphs || []), this.encoding = new ui(this), this.position = new Lt(this), this.substitution = new oe(this), this.tables = this.tables || {}, this._push = null, this._hmtxTableData = {}, Object.defineProperty(this, "hinting", {
10410
10411
  get: function() {
10411
10412
  if (this._hinting)
10412
10413
  return this._hinting;
@@ -10670,7 +10671,7 @@ function Gu(r, e) {
10670
10671
  t.fields = t.fields.concat(Uu(s, r.instances[s], r.axes, e));
10671
10672
  return t;
10672
10673
  }
10673
- function zu(r, e, t) {
10674
+ function Nu(r, e, t) {
10674
10675
  var n = new E.Parser(r, e), s = n.parseULong();
10675
10676
  B.argument(s === 65536, "Unsupported fvar table version.");
10676
10677
  var i = n.parseOffset16();
@@ -10681,7 +10682,7 @@ function zu(r, e, t) {
10681
10682
  u.push(Pu(r, p + f * l, h, t));
10682
10683
  return { axes: h, instances: u };
10683
10684
  }
10684
- var Nu = { make: Gu, parse: zu }, Vu = function() {
10685
+ var zu = { make: Gu, parse: Nu }, Vu = function() {
10685
10686
  return {
10686
10687
  coverage: this.parsePointer(b.coverage),
10687
10688
  attachPoints: this.parseList(b.pointer(b.uShortList))
@@ -10723,8 +10724,8 @@ function qu(r, e) {
10723
10724
  };
10724
10725
  return n >= 1.2 && (s.markGlyphSets = t.parsePointer(Xu)), s;
10725
10726
  }
10726
- var $u = { parse: qu }, fe = new Array(10);
10727
- fe[1] = function() {
10727
+ var $u = { parse: qu }, ge = new Array(10);
10728
+ ge[1] = function() {
10728
10729
  var r = this.offset + this.relativeOffset, e = this.parseUShort();
10729
10730
  if (e === 1)
10730
10731
  return {
@@ -10740,7 +10741,7 @@ fe[1] = function() {
10740
10741
  };
10741
10742
  B.assert(!1, "0x" + r.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
10742
10743
  };
10743
- fe[2] = function() {
10744
+ ge[2] = function() {
10744
10745
  var r = this.offset + this.relativeOffset, e = this.parseUShort();
10745
10746
  B.assert(e === 1 || e === 2, "0x" + r.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
10746
10747
  var t = this.parsePointer(b.coverage), n = this.parseUShort(), s = this.parseUShort();
@@ -10780,25 +10781,25 @@ fe[2] = function() {
10780
10781
  };
10781
10782
  }
10782
10783
  };
10783
- fe[3] = function() {
10784
+ ge[3] = function() {
10784
10785
  return { error: "GPOS Lookup 3 not supported" };
10785
10786
  };
10786
- fe[4] = function() {
10787
+ ge[4] = function() {
10787
10788
  return { error: "GPOS Lookup 4 not supported" };
10788
10789
  };
10789
- fe[5] = function() {
10790
+ ge[5] = function() {
10790
10791
  return { error: "GPOS Lookup 5 not supported" };
10791
10792
  };
10792
- fe[6] = function() {
10793
+ ge[6] = function() {
10793
10794
  return { error: "GPOS Lookup 6 not supported" };
10794
10795
  };
10795
- fe[7] = function() {
10796
+ ge[7] = function() {
10796
10797
  return { error: "GPOS Lookup 7 not supported" };
10797
10798
  };
10798
- fe[8] = function() {
10799
+ ge[8] = function() {
10799
10800
  return { error: "GPOS Lookup 8 not supported" };
10800
10801
  };
10801
- fe[9] = function() {
10802
+ ge[9] = function() {
10802
10803
  return { error: "GPOS Lookup 9 not supported" };
10803
10804
  };
10804
10805
  function Yu(r, e) {
@@ -10808,12 +10809,12 @@ function Yu(r, e) {
10808
10809
  version: n,
10809
10810
  scripts: t.parseScriptList(),
10810
10811
  features: t.parseFeatureList(),
10811
- lookups: t.parseLookupList(fe)
10812
+ lookups: t.parseLookupList(ge)
10812
10813
  } : {
10813
10814
  version: n,
10814
10815
  scripts: t.parseScriptList(),
10815
10816
  features: t.parseFeatureList(),
10816
- lookups: t.parseLookupList(fe),
10817
+ lookups: t.parseLookupList(ge),
10817
10818
  variations: t.parseFeatureVariationsList()
10818
10819
  };
10819
10820
  }
@@ -10826,8 +10827,8 @@ function Qu(r) {
10826
10827
  { name: "lookups", type: "TABLE", value: new I.LookupList(r.lookups, Zu) }
10827
10828
  ]);
10828
10829
  }
10829
- var Ku = { parse: Yu, make: Qu };
10830
- function Ju(r) {
10830
+ var Ju = { parse: Yu, make: Qu };
10831
+ function Ku(r) {
10831
10832
  var e = {};
10832
10833
  r.skip("uShort");
10833
10834
  var t = r.parseUShort();
@@ -10859,7 +10860,7 @@ function ed(r) {
10859
10860
  function td(r, e) {
10860
10861
  var t = new E.Parser(r, e), n = t.parseUShort();
10861
10862
  if (n === 0)
10862
- return Ju(t);
10863
+ return Ku(t);
10863
10864
  if (n === 1)
10864
10865
  return ed(t);
10865
10866
  throw new Error("Unsupported kern table version (" + n + ").");
@@ -10893,10 +10894,10 @@ function id(r, e) {
10893
10894
  }
10894
10895
  return t;
10895
10896
  }
10896
- function N(r, e) {
10897
+ function z(r, e) {
10897
10898
  if (e.compression === "WOFF") {
10898
10899
  var t = new Uint8Array(r.buffer, e.offset + 2, e.compressedLength - 2), n = new Uint8Array(e.length);
10899
- if (Ka(t, n), n.byteLength !== e.length)
10900
+ if (Ja(t, n), n.byteLength !== e.length)
10900
10901
  throw new Error("Decompression error: " + e.tag + " decompressed length doesn't match recorded length");
10901
10902
  var s = new DataView(n.buffer, 0);
10902
10903
  return { data: s, offset: 0 };
@@ -10921,47 +10922,47 @@ function od(r, e) {
10921
10922
  o = E.getUShort(i, 12), a = id(i, o);
10922
10923
  } else
10923
10924
  throw new Error("Unsupported OpenType signature " + c);
10924
- for (var h, d, u, p, f, m, y, v, w, x, _, S, L = 0; L < o; L += 1) {
10925
- var T = a[L], k = void 0;
10925
+ for (var h, d, u, p, f, m, y, v, w, x, _, S, A = 0; A < o; A += 1) {
10926
+ var T = a[A], k = void 0;
10926
10927
  switch (T.tag) {
10927
10928
  case "cmap":
10928
- k = N(i, T), s.tables.cmap = hi.parse(k.data, k.offset), s.encoding = new di(s.tables.cmap);
10929
+ k = z(i, T), s.tables.cmap = hi.parse(k.data, k.offset), s.encoding = new di(s.tables.cmap);
10929
10930
  break;
10930
10931
  case "cvt ":
10931
- k = N(i, T), S = new E.Parser(k.data, k.offset), s.tables.cvt = S.parseShortList(T.length / 2);
10932
+ k = z(i, T), S = new E.Parser(k.data, k.offset), s.tables.cvt = S.parseShortList(T.length / 2);
10932
10933
  break;
10933
10934
  case "fvar":
10934
10935
  d = T;
10935
10936
  break;
10936
10937
  case "fpgm":
10937
- k = N(i, T), S = new E.Parser(k.data, k.offset), s.tables.fpgm = S.parseByteList(T.length);
10938
+ k = z(i, T), S = new E.Parser(k.data, k.offset), s.tables.fpgm = S.parseByteList(T.length);
10938
10939
  break;
10939
10940
  case "head":
10940
- k = N(i, T), s.tables.head = Si.parse(k.data, k.offset), s.unitsPerEm = s.tables.head.unitsPerEm, t = s.tables.head.indexToLocFormat;
10941
+ k = z(i, T), s.tables.head = Si.parse(k.data, k.offset), s.unitsPerEm = s.tables.head.unitsPerEm, t = s.tables.head.indexToLocFormat;
10941
10942
  break;
10942
10943
  case "hhea":
10943
- k = N(i, T), s.tables.hhea = _i.parse(k.data, k.offset), s.ascender = s.tables.hhea.ascender, s.descender = s.tables.hhea.descender, s.numberOfHMetrics = s.tables.hhea.numberOfHMetrics;
10944
+ k = z(i, T), s.tables.hhea = _i.parse(k.data, k.offset), s.ascender = s.tables.hhea.ascender, s.descender = s.tables.hhea.descender, s.numberOfHMetrics = s.tables.hhea.numberOfHMetrics;
10944
10945
  break;
10945
10946
  case "hmtx":
10946
10947
  y = T;
10947
10948
  break;
10948
10949
  case "ltag":
10949
- k = N(i, T), n = Ci.parse(k.data, k.offset);
10950
+ k = z(i, T), n = Ci.parse(k.data, k.offset);
10950
10951
  break;
10951
10952
  case "maxp":
10952
- k = N(i, T), s.tables.maxp = ki.parse(k.data, k.offset), s.numGlyphs = s.tables.maxp.numGlyphs;
10953
+ k = z(i, T), s.tables.maxp = ki.parse(k.data, k.offset), s.numGlyphs = s.tables.maxp.numGlyphs;
10953
10954
  break;
10954
10955
  case "name":
10955
10956
  x = T;
10956
10957
  break;
10957
10958
  case "OS/2":
10958
- k = N(i, T), s.tables.os2 = rr.parse(k.data, k.offset);
10959
+ k = z(i, T), s.tables.os2 = rr.parse(k.data, k.offset);
10959
10960
  break;
10960
10961
  case "post":
10961
- k = N(i, T), s.tables.post = Li.parse(k.data, k.offset), s.glyphNames = new ur(s.tables.post);
10962
+ k = z(i, T), s.tables.post = Ai.parse(k.data, k.offset), s.glyphNames = new ur(s.tables.post);
10962
10963
  break;
10963
10964
  case "prep":
10964
- k = N(i, T), S = new E.Parser(k.data, k.offset), s.tables.prep = S.parseByteList(T.length);
10965
+ k = z(i, T), S = new E.Parser(k.data, k.offset), s.tables.prep = S.parseByteList(T.length);
10965
10966
  break;
10966
10967
  case "glyf":
10967
10968
  u = T;
@@ -10989,39 +10990,39 @@ function od(r, e) {
10989
10990
  break;
10990
10991
  }
10991
10992
  }
10992
- var O = N(i, x);
10993
- if (s.tables.name = Ai.parse(O.data, O.offset, n), s.names = s.tables.name, u && w) {
10994
- var G = t === 0, Q = N(i, w), te = sd.parse(Q.data, Q.offset, s.numGlyphs, G), $ = N(i, u);
10993
+ var O = z(i, x);
10994
+ if (s.tables.name = Li.parse(O.data, O.offset, n), s.names = s.tables.name, u && w) {
10995
+ var G = t === 0, Q = z(i, w), te = sd.parse(Q.data, Q.offset, s.numGlyphs, G), $ = z(i, u);
10995
10996
  s.glyphs = Gi.parse($.data, $.offset, te, s, e);
10996
10997
  } else if (h) {
10997
- var F = N(i, h);
10998
+ var F = z(i, h);
10998
10999
  wi.parse(F.data, F.offset, s, e);
10999
11000
  } else
11000
11001
  throw new Error("Font doesn't contain TrueType or CFF outlines.");
11001
- var z = N(i, y);
11002
- if (Ti.parse(s, z.data, z.offset, s.numberOfHMetrics, s.numGlyphs, s.glyphs, e), bc(s, e), v) {
11003
- var U = N(i, v);
11002
+ var N = z(i, y);
11003
+ if (Ti.parse(s, N.data, N.offset, s.numberOfHMetrics, s.numGlyphs, s.glyphs, e), bc(s, e), v) {
11004
+ var U = z(i, v);
11004
11005
  s.kerningPairs = nd.parse(U.data, U.offset);
11005
11006
  } else
11006
11007
  s.kerningPairs = {};
11007
11008
  if (p) {
11008
- var W = N(i, p);
11009
+ var W = z(i, p);
11009
11010
  s.tables.gdef = $u.parse(W.data, W.offset);
11010
11011
  }
11011
11012
  if (f) {
11012
- var Y = N(i, f);
11013
- s.tables.gpos = Ku.parse(Y.data, Y.offset), s.position.init();
11013
+ var Y = z(i, f);
11014
+ s.tables.gpos = Ju.parse(Y.data, Y.offset), s.position.init();
11014
11015
  }
11015
11016
  if (m) {
11016
- var X = N(i, m);
11017
+ var X = z(i, m);
11017
11018
  s.tables.gsub = Oi.parse(X.data, X.offset);
11018
11019
  }
11019
11020
  if (d) {
11020
- var K = N(i, d);
11021
- s.tables.fvar = Nu.parse(K.data, K.offset, s.names);
11021
+ var J = z(i, d);
11022
+ s.tables.fvar = zu.parse(J.data, J.offset, s.names);
11022
11023
  }
11023
11024
  if (_) {
11024
- var R = N(i, _);
11025
+ var R = z(i, _);
11025
11026
  s.tables.meta = Di.parse(R.data, R.offset), s.metas = s.tables.meta;
11026
11027
  }
11027
11028
  return s;
@@ -11185,8 +11186,8 @@ function ld(r, e = 1e-4) {
11185
11186
  S.itemSize,
11186
11187
  S.normalized
11187
11188
  );
11188
- const L = r.morphAttributes[_];
11189
- L && (l[_] || (l[_] = []), L.forEach((T, k) => {
11189
+ const A = r.morphAttributes[_];
11190
+ A && (l[_] || (l[_] = []), A.forEach((T, k) => {
11190
11191
  const O = new T.array.constructor(T.count * T.itemSize);
11191
11192
  l[_][k] = new T.constructor(O, T.itemSize, T.normalized);
11192
11193
  }));
@@ -11195,7 +11196,7 @@ function ld(r, e = 1e-4) {
11195
11196
  for (let w = 0; w < i; w++) {
11196
11197
  const x = n ? n.getX(w) : w;
11197
11198
  let _ = "";
11198
- for (let S = 0, L = a.length; S < L; S++) {
11199
+ for (let S = 0, A = a.length; S < A; S++) {
11199
11200
  const T = a[S], k = r.getAttribute(T), O = k.itemSize;
11200
11201
  for (let G = 0; G < O; G++)
11201
11202
  _ += `${~~(k[d[G]](x) * m + y)},`;
@@ -11203,13 +11204,13 @@ function ld(r, e = 1e-4) {
11203
11204
  if (_ in t)
11204
11205
  h.push(t[_]);
11205
11206
  else {
11206
- for (let S = 0, L = a.length; S < L; S++) {
11207
+ for (let S = 0, A = a.length; S < A; S++) {
11207
11208
  const T = a[S], k = r.getAttribute(T), O = r.morphAttributes[T], G = k.itemSize, Q = c[T], te = l[T];
11208
11209
  for (let $ = 0; $ < G; $++) {
11209
- const F = d[$], z = u[$];
11210
- if (Q[z](o, k[F](x)), O)
11210
+ const F = d[$], N = u[$];
11211
+ if (Q[N](o, k[F](x)), O)
11211
11212
  for (let U = 0, W = O.length; U < W; U++)
11212
- te[U][z](o, O[U][F](x));
11213
+ te[U][N](o, O[U][F](x));
11213
11214
  }
11214
11215
  }
11215
11216
  t[_] = o, h.push(o), o++;
@@ -11282,8 +11283,8 @@ const $i = class {
11282
11283
  };
11283
11284
  $i.originalComputeVertexNormals = tn.prototype.computeVertexNormals;
11284
11285
  let hd = $i;
11285
- const ze = new g.Vector2();
11286
- class _s extends Ks {
11286
+ const Ne = new g.Vector2();
11287
+ class _s extends Js {
11287
11288
  constructor(e, t, n) {
11288
11289
  super(e), this.isFound = !1, this.fontSize = t, this.font = n, this.width = this.getCharWidth(e, t, n);
11289
11290
  }
@@ -11305,8 +11306,8 @@ class _s extends Ks {
11305
11306
  // Pass dummy uv generator to save computation cost because rendering font characters
11306
11307
  // always use color material and don't need 'uv' data.
11307
11308
  UVGenerator: {
11308
- generateTopUV: () => [ze, ze, ze],
11309
- generateSideWallUV: () => [ze, ze, ze, ze]
11309
+ generateTopUV: () => [Ne, Ne, Ne],
11310
+ generateSideWallUV: () => [Ne, Ne, Ne, Ne]
11310
11311
  }
11311
11312
  });
11312
11313
  return t.hasAttribute("uv") && t.deleteAttribute("uv"), t.hasAttribute("normal") && t.deleteAttribute("normal"), ld(t, 1e-6);
@@ -11380,7 +11381,7 @@ class Ts extends Qs {
11380
11381
  return new _s("?", e, this);
11381
11382
  }
11382
11383
  }
11383
- let re = class {
11384
+ let se = class {
11384
11385
  /**
11385
11386
  * Converts an unsigned byte to a signed byte as used in SHX format.
11386
11387
  * Values > 127 are converted to their signed equivalent (-128 to -1).
@@ -11536,11 +11537,11 @@ let re = class {
11536
11537
  );
11537
11538
  }
11538
11539
  };
11539
- var se = /* @__PURE__ */ ((r) => (r.SHAPES = "shapes", r.BIGFONT = "bigfont", r.UNIFONT = "unifont", r))(se || {});
11540
+ var ie = /* @__PURE__ */ ((r) => (r.SHAPES = "shapes", r.BIGFONT = "bigfont", r.UNIFONT = "unifont", r))(ie || {});
11540
11541
  let ud = class {
11541
11542
  parse(r) {
11542
11543
  const e = this.parseHeader(r).split(" "), t = e[1].toLocaleLowerCase();
11543
- if (!Object.values(se).includes(t))
11544
+ if (!Object.values(ie).includes(t))
11544
11545
  throw new Error(`Invalid font type: ${t}`);
11545
11546
  return {
11546
11547
  fileHeader: e[0],
@@ -11758,11 +11759,11 @@ class fd {
11758
11759
  class gd {
11759
11760
  static createParser(e) {
11760
11761
  switch (e) {
11761
- case se.SHAPES:
11762
+ case ie.SHAPES:
11762
11763
  return new dd();
11763
- case se.BIGFONT:
11764
+ case ie.BIGFONT:
11764
11765
  return new pd();
11765
- case se.UNIFONT:
11766
+ case ie.UNIFONT:
11766
11767
  return new fd();
11767
11768
  default:
11768
11769
  throw new Error(`Unsupported font type: ${e}`);
@@ -11952,7 +11953,7 @@ let ks = class ir {
11952
11953
  )
11953
11954
  ), t;
11954
11955
  }
11955
- }, Ln = class Yi {
11956
+ }, An = class Yi {
11956
11957
  constructor(e, t = []) {
11957
11958
  this.lastPoint = e, this.polylines = t;
11958
11959
  }
@@ -12041,7 +12042,7 @@ let yd = class {
12041
12042
  }
12042
12043
  if (this.shapeData.has(r)) {
12043
12044
  const o = e / Is, a = this.shapeData.get(r);
12044
- i = new Ln(
12045
+ i = new An(
12045
12046
  (t = a.lastPoint) == null ? void 0 : t.clone().multiply(o),
12046
12047
  a.polylines.map((c) => c.map((l) => l.clone().multiply(o)))
12047
12048
  );
@@ -12067,7 +12068,7 @@ let yd = class {
12067
12068
  const s = r[n];
12068
12069
  s <= 15 ? n = this.handleSpecialCommand(s, r, n, t) : this.handleVectorCommand(s, t);
12069
12070
  }
12070
- return new Ln(t.currentPoint, t.polylines);
12071
+ return new An(t.currentPoint, t.polylines);
12071
12072
  }
12072
12073
  /**
12073
12074
  * Please refer to special codes reference in the following link for more information.
@@ -12199,13 +12200,13 @@ let yd = class {
12199
12200
  let n = e, s = 0, i, o = t.scale * this.fontData.content.baseUp, a = o;
12200
12201
  const c = t.currentPoint.clone();
12201
12202
  switch (t.currentPolyline.length > 1 && (t.polylines.push(t.currentPolyline.slice()), t.currentPolyline = []), this.fontData.header.fontType) {
12202
- case se.SHAPES:
12203
+ case ie.SHAPES:
12203
12204
  n++, s = r[n];
12204
12205
  break;
12205
- case se.BIGFONT:
12206
+ case ie.BIGFONT:
12206
12207
  n++, s = r[n], s === 0 && (n++, s = r[n++] | r[n++] << 8, c.x = r[n++] * t.scale, c.y = r[n++] * t.scale, this.fontData.content.isExtended && (a = r[n++] * t.scale), o = r[n] * t.scale);
12207
12208
  break;
12208
- case se.UNIFONT:
12209
+ case ie.UNIFONT:
12209
12210
  n++, s = r[n++] << 8 | r[n++];
12210
12211
  break;
12211
12212
  }
@@ -12214,13 +12215,13 @@ let yd = class {
12214
12215
  handleXYDisplacement(r, e, t) {
12215
12216
  let n = e;
12216
12217
  const s = new V();
12217
- return s.x = re.byteToSByte(r[++n]), s.y = re.byteToSByte(r[++n]), t.currentPoint.add(s.multiply(t.scale)), t.isPenDown && t.currentPolyline.push(t.currentPoint.clone()), n;
12218
+ return s.x = se.byteToSByte(r[++n]), s.y = se.byteToSByte(r[++n]), t.currentPoint.add(s.multiply(t.scale)), t.isPenDown && t.currentPolyline.push(t.currentPoint.clone()), n;
12218
12219
  }
12219
12220
  handleMultipleXYDisplacements(r, e, t) {
12220
12221
  let n = e;
12221
12222
  for (; ; ) {
12222
12223
  const s = new V();
12223
- if (s.x = re.byteToSByte(r[++n]), s.y = re.byteToSByte(r[++n]), s.x === 0 && s.y === 0)
12224
+ if (s.x = se.byteToSByte(r[++n]), s.y = se.byteToSByte(r[++n]), s.x === 0 && s.y === 0)
12224
12225
  break;
12225
12226
  t.currentPoint.add(s.multiply(t.scale)), t.isPenDown && t.currentPolyline.push(t.currentPoint.clone());
12226
12227
  }
@@ -12229,7 +12230,7 @@ let yd = class {
12229
12230
  handleOctantArc(r, e, t) {
12230
12231
  var n;
12231
12232
  let s = e;
12232
- const i = r[++s] * t.scale, o = re.byteToSByte(r[++s]), a = (o & 112) >> 4;
12233
+ const i = r[++s] * t.scale, o = se.byteToSByte(r[++s]), a = (o & 112) >> 4;
12233
12234
  let c = o & 7;
12234
12235
  const l = o < 0, h = Math.PI / 4 * a, d = t.currentPoint.clone().subtract(new V(Math.cos(h) * i, Math.sin(h) * i)), u = ks.fromOctant(d, i, a, c, l);
12235
12236
  if (t.isPenDown) {
@@ -12240,7 +12241,7 @@ let yd = class {
12240
12241
  }
12241
12242
  handleFractionalArc(r, e, t) {
12242
12243
  let n = e;
12243
- const s = r[++n], i = r[++n], o = r[++n], a = r[++n], c = (o * 255 + a) * t.scale, l = re.byteToSByte(r[++n]), h = (l & 112) >> 4;
12244
+ const s = r[++n], i = r[++n], o = r[++n], a = r[++n], c = (o * 255 + a) * t.scale, l = se.byteToSByte(r[++n]), h = (l & 112) >> 4;
12244
12245
  let d = l & 7;
12245
12246
  d === 0 && (d = 8), i !== 0 && d--;
12246
12247
  const u = Math.PI / 4;
@@ -12271,8 +12272,8 @@ let yd = class {
12271
12272
  handleBulgeArc(r, e, t) {
12272
12273
  let n = e;
12273
12274
  const s = new V();
12274
- s.x = re.byteToSByte(r[++n]), s.y = re.byteToSByte(r[++n]);
12275
- const i = re.byteToSByte(r[++n]);
12275
+ s.x = se.byteToSByte(r[++n]), s.y = se.byteToSByte(r[++n]);
12276
+ const i = se.byteToSByte(r[++n]);
12276
12277
  return t.currentPoint = this.handleArcSegment(
12277
12278
  t.currentPoint,
12278
12279
  s,
@@ -12286,9 +12287,9 @@ let yd = class {
12286
12287
  let n = e;
12287
12288
  for (; ; ) {
12288
12289
  const s = new V();
12289
- if (s.x = re.byteToSByte(r[++n]), s.y = re.byteToSByte(r[++n]), s.x === 0 && s.y === 0)
12290
+ if (s.x = se.byteToSByte(r[++n]), s.y = se.byteToSByte(r[++n]), s.x === 0 && s.y === 0)
12290
12291
  break;
12291
- const i = re.byteToSByte(r[++n]);
12292
+ const i = se.byteToSByte(r[++n]);
12292
12293
  t.currentPoint = this.handleArcSegment(
12293
12294
  t.currentPoint,
12294
12295
  s,
@@ -12318,13 +12319,13 @@ let yd = class {
12318
12319
  break;
12319
12320
  case 7:
12320
12321
  switch (this.fontData.header.fontType) {
12321
- case se.SHAPES:
12322
+ case ie.SHAPES:
12322
12323
  e++;
12323
12324
  break;
12324
- case se.BIGFONT:
12325
+ case ie.BIGFONT:
12325
12326
  e++, r[e] === 0 && (e += 5);
12326
12327
  break;
12327
- case se.UNIFONT:
12328
+ case ie.UNIFONT:
12328
12329
  e += 2;
12329
12330
  break;
12330
12331
  }
@@ -12369,7 +12370,7 @@ let yd = class {
12369
12370
  const o = (s = i.lastPoint) == null ? void 0 : s.clone();
12370
12371
  o && (o.x *= e / t);
12371
12372
  const a = i.polylines.map((c) => c.map((l) => l.clone()));
12372
- return a.forEach((c) => c.forEach((l) => l.x *= e / t)), new Ln(
12373
+ return a.forEach((c) => c.forEach((l) => l.x *= e / t)), new An(
12373
12374
  o == null ? void 0 : o.add(n),
12374
12375
  a.map((c) => c.map((l) => l.add(n)))
12375
12376
  );
@@ -12407,7 +12408,7 @@ class vd {
12407
12408
  */
12408
12409
  constructor(e) {
12409
12410
  if (e instanceof ArrayBuffer) {
12410
- const t = new re(e), n = new ud().parse(t), s = gd.createParser(n.fontType).parse(t);
12411
+ const t = new se(e), n = new ud().parse(t), s = gd.createParser(n.fontType).parse(t);
12411
12412
  this.fontData = {
12412
12413
  header: n,
12413
12414
  content: s
@@ -12441,7 +12442,7 @@ class vd {
12441
12442
  this.shapeParser.release();
12442
12443
  }
12443
12444
  }
12444
- class vr extends Ks {
12445
+ class vr extends Js {
12445
12446
  /**
12446
12447
  * Creates a new instance of ShxTextShape
12447
12448
  * @param char - The character this shape represents
@@ -12539,18 +12540,18 @@ class Ms extends Qs {
12539
12540
  * For an unsupported char, use "?" as a replacement.
12540
12541
  */
12541
12542
  getNotFoundTextShape(e) {
12542
- const t = this.font.fontData.header.fontType === se.BIGFONT ? "?" : "?";
12543
+ const t = this.font.fontData.header.fontType === ie.BIGFONT ? "?" : "?";
12543
12544
  return this.getCharShape(t, e);
12544
12545
  }
12545
12546
  getCode(e) {
12546
- if (this.font.fontData.header.fontType === se.BIGFONT)
12547
+ if (this.font.fontData.header.fontType === ie.BIGFONT)
12547
12548
  throw new Error(
12548
12549
  `Can't get font glyph for '${e}' because big font is not supported yet!`
12549
12550
  );
12550
12551
  return e.charCodeAt(0);
12551
12552
  }
12552
12553
  }
12553
- class Le {
12554
+ class Ae {
12554
12555
  constructor() {
12555
12556
  }
12556
12557
  /**
@@ -12558,7 +12559,7 @@ class Le {
12558
12559
  * @returns The FontFactory instance
12559
12560
  */
12560
12561
  static get instance() {
12561
- return Le._instance || (Le._instance = new Le()), Le._instance;
12562
+ return Ae._instance || (Ae._instance = new Ae()), Ae._instance;
12562
12563
  }
12563
12564
  /**
12564
12565
  * Creates a font instance based on the provided font data.
@@ -12790,10 +12791,10 @@ class ee {
12790
12791
  throw new Error(`Invalid font url: ${e}`);
12791
12792
  const n = Rr(e).toLowerCase(), s = await Sn.instance.get(n);
12792
12793
  if (s) {
12793
- const i = Le.instance.createFont(s);
12794
+ const i = Ae.instance.createFont(s);
12794
12795
  this.fontMap.set(n, i);
12795
12796
  } else {
12796
- const i = await this.loader.loadAsync(e), o = Le.instance.createFontFromBuffer(t, i);
12797
+ const i = await this.loader.loadAsync(e), o = Ae.instance.createFontFromBuffer(t, i);
12797
12798
  o && (this.fontMap.set(n, o), this.enableFontCache && await Sn.instance.set(n, {
12798
12799
  name: n,
12799
12800
  type: o.type,
@@ -12815,7 +12816,7 @@ class ee {
12815
12816
  const { name: n } = t;
12816
12817
  if (this.fileNames && !this.fileNames.includes(n))
12817
12818
  continue;
12818
- const s = Le.instance.createFont(t);
12819
+ const s = Ae.instance.createFont(t);
12819
12820
  this.fontMap.set(n, s);
12820
12821
  }
12821
12822
  }
@@ -12916,7 +12917,7 @@ class bd {
12916
12917
  });
12917
12918
  }
12918
12919
  }
12919
- var rt = /* @__PURE__ */ ((r) => (r[r.NONE = 0] = "NONE", r[r.WORD = 1] = "WORD", r[r.STACK = 2] = "STACK", r[r.SPACE = 3] = "SPACE", r[r.NBSP = 4] = "NBSP", r[r.TABULATOR = 5] = "TABULATOR", r[r.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", r[r.NEW_COLUMN = 7] = "NEW_COLUMN", r[r.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", r[r.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", r))(rt || {}), yt = /* @__PURE__ */ ((r) => (r[r.BOTTOM = 0] = "BOTTOM", r[r.MIDDLE = 1] = "MIDDLE", r[r.TOP = 2] = "TOP", r))(yt || {}), he = /* @__PURE__ */ ((r) => (r[r.DEFAULT = 0] = "DEFAULT", r[r.LEFT = 1] = "LEFT", r[r.RIGHT = 2] = "RIGHT", r[r.CENTER = 3] = "CENTER", r[r.JUSTIFIED = 4] = "JUSTIFIED", r[r.DISTRIBUTED = 5] = "DISTRIBUTED", r))(he || {});
12920
+ var rt = /* @__PURE__ */ ((r) => (r[r.NONE = 0] = "NONE", r[r.WORD = 1] = "WORD", r[r.STACK = 2] = "STACK", r[r.SPACE = 3] = "SPACE", r[r.NBSP = 4] = "NBSP", r[r.TABULATOR = 5] = "TABULATOR", r[r.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", r[r.NEW_COLUMN = 7] = "NEW_COLUMN", r[r.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", r[r.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", r))(rt || {}), yt = /* @__PURE__ */ ((r) => (r[r.BOTTOM = 0] = "BOTTOM", r[r.MIDDLE = 1] = "MIDDLE", r[r.TOP = 2] = "TOP", r))(yt || {}), ue = /* @__PURE__ */ ((r) => (r[r.DEFAULT = 0] = "DEFAULT", r[r.LEFT = 1] = "LEFT", r[r.RIGHT = 2] = "RIGHT", r[r.CENTER = 3] = "CENTER", r[r.JUSTIFIED = 4] = "JUSTIFIED", r[r.DISTRIBUTED = 5] = "DISTRIBUTED", r))(ue || {});
12920
12921
  const xd = {
12921
12922
  c: "Ø",
12922
12923
  d: "°",
@@ -13970,7 +13971,7 @@ class xr extends Rt {
13970
13971
  * @returns The color as a hex number (0xRRGGBB)
13971
13972
  */
13972
13973
  getColorAsHex() {
13973
- return this.color.isRgb && this.color.rgbValue !== null ? this.color.rgbValue : this.color.isAci && this.color.aci !== null ? Na(this.color.aci) : 16777215;
13974
+ return this.color.isRgb && this.color.rgbValue !== null ? this.color.rgbValue : this.color.isAci && this.color.aci !== null ? za(this.color.aci) : 16777215;
13974
13975
  }
13975
13976
  /**
13976
13977
  * Set the color using a hex value for rendering purposes.
@@ -14253,7 +14254,7 @@ class Id {
14253
14254
  let s = 0;
14254
14255
  for (let i = 0; i < e.length; i++) {
14255
14256
  const o = this.getCharShape(e[i]);
14256
- o ? this.currentHorizontalAlignment == he.DISTRIBUTED ? s += o.width * this.currentWidthFactor : s += o.width * this.currentWordSpace * this.currentWidthFactor : s += this._currentContext.blankWidth;
14257
+ o ? this.currentHorizontalAlignment == ue.DISTRIBUTED ? s += o.width * this.currentWidthFactor : s += o.width * this.currentWordSpace * this.currentWidthFactor : s += this._currentContext.blankWidth;
14257
14258
  }
14258
14259
  this.hOffset + s > (this.maxLineWidth || 1 / 0) && this.startNewLine();
14259
14260
  for (let i = 0; i < e.length; i++)
@@ -14316,7 +14317,7 @@ class Id {
14316
14317
  _
14317
14318
  );
14318
14319
  if (t.push(...x), n.push(..._), o === "/" || o === "#") {
14319
- const S = new g.BufferGeometry(), L = new Float32Array([
14320
+ const S = new g.BufferGeometry(), A = new Float32Array([
14320
14321
  a,
14321
14322
  c - this.currentFontSize * 0.8,
14322
14323
  0,
@@ -14326,7 +14327,7 @@ class Id {
14326
14327
  ]);
14327
14328
  S.setAttribute(
14328
14329
  "position",
14329
- new g.BufferAttribute(L, 3)
14330
+ new g.BufferAttribute(A, 3)
14330
14331
  ), S.setIndex(null), n.push(S);
14331
14332
  }
14332
14333
  this._hOffset = a + f;
@@ -14372,7 +14373,7 @@ class Id {
14372
14373
  const a = this.fontManager.getFontType(this.currentFont);
14373
14374
  this._currentContext.bold && a === "mesh" && i.scale(1.06, 1.06, 1), this.hOffset > (this.maxLineWidth || 1 / 0) && this.startNewLine();
14374
14375
  const c = this.hOffset, l = this.flowDirection == It.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentFontSize, h = s.width * this.currentWidthFactor, d = this.currentFontSize;
14375
- i.translate(c, l, 0), this.currentHorizontalAlignment == he.DISTRIBUTED ? this._hOffset += s.width * this.currentWidthFactor : this._hOffset += s.width * this.currentWordSpace * this.currentWidthFactor, t.push(i);
14376
+ i.translate(c, l, 0), this.currentHorizontalAlignment == ue.DISTRIBUTED ? this._hOffset += s.width * this.currentWidthFactor : this._hOffset += s.width * this.currentWordSpace * this.currentWidthFactor, t.push(i);
14376
14377
  const u = d * 0.05, p = 1e-3;
14377
14378
  if (this._currentContext.underline) {
14378
14379
  const f = new g.BufferGeometry(), m = l - u;
@@ -14485,12 +14486,12 @@ class Id {
14485
14486
  }), t) {
14486
14487
  const n = t.getSize(Cd);
14487
14488
  switch (this.currentHorizontalAlignment) {
14488
- case he.LEFT:
14489
+ case ue.LEFT:
14489
14490
  e.forEach(
14490
14491
  (s) => s.translate(this._currentLeftMargin - t.min.x, 0, 0)
14491
14492
  );
14492
14493
  break;
14493
- case he.CENTER:
14494
+ case ue.CENTER:
14494
14495
  e.forEach(
14495
14496
  (s) => s.translate(
14496
14497
  this._currentLeftMargin + (this.maxLineWidth - n.x) / 2 - t.min.x,
@@ -14499,7 +14500,7 @@ class Id {
14499
14500
  )
14500
14501
  );
14501
14502
  break;
14502
- case he.RIGHT:
14503
+ case ue.RIGHT:
14503
14504
  e.forEach(
14504
14505
  (s) => s.translate(
14505
14506
  this._currentLeftMargin + this.maxLineWidth - n.x - t.min.x,
@@ -14508,7 +14509,7 @@ class Id {
14508
14509
  )
14509
14510
  );
14510
14511
  break;
14511
- case he.DISTRIBUTED:
14512
+ case ue.DISTRIBUTED:
14512
14513
  if (e.length > 1) {
14513
14514
  const s = (this.maxLineWidth - n.x) / (e.length - 1);
14514
14515
  for (let i = 1; i < e.length; i++)
@@ -14562,8 +14563,8 @@ class Id {
14562
14563
  this._currentContext.fontSize = e * this._currentContext.fontScaleFactor * this._currentContext.fontSizeScaleFactor, this.calcuateLineParams();
14563
14564
  }
14564
14565
  }
14565
- const Rn = /* @__PURE__ */ new g.Vector3(), Ne = /* @__PURE__ */ new g.Vector3(), Fn = /* @__PURE__ */ new g.Vector3(), Un = /* @__PURE__ */ new g.Quaternion(), Pn = /* @__PURE__ */ new g.Matrix4(), Es = /* @__PURE__ */ new g.Matrix4(), Bs = /* @__PURE__ */ new g.Vector3(1, 0, 0);
14566
- let As = class Zi extends g.Object3D {
14566
+ const Rn = /* @__PURE__ */ new g.Vector3(), ze = /* @__PURE__ */ new g.Vector3(), Fn = /* @__PURE__ */ new g.Vector3(), Un = /* @__PURE__ */ new g.Quaternion(), Pn = /* @__PURE__ */ new g.Matrix4(), Es = /* @__PURE__ */ new g.Matrix4(), Bs = /* @__PURE__ */ new g.Vector3(1, 0, 0);
14567
+ let Ls = class Zi extends g.Object3D {
14567
14568
  /**
14568
14569
  * Extracts all unique font names used in an MText string.
14569
14570
  * This function searches for font commands in the format \f{fontname}| or \f{fontname}; and returns a set of unique font names.
@@ -14677,7 +14678,7 @@ let As = class Zi extends g.Object3D {
14677
14678
  const { object: n, height: s } = this.createMTextGroup(e, t);
14678
14679
  if (!n)
14679
14680
  return;
14680
- n.matrix.decompose(Ne, Un, Fn), e.position && (Ne.x += e.position.x, Ne.y += e.position.y, n.matrix.compose(Ne, Un, Fn));
14681
+ n.matrix.decompose(ze, Un, Fn), e.position && (ze.x += e.position.x, ze.y += e.position.y, n.matrix.compose(ze, Un, Fn));
14681
14682
  const i = e.width, o = this.calculateAnchorPoint(
14682
14683
  i,
14683
14684
  s,
@@ -14692,8 +14693,8 @@ let As = class Zi extends g.Object3D {
14692
14693
  const l = e.directionVector, h = new g.Vector3(l.x, l.y, l.z), d = h.clone().cross(Bs), u = Bs.angleTo(h);
14693
14694
  a = d.z > 0 ? -u : u;
14694
14695
  }
14695
- n.matrix.compose(Ne, Un, Fn);
14696
- const c = e.position ? Ne.clone().sub(e.position) : Ne;
14696
+ n.matrix.compose(ze, Un, Fn);
14697
+ const c = e.position ? ze.clone().sub(e.position) : ze;
14697
14698
  return Pn.makeTranslation(-c.x, -c.y, 0), Es.makeRotationZ(a), n.matrix.multiply(Pn), n.matrix.multiply(Es), n.matrix.multiply(Pn.invert()), n.matrix.decompose(n.position, n.quaternion, n.scale), n;
14698
14699
  }
14699
14700
  /**
@@ -14708,8 +14709,8 @@ let As = class Zi extends g.Object3D {
14708
14709
  this.styleManager.unsupportedTextStyles[p] || (this.styleManager.unsupportedTextStyles[p] = 0), this.styleManager.unsupportedTextStyles[p]++;
14709
14710
  }
14710
14711
  const n = e.width || 0;
14711
- let s = he.LEFT;
14712
- e.width && e.attachmentPoint && ([1, 4, 7].includes(e.attachmentPoint) ? s = he.LEFT : [2, 5, 8].includes(e.attachmentPoint) ? s = he.CENTER : [3, 6, 9].includes(e.attachmentPoint) && (s = he.RIGHT));
14712
+ let s = ue.LEFT;
14713
+ e.width && e.attachmentPoint && ([1, 4, 7].includes(e.attachmentPoint) ? s = ue.LEFT : [2, 5, 8].includes(e.attachmentPoint) ? s = ue.CENTER : [3, 6, 9].includes(e.attachmentPoint) && (s = ue.RIGHT));
14713
14714
  let i = yt.BOTTOM;
14714
14715
  e.attachmentPoint && ([1, 2, 3].includes(e.attachmentPoint) ? i = yt.TOP : [4, 5, 6].includes(e.attachmentPoint) ? i = yt.MIDDLE : [7, 8, 9].includes(e.attachmentPoint) && (i = yt.BOTTOM));
14715
14716
  const o = e.height || 0, a = e.lineSpaceFactor || 0.3, c = e.drawingDirection ?? It.LEFT_TO_RIGHT, l = {
@@ -15069,7 +15070,7 @@ class Ed {
15069
15070
  byBlockColor: 16777215
15070
15071
  }) {
15071
15072
  await this.ensureInitialized();
15072
- const s = new As(
15073
+ const s = new Ls(
15073
15074
  e,
15074
15075
  t,
15075
15076
  this.styleManager,
@@ -15086,7 +15087,7 @@ class Ed {
15086
15087
  byLayerColor: 16777215,
15087
15088
  byBlockColor: 16777215
15088
15089
  }) {
15089
- const s = new As(
15090
+ const s = new Ls(
15090
15091
  e,
15091
15092
  t,
15092
15093
  this.styleManager,
@@ -15184,11 +15185,11 @@ class Bd {
15184
15185
  this.webWorkerRenderer && this.webWorkerRenderer.terminate(), this.mainThreadRenderer.destroy();
15185
15186
  }
15186
15187
  }
15187
- var J;
15188
+ var K;
15188
15189
  (function(r) {
15189
15190
  r[r.BeforeStart = 0] = "BeforeStart", r[r.EqualStart = 1] = "EqualStart", r[r.BetweenStartAndEnd = 2] = "BetweenStartAndEnd", r[r.EqualEnd = 3] = "EqualEnd", r[r.AfterEnd = 4] = "AfterEnd";
15190
- })(J || (J = {}));
15191
- class Ad {
15191
+ })(K || (K = {}));
15192
+ class Ld {
15192
15193
  pointsSame(e, t) {
15193
15194
  return this.pointsSameX(e, t) && this.pointsSameY(e, t);
15194
15195
  }
@@ -15196,7 +15197,7 @@ class Ad {
15196
15197
  return this.pointsSameX(e, t) ? this.pointsSameY(e, t) ? 0 : e[1] < t[1] ? -1 : 1 : e[0] < t[0] ? -1 : 1;
15197
15198
  }
15198
15199
  }
15199
- class Ki extends Ad {
15200
+ class Ji extends Ld {
15200
15201
  constructor(e = 1e-10) {
15201
15202
  super(), this.epsilon = e;
15202
15203
  }
@@ -15225,7 +15226,7 @@ class Ki extends Ad {
15225
15226
  const i = t[0] - e[0], o = t[1] - e[1], a = s[0] - n[0], c = s[1] - n[1], l = i * c - o * a;
15226
15227
  if (Math.abs(l) < this.epsilon)
15227
15228
  return null;
15228
- const h = e[0] - n[0], d = e[1] - n[1], u = (a * d - c * h) / l, p = (i * d - o * h) / l, f = (y) => y <= -this.epsilon ? J.BeforeStart : y < this.epsilon ? J.EqualStart : y - 1 <= -this.epsilon ? J.BetweenStartAndEnd : y - 1 < this.epsilon ? J.EqualEnd : J.AfterEnd, m = [e[0] + u * i, e[1] + u * o];
15229
+ const h = e[0] - n[0], d = e[1] - n[1], u = (a * d - c * h) / l, p = (i * d - o * h) / l, f = (y) => y <= -this.epsilon ? K.BeforeStart : y < this.epsilon ? K.EqualStart : y - 1 <= -this.epsilon ? K.BetweenStartAndEnd : y - 1 < this.epsilon ? K.EqualEnd : K.AfterEnd, m = [e[0] + u * i, e[1] + u * o];
15229
15230
  return {
15230
15231
  alongA: f(u),
15231
15232
  alongB: f(p),
@@ -15233,7 +15234,7 @@ class Ki extends Ad {
15233
15234
  };
15234
15235
  }
15235
15236
  }
15236
- class Ls {
15237
+ class As {
15237
15238
  constructor() {
15238
15239
  this.nodes = [];
15239
15240
  }
@@ -15287,7 +15288,7 @@ class Os {
15287
15288
  }
15288
15289
  class Ds {
15289
15290
  constructor(e, t, n = null) {
15290
- this.events = new Ls(), this.status = new Ls(), this.selfIntersection = e, this.geo = t, this.log = n;
15291
+ this.events = new As(), this.status = new As(), this.selfIntersection = e, this.geo = t, this.log = n;
15291
15292
  }
15292
15293
  compareEvents(e, t, n, s, i, o) {
15293
15294
  const a = this.geo.pointsCompare(t, i);
@@ -15345,7 +15346,7 @@ class Ds {
15345
15346
  return f ? this.divideEvent(t, a) : this.divideEvent(e, l), t;
15346
15347
  p && (u || (f ? this.divideEvent(t, a) : this.divideEvent(e, l)), this.divideEvent(t, o));
15347
15348
  } else
15348
- h.alongA === J.BetweenStartAndEnd && (h.alongB === J.EqualStart ? this.divideEvent(e, c) : h.alongB === J.BetweenStartAndEnd ? this.divideEvent(e, h.p) : h.alongB === J.EqualEnd && this.divideEvent(e, l)), h.alongB === J.BetweenStartAndEnd && (h.alongA === J.EqualStart ? this.divideEvent(t, o) : h.alongA === J.BetweenStartAndEnd ? this.divideEvent(t, h.p) : h.alongA === J.EqualEnd && this.divideEvent(t, a));
15349
+ h.alongA === K.BetweenStartAndEnd && (h.alongB === K.EqualStart ? this.divideEvent(e, c) : h.alongB === K.BetweenStartAndEnd ? this.divideEvent(e, h.p) : h.alongB === K.EqualEnd && this.divideEvent(e, l)), h.alongB === K.BetweenStartAndEnd && (h.alongA === K.EqualStart ? this.divideEvent(t, o) : h.alongA === K.BetweenStartAndEnd ? this.divideEvent(t, h.p) : h.alongA === K.EqualEnd && this.divideEvent(t, a));
15349
15350
  return null;
15350
15351
  }
15351
15352
  calculate(e, t) {
@@ -15446,7 +15447,7 @@ class ft {
15446
15447
  return pt(e, [0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0], t);
15447
15448
  }
15448
15449
  }
15449
- function Ld(r, e, t) {
15450
+ function Ad(r, e, t) {
15450
15451
  const n = [], s = [];
15451
15452
  for (const i of r) {
15452
15453
  let d = function(v, w, x) {
@@ -15456,8 +15457,8 @@ function Ld(r, e, t) {
15456
15457
  }, p = function(v, w) {
15457
15458
  const x = n[v], _ = n[w];
15458
15459
  let S = x[x.length - 1];
15459
- const L = x[x.length - 2], T = _[0], k = _[1];
15460
- e.pointsCollinear(L, S, T) && (t == null || t.chainRemoveTail(v, S), x.pop(), S = L), e.pointsCollinear(S, T, k) && (t == null || t.chainRemoveHead(w, T), _.shift()), t == null || t.chainJoin(v, w), n[v] = x.concat(_), n.splice(w, 1);
15460
+ const A = x[x.length - 2], T = _[0], k = _[1];
15461
+ e.pointsCollinear(A, S, T) && (t == null || t.chainRemoveTail(v, S), x.pop(), S = A), e.pointsCollinear(S, T, k) && (t == null || t.chainRemoveHead(w, T), _.shift()), t == null || t.chainJoin(v, w), n[v] = x.concat(_), n.splice(w, 1);
15461
15462
  };
15462
15463
  const o = i.start, a = i.end;
15463
15464
  if (e.pointsSame(o, a)) {
@@ -15497,8 +15498,8 @@ function Ld(r, e, t) {
15497
15498
  t == null || t.chainMatch(c.index);
15498
15499
  const v = c.index, w = c.matches_pt1 ? a : o, x = c.matches_head, _ = n[v];
15499
15500
  let S = x ? _[0] : _[_.length - 1];
15500
- const L = x ? _[1] : _[_.length - 2], T = x ? _[_.length - 1] : _[0], k = x ? _[_.length - 2] : _[1];
15501
- if (e.pointsCollinear(L, S, w) && (x ? (t == null || t.chainRemoveHead(c.index, w), _.shift()) : (t == null || t.chainRemoveTail(c.index, w), _.pop()), S = L), e.pointsSame(T, w)) {
15501
+ const A = x ? _[1] : _[_.length - 2], T = x ? _[_.length - 1] : _[0], k = x ? _[_.length - 2] : _[1];
15502
+ if (e.pointsCollinear(A, S, w) && (x ? (t == null || t.chainRemoveHead(c.index, w), _.shift()) : (t == null || t.chainRemoveTail(c.index, w), _.pop()), S = A), e.pointsSame(T, w)) {
15502
15503
  n.splice(v, 1), e.pointsCollinear(k, T, S) && (x ? (t == null || t.chainRemoveTail(c.index, S), _.pop()) : (t == null || t.chainRemoveHead(c.index, S), _.shift())), t == null || t.chainClose(c.index), s.push(_);
15503
15504
  continue;
15504
15505
  }
@@ -15592,7 +15593,7 @@ class Od {
15592
15593
  this.push("done", null);
15593
15594
  }
15594
15595
  }
15595
- class Ji {
15596
+ class Ki {
15596
15597
  constructor(e) {
15597
15598
  this.log = null, this.geo = e;
15598
15599
  }
@@ -15653,7 +15654,7 @@ class Ji {
15653
15654
  }
15654
15655
  polygon(e) {
15655
15656
  return {
15656
- regions: Ld(e.segments, this.geo, this.log),
15657
+ regions: Ad(e.segments, this.geo, this.log),
15657
15658
  inverted: e.inverted
15658
15659
  };
15659
15660
  }
@@ -15679,55 +15680,7 @@ class Ji {
15679
15680
  return this.polygon(o);
15680
15681
  }
15681
15682
  }
15682
- new Ji(new Ki());
15683
- class ln extends g.Object3D {
15684
- /**
15685
- * Flatten the hierarchy of the specified object so that all children are moved to be direct
15686
- * children of this object. Preserve transformations.
15687
- * @param root Input object to be flatten
15688
- * @returns Return the flatten object
15689
- */
15690
- static flattenObject(e) {
15691
- const t = [];
15692
- function n(i) {
15693
- i.position.set(0, 0, 0), i.rotation.set(0, 0, 0), i.scale.set(1, 1, 1), i.matrix.identity();
15694
- }
15695
- function s(i, o) {
15696
- const a = [...i.children];
15697
- for (const c of a)
15698
- c.applyMatrix4(o), n(c), c.children.length > 0 ? s(c, c.matrixWorld) : t.push(c);
15699
- i.children = [];
15700
- }
15701
- e.updateMatrixWorld(!0), s(e, e.matrixWorld);
15702
- for (const i of t)
15703
- "geometry" in i && (i.geometry.applyMatrix4(i.matrixWorld), i.matrixWorld.identity(), i.matrixWorldNeedsUpdate = !1, e.add(i));
15704
- n(e), e.matrixWorld.identity(), e.matrixWorldNeedsUpdate = !1;
15705
- }
15706
- /**
15707
- * Remove the specified object from its parent and release geometry and material resource used
15708
- * by the object.
15709
- * @param object Input object to dispose
15710
- */
15711
- static disposeObject(e, t = !0) {
15712
- t && e.removeFromParent(), (e instanceof g.Mesh || e instanceof g.Line || e instanceof g.Points) && e.geometry && e.geometry.dispose(), (e instanceof g.Mesh || e instanceof g.Line || e instanceof g.Points) && (Array.isArray(e.material) ? e.material : [e.material]).forEach((n) => {
15713
- var s, i, o, a, c, l, h, d;
15714
- n.dispose(), (s = n.map) == null || s.dispose(), (i = n.envMap) == null || i.dispose(), (o = n.lightMap) == null || o.dispose(), (a = n.bumpMap) == null || a.dispose(), (c = n.normalMap) == null || c.dispose(), (l = n.roughnessMap) == null || l.dispose(), (h = n.metalnessMap) == null || h.dispose(), (d = n.alphaMap) == null || d.dispose();
15715
- }), e.children.forEach((n) => this.disposeObject(n)), "geometry" in e && (e.geometry = null), "material" in e && (e.material = null), e.children = [];
15716
- }
15717
- /**
15718
- * Flatten the hierarchy of this object so that all children are moved to be direct children of
15719
- * this entity. Preserve transformations.
15720
- */
15721
- flatten() {
15722
- ln.flattenObject(this);
15723
- }
15724
- /**
15725
- * Remove this object from its parent and release geometry and material resource used by this object.
15726
- */
15727
- dispose() {
15728
- ln.disposeObject(this);
15729
- }
15730
- }
15683
+ new Ki(new Ji());
15731
15684
  const be = [
15732
15685
  0.5,
15733
15686
  0,
@@ -16342,7 +16295,7 @@ class Oe {
16342
16295
  }
16343
16296
  }
16344
16297
  const Rs = /* @__PURE__ */ new g.Matrix4(), gt = /* @__PURE__ */ new g.Vector3(), Rd = new g.Color(583902);
16345
- class hn {
16298
+ class ln {
16346
16299
  /**
16347
16300
  * Clone given material(s)
16348
16301
  */
@@ -16806,7 +16759,7 @@ class Fd extends g.LineSegments {
16806
16759
  return this.geometry.dispose(), this;
16807
16760
  }
16808
16761
  }
16809
- const Us = /* @__PURE__ */ new g.Box3(), Qe = /* @__PURE__ */ new g.Vector3(), Ke = /* @__PURE__ */ new g.Mesh(), Wt = [];
16762
+ const Us = /* @__PURE__ */ new g.Box3(), Qe = /* @__PURE__ */ new g.Vector3(), Je = /* @__PURE__ */ new g.Mesh(), Wt = [];
16810
16763
  class Ud extends g.Mesh {
16811
16764
  constructor(e = 1e3, t = e * 2, n) {
16812
16765
  super(new g.BufferGeometry(), n), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e, this._maxIndexCount = t;
@@ -17088,7 +17041,7 @@ class Ud extends g.Mesh {
17088
17041
  e.geometry.index = null, e.geometry.attributes = {}, e.geometry.setDrawRange(0, 1 / 0);
17089
17042
  }
17090
17043
  intersectWith(e, t, n) {
17091
- this._initializeRaycastObject(Ke), this._intersectWith(e, t, n), this._resetRaycastObjectInfo(Ke);
17044
+ this._initializeRaycastObject(Je), this._intersectWith(e, t, n), this._resetRaycastObjectInfo(Je);
17092
17045
  }
17093
17046
  _intersectWith(e, t, n) {
17094
17047
  const s = this._geometryInfo[e];
@@ -17111,11 +17064,11 @@ class Ud extends g.Mesh {
17111
17064
  }
17112
17065
  } else {
17113
17066
  this._setRaycastObjectInfo(
17114
- Ke,
17067
+ Je,
17115
17068
  e,
17116
17069
  s.start,
17117
17070
  s.count
17118
- ), Ke.raycast(t, Wt);
17071
+ ), Je.raycast(t, Wt);
17119
17072
  for (let i = 0, o = Wt.length; i < o; i++) {
17120
17073
  const a = Wt[i];
17121
17074
  a.object = this, a.batchId = e, a.objectId = s.objectId, n.push(a);
@@ -17125,10 +17078,10 @@ class Ud extends g.Mesh {
17125
17078
  }
17126
17079
  raycast(e, t) {
17127
17080
  const n = this._geometryInfo;
17128
- this._initializeRaycastObject(Ke);
17081
+ this._initializeRaycastObject(Je);
17129
17082
  for (let s = 0, i = n.length; s < i; s++)
17130
17083
  this._intersectWith(s, e, t);
17131
- this._resetRaycastObjectInfo(Ke);
17084
+ this._resetRaycastObjectInfo(Je);
17132
17085
  }
17133
17086
  copy(e) {
17134
17087
  return super.copy(e), this.geometry = e.geometry.clone(), this.boundingBox = e.boundingBox !== null ? e.boundingBox.clone() : null, this.boundingSphere = e.boundingSphere !== null ? e.boundingSphere.clone() : null, this._geometryInfo = e._geometryInfo.map((t) => ({
@@ -17141,7 +17094,7 @@ class Ud extends g.Mesh {
17141
17094
  return this.geometry.dispose(), this;
17142
17095
  }
17143
17096
  }
17144
- const Ps = /* @__PURE__ */ new g.Box3(), Je = /* @__PURE__ */ new g.Vector3(), et = /* @__PURE__ */ new g.Points(), jt = [];
17097
+ const Ps = /* @__PURE__ */ new g.Box3(), Ke = /* @__PURE__ */ new g.Vector3(), et = /* @__PURE__ */ new g.Points(), jt = [];
17145
17098
  class Pd extends g.Points {
17146
17099
  constructor(e = 1e3, t) {
17147
17100
  super(new g.BufferGeometry(), t), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e;
@@ -17308,7 +17261,7 @@ class Pd extends g.Points {
17308
17261
  const i = new g.Box3(), o = n.index, a = n.attributes.position;
17309
17262
  for (let c = s.vertexStart, l = s.vertexStart + s.vertexCount; c < l; c++) {
17310
17263
  let h = c;
17311
- o && (h = o.getX(h)), i.expandByPoint(Je.fromBufferAttribute(a, h));
17264
+ o && (h = o.getX(h)), i.expandByPoint(Ke.fromBufferAttribute(a, h));
17312
17265
  }
17313
17266
  s.boundingBox = i;
17314
17267
  }
@@ -17326,9 +17279,9 @@ class Pd extends g.Points {
17326
17279
  let c = 0;
17327
17280
  for (let l = s.vertexStart, h = s.vertexStart + s.vertexCount; l < h; l++) {
17328
17281
  let d = l;
17329
- o && (d = o.getX(d)), Je.fromBufferAttribute(a, d), c = Math.max(
17282
+ o && (d = o.getX(d)), Ke.fromBufferAttribute(a, d), c = Math.max(
17330
17283
  c,
17331
- i.center.distanceToSquared(Je)
17284
+ i.center.distanceToSquared(Ke)
17332
17285
  );
17333
17286
  }
17334
17287
  i.radius = Math.sqrt(c), s.boundingSphere = i;
@@ -17384,11 +17337,11 @@ class Pd extends g.Points {
17384
17337
  if (!(!s.visible || !s.active))
17385
17338
  if (s.bboxIntersectionCheck) {
17386
17339
  const i = s.boundingBox;
17387
- if (t.ray.intersectBox(i, Je)) {
17388
- const o = t.ray.origin.distanceTo(Je);
17340
+ if (t.ray.intersectBox(i, Ke)) {
17341
+ const o = t.ray.origin.distanceTo(Ke);
17389
17342
  n.push({
17390
17343
  distance: o,
17391
- point: Je.clone(),
17344
+ point: Ke.clone(),
17392
17345
  object: this,
17393
17346
  face: null,
17394
17347
  faceIndex: void 0,
@@ -17584,8 +17537,8 @@ class Gd extends g.Group {
17584
17537
  n && n.forEach((s) => {
17585
17538
  const i = this.getObjectById(
17586
17539
  s.batchedObjectId
17587
- ).getObjectAt(s.batchId), o = hn.cloneMaterial(i.material);
17588
- hn.setMaterialColor(o), i.material = o, i.userData.objectId = e, t.add(i);
17540
+ ).getObjectAt(s.batchId), o = ln.cloneMaterial(i.material);
17541
+ ln.setMaterialColor(o), i.material = o, i.userData.objectId = e, t.add(i);
17589
17542
  });
17590
17543
  }
17591
17544
  unhighlight(e, t) {
@@ -17664,7 +17617,7 @@ class Gd extends g.Group {
17664
17617
  return t;
17665
17618
  }
17666
17619
  }
17667
- class eo extends ln {
17620
+ class eo extends g.Object3D {
17668
17621
  constructor(e) {
17669
17622
  super(), this._styleManager = e;
17670
17623
  }
@@ -17678,9 +17631,9 @@ class eo extends ln {
17678
17631
  return this._styleManager = e._styleManager, super.copy(e, t);
17679
17632
  }
17680
17633
  }
17681
- class ge extends eo {
17634
+ class re extends eo {
17682
17635
  constructor(e) {
17683
- super(e), this._objectId = "", this._ownerId = "", this._layerName = "", this._box = new g.Box3();
17636
+ super(e), this._box = new g.Box3();
17684
17637
  }
17685
17638
  /**
17686
17639
  * The bounding box without considering transformation matrix applied on this object.
@@ -17697,28 +17650,74 @@ class ge extends eo {
17697
17650
  * @inheritdoc
17698
17651
  */
17699
17652
  get objectId() {
17700
- return this._objectId;
17653
+ return this.userData.objectId;
17701
17654
  }
17702
17655
  set objectId(e) {
17703
- this._objectId = e;
17656
+ this.userData.objectId = e;
17704
17657
  }
17705
17658
  /**
17706
17659
  * @inheritdoc
17707
17660
  */
17708
17661
  get ownerId() {
17709
- return this._ownerId;
17662
+ return this.userData.ownerId;
17710
17663
  }
17711
17664
  set ownerId(e) {
17712
- this._ownerId = e;
17665
+ this.userData.ownerId = e;
17713
17666
  }
17714
17667
  /**
17715
17668
  * @inheritdoc
17716
17669
  */
17717
17670
  get layerName() {
17718
- return this._layerName;
17671
+ return this.userData.layerName;
17719
17672
  }
17720
17673
  set layerName(e) {
17721
- this._layerName = e;
17674
+ this.userData.layerName = e;
17675
+ }
17676
+ /**
17677
+ * Flatten the hierarchy of the specified object so that all children are moved to be direct
17678
+ * children of this object. Preserve transformations.
17679
+ * @param root Input object to be flatten
17680
+ * @returns Return the flatten object
17681
+ */
17682
+ static flattenObject(e) {
17683
+ const t = [];
17684
+ function n(i) {
17685
+ i.position.set(0, 0, 0), i.rotation.set(0, 0, 0), i.scale.set(1, 1, 1), i.matrix.identity();
17686
+ }
17687
+ function s(i, o) {
17688
+ const a = [...i.children];
17689
+ for (const c of a)
17690
+ !c.userData.layerName && i.userData.layerName && (c.userData.layerName = i.userData.layerName), c.applyMatrix4(o), n(c), c.children.length > 0 ? s(c, c.matrixWorld) : t.push(c);
17691
+ i.children = [];
17692
+ }
17693
+ e.updateMatrixWorld(!0), s(e, e.matrixWorld);
17694
+ for (const i of t)
17695
+ "geometry" in i && (i.geometry.applyMatrix4(i.matrixWorld), i.matrixWorld.identity(), i.matrixWorldNeedsUpdate = !1, e.add(i));
17696
+ n(e), e.matrixWorld.identity(), e.matrixWorldNeedsUpdate = !1;
17697
+ }
17698
+ /**
17699
+ * Remove the specified object from its parent and release geometry and material resource used
17700
+ * by the object.
17701
+ * @param object Input object to dispose
17702
+ */
17703
+ static disposeObject(e, t = !0) {
17704
+ t && e.removeFromParent(), (e instanceof g.Mesh || e instanceof g.Line || e instanceof g.Points) && e.geometry && e.geometry.dispose(), (e instanceof g.Mesh || e instanceof g.Line || e instanceof g.Points) && (Array.isArray(e.material) ? e.material : [e.material]).forEach((n) => {
17705
+ var s, i, o, a, c, l, h, d;
17706
+ n.dispose(), (s = n.map) == null || s.dispose(), (i = n.envMap) == null || i.dispose(), (o = n.lightMap) == null || o.dispose(), (a = n.bumpMap) == null || a.dispose(), (c = n.normalMap) == null || c.dispose(), (l = n.roughnessMap) == null || l.dispose(), (h = n.metalnessMap) == null || h.dispose(), (d = n.alphaMap) == null || d.dispose();
17707
+ }), e.children.forEach((n) => this.disposeObject(n)), "geometry" in e && (e.geometry = null), "material" in e && (e.material = null), e.children = [];
17708
+ }
17709
+ /**
17710
+ * Flatten the hierarchy of this object so that all children are moved to be direct children of
17711
+ * this entity. Preserve transformations.
17712
+ */
17713
+ flatten() {
17714
+ re.flattenObject(this);
17715
+ }
17716
+ /**
17717
+ * Remove this object from its parent and release geometry and material resource used by this object.
17718
+ */
17719
+ dispose() {
17720
+ re.disposeObject(this);
17722
17721
  }
17723
17722
  async draw() {
17724
17723
  }
@@ -17759,8 +17758,8 @@ class ge extends eo {
17759
17758
  if ("material" in e) {
17760
17759
  const t = e.material;
17761
17760
  if (e.userData.originalMaterial == null) {
17762
- const n = hn.cloneMaterial(t);
17763
- hn.setMaterialColor(n), e.userData.originalMaterial = e.material, e.material = n;
17761
+ const n = ln.cloneMaterial(t);
17762
+ ln.setMaterialColor(n), e.userData.originalMaterial = e.material, e.material = n;
17764
17763
  }
17765
17764
  } else e.children.length > 0 && e.children.forEach((t) => {
17766
17765
  this.highlightObject(t);
@@ -17776,7 +17775,7 @@ class ge extends eo {
17776
17775
  * @inheritdoc
17777
17776
  */
17778
17777
  fastDeepClone() {
17779
- const e = new ge(this.styleManager);
17778
+ const e = new re(this.styleManager);
17780
17779
  return e.copy(this, !1), this.copyGeometry(this, e), e;
17781
17780
  }
17782
17781
  /**
@@ -17814,6 +17813,43 @@ class ge extends eo {
17814
17813
  return o;
17815
17814
  }
17816
17815
  }
17816
+ class mn extends re {
17817
+ constructor(e, t) {
17818
+ super(t), e.forEach((i) => {
17819
+ if (Array.isArray(i)) {
17820
+ const o = new re(t);
17821
+ this.add(o), this.box.union(o.box);
17822
+ } else
17823
+ this.add(i), this.box.union(i.box);
17824
+ }), this.flatten();
17825
+ let n = !1;
17826
+ const s = this.children;
17827
+ for (let i = 0; i < s.length; ++i) {
17828
+ const o = s[i];
17829
+ if (o.userData.layerName != null && o.userData.layerName !== "0") {
17830
+ n = !0;
17831
+ break;
17832
+ }
17833
+ }
17834
+ this._isOnTheSameLayer = !n;
17835
+ }
17836
+ get isOnTheSameLayer() {
17837
+ return this._isOnTheSameLayer;
17838
+ }
17839
+ /**
17840
+ * @inheritdoc
17841
+ */
17842
+ copy(e, t) {
17843
+ return this._isOnTheSameLayer = e._isOnTheSameLayer, super.copy(e, t);
17844
+ }
17845
+ /**
17846
+ * @inheritdoc
17847
+ */
17848
+ fastDeepClone() {
17849
+ const e = new mn([], this.styleManager);
17850
+ return e.copy(this, !1), this.copyGeometry(this, e), e;
17851
+ }
17852
+ }
17817
17853
  const to = class st {
17818
17854
  constructor() {
17819
17855
  }
@@ -17869,19 +17905,8 @@ const to = class st {
17869
17905
  }
17870
17906
  };
17871
17907
  to._instance = null;
17872
- let un = to;
17873
- class zd extends ge {
17874
- constructor(e, t) {
17875
- super(t), e.forEach((n) => {
17876
- if (Array.isArray(n)) {
17877
- const s = new ge(t);
17878
- this.add(s), this.box.union(s.box);
17879
- } else
17880
- this.add(n), this.box.union(n.box);
17881
- }), this.flatten();
17882
- }
17883
- }
17884
- class Nd extends ge {
17908
+ let hn = to;
17909
+ class Nd extends re {
17885
17910
  constructor(e, t, n) {
17886
17911
  super(n);
17887
17912
  const s = URL.createObjectURL(e), i = new g.TextureLoader().load(s);
@@ -18033,7 +18058,7 @@ class Mt {
18033
18058
  return s.needsUpdate = !0, e;
18034
18059
  }
18035
18060
  }
18036
- class Vd extends ge {
18061
+ class zd extends re {
18037
18062
  constructor(e, t, n) {
18038
18063
  super(n);
18039
18064
  let s;
@@ -18055,7 +18080,7 @@ class Vd extends ge {
18055
18080
  e.computeBoundingBox(), this.box = e.boundingBox;
18056
18081
  }
18057
18082
  }
18058
- class Hd extends ge {
18083
+ class Vd extends re {
18059
18084
  constructor(e, t, n, s, i) {
18060
18085
  super(i);
18061
18086
  let o;
@@ -18069,12 +18094,12 @@ class Hd extends ge {
18069
18094
  Mt.computeLineDistances(c), this.add(c);
18070
18095
  }
18071
18096
  }
18072
- class Wd extends ge {
18097
+ class Hd extends re {
18073
18098
  constructor(e, t, n, s = !1) {
18074
18099
  super(n), this._text = e, this._style = t, s || this.syncDraw();
18075
18100
  }
18076
18101
  async syncDraw() {
18077
- const e = un.getInstance();
18102
+ const e = hn.getInstance();
18078
18103
  if (e)
18079
18104
  try {
18080
18105
  const t = this._style;
@@ -18093,7 +18118,7 @@ class Wd extends ge {
18093
18118
  }
18094
18119
  }
18095
18120
  async draw() {
18096
- const e = un.getInstance();
18121
+ const e = hn.getInstance();
18097
18122
  if (e)
18098
18123
  try {
18099
18124
  const t = this._style;
@@ -18125,8 +18150,8 @@ class Wd extends ge {
18125
18150
  return e != null && e.bigFont && e.bigFont.toUpperCase().startsWith("GB") ? "gbk" : "utf8";
18126
18151
  }
18127
18152
  }
18128
- const jd = /* @__PURE__ */ new g.Vector3();
18129
- class Xd extends ge {
18153
+ const Wd = /* @__PURE__ */ new g.Vector3();
18154
+ class jd extends re {
18130
18155
  constructor(e, t, n) {
18131
18156
  super(n);
18132
18157
  const s = Oe.instance.create(
@@ -18134,7 +18159,7 @@ class Xd extends ge {
18134
18159
  e
18135
18160
  );
18136
18161
  this.isShowPoint = s.point != null;
18137
- const i = s.point ?? new g.BufferGeometry().setFromPoints([jd.copy(e)]);
18162
+ const i = s.point ?? new g.BufferGeometry().setFromPoints([Wd.copy(e)]);
18138
18163
  i.computeBoundingBox(), i.boundingBox && this.box.union(i.boundingBox);
18139
18164
  const o = this.styleManager.getPointsMaterial(t.color), a = new g.Points(i, o);
18140
18165
  if (a.userData.bboxIntersectionCheck = !0, a.visible = this.isShowPoint, this.add(a), s.line) {
@@ -18145,7 +18170,7 @@ class Xd extends ge {
18145
18170
  }
18146
18171
  }
18147
18172
  }
18148
- class qd extends ge {
18173
+ class Xd extends re {
18149
18174
  constructor(e, t, n) {
18150
18175
  var s;
18151
18176
  super(n);
@@ -18208,7 +18233,7 @@ class qd extends ge {
18208
18233
  try {
18209
18234
  p.forEach((y, v) => {
18210
18235
  m = Math.min(e[y][0].relativeEps(), 1e-6);
18211
- const w = new Ji(new Ki(m));
18236
+ const w = new Ki(new Ji(m));
18212
18237
  if (v === 0)
18213
18238
  f = w.segments({
18214
18239
  regions: [a(e[y])],
@@ -18222,10 +18247,10 @@ class qd extends ge {
18222
18247
  h = w.polygon(w.selectUnion(_)), h.regions.length > 0 ? h.regions.forEach((S) => {
18223
18248
  if (S.length === 0)
18224
18249
  return;
18225
- const L = S.map(
18250
+ const A = S.map(
18226
18251
  (T) => new g.Vector2(T[0], T[1])
18227
18252
  );
18228
- l.holes.push(new g.Path(L));
18253
+ l.holes.push(new g.Path(A));
18229
18254
  }) : console.warn("mergedHoles.regions is empty!");
18230
18255
  }
18231
18256
  });
@@ -18266,7 +18291,7 @@ class qd extends ge {
18266
18291
  return s;
18267
18292
  }
18268
18293
  }
18269
- function $d(r, e, t, n, s = 0) {
18294
+ function qd(r, e, t, n, s = 0) {
18270
18295
  const i = {
18271
18296
  u_cameraZoom: t,
18272
18297
  u_patternLines: { value: r },
@@ -18486,7 +18511,7 @@ function $d(r, e, t, n, s = 0) {
18486
18511
  clipping: !0
18487
18512
  });
18488
18513
  }
18489
- class Yd {
18514
+ class $d {
18490
18515
  /**
18491
18516
  * Creates line shader by given pattern.
18492
18517
  * Note: remember to call line.computeLineDistances() in order to make it work!
@@ -18577,7 +18602,7 @@ class Yd {
18577
18602
  });
18578
18603
  }
18579
18604
  }
18580
- const Jt = class vt {
18605
+ const Kt = class vt {
18581
18606
  constructor() {
18582
18607
  this.pointMaterials = {}, this.lineShaderMaterials = {}, this.lineBasicMaterials = {}, this.hatchShaderMaterials = [], this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
18583
18608
  }
@@ -18601,7 +18626,7 @@ const Jt = class vt {
18601
18626
  getLineShaderMaterial(e, t) {
18602
18627
  if (e.pattern && e.pattern.length !== 0) {
18603
18628
  const n = `${e.name}_${e.color}_${t}`;
18604
- return this.lineShaderMaterials[n] || (this.lineShaderMaterials[n] = Yd.createLineShaderMaterial(
18629
+ return this.lineShaderMaterials[n] || (this.lineShaderMaterials[n] = $d.createLineShaderMaterial(
18605
18630
  e.pattern,
18606
18631
  e.color,
18607
18632
  t,
@@ -18661,7 +18686,7 @@ const Jt = class vt {
18661
18686
  x[T] = 0;
18662
18687
  for (let T = _.length; T < a + 1; ++T)
18663
18688
  _[T] = S;
18664
- const L = {
18689
+ const A = {
18665
18690
  origin: p,
18666
18691
  delta: f,
18667
18692
  angle: u.angle - e.patternAngle,
@@ -18675,9 +18700,9 @@ const Jt = class vt {
18675
18700
  );
18676
18701
  break;
18677
18702
  }
18678
- l.push(L);
18703
+ l.push(A);
18679
18704
  }
18680
- const d = $d(
18705
+ const d = qd(
18681
18706
  l,
18682
18707
  e.patternAngle,
18683
18708
  vt.CameraZoomUniform,
@@ -18714,13 +18739,13 @@ const Jt = class vt {
18714
18739
  return a == null ? void 0 : a.material;
18715
18740
  }
18716
18741
  };
18717
- Jt.CameraZoomUniform = { value: 1 }, Jt.ViewportScaleUniform = { value: 1 }, Jt.MaxFragmentUniforms = 1024;
18718
- let Zd = Jt;
18719
- class Qd {
18742
+ Kt.CameraZoomUniform = { value: 1 }, Kt.ViewportScaleUniform = { value: 1 }, Kt.MaxFragmentUniforms = 1024;
18743
+ let Yd = Kt;
18744
+ class Zd {
18720
18745
  constructor(e) {
18721
18746
  this.events = {
18722
18747
  fontNotFound: new ne()
18723
- }, this._renderer = e, this._styleManager = new Zd(), ee.instance.events.fontNotFound.addEventListener((t) => {
18748
+ }, this._renderer = e, this._styleManager = new Yd(), ee.instance.events.fontNotFound.addEventListener((t) => {
18724
18749
  this.events.fontNotFound.dispatch(t);
18725
18750
  });
18726
18751
  }
@@ -18818,19 +18843,19 @@ class Qd {
18818
18843
  * Create one empty entity
18819
18844
  */
18820
18845
  createEntity() {
18821
- return new ge(this._styleManager);
18846
+ return new re(this._styleManager);
18822
18847
  }
18823
18848
  /**
18824
18849
  * @inheritdoc
18825
18850
  */
18826
18851
  group(e) {
18827
- return new zd(e, this._styleManager);
18852
+ return new mn(e, this._styleManager);
18828
18853
  }
18829
18854
  /**
18830
18855
  * @inheritdoc
18831
18856
  */
18832
18857
  point(e, t) {
18833
- return new Xd(e, t, this._styleManager);
18858
+ return new jd(e, t, this._styleManager);
18834
18859
  }
18835
18860
  /**
18836
18861
  * @inheritdoc
@@ -18854,7 +18879,7 @@ class Qd {
18854
18879
  * @inheritdoc
18855
18880
  */
18856
18881
  lineSegments(e, t, n, s) {
18857
- return new Hd(
18882
+ return new Vd(
18858
18883
  e,
18859
18884
  t,
18860
18885
  n,
@@ -18866,13 +18891,13 @@ class Qd {
18866
18891
  * @inheritdoc
18867
18892
  */
18868
18893
  area(e, t) {
18869
- return new qd(e, t, this._styleManager);
18894
+ return new Xd(e, t, this._styleManager);
18870
18895
  }
18871
18896
  /**
18872
18897
  * @inheritdoc
18873
18898
  */
18874
18899
  mtext(e, t, n) {
18875
- return new Wd(e, t, this._styleManager, n);
18900
+ return new Hd(e, t, this._styleManager, n);
18876
18901
  }
18877
18902
  /**
18878
18903
  * @inheritdoc
@@ -18881,10 +18906,10 @@ class Qd {
18881
18906
  return new Nd(e, t, this._styleManager);
18882
18907
  }
18883
18908
  linePoints(e, t = void 0) {
18884
- return new Vd(e, t, this._styleManager);
18909
+ return new zd(e, t, this._styleManager);
18885
18910
  }
18886
18911
  }
18887
- class Kd {
18912
+ class Qd {
18888
18913
  constructor(e) {
18889
18914
  this._camera = e;
18890
18915
  }
@@ -18996,7 +19021,7 @@ class no {
18996
19021
  viewChanged: new ne()
18997
19022
  }, this._renderer = e, this._width = t, this._height = n;
18998
19023
  const s = this.createCamera();
18999
- this._camera = new Kd(s), this._cameraControls = this.createCameraControls(), this._cameraControls.addEventListener("change", () => {
19024
+ this._camera = new Qd(s), this._cameraControls = this.createCameraControls(), this._cameraControls.addEventListener("change", () => {
19000
19025
  this.events.viewChanged.dispatch({ view: this });
19001
19026
  }), this._raycaster = new g.Raycaster();
19002
19027
  }
@@ -19072,7 +19097,7 @@ class no {
19072
19097
  x: n.x - t,
19073
19098
  y: n.y - t
19074
19099
  });
19075
- return new ue().setFromPoints([s, i]);
19100
+ return new de().setFromPoints([s, i]);
19076
19101
  }
19077
19102
  /**
19078
19103
  * Reset ray of raycaster associated with this view by the provided parameters and return
@@ -19123,12 +19148,12 @@ class no {
19123
19148
  }, e.update(), e;
19124
19149
  }
19125
19150
  }
19126
- class dn extends no {
19151
+ class un extends no {
19127
19152
  /**
19128
19153
  * Calcuate the bounding box of this viewport in client window coordinate system
19129
19154
  */
19130
19155
  static calculateViewportWindowBox(e, t) {
19131
- const n = t.box, s = new ue();
19156
+ const n = t.box, s = new de();
19132
19157
  return s.expandByPoint(e.wcs2Cwcs(n.min)), s.expandByPoint(e.wcs2Cwcs(n.max)), s;
19133
19158
  }
19134
19159
  /**
@@ -19138,7 +19163,7 @@ class dn extends no {
19138
19163
  * @param renderer Input renderer to draw this viewport view
19139
19164
  */
19140
19165
  constructor(e, t, n) {
19141
- const s = dn.calculateViewportWindowBox(
19166
+ const s = un.calculateViewportWindowBox(
19142
19167
  e,
19143
19168
  t
19144
19169
  ).size;
@@ -19161,7 +19186,7 @@ class dn extends no {
19161
19186
  * @param scene Input the scene to render
19162
19187
  */
19163
19188
  render(e) {
19164
- const t = dn.calculateViewportWindowBox(
19189
+ const t = un.calculateViewportWindowBox(
19165
19190
  this._parentView,
19166
19191
  this._viewport
19167
19192
  );
@@ -19181,36 +19206,36 @@ class dn extends no {
19181
19206
  }
19182
19207
  }
19183
19208
  }
19184
- const Jd = (r) => new js(r.min, r.max), ep = (r) => new ue(
19209
+ const Jd = (r) => new js(r.min, r.max), Kd = (r) => new de(
19185
19210
  r.min,
19186
19211
  r.max
19187
- ), tp = (r) => new g.Box3(
19212
+ ), ep = (r) => new g.Box3(
19188
19213
  r.min,
19189
19214
  r.max
19190
- ), np = (r) => new ue(r.min, r.max), rp = (r) => new g.Box2(
19215
+ ), tp = (r) => new de(r.min, r.max), np = (r) => new g.Box2(
19191
19216
  r.min,
19192
19217
  r.max
19193
- ), sp = (r) => new ue(r.min, r.max), ip = (r) => {
19218
+ ), rp = (r) => new de(r.min, r.max), sp = (r) => {
19194
19219
  const e = new g.Box3();
19195
19220
  return e.min.set(r.min.x, r.min.y, 0), e.max.set(r.max.x, r.max.y, 0), e;
19196
- }, op = {
19221
+ }, ip = {
19197
19222
  /** Converts Three.js Box2 to CAD geometry AcGeBox2d */
19198
- threeBo2dToGeBox2d: np,
19223
+ threeBo2dToGeBox2d: tp,
19199
19224
  /** Converts CAD geometry AcGeBox2d to Three.js Box2 */
19200
- geBox2dToThreeBox2d: rp,
19225
+ geBox2dToThreeBox2d: np,
19201
19226
  /** Converts Three.js Box3 to CAD geometry AcGeBox3d */
19202
19227
  threeBox3dToGeBox3d: Jd,
19203
19228
  /** Converts CAD geometry AcGeBox3d to Three.js Box3 */
19204
- geBox3dToThreeBox3d: tp,
19229
+ geBox3dToThreeBox3d: ep,
19205
19230
  /** Converts CAD geometry AcGeBox3d to CAD geometry AcGeBox2d */
19206
- goBox3dToGeBox2d: ep,
19231
+ goBox3dToGeBox2d: Kd,
19207
19232
  /** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
19208
- threeBox3dToGeBox2d: sp,
19233
+ threeBox3dToGeBox2d: rp,
19209
19234
  /** Converts CAD geometry AcGeBox2d to Three.js Box3 (Z=0) */
19210
- geBox2dToThreeBox3d: ip
19235
+ geBox2dToThreeBox3d: sp
19211
19236
  };
19212
19237
  var yn = /* @__PURE__ */ ((r) => (r[r.LEFT_BOTTOM = 0] = "LEFT_BOTTOM", r[r.LEFT_TOP = 1] = "LEFT_TOP", r[r.RIGHT_TOP = 2] = "RIGHT_TOP", r[r.RIGHT_BOTTOM = 4] = "RIGHT_BOTTOM", r))(yn || {});
19213
- class ap extends g.Object3D {
19238
+ class op extends g.Object3D {
19214
19239
  /**
19215
19240
  * Construct one instance of this gizmo
19216
19241
  * @param camera Camera used in your canvas
@@ -19294,7 +19319,7 @@ class ap extends g.Object3D {
19294
19319
  return o;
19295
19320
  }
19296
19321
  }
19297
- function cp(r, e) {
19322
+ function ap(r, e) {
19298
19323
  const t = e.font || "Helvetica", n = e.fontSize || 30, s = e.width || 200, i = e.height || 200, o = e.bgColor ? e.bgColor.join(", ") : "255, 255, 255, 1.0", a = e.color ? e.color.join(", ") : "0, 0, 0, 1.0", c = document.createElement("canvas");
19299
19324
  c.width = s, c.height = i;
19300
19325
  const l = c.getContext("2d");
@@ -19311,7 +19336,7 @@ function cp(r, e) {
19311
19336
  return h.minFilter = g.LinearFilter, h.needsUpdate = !0, h;
19312
19337
  }
19313
19338
  function Gn(r) {
19314
- const e = cp(r, {
19339
+ const e = ap(r, {
19315
19340
  fontSize: 100,
19316
19341
  font: "Arial Narrow, sans-serif",
19317
19342
  color: [255, 255, 255, 1],
@@ -19320,15 +19345,15 @@ function Gn(r) {
19320
19345
  return new g.Sprite(t);
19321
19346
  }
19322
19347
  yn.RIGHT_TOP;
19323
- const lp = {
19348
+ const cp = {
19324
19349
  pos: yn.LEFT_BOTTOM,
19325
19350
  size: 100,
19326
19351
  hasZAxis: !0
19327
19352
  };
19328
- class hp extends ap {
19353
+ class lp extends op {
19329
19354
  constructor(e, t, n) {
19330
19355
  const s = {
19331
- ...lp,
19356
+ ...cp,
19332
19357
  ...n
19333
19358
  };
19334
19359
  super(e, t, s.size, n.pos), this.hasZAxis = s.hasZAxis;
@@ -19370,7 +19395,7 @@ class hp extends ap {
19370
19395
  this.axes.geometry.dispose(), this.axes.material.dispose(), this.xText.geometry.dispose(), this.xText.material.dispose(), this.yText.geometry.dispose(), this.yText.material.dispose(), this.hasZAxis && ((e = this.zText) == null || e.geometry.dispose(), (t = this.zText) == null || t.material.dispose());
19371
19396
  }
19372
19397
  }
19373
- class up extends no {
19398
+ class hp extends no {
19374
19399
  /**
19375
19400
  * Construct one instance of this class.
19376
19401
  *
@@ -19461,7 +19486,7 @@ class up extends no {
19461
19486
  * @returns The configured axes gizmo instance
19462
19487
  */
19463
19488
  createAxesGizmo() {
19464
- return new hp(
19489
+ return new lp(
19465
19490
  this._camera.internalCamera,
19466
19491
  this._renderer.internalRenderer,
19467
19492
  {
@@ -19495,7 +19520,7 @@ class up extends no {
19495
19520
  }
19496
19521
  }
19497
19522
  }
19498
- class dp {
19523
+ class up {
19499
19524
  /**
19500
19525
  * Creates a new layout view manager instance.
19501
19526
  * Initializes with no active layout and an empty collection of views.
@@ -19578,7 +19603,7 @@ class dp {
19578
19603
  (t = this.activeLayoutView) == null || t.render(e);
19579
19604
  }
19580
19605
  }
19581
- function ro(r, e, t = 0, n = r.length - 1, s = pp) {
19606
+ function ro(r, e, t = 0, n = r.length - 1, s = dp) {
19582
19607
  for (; n > t; ) {
19583
19608
  if (n - t > 600) {
19584
19609
  const c = n - t + 1, l = e - t + 1, h = Math.log(c), d = 0.5 * Math.exp(2 * h / 3), u = 0.5 * Math.sqrt(h * d * (c - d) / c) * (l - c / 2 < 0 ? -1 : 1), p = Math.max(t, Math.floor(e - l * d / c + u)), f = Math.min(n, Math.floor(e + (c - l) * d / c + u));
@@ -19597,10 +19622,10 @@ function mt(r, e, t) {
19597
19622
  const n = r[e];
19598
19623
  r[e] = r[t], r[t] = n;
19599
19624
  }
19600
- function pp(r, e) {
19625
+ function dp(r, e) {
19601
19626
  return r < e ? -1 : r > e ? 1 : 0;
19602
19627
  }
19603
- class fp {
19628
+ class pp {
19604
19629
  constructor(e = 9) {
19605
19630
  this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
19606
19631
  }
@@ -19615,7 +19640,7 @@ class fp {
19615
19640
  for (; t; ) {
19616
19641
  for (let o = 0; o < t.children.length; o++) {
19617
19642
  const a = t.children[o], c = t.leaf ? s(a) : a;
19618
- Yt(e, c) && (t.leaf ? n.push(a) : Nn(e, c) ? this._all(a, n) : i.push(a));
19643
+ Yt(e, c) && (t.leaf ? n.push(a) : zn(e, c) ? this._all(a, n) : i.push(a));
19619
19644
  }
19620
19645
  t = i.pop();
19621
19646
  }
@@ -19629,7 +19654,7 @@ class fp {
19629
19654
  for (let s = 0; s < t.children.length; s++) {
19630
19655
  const i = t.children[s], o = t.leaf ? this.toBBox(i) : i;
19631
19656
  if (Yt(e, o)) {
19632
- if (t.leaf || Nn(e, o)) return !0;
19657
+ if (t.leaf || zn(e, o)) return !0;
19633
19658
  n.push(i);
19634
19659
  }
19635
19660
  }
@@ -19671,11 +19696,11 @@ class fp {
19671
19696
  let a, c, l;
19672
19697
  for (; n || i.length; ) {
19673
19698
  if (n || (n = i.pop(), c = i[i.length - 1], a = o.pop(), l = !0), n.leaf) {
19674
- const h = gp(e, n.children, t);
19699
+ const h = fp(e, n.children, t);
19675
19700
  if (h !== -1)
19676
19701
  return n.children.splice(h, 1), i.push(n), this._condense(i), this;
19677
19702
  }
19678
- !l && !n.leaf && Nn(n, s) ? (i.push(n), o.push(a), a = 0, c = n, n = n.children[0]) : c ? (a++, n = c.children[a], l = !1) : n = null;
19703
+ !l && !n.leaf && zn(n, s) ? (i.push(n), o.push(a), a = 0, c = n, n = n.children[0]) : c ? (a++, n = c.children[a], l = !1) : n = null;
19679
19704
  }
19680
19705
  return this;
19681
19706
  }
@@ -19722,7 +19747,7 @@ class fp {
19722
19747
  for (; s.push(t), !(t.leaf || s.length - 1 === n); ) {
19723
19748
  let i = 1 / 0, o = 1 / 0, a;
19724
19749
  for (let c = 0; c < t.children.length; c++) {
19725
- const l = t.children[c], h = zn(l), d = vp(e, l) - h;
19750
+ const l = t.children[c], h = Nn(l), d = yp(e, l) - h;
19726
19751
  d < o ? (o = d, i = h < i ? h : i, a = l) : d === o && h < i && (i = h, a = l);
19727
19752
  }
19728
19753
  t = a || t.children[0];
@@ -19748,14 +19773,14 @@ class fp {
19748
19773
  _chooseSplitIndex(e, t, n) {
19749
19774
  let s, i = 1 / 0, o = 1 / 0;
19750
19775
  for (let a = t; a <= n - t; a++) {
19751
- const c = bt(e, 0, a, this.toBBox), l = bt(e, a, n, this.toBBox), h = bp(c, l), d = zn(c) + zn(l);
19776
+ const c = bt(e, 0, a, this.toBBox), l = bt(e, a, n, this.toBBox), h = vp(c, l), d = Nn(c) + Nn(l);
19752
19777
  h < i ? (i = h, s = a, o = d < o ? d : o) : h === i && d < o && (o = d, s = a);
19753
19778
  }
19754
19779
  return s || n - t;
19755
19780
  }
19756
19781
  // sorts node children by the best axis for split
19757
19782
  _chooseSplitAxis(e, t, n) {
19758
- const s = e.leaf ? this.compareMinX : mp, i = e.leaf ? this.compareMinY : yp, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, i);
19783
+ const s = e.leaf ? this.compareMinX : gp, i = e.leaf ? this.compareMinY : mp, o = this._allDistMargin(e, t, n, s), a = this._allDistMargin(e, t, n, i);
19759
19784
  o < a && e.children.sort(s);
19760
19785
  }
19761
19786
  // total margin of all possible split distributions where each node is at least m full
@@ -19782,7 +19807,7 @@ class fp {
19782
19807
  e[t].children.length === 0 ? t > 0 ? (n = e[t - 1].children, n.splice(n.indexOf(e[t]), 1)) : this.clear() : tt(e[t], this.toBBox);
19783
19808
  }
19784
19809
  }
19785
- function gp(r, e, t) {
19810
+ function fp(r, e, t) {
19786
19811
  if (!t) return e.indexOf(r);
19787
19812
  for (let n = 0; n < e.length; n++)
19788
19813
  if (t(r, e[n])) return n;
@@ -19802,26 +19827,26 @@ function bt(r, e, t, n, s) {
19802
19827
  function xt(r, e) {
19803
19828
  return r.minX = Math.min(r.minX, e.minX), r.minY = Math.min(r.minY, e.minY), r.maxX = Math.max(r.maxX, e.maxX), r.maxY = Math.max(r.maxY, e.maxY), r;
19804
19829
  }
19805
- function mp(r, e) {
19830
+ function gp(r, e) {
19806
19831
  return r.minX - e.minX;
19807
19832
  }
19808
- function yp(r, e) {
19833
+ function mp(r, e) {
19809
19834
  return r.minY - e.minY;
19810
19835
  }
19811
- function zn(r) {
19836
+ function Nn(r) {
19812
19837
  return (r.maxX - r.minX) * (r.maxY - r.minY);
19813
19838
  }
19814
19839
  function $t(r) {
19815
19840
  return r.maxX - r.minX + (r.maxY - r.minY);
19816
19841
  }
19817
- function vp(r, e) {
19842
+ function yp(r, e) {
19818
19843
  return (Math.max(e.maxX, r.maxX) - Math.min(e.minX, r.minX)) * (Math.max(e.maxY, r.maxY) - Math.min(e.minY, r.minY));
19819
19844
  }
19820
- function bp(r, e) {
19845
+ function vp(r, e) {
19821
19846
  const t = Math.max(r.minX, e.minX), n = Math.max(r.minY, e.minY), s = Math.min(r.maxX, e.maxX), i = Math.min(r.maxY, e.maxY);
19822
19847
  return Math.max(0, s - t) * Math.max(0, i - n);
19823
19848
  }
19824
- function Nn(r, e) {
19849
+ function zn(r, e) {
19825
19850
  return r.minX <= e.minX && r.minY <= e.minY && e.maxX <= r.maxX && e.maxY <= r.maxY;
19826
19851
  }
19827
19852
  function Yt(r, e) {
@@ -19846,7 +19871,7 @@ function Gs(r, e, t, n, s) {
19846
19871
  ro(r, o, e, t, s), i.push(e, o, o, t);
19847
19872
  }
19848
19873
  }
19849
- class xp {
19874
+ class bp {
19850
19875
  /**
19851
19876
  * Construct one instance of this class
19852
19877
  * @param name Input layer name
@@ -19968,13 +19993,13 @@ class xp {
19968
19993
  });
19969
19994
  }
19970
19995
  }
19971
- class wp {
19996
+ class xp {
19972
19997
  /**
19973
19998
  * Creates a new layout instance.
19974
19999
  * Initializes the layout with empty collections and a spatial index.
19975
20000
  */
19976
20001
  constructor() {
19977
- this._group = new g.Group(), this._indexTree = new fp(), this._box = new g.Box3(), this._layers = /* @__PURE__ */ new Map();
20002
+ this._group = new g.Group(), this._indexTree = new pp(), this._box = new g.Box3(), this._layers = /* @__PURE__ */ new Map();
19978
20003
  }
19979
20004
  /**
19980
20005
  * The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
@@ -20087,22 +20112,21 @@ class wp {
20087
20112
  */
20088
20113
  addEntity(e, t = !0) {
20089
20114
  if (!e.objectId)
20090
- throw new Error("[AcTrEntity] Object id is required to add one entity!");
20115
+ throw new Error("Object id is required to add one entity!");
20091
20116
  if (!e.layerName)
20092
- throw new Error("[AcTrEntity] Layer name is required to add one entity!");
20093
- const n = this.getLayer(e.layerName, !0);
20094
- if (n) {
20095
- n.addEntity(e);
20096
- const s = e.box;
20097
- t && this._box.union(s), this._indexTree.insert({
20098
- minX: s.min.x,
20099
- minY: s.min.y,
20100
- maxX: s.max.x,
20101
- maxY: s.max.y,
20102
- id: e.objectId
20103
- });
20104
- }
20105
- return this;
20117
+ throw new Error("Layer name is required to add one entity!");
20118
+ const n = this._layers.get(e.layerName);
20119
+ if (!n)
20120
+ throw new Error(`layer '${e.layerName}' doesn't exist!`);
20121
+ n.addEntity(e);
20122
+ const s = e.box;
20123
+ return t && this._box.union(s), this._indexTree.insert({
20124
+ minX: s.min.x,
20125
+ minY: s.min.y,
20126
+ maxX: s.max.x,
20127
+ maxY: s.max.y,
20128
+ id: e.objectId
20129
+ }), this;
20106
20130
  }
20107
20131
  /**
20108
20132
  * Remove the specified entity from this layout.
@@ -20121,11 +20145,32 @@ class wp {
20121
20145
  * @param entity - Input the entity to update
20122
20146
  * @returns Return true if update the specified entity successfully. Otherwise, return false.
20123
20147
  */
20124
- update(e) {
20148
+ updateEntity(e) {
20125
20149
  for (const [t, n] of this._layers)
20126
20150
  if (n.update(e)) return !0;
20127
20151
  return !1;
20128
20152
  }
20153
+ /**
20154
+ * Adds layer group into this layout. If the layer already exist, do nothing.
20155
+ *
20156
+ * @param name - Input layer name
20157
+ * @returns Return added layer group or the existing layer group in this layout if one layer
20158
+ * group already exists in this layout.
20159
+ */
20160
+ addLayer(e) {
20161
+ const t = e.name;
20162
+ let n = this._layers.get(t);
20163
+ return n === void 0 && (n = new bp(t), n.visible = !(e.isFrozen || e.isOff), this._layers.set(t, n), this._group.add(n.internalObject)), e;
20164
+ }
20165
+ /**
20166
+ * Updates layer group information (such as visibility). If the layer doesn't exist, do nothing.
20167
+ * @param layerName Input layer information
20168
+ * @returns Returns the updated layer group.
20169
+ */
20170
+ updateLayer(e) {
20171
+ const t = this._layers.get(e.name);
20172
+ return t && (t.visible = !(e.isFrozen || e.isOff)), t;
20173
+ }
20129
20174
  /**
20130
20175
  * Hover the specified entities.
20131
20176
  * Applies hover highlighting to the entities with the given IDs.
@@ -20208,20 +20253,8 @@ class wp {
20208
20253
  for (const [t, n] of this._layers)
20209
20254
  if (n.hasEntity(e)) return n;
20210
20255
  }
20211
- /**
20212
- * Get layer group by name. If the layer doesn't exist, create one layer group into this layout.
20213
- *
20214
- * @param name - Input layer name
20215
- * @param createIfNotExist - Input one flag to indicate whether to create layer group if it doesn't exist in
20216
- * this layout. Defaults to true.
20217
- * @returns Return matched layer, or undefined if not found and createIfNotExist is false
20218
- */
20219
- getLayer(e, t = !0) {
20220
- let n = this._layers.get(e);
20221
- return n === void 0 && t && (n = new xp(e), this._layers.set(e, n), this._group.add(n.internalObject)), n;
20222
- }
20223
20256
  }
20224
- class Sp {
20257
+ class wp {
20225
20258
  /**
20226
20259
  * Creates a new CAD scene instance.
20227
20260
  *
@@ -20307,8 +20340,10 @@ class Sp {
20307
20340
  * @returns Return the newly created empty layout
20308
20341
  */
20309
20342
  addEmptyLayout(e) {
20310
- const t = new wp();
20311
- return this._layouts.set(e, t), this._scene.add(t.internalObject), t.visible = e == this._activeLayoutBtrId, t;
20343
+ const t = new xp();
20344
+ return this._layouts.set(e, t), this._scene.add(t.internalObject), t.visible = e == this._activeLayoutBtrId, this._layers.forEach((n) => {
20345
+ t.addLayer(n);
20346
+ }), t;
20312
20347
  }
20313
20348
  /**
20314
20349
  * Clear scene
@@ -20317,19 +20352,7 @@ class Sp {
20317
20352
  clear() {
20318
20353
  return this._layouts.forEach((e) => {
20319
20354
  this._scene.remove(e.internalObject), e.clear();
20320
- }), this._layouts.clear(), this._scene.clear(), this;
20321
- }
20322
- /**
20323
- * Set layer's visibility
20324
- * @param layerName Input layer name
20325
- * @param visible Input visibility of the layer
20326
- */
20327
- setLayerVisibility(e, t) {
20328
- var s;
20329
- let n = !1;
20330
- return (s = this.activeLayout) == null || s.layers.forEach((i) => {
20331
- i.name === e && (i.visible = t, n = !0);
20332
- }), n;
20355
+ }), this._layouts.clear(), this._layers.clear(), this._scene.clear(), this;
20333
20356
  }
20334
20357
  /**
20335
20358
  * Hover the specified entities
@@ -20365,10 +20388,14 @@ class Sp {
20365
20388
  return t ? t == null ? void 0 : t.search(e) : [];
20366
20389
  }
20367
20390
  addLayer(e) {
20368
- this._layers.set(e.name, e);
20391
+ this._layers.set(e.name, e), this._layouts.forEach((t) => {
20392
+ t.addLayer(e);
20393
+ });
20369
20394
  }
20370
20395
  updateLayer(e) {
20371
- this._layers.set(e.name, e);
20396
+ this._layers.set(e.name, e), this._layouts.forEach((t) => {
20397
+ t.updateLayer(e);
20398
+ });
20372
20399
  }
20373
20400
  /**
20374
20401
  * Add one AutoCAD entity into this scene. If the layout associated with this entity doesn't exist,
@@ -20404,7 +20431,7 @@ class Sp {
20404
20431
  */
20405
20432
  update(e) {
20406
20433
  for (const [t, n] of this._layouts)
20407
- if (n.update(e)) return !0;
20434
+ if (n.updateEntity(e)) return !0;
20408
20435
  return !1;
20409
20436
  }
20410
20437
  setSnapObject(e) {
@@ -20413,10 +20440,10 @@ class Sp {
20413
20440
  }), this;
20414
20441
  }
20415
20442
  }
20416
- const zs = {
20443
+ const Ns = {
20417
20444
  background: 0
20418
20445
  };
20419
- class _p extends ua {
20446
+ class Sp extends ua {
20420
20447
  /**
20421
20448
  * Creates a new 2D CAD viewer instance.
20422
20449
  *
@@ -20425,16 +20452,16 @@ class _p extends ua {
20425
20452
  * @param options.calculateSizeCallback - Optional callback function to calculate canvas size on window resize
20426
20453
  * @param options.background - Optional background color as hex number (default: 0x000000)
20427
20454
  */
20428
- constructor(e = zs) {
20455
+ constructor(e = Ns) {
20429
20456
  const t = {
20430
- ...zs,
20457
+ ...Ns,
20431
20458
  ...e
20432
20459
  }, n = new g.WebGLRenderer({
20433
20460
  antialias: !0,
20434
20461
  alpha: !0,
20435
20462
  canvas: e.canvas
20436
20463
  });
20437
- t.canvas == null && (t.canvas = n.domElement), super(t.canvas), e.calculateSizeCallback && this.setCalculateSizeCallback(e.calculateSizeCallback), n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.setSize(this.width, this.height), this._renderer = new Qd(n);
20464
+ t.canvas == null && (t.canvas = n.domElement), super(t.canvas), e.calculateSizeCallback && this.setCalculateSizeCallback(e.calculateSizeCallback), n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.setSize(this.width, this.height), this._renderer = new Zd(n);
20438
20465
  const s = St.instance.fontMapping;
20439
20466
  this._renderer.setFontMapping(s), this._renderer.events.fontNotFound.addEventListener((i) => {
20440
20467
  Fe.emit("font-not-found", {
@@ -20451,7 +20478,7 @@ class _p extends ua {
20451
20478
  (i) => {
20452
20479
  this.activeLayoutBtrId = i.layout.blockTableRecordId;
20453
20480
  }
20454
- ), this._missedImages = /* @__PURE__ */ new Map(), this._layoutViewManager = new dp(), this.initialize(), this.onWindowResize(), this.animate(), this._isDirty = !0;
20481
+ ), this._missedImages = /* @__PURE__ */ new Map(), this._layoutViewManager = new up(), this.initialize(), this.onWindowResize(), this.animate(), this._isDirty = !0;
20455
20482
  }
20456
20483
  /**
20457
20484
  * Initializes the viewer after renderer and camera are created.
@@ -20607,7 +20634,7 @@ class _p extends ua {
20607
20634
  */
20608
20635
  zoomToFit() {
20609
20636
  if (this._scene.box) {
20610
- const e = op.threeBox3dToGeBox2d(this._scene.box);
20637
+ const e = ip.threeBox3dToGeBox2d(this._scene.box);
20611
20638
  this.zoomTo(e), this._isDirty = !0;
20612
20639
  }
20613
20640
  }
@@ -20654,7 +20681,7 @@ class _p extends ua {
20654
20681
  name: e.name,
20655
20682
  isFrozen: e.isFrozen,
20656
20683
  isOff: e.isOff
20657
- });
20684
+ }), this._isDirty = !0;
20658
20685
  }
20659
20686
  /**
20660
20687
  * @inheritdoc
@@ -20664,7 +20691,7 @@ class _p extends ua {
20664
20691
  name: e.name,
20665
20692
  isFrozen: e.isFrozen,
20666
20693
  isOff: e.isOff
20667
- });
20694
+ }), this._isDirty = !0;
20668
20695
  }
20669
20696
  /**
20670
20697
  * @inheritdoc
@@ -20689,7 +20716,7 @@ class _p extends ua {
20689
20716
  let t = [];
20690
20717
  Array.isArray(e) ? t = e : t.push(e);
20691
20718
  for (let n = 0; n < t.length; ++n) {
20692
- const s = t[n], i = s.draw(this._renderer, !0);
20719
+ const s = t[n], i = s.draw(this._renderer);
20693
20720
  i && (i.objectId = s.objectId, i.ownerId = s.ownerId, i.layerName = s.layer, i.visible = s.visibility, this._scene.update(i));
20694
20721
  }
20695
20722
  this._isDirty = !0, setTimeout(() => {
@@ -20700,7 +20727,7 @@ class _p extends ua {
20700
20727
  * @inheritdoc
20701
20728
  */
20702
20729
  addLayout(e) {
20703
- this._scene.addEmptyLayout(e.blockTableRecordId), this.createLayoutViewIfNeeded(e.blockTableRecordId);
20730
+ this._scene.addEmptyLayout(e.blockTableRecordId), this.createLayoutViewIfNeeded(e.blockTableRecordId), this._isDirty = !0;
20704
20731
  }
20705
20732
  /**
20706
20733
  * @inheritdoc
@@ -20720,12 +20747,6 @@ class _p extends ua {
20720
20747
  unhighlight(e) {
20721
20748
  this._isDirty = this._scene.unselect(e);
20722
20749
  }
20723
- /**
20724
- * @inheritdoc
20725
- */
20726
- setLayerVisibility(e, t) {
20727
- this._isDirty = this._scene.setLayerVisibility(e, t);
20728
- }
20729
20750
  /**
20730
20751
  * @inheritdoc
20731
20752
  */
@@ -20739,13 +20760,13 @@ class _p extends ua {
20739
20760
  this._isDirty = this._scene.unhover([e]);
20740
20761
  }
20741
20762
  createScene() {
20742
- const e = new Sp();
20763
+ const e = new wp();
20743
20764
  return e.layouts.forEach((t) => {
20744
20765
  t.setSnapObject(this.renderer.createObject());
20745
20766
  }), e;
20746
20767
  }
20747
20768
  createStats(e) {
20748
- const t = new Ko();
20769
+ const t = new Jo();
20749
20770
  document.body.appendChild(t.dom);
20750
20771
  const n = t.dom;
20751
20772
  return n.style.position = "fixed", n.style.inset = "unset", n.style.bottom = "30px", n.style.right = "0px", this.toggleStatsVisibility(t, e), t;
@@ -20759,7 +20780,7 @@ class _p extends ua {
20759
20780
  */
20760
20781
  createLayoutViewIfNeeded(e) {
20761
20782
  let t = this._layoutViewManager.getAt(e);
20762
- return t == null && (t = new up(
20783
+ return t == null && (t = new hp(
20763
20784
  this._renderer,
20764
20785
  e,
20765
20786
  this.width,
@@ -20788,31 +20809,48 @@ class _p extends ua {
20788
20809
  !0
20789
20810
  );
20790
20811
  if (s) {
20791
- s.objectId = n.objectId, s.ownerId = n.ownerId, s.layerName = n.layer, s.visible = n.visibility;
20792
- const i = !(n instanceof Ys || n instanceof Zs);
20793
- if (await s.draw().then(() => {
20794
- this._scene.addEntity(s, i), s.dispose(), this._isDirty = !0;
20795
- }), n instanceof qs) {
20812
+ if (s.objectId = n.objectId, s.ownerId = n.ownerId, s.layerName = n.layer, s.visible = n.visibility, s instanceof mn && !s.isOnTheSameLayer)
20813
+ this.handleGroup(s);
20814
+ else {
20815
+ const i = !(n instanceof Ys || n instanceof Zs);
20816
+ await s.draw().then(() => {
20817
+ this._scene.addEntity(s, i), s.dispose(), this._isDirty = !0;
20818
+ });
20819
+ }
20820
+ if (n instanceof qs) {
20796
20821
  if (n.number > 1) {
20797
- const o = this._layoutViewManager.getAt(n.ownerId);
20798
- if (o) {
20799
- const a = new dn(
20800
- o,
20822
+ const i = this._layoutViewManager.getAt(n.ownerId);
20823
+ if (i) {
20824
+ const o = new un(
20825
+ i,
20801
20826
  n.toGiViewport(),
20802
20827
  this._renderer
20803
20828
  );
20804
- o.addViewport(a);
20829
+ i.addViewport(o);
20805
20830
  }
20806
20831
  }
20807
20832
  } else if (n instanceof $s) {
20808
- const o = n.imageFileName;
20809
- o && this._missedImages.set(n.objectId, o);
20833
+ const i = n.imageFileName;
20834
+ i && this._missedImages.set(n.objectId, i);
20810
20835
  }
20811
20836
  }
20812
20837
  }
20813
20838
  }
20839
+ handleGroup(e) {
20840
+ const t = e.children, n = /* @__PURE__ */ new Map();
20841
+ t.forEach((c) => {
20842
+ var h;
20843
+ const l = c.userData.layerName;
20844
+ n.has(l) || n.set(l, []), (h = n.get(l)) == null || h.push(c);
20845
+ });
20846
+ const s = e.styleManager, i = e.objectId, o = e.layerName, a = e.box;
20847
+ n.forEach((c, l) => {
20848
+ const h = new re(s);
20849
+ h.applyMatrix4(e.matrix), h.objectId = i, h.ownerId = e.ownerId, h.layerName = l === "0" ? o : l, h.box = a, h.add(...c), this._scene.addEntity(h, !0), h.dispose();
20850
+ }), this._isDirty = !0;
20851
+ }
20814
20852
  }
20815
- class Tp {
20853
+ class _p {
20816
20854
  /**
20817
20855
  * Creates a new font loader instance.
20818
20856
  *
@@ -20864,7 +20902,7 @@ class Tp {
20864
20902
  });
20865
20903
  }
20866
20904
  }
20867
- class le {
20905
+ class he {
20868
20906
  /**
20869
20907
  * Private constructor for singleton pattern.
20870
20908
  *
@@ -20894,8 +20932,8 @@ class le {
20894
20932
  const n = () => ({
20895
20933
  width: window.innerWidth,
20896
20934
  height: window.innerHeight - 30
20897
- }), s = new _p({ canvas: e, calculateSizeCallback: n });
20898
- this._context = new Jo(s, t), this._fontLoader = new Tp(s.renderer), Xs().workingDatabase = t.database, this.registerCommands();
20935
+ }), s = new Sp({ canvas: e, calculateSizeCallback: n });
20936
+ this._context = new Ko(s, t), this._fontLoader = new _p(s.renderer), Xs().workingDatabase = t.database, this.registerCommands();
20899
20937
  }
20900
20938
  /**
20901
20939
  * Creates the singleton instance with an optional canvas element.
@@ -20913,7 +20951,7 @@ class le {
20913
20951
  * ```
20914
20952
  */
20915
20953
  static createInstance(e) {
20916
- return le._instance == null && (le._instance = new le(e)), this._instance;
20954
+ return he._instance == null && (he._instance = new he(e)), this._instance;
20917
20955
  }
20918
20956
  /**
20919
20957
  * Gets the singleton instance of the document manager.
@@ -20923,7 +20961,7 @@ class le {
20923
20961
  * @returns The singleton document manager instance
20924
20962
  */
20925
20963
  static get instance() {
20926
- return le._instance || (le._instance = new le()), le._instance;
20964
+ return he._instance || (he._instance = new he()), he._instance;
20927
20965
  }
20928
20966
  /**
20929
20967
  * Gets the current application context.
@@ -21091,39 +21129,39 @@ class le {
21091
21129
  * All commands are registered under the system command group.
21092
21130
  */
21093
21131
  registerCommands() {
21094
- const e = ce.instance;
21132
+ const e = le.instance;
21095
21133
  e.addCommand(
21096
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21134
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21097
21135
  "pan",
21098
21136
  "pan",
21099
21137
  new Ca()
21100
21138
  ), e.addCommand(
21101
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21139
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21102
21140
  "select",
21103
21141
  "select",
21104
21142
  new wa()
21105
21143
  ), e.addCommand(
21106
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21144
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21107
21145
  "zoom",
21108
21146
  "zoom",
21109
21147
  new Sa()
21110
21148
  ), e.addCommand(
21111
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21149
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21112
21150
  "zoomw",
21113
21151
  "zoomw",
21114
21152
  new Ta()
21115
21153
  ), e.addCommand(
21116
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21154
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21117
21155
  "csvg",
21118
21156
  "csvg",
21119
21157
  new va()
21120
21158
  ), e.addCommand(
21121
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21159
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21122
21160
  "qnew",
21123
21161
  "qnew",
21124
21162
  new xa()
21125
21163
  ), e.addCommand(
21126
- ce.SYSTEMT_COMMAND_GROUP_NAME,
21164
+ le.SYSTEMT_COMMAND_GROUP_NAME,
21127
21165
  "open",
21128
21166
  "open",
21129
21167
  new ba()
@@ -21144,7 +21182,7 @@ class le {
21144
21182
  * ```
21145
21183
  */
21146
21184
  sendStringToExecute(e) {
21147
- const n = ce.instance.lookupGlobalCmd(e);
21185
+ const n = le.instance.lookupGlobalCmd(e);
21148
21186
  n == null || n.execute(this.context);
21149
21187
  }
21150
21188
  /**
@@ -21183,7 +21221,7 @@ class le {
21183
21221
  const t = this.context.doc;
21184
21222
  this.events.documentActivated.dispatch({ doc: t }), this.setActiveLayout();
21185
21223
  const n = t.database;
21186
- this.curView.zoomTo(new ue(n.extmin, n.extmax));
21224
+ this.curView.zoomTo(new de(n.extmin, n.extmax));
21187
21225
  }
21188
21226
  }
21189
21227
  /**
@@ -21201,7 +21239,7 @@ class le {
21201
21239
  return e == null ? e = { fontLoader: this._fontLoader } : e.fontLoader == null && (e.fontLoader = this._fontLoader), e;
21202
21240
  }
21203
21241
  }
21204
- class Ns {
21242
+ class zs {
21205
21243
  convert(e) {
21206
21244
  const t = this.createEntity(e);
21207
21245
  return t && this.processCommonAttrs(e, t), t;
@@ -21339,7 +21377,7 @@ class Ns {
21339
21377
  let d = c.startAngle, u = c.endAngle;
21340
21378
  const p = Math.atan2(c.end.y, c.end.x);
21341
21379
  c.isCCW || (d = Math.PI * 2 - d, u = Math.PI * 2 - u), o.add(
21342
- new Ao(
21380
+ new Lo(
21343
21381
  { ...c.center, z: 0 },
21344
21382
  l,
21345
21383
  h,
@@ -21382,7 +21420,7 @@ class Ns {
21382
21420
  }), n;
21383
21421
  }
21384
21422
  convertTable(e) {
21385
- const t = new Lo(
21423
+ const t = new Ao(
21386
21424
  e.name,
21387
21425
  e.rowCount,
21388
21426
  e.columnCount
@@ -21439,7 +21477,7 @@ class Ns {
21439
21477
  );
21440
21478
  return this.processDimensionCommonAttrs(e, n), n;
21441
21479
  } else if (e.subclassMarker == "AcDbDiametricDimension") {
21442
- const t = e, n = new zo(
21480
+ const t = e, n = new No(
21443
21481
  t.definitionPoint,
21444
21482
  t.centerPoint,
21445
21483
  t.leaderLength
@@ -21449,7 +21487,7 @@ class Ns {
21449
21487
  return null;
21450
21488
  }
21451
21489
  processImage(e, t) {
21452
- t.position.copy(e.position), t.brightness = e.brightness, t.contrast = e.contrast, t.fade = e.fade, t.imageDefId = e.imageDefHandle.toString(), t.isClipped = (e.flags | 4) > 0, t.isImageShown = (e.flags | 3) > 0, t.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((n) => {
21490
+ t.position.copy(e.position), t.brightness = e.brightness, t.contrast = e.contrast, t.fade = e.fade, t.imageDefId = e.imageDefHandle.toString(), t.isClipped = e.clipping > 0, t.isShownClipped = (e.flags | 4) > 0, t.isImageShown = (e.flags | 3) > 0, t.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((n) => {
21453
21491
  t.clipBoundary.push(new H(n));
21454
21492
  }), t.clipBoundaryType = e.clippingBoundaryType, t.width = Math.sqrt(
21455
21493
  e.uPixel.x ** 2 + e.uPixel.y ** 2 + e.uPixel.z ** 2
@@ -21462,7 +21500,7 @@ class Ns {
21462
21500
  return this.processImage(e, t), t;
21463
21501
  }
21464
21502
  convertWipeout(e) {
21465
- const t = new No();
21503
+ const t = new zo();
21466
21504
  return this.processImage(e, t), t;
21467
21505
  }
21468
21506
  convertViewport(e) {
@@ -21488,7 +21526,7 @@ class Ns {
21488
21526
  t.layer = e.layer, t.objectId = e.handle.toString(), t.ownerId = e.ownerBlockRecordSoftId.toString(), e.lineType != null && (t.lineType = e.lineType), e.lineweight != null && (t.lineWeight = e.lineweight), e.lineTypeScale != null && (t.linetypeScale = e.lineTypeScale), e.color != null && (t.color.color = e.color), e.colorIndex != null && (t.color.colorIndex = e.colorIndex), e.colorName != null && (t.color.colorName = e.colorName), e.isVisible != null && (t.visibility = e.isVisible), e.transparency != null && (t.transparency = e.transparency);
21489
21527
  }
21490
21528
  }
21491
- class Cp extends lo {
21529
+ class Tp extends lo {
21492
21530
  constructor(e = {}) {
21493
21531
  super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
21494
21532
  }
@@ -21678,7 +21716,7 @@ class Cp extends lo {
21678
21716
  processBlocks(e, t) {
21679
21717
  }
21680
21718
  async processEntitiesInBlock(e, t) {
21681
- const n = new Ns(), s = e.length, i = [];
21719
+ const n = new zs(), s = e.length, i = [];
21682
21720
  for (let o = 0; o < s; o++) {
21683
21721
  const a = e[o], c = n.convert(a);
21684
21722
  c && i.push(c);
@@ -21691,7 +21729,7 @@ class Cp extends lo {
21691
21729
  * smaller pieces and executed in small intervals to allow the UI to remain responsive.
21692
21730
  */
21693
21731
  async processEntities(e, t, n, s, i) {
21694
- const o = new Ns();
21732
+ const o = new zs();
21695
21733
  let a = e.entities;
21696
21734
  const c = a.length, l = new vo(
21697
21735
  c,
@@ -21767,7 +21805,7 @@ class Cp extends lo {
21767
21805
  return n.flatMap((s) => t[s]);
21768
21806
  }
21769
21807
  }
21770
- function kp() {
21808
+ function Cp() {
21771
21809
  try {
21772
21810
  const r = new Ho({
21773
21811
  convertByEntityType: !1,
@@ -21779,7 +21817,7 @@ function kp() {
21779
21817
  console.error("Failed to register dxf converter: ", r);
21780
21818
  }
21781
21819
  try {
21782
- const r = new Cp({
21820
+ const r = new Tp({
21783
21821
  convertByEntityType: !1,
21784
21822
  useWorker: !0,
21785
21823
  parserWorkerUrl: "./assets/libredwg-parser-worker.js"
@@ -21790,11 +21828,11 @@ function kp() {
21790
21828
  }
21791
21829
  }
21792
21830
  function Gp() {
21793
- kp(), typeof window < "u" && !!window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? un.getInstance().initialize(
21831
+ Cp(), typeof window < "u" && !!window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? hn.getInstance().initialize(
21794
21832
  "/assets/mtext-renderer-worker.js"
21795
- ) : un.getInstance().initialize("./mtext-renderer-worker.js");
21833
+ ) : hn.getInstance().initialize("./mtext-renderer-worker.js");
21796
21834
  }
21797
- const Ip = {
21835
+ const kp = {
21798
21836
  isDebug: !1,
21799
21837
  isShowCommandLine: !0,
21800
21838
  isShowCoordinate: !0,
@@ -21992,13 +22030,13 @@ class St {
21992
22030
  */
21993
22031
  get settings() {
21994
22032
  const e = localStorage.getItem(Vs), t = e == null ? {} : JSON.parse(e);
21995
- return Qo(t, Ip);
22033
+ return Qo(t, kp);
21996
22034
  }
21997
22035
  }
21998
22036
  export {
21999
- Jo as AcApContext,
22037
+ Ko as AcApContext,
22000
22038
  va as AcApConvertToSvgCmd,
22001
- le as AcApDocManager,
22039
+ he as AcApDocManager,
22002
22040
  da as AcApDocument,
22003
22041
  ba as AcApOpenCmd,
22004
22042
  Ca as AcApPanCmd,
@@ -22010,17 +22048,17 @@ export {
22010
22048
  _a as AcApZoomToBoxJig,
22011
22049
  ua as AcEdBaseView,
22012
22050
  Xe as AcEdCommand,
22013
- ce as AcEdCommandStack,
22051
+ le as AcEdCommandStack,
22014
22052
  Et as AcEdCorsorType,
22015
22053
  na as AcEdCursorManager,
22016
22054
  sa as AcEdJig,
22017
22055
  ha as AcEdSelectionSet,
22018
22056
  De as AcEdViewMode,
22019
22057
  la as AcEditor,
22020
- _p as AcTrView2d,
22021
- zs as DEFAULT_VIEW_2D_OPTIONS,
22022
- Dp as acedAlert,
22058
+ Sp as AcTrView2d,
22059
+ Ns as DEFAULT_VIEW_2D_OPTIONS,
22060
+ Op as acedAlert,
22023
22061
  Fe as eventBus,
22024
- kp as registerConverters,
22062
+ Cp as registerConverters,
22025
22063
  Gp as registerWorkers
22026
22064
  };