@nebula-spatial/viewer 0.5.13 → 0.5.14

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.
@@ -1,25 +1,26 @@
1
- import { DataTexture as ne, LinearMipmapLinearFilter as ke, LinearFilter as Xe, Loader as J, LoaderUtils as _e, FileLoader as Ve, TextureLoader as Me, RepeatWrapping as ue, ClampToEdgeWrapping as pe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Se, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ge, Matrix4 as L, Group as ce, Bone as fe, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as Ne, PointLight as he, MathUtils as B, SpotLight as $e, DirectionalLight as ze, SkinnedMesh as je, Mesh as Fe, LineBasicMaterial as He, Line as We, Vector3 as V, Skeleton as Ye, AmbientLight as qe, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ke, Matrix3 as Ze, Vector2 as Qe, ShapeUtils as Je, Vector4 as et, Euler as z, AnimationClip as tt, Quaternion as G, VectorKeyframeTrack as nt, QuaternionKeyframeTrack as de, NumberKeyframeTrack as rt, LoadingManager as st, LinearSRGBColorSpace as me, RGBAFormat as Ie, UnsignedByteType as Ae, NoColorSpace as at, MeshPhysicalMaterial as De, Box3 as ot } from "three";
1
+ import { DataTexture as ne, LinearMipmapLinearFilter as ke, LinearFilter as Xe, Loader as J, LoaderUtils as _e, FileLoader as Ve, TextureLoader as Me, RepeatWrapping as ue, ClampToEdgeWrapping as pe, Texture as Y, MeshPhongMaterial as W, MeshLambertMaterial as Se, ColorManagement as N, Color as k, SRGBColorSpace as X, EquirectangularReflectionMapping as Ge, Matrix4 as L, Group as ce, Bone as fe, PropertyBinding as ee, Object3D as Z, PerspectiveCamera as Ne, PointLight as he, MathUtils as B, SpotLight as $e, DirectionalLight as ze, SkinnedMesh as je, Mesh as Fe, LineBasicMaterial as He, Line as We, Vector3 as V, Skeleton as Ye, AmbientLight as qe, BufferGeometry as re, Float32BufferAttribute as j, Uint16BufferAttribute as Ke, Matrix3 as Ze, Vector2 as Qe, ShapeUtils as Je, Vector4 as et, Euler as z, AnimationClip as tt, Quaternion as G, VectorKeyframeTrack as nt, QuaternionKeyframeTrack as de, NumberKeyframeTrack as rt, LoadingManager as st, LinearSRGBColorSpace as me, RGBAFormat as Ie, UnsignedByteType as Ae, NoColorSpace as at, MeshPhysicalMaterial as Re, Box3 as ot } from "three";
2
2
  import { DRACOLoader as it } from "three/examples/jsm/loaders/DRACOLoader.js";
3
3
  import { GLTFLoader as lt } from "three/examples/jsm/loaders/GLTFLoader.js";
4
- import { D as ct } from "./index-DbJbq4N_.js";
5
- import { d as ge, a as ye, S as ut } from "./stage-PhbBBoMY.js";
4
+ import { D as ct } from "./index-BSDalKkd.js";
5
+ import { d as ge, a as ye, S as ut } from "./stage-CvP0yaff.js";
6
6
  import { TGALoader as pt } from "three/examples/jsm/loaders/TGALoader.js";
7
7
  import * as ft from "three/examples/jsm/libs/fflate.module.js";
8
8
  import { unzlibSync as ht } from "three/examples/jsm/libs/fflate.module.js";
9
9
  import { NURBSCurve as dt } from "three/examples/jsm/curves/NURBSCurve.js";
10
10
  import { disposeModelResources as we } from "./resources-CHhCm2f7.js";
11
- const mt = 16 * 1024 * 1024;
12
- function Re(i, e) {
13
- if (!i || !e || i * e > mt) throw new Error("Invalid or oversized image dimensions (maximum 16M pixels).");
11
+ import { r as mt } from "./runtime-paths-Dj0itY6G.js";
12
+ const gt = 16 * 1024 * 1024;
13
+ function De(i, e) {
14
+ if (!i || !e || i * e > gt) throw new Error("Invalid or oversized image dimensions (maximum 16M pixels).");
14
15
  }
15
16
  function $(i, e, t) {
16
17
  if (e < 0 || t < 0 || e + t > i.length) throw new Error("Truncated image payload.");
17
18
  }
18
- function gt(i) {
19
+ function yt(i) {
19
20
  const e = new Uint8Array(i);
20
21
  $(e, 0, 18);
21
22
  const t = new DataView(i), n = e[2], r = e[16], s = t.getUint16(12, !0), a = t.getUint16(14, !0);
22
- if (Re(s, a), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
23
+ if (De(s, a), e[1] !== 0 || ![2, 3, 10, 11].includes(n) || !([3, 11].includes(n) ? [8, 16] : [24, 32]).includes(r) || e[17] & 192)
23
24
  throw new Error("Unsupported TGA: require non-interleaved 24/32-bit true-color or 8/16-bit grayscale.");
24
25
  let o = 18 + e[0];
25
26
  $(e, 18, e[0]);
@@ -41,13 +42,13 @@ function ve(i) {
41
42
  const e = i >>> 11 & 31, t = i >>> 5 & 63, n = i & 31;
42
43
  return [e << 3 | e >>> 2, t << 2 | t >>> 4, n << 3 | n >>> 2, 255];
43
44
  }
44
- function yt(i) {
45
+ function wt(i) {
45
46
  const e = new Uint8Array(i);
46
47
  $(e, 0, 128);
47
48
  const t = new DataView(i), n = (h) => t.getUint32(h, !0);
48
49
  if (n(0) !== 542327876 || n(4) !== 124 || n(76) !== 32) throw new Error("Invalid DDS header.");
49
50
  const r = n(16), s = n(12);
50
- if (Re(r, s), n(112) & 2162176 || n(24) > 1) throw new Error("DDS cubemap/volume textures are unsupported.");
51
+ if (De(r, s), n(112) & 2162176 || n(24) > 1) throw new Error("DDS cubemap/volume textures are unsupported.");
51
52
  const a = n(80), o = String.fromCharCode(...e.subarray(84, 88)), l = (a & 4) !== 0;
52
53
  if (l && !["DXT1", "DXT3", "DXT5"].includes(o)) throw new Error(`Unsupported DDS FourCC: ${o}. Require DXT1/DXT3/DXT5.`);
53
54
  const p = new Uint8Array(r * s * 4);
@@ -79,21 +80,21 @@ function yt(i) {
79
80
  if (v >= r || S >= s) continue;
80
81
  const E = y[I >>> 2 * M & 3], b = (S * r + v) * 4;
81
82
  if (p.set(E, b), o === "DXT3" && (p[b + 3] = (e[g + Math.floor(M / 2)] >>> M % 2 * 4 & 15) * 17), o === "DXT5") {
82
- const D = M * 3, w = g + 2 + Math.floor(D / 8), R = e[w] | (w + 1 < g + 8 ? e[w + 1] : 0) << 8;
83
- p[b + 3] = A[R >>> D % 8 & 7];
83
+ const R = M * 3, w = g + 2 + Math.floor(R / 8), D = e[w] | (w + 1 < g + 8 ? e[w + 1] : 0) << 8;
84
+ p[b + 3] = A[D >>> R % 8 & 7];
84
85
  }
85
86
  }
86
87
  }
87
88
  return { data: p, width: r, height: s };
88
89
  }
89
- function wt(i, e) {
90
- const t = e === "tga" ? gt(i) : yt(i), n = new Uint8Array(t.data.length), r = t.width * 4;
90
+ function vt(i, e) {
91
+ const t = e === "tga" ? yt(i) : wt(i), n = new Uint8Array(t.data.length), r = t.width * 4;
91
92
  for (let a = 0; a < t.height; a++) n.set(t.data.subarray(a * r, (a + 1) * r), (t.height - 1 - a) * r);
92
93
  const s = new ne(n, t.width, t.height);
93
94
  return s.flipY = !1, s.generateMipmaps = !0, s.minFilter = ke, s.magFilter = Xe, s.needsUpdate = !0, s;
94
95
  }
95
96
  let C, O, U;
96
- class vt extends J {
97
+ class Tt extends J {
97
98
  /**
98
99
  * Constructs a new FBX loader.
99
100
  *
@@ -129,27 +130,27 @@ class vt extends J {
129
130
  * @return {Group} An object representing the parsed asset.
130
131
  */
131
132
  parse(e, t) {
132
- if (St(e))
133
- C = new Mt().parse(e);
133
+ if (Ft(e))
134
+ C = new St().parse(e);
134
135
  else {
135
136
  const r = Le(e);
136
- if (!Ft(r))
137
+ if (!It(r))
137
138
  throw new Error("THREE.FBXLoader: Unknown format.");
138
139
  if (xe(r) < 7e3)
139
140
  throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + xe(r));
140
- C = new bt().parse(r);
141
+ C = new Mt().parse(r);
141
142
  }
142
143
  const n = new Me(this.manager).setPath(this.resourcePath || t).setCrossOrigin(this.crossOrigin);
143
- return new Tt(n, this.manager).parse(C);
144
+ return new xt(n, this.manager).parse(C);
144
145
  }
145
146
  }
146
- class Tt {
147
+ class xt {
147
148
  constructor(e, t) {
148
149
  this.textureLoader = e, this.manager = t;
149
150
  }
150
151
  parse() {
151
152
  O = this.parseConnections();
152
- const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), r = this.parseDeformers(), s = new xt().parse(r);
153
+ const e = this.parseImages(), t = this.parseTextures(e), n = this.parseMaterials(t), r = this.parseDeformers(), s = new Et().parse(r);
153
154
  return this.parseScene(r, s, n), U;
154
155
  }
155
156
  // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry )
@@ -441,7 +442,7 @@ class Tt {
441
442
  l.applyMatrix4(p), l.updateWorldMatrix();
442
443
  }
443
444
  });
444
- const o = new Et().parse();
445
+ const o = new bt().parse();
445
446
  U.children.length === 1 && U.children[0].isGroup && (U.children[0].animations = o, U = U.children[0]), U.animations = o;
446
447
  }
447
448
  // parse nodes in FBXTree.Objects.Model
@@ -658,7 +659,7 @@ class Tt {
658
659
  }
659
660
  }
660
661
  }
661
- class xt {
662
+ class Et {
662
663
  constructor() {
663
664
  this.negativeMaterialIndices = !1;
664
665
  }
@@ -772,8 +773,8 @@ class xt {
772
773
  x.forEach(function(S, E, b) {
773
774
  if (M > S) {
774
775
  b[E] = M, M = S;
775
- const D = y[E];
776
- y[E] = v, v = D;
776
+ const R = y[E];
777
+ y[E] = v, v = R;
777
778
  }
778
779
  });
779
780
  }), T = y, F = x;
@@ -949,7 +950,7 @@ class xt {
949
950
  return new re().setFromPoints(f);
950
951
  }
951
952
  }
952
- class Et {
953
+ class bt {
953
954
  // take raw animation clips and turn them into three.js animation clips
954
955
  parse() {
955
956
  const e = [], t = this.parseClips();
@@ -993,7 +994,7 @@ class Et {
993
994
  for (const n in t) {
994
995
  const r = {
995
996
  id: t[n].id,
996
- times: t[n].KeyTime.a.map(It),
997
+ times: t[n].KeyTime.a.map(At),
997
998
  values: t[n].KeyValueFloat.a
998
999
  }, s = O.get(r.id);
999
1000
  if (s !== void 0) {
@@ -1202,7 +1203,7 @@ class Et {
1202
1203
  return [s, a];
1203
1204
  }
1204
1205
  }
1205
- class bt {
1206
+ class Mt {
1206
1207
  getPrevNode() {
1207
1208
  return this.nodeStack[this.currentIndent - 2];
1208
1209
  }
@@ -1297,7 +1298,7 @@ class bt {
1297
1298
  }, this.setCurrentProp(this.getPrevNode(), s);
1298
1299
  }
1299
1300
  }
1300
- class Mt {
1301
+ class St {
1301
1302
  parse(e) {
1302
1303
  const t = new Te(e);
1303
1304
  t.skip(23);
@@ -1525,11 +1526,11 @@ class Pe {
1525
1526
  this[e] = t;
1526
1527
  }
1527
1528
  }
1528
- function St(i) {
1529
+ function Ft(i) {
1529
1530
  const e = "Kaydara FBX Binary \0";
1530
1531
  return i.byteLength >= e.length && e === Le(i, 0, e.length);
1531
1532
  }
1532
- function Ft(i) {
1533
+ function It(i) {
1533
1534
  const e = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"];
1534
1535
  let t = 0;
1535
1536
  function n(r) {
@@ -1547,10 +1548,10 @@ function xe(i) {
1547
1548
  return parseInt(t[1]);
1548
1549
  throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.");
1549
1550
  }
1550
- function It(i) {
1551
+ function At(i) {
1551
1552
  return i / 46186158e3;
1552
1553
  }
1553
- const At = [];
1554
+ const Rt = [];
1554
1555
  function Q(i, e, t, n) {
1555
1556
  let r;
1556
1557
  switch (n.mappingType) {
@@ -1571,7 +1572,7 @@ function Q(i, e, t, n) {
1571
1572
  }
1572
1573
  n.referenceType === "IndexToDirect" && (r = n.indices[r]);
1573
1574
  const s = r * n.dataSize, a = s + n.dataSize;
1574
- return Rt(At, n.buffer, s, a);
1575
+ return Pt(Rt, n.buffer, s, a);
1575
1576
  }
1576
1577
  const se = new z(), H = new V();
1577
1578
  function Ce(i) {
@@ -1601,7 +1602,7 @@ function Ce(i) {
1601
1602
  else if (h === 1)
1602
1603
  I.copy(d).multiply(y).multiply(g).multiply(x);
1603
1604
  else {
1604
- const D = new L().scale(new V().setFromMatrixScale(u)).clone().invert(), w = y.clone().multiply(D);
1605
+ const R = new L().scale(new V().setFromMatrixScale(u)).clone().invert(), w = y.clone().multiply(R);
1605
1606
  I.copy(d).multiply(g).multiply(w).multiply(x);
1606
1607
  }
1607
1608
  const A = p.clone().invert(), M = a.clone().invert();
@@ -1640,12 +1641,12 @@ function Dt(i, e) {
1640
1641
  for (let t = 0, n = i.length, r = e.length; t < r; t++, n++)
1641
1642
  i[n] = e[t];
1642
1643
  }
1643
- function Rt(i, e, t, n) {
1644
+ function Pt(i, e, t, n) {
1644
1645
  for (let r = t, s = 0; r < n; r++, s++)
1645
1646
  i[s] = e[r];
1646
1647
  return i;
1647
1648
  }
1648
- async function Pt(i, e, t) {
1649
+ async function Ct(i, e, t) {
1649
1650
  e.signal.throwIfAborted();
1650
1651
  const n = new AbortController(), r = n.signal, s = () => n.abort(e.signal.reason);
1651
1652
  e.signal.addEventListener("abort", s, { once: !0 });
@@ -1669,10 +1670,10 @@ async function Pt(i, e, t) {
1669
1670
  const x = T(y[0] ?? g), I = e.original;
1670
1671
  if (typeof I == "object" && I !== null && "kind" in I && I.kind === "files") {
1671
1672
  const M = ((A = e.entryPath) == null ? void 0 : A.replace(/[^/]*$/, "")) ?? "", v = (b) => {
1672
- const D = [];
1673
+ const R = [];
1673
1674
  for (const w of T(b).split("/"))
1674
- w === ".." ? D.pop() : w && w !== "." && D.push(w);
1675
- return D.join("/");
1675
+ w === ".." ? R.pop() : w && w !== "." && R.push(w);
1676
+ return R.join("/");
1676
1677
  }, S = I.files.filter((b) => v(b.path) === v(M + x));
1677
1678
  if (S.length === 1) return e.resolve(S[0].path);
1678
1679
  const E = I.files.filter((b) => v(b.path).split("/").pop() === x.split("/").pop());
@@ -1701,7 +1702,7 @@ async function Pt(i, e, t) {
1701
1702
  r.throwIfAborted();
1702
1703
  let E;
1703
1704
  try {
1704
- E = wt(S, this.binaryFormat);
1705
+ E = vt(S, this.binaryFormat);
1705
1706
  } catch (b) {
1706
1707
  throw new Error(`FBX texture decode failed (${this.binaryFormat}): ${d}: ${String(b)}`, { cause: b });
1707
1708
  }
@@ -1711,8 +1712,8 @@ async function Pt(i, e, t) {
1711
1712
  const v = URL.createObjectURL(await M.blob());
1712
1713
  try {
1713
1714
  const S = new Me().loadAsync(v).catch((b) => {
1714
- const D = b instanceof Error ? `: ${b.message}` : "";
1715
- throw new Error(`FBX texture decode failed: ${d}${D}`, { cause: b });
1715
+ const R = b instanceof Error ? `: ${b.message}` : "";
1716
+ throw new Error(`FBX texture decode failed: ${d}${R}`, { cause: b });
1716
1717
  }), E = await a(S, (b) => {
1717
1718
  b.dispose();
1718
1719
  });
@@ -1731,7 +1732,7 @@ async function Pt(i, e, t) {
1731
1732
  u.addHandler(/\.tga$/i, new h("tga")), u.addHandler(/\.dds$/i, new h("dds")), u.addHandler(/.*/, new h());
1732
1733
  let m;
1733
1734
  try {
1734
- return m = new vt(u).parse(i, ""), await Promise.all(o), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1735
+ return m = new Tt(u).parse(i, ""), await Promise.all(o), e.signal.throwIfAborted(), { root: m, textures: l, textureFailures: f };
1735
1736
  } catch (g) {
1736
1737
  if (n.abort(g), await Promise.allSettled(o), m) {
1737
1738
  const { disposeModelResources: d } = await import("./resources-CHhCm2f7.js");
@@ -1743,29 +1744,29 @@ async function Pt(i, e, t) {
1743
1744
  for (const g of p) URL.revokeObjectURL(g);
1744
1745
  }
1745
1746
  }
1746
- const oe = "Kaydara FBX Binary \0", Ct = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Lt = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1747
- function Ot(i) {
1747
+ const oe = "Kaydara FBX Binary \0", Lt = /(?:^|[\r\n])\s*P:\s*"UpAxis"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i, Ot = /(?:^|[\r\n])\s*P:\s*"UpAxisSign"\s*,\s*"int"\s*,\s*"Integer"\s*,\s*""\s*,\s*(-?\d+)/i;
1748
+ function Ut(i) {
1748
1749
  try {
1749
- const e = new Uint8Array(i), t = Ut(e) ? kt(i) : Bt(new TextDecoder().decode(e));
1750
+ const e = new Uint8Array(i), t = Bt(e) ? Xt(i) : kt(new TextDecoder().decode(e));
1750
1751
  return !t || t.sign !== 1 ? null : t.axis === 1 ? "y" : t.axis === 2 ? "z" : null;
1751
1752
  } catch {
1752
1753
  return null;
1753
1754
  }
1754
1755
  }
1755
- function Ut(i) {
1756
+ function Bt(i) {
1756
1757
  if (i.byteLength < oe.length) return !1;
1757
1758
  for (let e = 0; e < oe.length; e += 1)
1758
1759
  if (i[e] !== oe.charCodeAt(e)) return !1;
1759
1760
  return !0;
1760
1761
  }
1761
- function Bt(i) {
1762
+ function kt(i) {
1762
1763
  var r, s;
1763
- const e = Number.parseInt(((r = Ct.exec(i)) == null ? void 0 : r[1]) ?? "", 10);
1764
+ const e = Number.parseInt(((r = Lt.exec(i)) == null ? void 0 : r[1]) ?? "", 10);
1764
1765
  if (!Number.isInteger(e)) return null;
1765
- const t = (s = Lt.exec(i)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1766
+ const t = (s = Ot.exec(i)) == null ? void 0 : s[1], n = t === void 0 ? 1 : Number.parseInt(t, 10);
1766
1767
  return Number.isInteger(n) ? { axis: e, sign: n } : null;
1767
1768
  }
1768
- function kt(i) {
1769
+ function Xt(i) {
1769
1770
  const e = new DataView(i);
1770
1771
  if (e.byteLength < 27) return null;
1771
1772
  const t = e.getUint32(23, !0) >= 7500;
@@ -1806,7 +1807,7 @@ function K(i, e, t, n) {
1806
1807
  if (n) {
1807
1808
  let m = f;
1808
1809
  for (let g = 0; g < a; g += 1) {
1809
- const d = Xt(i, m);
1810
+ const d = _t(i, m);
1810
1811
  if (h.push(d.value), m = d.nextOffset, m > u) return null;
1811
1812
  }
1812
1813
  }
@@ -1818,7 +1819,7 @@ function ie(i, e, t) {
1818
1819
  if (n > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error("FBX offset exceeds the safe integer range.");
1819
1820
  return Number(n);
1820
1821
  }
1821
- function Xt(i, e) {
1822
+ function _t(i, e) {
1822
1823
  const t = String.fromCharCode(i.getUint8(e));
1823
1824
  switch (t) {
1824
1825
  case "Y":
@@ -1852,9 +1853,9 @@ function Xt(i, e) {
1852
1853
  }
1853
1854
  }
1854
1855
  const te = /* @__PURE__ */ new Set(["Definitions", "ObjectType", "PropertyTemplate", "Objects", "Material", "Properties70", "Connections", "Texture", "Video", "Geometry", "LayerElementUV", "LayeredTexture", "BlendModes", "Alphas"]), Ue = /* @__PURE__ */ new Set(["P", "C", "RelativeFilename", "FileName", "Filename", "ShadingModel", "UVSet", "Scaling", "Translation", "Rotation", "RotationPivot", "ScalingPivot", "Name", "UV", "a"]);
1855
- function _t(i) {
1856
+ function Vt(i) {
1856
1857
  var F, y, x, I, A, M;
1857
- const e = new Uint8Array(i), n = new TextDecoder().decode(e.subarray(0, 21)) === "Kaydara FBX Binary \0" ? Vt(i) : Gt(new TextDecoder().decode(e)), r = (v) => {
1858
+ const e = new Uint8Array(i), n = new TextDecoder().decode(e.subarray(0, 21)) === "Kaydara FBX Binary \0" ? Gt(i) : Nt(new TextDecoder().decode(e)), r = (v) => {
1858
1859
  var S;
1859
1860
  return new Map(
1860
1861
  (((S = v == null ? void 0 : v.children.find((E) => E.name === "Properties70")) == null ? void 0 : S.children) ?? []).filter((E) => E.name === "P" && typeof E.values[0] == "string").map((E) => [E.values[0], E.values.slice(4)])
@@ -1864,17 +1865,17 @@ function _t(i) {
1864
1865
  return (E = v == null ? void 0 : v.children.find((b) => b.name === S)) == null ? void 0 : E.values[0];
1865
1866
  };
1866
1867
  for (const v of p.filter((S) => S.name === "Texture")) {
1867
- const S = Number(v.values[0]), E = (x = l.find((P) => P.values[0] === "OO" && P.values[2] === S)) == null ? void 0 : x.values[1], b = p.find((P) => P.name === "Video" && P.values[0] === E), D = String(u(b, "RelativeFilename") || u(v, "RelativeFilename") || u(b, "Filename") || u(v, "FileName") || ""), w = r(v);
1868
+ const S = Number(v.values[0]), E = (x = l.find((P) => P.values[0] === "OO" && P.values[2] === S)) == null ? void 0 : x.values[1], b = p.find((P) => P.name === "Video" && P.values[0] === E), R = String(u(b, "RelativeFilename") || u(v, "RelativeFilename") || u(b, "Filename") || u(v, "FileName") || ""), w = r(v);
1868
1869
  for (const P of ["Scaling", "Translation", "Rotation", "RotationPivot", "ScalingPivot"]) {
1869
1870
  const _ = (I = v.children.find((Be) => Be.name === P)) == null ? void 0 : I.values;
1870
1871
  _ && w.set(P, _);
1871
1872
  }
1872
- const R = u(v, "UVSet") ?? ((A = w.get("UVSet")) == null ? void 0 : A[0]);
1873
- f.set(S, { id: S, path: D, values: w, uvSet: typeof R == "string" ? R : null });
1873
+ const D = u(v, "UVSet") ?? ((A = w.get("UVSet")) == null ? void 0 : A[0]);
1874
+ f.set(S, { id: S, path: R, values: w, uvSet: typeof D == "string" ? D : null });
1874
1875
  }
1875
1876
  const c = /* @__PURE__ */ new Map(), h = (v, S) => {
1876
- var D;
1877
- const E = v.children.find((w) => w.name === S), b = ((D = E == null ? void 0 : E.children.find((w) => w.name === "a")) == null ? void 0 : D.values) ?? (E == null ? void 0 : E.values) ?? [];
1877
+ var R;
1878
+ const E = v.children.find((w) => w.name === S), b = ((R = E == null ? void 0 : E.children.find((w) => w.name === "a")) == null ? void 0 : R.values) ?? (E == null ? void 0 : E.values) ?? [];
1878
1879
  if (b.some((w) => typeof w != "number" || !Number.isFinite(w))) throw new Error(`Invalid FBX layered ${S}.`);
1879
1880
  return b;
1880
1881
  };
@@ -1894,14 +1895,14 @@ function _t(i) {
1894
1895
  if (v.name !== "Material") continue;
1895
1896
  const S = v.values[0];
1896
1897
  if (typeof S != "number" || !Number.isSafeInteger(S)) throw new Error("Invalid FBX material ID.");
1897
- const E = r(v), b = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), D = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => ({ id: Number(P.values[1]), role: String(P.values[3]) })), w = String(u(v, "ShadingModel") ?? "phong").toLowerCase(), R = r(o.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1898
+ const E = r(v), b = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => String(P.values[3])), R = l.filter((P) => P.values[0] === "OP" && P.values[2] === S).map((P) => ({ id: Number(P.values[1]), role: String(P.values[3]) })), w = String(u(v, "ShadingModel") ?? "phong").toLowerCase(), D = r(o.find((P) => String(P.values[0]).toLowerCase() === `fbxsurface${w}`));
1898
1899
  m.set(S, {
1899
- textureConnections: D,
1900
+ textureConnections: R,
1900
1901
  shadingModel: w,
1901
1902
  id: S,
1902
1903
  name: String(v.values[1] ?? ""),
1903
1904
  ownValues: E,
1904
- values: new Map([...R, ...E]),
1905
+ values: new Map([...D, ...E]),
1905
1906
  textureRoles: b
1906
1907
  });
1907
1908
  }
@@ -1909,15 +1910,15 @@ function _t(i) {
1909
1910
  for (const v of l) {
1910
1911
  const [S, E, b] = v.values;
1911
1912
  if (S !== "OO" || typeof E != "number" || typeof b != "number" || !m.has(E)) continue;
1912
- const D = g.get(b) ?? [];
1913
- D.push(E), g.set(b, D);
1913
+ const R = g.get(b) ?? [];
1914
+ R.push(E), g.set(b, R);
1914
1915
  }
1915
1916
  const d = /* @__PURE__ */ new Map();
1916
1917
  for (const v of p.filter((S) => S.name === "Geometry")) {
1917
1918
  const S = new Map(v.children.filter((b) => b.name === "LayerElementUV").map((b) => [Number(b.values[0]), b])), E = [];
1918
1919
  for (let b = 0; S.has(b); b++) {
1919
- const D = S.get(b);
1920
- D.children.some((w) => w.name === "UV") && E.push(String(u(D, "Name") ?? ""));
1920
+ const R = S.get(b);
1921
+ R.children.some((w) => w.name === "UV") && E.push(String(u(R, "Name") ?? ""));
1921
1922
  }
1922
1923
  d.set(Number(v.values[0]), E);
1923
1924
  }
@@ -1928,7 +1929,7 @@ function _t(i) {
1928
1929
  }
1929
1930
  return { materials: m, modelMaterials: g, textures: f, modelUvSets: T, layeredTextures: c };
1930
1931
  }
1931
- function Vt(i) {
1932
+ function Gt(i) {
1932
1933
  const e = new DataView(i);
1933
1934
  if (e.byteLength < 27) throw new Error("Truncated FBX header.");
1934
1935
  const t = e.getUint32(23, !0) >= 7500, n = (r, s, a) => {
@@ -1941,7 +1942,7 @@ function Vt(i) {
1941
1942
  if (p.endOffset > s) throw new Error("FBX child extends past its parent.");
1942
1943
  if (te.has(p.name) || Ue.has(p.name)) {
1943
1944
  const f = K(e, l, t, p.name !== "UV");
1944
- o.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? Nt(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1945
+ o.push({ name: f.name, values: ["BlendModes", "Alphas"].includes(f.name) ? $t(e, l, t, f.childrenOffset) : [...f.properties], children: te.has(f.name) ? n(f.childrenOffset, f.endOffset, a + 1) : [] });
1945
1946
  }
1946
1947
  l = p.endOffset;
1947
1948
  }
@@ -1949,7 +1950,7 @@ function Vt(i) {
1949
1950
  };
1950
1951
  return n(27, e.byteLength, 0);
1951
1952
  }
1952
- function Gt(i) {
1953
+ function Nt(i) {
1953
1954
  const e = /"(?:\\.|[^"\\])*"|;[^\r\n]*|\r?\n|[^\S\r\n]+|[{}:,]|[^\s{}:,;]+/g;
1954
1955
  let t = null;
1955
1956
  const n = () => {
@@ -2011,7 +2012,7 @@ function Gt(i) {
2011
2012
  };
2012
2013
  return s(0);
2013
2014
  }
2014
- function Nt(i, e, t, n) {
2015
+ function $t(i, e, t, n) {
2015
2016
  const r = t ? 25 : 13;
2016
2017
  let s = e + r + i.getUint8(e + r - 1);
2017
2018
  if (s === n) return [];
@@ -2025,10 +2026,10 @@ function Nt(i, e, t, n) {
2025
2026
  const h = new DataView(c.buffer, c.byteOffset, c.byteLength);
2026
2027
  return Array.from({ length: o }, (m, g) => a === "i" ? h.getInt32(g * f, !0) : a === "d" ? h.getFloat64(g * f, !0) : h.getFloat32(g * f, !0));
2027
2028
  }
2028
- const Ee = (i) => i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4, $t = (i) => i <= 31308e-7 ? i * 12.92 : 1.055 * i ** (1 / 2.4) - 0.055, zt = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), jt = 4 * 1024 * 1024;
2029
+ const Ee = (i) => i <= 0.04045 ? i / 12.92 : ((i + 0.055) / 1.055) ** 2.4, zt = (i) => i <= 31308e-7 ? i * 12.92 : 1.055 * i ** (1 / 2.4) - 0.055, jt = /* @__PURE__ */ new Set([0, 1, 2, 4, 5]), Ht = 4 * 1024 * 1024;
2029
2030
  function be(i) {
2030
2031
  const e = i.image, t = (e == null ? void 0 : e.naturalWidth) || (e == null ? void 0 : e.width), n = (e == null ? void 0 : e.naturalHeight) || (e == null ? void 0 : e.height);
2031
- if (!t || !n || t * n > jt) throw new Error("missing image or image exceeds 4M pixels");
2032
+ if (!t || !n || t * n > Ht) throw new Error("missing image or image exceeds 4M pixels");
2032
2033
  let r;
2033
2034
  if (e.data) {
2034
2035
  if (i.format !== Ie || i.type !== Ae || !(e.data instanceof Uint8Array) || e.data.length !== t * n * 4) throw new Error("require RGBA8 source");
@@ -2044,10 +2045,10 @@ function be(i) {
2044
2045
  for (let a = 0; a < n; a++) for (let o = 0; o < t * 4; o++) s[(i.flipY ? n - a - 1 : a) * t * 4 + o] = r[a * t * 4 + o];
2045
2046
  return { data: s, width: t, height: n };
2046
2047
  }
2047
- function Ht(i, e, t) {
2048
+ function Wt(i, e, t) {
2048
2049
  if (i.issues.some((u) => u.code !== "LAYERED_TEXTURE_NOT_COMPOSITED")) throw new Error("incompatible layer graph or coordinates");
2049
2050
  if (i.layers.length < 1 || i.layers.length > 8) throw new Error("require 1–8 layers");
2050
- if (!i.layers.every((u) => u.blendMode !== null && zt.has(u.blendMode))) throw new Error("unsupported blend mode");
2051
+ if (!i.layers.every((u) => u.blendMode !== null && jt.has(u.blendMode))) throw new Error("unsupported blend mode");
2051
2052
  const n = i.layers.map((u) => {
2052
2053
  const c = [...t].find((h) => h.ID === u.textureId);
2053
2054
  if (!c) throw new Error(`missing decoded texture ${u.textureId}`);
@@ -2086,11 +2087,11 @@ function Ht(i, e, t) {
2086
2087
  }
2087
2088
  const p = new Uint8Array(o * 4);
2088
2089
  for (let u = 0; u < o; u++) p[u * 4 + 3] = 255;
2089
- for (let u = 0; u < o; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, $t(l[u * 3 + c]))));
2090
+ for (let u = 0; u < o; u++) for (let c = 0; c < 3; c++) p[u * 4 + c] = Math.round(255 * Math.min(1, Math.max(0, zt(l[u * 3 + c]))));
2090
2091
  const f = new ne(p, a.width, a.height);
2091
2092
  return f.colorSpace = X, f.generateMipmaps = r.generateMipmaps, f.wrapS = r.wrapS, f.wrapT = r.wrapT, f.minFilter = r.minFilter, f.magFilter = r.magFilter, f.anisotropy = r.anisotropy, f.offset.copy(r.offset), f.repeat.copy(r.repeat), f.center.copy(r.center), f.rotation = r.rotation, f.matrix.copy(r.matrix), f.matrixAutoUpdate = r.matrixAutoUpdate, f.channel = r.channel, f.mapping = r.mapping, f.userData.fbxLayerBaseId = i.layers[0].textureId, f.needsUpdate = !0, f;
2092
2093
  }
2093
- function Wt(i, e) {
2094
+ function Yt(i, e) {
2094
2095
  return i.textureConnections.flatMap((t) => {
2095
2096
  var u;
2096
2097
  const n = (u = e.layeredTextures) == null ? void 0 : u.get(t.id);
@@ -2123,7 +2124,7 @@ function Wt(i, e) {
2123
2124
  })).size > 1 && s("LAYERED_TEXTURE_COORDINATES_DIFFER", "UV sets or transforms differ; direct pixel blending is unsafe"), [{ id: n.id, role: t.role, layers: n.textureIds.map((c, h) => ({ textureId: c, blendMode: n.blendModes[h] ?? null, alpha: n.alphas[h] ?? null })), issues: r }];
2124
2125
  });
2125
2126
  }
2126
- const Yt = {
2127
+ const qt = {
2127
2128
  DiffuseColor: "map",
2128
2129
  "Maya|TEX_color_map": "map",
2129
2130
  NormalMap: "normalMap",
@@ -2140,22 +2141,22 @@ const Yt = {
2140
2141
  TransparentColor: "alphaMap",
2141
2142
  TransparencyFactor: "alphaMap"
2142
2143
  };
2143
- function qt(i, e, t, n, r, s) {
2144
+ function Kt(i, e, t, n, r, s) {
2144
2145
  var c;
2145
2146
  const a = (c = n.modelUvSets) == null ? void 0 : c.get(i.ID ?? NaN), o = [], l = [], p = /* @__PURE__ */ new Set();
2146
2147
  for (const h of t.textureConnections) {
2147
- const m = Yt[h.role], g = m ? e[m] : void 0, d = n.textures.get(h.id) ?? (g instanceof Y ? n.textures.get(g.userData.fbxLayerBaseId) : void 0);
2148
+ const m = qt[h.role], g = m ? e[m] : void 0, d = n.textures.get(h.id) ?? (g instanceof Y ? n.textures.get(g.userData.fbxLayerBaseId) : void 0);
2148
2149
  if (!m || !d || p.has(m)) continue;
2149
2150
  p.add(m);
2150
2151
  const T = e[m];
2151
2152
  if (!(T instanceof Y)) continue;
2152
- const F = (D, w) => l.push({ status: "unsupported", code: D, source: `texture:${h.id}:${w}`, target: String(m) });
2153
+ const F = (R, w) => l.push({ status: "unsupported", code: R, source: `texture:${h.id}:${w}`, target: String(m) });
2153
2154
  let y = 0;
2154
2155
  if (d.uvSet) {
2155
- const D = (a == null ? void 0 : a.flatMap((w, R) => w === d.uvSet ? [R] : [])) ?? [];
2156
- if (D.length === 1) y = D[0];
2157
- else if (D.length > 1 || d.uvSet !== "default") {
2158
- F("UV_SET_UNRESOLVED", `UVSet:${d.uvSet}:${D.length > 1 ? "ambiguous" : "missing"}`);
2156
+ const R = (a == null ? void 0 : a.flatMap((w, D) => w === d.uvSet ? [D] : [])) ?? [];
2157
+ if (R.length === 1) y = R[0];
2158
+ else if (R.length > 1 || d.uvSet !== "default") {
2159
+ F("UV_SET_UNRESOLVED", `UVSet:${d.uvSet}:${R.length > 1 ? "ambiguous" : "missing"}`);
2159
2160
  continue;
2160
2161
  }
2161
2162
  }
@@ -2163,10 +2164,10 @@ function qt(i, e, t, n, r, s) {
2163
2164
  F("UV_CHANNEL_UNAVAILABLE", `channel:${y}`);
2164
2165
  continue;
2165
2166
  }
2166
- const x = (D, w) => {
2167
- const R = d.values.get(D);
2168
- return R ? R.length < 2 || !R.every((P) => typeof P == "number" && Number.isFinite(P)) ? (F("TEXTURE_TRANSFORM_INVALID", D), w) : R : w;
2169
- }, I = x("Translation", [T.offset.x, T.offset.y, 0]), A = x("Scaling", [T.repeat.x, T.repeat.y, 1]), M = x("Rotation", [0, 0, 0]), v = x("RotationPivot", [0, 0, 0]), S = x("ScalingPivot", [0, 0, 0]), E = M[0] !== 0 || M[1] !== 0 || v.some((D) => D !== 0) || S.some((D) => D !== 0);
2167
+ const x = (R, w) => {
2168
+ const D = d.values.get(R);
2169
+ return D ? D.length < 2 || !D.every((P) => typeof P == "number" && Number.isFinite(P)) ? (F("TEXTURE_TRANSFORM_INVALID", R), w) : D : w;
2170
+ }, I = x("Translation", [T.offset.x, T.offset.y, 0]), A = x("Scaling", [T.repeat.x, T.repeat.y, 1]), M = x("Rotation", [0, 0, 0]), v = x("RotationPivot", [0, 0, 0]), S = x("ScalingPivot", [0, 0, 0]), E = M[0] !== 0 || M[1] !== 0 || v.some((R) => R !== 0) || S.some((R) => R !== 0);
2170
2171
  E && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-rotation-or-pivot"), (I[2] || A[2] !== void 0 && A[2] !== 1) && F("TEXTURE_TRANSFORM_UNSUPPORTED", "3D-translation-or-scale");
2171
2172
  const b = E ? 0 : -(M[2] ?? 0) * Math.PI / 180;
2172
2173
  b && l.push({ status: "approximate", code: "TEXTURE_ROTATION_PROFILE", source: `texture:${h.id}:Rotation`, target: "T * Rccw * S; origin pivot" }), (y !== T.channel || I[0] !== T.offset.x || I[1] !== T.offset.y || A[0] !== T.repeat.x || A[1] !== T.repeat.y || b !== T.rotation) && o.push({ slot: m, source: T, channel: y, offset: I, scale: A, rotation: b });
@@ -2194,20 +2195,20 @@ function qt(i, e, t, n, r, s) {
2194
2195
  }
2195
2196
  return f.needsUpdate = !0, f;
2196
2197
  }
2197
- function Kt(i, e) {
2198
+ function Zt(i, e) {
2198
2199
  return Math.min(1, Math.max(0, i));
2199
2200
  }
2200
- function Zt(i, e, t, n, r = "r", s = !1) {
2201
+ function Qt(i, e, t, n, r = "r", s = !1) {
2201
2202
  if (!Number.isInteger(e) || !Number.isInteger(t) || e <= 0 || t <= 0 || i.length !== e * t * 4)
2202
2203
  throw new Error("Invalid FBX scalar RGBA dimensions.");
2203
2204
  const a = new Uint8Array(i.length), o = { r: 0, g: 1, b: 2, a: 3 }[r];
2204
2205
  for (let l = 0; l < t; l++) for (let p = 0; p < e; p++) {
2205
- const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Kt(i[f + o] / 255));
2206
+ const f = (l * e + p) * 4, u = ((s ? t - l - 1 : l) * e + p) * 4, c = Math.round(255 * Zt(i[f + o] / 255));
2206
2207
  a.fill(c, u, u + 4);
2207
2208
  }
2208
2209
  return a;
2209
2210
  }
2210
- function Qt(i, e) {
2211
+ function Jt(i, e) {
2211
2212
  const t = i.image;
2212
2213
  if (!t) throw new Error("FBX scalar texture has no decoded image.");
2213
2214
  const n = t.naturalWidth || t.width, r = t.naturalHeight || t.height;
@@ -2224,17 +2225,17 @@ function Qt(i, e) {
2224
2225
  if (!l) throw new Error("FBX scalar texture conversion requires a 2D canvas.");
2225
2226
  l.drawImage(t, 0, 0), s = l.getImageData(0, 0, n, r).data;
2226
2227
  }
2227
- const a = new ne(Zt(s, n, r, e, "r", i.flipY), n, r);
2228
+ const a = new ne(Qt(s, n, r, e, "r", i.flipY), n, r);
2228
2229
  return a.wrapS = i.wrapS, a.wrapT = i.wrapT, a.offset.copy(i.offset), a.repeat.copy(i.repeat), a.center.copy(i.center), a.rotation = i.rotation, a.matrix.copy(i.matrix), a.matrixAutoUpdate = i.matrixAutoUpdate, a.channel = i.channel, a.magFilter = i.magFilter, a.minFilter = i.minFilter, a.generateMipmaps = i.generateMipmaps, a.anisotropy = i.anisotropy, a.colorSpace = at, a.needsUpdate = !0, a;
2229
2230
  }
2230
- function Jt(i, e, t) {
2231
+ function en(i, e, t) {
2231
2232
  const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), l = [];
2232
2233
  try {
2233
2234
  i.traverse((c) => {
2234
2235
  if (!(c instanceof Fe)) return;
2235
2236
  const h = e == null ? void 0 : e.modelMaterials.get(c.ID ?? NaN), m = (d) => h ? e == null ? void 0 : e.materials.get(h[d]) : void 0, g = (d, T) => {
2236
- const F = m(T), y = en(d, n, F, t, e, r, s);
2237
- return y instanceof De && F && e ? qt(c, y, F, e, (x) => a.add(x), (x) => o.add(x)) : y;
2237
+ const F = m(T), y = tn(d, n, F, t, e, r, s);
2238
+ return y instanceof Re && F && e ? Kt(c, y, F, e, (x) => a.add(x), (x) => o.add(x)) : y;
2238
2239
  };
2239
2240
  l.push({ mesh: c, material: Array.isArray(c.material) ? c.material.map(g) : g(c.material, 0) });
2240
2241
  });
@@ -2257,26 +2258,26 @@ function Jt(i, e, t) {
2257
2258
  const u = [...p].flatMap((c) => c.userData.fbxConversionReport ? [c.userData.fbxConversionReport] : []);
2258
2259
  return i.userData.fbxConversionReports = u, u;
2259
2260
  }
2260
- function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map()) {
2261
- var E, b, D;
2261
+ function tn(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map()) {
2262
+ var E, b, R;
2262
2263
  const o = e.get(i);
2263
2264
  if (o) return o;
2264
2265
  if (!(i instanceof W) && !(i instanceof Se))
2265
2266
  return e.set(i, i), i;
2266
- const l = i instanceof W ? i : null, p = (w, R) => {
2267
+ const l = i instanceof W ? i : null, p = (w, D) => {
2267
2268
  var _;
2268
2269
  const P = (_ = t == null ? void 0 : t.values.get(w)) == null ? void 0 : _[0];
2269
- return typeof P == "number" && Number.isFinite(P) ? P : R;
2270
- }, f = (w, R) => {
2270
+ return typeof P == "number" && Number.isFinite(P) ? P : D;
2271
+ }, f = (w, D) => {
2271
2272
  const P = t == null ? void 0 : t.values.get(w);
2272
- return P && P.length >= 3 && P.slice(0, 3).every((_) => typeof _ == "number" && Number.isFinite(_)) ? new k().setRGB(P[0], P[1], P[2]) : R.clone();
2273
+ return P && P.length >= 3 && P.slice(0, 3).every((_) => typeof _ == "number" && Number.isFinite(_)) ? new k().setRGB(P[0], P[1], P[2]) : D.clone();
2273
2274
  }, u = (w) => Math.min(1, Math.max(0, w)), c = u(p("SpecularFactor", 0.25) * 2), h = Math.sqrt(0.08 * c), m = (1 + h) / (1 - h);
2274
2275
  let g = i.opacity;
2275
2276
  if (t && (g = 1 - p("TransparencyFactor", 0), g === 0 || g === 1)) {
2276
2277
  const w = (E = t.ownValues.get("Opacity")) == null ? void 0 : E[0];
2277
2278
  g = typeof w == "number" && Number.isFinite(w) ? w : 1 - f("TransparentColor", new k(0)).r;
2278
2279
  }
2279
- const d = new De({
2280
+ const d = new Re({
2280
2281
  name: i.name,
2281
2282
  // FBX diffuse textures supply the base color (as in Blender's importer),
2282
2283
  // not an additional tint. Multiplying the atlas by DiffuseColor can turn
@@ -2315,16 +2316,16 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2315
2316
  });
2316
2317
  e.set(i, d);
2317
2318
  const T = (w) => {
2318
- let R = s.get(w);
2319
- return R || (R = Qt(w, "identity"), s.set(w, R)), R;
2320
- }, F = t && r ? Wt(t, r) : [], y = [];
2319
+ let D = s.get(w);
2320
+ return D || (D = Jt(w, "identity"), s.set(w, D)), D;
2321
+ }, F = t && r ? Yt(t, r) : [], y = [];
2321
2322
  for (const w of F)
2322
- if (!(!["DiffuseColor", "EmissiveColor"].includes(w.role) || !r || !n) && t.textureConnections.filter((R) => R.role === w.role).length === 1)
2323
+ if (!(!["DiffuseColor", "EmissiveColor"].includes(w.role) || !r || !n) && t.textureConnections.filter((D) => D.role === w.role).length === 1)
2323
2324
  try {
2324
- let R = a.get(w.id);
2325
- R || (R = Ht(w, r, n), a.set(w.id, R)), w.role === "DiffuseColor" ? (d.map = R, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = R, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2326
- } catch (R) {
2327
- w.issues.push({ status: "unsupported", code: "LAYERED_TEXTURE_BAKE_REJECTED", source: `layered:${w.id}:${R instanceof Error ? R.message : String(R)}`, target: w.role });
2325
+ let D = a.get(w.id);
2326
+ D || (D = Wt(w, r, n), a.set(w.id, D)), w.role === "DiffuseColor" ? (d.map = D, d.color.setRGB(1, 1, 1)) : (d.emissiveMap = D, d.emissive.setRGB(1, 1, 1)), w.issues = [], y.push(w.id);
2327
+ } catch (D) {
2328
+ w.issues.push({ status: "unsupported", code: "LAYERED_TEXTURE_BAKE_REJECTED", source: `layered:${w.id}:${D instanceof Error ? D.message : String(D)}`, target: w.role });
2328
2329
  }
2329
2330
  const x = /* @__PURE__ */ new Set(), I = [], A = /* @__PURE__ */ new Set(), M = {
2330
2331
  ReflectionFactor: "metalnessMap",
@@ -2337,8 +2338,8 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2337
2338
  };
2338
2339
  for (const w of (t == null ? void 0 : t.textureConnections) ?? []) {
2339
2340
  if ((b = r == null ? void 0 : r.layeredTextures) != null && b.has(w.id)) continue;
2340
- const R = [...n ?? []].find((_) => _.ID === w.id);
2341
- if (!R) {
2341
+ const D = [...n ?? []].find((_) => _.ID === w.id);
2342
+ if (!D) {
2342
2343
  I.push(`texture:${w.id}:unresolved:${w.role}`);
2343
2344
  continue;
2344
2345
  }
@@ -2350,18 +2351,18 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2350
2351
  switch (P && A.add(P), w.role) {
2351
2352
  case "ReflectionFactor":
2352
2353
  case "ReflectionColor":
2353
- d.metalnessMap = T(R), d.metalness = 1, x.add(w.role);
2354
+ d.metalnessMap = T(D), d.metalness = 1, x.add(w.role);
2354
2355
  break;
2355
2356
  case "ShininessExponent":
2356
- d.roughnessMap = T(R), d.roughness = 1, x.add(w.role);
2357
+ d.roughnessMap = T(D), d.roughness = 1, x.add(w.role);
2357
2358
  break;
2358
2359
  case "SpecularFactor":
2359
2360
  case "SpecularColor":
2360
- d.specularIntensityMap = T(R), d.ior = (1 + Math.sqrt(0.08)) / (1 - Math.sqrt(0.08)), d.specularIntensity = 1, x.add(w.role);
2361
+ d.specularIntensityMap = T(D), d.ior = (1 + Math.sqrt(0.08)) / (1 - Math.sqrt(0.08)), d.specularIntensity = 1, x.add(w.role);
2361
2362
  break;
2362
2363
  case "TransparentColor":
2363
2364
  case "TransparencyFactor":
2364
- d.alphaMap = T(R), d.opacity = 1, d.transparent = !0, x.add(w.role);
2365
+ d.alphaMap = T(D), d.opacity = 1, d.transparent = !0, x.add(w.role);
2365
2366
  break;
2366
2367
  }
2367
2368
  }
@@ -2380,7 +2381,7 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2380
2381
  ].includes(w) && !x.has(w))) ?? [];
2381
2382
  v.push(...I);
2382
2383
  for (const w of (t == null ? void 0 : t.textureConnections) ?? [])
2383
- !(r == null ? void 0 : r.textures.get(w.id)) && !((D = r == null ? void 0 : r.layeredTextures) != null && D.has(w.id)) && v.push(`texture:${w.id}:layered-or-unknown`);
2384
+ !(r == null ? void 0 : r.textures.get(w.id)) && !((R = r == null ? void 0 : r.layeredTextures) != null && R.has(w.id)) && v.push(`texture:${w.id}:layered-or-unknown`);
2384
2385
  t && !["phong", "lambert"].includes(t.shadingModel) && v.push(`shader:${t.shadingModel}`), v.length && (d.userData.fbxUnsupportedTextureRoles = v, console.warn(`[viewer] FBX material ${i.name}: unsupported texture semantics: ${v.join(", ")}`));
2385
2386
  const S = {
2386
2387
  layerStacks: F,
@@ -2403,7 +2404,7 @@ function en(i, e, t, n, r, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ ne
2403
2404
  };
2404
2405
  return d.userData.fbxConversionReport = S, d.visible = i.visible, d.toneMapped = i.toneMapped, d.clippingPlanes = i.clippingPlanes, d.clipIntersection = i.clipIntersection, d.clipShadows = i.clipShadows, d.polygonOffset = i.polygonOffset, d.polygonOffsetFactor = i.polygonOffsetFactor, d.polygonOffsetUnits = i.polygonOffsetUnits, d.dithering = i.dithering, d.needsUpdate = !0, e.set(i, d), d;
2405
2406
  }
2406
- function fn(i, e) {
2407
+ function dn(i, e) {
2407
2408
  let t = !1, n = null, r = null, s = "z", a, o = null, l;
2408
2409
  const p = () => {
2409
2410
  t = !0;
@@ -2417,10 +2418,10 @@ function fn(i, e) {
2417
2418
  const m = await fetch(c, { signal: e.signal });
2418
2419
  if (!m.ok) throw new Error(`FBX request failed: ${m.status} ${m.statusText}`);
2419
2420
  const g = await m.arrayBuffer();
2420
- s = e.options.upAxis ?? Ot(g) ?? ge(e.format);
2421
- const d = _t(g), T = await Pt(g, i, d);
2421
+ s = e.options.upAxis ?? Ut(g) ?? ge(e.format);
2422
+ const d = Vt(g), T = await Ct(g, i, d);
2422
2423
  l = T.textures, u.add(T.root);
2423
- const y = Jt(u, d, l).flatMap((I) => I.issues.filter((A) => A.status === "unsupported" || A.code === "TEXTURE_ROTATION_PROFILE" || A.code === "LAYERED_TEXTURE_BAKED").map((A) => `${I.materialName || I.materialId || "material"}: ${A.source}`));
2424
+ const y = en(u, d, l).flatMap((I) => I.issues.filter((A) => A.status === "unsupported" || A.code === "TEXTURE_ROTATION_PROFILE" || A.code === "LAYERED_TEXTURE_BAKED").map((A) => `${I.materialName || I.materialId || "material"}: ${A.source}`));
2424
2425
  y.length && (o = {
2425
2426
  code: "W_FBX_MATERIAL_APPROXIMATED",
2426
2427
  stage: "material-conversion",
@@ -2435,7 +2436,9 @@ function fn(i, e) {
2435
2436
  } else {
2436
2437
  const m = new it(), g = new lt();
2437
2438
  try {
2438
- e.options.dracoDecoderPath && m.setDecoderPath(e.options.dracoDecoderPath), g.setDRACOLoader(m);
2439
+ m.setDecoderPath(
2440
+ e.options.dracoDecoderPath ?? mt("draco")
2441
+ ), g.setDRACOLoader(m);
2439
2442
  const d = await g.loadAsync(c), T = d.scenes.filter((F) => F !== d.scene);
2440
2443
  if (u.add(d.scene), t || e.signal.aborted) {
2441
2444
  for (const F of T) u.add(F);
@@ -2446,7 +2449,7 @@ function fn(i, e) {
2446
2449
  }
2447
2450
  }
2448
2451
  if (t || e.signal.aborted) throw le();
2449
- ye(u, s), tn(u);
2452
+ ye(u, s), nn(u);
2450
2453
  const h = new ut(u, e.options.simulationTheme, void 0, "model");
2451
2454
  h.setCacheInvalidationCallback(e.invalidateTransmissionCaches), n = u, r = h, u = null;
2452
2455
  } finally {
@@ -2504,7 +2507,7 @@ function fn(i, e) {
2504
2507
  }
2505
2508
  };
2506
2509
  }
2507
- function tn(i) {
2510
+ function nn(i) {
2508
2511
  i.updateMatrixWorld(!0);
2509
2512
  const e = new ot().setFromObject(i);
2510
2513
  if (e.isEmpty()) throw new Error("模型不包含可显示的几何内容。");
@@ -2515,5 +2518,5 @@ function le() {
2515
2518
  return Object.assign(new Error("Model load aborted."), { name: "AbortError", code: "E_ABORTED" });
2516
2519
  }
2517
2520
  export {
2518
- fn as createModelSession
2521
+ dn as createModelSession
2519
2522
  };