softbox 4.15.3 → 4.15.4

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,7 +1,7 @@
1
1
  import { jsx as Se, jsxs as Zn } from "react/jsx-runtime";
2
2
  import { useMemo as Nt, useState as vn, useEffect as rt, useRef as je, useCallback as Mt, createContext as qa, useContext as $a, Component as Qa, forwardRef as bo, useImperativeHandle as Ja } from "react";
3
3
  import * as g from "three";
4
- import { Box3 as _t, Matrix4 as ut, BufferAttribute as Kn, Vector3 as $, Line3 as kt, Plane as ts, Vector2 as me, Triangle as Tn, BackSide as Ao, DoubleSide as xo, REVISION as vo, Ray as er, FrontSide as Mi, Mesh as wt, LineSegments as tr, LineLoop as nr, Line as sr, Points as ir, Sphere as Ro, BatchedMesh as ec, TrianglesDrawMode as tc, TriangleFanDrawMode as Ii, TriangleStripDrawMode as Mo, Loader as nc, LoaderUtils as Xn, FileLoader as Io, MeshPhysicalMaterial as Ct, Color as sn, LinearSRGBColorSpace as Ge, SRGBColorSpace as Jn, SpotLight as sc, PointLight as Co, DirectionalLight as ic, Quaternion as Rn, InstancedMesh as Po, InstancedBufferAttribute as rc, Object3D as rr, TextureLoader as oc, ImageBitmapLoader as ac, InterleavedBuffer as cc, InterleavedBufferAttribute as lc, LinearMipmapLinearFilter as Lo, NearestMipmapLinearFilter as hc, LinearMipmapNearestFilter as uc, NearestMipmapNearestFilter as dc, LinearFilter as rn, NearestFilter as Oo, RepeatWrapping as Ci, MirroredRepeatWrapping as fc, ClampToEdgeWrapping as pc, PointsMaterial as mc, Material as ni, LineBasicMaterial as gc, MeshStandardMaterial as js, MeshBasicMaterial as Wn, PropertyBinding as yc, BufferGeometry as wc, SkinnedMesh as Ec, Group as si, PerspectiveCamera as Tc, MathUtils as or, OrthographicCamera as Sc, Skeleton as _c, AnimationClip as bc, Bone as Ac, InterpolateDiscrete as xc, InterpolateLinear as Do, Texture as Pr, VectorKeyframeTrack as Lr, NumberKeyframeTrack as Or, QuaternionKeyframeTrack as Dr, ColorManagement as Nr, Interpolant as vc, Controls as No, MOUSE as Be, TOUCH as Ye, Spherical as Vs, Raycaster as Rc, DataTextureLoader as ko, HalfFloatType as Zt, RGBAFormat as $t, RGFormat as On, DataUtils as Et, RedFormat as ms, FloatType as Yn, Scene as Mc, BoxGeometry as Ic, MeshLambertMaterial as Cc } from "three";
4
+ import { Box3 as _t, Matrix4 as ut, BufferAttribute as Kn, Vector3 as $, Line3 as kt, Plane as ts, Vector2 as me, Triangle as Tn, BackSide as xo, DoubleSide as Ao, REVISION as vo, Ray as er, FrontSide as Mi, Mesh as wt, LineSegments as tr, LineLoop as nr, Line as sr, Points as ir, Sphere as Ro, BatchedMesh as ec, TrianglesDrawMode as tc, TriangleFanDrawMode as Ci, TriangleStripDrawMode as Mo, Loader as nc, LoaderUtils as Xn, FileLoader as Co, MeshPhysicalMaterial as It, Color as sn, LinearSRGBColorSpace as Ge, SRGBColorSpace as Jn, SpotLight as sc, PointLight as Io, DirectionalLight as ic, Quaternion as Rn, InstancedMesh as Po, InstancedBufferAttribute as rc, Object3D as rr, TextureLoader as oc, ImageBitmapLoader as ac, InterleavedBuffer as cc, InterleavedBufferAttribute as lc, LinearMipmapLinearFilter as Lo, NearestMipmapLinearFilter as hc, LinearMipmapNearestFilter as uc, NearestMipmapNearestFilter as dc, LinearFilter as rn, NearestFilter as Oo, RepeatWrapping as Ii, MirroredRepeatWrapping as fc, ClampToEdgeWrapping as pc, PointsMaterial as mc, Material as ni, LineBasicMaterial as gc, MeshStandardMaterial as js, MeshBasicMaterial as Wn, PropertyBinding as yc, BufferGeometry as wc, SkinnedMesh as Ec, Group as si, PerspectiveCamera as Tc, MathUtils as or, OrthographicCamera as Sc, Skeleton as _c, AnimationClip as bc, Bone as xc, InterpolateDiscrete as Ac, InterpolateLinear as Do, Texture as Pr, VectorKeyframeTrack as Lr, NumberKeyframeTrack as Or, QuaternionKeyframeTrack as Dr, ColorManagement as Nr, Interpolant as vc, Controls as No, MOUSE as Be, TOUCH as Ye, Spherical as Vs, Raycaster as Rc, DataTextureLoader as ko, HalfFloatType as Zt, RGBAFormat as $t, RGFormat as On, DataUtils as Et, RedFormat as ms, FloatType as Yn, Scene as Mc, BoxGeometry as Cc, MeshLambertMaterial as Ic } from "three";
5
5
  class W extends Error {
6
6
  constructor(e, t, n) {
7
7
  super(e), this.code = t, this.context = n, this.name = "ThreeViewerError", this.timestamp = /* @__PURE__ */ new Date(), Error.captureStackTrace && Error.captureStackTrace(this, W);
@@ -184,14 +184,14 @@ class Lc {
184
184
  environmentIntensity: (f = r.environment) == null ? void 0 : f.environmentIntensity
185
185
  }, h = (p = r.environment) == null ? void 0 : p.url;
186
186
  if (h) {
187
- const S = await t.loadEnvironmentMap(h);
187
+ const T = await t.loadEnvironmentMap(h);
188
188
  if (o())
189
189
  return;
190
- S.ok ? t.applyToScene(e, S.value, c) : console.warn("Failed to load environment map:", S.error);
190
+ T.ok ? t.applyToScene(e, T.value, c) : console.warn("Failed to load environment map:", T.error);
191
191
  } else if ((y = r.helpers) != null && y.studioEnvironment) {
192
- const S = t.createStudioEnvironment();
193
- if (S.ok) {
194
- if (t.applyToScene(e, S.value, {
192
+ const T = t.createStudioEnvironment();
193
+ if (T.ok) {
194
+ if (t.applyToScene(e, T.value, {
195
195
  ...c,
196
196
  setBackground: !1
197
197
  }), (b = r.helpers) != null && b.darkStudioMode && n) {
@@ -202,7 +202,7 @@ class Lc {
202
202
  x.ok || console.warn("Failed to set dark studio background:", x.error);
203
203
  }
204
204
  } else
205
- console.warn("Failed to create studio environment:", S.error);
205
+ console.warn("Failed to create studio environment:", T.error);
206
206
  }
207
207
  }
208
208
  }
@@ -292,7 +292,7 @@ class Oc {
292
292
  function gs(i) {
293
293
  return typeof i == "object" && i !== null && !Array.isArray(i);
294
294
  }
295
- function An(i, e) {
295
+ function xn(i, e) {
296
296
  if (!gs(i) || !gs(e))
297
297
  return e === void 0 ? i : e;
298
298
  const t = e, n = { ...i };
@@ -301,7 +301,7 @@ function An(i, e) {
301
301
  if (r === void 0)
302
302
  continue;
303
303
  const o = n[s];
304
- n[s] = gs(o) && gs(r) ? An(o, r) : r;
304
+ n[s] = gs(o) && gs(r) ? xn(o, r) : r;
305
305
  }
306
306
  return n;
307
307
  }
@@ -1078,8 +1078,8 @@ class Uc {
1078
1078
  const f = [];
1079
1079
  let p = null, y = !1;
1080
1080
  const b = (x) => {
1081
- y || (y = !0, this.pendingSettlers.delete(S), c(), p !== null && clearTimeout(p), this.deps.renderLoopManager.releaseContinuous(h), s.getTracks().forEach((E) => E.stop()), u(x));
1082
- }, S = () => {
1081
+ y || (y = !0, this.pendingSettlers.delete(T), c(), p !== null && clearTimeout(p), this.deps.renderLoopManager.releaseContinuous(h), s.getTracks().forEach((E) => E.stop()), u(x));
1082
+ }, T = () => {
1083
1083
  b(
1084
1084
  D.err(
1085
1085
  new W("Viewer was disposed during video capture", Z.INVALID_STATE)
@@ -1090,7 +1090,7 @@ class Uc {
1090
1090
  } catch {
1091
1091
  }
1092
1092
  };
1093
- this.pendingSettlers.add(S), r.ondataavailable = (x) => {
1093
+ this.pendingSettlers.add(T), r.ondataavailable = (x) => {
1094
1094
  x.data.size > 0 && f.push(x.data);
1095
1095
  }, r.onstop = () => {
1096
1096
  b(D.ok(new Blob(f, { type: r.mimeType || "video/webm" })));
@@ -1175,8 +1175,8 @@ class Uc {
1175
1175
  )
1176
1176
  );
1177
1177
  t.setPixelRatio(1), t.setSize(f, p), Pi(s, f / p);
1178
- const b = t.renderPostProcessed ? t.renderPostProcessed(n, s) : t.render(n, s), S = b.ok ? this.readCanvasPng() : D.err(b.error);
1179
- return t.setSize(h, d), t.setPixelRatio(a), Pi(s, u), t.render(n, s), r.requestRender(), S;
1178
+ const b = t.renderPostProcessed ? t.renderPostProcessed(n, s) : t.render(n, s), T = b.ok ? this.readCanvasPng() : D.err(b.error);
1179
+ return t.setSize(h, d), t.setPixelRatio(a), Pi(s, u), t.render(n, s), r.requestRender(), T;
1180
1180
  }
1181
1181
  readCanvasPng() {
1182
1182
  const e = Bo(this.deps.renderer.getDomElement());
@@ -1388,25 +1388,25 @@ class Hc {
1388
1388
  * helpers — take effect at construction time and require a rebuild.
1389
1389
  */
1390
1390
  updateOptions(e) {
1391
- var y, b, S, x, E, T, _, A, P, C, M;
1391
+ var y, b, T, x, E, S, _, A, P, I, M;
1392
1392
  if (this.disposed)
1393
1393
  return;
1394
- const t = (y = this.options.animations) == null ? void 0 : y.autoplay, n = (b = this.options.controls) == null ? void 0 : b.autoRotate, s = ((S = this.options.pathTracing) == null ? void 0 : S.enabled) ?? !1;
1395
- this.options = An(this.options, e), "backgroundColorEdge" in e && (this.options.backgroundColorEdge = e.backgroundColorEdge);
1394
+ const t = (y = this.options.animations) == null ? void 0 : y.autoplay, n = (b = this.options.controls) == null ? void 0 : b.autoRotate, s = ((T = this.options.pathTracing) == null ? void 0 : T.enabled) ?? !1;
1395
+ this.options = xn(this.options, e), "backgroundColorEdge" in e && (this.options.backgroundColorEdge = e.backgroundColorEdge);
1396
1396
  let r = !1;
1397
1397
  (e.backgroundColor !== void 0 || e.backgroundColorEdge !== void 0) && this.options.backgroundColor !== void 0 && this.applyBackgroundColor(this.options.backgroundColor);
1398
1398
  const a = (x = e.renderer) == null ? void 0 : x.toneMappingExposure;
1399
1399
  a !== void 0 && (this.renderer.setToneMappingExposure(a), r = !0);
1400
1400
  const c = (E = e.environment) == null ? void 0 : E.environmentIntensity;
1401
1401
  c !== void 0 && (this.scene.setEnvironmentIntensity(c), r = !0);
1402
- const h = (T = e.controls) == null ? void 0 : T.autoRotate;
1402
+ const h = (S = e.controls) == null ? void 0 : S.autoRotate;
1403
1403
  h !== void 0 && h !== n && (this.controls.autoRotate = h, h ? (this.renderLoopManager.requireContinuous("turntable"), this.capture.notifyTurntableEnabled()) : this.renderLoopManager.releaseContinuous("turntable"), r = !0);
1404
1404
  const d = (_ = e.controls) == null ? void 0 : _.autoRotateSpeed;
1405
1405
  d !== void 0 && (this.controls.autoRotateSpeed = d, r = !0);
1406
1406
  const u = (A = e.animations) == null ? void 0 : A.autoplay;
1407
1407
  u !== void 0 && u !== t && (u ? this.modelManager.getCurrentModel() && this.autoplayFromOptions(u) : this.pauseAnimations(), r = !0);
1408
1408
  const f = (P = e.animations) == null ? void 0 : P.speed;
1409
- f !== void 0 && ((C = this.animationService) == null || C.setSpeed(f), r = !0);
1409
+ f !== void 0 && ((I = this.animationService) == null || I.setSpeed(f), r = !0);
1410
1410
  const p = (M = e.pathTracing) == null ? void 0 : M.enabled;
1411
1411
  p !== void 0 && p !== s && (this.setPathTracingEnabled(p), r = !0), r && (this.reviveRenderLoop(), this.renderLoopManager.requestRender());
1412
1412
  }
@@ -1451,7 +1451,7 @@ class Hc {
1451
1451
  environmentIntensity: (o = this.options.environment) == null ? void 0 : o.environmentIntensity,
1452
1452
  setBackground: !0
1453
1453
  });
1454
- return n.ok ? (this.options = An(this.options, { environment: { url: e } }), this.repaintAfterEnvironmentChange(), D.ok(void 0)) : n;
1454
+ return n.ok ? (this.options = xn(this.options, { environment: { url: e } }), this.repaintAfterEnvironmentChange(), D.ok(void 0)) : n;
1455
1455
  }
1456
1456
  /**
1457
1457
  * Runtime: drop back to the built-in studio environment and the clean gradient
@@ -1497,7 +1497,7 @@ class Hc {
1497
1497
  this.scene,
1498
1498
  this.backgroundGradient(e, void 0)
1499
1499
  );
1500
- return t.ok ? (this.options = An(this.options, { backgroundColor: e }), this.options.backgroundColorEdge = void 0, this.repaintAfterEnvironmentChange(), D.ok(void 0)) : t;
1500
+ return t.ok ? (this.options = xn(this.options, { backgroundColor: e }), this.options.backgroundColorEdge = void 0, this.repaintAfterEnvironmentChange(), D.ok(void 0)) : t;
1501
1501
  }
1502
1502
  restoreBackgroundColor() {
1503
1503
  const e = this.options.backgroundColor;
@@ -1759,7 +1759,7 @@ const Ho = 0, Gc = 1, jc = 2, zr = 2, ai = 1.25, Br = 1, qe = 32, Oe = qe / 4, c
1759
1759
  range: null,
1760
1760
  [lr]: !1
1761
1761
  };
1762
- function xe(i, e, t) {
1762
+ function Ae(i, e, t) {
1763
1763
  return t.min.x = e[i], t.min.y = e[i + 1], t.min.z = e[i + 2], t.max.x = e[i + 3], t.max.y = e[i + 4], t.max.z = e[i + 5], t;
1764
1764
  }
1765
1765
  function Ur(i) {
@@ -1813,17 +1813,17 @@ function Ef(i) {
1813
1813
  return i;
1814
1814
  }
1815
1815
  function ci(i, e, t, n, s) {
1816
- let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, h = -1 / 0, d = -1 / 0, u = 1 / 0, f = 1 / 0, p = 1 / 0, y = -1 / 0, b = -1 / 0, S = -1 / 0;
1816
+ let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, h = -1 / 0, d = -1 / 0, u = 1 / 0, f = 1 / 0, p = 1 / 0, y = -1 / 0, b = -1 / 0, T = -1 / 0;
1817
1817
  const x = i.offset || 0;
1818
- for (let E = (e - x) * 6, T = (e + t - x) * 6; E < T; E += 6) {
1819
- const _ = i[E + 0], A = i[E + 1], P = _ - A, C = _ + A;
1820
- P < r && (r = P), C > c && (c = C), _ < u && (u = _), _ > y && (y = _);
1821
- const M = i[E + 2], O = i[E + 3], I = M - O, k = M + O;
1822
- I < o && (o = I), k > h && (h = k), M < f && (f = M), M > b && (b = M);
1818
+ for (let E = (e - x) * 6, S = (e + t - x) * 6; E < S; E += 6) {
1819
+ const _ = i[E + 0], A = i[E + 1], P = _ - A, I = _ + A;
1820
+ P < r && (r = P), I > c && (c = I), _ < u && (u = _), _ > y && (y = _);
1821
+ const M = i[E + 2], O = i[E + 3], C = M - O, k = M + O;
1822
+ C < o && (o = C), k > h && (h = k), M < f && (f = M), M > b && (b = M);
1823
1823
  const N = i[E + 4], G = i[E + 5], z = N - G, X = N + G;
1824
- z < a && (a = z), X > d && (d = X), N < p && (p = N), N > S && (S = N);
1824
+ z < a && (a = z), X > d && (d = X), N < p && (p = N), N > T && (T = N);
1825
1825
  }
1826
- n[0] = r, n[1] = o, n[2] = a, n[3] = c, n[4] = h, n[5] = d, s[0] = u, s[1] = f, s[2] = p, s[3] = y, s[4] = b, s[5] = S;
1826
+ n[0] = r, n[1] = o, n[2] = a, n[3] = c, n[4] = h, n[5] = d, s[0] = u, s[1] = f, s[2] = p, s[3] = y, s[4] = b, s[5] = T;
1827
1827
  }
1828
1828
  const Ot = 32, Vc = (i, e) => i.candidate - e.candidate, Ut = /* @__PURE__ */ new Array(Ot).fill().map(() => ({
1829
1829
  count: 0,
@@ -1847,18 +1847,18 @@ function Wc(i, e, t, n, s, r) {
1847
1847
  if (s < Ot / 4) {
1848
1848
  const E = [...Ut];
1849
1849
  E.length = s;
1850
- let T = 0;
1851
- for (let A = u; A < f; A += 6, T++) {
1852
- const P = E[T];
1850
+ let S = 0;
1851
+ for (let A = u; A < f; A += 6, S++) {
1852
+ const P = E[S];
1853
1853
  P.candidate = t[A + 2 * p], P.count = 0;
1854
1854
  const {
1855
- bounds: C,
1855
+ bounds: I,
1856
1856
  leftCacheBounds: M,
1857
1857
  rightCacheBounds: O
1858
1858
  } = P;
1859
- for (let I = 0; I < 3; I++)
1860
- O[I] = 1 / 0, O[I + 3] = -1 / 0, M[I] = 1 / 0, M[I + 3] = -1 / 0, C[I] = 1 / 0, C[I + 3] = -1 / 0;
1861
- ys(A, t, C);
1859
+ for (let C = 0; C < 3; C++)
1860
+ O[C] = 1 / 0, O[C + 3] = -1 / 0, M[C] = 1 / 0, M[C + 3] = -1 / 0, I[C] = 1 / 0, I[C + 3] = -1 / 0;
1861
+ ys(A, t, I);
1862
1862
  }
1863
1863
  E.sort(Vc);
1864
1864
  let _ = s;
@@ -1869,18 +1869,18 @@ function Wc(i, e, t, n, s, r) {
1869
1869
  }
1870
1870
  for (let A = u; A < f; A += 6) {
1871
1871
  const P = t[A + 2 * p];
1872
- for (let C = 0; C < _; C++) {
1873
- const M = E[C];
1872
+ for (let I = 0; I < _; I++) {
1873
+ const M = E[I];
1874
1874
  P >= M.candidate ? ys(A, t, M.rightCacheBounds) : (ys(A, t, M.leftCacheBounds), M.count++);
1875
1875
  }
1876
1876
  }
1877
1877
  for (let A = 0; A < _; A++) {
1878
- const P = E[A], C = P.count, M = s - P.count, O = P.leftCacheBounds, I = P.rightCacheBounds;
1878
+ const P = E[A], I = P.count, M = s - P.count, O = P.leftCacheBounds, C = P.rightCacheBounds;
1879
1879
  let k = 0;
1880
- C !== 0 && (k = Dn(O) / c);
1880
+ I !== 0 && (k = Dn(O) / c);
1881
1881
  let N = 0;
1882
- M !== 0 && (N = Dn(I) / c);
1883
- const G = Br + ai * (k * C + N * M);
1882
+ M !== 0 && (N = Dn(C) / c);
1883
+ const G = Br + ai * (k * I + N * M);
1884
1884
  G < h && (o = p, h = G, a = P.candidate);
1885
1885
  }
1886
1886
  } else {
@@ -1888,13 +1888,13 @@ function Wc(i, e, t, n, s, r) {
1888
1888
  const A = Ut[_];
1889
1889
  A.count = 0, A.candidate = y + x + _ * x;
1890
1890
  const P = A.bounds;
1891
- for (let C = 0; C < 3; C++)
1892
- P[C] = 1 / 0, P[C + 3] = -1 / 0;
1891
+ for (let I = 0; I < 3; I++)
1892
+ P[I] = 1 / 0, P[I + 3] = -1 / 0;
1893
1893
  }
1894
1894
  for (let _ = u; _ < f; _ += 6) {
1895
- let C = ~~((t[_ + 2 * p] - y) / x);
1896
- C >= Ot && (C = Ot - 1);
1897
- const M = Ut[C];
1895
+ let I = ~~((t[_ + 2 * p] - y) / x);
1896
+ I >= Ot && (I = Ot - 1);
1897
+ const M = Ut[I];
1898
1898
  M.count++, ys(_, t, M.bounds);
1899
1899
  }
1900
1900
  const E = Ut[Ot - 1];
@@ -1903,15 +1903,15 @@ function Wc(i, e, t, n, s, r) {
1903
1903
  const A = Ut[_], P = Ut[_ + 1];
1904
1904
  Gr(A.bounds, P.rightCacheBounds, A.rightCacheBounds);
1905
1905
  }
1906
- let T = 0;
1906
+ let S = 0;
1907
1907
  for (let _ = 0; _ < Ot - 1; _++) {
1908
- const A = Ut[_], P = A.count, C = A.bounds, O = Ut[_ + 1].rightCacheBounds;
1909
- P !== 0 && (T === 0 ? Hr(C, ws) : Gr(C, ws, ws)), T += P;
1910
- let I = 0, k = 0;
1911
- T !== 0 && (I = Dn(ws) / c);
1912
- const N = s - T;
1908
+ const A = Ut[_], P = A.count, I = A.bounds, O = Ut[_ + 1].rightCacheBounds;
1909
+ P !== 0 && (S === 0 ? Hr(I, ws) : Gr(I, ws, ws)), S += P;
1910
+ let C = 0, k = 0;
1911
+ S !== 0 && (C = Dn(ws) / c);
1912
+ const N = s - S;
1913
1913
  N !== 0 && (k = Dn(O) / c);
1914
- const G = Br + ai * (I * T + k * N);
1914
+ const G = Br + ai * (C * S + k * N);
1915
1915
  G < h && (o = p, h = G, a = A.candidate);
1916
1916
  }
1917
1917
  }
@@ -1988,22 +1988,22 @@ function qc(i, e, t, n, s, r) {
1988
1988
  let y = !1;
1989
1989
  const b = new li();
1990
1990
  return ci(e, t, n, b.boundingData, p), x(b, t, n, p), b;
1991
- function S(E) {
1991
+ function T(E) {
1992
1992
  d && d((E - r.offset) / r.count);
1993
1993
  }
1994
- function x(E, T, _, A = null, P = 0) {
1994
+ function x(E, S, _, A = null, P = 0) {
1995
1995
  if (!y && P >= o && (y = !0, a && console.warn(`BVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`)), _ <= c || P >= o)
1996
- return S(T + _), E.offset = T, E.count = _, E;
1997
- const C = Wc(E.boundingData, A, e, T, _, h);
1998
- if (C.axis === -1)
1999
- return S(T + _), E.offset = T, E.count = _, E;
2000
- const M = Kc(u, f, e, T, _, C);
2001
- if (M === T || M === T + _)
2002
- S(T + _), E.offset = T, E.count = _;
1996
+ return T(S + _), E.offset = S, E.count = _, E;
1997
+ const I = Wc(E.boundingData, A, e, S, _, h);
1998
+ if (I.axis === -1)
1999
+ return T(S + _), E.offset = S, E.count = _, E;
2000
+ const M = Kc(u, f, e, S, _, I);
2001
+ if (M === S || M === S + _)
2002
+ T(S + _), E.offset = S, E.count = _;
2003
2003
  else {
2004
- E.splitAxis = C.axis;
2005
- const O = new li(), I = T, k = M - T;
2006
- E.left = O, ci(e, I, k, O.boundingData, p), x(O, I, k, p, P + 1);
2004
+ E.splitAxis = I.axis;
2005
+ const O = new li(), C = S, k = M - S;
2006
+ E.left = O, ci(e, C, k, O.boundingData, p), x(O, C, k, p, P + 1);
2007
2007
  const N = new li(), G = M, z = _ - k;
2008
2008
  E.right = N, ci(e, G, z, N.boundingData, p), x(N, G, z, p, P + 1);
2009
2009
  }
@@ -2044,48 +2044,48 @@ class Qc {
2044
2044
  };
2045
2045
  }
2046
2046
  }
2047
- const Ae = /* @__PURE__ */ new Qc();
2047
+ const xe = /* @__PURE__ */ new Qc();
2048
2048
  let Kt, _n;
2049
2049
  const hn = [], Es = /* @__PURE__ */ new ur(() => new _t());
2050
2050
  function Jc(i, e, t, n, s, r) {
2051
- Kt = Es.getPrimitive(), _n = Es.getPrimitive(), hn.push(Kt, _n), Ae.setBuffer(i._roots[e]);
2051
+ Kt = Es.getPrimitive(), _n = Es.getPrimitive(), hn.push(Kt, _n), xe.setBuffer(i._roots[e]);
2052
2052
  const o = Ni(0, i.geometry, t, n, s, r);
2053
- Ae.clearBuffer(), Es.releasePrimitive(Kt), Es.releasePrimitive(_n), hn.pop(), hn.pop();
2053
+ xe.clearBuffer(), Es.releasePrimitive(Kt), Es.releasePrimitive(_n), hn.pop(), hn.pop();
2054
2054
  const a = hn.length;
2055
2055
  return a > 0 && (_n = hn[a - 1], Kt = hn[a - 2]), o;
2056
2056
  }
2057
2057
  function Ni(i, e, t, n, s = null, r = 0, o = 0) {
2058
- const { float32Array: a, uint16Array: c, uint32Array: h } = Ae;
2058
+ const { float32Array: a, uint16Array: c, uint32Array: h } = xe;
2059
2059
  let d = i * 2;
2060
2060
  if (De(d, c)) {
2061
2061
  const f = $e(i, h), p = Qe(d, c);
2062
- return xe(i, a, Kt), n(f, p, !1, o, r + i / Oe, Kt);
2062
+ return Ae(i, a, Kt), n(f, p, !1, o, r + i / Oe, Kt);
2063
2063
  } else {
2064
- let I = function(N) {
2065
- const { uint16Array: G, uint32Array: z } = Ae;
2064
+ let C = function(N) {
2065
+ const { uint16Array: G, uint32Array: z } = xe;
2066
2066
  let X = N * 2;
2067
2067
  for (; !De(X, G); )
2068
2068
  N = Fe(N), X = N * 2;
2069
2069
  return $e(N, z);
2070
2070
  }, k = function(N) {
2071
- const { uint16Array: G, uint32Array: z } = Ae;
2071
+ const { uint16Array: G, uint32Array: z } = xe;
2072
2072
  let X = N * 2;
2073
2073
  for (; !De(X, G); )
2074
2074
  N = ze(N, z), X = N * 2;
2075
2075
  return $e(N, z) + Qe(X, G);
2076
2076
  };
2077
2077
  const f = Fe(i), p = ze(i, h);
2078
- let y = f, b = p, S, x, E, T;
2079
- if (s && (E = Kt, T = _n, xe(y, a, E), xe(b, a, T), S = s(E), x = s(T), x < S)) {
2078
+ let y = f, b = p, T, x, E, S;
2079
+ if (s && (E = Kt, S = _n, Ae(y, a, E), Ae(b, a, S), T = s(E), x = s(S), x < T)) {
2080
2080
  y = p, b = f;
2081
- const N = S;
2082
- S = x, x = N, E = T;
2081
+ const N = T;
2082
+ T = x, x = N, E = S;
2083
2083
  }
2084
- E || (E = Kt, xe(y, a, E));
2085
- const _ = De(y * 2, c), A = t(E, _, S, o + 1, r + y / Oe);
2084
+ E || (E = Kt, Ae(y, a, E));
2085
+ const _ = De(y * 2, c), A = t(E, _, T, o + 1, r + y / Oe);
2086
2086
  let P;
2087
2087
  if (A === zr) {
2088
- const N = I(y), z = k(y) - N;
2088
+ const N = C(y), z = k(y) - N;
2089
2089
  P = n(N, z, !0, o + 1, r + y / Oe, E);
2090
2090
  } else
2091
2091
  P = A && Ni(
@@ -2098,12 +2098,12 @@ function Ni(i, e, t, n, s = null, r = 0, o = 0) {
2098
2098
  o + 1
2099
2099
  );
2100
2100
  if (P) return !0;
2101
- T = _n, xe(b, a, T);
2102
- const C = De(b * 2, c), M = t(T, C, x, o + 1, r + b / Oe);
2101
+ S = _n, Ae(b, a, S);
2102
+ const I = De(b * 2, c), M = t(S, I, x, o + 1, r + b / Oe);
2103
2103
  let O;
2104
2104
  if (M === zr) {
2105
- const N = I(b), z = k(b) - N;
2106
- O = n(N, z, !0, o + 1, r + b / Oe, T);
2105
+ const N = C(b), z = k(b) - N;
2106
+ O = n(N, z, !0, o + 1, r + b / Oe, S);
2107
2107
  } else
2108
2108
  O = M && Ni(
2109
2109
  b,
@@ -2117,7 +2117,7 @@ function Ni(i, e, t, n, s = null, r = 0, o = 0) {
2117
2117
  return !!O;
2118
2118
  }
2119
2119
  }
2120
- const qn = /* @__PURE__ */ new Ae.constructor(), Ws = /* @__PURE__ */ new Ae.constructor(), Vt = /* @__PURE__ */ new ur(() => new _t()), un = /* @__PURE__ */ new _t(), dn = /* @__PURE__ */ new _t(), hi = /* @__PURE__ */ new _t(), ui = /* @__PURE__ */ new _t();
2120
+ const qn = /* @__PURE__ */ new xe.constructor(), Ws = /* @__PURE__ */ new xe.constructor(), Vt = /* @__PURE__ */ new ur(() => new _t()), un = /* @__PURE__ */ new _t(), dn = /* @__PURE__ */ new _t(), hi = /* @__PURE__ */ new _t(), ui = /* @__PURE__ */ new _t();
2121
2121
  let di = !1;
2122
2122
  function el(i, e, t, n) {
2123
2123
  if (di)
@@ -2129,7 +2129,7 @@ function el(i, e, t, n) {
2129
2129
  for (let d = 0, u = s.length; d < u; d++) {
2130
2130
  qn.setBuffer(s[d]), c = 0;
2131
2131
  const f = Vt.getPrimitive();
2132
- xe(0, qn.float32Array, f), f.applyMatrix4(h);
2132
+ Ae(0, qn.float32Array, f), f.applyMatrix4(h);
2133
2133
  for (let p = 0, y = r.length; p < y && (Ws.setBuffer(r[p]), o = gt(
2134
2134
  0,
2135
2135
  0,
@@ -2151,10 +2151,10 @@ function el(i, e, t, n) {
2151
2151
  function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2152
2152
  let u, f;
2153
2153
  d ? (u = Ws, f = qn) : (u = qn, f = Ws);
2154
- const p = u.float32Array, y = u.uint32Array, b = u.uint16Array, S = f.float32Array, x = f.uint32Array, E = f.uint16Array, T = i * 2, _ = e * 2, A = De(T, b), P = De(_, E);
2155
- let C = !1;
2154
+ const p = u.float32Array, y = u.uint32Array, b = u.uint16Array, T = f.float32Array, x = f.uint32Array, E = f.uint16Array, S = i * 2, _ = e * 2, A = De(S, b), P = De(_, E);
2155
+ let I = !1;
2156
2156
  if (P && A)
2157
- d ? C = s(
2157
+ d ? I = s(
2158
2158
  $e(e, x),
2159
2159
  Qe(e * 2, E),
2160
2160
  $e(i, y),
@@ -2163,7 +2163,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2163
2163
  o + e / Oe,
2164
2164
  a,
2165
2165
  r + i / Oe
2166
- ) : C = s(
2166
+ ) : I = s(
2167
2167
  $e(i, y),
2168
2168
  Qe(i * 2, b),
2169
2169
  $e(e, x),
@@ -2175,11 +2175,11 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2175
2175
  );
2176
2176
  else if (P) {
2177
2177
  const M = Vt.getPrimitive();
2178
- xe(e, S, M), M.applyMatrix4(t);
2179
- const O = Fe(i), I = ze(i, y);
2180
- xe(O, p, un), xe(I, p, dn);
2178
+ Ae(e, T, M), M.applyMatrix4(t);
2179
+ const O = Fe(i), C = ze(i, y);
2180
+ Ae(O, p, un), Ae(C, p, dn);
2181
2181
  const k = M.intersectsBox(un), N = M.intersectsBox(dn);
2182
- C = k && gt(
2182
+ I = k && gt(
2183
2183
  e,
2184
2184
  O,
2185
2185
  n,
@@ -2193,7 +2193,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2193
2193
  !d
2194
2194
  ) || N && gt(
2195
2195
  e,
2196
- I,
2196
+ C,
2197
2197
  n,
2198
2198
  t,
2199
2199
  s,
@@ -2206,10 +2206,10 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2206
2206
  ), Vt.releasePrimitive(M);
2207
2207
  } else {
2208
2208
  const M = Fe(e), O = ze(e, x);
2209
- xe(M, S, hi), xe(O, S, ui);
2210
- const I = h.intersectsBox(hi), k = h.intersectsBox(ui);
2211
- if (I && k)
2212
- C = gt(
2209
+ Ae(M, T, hi), Ae(O, T, ui);
2210
+ const C = h.intersectsBox(hi), k = h.intersectsBox(ui);
2211
+ if (C && k)
2212
+ I = gt(
2213
2213
  i,
2214
2214
  M,
2215
2215
  t,
@@ -2234,9 +2234,9 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2234
2234
  h,
2235
2235
  d
2236
2236
  );
2237
- else if (I)
2237
+ else if (C)
2238
2238
  if (A)
2239
- C = gt(
2239
+ I = gt(
2240
2240
  i,
2241
2241
  M,
2242
2242
  t,
@@ -2253,9 +2253,9 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2253
2253
  const N = Vt.getPrimitive();
2254
2254
  N.copy(hi).applyMatrix4(t);
2255
2255
  const G = Fe(i), z = ze(i, y);
2256
- xe(G, p, un), xe(z, p, dn);
2256
+ Ae(G, p, un), Ae(z, p, dn);
2257
2257
  const X = N.intersectsBox(un), ie = N.intersectsBox(dn);
2258
- C = X && gt(
2258
+ I = X && gt(
2259
2259
  M,
2260
2260
  G,
2261
2261
  n,
@@ -2283,7 +2283,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2283
2283
  }
2284
2284
  else if (k)
2285
2285
  if (A)
2286
- C = gt(
2286
+ I = gt(
2287
2287
  i,
2288
2288
  O,
2289
2289
  t,
@@ -2300,9 +2300,9 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2300
2300
  const N = Vt.getPrimitive();
2301
2301
  N.copy(ui).applyMatrix4(t);
2302
2302
  const G = Fe(i), z = ze(i, y);
2303
- xe(G, p, un), xe(z, p, dn);
2303
+ Ae(G, p, un), Ae(z, p, dn);
2304
2304
  const X = N.intersectsBox(un), ie = N.intersectsBox(dn);
2305
- C = X && gt(
2305
+ I = X && gt(
2306
2306
  O,
2307
2307
  G,
2308
2308
  n,
@@ -2329,7 +2329,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, h = null, d = !1) {
2329
2329
  ), Vt.releasePrimitive(N);
2330
2330
  }
2331
2331
  }
2332
- return C;
2332
+ return I;
2333
2333
  }
2334
2334
  const jr = /* @__PURE__ */ new _t(), fn = /* @__PURE__ */ new Float32Array(6);
2335
2335
  class tl {
@@ -2356,8 +2356,8 @@ class tl {
2356
2356
  let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, h = -1 / 0, d = -1 / 0;
2357
2357
  for (let u = e, f = e + t; u < f; u++) {
2358
2358
  this.writePrimitiveBounds(u, fn, 0);
2359
- const [p, y, b, S, x, E] = fn;
2360
- p < r && (r = p), S > c && (c = S), y < o && (o = y), x > h && (h = x), b < a && (a = b), E > d && (d = E);
2359
+ const [p, y, b, T, x, E] = fn;
2360
+ p < r && (r = p), T > c && (c = T), y < o && (o = y), x > h && (h = x), b < a && (a = b), E > d && (d = E);
2361
2361
  }
2362
2362
  return n[s + 0] = r, n[s + 1] = o, n[s + 2] = a, n[s + 3] = c, n[s + 4] = h, n[s + 5] = d, n;
2363
2363
  }
@@ -2365,8 +2365,8 @@ class tl {
2365
2365
  const s = n.offset || 0;
2366
2366
  for (let r = e, o = e + t; r < o; r++) {
2367
2367
  this.writePrimitiveBounds(r, fn, 0);
2368
- const [a, c, h, d, u, f] = fn, p = (a + d) / 2, y = (c + u) / 2, b = (h + f) / 2, S = (d - a) / 2, x = (u - c) / 2, E = (f - h) / 2, T = (r - s) * 6;
2369
- n[T + 0] = p, n[T + 1] = S + (Math.abs(p) + S) * Us, n[T + 2] = y, n[T + 3] = x + (Math.abs(y) + x) * Us, n[T + 4] = b, n[T + 5] = E + (Math.abs(b) + E) * Us;
2368
+ const [a, c, h, d, u, f] = fn, p = (a + d) / 2, y = (c + u) / 2, b = (h + f) / 2, T = (d - a) / 2, x = (u - c) / 2, E = (f - h) / 2, S = (r - s) * 6;
2369
+ n[S + 0] = p, n[S + 1] = T + (Math.abs(p) + T) * Us, n[S + 2] = y, n[S + 3] = x + (Math.abs(y) + x) * Us, n[S + 4] = b, n[S + 5] = E + (Math.abs(b) + E) * Us;
2370
2370
  }
2371
2371
  return n;
2372
2372
  }
@@ -2431,8 +2431,8 @@ class tl {
2431
2431
  } else {
2432
2432
  const p = Fe(d), y = ze(d, r);
2433
2433
  for (let b = 0; b < 3; b++) {
2434
- const S = a[p + b], x = a[p + b + 3], E = a[y + b], T = a[y + b + 3];
2435
- a[d + b] = S < E ? S : E, a[d + b + 3] = x > T ? x : T;
2434
+ const T = a[p + b], x = a[p + b + 3], E = a[y + b], S = a[y + b + 3];
2435
+ a[d + b] = T < E ? T : E, a[d + b + 3] = x > S ? x : S;
2436
2436
  }
2437
2437
  }
2438
2438
  }
@@ -2445,7 +2445,7 @@ class tl {
2445
2445
  */
2446
2446
  getBoundingBox(e) {
2447
2447
  return e.makeEmpty(), this._roots.forEach((n) => {
2448
- xe(0, new Float32Array(n), jr), e.union(jr);
2448
+ Ae(0, new Float32Array(n), jr), e.union(jr);
2449
2449
  }), e;
2450
2450
  }
2451
2451
  /**
@@ -2474,7 +2474,7 @@ class tl {
2474
2474
  } = e;
2475
2475
  if (s && r) {
2476
2476
  const u = s;
2477
- s = (f, p, y, b, S) => u(f, p, y, b, S) ? !0 : a(f, p, this, r, y, b, o);
2477
+ s = (f, p, y, b, T) => u(f, p, y, b, T) ? !0 : a(f, p, this, r, y, b, o);
2478
2478
  } else s || (r ? s = (u, f, p, y) => a(u, f, this, r, p, y, o) : s = (u, f, p) => p);
2479
2479
  let c = !1, h = 0;
2480
2480
  const d = this._roots;
@@ -2541,7 +2541,7 @@ function Vr(i, e, t) {
2541
2541
  return [n];
2542
2542
  const r = [], o = n.offset, a = n.offset + n.count, c = dr(i) / t, h = [];
2543
2543
  for (const f of s) {
2544
- const { offset: p, count: y } = f, b = p, S = isFinite(y) ? y : c - p, x = p + S;
2544
+ const { offset: p, count: y } = f, b = p, T = isFinite(y) ? y : c - p, x = p + T;
2545
2545
  b < a && x > o && (h.push({ pos: Math.max(o, b), isStart: !0 }), h.push({ pos: Math.min(a, x), isStart: !1 }));
2546
2546
  }
2547
2547
  h.sort((f, p) => f.pos !== p.pos ? f.pos - p.pos : f.type === "end" ? -1 : 1);
@@ -2661,9 +2661,9 @@ const ll = /* @__PURE__ */ (function() {
2661
2661
  return function(s, r, o) {
2662
2662
  const a = s.start, c = i, h = r.start, d = e;
2663
2663
  t.subVectors(a, h), i.subVectors(s.end, s.start), e.subVectors(r.end, r.start);
2664
- const u = t.dot(d), f = d.dot(c), p = d.dot(d), y = t.dot(c), S = c.dot(c) * p - f * f;
2664
+ const u = t.dot(d), f = d.dot(c), p = d.dot(d), y = t.dot(c), T = c.dot(c) * p - f * f;
2665
2665
  let x, E;
2666
- S !== 0 ? x = (u * f - y * p) / S : x = 0, E = (u + x * f) / p, o.x = x, o.y = E;
2666
+ T !== 0 ? x = (u * f - y * p) / T : x = 0, E = (u + x * f) / p, o.x = x, o.y = E;
2667
2667
  };
2668
2668
  })(), fr = /* @__PURE__ */ (function() {
2669
2669
  const i = /* @__PURE__ */ new me(), e = /* @__PURE__ */ new $(), t = /* @__PURE__ */ new $();
@@ -2731,8 +2731,8 @@ class Tt extends Tn {
2731
2731
  u.subVectors(t, n), f.setFromPoints(u, s);
2732
2732
  const p = r[3], y = o[3];
2733
2733
  p.subVectors(n, e), y.setFromPoints(p, s);
2734
- const b = h.length(), S = u.length(), x = p.length();
2735
- this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, b < Dt ? S < Dt || x < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : S < Dt ? x < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : x < Dt && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(a, e), this.needsUpdate = !1;
2734
+ const b = h.length(), T = u.length(), x = p.length();
2735
+ this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, b < Dt ? T < Dt || x < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : T < Dt ? x < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : x < Dt && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(a, e), this.needsUpdate = !1;
2736
2736
  }
2737
2737
  }
2738
2738
  Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
@@ -2749,84 +2749,84 @@ Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
2749
2749
  })();
2750
2750
  Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2751
2751
  const i = /* @__PURE__ */ new Tt(), e = /* @__PURE__ */ new Ft(), t = /* @__PURE__ */ new Ft(), n = /* @__PURE__ */ new $(), s = /* @__PURE__ */ new $(), r = /* @__PURE__ */ new $(), o = /* @__PURE__ */ new $(), a = /* @__PURE__ */ new kt(), c = /* @__PURE__ */ new kt(), h = /* @__PURE__ */ new $(), d = /* @__PURE__ */ new me(), u = /* @__PURE__ */ new me();
2752
- function f(T, _, A, P) {
2753
- const C = n;
2754
- !T.isDegenerateIntoPoint && !T.isDegenerateIntoSegment ? C.copy(T.plane.normal) : C.copy(_.plane.normal);
2755
- const M = T.satBounds, O = T.satAxes;
2752
+ function f(S, _, A, P) {
2753
+ const I = n;
2754
+ !S.isDegenerateIntoPoint && !S.isDegenerateIntoSegment ? I.copy(S.plane.normal) : I.copy(_.plane.normal);
2755
+ const M = S.satBounds, O = S.satAxes;
2756
2756
  for (let N = 1; N < 4; N++) {
2757
2757
  const G = M[N], z = O[N];
2758
- if (e.setFromPoints(z, _.points), G.isSeparated(e) || (o.copy(C).cross(z), e.setFromPoints(o, T.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2758
+ if (e.setFromPoints(z, _.points), G.isSeparated(e) || (o.copy(I).cross(z), e.setFromPoints(o, S.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2759
2759
  }
2760
- const I = _.satBounds, k = _.satAxes;
2760
+ const C = _.satBounds, k = _.satAxes;
2761
2761
  for (let N = 1; N < 4; N++) {
2762
- const G = I[N], z = k[N];
2763
- if (e.setFromPoints(z, T.points), G.isSeparated(e) || (o.crossVectors(C, z), e.setFromPoints(o, T.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2762
+ const G = C[N], z = k[N];
2763
+ if (e.setFromPoints(z, S.points), G.isSeparated(e) || (o.crossVectors(I, z), e.setFromPoints(o, S.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2764
2764
  }
2765
2765
  return A && (P || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), A.start.set(0, 0, 0), A.end.set(0, 0, 0)), !0;
2766
2766
  }
2767
- function p(T, _, A, P, C, M, O, I, k, N, G) {
2768
- let z = O / (O - I);
2769
- N.x = P + (C - P) * z, G.start.subVectors(_, T).multiplyScalar(z).add(T), z = O / (O - k), N.y = P + (M - P) * z, G.end.subVectors(A, T).multiplyScalar(z).add(T);
2767
+ function p(S, _, A, P, I, M, O, C, k, N, G) {
2768
+ let z = O / (O - C);
2769
+ N.x = P + (I - P) * z, G.start.subVectors(_, S).multiplyScalar(z).add(S), z = O / (O - k), N.y = P + (M - P) * z, G.end.subVectors(A, S).multiplyScalar(z).add(S);
2770
2770
  }
2771
- function y(T, _, A, P, C, M, O, I, k, N, G) {
2772
- if (C > 0)
2773
- p(T.c, T.a, T.b, P, _, A, k, O, I, N, G);
2771
+ function y(S, _, A, P, I, M, O, C, k, N, G) {
2772
+ if (I > 0)
2773
+ p(S.c, S.a, S.b, P, _, A, k, O, C, N, G);
2774
2774
  else if (M > 0)
2775
- p(T.b, T.a, T.c, A, _, P, I, O, k, N, G);
2776
- else if (I * k > 0 || O != 0)
2777
- p(T.a, T.b, T.c, _, A, P, O, I, k, N, G);
2778
- else if (I != 0)
2779
- p(T.b, T.a, T.c, A, _, P, I, O, k, N, G);
2775
+ p(S.b, S.a, S.c, A, _, P, C, O, k, N, G);
2776
+ else if (C * k > 0 || O != 0)
2777
+ p(S.a, S.b, S.c, _, A, P, O, C, k, N, G);
2778
+ else if (C != 0)
2779
+ p(S.b, S.a, S.c, A, _, P, C, O, k, N, G);
2780
2780
  else if (k != 0)
2781
- p(T.c, T.a, T.b, P, _, A, k, O, I, N, G);
2781
+ p(S.c, S.a, S.b, P, _, A, k, O, C, N, G);
2782
2782
  else
2783
2783
  return !0;
2784
2784
  return !1;
2785
2785
  }
2786
- function b(T, _, A, P) {
2787
- const C = _.degenerateSegment, M = T.plane.distanceToPoint(C.start), O = T.plane.distanceToPoint(C.end);
2788
- return at(M) ? at(O) ? f(T, _, A, P) : (A && (A.start.copy(C.start), A.end.copy(C.start)), T.containsPoint(C.start)) : at(O) ? (A && (A.start.copy(C.end), A.end.copy(C.end)), T.containsPoint(C.end)) : T.plane.intersectLine(C, n) != null ? (A && (A.start.copy(n), A.end.copy(n)), T.containsPoint(n)) : !1;
2786
+ function b(S, _, A, P) {
2787
+ const I = _.degenerateSegment, M = S.plane.distanceToPoint(I.start), O = S.plane.distanceToPoint(I.end);
2788
+ return at(M) ? at(O) ? f(S, _, A, P) : (A && (A.start.copy(I.start), A.end.copy(I.start)), S.containsPoint(I.start)) : at(O) ? (A && (A.start.copy(I.end), A.end.copy(I.end)), S.containsPoint(I.end)) : S.plane.intersectLine(I, n) != null ? (A && (A.start.copy(n), A.end.copy(n)), S.containsPoint(n)) : !1;
2789
2789
  }
2790
- function S(T, _, A) {
2790
+ function T(S, _, A) {
2791
2791
  const P = _.a;
2792
- return at(T.plane.distanceToPoint(P)) && T.containsPoint(P) ? (A && (A.start.copy(P), A.end.copy(P)), !0) : !1;
2792
+ return at(S.plane.distanceToPoint(P)) && S.containsPoint(P) ? (A && (A.start.copy(P), A.end.copy(P)), !0) : !1;
2793
2793
  }
2794
- function x(T, _, A) {
2795
- const P = T.degenerateSegment, C = _.a;
2796
- return P.closestPointToPoint(C, !0, n), C.distanceToSquared(n) < Wr ? (A && (A.start.copy(C), A.end.copy(C)), !0) : !1;
2794
+ function x(S, _, A) {
2795
+ const P = S.degenerateSegment, I = _.a;
2796
+ return P.closestPointToPoint(I, !0, n), I.distanceToSquared(n) < Wr ? (A && (A.start.copy(I), A.end.copy(I)), !0) : !1;
2797
2797
  }
2798
- function E(T, _, A, P) {
2799
- if (T.isDegenerateIntoSegment)
2798
+ function E(S, _, A, P) {
2799
+ if (S.isDegenerateIntoSegment)
2800
2800
  if (_.isDegenerateIntoSegment) {
2801
- const C = T.degenerateSegment, M = _.degenerateSegment, O = s, I = r;
2802
- C.delta(O), M.delta(I);
2803
- const k = n.subVectors(M.start, C.start), N = O.x * I.y - O.y * I.x;
2801
+ const I = S.degenerateSegment, M = _.degenerateSegment, O = s, C = r;
2802
+ I.delta(O), M.delta(C);
2803
+ const k = n.subVectors(M.start, I.start), N = O.x * C.y - O.y * C.x;
2804
2804
  if (at(N))
2805
2805
  return !1;
2806
- const G = (k.x * I.y - k.y * I.x) / N, z = -(O.x * k.y - O.y * k.x) / N;
2806
+ const G = (k.x * C.y - k.y * C.x) / N, z = -(O.x * k.y - O.y * k.x) / N;
2807
2807
  if (G < 0 || G > 1 || z < 0 || z > 1)
2808
2808
  return !1;
2809
- const X = C.start.z + O.z * G, ie = M.start.z + I.z * z;
2810
- return at(X - ie) ? (A && (A.start.copy(C.start).addScaledVector(O, G), A.end.copy(C.start).addScaledVector(O, G)), !0) : !1;
2811
- } else return _.isDegenerateIntoPoint ? x(T, _, A) : b(_, T, A, P);
2809
+ const X = I.start.z + O.z * G, ie = M.start.z + C.z * z;
2810
+ return at(X - ie) ? (A && (A.start.copy(I.start).addScaledVector(O, G), A.end.copy(I.start).addScaledVector(O, G)), !0) : !1;
2811
+ } else return _.isDegenerateIntoPoint ? x(S, _, A) : b(_, S, A, P);
2812
2812
  else {
2813
- if (T.isDegenerateIntoPoint)
2814
- return _.isDegenerateIntoPoint ? _.a.distanceToSquared(T.a) < Wr ? (A && (A.start.copy(T.a), A.end.copy(T.a)), !0) : !1 : _.isDegenerateIntoSegment ? x(_, T, A) : S(_, T, A);
2813
+ if (S.isDegenerateIntoPoint)
2814
+ return _.isDegenerateIntoPoint ? _.a.distanceToSquared(S.a) < Wr ? (A && (A.start.copy(S.a), A.end.copy(S.a)), !0) : !1 : _.isDegenerateIntoSegment ? x(_, S, A) : T(_, S, A);
2815
2815
  if (_.isDegenerateIntoPoint)
2816
- return S(T, _, A);
2816
+ return T(S, _, A);
2817
2817
  if (_.isDegenerateIntoSegment)
2818
- return b(T, _, A, P);
2818
+ return b(S, _, A, P);
2819
2819
  }
2820
2820
  }
2821
2821
  return function(_, A = null, P = !1) {
2822
2822
  this.needsUpdate && this.update(), _.isExtendedTriangle ? _.needsUpdate && _.update() : (i.copy(_), i.update(), _ = i);
2823
- const C = E(this, _, A, P);
2824
- if (C !== void 0)
2825
- return C;
2823
+ const I = E(this, _, A, P);
2824
+ if (I !== void 0)
2825
+ return I;
2826
2826
  const M = this.plane, O = _.plane;
2827
- let I = O.distanceToPoint(this.a), k = O.distanceToPoint(this.b), N = O.distanceToPoint(this.c);
2828
- at(I) && (I = 0), at(k) && (k = 0), at(N) && (N = 0);
2829
- const G = I * k, z = I * N;
2827
+ let C = O.distanceToPoint(this.a), k = O.distanceToPoint(this.b), N = O.distanceToPoint(this.c);
2828
+ at(C) && (C = 0), at(k) && (k = 0), at(N) && (N = 0);
2829
+ const G = C * k, z = C * N;
2830
2830
  if (G > 0 && z > 0)
2831
2831
  return !1;
2832
2832
  let X = M.distanceToPoint(_.a), ie = M.distanceToPoint(_.b), Ne = M.distanceToPoint(_.c);
@@ -2839,10 +2839,10 @@ Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2839
2839
  let Ve = 0, ve = Math.abs(Ue.x);
2840
2840
  const ye = Math.abs(Ue.y);
2841
2841
  ye > ve && (ve = ye, Ve = 1), Math.abs(Ue.z) > ve && (Ve = 2);
2842
- const We = ul[Ve], zt = this.a[We], ge = this.b[We], ft = this.c[We], pt = _.a[We], In = _.b[We], an = _.c[We];
2843
- if (y(this, zt, ge, ft, G, z, I, k, N, d, a))
2842
+ const We = ul[Ve], zt = this.a[We], ge = this.b[We], ft = this.c[We], pt = _.a[We], Cn = _.b[We], an = _.c[We];
2843
+ if (y(this, zt, ge, ft, G, z, C, k, N, d, a))
2844
2844
  return f(this, _, A, P);
2845
- if (y(_, pt, In, an, dt, Me, X, ie, Ne, u, c))
2845
+ if (y(_, pt, Cn, an, dt, Me, X, ie, Ne, u, c))
2846
2846
  return f(this, _, A, P);
2847
2847
  if (d.y < d.x) {
2848
2848
  const Lt = d.y;
@@ -2879,8 +2879,8 @@ Tt.prototype.distanceToTriangle = /* @__PURE__ */ (function() {
2879
2879
  const f = t[u], p = t[(u + 1) % 3];
2880
2880
  n.set(this[f], this[p]);
2881
2881
  for (let y = 0; y < 3; y++) {
2882
- const b = t[y], S = t[(y + 1) % 3];
2883
- s.set(o[b], o[S]), fr(n, s, i, e);
2882
+ const b = t[y], T = t[(y + 1) % 3];
2883
+ s.set(o[b], o[T]), fr(n, s, i, e);
2884
2884
  const x = i.distanceToSquared(e);
2885
2885
  x < d && (d = x, a && a.copy(i), c && c.copy(e));
2886
2886
  }
@@ -2979,35 +2979,35 @@ Je.prototype.distanceToBox = /* @__PURE__ */ (function() {
2979
2979
  return (c || h) && (o.getCenter(s), this.closestPointToPoint(s, n), o.closestPointToPoint(n, s), c && c.copy(n), h && h.copy(s)), 0;
2980
2980
  const d = a * a, u = o.min, f = o.max, p = this.points;
2981
2981
  let y = 1 / 0;
2982
- for (let S = 0; S < 8; S++) {
2983
- const x = p[S];
2982
+ for (let T = 0; T < 8; T++) {
2983
+ const x = p[T];
2984
2984
  s.copy(x).clamp(u, f);
2985
2985
  const E = x.distanceToSquared(s);
2986
2986
  if (E < y && (y = E, c && c.copy(x), h && h.copy(s), E < d))
2987
2987
  return Math.sqrt(E);
2988
2988
  }
2989
2989
  let b = 0;
2990
- for (let S = 0; S < 3; S++)
2990
+ for (let T = 0; T < 3; T++)
2991
2991
  for (let x = 0; x <= 1; x++)
2992
2992
  for (let E = 0; E <= 1; E++) {
2993
- const T = (S + 1) % 3, _ = (S + 2) % 3, A = x << T | E << _, P = 1 << S | x << T | E << _, C = p[A], M = p[P];
2994
- e[b].set(C, M);
2995
- const I = i[S], k = i[T], N = i[_], G = t[b], z = G.start, X = G.end;
2996
- z[I] = u[I], z[k] = x ? u[k] : f[k], z[N] = E ? u[N] : f[k], X[I] = f[I], X[k] = x ? u[k] : f[k], X[N] = E ? u[N] : f[k], b++;
2993
+ const S = (T + 1) % 3, _ = (T + 2) % 3, A = x << S | E << _, P = 1 << T | x << S | E << _, I = p[A], M = p[P];
2994
+ e[b].set(I, M);
2995
+ const C = i[T], k = i[S], N = i[_], G = t[b], z = G.start, X = G.end;
2996
+ z[C] = u[C], z[k] = x ? u[k] : f[k], z[N] = E ? u[N] : f[k], X[C] = f[C], X[k] = x ? u[k] : f[k], X[N] = E ? u[N] : f[k], b++;
2997
2997
  }
2998
- for (let S = 0; S <= 1; S++)
2998
+ for (let T = 0; T <= 1; T++)
2999
2999
  for (let x = 0; x <= 1; x++)
3000
3000
  for (let E = 0; E <= 1; E++) {
3001
- s.x = S ? f.x : u.x, s.y = x ? f.y : u.y, s.z = E ? f.z : u.z, this.closestPointToPoint(s, n);
3002
- const T = s.distanceToSquared(n);
3003
- if (T < y && (y = T, c && c.copy(n), h && h.copy(s), T < d))
3004
- return Math.sqrt(T);
3001
+ s.x = T ? f.x : u.x, s.y = x ? f.y : u.y, s.z = E ? f.z : u.z, this.closestPointToPoint(s, n);
3002
+ const S = s.distanceToSquared(n);
3003
+ if (S < y && (y = S, c && c.copy(n), h && h.copy(s), S < d))
3004
+ return Math.sqrt(S);
3005
3005
  }
3006
- for (let S = 0; S < 12; S++) {
3007
- const x = e[S];
3006
+ for (let T = 0; T < 12; T++) {
3007
+ const x = e[T];
3008
3008
  for (let E = 0; E < 12; E++) {
3009
- const T = t[E];
3010
- fr(x, T, n, s);
3009
+ const S = t[E];
3010
+ fr(x, S, n, s);
3011
3011
  const _ = n.distanceToSquared(s);
3012
3012
  if (_ < y && (y = _, c && c.copy(n), h && h.copy(s), _ < d))
3013
3013
  return Math.sqrt(_);
@@ -3042,7 +3042,7 @@ function fl(i, e, t = {}, n = 0, s = 1 / 0) {
3042
3042
  const Ts = parseInt(vo) >= 169, pl = parseInt(vo) <= 161, Qt = /* @__PURE__ */ new $(), Jt = /* @__PURE__ */ new $(), en = /* @__PURE__ */ new $(), Ss = /* @__PURE__ */ new me(), _s = /* @__PURE__ */ new me(), bs = /* @__PURE__ */ new me(), Zr = /* @__PURE__ */ new $(), Kr = /* @__PURE__ */ new $(), Xr = /* @__PURE__ */ new $(), kn = /* @__PURE__ */ new $();
3043
3043
  function ml(i, e, t, n, s, r, o, a) {
3044
3044
  let c;
3045
- if (r === Ao ? c = i.intersectTriangle(n, t, e, !0, s) : c = i.intersectTriangle(e, t, n, r !== xo, s), c === null) return null;
3045
+ if (r === xo ? c = i.intersectTriangle(n, t, e, !0, s) : c = i.intersectTriangle(e, t, n, r !== Ao, s), c === null) return null;
3046
3046
  const h = i.origin.distanceTo(s);
3047
3047
  return h < o || h > a ? null : {
3048
3048
  distance: h,
@@ -3090,13 +3090,13 @@ function Qs(i, e, t, n, s, r, o) {
3090
3090
  let c = a + 0, h = a + 1, d = a + 2;
3091
3091
  const { index: u, groups: f } = i;
3092
3092
  i.index && (c = u.getX(c), h = u.getX(h), d = u.getX(d));
3093
- const { position: p, normal: y, uv: b, uv1: S } = i.attributes;
3093
+ const { position: p, normal: y, uv: b, uv1: T } = i.attributes;
3094
3094
  if (Array.isArray(e)) {
3095
3095
  const x = n * 3;
3096
- for (let E = 0, T = f.length; E < T; E++) {
3096
+ for (let E = 0, S = f.length; E < S; E++) {
3097
3097
  const { start: _, count: A, materialIndex: P } = f[E];
3098
3098
  if (x >= _ && x < _ + A) {
3099
- const C = qr(e[P]), M = Yr(t, p, y, b, S, c, h, d, C, r, o);
3099
+ const I = qr(e[P]), M = Yr(t, p, y, b, T, c, h, d, I, r, o);
3100
3100
  if (M)
3101
3101
  if (M.faceIndex = n, M.face.materialIndex = P, s)
3102
3102
  s.push(M);
@@ -3105,7 +3105,7 @@ function Qs(i, e, t, n, s, r, o) {
3105
3105
  }
3106
3106
  }
3107
3107
  } else {
3108
- const x = qr(e), E = Yr(t, p, y, b, S, c, h, d, x, r, o);
3108
+ const x = qr(e), E = Yr(t, p, y, b, T, c, h, d, x, r, o);
3109
3109
  if (E)
3110
3110
  if (E.faceIndex = n, E.face.materialIndex = 0, s)
3111
3111
  s.push(E);
@@ -3114,7 +3114,7 @@ function Qs(i, e, t, n, s, r, o) {
3114
3114
  }
3115
3115
  return null;
3116
3116
  }
3117
- function Ce(i, e, t, n) {
3117
+ function Ie(i, e, t, n) {
3118
3118
  const s = i.a, r = i.b, o = i.c;
3119
3119
  let a = e, c = e + 1, h = e + 2;
3120
3120
  t && (a = t.getX(a), c = t.getX(c), h = t.getX(h)), s.x = n.getX(a), s.y = n.getY(a), s.z = n.getZ(a), r.x = n.getX(c), r.y = n.getY(c), r.z = n.getZ(c), o.x = n.getX(h), o.y = n.getY(h), o.z = n.getZ(h);
@@ -3137,7 +3137,7 @@ function wl(i, e, t, n, s, r, o) {
3137
3137
  const { geometry: a } = t, { index: c } = a, h = a.attributes.position;
3138
3138
  for (let d = i, u = e + i; d < u; d++) {
3139
3139
  let f;
3140
- if (f = d, Ce(o, f * 3, c, h), o.needsUpdate = !0, n(o, f, s, r))
3140
+ if (f = d, Ie(o, f * 3, c, h), o.needsUpdate = !0, n(o, f, s, r))
3141
3141
  return !0;
3142
3142
  }
3143
3143
  return !1;
@@ -3152,34 +3152,34 @@ function El(i, e = null) {
3152
3152
  function u(f, p, y = !1) {
3153
3153
  const b = f * 2;
3154
3154
  if (De(b, a)) {
3155
- const S = $e(f, o), x = Qe(b, a);
3156
- let E = 1 / 0, T = 1 / 0, _ = 1 / 0, A = -1 / 0, P = -1 / 0, C = -1 / 0;
3157
- for (let M = 3 * S, O = 3 * (S + x); M < O; M++) {
3158
- let I = n[M];
3159
- const k = s.getX(I), N = s.getY(I), G = s.getZ(I);
3160
- k < E && (E = k), k > A && (A = k), N < T && (T = N), N > P && (P = N), G < _ && (_ = G), G > C && (C = G);
3161
- }
3162
- return c[f + 0] !== E || c[f + 1] !== T || c[f + 2] !== _ || c[f + 3] !== A || c[f + 4] !== P || c[f + 5] !== C ? (c[f + 0] = E, c[f + 1] = T, c[f + 2] = _, c[f + 3] = A, c[f + 4] = P, c[f + 5] = C, !0) : !1;
3155
+ const T = $e(f, o), x = Qe(b, a);
3156
+ let E = 1 / 0, S = 1 / 0, _ = 1 / 0, A = -1 / 0, P = -1 / 0, I = -1 / 0;
3157
+ for (let M = 3 * T, O = 3 * (T + x); M < O; M++) {
3158
+ let C = n[M];
3159
+ const k = s.getX(C), N = s.getY(C), G = s.getZ(C);
3160
+ k < E && (E = k), k > A && (A = k), N < S && (S = N), N > P && (P = N), G < _ && (_ = G), G > I && (I = G);
3161
+ }
3162
+ return c[f + 0] !== E || c[f + 1] !== S || c[f + 2] !== _ || c[f + 3] !== A || c[f + 4] !== P || c[f + 5] !== I ? (c[f + 0] = E, c[f + 1] = S, c[f + 2] = _, c[f + 3] = A, c[f + 4] = P, c[f + 5] = I, !0) : !1;
3163
3163
  } else {
3164
- const S = Fe(f), x = ze(f, o);
3165
- let E = y, T = !1, _ = !1;
3164
+ const T = Fe(f), x = ze(f, o);
3165
+ let E = y, S = !1, _ = !1;
3166
3166
  if (e) {
3167
3167
  if (!E) {
3168
- const I = S / Oe + p / qe, k = x / Oe + p / qe;
3169
- T = e.has(I), _ = e.has(k), E = !T && !_;
3168
+ const C = T / Oe + p / qe, k = x / Oe + p / qe;
3169
+ S = e.has(C), _ = e.has(k), E = !S && !_;
3170
3170
  }
3171
3171
  } else
3172
- T = !0, _ = !0;
3173
- const A = E || T, P = E || _;
3174
- let C = !1;
3175
- A && (C = u(S, p, E));
3172
+ S = !0, _ = !0;
3173
+ const A = E || S, P = E || _;
3174
+ let I = !1;
3175
+ A && (I = u(T, p, E));
3176
3176
  let M = !1;
3177
3177
  P && (M = u(x, p, E));
3178
- const O = C || M;
3178
+ const O = I || M;
3179
3179
  if (O)
3180
- for (let I = 0; I < 3; I++) {
3181
- const k = S + I, N = x + I, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3182
- c[f + I] = G < X ? G : X, c[f + I + 3] = z > ie ? z : ie;
3180
+ for (let C = 0; C < 3; C++) {
3181
+ const k = T + C, N = x + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3182
+ c[f + C] = G < X ? G : X, c[f + C + 3] = z > ie ? z : ie;
3183
3183
  }
3184
3184
  return O;
3185
3185
  }
@@ -3187,9 +3187,9 @@ function El(i, e = null) {
3187
3187
  }
3188
3188
  function Yt(i, e, t, n, s) {
3189
3189
  let r, o, a, c, h, d;
3190
- const u = 1 / t.direction.x, f = 1 / t.direction.y, p = 1 / t.direction.z, y = t.origin.x, b = t.origin.y, S = t.origin.z;
3191
- let x = e[i], E = e[i + 3], T = e[i + 1], _ = e[i + 3 + 1], A = e[i + 2], P = e[i + 3 + 2];
3192
- return u >= 0 ? (r = (x - y) * u, o = (E - y) * u) : (r = (E - y) * u, o = (x - y) * u), f >= 0 ? (a = (T - b) * f, c = (_ - b) * f) : (a = (_ - b) * f, c = (T - b) * f), r > c || a > o || ((a > r || isNaN(r)) && (r = a), (c < o || isNaN(o)) && (o = c), p >= 0 ? (h = (A - S) * p, d = (P - S) * p) : (h = (P - S) * p, d = (A - S) * p), r > d || h > o) ? !1 : ((h > r || r !== r) && (r = h), (d < o || o !== o) && (o = d), r <= s && o >= n);
3190
+ const u = 1 / t.direction.x, f = 1 / t.direction.y, p = 1 / t.direction.z, y = t.origin.x, b = t.origin.y, T = t.origin.z;
3191
+ let x = e[i], E = e[i + 3], S = e[i + 1], _ = e[i + 3 + 1], A = e[i + 2], P = e[i + 3 + 2];
3192
+ return u >= 0 ? (r = (x - y) * u, o = (E - y) * u) : (r = (E - y) * u, o = (x - y) * u), f >= 0 ? (a = (S - b) * f, c = (_ - b) * f) : (a = (_ - b) * f, c = (S - b) * f), r > c || a > o || ((a > r || isNaN(r)) && (r = a), (c < o || isNaN(o)) && (o = c), p >= 0 ? (h = (A - T) * p, d = (P - T) * p) : (h = (P - T) * p, d = (A - T) * p), r > d || h > o) ? !1 : ((h > r || r !== r) && (r = h), (d < o || o !== o) && (o = d), r <= s && o >= n);
3193
3193
  }
3194
3194
  function Tl(i, e, t, n, s, r, o, a) {
3195
3195
  const { geometry: c, _indirectBuffer: h } = i;
@@ -3211,16 +3211,16 @@ function _l(i, e, t, n, s, r, o) {
3211
3211
  const { geometry: a } = t, { index: c } = a, h = a.attributes.position;
3212
3212
  for (let d = i, u = e + i; d < u; d++) {
3213
3213
  let f;
3214
- if (f = t.resolveTriangleIndex(d), Ce(o, f * 3, c, h), o.needsUpdate = !0, n(o, f, s, r))
3214
+ if (f = t.resolveTriangleIndex(d), Ie(o, f * 3, c, h), o.needsUpdate = !0, n(o, f, s, r))
3215
3215
  return !0;
3216
3216
  }
3217
3217
  return !1;
3218
3218
  }
3219
3219
  function bl(i, e, t, n, s, r, o) {
3220
- Ae.setBuffer(i._roots[e]), ki(0, i, t, n, s, r, o), Ae.clearBuffer();
3220
+ xe.setBuffer(i._roots[e]), ki(0, i, t, n, s, r, o), xe.clearBuffer();
3221
3221
  }
3222
3222
  function ki(i, e, t, n, s, r, o) {
3223
- const { float32Array: a, uint16Array: c, uint32Array: h } = Ae, d = i * 2;
3223
+ const { float32Array: a, uint16Array: c, uint32Array: h } = xe, d = i * 2;
3224
3224
  if (De(d, c)) {
3225
3225
  const f = $e(i, h), p = Qe(d, c);
3226
3226
  gl(e, t, n, f, p, s, r, o);
@@ -3231,114 +3231,114 @@ function ki(i, e, t, n, s, r, o) {
3231
3231
  Yt(p, a, n, r, o) && ki(p, e, t, n, s, r, o);
3232
3232
  }
3233
3233
  }
3234
- const Al = ["x", "y", "z"];
3235
- function xl(i, e, t, n, s, r) {
3236
- Ae.setBuffer(i._roots[e]);
3234
+ const xl = ["x", "y", "z"];
3235
+ function Al(i, e, t, n, s, r) {
3236
+ xe.setBuffer(i._roots[e]);
3237
3237
  const o = Fi(0, i, t, n, s, r);
3238
- return Ae.clearBuffer(), o;
3238
+ return xe.clearBuffer(), o;
3239
3239
  }
3240
3240
  function Fi(i, e, t, n, s, r) {
3241
- const { float32Array: o, uint16Array: a, uint32Array: c } = Ae;
3241
+ const { float32Array: o, uint16Array: a, uint32Array: c } = xe;
3242
3242
  let h = i * 2;
3243
3243
  if (De(h, a)) {
3244
3244
  const u = $e(i, c), f = Qe(h, a);
3245
3245
  return yl(e, t, n, u, f, s, r);
3246
3246
  } else {
3247
- const u = hr(i, c), f = Al[u], y = n.direction[f] >= 0;
3248
- let b, S;
3249
- y ? (b = Fe(i), S = ze(i, c)) : (b = ze(i, c), S = Fe(i));
3247
+ const u = hr(i, c), f = xl[u], y = n.direction[f] >= 0;
3248
+ let b, T;
3249
+ y ? (b = Fe(i), T = ze(i, c)) : (b = ze(i, c), T = Fe(i));
3250
3250
  const E = Yt(b, o, n, s, r) ? Fi(b, e, t, n, s, r) : null;
3251
3251
  if (E) {
3252
3252
  const A = E.point[f];
3253
- if (y ? A <= o[S + u] : (
3253
+ if (y ? A <= o[T + u] : (
3254
3254
  // min bounding data
3255
- A >= o[S + u + 3]
3255
+ A >= o[T + u + 3]
3256
3256
  ))
3257
3257
  return E;
3258
3258
  }
3259
- const _ = Yt(S, o, n, s, r) ? Fi(S, e, t, n, s, r) : null;
3259
+ const _ = Yt(T, o, n, s, r) ? Fi(T, e, t, n, s, r) : null;
3260
3260
  return E && _ ? E.distance <= _.distance ? E : _ : E || _ || null;
3261
3261
  }
3262
3262
  }
3263
- const As = /* @__PURE__ */ new _t(), pn = /* @__PURE__ */ new Tt(), mn = /* @__PURE__ */ new Tt(), Fn = /* @__PURE__ */ new ut(), $r = /* @__PURE__ */ new Je(), xs = /* @__PURE__ */ new Je();
3263
+ const xs = /* @__PURE__ */ new _t(), pn = /* @__PURE__ */ new Tt(), mn = /* @__PURE__ */ new Tt(), Fn = /* @__PURE__ */ new ut(), $r = /* @__PURE__ */ new Je(), As = /* @__PURE__ */ new Je();
3264
3264
  function vl(i, e, t, n) {
3265
- Ae.setBuffer(i._roots[e]);
3265
+ xe.setBuffer(i._roots[e]);
3266
3266
  const s = zi(0, i, t, n);
3267
- return Ae.clearBuffer(), s;
3267
+ return xe.clearBuffer(), s;
3268
3268
  }
3269
3269
  function zi(i, e, t, n, s = null) {
3270
- const { float32Array: r, uint16Array: o, uint32Array: a } = Ae;
3270
+ const { float32Array: r, uint16Array: o, uint32Array: a } = xe;
3271
3271
  let c = i * 2;
3272
3272
  if (s === null && (t.boundingBox || t.computeBoundingBox(), $r.set(t.boundingBox.min, t.boundingBox.max, n), s = $r), De(c, o)) {
3273
- const d = e.geometry, u = d.index, f = d.attributes.position, p = t.index, y = t.attributes.position, b = $e(i, a), S = Qe(c, o);
3273
+ const d = e.geometry, u = d.index, f = d.attributes.position, p = t.index, y = t.attributes.position, b = $e(i, a), T = Qe(c, o);
3274
3274
  if (Fn.copy(n).invert(), t.boundsTree)
3275
- return xe(i, r, xs), xs.matrix.copy(Fn), xs.needsUpdate = !0, t.boundsTree.shapecast({
3276
- intersectsBounds: (E) => xs.intersectsBox(E),
3275
+ return Ae(i, r, As), As.matrix.copy(Fn), As.needsUpdate = !0, t.boundsTree.shapecast({
3276
+ intersectsBounds: (E) => As.intersectsBox(E),
3277
3277
  intersectsTriangle: (E) => {
3278
3278
  E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
3279
- for (let T = b * 3, _ = (S + b) * 3; T < _; T += 3)
3280
- if (Ce(mn, T, u, f), mn.needsUpdate = !0, E.intersectsTriangle(mn))
3279
+ for (let S = b * 3, _ = (T + b) * 3; S < _; S += 3)
3280
+ if (Ie(mn, S, u, f), mn.needsUpdate = !0, E.intersectsTriangle(mn))
3281
3281
  return !0;
3282
3282
  return !1;
3283
3283
  }
3284
3284
  });
3285
3285
  {
3286
3286
  const x = $s(t);
3287
- for (let E = b * 3, T = (S + b) * 3; E < T; E += 3) {
3288
- Ce(pn, E, u, f), pn.a.applyMatrix4(Fn), pn.b.applyMatrix4(Fn), pn.c.applyMatrix4(Fn), pn.needsUpdate = !0;
3287
+ for (let E = b * 3, S = (T + b) * 3; E < S; E += 3) {
3288
+ Ie(pn, E, u, f), pn.a.applyMatrix4(Fn), pn.b.applyMatrix4(Fn), pn.c.applyMatrix4(Fn), pn.needsUpdate = !0;
3289
3289
  for (let _ = 0, A = x * 3; _ < A; _ += 3)
3290
- if (Ce(mn, _, p, y), mn.needsUpdate = !0, pn.intersectsTriangle(mn))
3290
+ if (Ie(mn, _, p, y), mn.needsUpdate = !0, pn.intersectsTriangle(mn))
3291
3291
  return !0;
3292
3292
  }
3293
3293
  }
3294
3294
  } else {
3295
3295
  const d = Fe(i), u = ze(i, a);
3296
- return xe(d, r, As), !!(s.intersectsBox(As) && zi(d, e, t, n, s) || (xe(u, r, As), s.intersectsBox(As) && zi(u, e, t, n, s)));
3296
+ return Ae(d, r, xs), !!(s.intersectsBox(xs) && zi(d, e, t, n, s) || (Ae(u, r, xs), s.intersectsBox(xs) && zi(u, e, t, n, s)));
3297
3297
  }
3298
3298
  }
3299
- const vs = /* @__PURE__ */ new ut(), pi = /* @__PURE__ */ new Je(), zn = /* @__PURE__ */ new Je(), Rl = /* @__PURE__ */ new $(), Ml = /* @__PURE__ */ new $(), Il = /* @__PURE__ */ new $(), Cl = /* @__PURE__ */ new $();
3299
+ const vs = /* @__PURE__ */ new ut(), pi = /* @__PURE__ */ new Je(), zn = /* @__PURE__ */ new Je(), Rl = /* @__PURE__ */ new $(), Ml = /* @__PURE__ */ new $(), Cl = /* @__PURE__ */ new $(), Il = /* @__PURE__ */ new $();
3300
3300
  function Pl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3301
3301
  e.boundingBox || e.computeBoundingBox(), pi.set(e.boundingBox.min, e.boundingBox.max, t), pi.needsUpdate = !0;
3302
3302
  const a = i.geometry, c = a.attributes.position, h = a.index, d = e.attributes.position, u = e.index, f = ht.getPrimitive(), p = ht.getPrimitive();
3303
- let y = Rl, b = Ml, S = null, x = null;
3304
- s && (S = Il, x = Cl);
3305
- let E = 1 / 0, T = null, _ = null;
3303
+ let y = Rl, b = Ml, T = null, x = null;
3304
+ s && (T = Cl, x = Il);
3305
+ let E = 1 / 0, S = null, _ = null;
3306
3306
  return vs.copy(t).invert(), zn.matrix.copy(vs), i.shapecast(
3307
3307
  {
3308
3308
  boundsTraverseOrder: (A) => pi.distanceToBox(A),
3309
- intersectsBounds: (A, P, C) => C < E && C < o ? (P && (zn.min.copy(A.min), zn.max.copy(A.max), zn.needsUpdate = !0), !0) : !1,
3309
+ intersectsBounds: (A, P, I) => I < E && I < o ? (P && (zn.min.copy(A.min), zn.max.copy(A.max), zn.needsUpdate = !0), !0) : !1,
3310
3310
  intersectsRange: (A, P) => {
3311
3311
  if (e.boundsTree)
3312
3312
  return e.boundsTree.shapecast({
3313
3313
  boundsTraverseOrder: (M) => zn.distanceToBox(M),
3314
- intersectsBounds: (M, O, I) => I < E && I < o,
3314
+ intersectsBounds: (M, O, C) => C < E && C < o,
3315
3315
  intersectsRange: (M, O) => {
3316
- for (let I = M, k = M + O; I < k; I++) {
3317
- Ce(p, 3 * I, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3316
+ for (let C = M, k = M + O; C < k; C++) {
3317
+ Ie(p, 3 * C, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3318
3318
  for (let N = A, G = A + P; N < G; N++) {
3319
- Ce(f, 3 * N, h, c), f.needsUpdate = !0;
3320
- const z = f.distanceToTriangle(p, y, S);
3321
- if (z < E && (b.copy(y), x && x.copy(S), E = z, T = N, _ = I), z < r)
3319
+ Ie(f, 3 * N, h, c), f.needsUpdate = !0;
3320
+ const z = f.distanceToTriangle(p, y, T);
3321
+ if (z < E && (b.copy(y), x && x.copy(T), E = z, S = N, _ = C), z < r)
3322
3322
  return !0;
3323
3323
  }
3324
3324
  }
3325
3325
  }
3326
3326
  });
3327
3327
  {
3328
- const C = $s(e);
3329
- for (let M = 0, O = C; M < O; M++) {
3330
- Ce(p, 3 * M, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3331
- for (let I = A, k = A + P; I < k; I++) {
3332
- Ce(f, 3 * I, h, c), f.needsUpdate = !0;
3333
- const N = f.distanceToTriangle(p, y, S);
3334
- if (N < E && (b.copy(y), x && x.copy(S), E = N, T = I, _ = M), N < r)
3328
+ const I = $s(e);
3329
+ for (let M = 0, O = I; M < O; M++) {
3330
+ Ie(p, 3 * M, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3331
+ for (let C = A, k = A + P; C < k; C++) {
3332
+ Ie(f, 3 * C, h, c), f.needsUpdate = !0;
3333
+ const N = f.distanceToTriangle(p, y, T);
3334
+ if (N < E && (b.copy(y), x && x.copy(T), E = N, S = C, _ = M), N < r)
3335
3335
  return !0;
3336
3336
  }
3337
3337
  }
3338
3338
  }
3339
3339
  }
3340
3340
  }
3341
- ), ht.releasePrimitive(f), ht.releasePrimitive(p), E === 1 / 0 ? null : (n.point ? n.point.copy(b) : n.point = b.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(x) : s.point = x.clone(), s.point.applyMatrix4(vs), b.applyMatrix4(vs), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3341
+ ), ht.releasePrimitive(f), ht.releasePrimitive(p), E === 1 / 0 ? null : (n.point ? n.point.copy(b) : n.point = b.clone(), n.distance = E, n.faceIndex = S, s && (s.point ? s.point.copy(x) : s.point = x.clone(), s.point.applyMatrix4(vs), b.applyMatrix4(vs), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3342
3342
  }
3343
3343
  function Ll(i, e = null) {
3344
3344
  e && Array.isArray(e) && (e = new Set(e));
@@ -3350,48 +3350,48 @@ function Ll(i, e = null) {
3350
3350
  function u(f, p, y = !1) {
3351
3351
  const b = f * 2;
3352
3352
  if (De(b, a)) {
3353
- const S = $e(f, o), x = Qe(b, a);
3354
- let E = 1 / 0, T = 1 / 0, _ = 1 / 0, A = -1 / 0, P = -1 / 0, C = -1 / 0;
3355
- for (let M = S, O = S + x; M < O; M++) {
3356
- const I = 3 * i.resolveTriangleIndex(M);
3353
+ const T = $e(f, o), x = Qe(b, a);
3354
+ let E = 1 / 0, S = 1 / 0, _ = 1 / 0, A = -1 / 0, P = -1 / 0, I = -1 / 0;
3355
+ for (let M = T, O = T + x; M < O; M++) {
3356
+ const C = 3 * i.resolveTriangleIndex(M);
3357
3357
  for (let k = 0; k < 3; k++) {
3358
- let N = I + k;
3358
+ let N = C + k;
3359
3359
  N = n ? n[N] : N;
3360
3360
  const G = s.getX(N), z = s.getY(N), X = s.getZ(N);
3361
- G < E && (E = G), G > A && (A = G), z < T && (T = z), z > P && (P = z), X < _ && (_ = X), X > C && (C = X);
3361
+ G < E && (E = G), G > A && (A = G), z < S && (S = z), z > P && (P = z), X < _ && (_ = X), X > I && (I = X);
3362
3362
  }
3363
3363
  }
3364
- return c[f + 0] !== E || c[f + 1] !== T || c[f + 2] !== _ || c[f + 3] !== A || c[f + 4] !== P || c[f + 5] !== C ? (c[f + 0] = E, c[f + 1] = T, c[f + 2] = _, c[f + 3] = A, c[f + 4] = P, c[f + 5] = C, !0) : !1;
3364
+ return c[f + 0] !== E || c[f + 1] !== S || c[f + 2] !== _ || c[f + 3] !== A || c[f + 4] !== P || c[f + 5] !== I ? (c[f + 0] = E, c[f + 1] = S, c[f + 2] = _, c[f + 3] = A, c[f + 4] = P, c[f + 5] = I, !0) : !1;
3365
3365
  } else {
3366
- const S = Fe(f), x = ze(f, o);
3367
- let E = y, T = !1, _ = !1;
3366
+ const T = Fe(f), x = ze(f, o);
3367
+ let E = y, S = !1, _ = !1;
3368
3368
  if (e) {
3369
3369
  if (!E) {
3370
- const I = S / Oe + p / qe, k = x / Oe + p / qe;
3371
- T = e.has(I), _ = e.has(k), E = !T && !_;
3370
+ const C = T / Oe + p / qe, k = x / Oe + p / qe;
3371
+ S = e.has(C), _ = e.has(k), E = !S && !_;
3372
3372
  }
3373
3373
  } else
3374
- T = !0, _ = !0;
3375
- const A = E || T, P = E || _;
3376
- let C = !1;
3377
- A && (C = u(S, p, E));
3374
+ S = !0, _ = !0;
3375
+ const A = E || S, P = E || _;
3376
+ let I = !1;
3377
+ A && (I = u(T, p, E));
3378
3378
  let M = !1;
3379
3379
  P && (M = u(x, p, E));
3380
- const O = C || M;
3380
+ const O = I || M;
3381
3381
  if (O)
3382
- for (let I = 0; I < 3; I++) {
3383
- const k = S + I, N = x + I, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3384
- c[f + I] = G < X ? G : X, c[f + I + 3] = z > ie ? z : ie;
3382
+ for (let C = 0; C < 3; C++) {
3383
+ const k = T + C, N = x + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3384
+ c[f + C] = G < X ? G : X, c[f + C + 3] = z > ie ? z : ie;
3385
3385
  }
3386
3386
  return O;
3387
3387
  }
3388
3388
  }
3389
3389
  }
3390
3390
  function Ol(i, e, t, n, s, r, o) {
3391
- Ae.setBuffer(i._roots[e]), Bi(0, i, t, n, s, r, o), Ae.clearBuffer();
3391
+ xe.setBuffer(i._roots[e]), Bi(0, i, t, n, s, r, o), xe.clearBuffer();
3392
3392
  }
3393
3393
  function Bi(i, e, t, n, s, r, o) {
3394
- const { float32Array: a, uint16Array: c, uint32Array: h } = Ae, d = i * 2;
3394
+ const { float32Array: a, uint16Array: c, uint32Array: h } = xe, d = i * 2;
3395
3395
  if (De(d, c)) {
3396
3396
  const f = $e(i, h), p = Qe(d, c);
3397
3397
  Tl(e, t, n, f, p, s, r, o);
@@ -3404,122 +3404,122 @@ function Bi(i, e, t, n, s, r, o) {
3404
3404
  }
3405
3405
  const Dl = ["x", "y", "z"];
3406
3406
  function Nl(i, e, t, n, s, r) {
3407
- Ae.setBuffer(i._roots[e]);
3407
+ xe.setBuffer(i._roots[e]);
3408
3408
  const o = Ui(0, i, t, n, s, r);
3409
- return Ae.clearBuffer(), o;
3409
+ return xe.clearBuffer(), o;
3410
3410
  }
3411
3411
  function Ui(i, e, t, n, s, r) {
3412
- const { float32Array: o, uint16Array: a, uint32Array: c } = Ae;
3412
+ const { float32Array: o, uint16Array: a, uint32Array: c } = xe;
3413
3413
  let h = i * 2;
3414
3414
  if (De(h, a)) {
3415
3415
  const u = $e(i, c), f = Qe(h, a);
3416
3416
  return Sl(e, t, n, u, f, s, r);
3417
3417
  } else {
3418
3418
  const u = hr(i, c), f = Dl[u], y = n.direction[f] >= 0;
3419
- let b, S;
3420
- y ? (b = Fe(i), S = ze(i, c)) : (b = ze(i, c), S = Fe(i));
3419
+ let b, T;
3420
+ y ? (b = Fe(i), T = ze(i, c)) : (b = ze(i, c), T = Fe(i));
3421
3421
  const E = Yt(b, o, n, s, r) ? Ui(b, e, t, n, s, r) : null;
3422
3422
  if (E) {
3423
3423
  const A = E.point[f];
3424
- if (y ? A <= o[S + u] : (
3424
+ if (y ? A <= o[T + u] : (
3425
3425
  // min bounding data
3426
- A >= o[S + u + 3]
3426
+ A >= o[T + u + 3]
3427
3427
  ))
3428
3428
  return E;
3429
3429
  }
3430
- const _ = Yt(S, o, n, s, r) ? Ui(S, e, t, n, s, r) : null;
3430
+ const _ = Yt(T, o, n, s, r) ? Ui(T, e, t, n, s, r) : null;
3431
3431
  return E && _ ? E.distance <= _.distance ? E : _ : E || _ || null;
3432
3432
  }
3433
3433
  }
3434
3434
  const Rs = /* @__PURE__ */ new _t(), gn = /* @__PURE__ */ new Tt(), yn = /* @__PURE__ */ new Tt(), Bn = /* @__PURE__ */ new ut(), Qr = /* @__PURE__ */ new Je(), Ms = /* @__PURE__ */ new Je();
3435
3435
  function kl(i, e, t, n) {
3436
- Ae.setBuffer(i._roots[e]);
3436
+ xe.setBuffer(i._roots[e]);
3437
3437
  const s = Hi(0, i, t, n);
3438
- return Ae.clearBuffer(), s;
3438
+ return xe.clearBuffer(), s;
3439
3439
  }
3440
3440
  function Hi(i, e, t, n, s = null) {
3441
- const { float32Array: r, uint16Array: o, uint32Array: a } = Ae;
3441
+ const { float32Array: r, uint16Array: o, uint32Array: a } = xe;
3442
3442
  let c = i * 2;
3443
3443
  if (s === null && (t.boundingBox || t.computeBoundingBox(), Qr.set(t.boundingBox.min, t.boundingBox.max, n), s = Qr), De(c, o)) {
3444
- const d = e.geometry, u = d.index, f = d.attributes.position, p = t.index, y = t.attributes.position, b = $e(i, a), S = Qe(c, o);
3444
+ const d = e.geometry, u = d.index, f = d.attributes.position, p = t.index, y = t.attributes.position, b = $e(i, a), T = Qe(c, o);
3445
3445
  if (Bn.copy(n).invert(), t.boundsTree)
3446
- return xe(i, r, Ms), Ms.matrix.copy(Bn), Ms.needsUpdate = !0, t.boundsTree.shapecast({
3446
+ return Ae(i, r, Ms), Ms.matrix.copy(Bn), Ms.needsUpdate = !0, t.boundsTree.shapecast({
3447
3447
  intersectsBounds: (E) => Ms.intersectsBox(E),
3448
3448
  intersectsTriangle: (E) => {
3449
3449
  E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
3450
- for (let T = b, _ = S + b; T < _; T++)
3451
- if (Ce(yn, 3 * e.resolveTriangleIndex(T), u, f), yn.needsUpdate = !0, E.intersectsTriangle(yn))
3450
+ for (let S = b, _ = T + b; S < _; S++)
3451
+ if (Ie(yn, 3 * e.resolveTriangleIndex(S), u, f), yn.needsUpdate = !0, E.intersectsTriangle(yn))
3452
3452
  return !0;
3453
3453
  return !1;
3454
3454
  }
3455
3455
  });
3456
3456
  {
3457
3457
  const x = $s(t);
3458
- for (let E = b, T = S + b; E < T; E++) {
3458
+ for (let E = b, S = T + b; E < S; E++) {
3459
3459
  const _ = e.resolveTriangleIndex(E);
3460
- Ce(gn, 3 * _, u, f), gn.a.applyMatrix4(Bn), gn.b.applyMatrix4(Bn), gn.c.applyMatrix4(Bn), gn.needsUpdate = !0;
3460
+ Ie(gn, 3 * _, u, f), gn.a.applyMatrix4(Bn), gn.b.applyMatrix4(Bn), gn.c.applyMatrix4(Bn), gn.needsUpdate = !0;
3461
3461
  for (let A = 0, P = x * 3; A < P; A += 3)
3462
- if (Ce(yn, A, p, y), yn.needsUpdate = !0, gn.intersectsTriangle(yn))
3462
+ if (Ie(yn, A, p, y), yn.needsUpdate = !0, gn.intersectsTriangle(yn))
3463
3463
  return !0;
3464
3464
  }
3465
3465
  }
3466
3466
  } else {
3467
3467
  const d = Fe(i), u = ze(i, a);
3468
- return xe(d, r, Rs), !!(s.intersectsBox(Rs) && Hi(d, e, t, n, s) || (xe(u, r, Rs), s.intersectsBox(Rs) && Hi(u, e, t, n, s)));
3468
+ return Ae(d, r, Rs), !!(s.intersectsBox(Rs) && Hi(d, e, t, n, s) || (Ae(u, r, Rs), s.intersectsBox(Rs) && Hi(u, e, t, n, s)));
3469
3469
  }
3470
3470
  }
3471
- const Is = /* @__PURE__ */ new ut(), mi = /* @__PURE__ */ new Je(), Un = /* @__PURE__ */ new Je(), Fl = /* @__PURE__ */ new $(), zl = /* @__PURE__ */ new $(), Bl = /* @__PURE__ */ new $(), Ul = /* @__PURE__ */ new $();
3471
+ const Cs = /* @__PURE__ */ new ut(), mi = /* @__PURE__ */ new Je(), Un = /* @__PURE__ */ new Je(), Fl = /* @__PURE__ */ new $(), zl = /* @__PURE__ */ new $(), Bl = /* @__PURE__ */ new $(), Ul = /* @__PURE__ */ new $();
3472
3472
  function Hl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3473
3473
  e.boundingBox || e.computeBoundingBox(), mi.set(e.boundingBox.min, e.boundingBox.max, t), mi.needsUpdate = !0;
3474
3474
  const a = i.geometry, c = a.attributes.position, h = a.index, d = e.attributes.position, u = e.index, f = ht.getPrimitive(), p = ht.getPrimitive();
3475
- let y = Fl, b = zl, S = null, x = null;
3476
- s && (S = Bl, x = Ul);
3477
- let E = 1 / 0, T = null, _ = null;
3478
- return Is.copy(t).invert(), Un.matrix.copy(Is), i.shapecast(
3475
+ let y = Fl, b = zl, T = null, x = null;
3476
+ s && (T = Bl, x = Ul);
3477
+ let E = 1 / 0, S = null, _ = null;
3478
+ return Cs.copy(t).invert(), Un.matrix.copy(Cs), i.shapecast(
3479
3479
  {
3480
3480
  boundsTraverseOrder: (A) => mi.distanceToBox(A),
3481
- intersectsBounds: (A, P, C) => C < E && C < o ? (P && (Un.min.copy(A.min), Un.max.copy(A.max), Un.needsUpdate = !0), !0) : !1,
3481
+ intersectsBounds: (A, P, I) => I < E && I < o ? (P && (Un.min.copy(A.min), Un.max.copy(A.max), Un.needsUpdate = !0), !0) : !1,
3482
3482
  intersectsRange: (A, P) => {
3483
3483
  if (e.boundsTree) {
3484
- const C = e.boundsTree;
3485
- return C.shapecast({
3484
+ const I = e.boundsTree;
3485
+ return I.shapecast({
3486
3486
  boundsTraverseOrder: (M) => Un.distanceToBox(M),
3487
- intersectsBounds: (M, O, I) => I < E && I < o,
3487
+ intersectsBounds: (M, O, C) => C < E && C < o,
3488
3488
  intersectsRange: (M, O) => {
3489
- for (let I = M, k = M + O; I < k; I++) {
3490
- const N = C.resolveTriangleIndex(I);
3491
- Ce(p, 3 * N, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3489
+ for (let C = M, k = M + O; C < k; C++) {
3490
+ const N = I.resolveTriangleIndex(C);
3491
+ Ie(p, 3 * N, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3492
3492
  for (let G = A, z = A + P; G < z; G++) {
3493
3493
  const X = i.resolveTriangleIndex(G);
3494
- Ce(f, 3 * X, h, c), f.needsUpdate = !0;
3495
- const ie = f.distanceToTriangle(p, y, S);
3496
- if (ie < E && (b.copy(y), x && x.copy(S), E = ie, T = G, _ = I), ie < r)
3494
+ Ie(f, 3 * X, h, c), f.needsUpdate = !0;
3495
+ const ie = f.distanceToTriangle(p, y, T);
3496
+ if (ie < E && (b.copy(y), x && x.copy(T), E = ie, S = G, _ = C), ie < r)
3497
3497
  return !0;
3498
3498
  }
3499
3499
  }
3500
3500
  }
3501
3501
  });
3502
3502
  } else {
3503
- const C = $s(e);
3504
- for (let M = 0, O = C; M < O; M++) {
3505
- Ce(p, 3 * M, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3506
- for (let I = A, k = A + P; I < k; I++) {
3507
- const N = i.resolveTriangleIndex(I);
3508
- Ce(f, 3 * N, h, c), f.needsUpdate = !0;
3509
- const G = f.distanceToTriangle(p, y, S);
3510
- if (G < E && (b.copy(y), x && x.copy(S), E = G, T = I, _ = M), G < r)
3503
+ const I = $s(e);
3504
+ for (let M = 0, O = I; M < O; M++) {
3505
+ Ie(p, 3 * M, u, d), p.a.applyMatrix4(t), p.b.applyMatrix4(t), p.c.applyMatrix4(t), p.needsUpdate = !0;
3506
+ for (let C = A, k = A + P; C < k; C++) {
3507
+ const N = i.resolveTriangleIndex(C);
3508
+ Ie(f, 3 * N, h, c), f.needsUpdate = !0;
3509
+ const G = f.distanceToTriangle(p, y, T);
3510
+ if (G < E && (b.copy(y), x && x.copy(T), E = G, S = C, _ = M), G < r)
3511
3511
  return !0;
3512
3512
  }
3513
3513
  }
3514
3514
  }
3515
3515
  }
3516
3516
  }
3517
- ), ht.releasePrimitive(f), ht.releasePrimitive(p), E === 1 / 0 ? null : (n.point ? n.point.copy(b) : n.point = b.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(x) : s.point = x.clone(), s.point.applyMatrix4(Is), b.applyMatrix4(Is), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3517
+ ), ht.releasePrimitive(f), ht.releasePrimitive(p), E === 1 / 0 ? null : (n.point ? n.point.copy(b) : n.point = b.clone(), n.distance = E, n.faceIndex = S, s && (s.point ? s.point.copy(x) : s.point = x.clone(), s.point.applyMatrix4(Cs), b.applyMatrix4(Cs), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3518
3518
  }
3519
3519
  function Jr(i, e, t) {
3520
3520
  return i === null ? null : (i.point.applyMatrix4(e.matrixWorld), i.distance = i.point.distanceTo(t.ray.origin), i.object = e, i);
3521
3521
  }
3522
- const Cs = /* @__PURE__ */ new Je(), Ps = /* @__PURE__ */ new er(), eo = /* @__PURE__ */ new $(), to = /* @__PURE__ */ new ut(), no = /* @__PURE__ */ new $(), gi = ["getX", "getY", "getZ"];
3522
+ const Is = /* @__PURE__ */ new Je(), Ps = /* @__PURE__ */ new er(), eo = /* @__PURE__ */ new $(), to = /* @__PURE__ */ new ut(), no = /* @__PURE__ */ new $(), gi = ["getX", "getY", "getZ"];
3523
3523
  class Zs extends cl {
3524
3524
  /**
3525
3525
  * Generates a representation of the complete bounds tree and the geometry index buffer which
@@ -3586,8 +3586,8 @@ class Zs extends cl {
3586
3586
  for (let d = 0; d < h.length; d++) {
3587
3587
  const u = h[d], f = new Uint32Array(u), p = new Uint16Array(u);
3588
3588
  for (let y = 0, b = u.byteLength / qe; y < b; y++) {
3589
- const S = Oe * y, x = 2 * S;
3590
- De(x, p) || (f[S + 6] = f[S + 6] / Oe - y);
3589
+ const T = Oe * y, x = 2 * T;
3590
+ De(x, p) || (f[T + 6] = f[T + 6] / Oe - y);
3591
3591
  }
3592
3592
  }
3593
3593
  }
@@ -3631,11 +3631,11 @@ class Zs extends cl {
3631
3631
  let d = h + 0, u = h + 1, f = h + 2;
3632
3632
  a && (d = a[d], u = a[u], f = a[f]);
3633
3633
  for (let p = 0; p < 3; p++) {
3634
- const y = o[gi[p]](d), b = o[gi[p]](u), S = o[gi[p]](f);
3634
+ const y = o[gi[p]](d), b = o[gi[p]](u), T = o[gi[p]](f);
3635
3635
  let x = y;
3636
- b < x && (x = b), S < x && (x = S);
3636
+ b < x && (x = b), T < x && (x = T);
3637
3637
  let E = y;
3638
- b > E && (E = b), S > E && (E = S), t[n + p] = x, t[n + p + 3] = E;
3638
+ b > E && (E = b), T > E && (E = T), t[n + p] = x, t[n + p + 3] = E;
3639
3639
  }
3640
3640
  return t;
3641
3641
  }
@@ -3653,17 +3653,17 @@ class Zs extends cl {
3653
3653
  const f = ["getX", "getY", "getZ"], p = n.offset;
3654
3654
  for (let y = e, b = e + t; y < b; y++) {
3655
3655
  const x = (r ? r[y] : y) * 3, E = (y - p) * 6;
3656
- let T = x + 0, _ = x + 1, A = x + 2;
3657
- a && (T = a[T], _ = a[_], A = a[A]), c || (T = T * u + d, _ = _ * u + d, A = A * u + d);
3656
+ let S = x + 0, _ = x + 1, A = x + 2;
3657
+ a && (S = a[S], _ = a[_], A = a[A]), c || (S = S * u + d, _ = _ * u + d, A = A * u + d);
3658
3658
  for (let P = 0; P < 3; P++) {
3659
- let C, M, O;
3660
- c ? (C = o[f[P]](T), M = o[f[P]](_), O = o[f[P]](A)) : (C = h[T + P], M = h[_ + P], O = h[A + P]);
3661
- let I = C;
3662
- M < I && (I = M), O < I && (I = O);
3663
- let k = C;
3659
+ let I, M, O;
3660
+ c ? (I = o[f[P]](S), M = o[f[P]](_), O = o[f[P]](A)) : (I = h[S + P], M = h[_ + P], O = h[A + P]);
3661
+ let C = I;
3662
+ M < C && (C = M), O < C && (C = O);
3663
+ let k = I;
3664
3664
  M > k && (k = M), O > k && (k = O);
3665
- const N = (k - I) / 2, G = P * 2;
3666
- n[E + G + 0] = I + N, n[E + G + 1] = N + (Math.abs(I) + N) * Us;
3665
+ const N = (k - C) / 2, G = P * 2;
3666
+ n[E + G + 0] = C + N, n[E + G + 1] = N + (Math.abs(C) + N) * Us;
3667
3667
  }
3668
3668
  }
3669
3669
  return n;
@@ -3746,7 +3746,7 @@ class Zs extends cl {
3746
3746
  raycastFirst(e, t = Mi, n = 0, s = 1 / 0) {
3747
3747
  const r = this._roots;
3748
3748
  let o = null;
3749
- const a = this.indirect ? Nl : xl;
3749
+ const a = this.indirect ? Nl : Al;
3750
3750
  for (let c = 0, h = r.length; c < h; c++) {
3751
3751
  const d = a(this, c, t, e, n, s);
3752
3752
  d != null && (o == null || d.distance < o.distance) && (o = d);
@@ -3821,31 +3821,31 @@ class Zs extends cl {
3821
3821
  } = n;
3822
3822
  const o = ht.getPrimitive(), a = this.geometry.index, c = this.geometry.attributes.position, h = this.indirect ? (y) => {
3823
3823
  const b = this.resolveTriangleIndex(y);
3824
- Ce(o, b * 3, a, c);
3824
+ Ie(o, b * 3, a, c);
3825
3825
  } : (y) => {
3826
- Ce(o, y * 3, a, c);
3826
+ Ie(o, y * 3, a, c);
3827
3827
  }, d = ht.getPrimitive(), u = e.geometry.index, f = e.geometry.attributes.position, p = e.indirect ? (y) => {
3828
3828
  const b = e.resolveTriangleIndex(y);
3829
- Ce(d, b * 3, u, f);
3829
+ Ie(d, b * 3, u, f);
3830
3830
  } : (y) => {
3831
- Ce(d, y * 3, u, f);
3831
+ Ie(d, y * 3, u, f);
3832
3832
  };
3833
3833
  if (r) {
3834
3834
  if (!(e instanceof Zs))
3835
3835
  throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');
3836
- const y = (b, S, x, E, T, _, A, P) => {
3837
- for (let C = x, M = x + E; C < M; C++) {
3838
- p(C), d.a.applyMatrix4(t), d.b.applyMatrix4(t), d.c.applyMatrix4(t), d.needsUpdate = !0;
3839
- for (let O = b, I = b + S; O < I; O++)
3840
- if (h(O), o.needsUpdate = !0, r(o, d, O, C, T, _, A, P))
3836
+ const y = (b, T, x, E, S, _, A, P) => {
3837
+ for (let I = x, M = x + E; I < M; I++) {
3838
+ p(I), d.a.applyMatrix4(t), d.b.applyMatrix4(t), d.c.applyMatrix4(t), d.needsUpdate = !0;
3839
+ for (let O = b, C = b + T; O < C; O++)
3840
+ if (h(O), o.needsUpdate = !0, r(o, d, O, I, S, _, A, P))
3841
3841
  return !0;
3842
3842
  }
3843
3843
  return !1;
3844
3844
  };
3845
3845
  if (s) {
3846
3846
  const b = s;
3847
- s = function(S, x, E, T, _, A, P, C) {
3848
- return b(S, x, E, T, _, A, P, C) ? !0 : y(S, x, E, T, _, A, P, C);
3847
+ s = function(T, x, E, S, _, A, P, I) {
3848
+ return b(T, x, E, S, _, A, P, I) ? !0 : y(T, x, E, S, _, A, P, I);
3849
3849
  };
3850
3850
  } else
3851
3851
  s = y;
@@ -3863,10 +3863,10 @@ class Zs extends cl {
3863
3863
  * @returns {boolean}
3864
3864
  */
3865
3865
  intersectsBox(e, t) {
3866
- return Cs.set(e.min, e.max, t), Cs.needsUpdate = !0, this.shapecast(
3866
+ return Is.set(e.min, e.max, t), Is.needsUpdate = !0, this.shapecast(
3867
3867
  {
3868
- intersectsBounds: (n) => Cs.intersectsBox(n),
3869
- intersectsTriangle: (n) => Cs.intersectsTriangle(n)
3868
+ intersectsBounds: (n) => Is.intersectsBox(n),
3869
+ intersectsTriangle: (n) => Is.intersectsTriangle(n)
3870
3870
  }
3871
3871
  );
3872
3872
  }
@@ -4701,7 +4701,7 @@ class th {
4701
4701
  function ro(i, e) {
4702
4702
  if (e === tc)
4703
4703
  return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), i;
4704
- if (e === Ii || e === Mo) {
4704
+ if (e === Ci || e === Mo) {
4705
4705
  let t = i.getIndex();
4706
4706
  if (t === null) {
4707
4707
  const o = [], a = i.getAttribute("position");
@@ -4713,7 +4713,7 @@ function ro(i, e) {
4713
4713
  return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), i;
4714
4714
  }
4715
4715
  const n = t.count - 2, s = [];
4716
- if (e === Ii)
4716
+ if (e === Ci)
4717
4717
  for (let o = 1; o <= n; o++)
4718
4718
  s.push(t.getX(0)), s.push(t.getX(o)), s.push(t.getX(o + 1));
4719
4719
  else
@@ -4809,7 +4809,7 @@ class sh extends nc {
4809
4809
  this.manager.itemStart(e);
4810
4810
  const a = function(h) {
4811
4811
  s ? s(h) : console.error(h), r.manager.itemError(e), r.manager.itemEnd(e);
4812
- }, c = new Io(this.manager);
4812
+ }, c = new Co(this.manager);
4813
4813
  c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(h) {
4814
4814
  try {
4815
4815
  r.parse(h, o, function(d) {
@@ -4924,10 +4924,10 @@ class sh extends nc {
4924
4924
  o[u] = new bh(r, this.dracoLoader);
4925
4925
  break;
4926
4926
  case ce.KHR_TEXTURE_TRANSFORM:
4927
- o[u] = new Ah();
4927
+ o[u] = new xh();
4928
4928
  break;
4929
4929
  case ce.KHR_MESH_QUANTIZATION:
4930
- o[u] = new xh();
4930
+ o[u] = new Ah();
4931
4931
  break;
4932
4932
  default:
4933
4933
  f.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
@@ -5021,7 +5021,7 @@ class rh {
5021
5021
  h = new ic(d), h.target.position.set(0, 0, -1), h.add(h.target);
5022
5022
  break;
5023
5023
  case "point":
5024
- h = new Co(d), h.distance = u;
5024
+ h = new Io(d), h.distance = u;
5025
5025
  break;
5026
5026
  case "spot":
5027
5027
  h = new sc(d), h.distance = u, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, h.angle = c.spot.outerConeAngle, h.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, h.target.position.set(0, 0, -1), h.add(h.target);
@@ -5077,7 +5077,7 @@ class ch {
5077
5077
  this.parser = e, this.name = ce.KHR_MATERIALS_CLEARCOAT;
5078
5078
  }
5079
5079
  getMaterialType(e) {
5080
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5080
+ return Re(this.parser, e, this.name) !== null ? It : null;
5081
5081
  }
5082
5082
  extendMaterialParams(e, t) {
5083
5083
  const n = Re(this.parser, e, this.name);
@@ -5095,7 +5095,7 @@ class lh {
5095
5095
  this.parser = e, this.name = ce.KHR_MATERIALS_DISPERSION;
5096
5096
  }
5097
5097
  getMaterialType(e) {
5098
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5098
+ return Re(this.parser, e, this.name) !== null ? It : null;
5099
5099
  }
5100
5100
  extendMaterialParams(e, t) {
5101
5101
  const n = Re(this.parser, e, this.name);
@@ -5107,7 +5107,7 @@ class hh {
5107
5107
  this.parser = e, this.name = ce.KHR_MATERIALS_IRIDESCENCE;
5108
5108
  }
5109
5109
  getMaterialType(e) {
5110
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5110
+ return Re(this.parser, e, this.name) !== null ? It : null;
5111
5111
  }
5112
5112
  extendMaterialParams(e, t) {
5113
5113
  const n = Re(this.parser, e, this.name);
@@ -5121,7 +5121,7 @@ class uh {
5121
5121
  this.parser = e, this.name = ce.KHR_MATERIALS_SHEEN;
5122
5122
  }
5123
5123
  getMaterialType(e) {
5124
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5124
+ return Re(this.parser, e, this.name) !== null ? It : null;
5125
5125
  }
5126
5126
  extendMaterialParams(e, t) {
5127
5127
  const n = Re(this.parser, e, this.name);
@@ -5139,7 +5139,7 @@ class dh {
5139
5139
  this.parser = e, this.name = ce.KHR_MATERIALS_TRANSMISSION;
5140
5140
  }
5141
5141
  getMaterialType(e) {
5142
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5142
+ return Re(this.parser, e, this.name) !== null ? It : null;
5143
5143
  }
5144
5144
  extendMaterialParams(e, t) {
5145
5145
  const n = Re(this.parser, e, this.name);
@@ -5153,7 +5153,7 @@ class fh {
5153
5153
  this.parser = e, this.name = ce.KHR_MATERIALS_VOLUME;
5154
5154
  }
5155
5155
  getMaterialType(e) {
5156
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5156
+ return Re(this.parser, e, this.name) !== null ? It : null;
5157
5157
  }
5158
5158
  extendMaterialParams(e, t) {
5159
5159
  const n = Re(this.parser, e, this.name);
@@ -5169,7 +5169,7 @@ class ph {
5169
5169
  this.parser = e, this.name = ce.KHR_MATERIALS_IOR;
5170
5170
  }
5171
5171
  getMaterialType(e) {
5172
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5172
+ return Re(this.parser, e, this.name) !== null ? It : null;
5173
5173
  }
5174
5174
  extendMaterialParams(e, t) {
5175
5175
  const n = Re(this.parser, e, this.name);
@@ -5181,7 +5181,7 @@ class mh {
5181
5181
  this.parser = e, this.name = ce.KHR_MATERIALS_SPECULAR;
5182
5182
  }
5183
5183
  getMaterialType(e) {
5184
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5184
+ return Re(this.parser, e, this.name) !== null ? It : null;
5185
5185
  }
5186
5186
  extendMaterialParams(e, t) {
5187
5187
  const n = Re(this.parser, e, this.name);
@@ -5197,7 +5197,7 @@ class gh {
5197
5197
  this.parser = e, this.name = ce.EXT_MATERIALS_BUMP;
5198
5198
  }
5199
5199
  getMaterialType(e) {
5200
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5200
+ return Re(this.parser, e, this.name) !== null ? It : null;
5201
5201
  }
5202
5202
  extendMaterialParams(e, t) {
5203
5203
  const n = Re(this.parser, e, this.name);
@@ -5211,7 +5211,7 @@ class yh {
5211
5211
  this.parser = e, this.name = ce.KHR_MATERIALS_ANISOTROPY;
5212
5212
  }
5213
5213
  getMaterialType(e) {
5214
- return Re(this.parser, e, this.name) !== null ? Ct : null;
5214
+ return Re(this.parser, e, this.name) !== null ? It : null;
5215
5215
  }
5216
5216
  extendMaterialParams(e, t) {
5217
5217
  const n = Re(this.parser, e, this.name);
@@ -5315,15 +5315,15 @@ class Sh {
5315
5315
  return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((h) => {
5316
5316
  const d = h.pop(), u = d.isGroup ? d.children : [d], f = h[0].count, p = [];
5317
5317
  for (const y of u) {
5318
- const b = new ut(), S = new $(), x = new Rn(), E = new $(1, 1, 1), T = new Po(y.geometry, y.material, f);
5318
+ const b = new ut(), T = new $(), x = new Rn(), E = new $(1, 1, 1), S = new Po(y.geometry, y.material, f);
5319
5319
  for (let _ = 0; _ < f; _++)
5320
- c.TRANSLATION && S.fromBufferAttribute(c.TRANSLATION, _), c.ROTATION && x.fromBufferAttribute(c.ROTATION, _), c.SCALE && E.fromBufferAttribute(c.SCALE, _), T.setMatrixAt(_, b.compose(S, x, E));
5320
+ c.TRANSLATION && T.fromBufferAttribute(c.TRANSLATION, _), c.ROTATION && x.fromBufferAttribute(c.ROTATION, _), c.SCALE && E.fromBufferAttribute(c.SCALE, _), S.setMatrixAt(_, b.compose(T, x, E));
5321
5321
  for (const _ in c)
5322
5322
  if (_ === "_COLOR_0") {
5323
5323
  const A = c[_];
5324
- T.instanceColor = new rc(A.array, A.itemSize, A.normalized);
5324
+ S.instanceColor = new rc(A.array, A.itemSize, A.normalized);
5325
5325
  } else _ !== "TRANSLATION" && _ !== "ROTATION" && _ !== "SCALE" && y.geometry.setAttribute(_, c[_]);
5326
- rr.prototype.copy.call(T, y), this.parser.assignFinalMaterial(T), p.push(T);
5326
+ rr.prototype.copy.call(S, y), this.parser.assignFinalMaterial(S), p.push(S);
5327
5327
  }
5328
5328
  return d.isGroup ? (d.clear(), d.add(...p), d) : p[0];
5329
5329
  }));
@@ -5376,7 +5376,7 @@ class bh {
5376
5376
  for (const d in e.attributes) {
5377
5377
  const u = Wi[d] || d.toLowerCase();
5378
5378
  if (o[d] !== void 0) {
5379
- const f = n.accessors[e.attributes[d]], p = xn[f.componentType];
5379
+ const f = n.accessors[e.attributes[d]], p = An[f.componentType];
5380
5380
  h[u] = p.name, c[u] = f.normalized === !0;
5381
5381
  }
5382
5382
  }
@@ -5384,8 +5384,8 @@ class bh {
5384
5384
  return new Promise(function(u, f) {
5385
5385
  s.decodeDracoFile(d, function(p) {
5386
5386
  for (const y in p.attributes) {
5387
- const b = p.attributes[y], S = c[y];
5388
- S !== void 0 && (b.normalized = S);
5387
+ const b = p.attributes[y], T = c[y];
5388
+ T !== void 0 && (b.normalized = T);
5389
5389
  }
5390
5390
  u(p);
5391
5391
  }, a, h, Ge, f);
@@ -5393,7 +5393,7 @@ class bh {
5393
5393
  });
5394
5394
  }
5395
5395
  }
5396
- class Ah {
5396
+ class xh {
5397
5397
  constructor() {
5398
5398
  this.name = ce.KHR_TEXTURE_TRANSFORM;
5399
5399
  }
@@ -5401,7 +5401,7 @@ class Ah {
5401
5401
  return (t.texCoord === void 0 || t.texCoord === e.channel) && t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.texCoord !== void 0 && (e.channel = t.texCoord), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
5402
5402
  }
5403
5403
  }
5404
- class xh {
5404
+ class Ah {
5405
5405
  constructor() {
5406
5406
  this.name = ce.KHR_MESH_QUANTIZATION;
5407
5407
  }
@@ -5417,10 +5417,10 @@ class Xo extends vc {
5417
5417
  return t;
5418
5418
  }
5419
5419
  interpolate_(e, t, n, s) {
5420
- const r = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = a * 2, h = a * 3, d = s - t, u = (n - t) / d, f = u * u, p = f * u, y = e * h, b = y - h, S = -2 * p + 3 * f, x = p - f, E = 1 - S, T = x - f + u;
5420
+ const r = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = a * 2, h = a * 3, d = s - t, u = (n - t) / d, f = u * u, p = f * u, y = e * h, b = y - h, T = -2 * p + 3 * f, x = p - f, E = 1 - T, S = x - f + u;
5421
5421
  for (let _ = 0; _ !== a; _++) {
5422
- const A = o[b + _ + a], P = o[b + _ + c] * d, C = o[y + _ + a], M = o[y + _] * d;
5423
- r[_] = E * A + T * P + S * C + x * M;
5422
+ const A = o[b + _ + a], P = o[b + _ + c] * d, I = o[y + _ + a], M = o[y + _] * d;
5423
+ r[_] = E * A + S * P + T * I + x * M;
5424
5424
  }
5425
5425
  return r;
5426
5426
  }
@@ -5440,7 +5440,7 @@ const ct = {
5440
5440
  TRIANGLES: 4,
5441
5441
  TRIANGLE_STRIP: 5,
5442
5442
  TRIANGLE_FAN: 6
5443
- }, xn = {
5443
+ }, An = {
5444
5444
  5120: Int8Array,
5445
5445
  5121: Uint8Array,
5446
5446
  5122: Int16Array,
@@ -5457,7 +5457,7 @@ const ct = {
5457
5457
  }, lo = {
5458
5458
  33071: pc,
5459
5459
  33648: fc,
5460
- 10497: Ci
5460
+ 10497: Ii
5461
5461
  }, yi = {
5462
5462
  SCALAR: 1,
5463
5463
  VEC2: 2,
@@ -5487,13 +5487,13 @@ const ct = {
5487
5487
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
5488
5488
  // keyframe track will be initialized with a default interpolation type, then modified.
5489
5489
  LINEAR: Do,
5490
- STEP: xc
5490
+ STEP: Ac
5491
5491
  }, wi = {
5492
5492
  OPAQUE: "OPAQUE",
5493
5493
  MASK: "MASK",
5494
5494
  BLEND: "BLEND"
5495
5495
  };
5496
- function Ih(i) {
5496
+ function Ch(i) {
5497
5497
  return i.DefaultMaterial === void 0 && (i.DefaultMaterial = new js({
5498
5498
  color: 16777215,
5499
5499
  emissive: 0,
@@ -5511,7 +5511,7 @@ function tn(i, e, t) {
5511
5511
  function Rt(i, e) {
5512
5512
  e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(i.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
5513
5513
  }
5514
- function Ch(i, e, t) {
5514
+ function Ih(i, e, t) {
5515
5515
  let n = !1, s = !1, r = !1;
5516
5516
  for (let h = 0, d = e.length; h < d; h++) {
5517
5517
  const u = e[h];
@@ -5600,7 +5600,7 @@ class Nh {
5600
5600
  const c = a.match(/Version\/(\d+)/);
5601
5601
  s = n && c ? parseInt(c[1], 10) : -1, r = a.indexOf("Firefox") > -1, o = r ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
5602
5602
  }
5603
- typeof createImageBitmap > "u" || n && s < 17 || r && o < 98 ? this.textureLoader = new oc(this.options.manager) : this.textureLoader = new ac(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Io(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
5603
+ typeof createImageBitmap > "u" || n && s < 17 || r && o < 98 ? this.textureLoader = new oc(this.options.manager) : this.textureLoader = new ac(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Co(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
5604
5604
  }
5605
5605
  setExtensions(e) {
5606
5606
  this.extensions = e;
@@ -5840,29 +5840,29 @@ class Nh {
5840
5840
  loadAccessor(e) {
5841
5841
  const t = this, n = this.json, s = this.json.accessors[e];
5842
5842
  if (s.bufferView === void 0 && s.sparse === void 0) {
5843
- const o = yi[s.type], a = xn[s.componentType], c = s.normalized === !0, h = new a(s.count * o);
5843
+ const o = yi[s.type], a = An[s.componentType], c = s.normalized === !0, h = new a(s.count * o);
5844
5844
  return Promise.resolve(new Kn(h, o, c));
5845
5845
  }
5846
5846
  const r = [];
5847
5847
  return s.bufferView !== void 0 ? r.push(this.getDependency("bufferView", s.bufferView)) : r.push(null), s.sparse !== void 0 && (r.push(this.getDependency("bufferView", s.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", s.sparse.values.bufferView))), Promise.all(r).then(function(o) {
5848
- const a = o[0], c = yi[s.type], h = xn[s.componentType], d = h.BYTES_PER_ELEMENT, u = d * c, f = s.byteOffset || 0, p = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, y = s.normalized === !0;
5849
- let b, S;
5848
+ const a = o[0], c = yi[s.type], h = An[s.componentType], d = h.BYTES_PER_ELEMENT, u = d * c, f = s.byteOffset || 0, p = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, y = s.normalized === !0;
5849
+ let b, T;
5850
5850
  if (p && p !== u) {
5851
5851
  const x = Math.floor(f / p), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + x + ":" + s.count;
5852
- let T = t.cache.get(E);
5853
- T || (b = new h(a, x * p, s.count * p / d), T = new cc(b, p / d), t.cache.add(E, T)), S = new lc(T, c, f % p / d, y);
5852
+ let S = t.cache.get(E);
5853
+ S || (b = new h(a, x * p, s.count * p / d), S = new cc(b, p / d), t.cache.add(E, S)), T = new lc(S, c, f % p / d, y);
5854
5854
  } else
5855
- a === null ? b = new h(s.count * c) : b = new h(a, f, s.count * c), S = new Kn(b, c, y);
5855
+ a === null ? b = new h(s.count * c) : b = new h(a, f, s.count * c), T = new Kn(b, c, y);
5856
5856
  if (s.sparse !== void 0) {
5857
- const x = yi.SCALAR, E = xn[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, A = new E(o[1], T, s.sparse.count * x), P = new h(o[2], _, s.sparse.count * c);
5858
- a !== null && (S = new Kn(S.array.slice(), S.itemSize, S.normalized)), S.normalized = !1;
5859
- for (let C = 0, M = A.length; C < M; C++) {
5860
- const O = A[C];
5861
- if (S.setX(O, P[C * c]), c >= 2 && S.setY(O, P[C * c + 1]), c >= 3 && S.setZ(O, P[C * c + 2]), c >= 4 && S.setW(O, P[C * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
5857
+ const x = yi.SCALAR, E = An[s.sparse.indices.componentType], S = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, A = new E(o[1], S, s.sparse.count * x), P = new h(o[2], _, s.sparse.count * c);
5858
+ a !== null && (T = new Kn(T.array.slice(), T.itemSize, T.normalized)), T.normalized = !1;
5859
+ for (let I = 0, M = A.length; I < M; I++) {
5860
+ const O = A[I];
5861
+ if (T.setX(O, P[I * c]), c >= 2 && T.setY(O, P[I * c + 1]), c >= 3 && T.setZ(O, P[I * c + 2]), c >= 4 && T.setW(O, P[I * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
5862
5862
  }
5863
- S.normalized = y;
5863
+ T.normalized = y;
5864
5864
  }
5865
- return S;
5865
+ return T;
5866
5866
  });
5867
5867
  }
5868
5868
  /**
@@ -5888,7 +5888,7 @@ class Nh {
5888
5888
  const h = this.loadImageSource(t, n).then(function(d) {
5889
5889
  d.flipY = !1, d.name = o.name || a.name || "", d.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (d.name = a.uri);
5890
5890
  const f = (r.samplers || {})[o.sampler] || {};
5891
- return d.magFilter = co[f.magFilter] || rn, d.minFilter = co[f.minFilter] || Lo, d.wrapS = lo[f.wrapS] || Ci, d.wrapT = lo[f.wrapT] || Ci, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Oo && d.minFilter !== rn, s.associations.set(d, { textures: e }), d;
5891
+ return d.magFilter = co[f.magFilter] || rn, d.minFilter = co[f.minFilter] || Lo, d.wrapS = lo[f.wrapS] || Ii, d.wrapT = lo[f.wrapT] || Ii, d.generateMipmaps = !d.isCompressedTexture && d.minFilter !== Oo && d.minFilter !== rn, s.associations.set(d, { textures: e }), d;
5892
5892
  }).catch(function() {
5893
5893
  return null;
5894
5894
  });
@@ -5912,8 +5912,8 @@ class Nh {
5912
5912
  return new Promise(function(f, p) {
5913
5913
  let y = f;
5914
5914
  t.isImageBitmapLoader === !0 && (y = function(b) {
5915
- const S = new Pr(b);
5916
- S.needsUpdate = !0, f(S);
5915
+ const T = new Pr(b);
5916
+ T.needsUpdate = !0, f(T);
5917
5917
  }), t.load(Xn.resolveURL(u, r.path), y, void 0, p);
5918
5918
  });
5919
5919
  }).then(function(u) {
@@ -6007,7 +6007,7 @@ class Nh {
6007
6007
  return f.extendMaterialParams && f.extendMaterialParams(e, a);
6008
6008
  })));
6009
6009
  }
6010
- r.doubleSided === !0 && (a.side = xo);
6010
+ r.doubleSided === !0 && (a.side = Ao);
6011
6011
  const d = r.alphaMode || wi.OPAQUE;
6012
6012
  if (d === wi.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === wi.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && o !== Wn && (h.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new me(1, 1), r.normalTexture.scale !== void 0)) {
6013
6013
  const u = r.normalTexture.scale;
@@ -6071,28 +6071,28 @@ class Nh {
6071
6071
  loadMesh(e) {
6072
6072
  const t = this, n = this.json, s = this.extensions, r = n.meshes[e], o = r.primitives, a = [];
6073
6073
  for (let c = 0, h = o.length; c < h; c++) {
6074
- const d = o[c].material === void 0 ? Ih(this.cache) : this.getDependency("material", o[c].material);
6074
+ const d = o[c].material === void 0 ? Ch(this.cache) : this.getDependency("material", o[c].material);
6075
6075
  a.push(d);
6076
6076
  }
6077
6077
  return a.push(t.loadGeometries(o)), Promise.all(a).then(function(c) {
6078
6078
  const h = c.slice(0, c.length - 1), d = c[c.length - 1], u = [];
6079
6079
  for (let p = 0, y = d.length; p < y; p++) {
6080
- const b = d[p], S = o[p];
6080
+ const b = d[p], T = o[p];
6081
6081
  let x;
6082
6082
  const E = h[p];
6083
- if (S.mode === ct.TRIANGLES || S.mode === ct.TRIANGLE_STRIP || S.mode === ct.TRIANGLE_FAN || S.mode === void 0)
6084
- x = r.isSkinnedMesh === !0 ? new Ec(b, E) : new wt(b, E), x.isSkinnedMesh === !0 && x.normalizeSkinWeights(), S.mode === ct.TRIANGLE_STRIP ? x.geometry = ro(x.geometry, Mo) : S.mode === ct.TRIANGLE_FAN && (x.geometry = ro(x.geometry, Ii));
6085
- else if (S.mode === ct.LINES)
6083
+ if (T.mode === ct.TRIANGLES || T.mode === ct.TRIANGLE_STRIP || T.mode === ct.TRIANGLE_FAN || T.mode === void 0)
6084
+ x = r.isSkinnedMesh === !0 ? new Ec(b, E) : new wt(b, E), x.isSkinnedMesh === !0 && x.normalizeSkinWeights(), T.mode === ct.TRIANGLE_STRIP ? x.geometry = ro(x.geometry, Mo) : T.mode === ct.TRIANGLE_FAN && (x.geometry = ro(x.geometry, Ci));
6085
+ else if (T.mode === ct.LINES)
6086
6086
  x = new tr(b, E);
6087
- else if (S.mode === ct.LINE_STRIP)
6087
+ else if (T.mode === ct.LINE_STRIP)
6088
6088
  x = new sr(b, E);
6089
- else if (S.mode === ct.LINE_LOOP)
6089
+ else if (T.mode === ct.LINE_LOOP)
6090
6090
  x = new nr(b, E);
6091
- else if (S.mode === ct.POINTS)
6091
+ else if (T.mode === ct.POINTS)
6092
6092
  x = new ir(b, E);
6093
6093
  else
6094
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + S.mode);
6095
- Object.keys(x.geometry.morphAttributes).length > 0 && Ph(x, r), x.name = t.createUniqueName(r.name || "mesh_" + e), Rt(x, r), S.extensions && tn(s, x, S), t.assignFinalMaterial(x), u.push(x);
6094
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + T.mode);
6095
+ Object.keys(x.geometry.morphAttributes).length > 0 && Ph(x, r), x.name = t.createUniqueName(r.name || "mesh_" + e), Rt(x, r), T.extensions && tn(s, x, T), t.assignFinalMaterial(x), u.push(x);
6096
6096
  }
6097
6097
  for (let p = 0, y = u.length; p < y; p++)
6098
6098
  t.associations.set(u[p], {
@@ -6159,8 +6159,8 @@ class Nh {
6159
6159
  loadAnimation(e) {
6160
6160
  const t = this.json, n = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, o = [], a = [], c = [], h = [], d = [];
6161
6161
  for (let u = 0, f = s.channels.length; u < f; u++) {
6162
- const p = s.channels[u], y = s.samplers[p.sampler], b = p.target, S = b.node, x = s.parameters !== void 0 ? s.parameters[y.input] : y.input, E = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
6163
- b.node !== void 0 && (o.push(this.getDependency("node", S)), a.push(this.getDependency("accessor", x)), c.push(this.getDependency("accessor", E)), h.push(y), d.push(b));
6162
+ const p = s.channels[u], y = s.samplers[p.sampler], b = p.target, T = b.node, x = s.parameters !== void 0 ? s.parameters[y.input] : y.input, E = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
6163
+ b.node !== void 0 && (o.push(this.getDependency("node", T)), a.push(this.getDependency("accessor", x)), c.push(this.getDependency("accessor", E)), h.push(y), d.push(b));
6164
6164
  }
6165
6165
  return Promise.all([
6166
6166
  Promise.all(o),
@@ -6169,15 +6169,15 @@ class Nh {
6169
6169
  Promise.all(h),
6170
6170
  Promise.all(d)
6171
6171
  ]).then(function(u) {
6172
- const f = u[0], p = u[1], y = u[2], b = u[3], S = u[4], x = [];
6173
- for (let T = 0, _ = f.length; T < _; T++) {
6174
- const A = f[T], P = p[T], C = y[T], M = b[T], O = S[T];
6172
+ const f = u[0], p = u[1], y = u[2], b = u[3], T = u[4], x = [];
6173
+ for (let S = 0, _ = f.length; S < _; S++) {
6174
+ const A = f[S], P = p[S], I = y[S], M = b[S], O = T[S];
6175
6175
  if (A === void 0) continue;
6176
6176
  A.updateMatrix && A.updateMatrix();
6177
- const I = n._createAnimationTracks(A, P, C, M, O);
6178
- if (I)
6179
- for (let k = 0; k < I.length; k++)
6180
- x.push(I[k]);
6177
+ const C = n._createAnimationTracks(A, P, I, M, O);
6178
+ if (C)
6179
+ for (let k = 0; k < C.length; k++)
6180
+ x.push(C[k]);
6181
6181
  }
6182
6182
  const E = new bc(r, void 0, x);
6183
6183
  return Rt(E, s), E;
@@ -6241,7 +6241,7 @@ class Nh {
6241
6241
  a.push(h);
6242
6242
  }), this.nodeCache[e] = Promise.all(a).then(function(h) {
6243
6243
  let d;
6244
- if (r.isBone === !0 ? d = new Ac() : h.length > 1 ? d = new si() : h.length === 1 ? d = h[0] : d = new rr(), d !== h[0])
6244
+ if (r.isBone === !0 ? d = new xc() : h.length > 1 ? d = new si() : h.length === 1 ? d = h[0] : d = new rr(), d !== h[0])
6245
6245
  for (let u = 0, f = h.length; u < f; u++)
6246
6246
  d.add(h[u]);
6247
6247
  if (r.name && (d.userData.name = r.name, d.name = o), Rt(d, r), r.extensions && tn(n, d, r), r.matrix !== void 0) {
@@ -6357,7 +6357,7 @@ function kh(i, e, t) {
6357
6357
  new $(c[0], c[1], c[2]),
6358
6358
  new $(h[0], h[1], h[2])
6359
6359
  ), a.normalized) {
6360
- const d = Zi(xn[a.componentType]);
6360
+ const d = Zi(An[a.componentType]);
6361
6361
  s.min.multiplyScalar(d), s.max.multiplyScalar(d);
6362
6362
  }
6363
6363
  } else {
@@ -6375,7 +6375,7 @@ function kh(i, e, t) {
6375
6375
  const f = t.json.accessors[u.POSITION], p = f.min, y = f.max;
6376
6376
  if (p !== void 0 && y !== void 0) {
6377
6377
  if (c.setX(Math.max(Math.abs(p[0]), Math.abs(y[0]))), c.setY(Math.max(Math.abs(p[1]), Math.abs(y[1]))), c.setZ(Math.max(Math.abs(p[2]), Math.abs(y[2]))), f.normalized) {
6378
- const b = Zi(xn[f.componentType]);
6378
+ const b = Zi(An[f.componentType]);
6379
6379
  c.multiplyScalar(b);
6380
6380
  }
6381
6381
  a.max(c);
@@ -6407,7 +6407,7 @@ function ho(i, e, t) {
6407
6407
  s.push(o);
6408
6408
  }
6409
6409
  return Nr.workingColorSpace !== Ge && "COLOR_0" in n && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Nr.workingColorSpace}" not supported.`), Rt(i, e), kh(i, e, t), Promise.all(s).then(function() {
6410
- return e.targets !== void 0 ? Ch(i, e.targets, t) : i;
6410
+ return e.targets !== void 0 ? Ih(i, e.targets, t) : i;
6411
6411
  });
6412
6412
  }
6413
6413
  const Fh = g.REVISION.replace(/\D/g, ""), Yo = `https://cdn.jsdelivr.net/npm/three@0.${Fh}/examples/jsm/libs`, zh = `${Yo}/draco/`, Bh = `${Yo}/basis/`;
@@ -7278,7 +7278,7 @@ const Ki = "contact-shadow-baked", nn = "contact-shadow-live", gr = "softboxCont
7278
7278
  r * fe.DISC_FOOTPRINT_MARGIN + n.y * fe.DISC_HEIGHT_STRETCH,
7279
7279
  fe.DISC_MIN_HALF_EXTENT
7280
7280
  );
7281
- return { center: s, halfExtent: o, objectHeight: n.y };
7281
+ return { center: s, halfExtent: o, objectHeight: n.y, boundingRadius: n.length() / 2 };
7282
7282
  }
7283
7283
  accumulateShadowPasses(e, t, n, s, r, o) {
7284
7284
  const a = new g.Scene(), c = t.parent;
@@ -7299,15 +7299,15 @@ const Ki = "contact-shadow-baked", nn = "contact-shadow-live", gr = "softboxCont
7299
7299
  f.rotation.x = -Math.PI / 2, f.position.set(s.center.x, 0, s.center.z), f.receiveShadow = !0, a.add(f);
7300
7300
  const p = this.createBakeCamera(s);
7301
7301
  a.add(p);
7302
- const y = e.getRenderTarget(), b = e.autoClear, S = e.getClearColor(new g.Color()), x = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
7302
+ const y = e.getRenderTarget(), b = e.autoClear, T = e.getClearColor(new g.Color()), x = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
7303
7303
  try {
7304
7304
  e.shadowMap.autoUpdate = !0, e.setRenderTarget(r), e.setClearColor(0, 0), e.clear(!0, !1, !1), e.autoClear = !1;
7305
- const T = this.explicitPasses ?? this.measureAffordablePasses(e, a, p, n, d, r);
7306
- u.opacity = 1 / T;
7307
- for (const _ of this.sampleLightPositions(n, T))
7308
- d.position.copy(_), e.render(a, p);
7305
+ const S = this.explicitPasses ?? this.measureAffordablePasses(e, a, p, n, d, r);
7306
+ u.opacity = 1 / S;
7307
+ for (const _ of this.sampleLightPositions(n, S))
7308
+ d.position.copy(_), this.fitBakeDepthRange(d, s), e.render(a, p);
7309
7309
  } finally {
7310
- e.autoClear = b, e.setClearColor(S, x), e.setRenderTarget(y), e.shadowMap.autoUpdate = E, this.restoreColorWrite(h), c ? c.add(t) : a.remove(t), d.dispose(), u.dispose();
7310
+ e.autoClear = b, e.setClearColor(T, x), e.setRenderTarget(y), e.shadowMap.autoUpdate = E, this.restoreColorWrite(h), c ? c.add(t) : a.remove(t), d.dispose(), u.dispose();
7311
7311
  }
7312
7312
  }
7313
7313
  /**
@@ -7356,9 +7356,25 @@ const Ki = "contact-shadow-baked", nn = "contact-shadow-live", gr = "softboxCont
7356
7356
  t.castShadow = !0, t.shadow.mapSize.set(
7357
7357
  fe.BAKE_SHADOW_MAP_SIZE,
7358
7358
  fe.BAKE_SHADOW_MAP_SIZE
7359
- ), t.shadow.bias = e.shadow.bias, t.shadow.normalBias = e.shadow.normalBias, t.shadow.radius = 6;
7359
+ ), t.shadow.bias = 0, t.shadow.normalBias = 0, t.shadow.radius = 6;
7360
7360
  const n = e.shadow.camera, s = t.shadow.camera;
7361
- return s.left = n.left, s.right = n.right, s.top = n.top, s.bottom = n.bottom, s.near = n.near, s.far = n.far, s.updateProjectionMatrix(), t;
7361
+ return s.left = n.left, s.right = n.right, s.top = n.top, s.bottom = n.bottom, s.updateProjectionMatrix(), t;
7362
+ }
7363
+ /**
7364
+ * Bracket the depth range tightly around the object for the CURRENT sample
7365
+ * position. The distance is the exact projection of the object's centre onto
7366
+ * the light's view axis (aperture-jittered samples sit off-axis, so a plain
7367
+ * centre distance would over-estimate and could clip the object). The padding
7368
+ * must cover BOTH every caster vertex (within `boundingRadius` of the centre)
7369
+ * AND every fragment of the receiver disc: the shadow lookup treats a
7370
+ * receiver whose depth falls past `far` as lit (`frustumTest`), so a tilted
7371
+ * key sample would otherwise truncate the shadow tail at the disc edge —
7372
+ * hence the extra `halfExtent` (the disc radius, an upper bound on a
7373
+ * receiver fragment's along-axis depth offset at any tilt).
7374
+ */
7375
+ fitBakeDepthRange(e, t) {
7376
+ const n = e.target.position.clone().sub(e.position).normalize(), r = t.center.clone().sub(e.position).dot(n), o = t.boundingRadius * 1.5 + t.halfExtent, a = e.shadow.camera;
7377
+ a.near = Math.max(r - o, r * 0.01), a.far = r + o, a.updateProjectionMatrix();
7362
7378
  }
7363
7379
  createBakeCamera(e) {
7364
7380
  const t = new g.OrthographicCamera(
@@ -7381,20 +7397,20 @@ const Ki = "contact-shadow-baked", nn = "contact-shadow-live", gr = "softboxCont
7381
7397
  c.lengthSq() < 1e-6 && c.set(1, 0, 0), c.normalize();
7382
7398
  const h = new g.Vector3().crossVectors(a, c), d = Math.round(t * fe.AMBIENT_RATIO), u = t - d, f = g.MathUtils.degToRad(fe.LIGHT_APERTURE_DEGREES), p = Math.tan(f / 2) * o, y = [];
7383
7399
  for (let x = 0; x < u; x++) {
7384
- const E = p * Math.sqrt((x + 0.5) / u), T = x * mo;
7400
+ const E = p * Math.sqrt((x + 0.5) / u), S = x * mo;
7385
7401
  y.push(
7386
- n.clone().addScaledVector(c, E * Math.cos(T)).addScaledVector(h, E * Math.sin(T))
7402
+ n.clone().addScaledVector(c, E * Math.cos(S)).addScaledVector(h, E * Math.sin(S))
7387
7403
  );
7388
7404
  }
7389
7405
  const b = Math.sin(
7390
7406
  g.MathUtils.degToRad(fe.AMBIENT_MIN_ELEVATION_DEGREES)
7391
- ), S = 0.98;
7407
+ ), T = 0.98;
7392
7408
  for (let x = 0; x < d; x++) {
7393
- const E = Math.sqrt((x + 0.5) / d), T = b + (S - b) * E, _ = Math.sqrt(1 - T * T), A = x * mo;
7409
+ const E = Math.sqrt((x + 0.5) / d), S = b + (T - b) * E, _ = Math.sqrt(1 - S * S), A = x * mo;
7394
7410
  y.push(
7395
7411
  new g.Vector3(
7396
7412
  _ * Math.cos(A),
7397
- T,
7413
+ S,
7398
7414
  _ * Math.sin(A)
7399
7415
  ).multiplyScalar(o).add(s)
7400
7416
  );
@@ -7473,7 +7489,7 @@ function Jo(i) {
7473
7489
  function wr(i) {
7474
7490
  return Mn(i, "getThreeControls");
7475
7491
  }
7476
- var It = /* @__PURE__ */ ((i) => (i.SHADOW_FLOOR = "shadow_floor", i.SQUARE_WIRE = "square_wire", i.HEXAGONAL_WIRE = "hexagonal_wire", i.HEXAGONAL_GLASS = "hexagonal_glass", i.STONE_TILES = "stone_tiles", i.CUSTOM = "custom", i))(It || {});
7492
+ var Ct = /* @__PURE__ */ ((i) => (i.SHADOW_FLOOR = "shadow_floor", i.SQUARE_WIRE = "square_wire", i.HEXAGONAL_WIRE = "hexagonal_wire", i.HEXAGONAL_GLASS = "hexagonal_glass", i.STONE_TILES = "stone_tiles", i.CUSTOM = "custom", i))(Ct || {});
7477
7493
  class iu {
7478
7494
  constructor() {
7479
7495
  this.name = "Square Wire Grid";
@@ -7503,12 +7519,12 @@ class ru {
7503
7519
  for (let u = -n; u <= n; u++) {
7504
7520
  const f = Math.max(-n, -u - n), p = Math.min(n, -u + n);
7505
7521
  for (let y = f; y <= p; y++) {
7506
- const b = c * (u + y / 2), S = h * 0.75 * y, x = [], E = Math.PI * 2 / 6;
7522
+ const b = c * (u + y / 2), T = h * 0.75 * y, x = [], E = Math.PI * 2 / 6;
7507
7523
  for (let A = 0; A <= 6; A++) {
7508
- const P = A * E + Math.PI / 6, C = b + s * Math.cos(P), M = S + s * Math.sin(P);
7509
- x.push(new g.Vector3(C, 0, M));
7524
+ const P = A * E + Math.PI / 6, I = b + s * Math.cos(P), M = T + s * Math.sin(P);
7525
+ x.push(new g.Vector3(I, 0, M));
7510
7526
  }
7511
- const T = new g.BufferGeometry().setFromPoints(x), _ = new g.Line(T, a);
7527
+ const S = new g.BufferGeometry().setFromPoints(x), _ = new g.Line(S, a);
7512
7528
  t.add(_);
7513
7529
  }
7514
7530
  }
@@ -7648,17 +7664,17 @@ class cu {
7648
7664
  this.name = "Hexagonal Glass Grid";
7649
7665
  }
7650
7666
  createGrid(e) {
7651
- var y, b, S, x, E, T, _;
7667
+ var y, b, T, x, E, S, _;
7652
7668
  const t = new g.Group(), n = ((y = e.styleOptions) == null ? void 0 : y.hexRadius) ?? Math.floor(e.divisions / 2), s = ((b = e.styleOptions) == null ? void 0 : b.tileSize) || 1, r = String(e.color || "#ffffff"), o = on.getGridSpacing(s), a = o.width, c = o.height, h = new ou(new g.Vector3(0, 0, 0), s, r, {
7653
- metalness: (S = e.styleOptions) == null ? void 0 : S.metalness,
7669
+ metalness: (T = e.styleOptions) == null ? void 0 : T.metalness,
7654
7670
  roughness: (x = e.styleOptions) == null ? void 0 : x.roughness,
7655
7671
  transmission: (E = e.styleOptions) == null ? void 0 : E.transmission,
7656
- thickness: (T = e.styleOptions) == null ? void 0 : T.thickness,
7672
+ thickness: (S = e.styleOptions) == null ? void 0 : S.thickness,
7657
7673
  ior: (_ = e.styleOptions) == null ? void 0 : _.ior
7658
7674
  }), d = h.createGeometry(), u = on.getYPosition(s), f = [];
7659
7675
  for (let A = -n; A <= n; A++) {
7660
- const P = Math.max(-n, -A - n), C = Math.min(n, -A + n);
7661
- for (let M = P; M <= C; M++)
7676
+ const P = Math.max(-n, -A - n), I = Math.min(n, -A + n);
7677
+ for (let M = P; M <= I; M++)
7662
7678
  f.push(new g.Vector3(a * (A + M / 2), u, c * 0.75 * M));
7663
7679
  }
7664
7680
  const p = new g.Mesh(
@@ -7682,12 +7698,12 @@ class lu {
7682
7698
  this.name = "Stone Tile Grid", this.textureLoader = new g.TextureLoader();
7683
7699
  }
7684
7700
  createGrid(e) {
7685
- var p, y, b, S;
7686
- const t = new g.Group(), n = e.size, s = Math.max(1, e.divisions), r = n / s, o = r * 0.02, a = r - o, c = ((p = e.styleOptions) == null ? void 0 : p.height) || r * 0.05, h = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((b = e.styleOptions) == null ? void 0 : b.randomHeight) || !1, u = ((S = e.styleOptions) == null ? void 0 : S.randomRotation) || !1, f = this.createStoneMaterial(e);
7701
+ var p, y, b, T;
7702
+ const t = new g.Group(), n = e.size, s = Math.max(1, e.divisions), r = n / s, o = r * 0.02, a = r - o, c = ((p = e.styleOptions) == null ? void 0 : p.height) || r * 0.05, h = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((b = e.styleOptions) == null ? void 0 : b.randomHeight) || !1, u = ((T = e.styleOptions) == null ? void 0 : T.randomRotation) || !1, f = this.createStoneMaterial(e);
7687
7703
  for (let x = 0; x < s; x++)
7688
7704
  for (let E = 0; E < s; E++) {
7689
- const T = (x - s / 2) * r + r / 2, _ = (E - s / 2) * r + r / 2, A = d ? c * (0.8 + Math.random() * 0.4) : c, P = new g.Shape(), C = a / 2;
7690
- P.moveTo(-C, -C), P.lineTo(C, -C), P.lineTo(C, C), P.lineTo(-C, C), P.closePath();
7705
+ const S = (x - s / 2) * r + r / 2, _ = (E - s / 2) * r + r / 2, A = d ? c * (0.8 + Math.random() * 0.4) : c, P = new g.Shape(), I = a / 2;
7706
+ P.moveTo(-I, -I), P.lineTo(I, -I), P.lineTo(I, I), P.lineTo(-I, I), P.closePath();
7691
7707
  const M = {
7692
7708
  depth: A,
7693
7709
  bevelEnabled: !0,
@@ -7696,8 +7712,8 @@ class lu {
7696
7712
  bevelSegments: 2
7697
7713
  }, O = new g.ExtrudeGeometry(P, M);
7698
7714
  O.rotateX(-Math.PI / 2);
7699
- const I = new g.Mesh(O, f);
7700
- I.position.set(T, -A / 2, _), I.castShadow = !0, I.receiveShadow = !0, u && (I.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(I);
7715
+ const C = new g.Mesh(O, f);
7716
+ C.position.set(S, -A / 2, _), C.castShadow = !0, C.receiveShadow = !0, u && (C.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(C);
7701
7717
  }
7702
7718
  return t;
7703
7719
  }
@@ -7794,7 +7810,7 @@ const Tr = class Tr {
7794
7810
  const n = this.gridStyles.get(e);
7795
7811
  if (!n) {
7796
7812
  console.warn(`Unknown grid type: ${e}, falling back to square wire grid`);
7797
- const r = this.gridStyles.get(It.SQUARE_WIRE);
7813
+ const r = this.gridStyles.get(Ct.SQUARE_WIRE);
7798
7814
  if (!r)
7799
7815
  throw new Error("Square wire grid style not found");
7800
7816
  return r.createGrid(t);
@@ -7823,11 +7839,11 @@ const Tr = class Tr {
7823
7839
  }
7824
7840
  };
7825
7841
  Tr.gridStyles = /* @__PURE__ */ new Map([
7826
- [It.SHADOW_FLOOR, new hu()],
7827
- [It.SQUARE_WIRE, new iu()],
7828
- [It.HEXAGONAL_WIRE, new ru()],
7829
- [It.HEXAGONAL_GLASS, new cu()],
7830
- [It.STONE_TILES, new lu()]
7842
+ [Ct.SHADOW_FLOOR, new hu()],
7843
+ [Ct.SQUARE_WIRE, new iu()],
7844
+ [Ct.HEXAGONAL_WIRE, new ru()],
7845
+ [Ct.HEXAGONAL_GLASS, new cu()],
7846
+ [Ct.STONE_TILES, new lu()]
7831
7847
  ]);
7832
7848
  let Ks = Tr;
7833
7849
  function uu(i, e) {
@@ -7844,7 +7860,7 @@ function uu(i, e) {
7844
7860
  const n = t.userData, s = typeof e.grid == "object" ? e.grid : null, r = {
7845
7861
  enabled: !0,
7846
7862
  color: (s == null ? void 0 : s.colorGrid) || e.gridColor || "#AAAAAA",
7847
- type: s != null && s.type ? s.type : It.HEXAGONAL_GLASS,
7863
+ type: s != null && s.type ? s.type : Ct.HEXAGONAL_GLASS,
7848
7864
  opacity: s == null ? void 0 : s.opacity,
7849
7865
  styleOptions: s == null ? void 0 : s.styleOptions
7850
7866
  };
@@ -7852,7 +7868,7 @@ function uu(i, e) {
7852
7868
  ...n,
7853
7869
  gridOptions: r
7854
7870
  }, s != null && s.size || s != null && s.divisions) {
7855
- const o = r.type || It.HEXAGONAL_GLASS, a = s.size || 10, c = s.divisions || 10, h = {
7871
+ const o = r.type || Ct.HEXAGONAL_GLASS, a = s.size || 10, c = s.divisions || 10, h = {
7856
7872
  size: a,
7857
7873
  divisions: c,
7858
7874
  color: r.color,
@@ -7897,8 +7913,8 @@ function du(i, e, t = 1.2) {
7897
7913
  return D.ok(void 0);
7898
7914
  const a = [];
7899
7915
  s.traverse((O) => {
7900
- var I, k, N;
7901
- ((I = O.userData) != null && I.isGrid || (k = O.userData) != null && k.isHexGrid || (N = O.userData) != null && N.isDefaultGrid) && a.push(O);
7916
+ var C, k, N;
7917
+ ((C = O.userData) != null && C.isGrid || (k = O.userData) != null && k.isHexGrid || (N = O.userData) != null && N.isDefaultGrid) && a.push(O);
7902
7918
  }), a.forEach((O) => {
7903
7919
  Js(O), s.remove(O);
7904
7920
  });
@@ -7914,27 +7930,27 @@ function du(i, e, t = 1.2) {
7914
7930
  if (h.isEmpty() || !Number.isFinite(d.x) || !Number.isFinite(d.z))
7915
7931
  return console.warn("Skipping dynamic grid: object has an empty or non-finite bounding box"), D.ok(void 0);
7916
7932
  const u = (n = o.styleOptions) == null ? void 0 : n.tileSize, f = typeof u == "number" ? u : 1, y = on.getGridSpacing(f).width, b = Math.max(d.x, d.z) * t + d.y;
7917
- let S = b <= y ? 0 : Math.ceil((b / y - 1) / 2);
7933
+ let T = b <= y ? 0 : Math.ceil((b / y - 1) / 2);
7918
7934
  const x = 60;
7919
- S > x && (console.warn(
7920
- `Dynamic grid would need ${S} rings to cover the object; capping at ${x}. The floor will not fully reach the configured coverage for this tileSize/object-size combination.`
7921
- ), S = x), b < y * 0.8 ? S = 0 : S < 3 && b > y * 2 && (S = 3);
7922
- const E = o.type || It.HEXAGONAL_GLASS, _ = {
7935
+ T > x && (console.warn(
7936
+ `Dynamic grid would need ${T} rings to cover the object; capping at ${x}. The floor will not fully reach the configured coverage for this tileSize/object-size combination.`
7937
+ ), T = x), b < y * 0.8 ? T = 0 : T < 3 && b > y * 2 && (T = 3);
7938
+ const E = o.type || Ct.HEXAGONAL_GLASS, _ = {
7923
7939
  size: Math.max(d.x, d.z) * t,
7924
- divisions: S * 2 + 1,
7940
+ divisions: T * 2 + 1,
7925
7941
  color: o.color,
7926
7942
  opacity: o.opacity,
7927
7943
  styleOptions: {
7928
- hexRadius: S,
7944
+ hexRadius: T,
7929
7945
  tileSize: f,
7930
7946
  ...o.styleOptions
7931
7947
  }
7932
7948
  }, A = Ks.createGrid(E, _);
7933
7949
  A.userData.isGrid = !0, A.userData.isHexGrid = !0;
7934
- const P = g.MathUtils.clamp(d.y * 25e-4, 2e-4, 2e-3), C = A.getObjectByName(nn);
7935
- C && (C.position.y = P), A.traverse((O) => {
7936
- var I;
7937
- (I = O.userData) != null && I[yr] && (O.position.y = P);
7950
+ const P = g.MathUtils.clamp(d.y * 25e-4, 2e-4, 2e-3), I = A.getObjectByName(nn);
7951
+ I && (I.position.y = P), A.traverse((O) => {
7952
+ var C;
7953
+ (C = O.userData) != null && C[yr] && (O.position.y = P);
7938
7954
  });
7939
7955
  const M = h.getCenter(new g.Vector3());
7940
7956
  return A.position.set(M.x, 0, M.z), s.add(A), D.ok(void 0);
@@ -7966,11 +7982,11 @@ function fu(i, e) {
7966
7982
  Z.INVALID_PARAMETER
7967
7983
  )
7968
7984
  );
7969
- const s = (T) => {
7970
- var A, P, C;
7971
- let _ = T;
7985
+ const s = (S) => {
7986
+ var A, P, I;
7987
+ let _ = S;
7972
7988
  for (; _; ) {
7973
- if ((A = _.userData) != null && A.isGrid || (P = _.userData) != null && P.isHexGrid || (C = _.userData) != null && C.isDefaultGrid)
7989
+ if ((A = _.userData) != null && A.isGrid || (P = _.userData) != null && P.isHexGrid || (I = _.userData) != null && I.isDefaultGrid)
7974
7990
  return !0;
7975
7991
  _ = _.parent;
7976
7992
  }
@@ -7978,39 +7994,39 @@ function fu(i, e) {
7978
7994
  };
7979
7995
  t.updateMatrixWorld(!0);
7980
7996
  const r = [];
7981
- t.traverse((T) => {
7997
+ t.traverse((S) => {
7982
7998
  var _;
7983
- (_ = T.userData) != null && _[yr] || T.isMesh && s(T) && r.push(T);
7999
+ (_ = S.userData) != null && _[yr] || S.isMesh && s(S) && r.push(S);
7984
8000
  });
7985
8001
  const o = [];
7986
- if (n.traverse((T) => {
7987
- T.isMesh && o.push(T);
8002
+ if (n.traverse((S) => {
8003
+ S.isMesh && o.push(S);
7988
8004
  }), r.length === 0 || o.length === 0)
7989
8005
  return D.ok(void 0);
7990
8006
  let a = -1 / 0;
7991
8007
  const c = new g.Box3();
7992
- for (const T of r)
7993
- c.setFromObject(T), Number.isFinite(c.max.y) && (a = Math.max(a, c.max.y));
8008
+ for (const S of r)
8009
+ c.setFromObject(S), Number.isFinite(c.max.y) && (a = Math.max(a, c.max.y));
7994
8010
  if (!Number.isFinite(a))
7995
8011
  return D.ok(void 0);
7996
8012
  const h = new g.Box3().setFromObject(n);
7997
8013
  if (h.isEmpty() || !Number.isFinite(h.min.x) || !Number.isFinite(h.max.x))
7998
8014
  return D.ok(void 0);
7999
- const d = 40, u = Math.max(1, h.max.y - h.min.y), f = h.max.y + u, p = h.min.y - u, y = new g.Raycaster(), b = new g.Vector3(0, -1, 0), S = new g.Vector3(0, 1, 0);
8015
+ const d = 40, u = Math.max(1, h.max.y - h.min.y), f = h.max.y + u, p = h.min.y - u, y = new g.Raycaster(), b = new g.Vector3(0, -1, 0), T = new g.Vector3(0, 1, 0);
8000
8016
  let x = 1 / 0;
8001
- const E = (T, _, A, P) => {
8002
- y.set(new g.Vector3(T, _, A), P);
8003
- for (const C of y.intersectObjects(o, !1))
8004
- C.point.y < x && (x = C.point.y);
8017
+ const E = (S, _, A, P) => {
8018
+ y.set(new g.Vector3(S, _, A), P);
8019
+ for (const I of y.intersectObjects(o, !1))
8020
+ I.point.y < x && (x = I.point.y);
8005
8021
  };
8006
- for (let T = 0; T <= d; T++)
8022
+ for (let S = 0; S <= d; S++)
8007
8023
  for (let _ = 0; _ <= d; _++) {
8008
- const A = h.min.x + (h.max.x - h.min.x) * (T / d), P = h.min.z + (h.max.z - h.min.z) * (_ / d);
8009
- E(A, f, P, b), E(A, p, P, S);
8024
+ const A = h.min.x + (h.max.x - h.min.x) * (S / d), P = h.min.z + (h.max.z - h.min.z) * (_ / d);
8025
+ E(A, f, P, b), E(A, p, P, T);
8010
8026
  }
8011
8027
  if (Number.isFinite(x)) {
8012
- const T = x - a;
8013
- Math.abs(T) > 1e-4 && (n.position.y -= T);
8028
+ const S = x - a;
8029
+ Math.abs(S) > 1e-4 && (n.position.y -= S);
8014
8030
  }
8015
8031
  return D.ok(void 0);
8016
8032
  } catch (t) {
@@ -8054,11 +8070,13 @@ function pu(i, e) {
8054
8070
  if (!a || !a.castShadow)
8055
8071
  return D.ok(void 0);
8056
8072
  if (a.parent === t && a.target.parent === t) {
8057
- const p = a.position.clone().sub(a.target.position);
8058
- a.target.position.copy(o), a.position.copy(o).add(p);
8073
+ const E = a.position.clone().sub(a.target.position);
8074
+ a.target.position.copy(o), a.position.copy(o).add(E);
8059
8075
  }
8060
8076
  const u = Math.max(r.x, r.y, r.z, 0.1) * 2, f = a.shadow.camera;
8061
- return f.left = -u, f.right = u, f.top = u, f.bottom = -u, f.updateProjectionMatrix(), D.ok(void 0);
8077
+ f.left = -u, f.right = u, f.top = u, f.bottom = -u;
8078
+ const p = a.getWorldPosition(new g.Vector3()), b = a.target.getWorldPosition(new g.Vector3()).sub(p).normalize(), T = o.clone().sub(p).dot(b), x = u * 2;
8079
+ return f.near = Math.max(T - x, T * 0.01), f.far = T + x, f.updateProjectionMatrix(), D.ok(void 0);
8062
8080
  } catch (t) {
8063
8081
  return D.err(
8064
8082
  new W(
@@ -8283,8 +8301,8 @@ function Tu(i, e, t) {
8283
8301
  "fov" in s ? d = s.fov * (Math.PI / 180) : d = 50 * (Math.PI / 180);
8284
8302
  let u = Math.abs(h / 2 / Math.tan(d / 2));
8285
8303
  u *= 1.65;
8286
- const f = -Math.PI / 4, p = Math.PI / 8, y = a.x + u * Math.sin(f) * Math.cos(p), b = a.y + u * Math.sin(p), S = a.z + u * Math.cos(f) * Math.cos(p);
8287
- return s.position.set(y, b, S), s.lookAt(a), s.updateProjectionMatrix(), r.target && (r.target.copy(a), r.update()), D.ok(void 0);
8304
+ const f = -Math.PI / 4, p = Math.PI / 8, y = a.x + u * Math.sin(f) * Math.cos(p), b = a.y + u * Math.sin(p), T = a.z + u * Math.cos(f) * Math.cos(p);
8305
+ return s.position.set(y, b, T), s.lookAt(a), s.updateProjectionMatrix(), r.target && (r.target.copy(a), r.update()), D.ok(void 0);
8288
8306
  } catch (n) {
8289
8307
  return D.err(
8290
8308
  new W(
@@ -8335,7 +8353,7 @@ class _u {
8335
8353
  this.events = new ar(), this.disposed = !1;
8336
8354
  }
8337
8355
  async initialize(e) {
8338
- const { ThreePathTracingService: t } = await import("./ThreePathTracingService-CdGtwV67.js");
8356
+ const { ThreePathTracingService: t } = await import("./ThreePathTracingService-VPXFQPdb.js");
8339
8357
  if (this.disposed)
8340
8358
  return D.ok(void 0);
8341
8359
  const n = new t();
@@ -8456,15 +8474,15 @@ var lt = Uint8Array, bn = Uint16Array, bu = Int32Array, ta = new lt([
8456
8474
  /* unused */
8457
8475
  0,
8458
8476
  0
8459
- ]), Au = new lt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), sa = function(i, e) {
8477
+ ]), xu = new lt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), sa = function(i, e) {
8460
8478
  for (var t = new bn(31), n = 0; n < 31; ++n)
8461
8479
  t[n] = e += 1 << i[n - 1];
8462
8480
  for (var s = new bu(t[30]), n = 1; n < 30; ++n)
8463
8481
  for (var r = t[n]; r < t[n + 1]; ++r)
8464
8482
  s[r] = r - t[n] << 5 | n;
8465
8483
  return { b: t, r: s };
8466
- }, ia = sa(ta, 2), ra = ia.b, xu = ia.r;
8467
- ra[28] = 258, xu[258] = 28;
8484
+ }, ia = sa(ta, 2), ra = ia.b, Au = ia.r;
8485
+ ra[28] = 258, Au[258] = 28;
8468
8486
  var vu = sa(na, 0), Ru = vu.b, Yi = new bn(32768);
8469
8487
  for (var be = 0; be < 32768; ++be) {
8470
8488
  var Gt = (be & 43690) >> 1 | (be & 21845) << 1;
@@ -8500,17 +8518,17 @@ for (var be = 280; be < 288; ++be)
8500
8518
  var oa = new lt(32);
8501
8519
  for (var be = 0; be < 32; ++be)
8502
8520
  oa[be] = 5;
8503
- var Mu = /* @__PURE__ */ $n(ss, 9, 1), Iu = /* @__PURE__ */ $n(oa, 5, 1), bi = function(i) {
8521
+ var Mu = /* @__PURE__ */ $n(ss, 9, 1), Cu = /* @__PURE__ */ $n(oa, 5, 1), bi = function(i) {
8504
8522
  for (var e = i[0], t = 1; t < i.length; ++t)
8505
8523
  i[t] > e && (e = i[t]);
8506
8524
  return e;
8507
8525
  }, mt = function(i, e, t) {
8508
8526
  var n = e / 8 | 0;
8509
8527
  return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
8510
- }, Ai = function(i, e) {
8528
+ }, xi = function(i, e) {
8511
8529
  var t = e / 8 | 0;
8512
8530
  return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
8513
- }, Cu = function(i) {
8531
+ }, Iu = function(i) {
8514
8532
  return (i + 7) / 8 | 0;
8515
8533
  }, Pu = function(i, e, t) {
8516
8534
  return (t == null || t > i.length) && (t = i.length), new lt(i.subarray(e, t));
@@ -8547,43 +8565,43 @@ var Mu = /* @__PURE__ */ $n(ss, 9, 1), Iu = /* @__PURE__ */ $n(oa, 5, 1), bi = f
8547
8565
  var is = new lt(Math.max(Lt * 2, an));
8548
8566
  is.set(t), t = is;
8549
8567
  }
8550
- }, d = e.f || 0, u = e.p || 0, f = e.b || 0, p = e.l, y = e.d, b = e.m, S = e.n, x = s * 8;
8568
+ }, d = e.f || 0, u = e.p || 0, f = e.b || 0, p = e.l, y = e.d, b = e.m, T = e.n, x = s * 8;
8551
8569
  do {
8552
8570
  if (!p) {
8553
8571
  d = mt(i, u, 1);
8554
8572
  var E = mt(i, u + 1, 3);
8555
8573
  if (u += 3, E)
8556
8574
  if (E == 1)
8557
- p = Mu, y = Iu, b = 9, S = 5;
8575
+ p = Mu, y = Cu, b = 9, T = 5;
8558
8576
  else if (E == 2) {
8559
- var P = mt(i, u, 31) + 257, C = mt(i, u + 10, 15) + 4, M = P + mt(i, u + 5, 31) + 1;
8577
+ var P = mt(i, u, 31) + 257, I = mt(i, u + 10, 15) + 4, M = P + mt(i, u + 5, 31) + 1;
8560
8578
  u += 14;
8561
- for (var O = new lt(M), I = new lt(19), k = 0; k < C; ++k)
8562
- I[Au[k]] = mt(i, u + k * 3, 7);
8563
- u += C * 3;
8564
- for (var N = bi(I), G = (1 << N) - 1, z = $n(I, N, 1), k = 0; k < M; ) {
8579
+ for (var O = new lt(M), C = new lt(19), k = 0; k < I; ++k)
8580
+ C[xu[k]] = mt(i, u + k * 3, 7);
8581
+ u += I * 3;
8582
+ for (var N = bi(C), G = (1 << N) - 1, z = $n(C, N, 1), k = 0; k < M; ) {
8565
8583
  var X = z[mt(i, u, G)];
8566
8584
  u += X & 15;
8567
- var T = X >> 4;
8568
- if (T < 16)
8569
- O[k++] = T;
8585
+ var S = X >> 4;
8586
+ if (S < 16)
8587
+ O[k++] = S;
8570
8588
  else {
8571
8589
  var ie = 0, Ne = 0;
8572
- for (T == 16 ? (Ne = 3 + mt(i, u, 3), u += 2, ie = O[k - 1]) : T == 17 ? (Ne = 3 + mt(i, u, 7), u += 3) : T == 18 && (Ne = 11 + mt(i, u, 127), u += 7); Ne--; )
8590
+ for (S == 16 ? (Ne = 3 + mt(i, u, 3), u += 2, ie = O[k - 1]) : S == 17 ? (Ne = 3 + mt(i, u, 7), u += 3) : S == 18 && (Ne = 11 + mt(i, u, 127), u += 7); Ne--; )
8573
8591
  O[k++] = ie;
8574
8592
  }
8575
8593
  }
8576
8594
  var dt = O.subarray(0, P), Me = O.subarray(P);
8577
- b = bi(dt), S = bi(Me), p = $n(dt, b, 1), y = $n(Me, S, 1);
8595
+ b = bi(dt), T = bi(Me), p = $n(dt, b, 1), y = $n(Me, T, 1);
8578
8596
  } else
8579
8597
  yt(1);
8580
8598
  else {
8581
- var T = Cu(u) + 4, _ = i[T - 4] | i[T - 3] << 8, A = T + _;
8599
+ var S = Iu(u) + 4, _ = i[S - 4] | i[S - 3] << 8, A = S + _;
8582
8600
  if (A > s) {
8583
8601
  c && yt(0);
8584
8602
  break;
8585
8603
  }
8586
- a && h(f + _), t.set(i.subarray(T, A), f), e.b = f += _, e.p = u = A * 8, e.f = d;
8604
+ a && h(f + _), t.set(i.subarray(S, A), f), e.b = f += _, e.p = u = A * 8, e.f = d;
8587
8605
  continue;
8588
8606
  }
8589
8607
  if (u > x) {
@@ -8592,8 +8610,8 @@ var Mu = /* @__PURE__ */ $n(ss, 9, 1), Iu = /* @__PURE__ */ $n(oa, 5, 1), bi = f
8592
8610
  }
8593
8611
  }
8594
8612
  a && h(f + 131072);
8595
- for (var Ue = (1 << b) - 1, Ve = (1 << S) - 1, ve = u; ; ve = u) {
8596
- var ie = p[Ai(i, u) & Ue], ye = ie >> 4;
8613
+ for (var Ue = (1 << b) - 1, Ve = (1 << T) - 1, ve = u; ; ve = u) {
8614
+ var ie = p[xi(i, u) & Ue], ye = ie >> 4;
8597
8615
  if (u += ie & 15, u > x) {
8598
8616
  c && yt(0);
8599
8617
  break;
@@ -8609,12 +8627,12 @@ var Mu = /* @__PURE__ */ $n(ss, 9, 1), Iu = /* @__PURE__ */ $n(oa, 5, 1), bi = f
8609
8627
  var k = ye - 257, We = ta[k];
8610
8628
  bt = mt(i, u, (1 << We) - 1) + ra[k], u += We;
8611
8629
  }
8612
- var zt = y[Ai(i, u) & Ve], ge = zt >> 4;
8630
+ var zt = y[xi(i, u) & Ve], ge = zt >> 4;
8613
8631
  zt || yt(3), u += zt & 15;
8614
8632
  var Me = Ru[ge];
8615
8633
  if (ge > 3) {
8616
8634
  var We = na[ge];
8617
- Me += Ai(i, u) & (1 << We) - 1, u += We;
8635
+ Me += xi(i, u) & (1 << We) - 1, u += We;
8618
8636
  }
8619
8637
  if (u > x) {
8620
8638
  c && yt(0);
@@ -8623,15 +8641,15 @@ var Mu = /* @__PURE__ */ $n(ss, 9, 1), Iu = /* @__PURE__ */ $n(oa, 5, 1), bi = f
8623
8641
  a && h(f + 131072);
8624
8642
  var ft = f + bt;
8625
8643
  if (f < Me) {
8626
- var pt = r - Me, In = Math.min(Me, ft);
8627
- for (pt + f < 0 && yt(3); f < In; ++f)
8644
+ var pt = r - Me, Cn = Math.min(Me, ft);
8645
+ for (pt + f < 0 && yt(3); f < Cn; ++f)
8628
8646
  t[f] = n[pt + f];
8629
8647
  }
8630
8648
  for (; f < ft; ++f)
8631
8649
  t[f] = t[f - Me];
8632
8650
  }
8633
8651
  }
8634
- e.l = p, e.p = ve, e.b = f, e.f = d, p && (d = 1, e.m = b, e.d = y, e.n = S);
8652
+ e.l = p, e.p = ve, e.b = f, e.f = d, p && (d = 1, e.m = b, e.d = y, e.n = T);
8635
8653
  } while (!d);
8636
8654
  return f != t.length && o ? Pu(t, 0, f) : t.subarray(0, f);
8637
8655
  }, Du = /* @__PURE__ */ new lt(0), Nu = function(i, e) {
@@ -8662,7 +8680,7 @@ class zu extends ko {
8662
8680
  */
8663
8681
  parse(e) {
8664
8682
  const O = Math.pow(2.7182818, 2.2);
8665
- let I = null;
8683
+ let C = null;
8666
8684
  function k(l, m) {
8667
8685
  let w = 0;
8668
8686
  for (let L = 0; L < 65536; ++L)
@@ -8792,7 +8810,7 @@ class zu extends ko {
8792
8810
  const w = We(l), R = We(m), L = w - (R >> 1) & 65535, B = R + L - 32768 & 65535;
8793
8811
  ge.a = B, ge.b = L;
8794
8812
  }
8795
- function In(l, m, w, R, L, B, v) {
8813
+ function Cn(l, m, w, R, L, B, v) {
8796
8814
  const H = v < 16384, F = w > L ? L : w;
8797
8815
  let U = 1, j, K;
8798
8816
  for (; U <= F; ) U <<= 1;
@@ -8925,23 +8943,23 @@ class zu extends ko {
8925
8943
  le[he].fill(0), le[he][0] = L[Q[he]++], Sr(Y, R, le[he]), _r(le[he], re[he]), br(re[he]);
8926
8944
  Ta(re);
8927
8945
  for (let he = 0; he < U; ++he)
8928
- Ar(re[he], oe[he], ae * 64);
8946
+ xr(re[he], oe[he], ae * 64);
8929
8947
  }
8930
8948
  let pe = 0;
8931
8949
  for (let ae = 0; ae < U; ++ae) {
8932
8950
  const he = w[l.idx[ae]].type;
8933
- for (let Ie = 8 * te; Ie < 8 * te + se; ++Ie) {
8934
- pe = ue[ae][Ie];
8951
+ for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
8952
+ pe = ue[ae][Ce];
8935
8953
  for (let it = 0; it < j; ++it) {
8936
- const _e = it * 64 + (Ie & 7) * 8;
8954
+ const _e = it * 64 + (Ce & 7) * 8;
8937
8955
  v.setUint16(pe + 0 * he, oe[ae][_e + 0], !0), v.setUint16(pe + 2 * he, oe[ae][_e + 1], !0), v.setUint16(pe + 4 * he, oe[ae][_e + 2], !0), v.setUint16(pe + 6 * he, oe[ae][_e + 3], !0), v.setUint16(pe + 8 * he, oe[ae][_e + 4], !0), v.setUint16(pe + 10 * he, oe[ae][_e + 5], !0), v.setUint16(pe + 12 * he, oe[ae][_e + 6], !0), v.setUint16(pe + 14 * he, oe[ae][_e + 7], !0), pe += 16 * he;
8938
8956
  }
8939
8957
  }
8940
8958
  if (j != K)
8941
- for (let Ie = 8 * te; Ie < 8 * te + se; ++Ie) {
8942
- const it = ue[ae][Ie] + 8 * j * 2 * he, _e = j * 64 + (Ie & 7) * 8;
8943
- for (let At = 0; At < we; ++At)
8944
- v.setUint16(it + At * 2 * he, oe[ae][_e + At], !0);
8959
+ for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
8960
+ const it = ue[ae][Ce] + 8 * j * 2 * he, _e = j * 64 + (Ce & 7) * 8;
8961
+ for (let xt = 0; xt < we; ++xt)
8962
+ v.setUint16(it + xt * 2 * he, oe[ae][_e + xt], !0);
8945
8963
  }
8946
8964
  }
8947
8965
  }
@@ -8968,7 +8986,7 @@ class zu extends ko {
8968
8986
  let ne = 8;
8969
8987
  ue == K - 1 && (ne = ee);
8970
8988
  for (let te = 0; te < j; ++te)
8971
- le.fill(0), le[0] = L[Q++], Sr(Y, R, le), _r(le, re), br(re), Ar(re, oe, te * 64);
8989
+ le.fill(0), le[0] = L[Q++], Sr(Y, R, le), _r(le, re), br(re), xr(re, oe, te * 64);
8972
8990
  for (let te = 8 * ue; te < 8 * ue + ne; ++te) {
8973
8991
  let se = m[l][te];
8974
8992
  for (let we = 0; we < V; ++we) {
@@ -9009,7 +9027,7 @@ class zu extends ko {
9009
9027
  l[0][m] = w + 1.5747 * L, l[1][m] = w - 0.1873 * R - 0.4682 * L, l[2][m] = w + 1.8556 * R;
9010
9028
  }
9011
9029
  }
9012
- function Ar(l, m, w) {
9030
+ function xr(l, m, w) {
9013
9031
  for (let R = 0; R < 64; ++R)
9014
9032
  m[w + R] = Et.toHalfFloat(Sa(l[R]));
9015
9033
  }
@@ -9033,7 +9051,7 @@ class zu extends ko {
9033
9051
  const v = new Array(l.inputChannels.length);
9034
9052
  for (let ee = 0, Y = l.inputChannels.length; ee < Y; ee++)
9035
9053
  v[ee] = {}, v[ee].start = B, v[ee].end = v[ee].start, v[ee].nx = l.columns, v[ee].ny = l.lines, v[ee].size = l.type, B += v[ee].nx * v[ee].ny * v[ee].size;
9036
- const H = Cn(m, w), F = Cn(m, w);
9054
+ const H = In(m, w), F = In(m, w);
9037
9055
  if (F >= 8192)
9038
9056
  throw new Error("THREE.EXRLoader: Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");
9039
9057
  if (H <= F)
@@ -9044,7 +9062,7 @@ class zu extends ko {
9044
9062
  for (let ee = 0; ee < l.inputChannels.length; ++ee) {
9045
9063
  const Y = v[ee];
9046
9064
  for (let Q = 0; Q < v[ee].size; ++Q)
9047
- In(
9065
+ Cn(
9048
9066
  R,
9049
9067
  Y.start + Q,
9050
9068
  Y.nx,
@@ -9064,7 +9082,7 @@ class zu extends ko {
9064
9082
  }
9065
9083
  return new DataView(q.buffer);
9066
9084
  }
9067
- function Aa(l) {
9085
+ function xa(l) {
9068
9086
  const m = l.array.slice(l.offset.value, l.offset.value + l.size), w = Gn(m), R = l.inputChannels.length * l.lines * l.columns * l.totalBytes, L = new ArrayBuffer(R), B = new DataView(L);
9069
9087
  let v = 0, H = 0;
9070
9088
  const F = new Array(4);
@@ -9090,7 +9108,7 @@ class zu extends ko {
9090
9108
  }
9091
9109
  return B;
9092
9110
  }
9093
- function xa(l) {
9111
+ function Aa(l) {
9094
9112
  const m = l.array;
9095
9113
  let w = l.offset.value;
9096
9114
  const R = l.columns, L = l.lines, B = l.inputChannels, v = l.totalBytes, H = Ke.compression === "B44A_COMPRESSION", F = new Uint8Array(L * R * v), U = new Uint16Array(16);
@@ -9115,23 +9133,23 @@ class zu extends ko {
9115
9133
  const ne = m[w] << 8 | m[w + 1], te = ne & 32768 ? ne & 32767 : ~ne & 65535;
9116
9134
  U.fill(te), w += 3;
9117
9135
  } else {
9118
- const ne = m[w] << 8 | m[w + 1], te = m[w + 2] >> 2, se = 32 << te, we = ne + ((m[w + 2] << 4 | m[w + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = we + ((m[w + 3] << 2 | m[w + 4] >> 6) & 63) * (1 << te) - se & 65535, ae = pe + (m[w + 4] & 63) * (1 << te) - se & 65535, he = ne + (m[w + 5] >> 2 & 63) * (1 << te) - se & 65535, Ie = we + ((m[w + 5] << 4 | m[w + 6] >> 4) & 63) * (1 << te) - se & 65535, it = pe + ((m[w + 6] << 2 | m[w + 7] >> 6) & 63) * (1 << te) - se & 65535, _e = ae + (m[w + 7] & 63) * (1 << te) - se & 65535, At = he + (m[w + 8] >> 2 & 63) * (1 << te) - se & 65535, cn = Ie + ((m[w + 8] << 4 | m[w + 9] >> 4) & 63) * (1 << te) - se & 65535, Pn = it + ((m[w + 9] << 2 | m[w + 10] >> 6) & 63) * (1 << te) - se & 65535, xt = _e + (m[w + 10] & 63) * (1 << te) - se & 65535, qt = At + (m[w + 11] >> 2 & 63) * (1 << te) - se & 65535, ds = cn + ((m[w + 11] << 4 | m[w + 12] >> 4) & 63) * (1 << te) - se & 65535, fs = Pn + ((m[w + 12] << 2 | m[w + 13] >> 6) & 63) * (1 << te) - se & 65535, ps = xt + (m[w + 13] & 63) * (1 << te) - se & 65535, Ln = [ne, he, At, qt, we, Ie, cn, ds, pe, it, Pn, fs, ae, _e, xt, ps];
9136
+ const ne = m[w] << 8 | m[w + 1], te = m[w + 2] >> 2, se = 32 << te, we = ne + ((m[w + 2] << 4 | m[w + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = we + ((m[w + 3] << 2 | m[w + 4] >> 6) & 63) * (1 << te) - se & 65535, ae = pe + (m[w + 4] & 63) * (1 << te) - se & 65535, he = ne + (m[w + 5] >> 2 & 63) * (1 << te) - se & 65535, Ce = we + ((m[w + 5] << 4 | m[w + 6] >> 4) & 63) * (1 << te) - se & 65535, it = pe + ((m[w + 6] << 2 | m[w + 7] >> 6) & 63) * (1 << te) - se & 65535, _e = ae + (m[w + 7] & 63) * (1 << te) - se & 65535, xt = he + (m[w + 8] >> 2 & 63) * (1 << te) - se & 65535, cn = Ce + ((m[w + 8] << 4 | m[w + 9] >> 4) & 63) * (1 << te) - se & 65535, Pn = it + ((m[w + 9] << 2 | m[w + 10] >> 6) & 63) * (1 << te) - se & 65535, At = _e + (m[w + 10] & 63) * (1 << te) - se & 65535, qt = xt + (m[w + 11] >> 2 & 63) * (1 << te) - se & 65535, ds = cn + ((m[w + 11] << 4 | m[w + 12] >> 4) & 63) * (1 << te) - se & 65535, fs = Pn + ((m[w + 12] << 2 | m[w + 13] >> 6) & 63) * (1 << te) - se & 65535, ps = At + (m[w + 13] & 63) * (1 << te) - se & 65535, Ln = [ne, he, xt, qt, we, Ce, cn, ds, pe, it, Pn, fs, ae, _e, At, ps];
9119
9137
  for (let ln = 0; ln < 16; ln++)
9120
9138
  U[ln] = Ln[ln] & 32768 ? Ln[ln] & 32767 : ~Ln[ln] & 65535;
9121
9139
  w += 14;
9122
9140
  }
9123
9141
  if (V.pLinear) {
9124
- if (I === null) {
9125
- I = new Uint16Array(65536);
9142
+ if (C === null) {
9143
+ C = new Uint16Array(65536);
9126
9144
  for (let ne = 0; ne < 65536; ne++)
9127
9145
  if ((ne & 31744) === 31744 || ne > 32768)
9128
- I[ne] = 0;
9146
+ C[ne] = 0;
9129
9147
  else {
9130
9148
  const te = J(ne);
9131
- I[ne] = te <= 0 ? 0 : Et.toHalfFloat(8 * Math.log(te));
9149
+ C[ne] = te <= 0 ? 0 : Et.toHalfFloat(8 * Math.log(te));
9132
9150
  }
9133
9151
  }
9134
- for (let ne = 0; ne < 16; ne++) U[ne] = I[U[ne]];
9152
+ for (let ne = 0; ne < 16; ne++) U[ne] = C[U[ne]];
9135
9153
  }
9136
9154
  for (let ne = 0; ne < 4; ne++) {
9137
9155
  const te = oe * 4 + ne;
@@ -9143,8 +9161,8 @@ class zu extends ko {
9143
9161
  for (let ae = 0; ae < V.ySampling; ae++) {
9144
9162
  const he = te * V.ySampling + ae;
9145
9163
  if (!(he >= L))
9146
- for (let Ie = 0; Ie < V.xSampling; Ie++) {
9147
- const it = we * V.xSampling + Ie;
9164
+ for (let Ce = 0; Ce < V.xSampling; Ce++) {
9165
+ const it = we * V.xSampling + Ce;
9148
9166
  if (it >= R) continue;
9149
9167
  const _e = he * R * v + j * R + it * 2;
9150
9168
  F[_e] = pe & 255, F[_e + 1] = pe >> 8 & 255;
@@ -9157,7 +9175,7 @@ class zu extends ko {
9157
9175
  }
9158
9176
  return new DataView(F.buffer);
9159
9177
  }
9160
- function xr(l) {
9178
+ function Ar(l) {
9161
9179
  const m = l.viewer, w = { value: l.offset.value }, R = new Uint8Array(l.columns * l.lines * (l.inputChannels.length * l.type * 2)), L = {
9162
9180
  version: ke(m, w),
9163
9181
  unknownUncompressedSize: ke(m, w),
@@ -9174,7 +9192,7 @@ class zu extends ko {
9174
9192
  if (L.version < 2)
9175
9193
  throw new Error("THREE.EXRLoader: " + Ke.compression + " version " + L.version + " is unsupported");
9176
9194
  const B = new Array();
9177
- let v = Cn(m, w) - 2;
9195
+ let v = In(m, w) - 2;
9178
9196
  for (; v > 0; ) {
9179
9197
  const Y = cs(m.buffer, w), Q = Bt(m, w), re = Q >> 2 & 3, le = (Q >> 4) - 1, oe = new Int8Array([le])[0], ue = Bt(m, w);
9180
9198
  B.push({
@@ -9303,19 +9321,19 @@ class zu extends ko {
9303
9321
  const w = l.getFloat32(m.value, !0);
9304
9322
  return m.value += 4, w;
9305
9323
  }
9306
- function Ia(l, m) {
9324
+ function Ca(l, m) {
9307
9325
  return Et.toHalfFloat(Ze(l, m));
9308
9326
  }
9309
9327
  function J(l) {
9310
9328
  const m = (l & 31744) >> 10, w = l & 1023;
9311
9329
  return (l >> 15 ? -1 : 1) * (m ? m === 31 ? w ? NaN : 1 / 0 : Math.pow(2, m - 15) * (1 + w / 1024) : 6103515625e-14 * (w / 1024));
9312
9330
  }
9313
- function Cn(l, m) {
9331
+ function In(l, m) {
9314
9332
  const w = l.getUint16(m.value, !0);
9315
9333
  return m.value += 2, w;
9316
9334
  }
9317
- function Ca(l, m) {
9318
- return J(Cn(l, m));
9335
+ function Ia(l, m) {
9336
+ return J(In(l, m));
9319
9337
  }
9320
9338
  function Pa(l, m, w, R) {
9321
9339
  const L = w.value, B = [];
@@ -9579,31 +9597,31 @@ class zu extends ko {
9579
9597
  const we = se === 0 ? 0 : re[se - 1], ae = re[se] - we;
9580
9598
  if (ae === 0) continue;
9581
9599
  const he = new Float32Array(F);
9582
- let Ie = 0;
9600
+ let Ce = 0;
9583
9601
  for (let _e = 0; _e < ae; _e++) {
9584
- const At = we + _e, cn = 1 - Ie;
9602
+ const xt = we + _e, cn = 1 - Ce;
9585
9603
  if (cn <= 0) break;
9586
9604
  let Pn = 1;
9587
9605
  if (j >= 0) {
9588
- const xt = L[j].bytesPerSample, qt = ue[j] + At * xt;
9589
- Pn = xt === 2 ? J(oe.getUint16(qt, !0)) : oe.getFloat32(qt, !0);
9606
+ const At = L[j].bytesPerSample, qt = ue[j] + xt * At;
9607
+ Pn = At === 2 ? J(oe.getUint16(qt, !0)) : oe.getFloat32(qt, !0);
9590
9608
  }
9591
- for (let xt = 0; xt < L.length; xt++) {
9592
- const qt = L[xt], ds = H[qt.name];
9609
+ for (let At = 0; At < L.length; At++) {
9610
+ const qt = L[At], ds = H[qt.name];
9593
9611
  if (ds === void 0) continue;
9594
- const fs = qt.bytesPerSample, ps = ue[xt] + At * fs, Ln = fs === 2 ? J(oe.getUint16(ps, !0)) : oe.getFloat32(ps, !0);
9612
+ const fs = qt.bytesPerSample, ps = ue[At] + xt * fs, Ln = fs === 2 ? J(oe.getUint16(ps, !0)) : oe.getFloat32(ps, !0);
9595
9613
  he[ds] += Ln * cn;
9596
9614
  }
9597
- Ie += Pn * cn;
9615
+ Ce += Pn * cn;
9598
9616
  }
9599
- H.A !== void 0 && (he[H.A] = Ie);
9617
+ H.A !== void 0 && (he[H.A] = Ce);
9600
9618
  const it = te + se * F;
9601
9619
  for (let _e = 0; _e < F; _e++)
9602
9620
  l.byteArray[it + _e] = U ? Et.toHalfFloat(he[_e]) : he[_e];
9603
9621
  }
9604
9622
  }
9605
9623
  }
9606
- function Ir(l, m, w) {
9624
+ function Cr(l, m, w) {
9607
9625
  const R = {};
9608
9626
  let L = !1;
9609
9627
  for (; ; ) {
@@ -9628,14 +9646,14 @@ class zu extends ko {
9628
9646
  const v = [];
9629
9647
  if (B.multiPart) {
9630
9648
  for (; ; ) {
9631
- const H = Ir(l, m, w);
9649
+ const H = Cr(l, m, w);
9632
9650
  if (H === null) break;
9633
9651
  H.version = R, H.spec = B, v.push(H);
9634
9652
  }
9635
9653
  if (v.length === 0)
9636
9654
  throw new Error("THREE.EXRLoader: No valid part headers found.");
9637
9655
  } else {
9638
- const H = Ir(l, m, w);
9656
+ const H = Cr(l, m, w);
9639
9657
  H.version = R, H.spec = B, v.push(H);
9640
9658
  }
9641
9659
  return v;
@@ -9678,17 +9696,17 @@ class zu extends ko {
9678
9696
  v.blockHeight = 32, v.uncompress = ba;
9679
9697
  break;
9680
9698
  case "PXR24_COMPRESSION":
9681
- v.blockHeight = 16, v.uncompress = Aa;
9699
+ v.blockHeight = 16, v.uncompress = xa;
9682
9700
  break;
9683
9701
  case "B44_COMPRESSION":
9684
9702
  case "B44A_COMPRESSION":
9685
- v.blockHeight = 32, v.uncompress = xa;
9703
+ v.blockHeight = 32, v.uncompress = Aa;
9686
9704
  break;
9687
9705
  case "DWAA_COMPRESSION":
9688
- v.blockHeight = 32, v.uncompress = xr;
9706
+ v.blockHeight = 32, v.uncompress = Ar;
9689
9707
  break;
9690
9708
  case "DWAB_COMPRESSION":
9691
- v.blockHeight = 256, v.uncompress = xr;
9709
+ v.blockHeight = 256, v.uncompress = Ar;
9692
9710
  break;
9693
9711
  default:
9694
9712
  throw new Error("THREE.EXRLoader: " + l.compression + " is unsupported");
@@ -9728,10 +9746,10 @@ class zu extends ko {
9728
9746
  if (v.yCbCr && (v.format = $t, v.outputChannels = 4, v.decodeChannels = { Y: 0, RY: 1, BY: 2 }, F = !0), v.type == 1)
9729
9747
  switch (L) {
9730
9748
  case Yn:
9731
- v.getter = Ca;
9749
+ v.getter = Ia;
9732
9750
  break;
9733
9751
  case Zt:
9734
- v.getter = Cn;
9752
+ v.getter = In;
9735
9753
  break;
9736
9754
  }
9737
9755
  else if (v.type == 2)
@@ -9740,7 +9758,7 @@ class zu extends ko {
9740
9758
  v.getter = Ze;
9741
9759
  break;
9742
9760
  case Zt:
9743
- v.getter = Ia;
9761
+ v.getter = Ca;
9744
9762
  }
9745
9763
  else
9746
9764
  throw new Error("THREE.EXRLoader: unsupported pixelType " + v.type + " for " + l.compression + ".");
@@ -9792,11 +9810,11 @@ class zu extends ko {
9792
9810
  }
9793
9811
  return v;
9794
9812
  }
9795
- const ls = { value: 0 }, hs = new DataView(e), Ya = new Uint8Array(e), us = Ka(hs, e, ls), Cr = Math.max(0, Math.min(this.part, us.length - 1)), Ke = us[Cr];
9813
+ const ls = { value: 0 }, hs = new DataView(e), Ya = new Uint8Array(e), us = Ka(hs, e, ls), Ir = Math.max(0, Math.min(this.part, us.length - 1)), Ke = us[Ir];
9796
9814
  if (Ke.spec.multiPart || Ke.spec.deepFormat)
9797
9815
  for (let l = 0; l < us.length; l++) {
9798
9816
  const m = us[l].chunkCount;
9799
- if (l === Cr) {
9817
+ if (l === Ir) {
9800
9818
  Ke._chunkOffsets = [];
9801
9819
  for (let w = 0; w < m; w++)
9802
9820
  Ke._chunkOffsets.push(ke(hs, ls));
@@ -9897,7 +9915,7 @@ class Bu extends ko {
9897
9915
  case 4:
9898
9916
  throw new Error("THREE.HDRLoader: Memory Error: " + (O || ""));
9899
9917
  }
9900
- }, u = function(M, O, I) {
9918
+ }, u = function(M, O, C) {
9901
9919
  O = O || 1024;
9902
9920
  let N = M.pos, G = -1, z = 0, X = "", ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(N, N + 128)));
9903
9921
  for (; 0 > (G = ie.indexOf(`
@@ -9905,7 +9923,7 @@ class Bu extends ko {
9905
9923
  X += ie, z += ie.length, N += 128, ie = String.fromCharCode.apply(null, new Uint16Array(M.subarray(N, N + 128)));
9906
9924
  return -1 < G ? (M.pos += z + G + 1, X + ie.slice(0, G)) : !1;
9907
9925
  }, f = function(M) {
9908
- const O = /^#\?(\S+)/, I = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, k = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, G = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, z = {
9926
+ const O = /^#\?(\S+)/, C = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, k = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, N = /^\s*FORMAT=(\S+)\s*$/, G = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, z = {
9909
9927
  valid: 0,
9910
9928
  /* indicate which fields are valid */
9911
9929
  string: "",
@@ -9933,10 +9951,10 @@ class Bu extends ko {
9933
9951
  `;
9934
9952
  continue;
9935
9953
  }
9936
- if ((ie = X.match(I)) && (z.gamma = parseFloat(ie[1])), (ie = X.match(k)) && (z.exposure = parseFloat(ie[1])), (ie = X.match(N)) && (z.valid |= 2, z.format = ie[1]), (ie = X.match(G)) && (z.valid |= 4, z.height = parseInt(ie[1], 10), z.width = parseInt(ie[2], 10)), z.valid & 2 && z.valid & 4) break;
9954
+ if ((ie = X.match(C)) && (z.gamma = parseFloat(ie[1])), (ie = X.match(k)) && (z.exposure = parseFloat(ie[1])), (ie = X.match(N)) && (z.valid |= 2, z.format = ie[1]), (ie = X.match(G)) && (z.valid |= 4, z.height = parseInt(ie[1], 10), z.width = parseInt(ie[2], 10)), z.valid & 2 && z.valid & 4) break;
9937
9955
  }
9938
9956
  return z.valid & 2 || o(3, "missing format specifier"), z.valid & 4 || o(3, "missing image size specifier"), z;
9939
- }, p = function(M, O, I) {
9957
+ }, p = function(M, O, C) {
9940
9958
  const k = O;
9941
9959
  if (
9942
9960
  // run length encoding is not allowed so read flat
@@ -9945,11 +9963,11 @@ class Bu extends ko {
9945
9963
  )
9946
9964
  return new Uint8Array(M);
9947
9965
  k !== (M[2] << 8 | M[3]) && o(3, "wrong scanline width");
9948
- const N = new Uint8Array(4 * O * I);
9966
+ const N = new Uint8Array(4 * O * C);
9949
9967
  N.length || o(4, "unable to allocate buffer space");
9950
9968
  let G = 0, z = 0;
9951
9969
  const X = 4 * k, ie = new Uint8Array(4), Ne = new Uint8Array(X);
9952
- let dt = I;
9970
+ let dt = C;
9953
9971
  for (; dt > 0 && z < M.byteLength; ) {
9954
9972
  z + 4 > M.byteLength && o(1), ie[0] = M[z++], ie[1] = M[z++], ie[2] = M[z++], ie[3] = M[z++], (ie[0] != 2 || ie[1] != 2 || (ie[2] << 8 | ie[3]) != k) && o(3, "bad rgbe scanline format");
9955
9973
  let Me = 0, Ue;
@@ -9971,29 +9989,29 @@ class Bu extends ko {
9971
9989
  dt--;
9972
9990
  }
9973
9991
  return N;
9974
- }, y = function(M, O, I, k) {
9992
+ }, y = function(M, O, C, k) {
9975
9993
  const N = M[O + 3], G = Math.pow(2, N - 128) / 255;
9976
- I[k + 0] = M[O + 0] * G, I[k + 1] = M[O + 1] * G, I[k + 2] = M[O + 2] * G, I[k + 3] = 1;
9977
- }, b = function(M, O, I, k) {
9994
+ C[k + 0] = M[O + 0] * G, C[k + 1] = M[O + 1] * G, C[k + 2] = M[O + 2] * G, C[k + 3] = 1;
9995
+ }, b = function(M, O, C, k) {
9978
9996
  const N = M[O + 3], G = Math.pow(2, N - 128) / 255;
9979
- I[k + 0] = Et.toHalfFloat(Math.min(M[O + 0] * G, 65504)), I[k + 1] = Et.toHalfFloat(Math.min(M[O + 1] * G, 65504)), I[k + 2] = Et.toHalfFloat(Math.min(M[O + 2] * G, 65504)), I[k + 3] = Et.toHalfFloat(1);
9980
- }, S = new Uint8Array(e);
9981
- S.pos = 0;
9982
- const x = f(S), E = x.width, T = x.height, _ = p(S.subarray(S.pos), E, T);
9983
- let A, P, C;
9997
+ C[k + 0] = Et.toHalfFloat(Math.min(M[O + 0] * G, 65504)), C[k + 1] = Et.toHalfFloat(Math.min(M[O + 1] * G, 65504)), C[k + 2] = Et.toHalfFloat(Math.min(M[O + 2] * G, 65504)), C[k + 3] = Et.toHalfFloat(1);
9998
+ }, T = new Uint8Array(e);
9999
+ T.pos = 0;
10000
+ const x = f(T), E = x.width, S = x.height, _ = p(T.subarray(T.pos), E, S);
10001
+ let A, P, I;
9984
10002
  switch (this.type) {
9985
10003
  case Yn:
9986
- C = _.length / 4;
9987
- const M = new Float32Array(C * 4);
9988
- for (let I = 0; I < C; I++)
9989
- y(_, I * 4, M, I * 4);
10004
+ I = _.length / 4;
10005
+ const M = new Float32Array(I * 4);
10006
+ for (let C = 0; C < I; C++)
10007
+ y(_, C * 4, M, C * 4);
9990
10008
  A = M, P = Yn;
9991
10009
  break;
9992
10010
  case Zt:
9993
- C = _.length / 4;
9994
- const O = new Uint16Array(C * 4);
9995
- for (let I = 0; I < C; I++)
9996
- b(_, I * 4, O, I * 4);
10011
+ I = _.length / 4;
10012
+ const O = new Uint16Array(I * 4);
10013
+ for (let C = 0; C < I; C++)
10014
+ b(_, C * 4, O, C * 4);
9997
10015
  A = O, P = Zt;
9998
10016
  break;
9999
10017
  default:
@@ -10001,7 +10019,7 @@ class Bu extends ko {
10001
10019
  }
10002
10020
  return {
10003
10021
  width: E,
10004
- height: T,
10022
+ height: S,
10005
10023
  data: A,
10006
10024
  header: x.string,
10007
10025
  gamma: x.gamma,
@@ -10032,9 +10050,9 @@ class Uu extends Bu {
10032
10050
  class Hu extends Mc {
10033
10051
  constructor() {
10034
10052
  super(), this.name = "RoomEnvironment", this.position.y = -3.5;
10035
- const e = new Ic();
10053
+ const e = new Cc();
10036
10054
  e.deleteAttribute("uv");
10037
- const t = new js({ side: Ao }), n = new js(), s = new Co(16777215, 900, 28, 2);
10055
+ const t = new js({ side: xo }), n = new js(), s = new Io(16777215, 900, 28, 2);
10038
10056
  s.position.set(0.418, 16.199, 0.3), this.add(s);
10039
10057
  const r = new wt(e, t);
10040
10058
  r.position.set(-0.757, 13.219, 0.717), r.scale.set(31.713, 28.305, 28.591), this.add(r);
@@ -10067,7 +10085,7 @@ class Hu extends Mc {
10067
10085
  }
10068
10086
  }
10069
10087
  function En(i) {
10070
- return new Cc({
10088
+ return new Ic({
10071
10089
  color: 0,
10072
10090
  emissive: 16777215,
10073
10091
  emissiveIntensity: i
@@ -10654,7 +10672,7 @@ class nd {
10654
10672
  t.renderer || {}
10655
10673
  );
10656
10674
  b.preserveDrawingBuffer = !0;
10657
- const S = {
10675
+ const T = {
10658
10676
  renderer: n,
10659
10677
  scene: s,
10660
10678
  camera: r,
@@ -10670,7 +10688,7 @@ class nd {
10670
10688
  anchorProjectionService: p,
10671
10689
  animationService: y
10672
10690
  };
10673
- return new Hc(S);
10691
+ return new Hc(T);
10674
10692
  }
10675
10693
  static createCamera(e) {
10676
10694
  const n = e.camera || {}, s = n.fov || n.cameraFov || 30, r = n.near || n.cameraNear || 0.1, o = n.far || n.cameraFar || 1e5, a = n.position || n.cameraPosition, c = n.target || n.cameraTarget, h = pr.create(
@@ -10949,7 +10967,7 @@ function cd(i) {
10949
10967
  return i ? ca[i] : {};
10950
10968
  }
10951
10969
  function Qi(i, e) {
10952
- return An(An(i, cd(e.preset)), e);
10970
+ return xn(xn(i, cd(e.preset)), e);
10953
10971
  }
10954
10972
  const ks = (i, ...e) => {
10955
10973
  if (!i)
@@ -11069,18 +11087,18 @@ function dd(i, e) {
11069
11087
  if (!t.current || !i.current)
11070
11088
  return;
11071
11089
  let f = null;
11072
- const p = (S) => {
11090
+ const p = (T) => {
11073
11091
  if (i.current && t.current) {
11074
11092
  const x = i.current.parentElement || i.current;
11075
- let { clientWidth: E, clientHeight: T } = x;
11076
- if (S && S[0]) {
11077
- const { width: _, height: A } = S[0].contentRect;
11078
- E = Math.floor(_), T = Math.floor(A);
11093
+ let { clientWidth: E, clientHeight: S } = x;
11094
+ if (T && T[0]) {
11095
+ const { width: _, height: A } = T[0].contentRect;
11096
+ E = Math.floor(_), S = Math.floor(A);
11079
11097
  }
11080
- if (n.current.width === E && n.current.height === T)
11098
+ if (n.current.width === E && n.current.height === S)
11081
11099
  return;
11082
11100
  f !== null && cancelAnimationFrame(f), f = requestAnimationFrame(() => {
11083
- t.current && i.current && (t.current.resize(E, T), n.current = { width: E, height: T });
11101
+ t.current && i.current && (t.current.resize(E, S), n.current = { width: E, height: S });
11084
11102
  });
11085
11103
  }
11086
11104
  };
@@ -11178,7 +11196,7 @@ function md(i, e, t) {
11178
11196
  };
11179
11197
  }, [i, e, n]), s;
11180
11198
  }
11181
- class xi {
11199
+ class Ai {
11182
11200
  /**
11183
11201
  * Convert IObject3D to THREE.Object3D
11184
11202
  */
@@ -11252,11 +11270,11 @@ function gd(i) {
11252
11270
  () => ({
11253
11271
  "model:loading": (n) => e.current.emit("model:loading", n),
11254
11272
  "model:progress": (n) => e.current.emit("model:progress", n),
11255
- "model:loaded": (n) => e.current.emit("model:loaded", xi.convertModelLoaded(n)),
11273
+ "model:loaded": (n) => e.current.emit("model:loaded", Ai.convertModelLoaded(n)),
11256
11274
  "model:error": (n) => e.current.emit("model:error", n),
11257
11275
  "render:complete": (n) => e.current.emit("render:complete", n),
11258
- "controls:change": (n) => e.current.emit("controls:change", xi.convertControlsChange(n)),
11259
- "object:selected": (n) => e.current.emit("object:selected", xi.convertObjectSelected(n)),
11276
+ "controls:change": (n) => e.current.emit("controls:change", Ai.convertControlsChange(n)),
11277
+ "object:selected": (n) => e.current.emit("object:selected", Ai.convertObjectSelected(n)),
11260
11278
  error: (n) => e.current.emit("error", n)
11261
11279
  }),
11262
11280
  []
@@ -11362,7 +11380,7 @@ class fa extends No {
11362
11380
  * @param {?HTMLDOMElement} domElement - The HTML element used for event listeners.
11363
11381
  */
11364
11382
  constructor(e, t = null) {
11365
- super(e, t), this.state = Te.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new Rn(), this._lastTargetPosition = new $(), this._quat = new Rn().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Vs(), this._sphericalDelta = new Vs(), this._scale = 1, this._panOffset = new $(), this._rotateStart = new me(), this._rotateEnd = new me(), this._rotateDelta = new me(), this._panStart = new me(), this._panEnd = new me(), this._panDelta = new me(), this._dollyStart = new me(), this._dollyEnd = new me(), this._dollyDelta = new me(), this._dollyDirection = new $(), this._mouse = new me(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = bd.bind(this), this._onPointerDown = _d.bind(this), this._onPointerUp = Ad.bind(this), this._onContextMenu = Pd.bind(this), this._onMouseWheel = Rd.bind(this), this._onKeyDown = Md.bind(this), this._onTouchStart = Id.bind(this), this._onTouchMove = Cd.bind(this), this._onMouseDown = xd.bind(this), this._onMouseMove = vd.bind(this), this._interceptControlDown = Ld.bind(this), this._interceptControlUp = Od.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
11383
+ super(e, t), this.state = Te.NONE, this.target = new $(), this.cursor = new $(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: Be.ROTATE, MIDDLE: Be.DOLLY, RIGHT: Be.PAN }, this.touches = { ONE: Ye.ROTATE, TWO: Ye.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this._lastPosition = new $(), this._lastQuaternion = new Rn(), this._lastTargetPosition = new $(), this._quat = new Rn().setFromUnitVectors(e.up, new $(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new Vs(), this._sphericalDelta = new Vs(), this._scale = 1, this._panOffset = new $(), this._rotateStart = new me(), this._rotateEnd = new me(), this._rotateDelta = new me(), this._panStart = new me(), this._panEnd = new me(), this._panDelta = new me(), this._dollyStart = new me(), this._dollyEnd = new me(), this._dollyDelta = new me(), this._dollyDirection = new $(), this._mouse = new me(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = bd.bind(this), this._onPointerDown = _d.bind(this), this._onPointerUp = xd.bind(this), this._onContextMenu = Pd.bind(this), this._onMouseWheel = Rd.bind(this), this._onKeyDown = Md.bind(this), this._onTouchStart = Cd.bind(this), this._onTouchMove = Id.bind(this), this._onMouseDown = Ad.bind(this), this._onMouseMove = vd.bind(this), this._interceptControlDown = Ld.bind(this), this._interceptControlUp = Od.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
11366
11384
  }
11367
11385
  connect(e) {
11368
11386
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, { passive: !0, capture: !0 }), this.domElement.style.touchAction = "none";
@@ -11656,7 +11674,7 @@ function _d(i) {
11656
11674
  function bd(i) {
11657
11675
  this.enabled !== !1 && (i.pointerType === "touch" ? this._onTouchMove(i) : this._onMouseMove(i));
11658
11676
  }
11659
- function Ad(i) {
11677
+ function xd(i) {
11660
11678
  switch (this._removePointer(i), this._pointers.length) {
11661
11679
  case 0:
11662
11680
  this.domElement.releasePointerCapture(i.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.domElement.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(da), this.state = Te.NONE;
@@ -11667,7 +11685,7 @@ function Ad(i) {
11667
11685
  break;
11668
11686
  }
11669
11687
  }
11670
- function xd(i) {
11688
+ function Ad(i) {
11671
11689
  let e;
11672
11690
  switch (i.button) {
11673
11691
  case 0:
@@ -11732,7 +11750,7 @@ function Rd(i) {
11732
11750
  function Md(i) {
11733
11751
  this.enabled !== !1 && this._handleKeyDown(i);
11734
11752
  }
11735
- function Id(i) {
11753
+ function Cd(i) {
11736
11754
  switch (this._trackPointer(i), this._pointers.length) {
11737
11755
  case 1:
11738
11756
  switch (this.touches.ONE) {
@@ -11767,7 +11785,7 @@ function Id(i) {
11767
11785
  }
11768
11786
  this.state !== Te.NONE && this.dispatchEvent(Er);
11769
11787
  }
11770
- function Cd(i) {
11788
+ function Id(i) {
11771
11789
  switch (this._trackPointer(i), this.state) {
11772
11790
  case Te.TOUCH_ROTATE:
11773
11791
  if (this.enableRotate === !1) return;
@@ -12342,12 +12360,12 @@ function tf({
12342
12360
  gizmoControlRef: s
12343
12361
  }) {
12344
12362
  const r = je(null), o = je(null), a = je(new g.Raycaster()).current, c = je(new g.Vector2()).current, h = Mt(() => {
12345
- const b = e.getObjectByName(es), S = Qd(t);
12346
- if (b && S) {
12363
+ const b = e.getObjectByName(es), T = Qd(t);
12364
+ if (b && T) {
12347
12365
  e.remove(b);
12348
12366
  return;
12349
12367
  }
12350
- if (b || S) return;
12368
+ if (b || T) return;
12351
12369
  const x = new $d().create();
12352
12370
  x.rotation.copy(t.rotation), e.add(x);
12353
12371
  }, [e, t]), d = Mt(() => {
@@ -12357,15 +12375,15 @@ function tf({
12357
12375
  Zd((b) => {
12358
12376
  if (!s.current || !i) return;
12359
12377
  _o(b, i, c);
12360
- const S = ma(
12378
+ const T = ma(
12361
12379
  c,
12362
12380
  t,
12363
12381
  e,
12364
12382
  a
12365
- ), x = ga(S);
12383
+ ), x = ga(T);
12366
12384
  x != null && x.userData.gizmoCube ? x.userData.gizmoCube.highlightObject(x) : e.traverse((E) => {
12367
12385
  E.userData.gizmoCube && E.userData.gizmoCube.highlightObject(null);
12368
- }), S.length > 0 ? h() : d();
12386
+ }), T.length > 0 ? h() : d();
12369
12387
  }, 1e3 / Jd),
12370
12388
  [
12371
12389
  s,
@@ -12381,22 +12399,22 @@ function tf({
12381
12399
  r.current = Date.now(), o.current = { x: b.clientX, y: b.clientY };
12382
12400
  }, []), p = Mt(
12383
12401
  (b) => {
12384
- var S;
12385
- const x = b.name === Ys ? 1 : -1, E = 90 * Math.PI / 180, T = new g.Vector3(0, 0, 0), _ = x * E, A = new g.Matrix4();
12386
- A.makeRotationZ(_), t.up.applyMatrix4(A), t.lookAt(T), (S = s.current) == null || S.gizmoControls.update();
12402
+ var T;
12403
+ const x = b.name === Ys ? 1 : -1, E = 90 * Math.PI / 180, S = new g.Vector3(0, 0, 0), _ = x * E, A = new g.Matrix4();
12404
+ A.makeRotationZ(_), t.up.applyMatrix4(A), t.lookAt(S), (T = s.current) == null || T.gizmoControls.update();
12387
12405
  },
12388
12406
  [t, s]
12389
12407
  ), y = Mt(
12390
12408
  (b) => {
12391
12409
  if ((r.current ? Date.now() - r.current : 0) < ef) {
12392
12410
  _o(b, i, c);
12393
- const S = Kd(
12411
+ const T = Kd(
12394
12412
  c,
12395
12413
  t,
12396
12414
  e,
12397
12415
  a
12398
12416
  );
12399
- S != null && S.name && kd.includes(S.name) ? p(S) : Xd(S, n);
12417
+ T != null && T.name && kd.includes(T.name) ? p(T) : Xd(T, n);
12400
12418
  }
12401
12419
  r.current = null, o.current = null;
12402
12420
  },
@@ -12431,27 +12449,27 @@ const nf = ({
12431
12449
  u
12432
12450
  ), p = je(f).current, y = je(null), b = Mt(() => {
12433
12451
  a && (n(), a.render(o, p));
12434
- }, [n, a, o, p]), S = Mt(
12452
+ }, [n, a, o, p]), T = Mt(
12435
12453
  (A) => {
12436
12454
  if (!i || !e) return;
12437
- const P = i.position.length(), C = A.clone().multiplyScalar(P), M = 400, O = new g.Matrix4();
12438
- O.lookAt(C, new g.Vector3(0, 0, 0), new g.Vector3(0, 1, 0));
12439
- const I = new g.Quaternion();
12440
- I.setFromRotationMatrix(O), i.quaternion.copy(I), Td(
12455
+ const P = i.position.length(), I = A.clone().multiplyScalar(P), M = 400, O = new g.Matrix4();
12456
+ O.lookAt(I, new g.Vector3(0, 0, 0), new g.Vector3(0, 1, 0));
12457
+ const C = new g.Quaternion();
12458
+ C.setFromRotationMatrix(O), i.quaternion.copy(C), Td(
12441
12459
  i,
12442
12460
  e,
12443
12461
  i.position.clone(),
12444
- C,
12462
+ I,
12445
12463
  M,
12446
12464
  b
12447
12465
  ), i.up.set(0, 1, 0), i.lookAt(new g.Vector3(0, 0, 0)), e.target.set(0, 0, 0), e.update();
12448
12466
  },
12449
12467
  [i, e, b, o]
12450
- ), { onMouseDown: x, onMouseMove: E, onMouseUp: T, onMouseLeave: _ } = tf({
12468
+ ), { onMouseDown: x, onMouseMove: E, onMouseUp: S, onMouseLeave: _ } = tf({
12451
12469
  gizmoRenderer: a,
12452
12470
  gizmoScene: o,
12453
12471
  gizmoCamera: p,
12454
- alignCameraWithVector: S,
12472
+ alignCameraWithVector: T,
12455
12473
  gizmoControlRef: y
12456
12474
  });
12457
12475
  return rt(() => {
@@ -12463,7 +12481,7 @@ const nf = ({
12463
12481
  gizmoScene: o,
12464
12482
  gizmoRenderer: a,
12465
12483
  gizmoCamera: p
12466
- }, C = {
12484
+ }, I = {
12467
12485
  mainCamera: i,
12468
12486
  mainControls: e,
12469
12487
  renderGizmo: b
@@ -12473,13 +12491,13 @@ const nf = ({
12473
12491
  };
12474
12492
  return y.current = new Wd({
12475
12493
  gizmoParams: P,
12476
- mainParams: C,
12494
+ mainParams: I,
12477
12495
  syncFunctions: M,
12478
12496
  options: s
12479
- }), A.addEventListener("mousedown", x), A.addEventListener("mousemove", E), A.addEventListener("mouseup", T), A.addEventListener("mouseleave", _), () => {
12480
- y.current && (y.current.dispose(), y.current = null), A.removeEventListener("mousedown", x), A.removeEventListener("mousemove", E), A.removeEventListener("mouseup", T), A.removeEventListener("mouseleave", _);
12497
+ }), A.addEventListener("mousedown", x), A.addEventListener("mousemove", E), A.addEventListener("mouseup", S), A.addEventListener("mouseleave", _), () => {
12498
+ y.current && (y.current.dispose(), y.current = null), A.removeEventListener("mousedown", x), A.removeEventListener("mousemove", E), A.removeEventListener("mouseup", S), A.removeEventListener("mouseleave", _);
12481
12499
  };
12482
- }, [i, e, b, E, x, T]), rt(() => {
12500
+ }, [i, e, b, E, x, S]), rt(() => {
12483
12501
  i && (So(p, i, o), b());
12484
12502
  }, [i, b]), /* @__PURE__ */ Se(
12485
12503
  "div",
@@ -12698,17 +12716,17 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), ya =
12698
12716
  n,
12699
12717
  s,
12700
12718
  r
12701
- ), { viewer: y, isInitialized: b, initError: S } = dd(c, p), x = md(y, b, i), E = gd(y);
12702
- yd(y, S, e);
12703
- const T = y ? ns(y.getCamera()) : null, _ = y ? wr(y.getControls()) : null, A = y ? Jo(y.getRenderer()) : null, P = Mt(() => {
12719
+ ), { viewer: y, isInitialized: b, initError: T } = dd(c, p), x = md(y, b, i), E = gd(y);
12720
+ yd(y, T, e);
12721
+ const S = y ? ns(y.getCamera()) : null, _ = y ? wr(y.getControls()) : null, A = y ? Jo(y.getRenderer()) : null, P = Mt(() => {
12704
12722
  y == null || y.requestRender();
12705
- }, [y]), C = ((N = e.helpers) == null ? void 0 : N.gizmo) !== void 0 && e.helpers.gizmo !== !1, M = typeof ((G = e.helpers) == null ? void 0 : G.gizmo) == "object" ? e.helpers.gizmo : {}, O = Nt(
12723
+ }, [y]), I = ((N = e.helpers) == null ? void 0 : N.gizmo) !== void 0 && e.helpers.gizmo !== !1, M = typeof ((G = e.helpers) == null ? void 0 : G.gizmo) == "object" ? e.helpers.gizmo : {}, O = Nt(
12706
12724
  () => df(e.loadingIndicator),
12707
12725
  [e.loadingIndicator]
12708
- ), I = x.status === "error" || !!S, k = O.enabled && (x.status === "loading" || I);
12726
+ ), C = x.status === "error" || !!T, k = O.enabled && (x.status === "loading" || C);
12709
12727
  return Ja(a, () => ({
12710
12728
  scene: y ? St(y.getScene()) : null,
12711
- camera: T,
12729
+ camera: S,
12712
12730
  renderer: A,
12713
12731
  controls: _,
12714
12732
  events: E,
@@ -12777,12 +12795,12 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), ya =
12777
12795
  dispose: () => {
12778
12796
  y == null || y.dispose();
12779
12797
  }
12780
- }), [y, T, A, _, E]), /* @__PURE__ */ Se(of, { children: /* @__PURE__ */ Se(wd, { viewer: y, canvasRef: c, children: /* @__PURE__ */ Zn("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
12798
+ }), [y, S, A, _, E]), /* @__PURE__ */ Se(of, { children: /* @__PURE__ */ Se(wd, { viewer: y, canvasRef: c, children: /* @__PURE__ */ Zn("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
12781
12799
  /* @__PURE__ */ Se(Ed, {}),
12782
- C && b && T && _ && /* @__PURE__ */ Se(
12800
+ I && b && S && _ && /* @__PURE__ */ Se(
12783
12801
  rf,
12784
12802
  {
12785
- camera: T,
12803
+ camera: S,
12786
12804
  controls: _,
12787
12805
  render: P,
12788
12806
  placement: M.placement,
@@ -12792,8 +12810,8 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), ya =
12792
12810
  k && /* @__PURE__ */ Se(
12793
12811
  af,
12794
12812
  {
12795
- status: I ? "error" : "loading",
12796
- label: I ? O.errorLabel ?? (S == null ? void 0 : S.message) ?? x.error ?? "Failed to load model" : O.label,
12813
+ status: C ? "error" : "loading",
12814
+ label: C ? O.errorLabel ?? (T == null ? void 0 : T.message) ?? x.error ?? "Failed to load model" : O.label,
12797
12815
  color: O.color,
12798
12816
  backdrop: O.backdrop
12799
12817
  }
@@ -12837,13 +12855,13 @@ function Sf({ position: i, occlude: e = !1, children: t }) {
12837
12855
  if (!d)
12838
12856
  return;
12839
12857
  const u = { x: r, y: o, z: a }, f = () => {
12840
- const S = d.project(u, e);
12841
- if (S) {
12842
- if (!S.visible) {
12858
+ const T = d.project(u, e);
12859
+ if (T) {
12860
+ if (!T.visible) {
12843
12861
  h.style.visibility = "hidden";
12844
12862
  return;
12845
12863
  }
12846
- h.style.visibility = "visible", h.style.left = `${S.left}px`, h.style.top = `${S.top}px`;
12864
+ h.style.visibility = "visible", h.style.left = `${T.left}px`, h.style.top = `${T.top}px`;
12847
12865
  }
12848
12866
  }, p = () => {
12849
12867
  d.invalidate(), f();
@@ -12855,7 +12873,7 @@ function Sf({ position: i, occlude: e = !1, children: t }) {
12855
12873
  y.on("model:loaded", p)
12856
12874
  ];
12857
12875
  return window.addEventListener("resize", p), () => {
12858
- b.forEach((S) => S()), window.removeEventListener("resize", p);
12876
+ b.forEach((T) => T()), window.removeEventListener("resize", p);
12859
12877
  };
12860
12878
  }, [n, r, o, a, e]);
12861
12879
  const c = t != null && t !== !1;