softbox 4.11.0 → 4.12.0

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 Te, jsxs as Zn } from "react/jsx-runtime";
2
2
  import { useMemo as Nt, useState as An, useEffect as rt, useRef as je, useCallback as Mt, createContext as Za, useContext as Ka, Component as Xa, forwardRef as Eo, useImperativeHandle as Ya } 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 fe, Triangle as Tn, BackSide as To, DoubleSide as So, REVISION as _o, Ray as qi, FrontSide as vi, Mesh as wt, LineSegments as $i, LineLoop as Qi, Line as Ji, Points as er, Sphere as bo, BatchedMesh as qa, TrianglesDrawMode as $a, TriangleFanDrawMode as Ai, TriangleStripDrawMode as xo, Loader as Qa, LoaderUtils as Xn, FileLoader as vo, MeshPhysicalMaterial as It, Color as sn, LinearSRGBColorSpace as Ge, SRGBColorSpace as Jn, SpotLight as Ja, PointLight as Ao, DirectionalLight as ec, Quaternion as Rn, InstancedMesh as Ro, InstancedBufferAttribute as tc, Object3D as tr, TextureLoader as nc, ImageBitmapLoader as sc, InterleavedBuffer as ic, InterleavedBufferAttribute as rc, LinearMipmapLinearFilter as Mo, NearestMipmapLinearFilter as oc, LinearMipmapNearestFilter as ac, NearestMipmapNearestFilter as cc, LinearFilter as rn, NearestFilter as Co, RepeatWrapping as Ri, MirroredRepeatWrapping as lc, ClampToEdgeWrapping as hc, PointsMaterial as uc, Material as ti, LineBasicMaterial as dc, MeshStandardMaterial as js, MeshBasicMaterial as Wn, PropertyBinding as pc, BufferGeometry as fc, SkinnedMesh as mc, Group as ni, PerspectiveCamera as gc, MathUtils as nr, OrthographicCamera as yc, Skeleton as wc, AnimationClip as Ec, Bone as Tc, InterpolateDiscrete as Sc, InterpolateLinear as Io, Texture as Rr, VectorKeyframeTrack as Mr, NumberKeyframeTrack as Cr, QuaternionKeyframeTrack as Ir, ColorManagement as Pr, Interpolant as _c, Controls as Po, MOUSE as Be, TOUCH as Ye, Spherical as Vs, Raycaster as bc, DataTextureLoader as Lo, HalfFloatType as Zt, RGBAFormat as $t, RGFormat as On, DataUtils as Et, RedFormat as ms, FloatType as Yn, Scene as xc, BoxGeometry as vc, MeshLambertMaterial as Ac } from "three";
4
+ import { Box3 as St, Matrix4 as ut, BufferAttribute as Kn, Vector3 as $, Line3 as kt, Plane as ts, Vector2 as fe, Triangle as Tn, BackSide as To, DoubleSide as bo, REVISION as So, Ray as qi, FrontSide as vi, Mesh as wt, LineSegments as $i, LineLoop as Qi, Line as Ji, Points as er, Sphere as _o, BatchedMesh as qa, TrianglesDrawMode as $a, TriangleFanDrawMode as Ai, TriangleStripDrawMode as xo, Loader as Qa, LoaderUtils as Xn, FileLoader as vo, MeshPhysicalMaterial as It, Color as sn, LinearSRGBColorSpace as Ge, SRGBColorSpace as Jn, SpotLight as Ja, PointLight as Ao, DirectionalLight as ec, Quaternion as Rn, InstancedMesh as Ro, InstancedBufferAttribute as tc, Object3D as tr, TextureLoader as nc, ImageBitmapLoader as sc, InterleavedBuffer as ic, InterleavedBufferAttribute as rc, LinearMipmapLinearFilter as Mo, NearestMipmapLinearFilter as oc, LinearMipmapNearestFilter as ac, NearestMipmapNearestFilter as cc, LinearFilter as rn, NearestFilter as Co, RepeatWrapping as Ri, MirroredRepeatWrapping as lc, ClampToEdgeWrapping as hc, PointsMaterial as uc, Material as ti, LineBasicMaterial as dc, MeshStandardMaterial as js, MeshBasicMaterial as Wn, PropertyBinding as pc, BufferGeometry as fc, SkinnedMesh as mc, Group as ni, PerspectiveCamera as gc, MathUtils as nr, OrthographicCamera as yc, Skeleton as wc, AnimationClip as Ec, Bone as Tc, InterpolateDiscrete as bc, InterpolateLinear as Io, Texture as Rr, VectorKeyframeTrack as Mr, NumberKeyframeTrack as Cr, QuaternionKeyframeTrack as Ir, ColorManagement as Pr, Interpolant as Sc, Controls as Po, MOUSE as Be, TOUCH as Ye, Spherical as Vs, Raycaster as _c, DataTextureLoader as Lo, HalfFloatType as Zt, RGBAFormat as $t, RGFormat as On, DataUtils as Et, RedFormat as ms, FloatType as Yn, Scene as xc, BoxGeometry as vc, MeshLambertMaterial as Ac } 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);
@@ -147,11 +147,8 @@ class Mc {
147
147
  }
148
148
  const r = (a = n.environment) == null ? void 0 : a.url, o = (((c = n.helpers) == null ? void 0 : c.studioEnvironment) ?? !1) && (((u = n.helpers) == null ? void 0 : u.darkStudioMode) ?? !1);
149
149
  if (n.backgroundColor && !r && !o) {
150
- const d = String(n.backgroundColor), h = t.createGradientBackground(e, {
151
- topColor: d,
152
- bottomColor: d
153
- });
154
- h.ok || console.warn("Failed to set background:", h.error);
150
+ const d = String(n.backgroundColor), h = n.backgroundColorEdge, p = h !== void 0 ? { topColor: d, bottomColor: String(h), radial: !0 } : { topColor: d, bottomColor: d }, f = t.createGradientBackground(e, p);
151
+ f.ok || console.warn("Failed to set background:", f.error);
155
152
  }
156
153
  }
157
154
  /**
@@ -161,7 +158,7 @@ class Mc {
161
158
  * aborts before touching a disposed renderer/scene.
162
159
  */
163
160
  async configureEnvironment(e, t, n, s, r, o) {
164
- var d, h, p, f, y, b;
161
+ var d, h, p, f, y, _;
165
162
  const a = await t.initialize({ renderer: s, autoDispose: !0 });
166
163
  if (o())
167
164
  return;
@@ -172,17 +169,17 @@ class Mc {
172
169
  environmentIntensity: (p = r.environment) == null ? void 0 : p.environmentIntensity
173
170
  }, u = (f = r.environment) == null ? void 0 : f.url;
174
171
  if (u) {
175
- const S = await t.loadEnvironmentMap(u);
172
+ const b = await t.loadEnvironmentMap(u);
176
173
  if (o())
177
174
  return;
178
- S.ok ? t.applyToScene(e, S.value, c) : console.warn("Failed to load environment map:", S.error);
175
+ b.ok ? t.applyToScene(e, b.value, c) : console.warn("Failed to load environment map:", b.error);
179
176
  } else if ((y = r.helpers) != null && y.studioEnvironment) {
180
- const S = t.createStudioEnvironment();
181
- if (S.ok) {
182
- if (t.applyToScene(e, S.value, {
177
+ const b = t.createStudioEnvironment();
178
+ if (b.ok) {
179
+ if (t.applyToScene(e, b.value, {
183
180
  ...c,
184
181
  setBackground: !1
185
- }), (b = r.helpers) != null && b.darkStudioMode && n) {
182
+ }), (_ = r.helpers) != null && _.darkStudioMode && n) {
186
183
  const v = n.createGradientBackground(e, {
187
184
  topColor: Or,
188
185
  bottomColor: Or
@@ -190,7 +187,7 @@ class Mc {
190
187
  v.ok || console.warn("Failed to set dark studio background:", v.error);
191
188
  }
192
189
  } else
193
- console.warn("Failed to create studio environment:", S.error);
190
+ console.warn("Failed to create studio environment:", b.error);
194
191
  }
195
192
  }
196
193
  }
@@ -1065,10 +1062,10 @@ class kc {
1065
1062
  return this.deps.renderLoopManager.requireContinuous(u), this.deps.reviveRenderLoop(), this.deps.renderLoopManager.requestRender(), new Promise((h) => {
1066
1063
  const p = [];
1067
1064
  let f = null, y = !1;
1068
- const b = (v) => {
1069
- y || (y = !0, this.pendingSettlers.delete(S), c(), f !== null && clearTimeout(f), this.deps.renderLoopManager.releaseContinuous(u), s.getTracks().forEach((E) => E.stop()), h(v));
1070
- }, S = () => {
1071
- b(
1065
+ const _ = (v) => {
1066
+ y || (y = !0, this.pendingSettlers.delete(b), c(), f !== null && clearTimeout(f), this.deps.renderLoopManager.releaseContinuous(u), s.getTracks().forEach((E) => E.stop()), h(v));
1067
+ }, b = () => {
1068
+ _(
1072
1069
  D.err(
1073
1070
  new W("Viewer was disposed during video capture", Z.INVALID_STATE)
1074
1071
  )
@@ -1078,12 +1075,12 @@ class kc {
1078
1075
  } catch {
1079
1076
  }
1080
1077
  };
1081
- this.pendingSettlers.add(S), r.ondataavailable = (v) => {
1078
+ this.pendingSettlers.add(b), r.ondataavailable = (v) => {
1082
1079
  v.data.size > 0 && p.push(v.data);
1083
1080
  }, r.onstop = () => {
1084
- b(D.ok(new Blob(p, { type: r.mimeType || "video/webm" })));
1081
+ _(D.ok(new Blob(p, { type: r.mimeType || "video/webm" })));
1085
1082
  }, r.onerror = () => {
1086
- b(
1083
+ _(
1087
1084
  D.err(
1088
1085
  new W("Video recording failed", Z.OPERATION_FAILED)
1089
1086
  )
@@ -1163,8 +1160,8 @@ class kc {
1163
1160
  )
1164
1161
  );
1165
1162
  t.setPixelRatio(1), t.setSize(p, f), Mi(s, p / f);
1166
- const b = t.renderPostProcessed ? t.renderPostProcessed(n, s) : t.render(n, s), S = b.ok ? this.readCanvasPng() : D.err(b.error);
1167
- return t.setSize(u, d), t.setPixelRatio(a), Mi(s, h), t.render(n, s), r.requestRender(), S;
1163
+ const _ = t.renderPostProcessed ? t.renderPostProcessed(n, s) : t.render(n, s), b = _.ok ? this.readCanvasPng() : D.err(_.error);
1164
+ return t.setSize(u, d), t.setPixelRatio(a), Mi(s, h), t.render(n, s), r.requestRender(), b;
1168
1165
  }
1169
1166
  readCanvasPng() {
1170
1167
  const e = No(this.deps.renderer.getDomElement());
@@ -1376,38 +1373,42 @@ class Fc {
1376
1373
  * helpers — take effect at construction time and require a rebuild.
1377
1374
  */
1378
1375
  updateOptions(e) {
1379
- var f, y, b, S, v, E, T, _, x, P, I;
1376
+ var y, _, b, v, E, T, S, x, P, I, M;
1380
1377
  if (this.disposed)
1381
1378
  return;
1382
- const t = (f = this.options.animations) == null ? void 0 : f.autoplay, n = (y = this.options.controls) == null ? void 0 : y.autoRotate, s = ((b = this.options.pathTracing) == null ? void 0 : b.enabled) ?? !1;
1383
- this.options = xn(this.options, e);
1379
+ const t = (y = this.options.animations) == null ? void 0 : y.autoplay, n = (_ = this.options.controls) == null ? void 0 : _.autoRotate, s = ((b = this.options.pathTracing) == null ? void 0 : b.enabled) ?? !1;
1380
+ this.options = xn(this.options, e), "backgroundColorEdge" in e && (this.options.backgroundColorEdge = e.backgroundColorEdge);
1384
1381
  let r = !1;
1385
- e.backgroundColor !== void 0 && this.applyBackgroundColor(e.backgroundColor);
1386
- const o = (S = e.renderer) == null ? void 0 : S.toneMappingExposure;
1387
- o !== void 0 && (this.renderer.setToneMappingExposure(o), r = !0);
1388
- const a = (v = e.environment) == null ? void 0 : v.environmentIntensity;
1389
- a !== void 0 && (this.scene.setEnvironmentIntensity(a), r = !0);
1390
- const c = (E = e.controls) == null ? void 0 : E.autoRotate;
1391
- c !== void 0 && c !== n && (this.controls.autoRotate = c, c ? (this.renderLoopManager.requireContinuous("turntable"), this.capture.notifyTurntableEnabled()) : this.renderLoopManager.releaseContinuous("turntable"), r = !0);
1392
- const u = (T = e.controls) == null ? void 0 : T.autoRotateSpeed;
1393
- u !== void 0 && (this.controls.autoRotateSpeed = u, r = !0);
1394
- const d = (_ = e.animations) == null ? void 0 : _.autoplay;
1395
- d !== void 0 && d !== t && (d ? this.modelManager.getCurrentModel() && this.autoplayFromOptions(d) : this.pauseAnimations(), r = !0);
1396
- const h = (x = e.animations) == null ? void 0 : x.speed;
1397
- h !== void 0 && ((P = this.animationService) == null || P.setSpeed(h), r = !0);
1398
- const p = (I = e.pathTracing) == null ? void 0 : I.enabled;
1399
- p !== void 0 && p !== s && (this.setPathTracingEnabled(p), r = !0), r && (this.reviveRenderLoop(), this.renderLoopManager.requestRender());
1382
+ (e.backgroundColor !== void 0 || e.backgroundColorEdge !== void 0) && this.options.backgroundColor !== void 0 && this.applyBackgroundColor(this.options.backgroundColor);
1383
+ const a = (v = e.renderer) == null ? void 0 : v.toneMappingExposure;
1384
+ a !== void 0 && (this.renderer.setToneMappingExposure(a), r = !0);
1385
+ const c = (E = e.environment) == null ? void 0 : E.environmentIntensity;
1386
+ c !== void 0 && (this.scene.setEnvironmentIntensity(c), r = !0);
1387
+ const u = (T = e.controls) == null ? void 0 : T.autoRotate;
1388
+ u !== void 0 && u !== n && (this.controls.autoRotate = u, u ? (this.renderLoopManager.requireContinuous("turntable"), this.capture.notifyTurntableEnabled()) : this.renderLoopManager.releaseContinuous("turntable"), r = !0);
1389
+ const d = (S = e.controls) == null ? void 0 : S.autoRotateSpeed;
1390
+ d !== void 0 && (this.controls.autoRotateSpeed = d, r = !0);
1391
+ const h = (x = e.animations) == null ? void 0 : x.autoplay;
1392
+ h !== void 0 && h !== t && (h ? this.modelManager.getCurrentModel() && this.autoplayFromOptions(h) : this.pauseAnimations(), r = !0);
1393
+ const p = (P = e.animations) == null ? void 0 : P.speed;
1394
+ p !== void 0 && ((I = this.animationService) == null || I.setSpeed(p), r = !0);
1395
+ const f = (M = e.pathTracing) == null ? void 0 : M.enabled;
1396
+ f !== void 0 && f !== s && (this.setPathTracingEnabled(f), r = !0), r && (this.reviveRenderLoop(), this.renderLoopManager.requestRender());
1397
+ }
1398
+ // A flat fill, or a radial studio vignette when a `backgroundColorEdge` is set
1399
+ // (base behind the subject → edge in the corners). Single source of truth so
1400
+ // every backdrop repaint — preset switch, environment reset, solid override —
1401
+ // agrees on flat-vs-radial.
1402
+ backgroundGradient(e, t) {
1403
+ return t !== void 0 ? { topColor: String(e), bottomColor: String(t), radial: !0 } : { topColor: String(e), bottomColor: String(e) };
1400
1404
  }
1401
1405
  applyBackgroundColor(e) {
1402
- var n;
1403
- if ((n = this.options.environment) != null && n.url || !this.sceneSetupService)
1406
+ var s;
1407
+ if ((s = this.options.environment) != null && s.url || !this.sceneSetupService)
1404
1408
  return;
1405
- const t = this.sceneSetupService.createGradientBackground(this.scene, {
1406
- topColor: String(e),
1407
- bottomColor: String(e)
1408
- });
1409
- if (!t.ok) {
1410
- console.warn("Failed to update background color:", t.error);
1409
+ const t = this.backgroundGradient(e, this.options.backgroundColorEdge), n = this.sceneSetupService.createGradientBackground(this.scene, t);
1410
+ if (!n.ok) {
1411
+ console.warn("Failed to update background color:", n.error);
1411
1412
  return;
1412
1413
  }
1413
1414
  this.renderLoopManager.requestRender();
@@ -1477,18 +1478,18 @@ class Fc {
1477
1478
  return D.err(
1478
1479
  new W("Scene setup service unavailable", Z.INVALID_STATE)
1479
1480
  );
1480
- const t = this.sceneSetupService.createGradientBackground(this.scene, {
1481
- topColor: String(e),
1482
- bottomColor: String(e)
1483
- });
1484
- return t.ok ? (this.options = xn(this.options, { backgroundColor: e }), this.repaintAfterEnvironmentChange(), D.ok(void 0)) : t;
1481
+ const t = this.sceneSetupService.createGradientBackground(
1482
+ this.scene,
1483
+ this.backgroundGradient(e, void 0)
1484
+ );
1485
+ return t.ok ? (this.options = xn(this.options, { backgroundColor: e }), this.options.backgroundColorEdge = void 0, this.repaintAfterEnvironmentChange(), D.ok(void 0)) : t;
1485
1486
  }
1486
1487
  restoreBackgroundColor() {
1487
1488
  const e = this.options.backgroundColor;
1488
- e === void 0 || !this.sceneSetupService || this.sceneSetupService.createGradientBackground(this.scene, {
1489
- topColor: String(e),
1490
- bottomColor: String(e)
1491
- });
1489
+ e === void 0 || !this.sceneSetupService || this.sceneSetupService.createGradientBackground(
1490
+ this.scene,
1491
+ this.backgroundGradient(e, this.options.backgroundColorEdge)
1492
+ );
1492
1493
  }
1493
1494
  repaintAfterEnvironmentChange() {
1494
1495
  this.pathTracing.resetAccumulation(!0), this.reviveRenderLoop(), this.renderLoopManager.requestRender();
@@ -1789,17 +1790,17 @@ function ip(i) {
1789
1790
  return i;
1790
1791
  }
1791
1792
  function ri(i, e, t, n, s) {
1792
- let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0, h = 1 / 0, p = 1 / 0, f = 1 / 0, y = -1 / 0, b = -1 / 0, S = -1 / 0;
1793
+ let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0, h = 1 / 0, p = 1 / 0, f = 1 / 0, y = -1 / 0, _ = -1 / 0, b = -1 / 0;
1793
1794
  const v = i.offset || 0;
1794
1795
  for (let E = (e - v) * 6, T = (e + t - v) * 6; E < T; E += 6) {
1795
- const _ = i[E + 0], x = i[E + 1], P = _ - x, I = _ + x;
1796
- P < r && (r = P), I > c && (c = I), _ < h && (h = _), _ > y && (y = _);
1796
+ const S = i[E + 0], x = i[E + 1], P = S - x, I = S + x;
1797
+ P < r && (r = P), I > c && (c = I), S < h && (h = S), S > y && (y = S);
1797
1798
  const M = i[E + 2], O = i[E + 3], C = M - O, k = M + O;
1798
- C < o && (o = C), k > u && (u = k), M < p && (p = M), M > b && (b = M);
1799
+ C < o && (o = C), k > u && (u = k), M < p && (p = M), M > _ && (_ = M);
1799
1800
  const N = i[E + 4], G = i[E + 5], z = N - G, X = N + G;
1800
- z < a && (a = z), X > d && (d = X), N < f && (f = N), N > S && (S = N);
1801
+ z < a && (a = z), X > d && (d = X), N < f && (f = N), N > b && (b = N);
1801
1802
  }
1802
- n[0] = r, n[1] = o, n[2] = a, n[3] = c, n[4] = u, n[5] = d, s[0] = h, s[1] = p, s[2] = f, s[3] = y, s[4] = b, s[5] = S;
1803
+ n[0] = r, n[1] = o, n[2] = a, n[3] = c, n[4] = u, n[5] = d, s[0] = h, s[1] = p, s[2] = f, s[3] = y, s[4] = _, s[5] = b;
1803
1804
  }
1804
1805
  const Ot = 32, Uc = (i, e) => i.candidate - e.candidate, Ut = /* @__PURE__ */ new Array(Ot).fill().map(() => ({
1805
1806
  count: 0,
@@ -1837,20 +1838,20 @@ function Hc(i, e, t, n, s, r) {
1837
1838
  ys(x, t, I);
1838
1839
  }
1839
1840
  E.sort(Uc);
1840
- let _ = s;
1841
- for (let x = 0; x < _; x++) {
1841
+ let S = s;
1842
+ for (let x = 0; x < S; x++) {
1842
1843
  const P = E[x];
1843
- for (; x + 1 < _ && E[x + 1].candidate === P.candidate; )
1844
- E.splice(x + 1, 1), _--;
1844
+ for (; x + 1 < S && E[x + 1].candidate === P.candidate; )
1845
+ E.splice(x + 1, 1), S--;
1845
1846
  }
1846
1847
  for (let x = h; x < p; x += 6) {
1847
1848
  const P = t[x + 2 * f];
1848
- for (let I = 0; I < _; I++) {
1849
+ for (let I = 0; I < S; I++) {
1849
1850
  const M = E[I];
1850
1851
  P >= M.candidate ? ys(x, t, M.rightCacheBounds) : (ys(x, t, M.leftCacheBounds), M.count++);
1851
1852
  }
1852
1853
  }
1853
- for (let x = 0; x < _; x++) {
1854
+ for (let x = 0; x < S; x++) {
1854
1855
  const P = E[x], I = P.count, M = s - P.count, O = P.leftCacheBounds, C = P.rightCacheBounds;
1855
1856
  let k = 0;
1856
1857
  I !== 0 && (k = Dn(O) / c);
@@ -1860,28 +1861,28 @@ function Hc(i, e, t, n, s, r) {
1860
1861
  G < u && (o = f, u = G, a = P.candidate);
1861
1862
  }
1862
1863
  } else {
1863
- for (let _ = 0; _ < Ot; _++) {
1864
- const x = Ut[_];
1865
- x.count = 0, x.candidate = y + v + _ * v;
1864
+ for (let S = 0; S < Ot; S++) {
1865
+ const x = Ut[S];
1866
+ x.count = 0, x.candidate = y + v + S * v;
1866
1867
  const P = x.bounds;
1867
1868
  for (let I = 0; I < 3; I++)
1868
1869
  P[I] = 1 / 0, P[I + 3] = -1 / 0;
1869
1870
  }
1870
- for (let _ = h; _ < p; _ += 6) {
1871
- let I = ~~((t[_ + 2 * f] - y) / v);
1871
+ for (let S = h; S < p; S += 6) {
1872
+ let I = ~~((t[S + 2 * f] - y) / v);
1872
1873
  I >= Ot && (I = Ot - 1);
1873
1874
  const M = Ut[I];
1874
- M.count++, ys(_, t, M.bounds);
1875
+ M.count++, ys(S, t, M.bounds);
1875
1876
  }
1876
1877
  const E = Ut[Ot - 1];
1877
1878
  Fr(E.bounds, E.rightCacheBounds);
1878
- for (let _ = Ot - 2; _ >= 0; _--) {
1879
- const x = Ut[_], P = Ut[_ + 1];
1879
+ for (let S = Ot - 2; S >= 0; S--) {
1880
+ const x = Ut[S], P = Ut[S + 1];
1880
1881
  zr(x.bounds, P.rightCacheBounds, x.rightCacheBounds);
1881
1882
  }
1882
1883
  let T = 0;
1883
- for (let _ = 0; _ < Ot - 1; _++) {
1884
- const x = Ut[_], P = x.count, I = x.bounds, O = Ut[_ + 1].rightCacheBounds;
1884
+ for (let S = 0; S < Ot - 1; S++) {
1885
+ const x = Ut[S], P = x.count, I = x.bounds, O = Ut[S + 1].rightCacheBounds;
1885
1886
  P !== 0 && (T === 0 ? Fr(I, ws) : zr(I, ws, ws)), T += P;
1886
1887
  let C = 0, k = 0;
1887
1888
  T !== 0 && (C = Dn(ws) / c);
@@ -1962,25 +1963,25 @@ function Zc(i, e, t, n, s, r) {
1962
1963
  onProgress: d
1963
1964
  } = s, h = i.primitiveBuffer, p = i.primitiveBufferStride, f = new Float32Array(6);
1964
1965
  let y = !1;
1965
- const b = new oi();
1966
- return ri(e, t, n, b.boundingData, f), v(b, t, n, f), b;
1967
- function S(E) {
1966
+ const _ = new oi();
1967
+ return ri(e, t, n, _.boundingData, f), v(_, t, n, f), _;
1968
+ function b(E) {
1968
1969
  d && d((E - r.offset) / r.count);
1969
1970
  }
1970
- function v(E, T, _, x = null, P = 0) {
1971
- if (!y && P >= o && (y = !0, a && console.warn(`BVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`)), _ <= c || P >= o)
1972
- return S(T + _), E.offset = T, E.count = _, E;
1973
- const I = Hc(E.boundingData, x, e, T, _, u);
1971
+ function v(E, T, S, x = null, P = 0) {
1972
+ if (!y && P >= o && (y = !0, a && console.warn(`BVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`)), S <= c || P >= o)
1973
+ return b(T + S), E.offset = T, E.count = S, E;
1974
+ const I = Hc(E.boundingData, x, e, T, S, u);
1974
1975
  if (I.axis === -1)
1975
- return S(T + _), E.offset = T, E.count = _, E;
1976
- const M = jc(h, p, e, T, _, I);
1977
- if (M === T || M === T + _)
1978
- S(T + _), E.offset = T, E.count = _;
1976
+ return b(T + S), E.offset = T, E.count = S, E;
1977
+ const M = jc(h, p, e, T, S, I);
1978
+ if (M === T || M === T + S)
1979
+ b(T + S), E.offset = T, E.count = S;
1979
1980
  else {
1980
1981
  E.splitAxis = I.axis;
1981
1982
  const O = new oi(), C = T, k = M - T;
1982
1983
  E.left = O, ri(e, C, k, O.boundingData, f), v(O, C, k, f, P + 1);
1983
- const N = new oi(), G = M, z = _ - k;
1984
+ const N = new oi(), G = M, z = S - k;
1984
1985
  E.right = N, ri(e, G, z, N.boundingData, f), v(N, G, z, f, P + 1);
1985
1986
  }
1986
1987
  return E;
@@ -2020,45 +2021,45 @@ class Xc {
2020
2021
  };
2021
2022
  }
2022
2023
  }
2023
- const be = /* @__PURE__ */ new Xc();
2024
- let Kt, _n;
2025
- const hn = [], Es = /* @__PURE__ */ new ar(() => new _t());
2024
+ const _e = /* @__PURE__ */ new Xc();
2025
+ let Kt, Sn;
2026
+ const hn = [], Es = /* @__PURE__ */ new ar(() => new St());
2026
2027
  function Yc(i, e, t, n, s, r) {
2027
- Kt = Es.getPrimitive(), _n = Es.getPrimitive(), hn.push(Kt, _n), be.setBuffer(i._roots[e]);
2028
+ Kt = Es.getPrimitive(), Sn = Es.getPrimitive(), hn.push(Kt, Sn), _e.setBuffer(i._roots[e]);
2028
2029
  const o = Li(0, i.geometry, t, n, s, r);
2029
- be.clearBuffer(), Es.releasePrimitive(Kt), Es.releasePrimitive(_n), hn.pop(), hn.pop();
2030
+ _e.clearBuffer(), Es.releasePrimitive(Kt), Es.releasePrimitive(Sn), hn.pop(), hn.pop();
2030
2031
  const a = hn.length;
2031
- return a > 0 && (_n = hn[a - 1], Kt = hn[a - 2]), o;
2032
+ return a > 0 && (Sn = hn[a - 1], Kt = hn[a - 2]), o;
2032
2033
  }
2033
2034
  function Li(i, e, t, n, s = null, r = 0, o = 0) {
2034
- const { float32Array: a, uint16Array: c, uint32Array: u } = be;
2035
+ const { float32Array: a, uint16Array: c, uint32Array: u } = _e;
2035
2036
  let d = i * 2;
2036
2037
  if (De(d, c)) {
2037
2038
  const p = $e(i, u), f = Qe(d, c);
2038
2039
  return ve(i, a, Kt), n(p, f, !1, o, r + i / Oe, Kt);
2039
2040
  } else {
2040
2041
  let C = function(N) {
2041
- const { uint16Array: G, uint32Array: z } = be;
2042
+ const { uint16Array: G, uint32Array: z } = _e;
2042
2043
  let X = N * 2;
2043
2044
  for (; !De(X, G); )
2044
2045
  N = Fe(N), X = N * 2;
2045
2046
  return $e(N, z);
2046
2047
  }, k = function(N) {
2047
- const { uint16Array: G, uint32Array: z } = be;
2048
+ const { uint16Array: G, uint32Array: z } = _e;
2048
2049
  let X = N * 2;
2049
2050
  for (; !De(X, G); )
2050
2051
  N = ze(N, z), X = N * 2;
2051
2052
  return $e(N, z) + Qe(X, G);
2052
2053
  };
2053
2054
  const p = Fe(i), f = ze(i, u);
2054
- let y = p, b = f, S, v, E, T;
2055
- if (s && (E = Kt, T = _n, ve(y, a, E), ve(b, a, T), S = s(E), v = s(T), v < S)) {
2056
- y = f, b = p;
2057
- const N = S;
2058
- S = v, v = N, E = T;
2055
+ let y = p, _ = f, b, v, E, T;
2056
+ if (s && (E = Kt, T = Sn, ve(y, a, E), ve(_, a, T), b = s(E), v = s(T), v < b)) {
2057
+ y = f, _ = p;
2058
+ const N = b;
2059
+ b = v, v = N, E = T;
2059
2060
  }
2060
2061
  E || (E = Kt, ve(y, a, E));
2061
- const _ = De(y * 2, c), x = t(E, _, S, o + 1, r + y / Oe);
2062
+ const S = De(y * 2, c), x = t(E, S, b, o + 1, r + y / Oe);
2062
2063
  let P;
2063
2064
  if (x === Dr) {
2064
2065
  const N = C(y), z = k(y) - N;
@@ -2074,15 +2075,15 @@ function Li(i, e, t, n, s = null, r = 0, o = 0) {
2074
2075
  o + 1
2075
2076
  );
2076
2077
  if (P) return !0;
2077
- T = _n, ve(b, a, T);
2078
- const I = De(b * 2, c), M = t(T, I, v, o + 1, r + b / Oe);
2078
+ T = Sn, ve(_, a, T);
2079
+ const I = De(_ * 2, c), M = t(T, I, v, o + 1, r + _ / Oe);
2079
2080
  let O;
2080
2081
  if (M === Dr) {
2081
- const N = C(b), z = k(b) - N;
2082
- O = n(N, z, !0, o + 1, r + b / Oe, T);
2082
+ const N = C(_), z = k(_) - N;
2083
+ O = n(N, z, !0, o + 1, r + _ / Oe, T);
2083
2084
  } else
2084
2085
  O = M && Li(
2085
- b,
2086
+ _,
2086
2087
  e,
2087
2088
  t,
2088
2089
  n,
@@ -2093,7 +2094,7 @@ function Li(i, e, t, n, s = null, r = 0, o = 0) {
2093
2094
  return !!O;
2094
2095
  }
2095
2096
  }
2096
- const qn = /* @__PURE__ */ new be.constructor(), Ws = /* @__PURE__ */ new be.constructor(), Vt = /* @__PURE__ */ new ar(() => new _t()), un = /* @__PURE__ */ new _t(), dn = /* @__PURE__ */ new _t(), ai = /* @__PURE__ */ new _t(), ci = /* @__PURE__ */ new _t();
2097
+ const qn = /* @__PURE__ */ new _e.constructor(), Ws = /* @__PURE__ */ new _e.constructor(), Vt = /* @__PURE__ */ new ar(() => new St()), un = /* @__PURE__ */ new St(), dn = /* @__PURE__ */ new St(), ai = /* @__PURE__ */ new St(), ci = /* @__PURE__ */ new St();
2097
2098
  let li = !1;
2098
2099
  function qc(i, e, t, n) {
2099
2100
  if (li)
@@ -2127,21 +2128,21 @@ function qc(i, e, t, n) {
2127
2128
  function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, u = null, d = !1) {
2128
2129
  let h, p;
2129
2130
  d ? (h = Ws, p = qn) : (h = qn, p = Ws);
2130
- const f = h.float32Array, y = h.uint32Array, b = h.uint16Array, S = p.float32Array, v = p.uint32Array, E = p.uint16Array, T = i * 2, _ = e * 2, x = De(T, b), P = De(_, E);
2131
+ const f = h.float32Array, y = h.uint32Array, _ = h.uint16Array, b = p.float32Array, v = p.uint32Array, E = p.uint16Array, T = i * 2, S = e * 2, x = De(T, _), P = De(S, E);
2131
2132
  let I = !1;
2132
2133
  if (P && x)
2133
2134
  d ? I = s(
2134
2135
  $e(e, v),
2135
2136
  Qe(e * 2, E),
2136
2137
  $e(i, y),
2137
- Qe(i * 2, b),
2138
+ Qe(i * 2, _),
2138
2139
  c,
2139
2140
  o + e / Oe,
2140
2141
  a,
2141
2142
  r + i / Oe
2142
2143
  ) : I = s(
2143
2144
  $e(i, y),
2144
- Qe(i * 2, b),
2145
+ Qe(i * 2, _),
2145
2146
  $e(e, v),
2146
2147
  Qe(e * 2, E),
2147
2148
  a,
@@ -2151,7 +2152,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, u = null, d = !1) {
2151
2152
  );
2152
2153
  else if (P) {
2153
2154
  const M = Vt.getPrimitive();
2154
- ve(e, S, M), M.applyMatrix4(t);
2155
+ ve(e, b, M), M.applyMatrix4(t);
2155
2156
  const O = Fe(i), C = ze(i, y);
2156
2157
  ve(O, f, un), ve(C, f, dn);
2157
2158
  const k = M.intersectsBox(un), N = M.intersectsBox(dn);
@@ -2182,7 +2183,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, u = null, d = !1) {
2182
2183
  ), Vt.releasePrimitive(M);
2183
2184
  } else {
2184
2185
  const M = Fe(e), O = ze(e, v);
2185
- ve(M, S, ai), ve(O, S, ci);
2186
+ ve(M, b, ai), ve(O, b, ci);
2186
2187
  const C = u.intersectsBox(ai), k = u.intersectsBox(ci);
2187
2188
  if (C && k)
2188
2189
  I = gt(
@@ -2307,7 +2308,7 @@ function gt(i, e, t, n, s, r = 0, o = 0, a = 0, c = 0, u = null, d = !1) {
2307
2308
  }
2308
2309
  return I;
2309
2310
  }
2310
- const Br = /* @__PURE__ */ new _t(), pn = /* @__PURE__ */ new Float32Array(6);
2311
+ const Br = /* @__PURE__ */ new St(), pn = /* @__PURE__ */ new Float32Array(6);
2311
2312
  class $c {
2312
2313
  constructor() {
2313
2314
  this._roots = null, this.primitiveBuffer = null, this.primitiveBufferStride = null;
@@ -2332,8 +2333,8 @@ class $c {
2332
2333
  let r = 1 / 0, o = 1 / 0, a = 1 / 0, c = -1 / 0, u = -1 / 0, d = -1 / 0;
2333
2334
  for (let h = e, p = e + t; h < p; h++) {
2334
2335
  this.writePrimitiveBounds(h, pn, 0);
2335
- const [f, y, b, S, v, E] = pn;
2336
- f < r && (r = f), S > c && (c = S), y < o && (o = y), v > u && (u = v), b < a && (a = b), E > d && (d = E);
2336
+ const [f, y, _, b, v, E] = pn;
2337
+ f < r && (r = f), b > c && (c = b), y < o && (o = y), v > u && (u = v), _ < a && (a = _), E > d && (d = E);
2337
2338
  }
2338
2339
  return n[s + 0] = r, n[s + 1] = o, n[s + 2] = a, n[s + 3] = c, n[s + 4] = u, n[s + 5] = d, n;
2339
2340
  }
@@ -2341,8 +2342,8 @@ class $c {
2341
2342
  const s = n.offset || 0;
2342
2343
  for (let r = e, o = e + t; r < o; r++) {
2343
2344
  this.writePrimitiveBounds(r, pn, 0);
2344
- const [a, c, u, d, h, p] = pn, f = (a + d) / 2, y = (c + h) / 2, b = (u + p) / 2, S = (d - a) / 2, v = (h - c) / 2, E = (p - u) / 2, T = (r - s) * 6;
2345
- n[T + 0] = f, n[T + 1] = S + (Math.abs(f) + S) * Us, n[T + 2] = y, n[T + 3] = v + (Math.abs(y) + v) * Us, n[T + 4] = b, n[T + 5] = E + (Math.abs(b) + E) * Us;
2345
+ const [a, c, u, d, h, p] = pn, f = (a + d) / 2, y = (c + h) / 2, _ = (u + p) / 2, b = (d - a) / 2, v = (h - c) / 2, E = (p - u) / 2, T = (r - s) * 6;
2346
+ n[T + 0] = f, n[T + 1] = b + (Math.abs(f) + b) * Us, n[T + 2] = y, n[T + 3] = v + (Math.abs(y) + v) * Us, n[T + 4] = _, n[T + 5] = E + (Math.abs(_) + E) * Us;
2346
2347
  }
2347
2348
  return n;
2348
2349
  }
@@ -2406,9 +2407,9 @@ class $c {
2406
2407
  this.writePrimitiveRangeBounds(f, y, pn, 0), a.set(pn, d);
2407
2408
  } else {
2408
2409
  const f = Fe(d), y = ze(d, r);
2409
- for (let b = 0; b < 3; b++) {
2410
- const S = a[f + b], v = a[f + b + 3], E = a[y + b], T = a[y + b + 3];
2411
- a[d + b] = S < E ? S : E, a[d + b + 3] = v > T ? v : T;
2410
+ for (let _ = 0; _ < 3; _++) {
2411
+ const b = a[f + _], v = a[f + _ + 3], E = a[y + _], T = a[y + _ + 3];
2412
+ a[d + _] = b < E ? b : E, a[d + _ + 3] = v > T ? v : T;
2412
2413
  }
2413
2414
  }
2414
2415
  }
@@ -2450,7 +2451,7 @@ class $c {
2450
2451
  } = e;
2451
2452
  if (s && r) {
2452
2453
  const h = s;
2453
- s = (p, f, y, b, S) => h(p, f, y, b, S) ? !0 : a(p, f, this, r, y, b, o);
2454
+ s = (p, f, y, _, b) => h(p, f, y, _, b) ? !0 : a(p, f, this, r, y, _, o);
2454
2455
  } else s || (r ? s = (h, p, f, y) => a(h, p, this, r, f, y, o) : s = (h, p, f) => f);
2455
2456
  let c = !1, u = 0;
2456
2457
  const d = this._roots;
@@ -2517,8 +2518,8 @@ function Ur(i, e, t) {
2517
2518
  return [n];
2518
2519
  const r = [], o = n.offset, a = n.offset + n.count, c = cr(i) / t, u = [];
2519
2520
  for (const p of s) {
2520
- const { offset: f, count: y } = p, b = f, S = isFinite(y) ? y : c - f, v = f + S;
2521
- b < a && v > o && (u.push({ pos: Math.max(o, b), isStart: !0 }), u.push({ pos: Math.min(a, v), isStart: !1 }));
2521
+ const { offset: f, count: y } = p, _ = f, b = isFinite(y) ? y : c - f, v = f + b;
2522
+ _ < a && v > o && (u.push({ pos: Math.max(o, _), isStart: !0 }), u.push({ pos: Math.min(a, v), isStart: !1 }));
2522
2523
  }
2523
2524
  u.sort((p, f) => p.pos !== f.pos ? p.pos - f.pos : p.type === "end" ? -1 : 1);
2524
2525
  let d = 0, h = null;
@@ -2583,7 +2584,7 @@ class il extends $c {
2583
2584
  this._indirectBuffer = r;
2584
2585
  } else
2585
2586
  el(t, e);
2586
- super.init(e), !t.boundingBox && e.setBoundingBox && (t.boundingBox = this.getBoundingBox(new _t()));
2587
+ super.init(e), !t.boundingBox && e.setBoundingBox && (t.boundingBox = this.getBoundingBox(new St()));
2587
2588
  }
2588
2589
  // Abstract methods to be implemented by subclasses
2589
2590
  getRootRanges(e) {
@@ -2637,9 +2638,9 @@ const rl = /* @__PURE__ */ (function() {
2637
2638
  return function(s, r, o) {
2638
2639
  const a = s.start, c = i, u = r.start, d = e;
2639
2640
  t.subVectors(a, u), i.subVectors(s.end, s.start), e.subVectors(r.end, r.start);
2640
- const h = t.dot(d), p = d.dot(c), f = d.dot(d), y = t.dot(c), S = c.dot(c) * f - p * p;
2641
+ const h = t.dot(d), p = d.dot(c), f = d.dot(d), y = t.dot(c), b = c.dot(c) * f - p * p;
2641
2642
  let v, E;
2642
- S !== 0 ? v = (h * p - y * f) / S : v = 0, E = (h + v * p) / f, o.x = v, o.y = E;
2643
+ b !== 0 ? v = (h * p - y * f) / b : v = 0, E = (h + v * p) / f, o.x = v, o.y = E;
2643
2644
  };
2644
2645
  })(), lr = /* @__PURE__ */ (function() {
2645
2646
  const i = /* @__PURE__ */ new fe(), e = /* @__PURE__ */ new $(), t = /* @__PURE__ */ new $();
@@ -2675,9 +2676,9 @@ const rl = /* @__PURE__ */ (function() {
2675
2676
  return function(r, o) {
2676
2677
  const { radius: a, center: c } = r, { a: u, b: d, c: h } = o;
2677
2678
  if (n.start = u, n.end = d, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a || (n.start = u, n.end = h, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a) || (n.start = d, n.end = h, n.closestPointToPoint(c, !0, i).distanceTo(c) <= a)) return !0;
2678
- const b = o.getPlane(t);
2679
- if (Math.abs(b.distanceToPoint(c)) <= a) {
2680
- const v = b.projectPoint(c, e);
2679
+ const _ = o.getPlane(t);
2680
+ if (Math.abs(_.distanceToPoint(c)) <= a) {
2681
+ const v = _.projectPoint(c, e);
2681
2682
  if (o.containsPoint(v)) return !0;
2682
2683
  }
2683
2684
  return !1;
@@ -2707,8 +2708,8 @@ class Tt extends Tn {
2707
2708
  h.subVectors(t, n), p.setFromPoints(h, s);
2708
2709
  const f = r[3], y = o[3];
2709
2710
  f.subVectors(n, e), y.setFromPoints(f, s);
2710
- const b = u.length(), S = h.length(), v = f.length();
2711
- this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, b < Dt ? S < Dt || v < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : S < Dt ? v < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : v < Dt && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(a, e), this.needsUpdate = !1;
2711
+ const _ = u.length(), b = h.length(), v = f.length();
2712
+ this.isDegenerateIntoPoint = !1, this.isDegenerateIntoSegment = !1, _ < Dt ? b < Dt || v < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(e), this.degenerateSegment.end.copy(n)) : b < Dt ? v < Dt ? this.isDegenerateIntoPoint = !0 : (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(t), this.degenerateSegment.end.copy(e)) : v < Dt && (this.isDegenerateIntoSegment = !0, this.degenerateSegment.start.copy(n), this.degenerateSegment.end.copy(t)), this.plane.setFromNormalAndCoplanarPoint(a, e), this.needsUpdate = !1;
2712
2713
  }
2713
2714
  }
2714
2715
  Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
@@ -2725,56 +2726,56 @@ Tt.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
2725
2726
  })();
2726
2727
  Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2727
2728
  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(), u = /* @__PURE__ */ new $(), d = /* @__PURE__ */ new fe(), h = /* @__PURE__ */ new fe();
2728
- function p(T, _, x, P) {
2729
+ function p(T, S, x, P) {
2729
2730
  const I = n;
2730
- !T.isDegenerateIntoPoint && !T.isDegenerateIntoSegment ? I.copy(T.plane.normal) : I.copy(_.plane.normal);
2731
+ !T.isDegenerateIntoPoint && !T.isDegenerateIntoSegment ? I.copy(T.plane.normal) : I.copy(S.plane.normal);
2731
2732
  const M = T.satBounds, O = T.satAxes;
2732
2733
  for (let N = 1; N < 4; N++) {
2733
2734
  const G = M[N], z = O[N];
2734
- if (e.setFromPoints(z, _.points), G.isSeparated(e) || (o.copy(I).cross(z), e.setFromPoints(o, T.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2735
+ if (e.setFromPoints(z, S.points), G.isSeparated(e) || (o.copy(I).cross(z), e.setFromPoints(o, T.points), t.setFromPoints(o, S.points), e.isSeparated(t))) return !1;
2735
2736
  }
2736
- const C = _.satBounds, k = _.satAxes;
2737
+ const C = S.satBounds, k = S.satAxes;
2737
2738
  for (let N = 1; N < 4; N++) {
2738
2739
  const G = C[N], z = k[N];
2739
- if (e.setFromPoints(z, T.points), G.isSeparated(e) || (o.crossVectors(I, z), e.setFromPoints(o, T.points), t.setFromPoints(o, _.points), e.isSeparated(t))) return !1;
2740
+ if (e.setFromPoints(z, T.points), G.isSeparated(e) || (o.crossVectors(I, z), e.setFromPoints(o, T.points), t.setFromPoints(o, S.points), e.isSeparated(t))) return !1;
2740
2741
  }
2741
2742
  return x && (P || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), x.start.set(0, 0, 0), x.end.set(0, 0, 0)), !0;
2742
2743
  }
2743
- function f(T, _, x, P, I, M, O, C, k, N, G) {
2744
+ function f(T, S, x, P, I, M, O, C, k, N, G) {
2744
2745
  let z = O / (O - C);
2745
- N.x = P + (I - P) * z, G.start.subVectors(_, T).multiplyScalar(z).add(T), z = O / (O - k), N.y = P + (M - P) * z, G.end.subVectors(x, T).multiplyScalar(z).add(T);
2746
+ N.x = P + (I - P) * z, G.start.subVectors(S, T).multiplyScalar(z).add(T), z = O / (O - k), N.y = P + (M - P) * z, G.end.subVectors(x, T).multiplyScalar(z).add(T);
2746
2747
  }
2747
- function y(T, _, x, P, I, M, O, C, k, N, G) {
2748
+ function y(T, S, x, P, I, M, O, C, k, N, G) {
2748
2749
  if (I > 0)
2749
- f(T.c, T.a, T.b, P, _, x, k, O, C, N, G);
2750
+ f(T.c, T.a, T.b, P, S, x, k, O, C, N, G);
2750
2751
  else if (M > 0)
2751
- f(T.b, T.a, T.c, x, _, P, C, O, k, N, G);
2752
+ f(T.b, T.a, T.c, x, S, P, C, O, k, N, G);
2752
2753
  else if (C * k > 0 || O != 0)
2753
- f(T.a, T.b, T.c, _, x, P, O, C, k, N, G);
2754
+ f(T.a, T.b, T.c, S, x, P, O, C, k, N, G);
2754
2755
  else if (C != 0)
2755
- f(T.b, T.a, T.c, x, _, P, C, O, k, N, G);
2756
+ f(T.b, T.a, T.c, x, S, P, C, O, k, N, G);
2756
2757
  else if (k != 0)
2757
- f(T.c, T.a, T.b, P, _, x, k, O, C, N, G);
2758
+ f(T.c, T.a, T.b, P, S, x, k, O, C, N, G);
2758
2759
  else
2759
2760
  return !0;
2760
2761
  return !1;
2761
2762
  }
2762
- function b(T, _, x, P) {
2763
- const I = _.degenerateSegment, M = T.plane.distanceToPoint(I.start), O = T.plane.distanceToPoint(I.end);
2764
- return at(M) ? at(O) ? p(T, _, x, P) : (x && (x.start.copy(I.start), x.end.copy(I.start)), T.containsPoint(I.start)) : at(O) ? (x && (x.start.copy(I.end), x.end.copy(I.end)), T.containsPoint(I.end)) : T.plane.intersectLine(I, n) != null ? (x && (x.start.copy(n), x.end.copy(n)), T.containsPoint(n)) : !1;
2763
+ function _(T, S, x, P) {
2764
+ const I = S.degenerateSegment, M = T.plane.distanceToPoint(I.start), O = T.plane.distanceToPoint(I.end);
2765
+ return at(M) ? at(O) ? p(T, S, x, P) : (x && (x.start.copy(I.start), x.end.copy(I.start)), T.containsPoint(I.start)) : at(O) ? (x && (x.start.copy(I.end), x.end.copy(I.end)), T.containsPoint(I.end)) : T.plane.intersectLine(I, n) != null ? (x && (x.start.copy(n), x.end.copy(n)), T.containsPoint(n)) : !1;
2765
2766
  }
2766
- function S(T, _, x) {
2767
- const P = _.a;
2767
+ function b(T, S, x) {
2768
+ const P = S.a;
2768
2769
  return at(T.plane.distanceToPoint(P)) && T.containsPoint(P) ? (x && (x.start.copy(P), x.end.copy(P)), !0) : !1;
2769
2770
  }
2770
- function v(T, _, x) {
2771
- const P = T.degenerateSegment, I = _.a;
2771
+ function v(T, S, x) {
2772
+ const P = T.degenerateSegment, I = S.a;
2772
2773
  return P.closestPointToPoint(I, !0, n), I.distanceToSquared(n) < Hr ? (x && (x.start.copy(I), x.end.copy(I)), !0) : !1;
2773
2774
  }
2774
- function E(T, _, x, P) {
2775
+ function E(T, S, x, P) {
2775
2776
  if (T.isDegenerateIntoSegment)
2776
- if (_.isDegenerateIntoSegment) {
2777
- const I = T.degenerateSegment, M = _.degenerateSegment, O = s, C = r;
2777
+ if (S.isDegenerateIntoSegment) {
2778
+ const I = T.degenerateSegment, M = S.degenerateSegment, O = s, C = r;
2778
2779
  I.delta(O), M.delta(C);
2779
2780
  const k = n.subVectors(M.start, I.start), N = O.x * C.y - O.y * C.x;
2780
2781
  if (at(N))
@@ -2784,28 +2785,28 @@ Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2784
2785
  return !1;
2785
2786
  const X = I.start.z + O.z * G, ie = M.start.z + C.z * z;
2786
2787
  return at(X - ie) ? (x && (x.start.copy(I.start).addScaledVector(O, G), x.end.copy(I.start).addScaledVector(O, G)), !0) : !1;
2787
- } else return _.isDegenerateIntoPoint ? v(T, _, x) : b(_, T, x, P);
2788
+ } else return S.isDegenerateIntoPoint ? v(T, S, x) : _(S, T, x, P);
2788
2789
  else {
2789
2790
  if (T.isDegenerateIntoPoint)
2790
- return _.isDegenerateIntoPoint ? _.a.distanceToSquared(T.a) < Hr ? (x && (x.start.copy(T.a), x.end.copy(T.a)), !0) : !1 : _.isDegenerateIntoSegment ? v(_, T, x) : S(_, T, x);
2791
- if (_.isDegenerateIntoPoint)
2792
- return S(T, _, x);
2793
- if (_.isDegenerateIntoSegment)
2794
- return b(T, _, x, P);
2791
+ return S.isDegenerateIntoPoint ? S.a.distanceToSquared(T.a) < Hr ? (x && (x.start.copy(T.a), x.end.copy(T.a)), !0) : !1 : S.isDegenerateIntoSegment ? v(S, T, x) : b(S, T, x);
2792
+ if (S.isDegenerateIntoPoint)
2793
+ return b(T, S, x);
2794
+ if (S.isDegenerateIntoSegment)
2795
+ return _(T, S, x, P);
2795
2796
  }
2796
2797
  }
2797
- return function(_, x = null, P = !1) {
2798
- this.needsUpdate && this.update(), _.isExtendedTriangle ? _.needsUpdate && _.update() : (i.copy(_), i.update(), _ = i);
2799
- const I = E(this, _, x, P);
2798
+ return function(S, x = null, P = !1) {
2799
+ this.needsUpdate && this.update(), S.isExtendedTriangle ? S.needsUpdate && S.update() : (i.copy(S), i.update(), S = i);
2800
+ const I = E(this, S, x, P);
2800
2801
  if (I !== void 0)
2801
2802
  return I;
2802
- const M = this.plane, O = _.plane;
2803
+ const M = this.plane, O = S.plane;
2803
2804
  let C = O.distanceToPoint(this.a), k = O.distanceToPoint(this.b), N = O.distanceToPoint(this.c);
2804
2805
  at(C) && (C = 0), at(k) && (k = 0), at(N) && (N = 0);
2805
2806
  const G = C * k, z = C * N;
2806
2807
  if (G > 0 && z > 0)
2807
2808
  return !1;
2808
- let X = M.distanceToPoint(_.a), ie = M.distanceToPoint(_.b), Ne = M.distanceToPoint(_.c);
2809
+ let X = M.distanceToPoint(S.a), ie = M.distanceToPoint(S.b), Ne = M.distanceToPoint(S.c);
2809
2810
  at(X) && (X = 0), at(ie) && (ie = 0), at(Ne) && (Ne = 0);
2810
2811
  const dt = X * ie, Me = X * Ne;
2811
2812
  if (dt > 0 && Me > 0)
@@ -2815,11 +2816,11 @@ Tt.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2815
2816
  let Ve = 0, Ae = Math.abs(Ue.x);
2816
2817
  const ge = Math.abs(Ue.y);
2817
2818
  ge > Ae && (Ae = ge, Ve = 1), Math.abs(Ue.z) > Ae && (Ve = 2);
2818
- const We = al[Ve], zt = this.a[We], me = this.b[We], pt = this.c[We], ft = _.a[We], Cn = _.b[We], an = _.c[We];
2819
+ const We = al[Ve], zt = this.a[We], me = this.b[We], pt = this.c[We], ft = S.a[We], Cn = S.b[We], an = S.c[We];
2819
2820
  if (y(this, zt, me, pt, G, z, C, k, N, d, a))
2820
- return p(this, _, x, P);
2821
- if (y(_, ft, Cn, an, dt, Me, X, ie, Ne, h, c))
2822
- return p(this, _, x, P);
2821
+ return p(this, S, x, P);
2822
+ if (y(S, ft, Cn, an, dt, Me, X, ie, Ne, h, c))
2823
+ return p(this, S, x, P);
2823
2824
  if (d.y < d.x) {
2824
2825
  const Lt = d.y;
2825
2826
  d.y = d.x, d.x = Lt, u.copy(a.start), a.start.copy(a.end), a.end.copy(u);
@@ -2848,15 +2849,15 @@ Tt.prototype.distanceToTriangle = /* @__PURE__ */ (function() {
2848
2849
  let p;
2849
2850
  const f = t[h], y = o[f];
2850
2851
  this.closestPointToPoint(y, i), p = y.distanceToSquared(i), p < d && (d = p, a && a.copy(i), c && c.copy(y));
2851
- const b = this[f];
2852
- o.closestPointToPoint(b, i), p = b.distanceToSquared(i), p < d && (d = p, a && a.copy(b), c && c.copy(i));
2852
+ const _ = this[f];
2853
+ o.closestPointToPoint(_, i), p = _.distanceToSquared(i), p < d && (d = p, a && a.copy(_), c && c.copy(i));
2853
2854
  }
2854
2855
  for (let h = 0; h < 3; h++) {
2855
2856
  const p = t[h], f = t[(h + 1) % 3];
2856
2857
  n.set(this[p], this[f]);
2857
2858
  for (let y = 0; y < 3; y++) {
2858
- const b = t[y], S = t[(y + 1) % 3];
2859
- s.set(o[b], o[S]), lr(n, s, i, e);
2859
+ const _ = t[y], b = t[(y + 1) % 3];
2860
+ s.set(o[_], o[b]), lr(n, s, i, e);
2860
2861
  const v = i.distanceToSquared(e);
2861
2862
  v < d && (d = v, a && a.copy(i), c && c.copy(e));
2862
2863
  }
@@ -2930,8 +2931,8 @@ Je.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
2930
2931
  for (let p = 0; p < 3; p++) {
2931
2932
  const f = c[p];
2932
2933
  for (let y = 0; y < 4; y++) {
2933
- const b = d[y];
2934
- if (s.crossVectors(f, b), t.setFromPoints(s, e), n.setFromPoints(s, h), t.isSeparated(n)) return !1;
2934
+ const _ = d[y];
2935
+ if (s.crossVectors(f, _), t.setFromPoints(s, e), n.setFromPoints(s, h), t.isSeparated(n)) return !1;
2935
2936
  }
2936
2937
  }
2937
2938
  return !0;
@@ -2955,38 +2956,38 @@ Je.prototype.distanceToBox = /* @__PURE__ */ (function() {
2955
2956
  return (c || u) && (o.getCenter(s), this.closestPointToPoint(s, n), o.closestPointToPoint(n, s), c && c.copy(n), u && u.copy(s)), 0;
2956
2957
  const d = a * a, h = o.min, p = o.max, f = this.points;
2957
2958
  let y = 1 / 0;
2958
- for (let S = 0; S < 8; S++) {
2959
- const v = f[S];
2959
+ for (let b = 0; b < 8; b++) {
2960
+ const v = f[b];
2960
2961
  s.copy(v).clamp(h, p);
2961
2962
  const E = v.distanceToSquared(s);
2962
2963
  if (E < y && (y = E, c && c.copy(v), u && u.copy(s), E < d))
2963
2964
  return Math.sqrt(E);
2964
2965
  }
2965
- let b = 0;
2966
- for (let S = 0; S < 3; S++)
2966
+ let _ = 0;
2967
+ for (let b = 0; b < 3; b++)
2967
2968
  for (let v = 0; v <= 1; v++)
2968
2969
  for (let E = 0; E <= 1; E++) {
2969
- const T = (S + 1) % 3, _ = (S + 2) % 3, x = v << T | E << _, P = 1 << S | v << T | E << _, I = f[x], M = f[P];
2970
- e[b].set(I, M);
2971
- const C = i[S], k = i[T], N = i[_], G = t[b], z = G.start, X = G.end;
2972
- z[C] = h[C], z[k] = v ? h[k] : p[k], z[N] = E ? h[N] : p[k], X[C] = p[C], X[k] = v ? h[k] : p[k], X[N] = E ? h[N] : p[k], b++;
2970
+ const T = (b + 1) % 3, S = (b + 2) % 3, x = v << T | E << S, P = 1 << b | v << T | E << S, I = f[x], M = f[P];
2971
+ e[_].set(I, M);
2972
+ const C = i[b], k = i[T], N = i[S], G = t[_], z = G.start, X = G.end;
2973
+ z[C] = h[C], z[k] = v ? h[k] : p[k], z[N] = E ? h[N] : p[k], X[C] = p[C], X[k] = v ? h[k] : p[k], X[N] = E ? h[N] : p[k], _++;
2973
2974
  }
2974
- for (let S = 0; S <= 1; S++)
2975
+ for (let b = 0; b <= 1; b++)
2975
2976
  for (let v = 0; v <= 1; v++)
2976
2977
  for (let E = 0; E <= 1; E++) {
2977
- s.x = S ? p.x : h.x, s.y = v ? p.y : h.y, s.z = E ? p.z : h.z, this.closestPointToPoint(s, n);
2978
+ s.x = b ? p.x : h.x, s.y = v ? p.y : h.y, s.z = E ? p.z : h.z, this.closestPointToPoint(s, n);
2978
2979
  const T = s.distanceToSquared(n);
2979
2980
  if (T < y && (y = T, c && c.copy(n), u && u.copy(s), T < d))
2980
2981
  return Math.sqrt(T);
2981
2982
  }
2982
- for (let S = 0; S < 12; S++) {
2983
- const v = e[S];
2983
+ for (let b = 0; b < 12; b++) {
2984
+ const v = e[b];
2984
2985
  for (let E = 0; E < 12; E++) {
2985
2986
  const T = t[E];
2986
2987
  lr(v, T, n, s);
2987
- const _ = n.distanceToSquared(s);
2988
- if (_ < y && (y = _, c && c.copy(n), u && u.copy(s), _ < d))
2989
- return Math.sqrt(_);
2988
+ const S = n.distanceToSquared(s);
2989
+ if (S < y && (y = S, c && c.copy(n), u && u.copy(s), S < d))
2990
+ return Math.sqrt(S);
2990
2991
  }
2991
2992
  }
2992
2993
  return Math.sqrt(y);
@@ -3015,10 +3016,10 @@ function ll(i, e, t = {}, n = 0, s = 1 / 0) {
3015
3016
  const u = Math.sqrt(a);
3016
3017
  return t.point ? t.point.copy(hi) : t.point = hi.clone(), t.distance = u, t.faceIndex = c, t;
3017
3018
  }
3018
- const Ts = parseInt(_o) >= 169, hl = parseInt(_o) <= 161, Qt = /* @__PURE__ */ new $(), Jt = /* @__PURE__ */ new $(), en = /* @__PURE__ */ new $(), Ss = /* @__PURE__ */ new fe(), _s = /* @__PURE__ */ new fe(), bs = /* @__PURE__ */ new fe(), Gr = /* @__PURE__ */ new $(), jr = /* @__PURE__ */ new $(), Vr = /* @__PURE__ */ new $(), kn = /* @__PURE__ */ new $();
3019
+ const Ts = parseInt(So) >= 169, hl = parseInt(So) <= 161, Qt = /* @__PURE__ */ new $(), Jt = /* @__PURE__ */ new $(), en = /* @__PURE__ */ new $(), bs = /* @__PURE__ */ new fe(), Ss = /* @__PURE__ */ new fe(), _s = /* @__PURE__ */ new fe(), Gr = /* @__PURE__ */ new $(), jr = /* @__PURE__ */ new $(), Vr = /* @__PURE__ */ new $(), kn = /* @__PURE__ */ new $();
3019
3020
  function ul(i, e, t, n, s, r, o, a) {
3020
3021
  let c;
3021
- if (r === To ? c = i.intersectTriangle(n, t, e, !0, s) : c = i.intersectTriangle(e, t, n, r !== So, s), c === null) return null;
3022
+ if (r === To ? c = i.intersectTriangle(n, t, e, !0, s) : c = i.intersectTriangle(e, t, n, r !== bo, s), c === null) return null;
3022
3023
  const u = i.origin.distanceTo(s);
3023
3024
  return u < o || u > a ? null : {
3024
3025
  distance: u,
@@ -3030,13 +3031,13 @@ function Wr(i, e, t, n, s, r, o, a, c, u, d) {
3030
3031
  const h = ul(i, Qt, Jt, en, kn, c, u, d);
3031
3032
  if (h) {
3032
3033
  if (n) {
3033
- Ss.fromBufferAttribute(n, r), _s.fromBufferAttribute(n, o), bs.fromBufferAttribute(n, a), h.uv = new fe();
3034
- const f = Tn.getInterpolation(kn, Qt, Jt, en, Ss, _s, bs, h.uv);
3034
+ bs.fromBufferAttribute(n, r), Ss.fromBufferAttribute(n, o), _s.fromBufferAttribute(n, a), h.uv = new fe();
3035
+ const f = Tn.getInterpolation(kn, Qt, Jt, en, bs, Ss, _s, h.uv);
3035
3036
  Ts || (h.uv = f);
3036
3037
  }
3037
3038
  if (s) {
3038
- Ss.fromBufferAttribute(s, r), _s.fromBufferAttribute(s, o), bs.fromBufferAttribute(s, a), h.uv1 = new fe();
3039
- const f = Tn.getInterpolation(kn, Qt, Jt, en, Ss, _s, bs, h.uv1);
3039
+ bs.fromBufferAttribute(s, r), Ss.fromBufferAttribute(s, o), _s.fromBufferAttribute(s, a), h.uv1 = new fe();
3040
+ const f = Tn.getInterpolation(kn, Qt, Jt, en, bs, Ss, _s, h.uv1);
3040
3041
  Ts || (h.uv1 = f), hl && (h.uv2 = h.uv1);
3041
3042
  }
3042
3043
  if (t) {
@@ -3066,13 +3067,13 @@ function $s(i, e, t, n, s, r, o) {
3066
3067
  let c = a + 0, u = a + 1, d = a + 2;
3067
3068
  const { index: h, groups: p } = i;
3068
3069
  i.index && (c = h.getX(c), u = h.getX(u), d = h.getX(d));
3069
- const { position: f, normal: y, uv: b, uv1: S } = i.attributes;
3070
+ const { position: f, normal: y, uv: _, uv1: b } = i.attributes;
3070
3071
  if (Array.isArray(e)) {
3071
3072
  const v = n * 3;
3072
3073
  for (let E = 0, T = p.length; E < T; E++) {
3073
- const { start: _, count: x, materialIndex: P } = p[E];
3074
- if (v >= _ && v < _ + x) {
3075
- const I = Zr(e[P]), M = Wr(t, f, y, b, S, c, u, d, I, r, o);
3074
+ const { start: S, count: x, materialIndex: P } = p[E];
3075
+ if (v >= S && v < S + x) {
3076
+ const I = Zr(e[P]), M = Wr(t, f, y, _, b, c, u, d, I, r, o);
3076
3077
  if (M)
3077
3078
  if (M.faceIndex = n, M.face.materialIndex = P, s)
3078
3079
  s.push(M);
@@ -3081,7 +3082,7 @@ function $s(i, e, t, n, s, r, o) {
3081
3082
  }
3082
3083
  }
3083
3084
  } else {
3084
- const v = Zr(e), E = Wr(t, f, y, b, S, c, u, d, v, r, o);
3085
+ const v = Zr(e), E = Wr(t, f, y, _, b, c, u, d, v, r, o);
3085
3086
  if (E)
3086
3087
  if (E.faceIndex = n, E.face.materialIndex = 0, s)
3087
3088
  s.push(E);
@@ -3126,35 +3127,35 @@ function ml(i, e = null) {
3126
3127
  for (let p = 0, f = d.length; p < f; p++)
3127
3128
  r = d[p], o = new Uint32Array(r), a = new Uint16Array(r), c = new Float32Array(r), h(0, u), u += r.byteLength;
3128
3129
  function h(p, f, y = !1) {
3129
- const b = p * 2;
3130
- if (De(b, a)) {
3131
- const S = $e(p, o), v = Qe(b, a);
3132
- let E = 1 / 0, T = 1 / 0, _ = 1 / 0, x = -1 / 0, P = -1 / 0, I = -1 / 0;
3133
- for (let M = 3 * S, O = 3 * (S + v); M < O; M++) {
3130
+ const _ = p * 2;
3131
+ if (De(_, a)) {
3132
+ const b = $e(p, o), v = Qe(_, a);
3133
+ let E = 1 / 0, T = 1 / 0, S = 1 / 0, x = -1 / 0, P = -1 / 0, I = -1 / 0;
3134
+ for (let M = 3 * b, O = 3 * (b + v); M < O; M++) {
3134
3135
  let C = n[M];
3135
3136
  const k = s.getX(C), N = s.getY(C), G = s.getZ(C);
3136
- k < E && (E = k), k > x && (x = k), N < T && (T = N), N > P && (P = N), G < _ && (_ = G), G > I && (I = G);
3137
+ k < E && (E = k), k > x && (x = k), N < T && (T = N), N > P && (P = N), G < S && (S = G), G > I && (I = G);
3137
3138
  }
3138
- return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== _ || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== I ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = _, c[p + 3] = x, c[p + 4] = P, c[p + 5] = I, !0) : !1;
3139
+ return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== S || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== I ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = S, c[p + 3] = x, c[p + 4] = P, c[p + 5] = I, !0) : !1;
3139
3140
  } else {
3140
- const S = Fe(p), v = ze(p, o);
3141
- let E = y, T = !1, _ = !1;
3141
+ const b = Fe(p), v = ze(p, o);
3142
+ let E = y, T = !1, S = !1;
3142
3143
  if (e) {
3143
3144
  if (!E) {
3144
- const C = S / Oe + f / qe, k = v / Oe + f / qe;
3145
- T = e.has(C), _ = e.has(k), E = !T && !_;
3145
+ const C = b / Oe + f / qe, k = v / Oe + f / qe;
3146
+ T = e.has(C), S = e.has(k), E = !T && !S;
3146
3147
  }
3147
3148
  } else
3148
- T = !0, _ = !0;
3149
- const x = E || T, P = E || _;
3149
+ T = !0, S = !0;
3150
+ const x = E || T, P = E || S;
3150
3151
  let I = !1;
3151
- x && (I = h(S, f, E));
3152
+ x && (I = h(b, f, E));
3152
3153
  let M = !1;
3153
3154
  P && (M = h(v, f, E));
3154
3155
  const O = I || M;
3155
3156
  if (O)
3156
3157
  for (let C = 0; C < 3; C++) {
3157
- const k = S + C, N = v + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3158
+ const k = b + C, N = v + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3158
3159
  c[p + C] = G < X ? G : X, c[p + C + 3] = z > ie ? z : ie;
3159
3160
  }
3160
3161
  return O;
@@ -3163,9 +3164,9 @@ function ml(i, e = null) {
3163
3164
  }
3164
3165
  function Yt(i, e, t, n, s) {
3165
3166
  let r, o, a, c, u, d;
3166
- const h = 1 / t.direction.x, p = 1 / t.direction.y, f = 1 / t.direction.z, y = t.origin.x, b = t.origin.y, S = t.origin.z;
3167
- let v = e[i], E = e[i + 3], T = e[i + 1], _ = e[i + 3 + 1], x = e[i + 2], P = e[i + 3 + 2];
3168
- return h >= 0 ? (r = (v - y) * h, o = (E - y) * h) : (r = (E - y) * h, o = (v - y) * h), p >= 0 ? (a = (T - b) * p, c = (_ - b) * p) : (a = (_ - b) * p, c = (T - b) * p), r > c || a > o || ((a > r || isNaN(r)) && (r = a), (c < o || isNaN(o)) && (o = c), f >= 0 ? (u = (x - S) * f, d = (P - S) * f) : (u = (P - S) * f, d = (x - S) * f), r > d || u > o) ? !1 : ((u > r || r !== r) && (r = u), (d < o || o !== o) && (o = d), r <= s && o >= n);
3167
+ const h = 1 / t.direction.x, p = 1 / t.direction.y, f = 1 / t.direction.z, y = t.origin.x, _ = t.origin.y, b = t.origin.z;
3168
+ let v = e[i], E = e[i + 3], T = e[i + 1], S = e[i + 3 + 1], x = e[i + 2], P = e[i + 3 + 2];
3169
+ return h >= 0 ? (r = (v - y) * h, o = (E - y) * h) : (r = (E - y) * h, o = (v - y) * h), p >= 0 ? (a = (T - _) * p, c = (S - _) * p) : (a = (S - _) * p, c = (T - _) * p), r > c || a > o || ((a > r || isNaN(r)) && (r = a), (c < o || isNaN(o)) && (o = c), f >= 0 ? (u = (x - b) * f, d = (P - b) * f) : (u = (P - b) * f, d = (x - b) * f), r > d || u > o) ? !1 : ((u > r || r !== r) && (r = u), (d < o || o !== o) && (o = d), r <= s && o >= n);
3169
3170
  }
3170
3171
  function gl(i, e, t, n, s, r, o, a) {
3171
3172
  const { geometry: c, _indirectBuffer: u } = i;
@@ -3193,10 +3194,10 @@ function wl(i, e, t, n, s, r, o) {
3193
3194
  return !1;
3194
3195
  }
3195
3196
  function El(i, e, t, n, s, r, o) {
3196
- be.setBuffer(i._roots[e]), Oi(0, i, t, n, s, r, o), be.clearBuffer();
3197
+ _e.setBuffer(i._roots[e]), Oi(0, i, t, n, s, r, o), _e.clearBuffer();
3197
3198
  }
3198
3199
  function Oi(i, e, t, n, s, r, o) {
3199
- const { float32Array: a, uint16Array: c, uint32Array: u } = be, d = i * 2;
3200
+ const { float32Array: a, uint16Array: c, uint32Array: u } = _e, d = i * 2;
3200
3201
  if (De(d, c)) {
3201
3202
  const p = $e(i, u), f = Qe(d, c);
3202
3203
  dl(e, t, n, p, f, s, r, o);
@@ -3208,51 +3209,51 @@ function Oi(i, e, t, n, s, r, o) {
3208
3209
  }
3209
3210
  }
3210
3211
  const Tl = ["x", "y", "z"];
3211
- function Sl(i, e, t, n, s, r) {
3212
- be.setBuffer(i._roots[e]);
3212
+ function bl(i, e, t, n, s, r) {
3213
+ _e.setBuffer(i._roots[e]);
3213
3214
  const o = Di(0, i, t, n, s, r);
3214
- return be.clearBuffer(), o;
3215
+ return _e.clearBuffer(), o;
3215
3216
  }
3216
3217
  function Di(i, e, t, n, s, r) {
3217
- const { float32Array: o, uint16Array: a, uint32Array: c } = be;
3218
+ const { float32Array: o, uint16Array: a, uint32Array: c } = _e;
3218
3219
  let u = i * 2;
3219
3220
  if (De(u, a)) {
3220
3221
  const h = $e(i, c), p = Qe(u, a);
3221
3222
  return pl(e, t, n, h, p, s, r);
3222
3223
  } else {
3223
3224
  const h = or(i, c), p = Tl[h], y = n.direction[p] >= 0;
3224
- let b, S;
3225
- y ? (b = Fe(i), S = ze(i, c)) : (b = ze(i, c), S = Fe(i));
3226
- const E = Yt(b, o, n, s, r) ? Di(b, e, t, n, s, r) : null;
3225
+ let _, b;
3226
+ y ? (_ = Fe(i), b = ze(i, c)) : (_ = ze(i, c), b = Fe(i));
3227
+ const E = Yt(_, o, n, s, r) ? Di(_, e, t, n, s, r) : null;
3227
3228
  if (E) {
3228
3229
  const x = E.point[p];
3229
- if (y ? x <= o[S + h] : (
3230
+ if (y ? x <= o[b + h] : (
3230
3231
  // min bounding data
3231
- x >= o[S + h + 3]
3232
+ x >= o[b + h + 3]
3232
3233
  ))
3233
3234
  return E;
3234
3235
  }
3235
- const _ = Yt(S, o, n, s, r) ? Di(S, e, t, n, s, r) : null;
3236
- return E && _ ? E.distance <= _.distance ? E : _ : E || _ || null;
3236
+ const S = Yt(b, o, n, s, r) ? Di(b, e, t, n, s, r) : null;
3237
+ return E && S ? E.distance <= S.distance ? E : S : E || S || null;
3237
3238
  }
3238
3239
  }
3239
- const xs = /* @__PURE__ */ new _t(), fn = /* @__PURE__ */ new Tt(), mn = /* @__PURE__ */ new Tt(), Fn = /* @__PURE__ */ new ut(), Kr = /* @__PURE__ */ new Je(), vs = /* @__PURE__ */ new Je();
3240
- function _l(i, e, t, n) {
3241
- be.setBuffer(i._roots[e]);
3240
+ const xs = /* @__PURE__ */ new St(), fn = /* @__PURE__ */ new Tt(), mn = /* @__PURE__ */ new Tt(), Fn = /* @__PURE__ */ new ut(), Kr = /* @__PURE__ */ new Je(), vs = /* @__PURE__ */ new Je();
3241
+ function Sl(i, e, t, n) {
3242
+ _e.setBuffer(i._roots[e]);
3242
3243
  const s = Ni(0, i, t, n);
3243
- return be.clearBuffer(), s;
3244
+ return _e.clearBuffer(), s;
3244
3245
  }
3245
3246
  function Ni(i, e, t, n, s = null) {
3246
- const { float32Array: r, uint16Array: o, uint32Array: a } = be;
3247
+ const { float32Array: r, uint16Array: o, uint32Array: a } = _e;
3247
3248
  let c = i * 2;
3248
3249
  if (s === null && (t.boundingBox || t.computeBoundingBox(), Kr.set(t.boundingBox.min, t.boundingBox.max, n), s = Kr), De(c, o)) {
3249
- const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, b = $e(i, a), S = Qe(c, o);
3250
+ const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, _ = $e(i, a), b = Qe(c, o);
3250
3251
  if (Fn.copy(n).invert(), t.boundsTree)
3251
3252
  return ve(i, r, vs), vs.matrix.copy(Fn), vs.needsUpdate = !0, t.boundsTree.shapecast({
3252
3253
  intersectsBounds: (E) => vs.intersectsBox(E),
3253
3254
  intersectsTriangle: (E) => {
3254
3255
  E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
3255
- for (let T = b * 3, _ = (S + b) * 3; T < _; T += 3)
3256
+ for (let T = _ * 3, S = (b + _) * 3; T < S; T += 3)
3256
3257
  if (Ie(mn, T, h, p), mn.needsUpdate = !0, E.intersectsTriangle(mn))
3257
3258
  return !0;
3258
3259
  return !1;
@@ -3260,10 +3261,10 @@ function Ni(i, e, t, n, s = null) {
3260
3261
  });
3261
3262
  {
3262
3263
  const v = qs(t);
3263
- for (let E = b * 3, T = (S + b) * 3; E < T; E += 3) {
3264
+ for (let E = _ * 3, T = (b + _) * 3; E < T; E += 3) {
3264
3265
  Ie(fn, E, h, p), fn.a.applyMatrix4(Fn), fn.b.applyMatrix4(Fn), fn.c.applyMatrix4(Fn), fn.needsUpdate = !0;
3265
- for (let _ = 0, x = v * 3; _ < x; _ += 3)
3266
- if (Ie(mn, _, f, y), mn.needsUpdate = !0, fn.intersectsTriangle(mn))
3266
+ for (let S = 0, x = v * 3; S < x; S += 3)
3267
+ if (Ie(mn, S, f, y), mn.needsUpdate = !0, fn.intersectsTriangle(mn))
3267
3268
  return !0;
3268
3269
  }
3269
3270
  }
@@ -3272,13 +3273,13 @@ function Ni(i, e, t, n, s = null) {
3272
3273
  return ve(d, r, xs), !!(s.intersectsBox(xs) && Ni(d, e, t, n, s) || (ve(h, r, xs), s.intersectsBox(xs) && Ni(h, e, t, n, s)));
3273
3274
  }
3274
3275
  }
3275
- const As = /* @__PURE__ */ new ut(), ui = /* @__PURE__ */ new Je(), zn = /* @__PURE__ */ new Je(), bl = /* @__PURE__ */ new $(), xl = /* @__PURE__ */ new $(), vl = /* @__PURE__ */ new $(), Al = /* @__PURE__ */ new $();
3276
+ const As = /* @__PURE__ */ new ut(), ui = /* @__PURE__ */ new Je(), zn = /* @__PURE__ */ new Je(), _l = /* @__PURE__ */ new $(), xl = /* @__PURE__ */ new $(), vl = /* @__PURE__ */ new $(), Al = /* @__PURE__ */ new $();
3276
3277
  function Rl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3277
3278
  e.boundingBox || e.computeBoundingBox(), ui.set(e.boundingBox.min, e.boundingBox.max, t), ui.needsUpdate = !0;
3278
3279
  const a = i.geometry, c = a.attributes.position, u = a.index, d = e.attributes.position, h = e.index, p = ht.getPrimitive(), f = ht.getPrimitive();
3279
- let y = bl, b = xl, S = null, v = null;
3280
- s && (S = vl, v = Al);
3281
- let E = 1 / 0, T = null, _ = null;
3280
+ let y = _l, _ = xl, b = null, v = null;
3281
+ s && (b = vl, v = Al);
3282
+ let E = 1 / 0, T = null, S = null;
3282
3283
  return As.copy(t).invert(), zn.matrix.copy(As), i.shapecast(
3283
3284
  {
3284
3285
  boundsTraverseOrder: (x) => ui.distanceToBox(x),
@@ -3293,8 +3294,8 @@ function Rl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3293
3294
  Ie(f, 3 * C, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
3294
3295
  for (let N = x, G = x + P; N < G; N++) {
3295
3296
  Ie(p, 3 * N, u, c), p.needsUpdate = !0;
3296
- const z = p.distanceToTriangle(f, y, S);
3297
- if (z < E && (b.copy(y), v && v.copy(S), E = z, T = N, _ = C), z < r)
3297
+ const z = p.distanceToTriangle(f, y, b);
3298
+ if (z < E && (_.copy(y), v && v.copy(b), E = z, T = N, S = C), z < r)
3298
3299
  return !0;
3299
3300
  }
3300
3301
  }
@@ -3306,15 +3307,15 @@ function Rl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3306
3307
  Ie(f, 3 * M, h, d), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
3307
3308
  for (let C = x, k = x + P; C < k; C++) {
3308
3309
  Ie(p, 3 * C, u, c), p.needsUpdate = !0;
3309
- const N = p.distanceToTriangle(f, y, S);
3310
- if (N < E && (b.copy(y), v && v.copy(S), E = N, T = C, _ = M), N < r)
3310
+ const N = p.distanceToTriangle(f, y, b);
3311
+ if (N < E && (_.copy(y), v && v.copy(b), E = N, T = C, S = M), N < r)
3311
3312
  return !0;
3312
3313
  }
3313
3314
  }
3314
3315
  }
3315
3316
  }
3316
3317
  }
3317
- ), ht.releasePrimitive(p), ht.releasePrimitive(f), 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(v) : s.point = v.clone(), s.point.applyMatrix4(As), b.applyMatrix4(As), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3318
+ ), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(_) : n.point = _.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(v) : s.point = v.clone(), s.point.applyMatrix4(As), _.applyMatrix4(As), s.distance = _.sub(s.point).length(), s.faceIndex = S), n);
3318
3319
  }
3319
3320
  function Ml(i, e = null) {
3320
3321
  e && Array.isArray(e) && (e = new Set(e));
@@ -3324,39 +3325,39 @@ function Ml(i, e = null) {
3324
3325
  for (let p = 0, f = d.length; p < f; p++)
3325
3326
  r = d[p], o = new Uint32Array(r), a = new Uint16Array(r), c = new Float32Array(r), h(0, u), u += r.byteLength;
3326
3327
  function h(p, f, y = !1) {
3327
- const b = p * 2;
3328
- if (De(b, a)) {
3329
- const S = $e(p, o), v = Qe(b, a);
3330
- let E = 1 / 0, T = 1 / 0, _ = 1 / 0, x = -1 / 0, P = -1 / 0, I = -1 / 0;
3331
- for (let M = S, O = S + v; M < O; M++) {
3328
+ const _ = p * 2;
3329
+ if (De(_, a)) {
3330
+ const b = $e(p, o), v = Qe(_, a);
3331
+ let E = 1 / 0, T = 1 / 0, S = 1 / 0, x = -1 / 0, P = -1 / 0, I = -1 / 0;
3332
+ for (let M = b, O = b + v; M < O; M++) {
3332
3333
  const C = 3 * i.resolveTriangleIndex(M);
3333
3334
  for (let k = 0; k < 3; k++) {
3334
3335
  let N = C + k;
3335
3336
  N = n ? n[N] : N;
3336
3337
  const G = s.getX(N), z = s.getY(N), X = s.getZ(N);
3337
- G < E && (E = G), G > x && (x = G), z < T && (T = z), z > P && (P = z), X < _ && (_ = X), X > I && (I = X);
3338
+ G < E && (E = G), G > x && (x = G), z < T && (T = z), z > P && (P = z), X < S && (S = X), X > I && (I = X);
3338
3339
  }
3339
3340
  }
3340
- return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== _ || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== I ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = _, c[p + 3] = x, c[p + 4] = P, c[p + 5] = I, !0) : !1;
3341
+ return c[p + 0] !== E || c[p + 1] !== T || c[p + 2] !== S || c[p + 3] !== x || c[p + 4] !== P || c[p + 5] !== I ? (c[p + 0] = E, c[p + 1] = T, c[p + 2] = S, c[p + 3] = x, c[p + 4] = P, c[p + 5] = I, !0) : !1;
3341
3342
  } else {
3342
- const S = Fe(p), v = ze(p, o);
3343
- let E = y, T = !1, _ = !1;
3343
+ const b = Fe(p), v = ze(p, o);
3344
+ let E = y, T = !1, S = !1;
3344
3345
  if (e) {
3345
3346
  if (!E) {
3346
- const C = S / Oe + f / qe, k = v / Oe + f / qe;
3347
- T = e.has(C), _ = e.has(k), E = !T && !_;
3347
+ const C = b / Oe + f / qe, k = v / Oe + f / qe;
3348
+ T = e.has(C), S = e.has(k), E = !T && !S;
3348
3349
  }
3349
3350
  } else
3350
- T = !0, _ = !0;
3351
- const x = E || T, P = E || _;
3351
+ T = !0, S = !0;
3352
+ const x = E || T, P = E || S;
3352
3353
  let I = !1;
3353
- x && (I = h(S, f, E));
3354
+ x && (I = h(b, f, E));
3354
3355
  let M = !1;
3355
3356
  P && (M = h(v, f, E));
3356
3357
  const O = I || M;
3357
3358
  if (O)
3358
3359
  for (let C = 0; C < 3; C++) {
3359
- const k = S + C, N = v + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3360
+ const k = b + C, N = v + C, G = c[k], z = c[k + 3], X = c[N], ie = c[N + 3];
3360
3361
  c[p + C] = G < X ? G : X, c[p + C + 3] = z > ie ? z : ie;
3361
3362
  }
3362
3363
  return O;
@@ -3364,10 +3365,10 @@ function Ml(i, e = null) {
3364
3365
  }
3365
3366
  }
3366
3367
  function Cl(i, e, t, n, s, r, o) {
3367
- be.setBuffer(i._roots[e]), ki(0, i, t, n, s, r, o), be.clearBuffer();
3368
+ _e.setBuffer(i._roots[e]), ki(0, i, t, n, s, r, o), _e.clearBuffer();
3368
3369
  }
3369
3370
  function ki(i, e, t, n, s, r, o) {
3370
- const { float32Array: a, uint16Array: c, uint32Array: u } = be, d = i * 2;
3371
+ const { float32Array: a, uint16Array: c, uint32Array: u } = _e, d = i * 2;
3371
3372
  if (De(d, c)) {
3372
3373
  const p = $e(i, u), f = Qe(d, c);
3373
3374
  gl(e, t, n, p, f, s, r, o);
@@ -3380,50 +3381,50 @@ function ki(i, e, t, n, s, r, o) {
3380
3381
  }
3381
3382
  const Il = ["x", "y", "z"];
3382
3383
  function Pl(i, e, t, n, s, r) {
3383
- be.setBuffer(i._roots[e]);
3384
+ _e.setBuffer(i._roots[e]);
3384
3385
  const o = Fi(0, i, t, n, s, r);
3385
- return be.clearBuffer(), o;
3386
+ return _e.clearBuffer(), o;
3386
3387
  }
3387
3388
  function Fi(i, e, t, n, s, r) {
3388
- const { float32Array: o, uint16Array: a, uint32Array: c } = be;
3389
+ const { float32Array: o, uint16Array: a, uint32Array: c } = _e;
3389
3390
  let u = i * 2;
3390
3391
  if (De(u, a)) {
3391
3392
  const h = $e(i, c), p = Qe(u, a);
3392
3393
  return yl(e, t, n, h, p, s, r);
3393
3394
  } else {
3394
3395
  const h = or(i, c), p = Il[h], y = n.direction[p] >= 0;
3395
- let b, S;
3396
- y ? (b = Fe(i), S = ze(i, c)) : (b = ze(i, c), S = Fe(i));
3397
- const E = Yt(b, o, n, s, r) ? Fi(b, e, t, n, s, r) : null;
3396
+ let _, b;
3397
+ y ? (_ = Fe(i), b = ze(i, c)) : (_ = ze(i, c), b = Fe(i));
3398
+ const E = Yt(_, o, n, s, r) ? Fi(_, e, t, n, s, r) : null;
3398
3399
  if (E) {
3399
3400
  const x = E.point[p];
3400
- if (y ? x <= o[S + h] : (
3401
+ if (y ? x <= o[b + h] : (
3401
3402
  // min bounding data
3402
- x >= o[S + h + 3]
3403
+ x >= o[b + h + 3]
3403
3404
  ))
3404
3405
  return E;
3405
3406
  }
3406
- const _ = Yt(S, o, n, s, r) ? Fi(S, e, t, n, s, r) : null;
3407
- return E && _ ? E.distance <= _.distance ? E : _ : E || _ || null;
3407
+ const S = Yt(b, o, n, s, r) ? Fi(b, e, t, n, s, r) : null;
3408
+ return E && S ? E.distance <= S.distance ? E : S : E || S || null;
3408
3409
  }
3409
3410
  }
3410
- const Rs = /* @__PURE__ */ new _t(), gn = /* @__PURE__ */ new Tt(), yn = /* @__PURE__ */ new Tt(), Bn = /* @__PURE__ */ new ut(), Xr = /* @__PURE__ */ new Je(), Ms = /* @__PURE__ */ new Je();
3411
+ const Rs = /* @__PURE__ */ new St(), gn = /* @__PURE__ */ new Tt(), yn = /* @__PURE__ */ new Tt(), Bn = /* @__PURE__ */ new ut(), Xr = /* @__PURE__ */ new Je(), Ms = /* @__PURE__ */ new Je();
3411
3412
  function Ll(i, e, t, n) {
3412
- be.setBuffer(i._roots[e]);
3413
+ _e.setBuffer(i._roots[e]);
3413
3414
  const s = zi(0, i, t, n);
3414
- return be.clearBuffer(), s;
3415
+ return _e.clearBuffer(), s;
3415
3416
  }
3416
3417
  function zi(i, e, t, n, s = null) {
3417
- const { float32Array: r, uint16Array: o, uint32Array: a } = be;
3418
+ const { float32Array: r, uint16Array: o, uint32Array: a } = _e;
3418
3419
  let c = i * 2;
3419
3420
  if (s === null && (t.boundingBox || t.computeBoundingBox(), Xr.set(t.boundingBox.min, t.boundingBox.max, n), s = Xr), De(c, o)) {
3420
- const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, b = $e(i, a), S = Qe(c, o);
3421
+ const d = e.geometry, h = d.index, p = d.attributes.position, f = t.index, y = t.attributes.position, _ = $e(i, a), b = Qe(c, o);
3421
3422
  if (Bn.copy(n).invert(), t.boundsTree)
3422
3423
  return ve(i, r, Ms), Ms.matrix.copy(Bn), Ms.needsUpdate = !0, t.boundsTree.shapecast({
3423
3424
  intersectsBounds: (E) => Ms.intersectsBox(E),
3424
3425
  intersectsTriangle: (E) => {
3425
3426
  E.a.applyMatrix4(n), E.b.applyMatrix4(n), E.c.applyMatrix4(n), E.needsUpdate = !0;
3426
- for (let T = b, _ = S + b; T < _; T++)
3427
+ for (let T = _, S = b + _; T < S; T++)
3427
3428
  if (Ie(yn, 3 * e.resolveTriangleIndex(T), h, p), yn.needsUpdate = !0, E.intersectsTriangle(yn))
3428
3429
  return !0;
3429
3430
  return !1;
@@ -3431,9 +3432,9 @@ function zi(i, e, t, n, s = null) {
3431
3432
  });
3432
3433
  {
3433
3434
  const v = qs(t);
3434
- for (let E = b, T = S + b; E < T; E++) {
3435
- const _ = e.resolveTriangleIndex(E);
3436
- Ie(gn, 3 * _, h, p), gn.a.applyMatrix4(Bn), gn.b.applyMatrix4(Bn), gn.c.applyMatrix4(Bn), gn.needsUpdate = !0;
3435
+ for (let E = _, T = b + _; E < T; E++) {
3436
+ const S = e.resolveTriangleIndex(E);
3437
+ Ie(gn, 3 * S, h, p), gn.a.applyMatrix4(Bn), gn.b.applyMatrix4(Bn), gn.c.applyMatrix4(Bn), gn.needsUpdate = !0;
3437
3438
  for (let x = 0, P = v * 3; x < P; x += 3)
3438
3439
  if (Ie(yn, x, f, y), yn.needsUpdate = !0, gn.intersectsTriangle(yn))
3439
3440
  return !0;
@@ -3448,9 +3449,9 @@ const Cs = /* @__PURE__ */ new ut(), di = /* @__PURE__ */ new Je(), Un = /* @__P
3448
3449
  function Fl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3449
3450
  e.boundingBox || e.computeBoundingBox(), di.set(e.boundingBox.min, e.boundingBox.max, t), di.needsUpdate = !0;
3450
3451
  const a = i.geometry, c = a.attributes.position, u = a.index, d = e.attributes.position, h = e.index, p = ht.getPrimitive(), f = ht.getPrimitive();
3451
- let y = Ol, b = Dl, S = null, v = null;
3452
- s && (S = Nl, v = kl);
3453
- let E = 1 / 0, T = null, _ = null;
3452
+ let y = Ol, _ = Dl, b = null, v = null;
3453
+ s && (b = Nl, v = kl);
3454
+ let E = 1 / 0, T = null, S = null;
3454
3455
  return Cs.copy(t).invert(), Un.matrix.copy(Cs), i.shapecast(
3455
3456
  {
3456
3457
  boundsTraverseOrder: (x) => di.distanceToBox(x),
@@ -3468,8 +3469,8 @@ function Fl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3468
3469
  for (let G = x, z = x + P; G < z; G++) {
3469
3470
  const X = i.resolveTriangleIndex(G);
3470
3471
  Ie(p, 3 * X, u, c), p.needsUpdate = !0;
3471
- const ie = p.distanceToTriangle(f, y, S);
3472
- if (ie < E && (b.copy(y), v && v.copy(S), E = ie, T = G, _ = C), ie < r)
3472
+ const ie = p.distanceToTriangle(f, y, b);
3473
+ if (ie < E && (_.copy(y), v && v.copy(b), E = ie, T = G, S = C), ie < r)
3473
3474
  return !0;
3474
3475
  }
3475
3476
  }
@@ -3482,15 +3483,15 @@ function Fl(i, e, t, n = {}, s = {}, r = 0, o = 1 / 0) {
3482
3483
  for (let C = x, k = x + P; C < k; C++) {
3483
3484
  const N = i.resolveTriangleIndex(C);
3484
3485
  Ie(p, 3 * N, u, c), p.needsUpdate = !0;
3485
- const G = p.distanceToTriangle(f, y, S);
3486
- if (G < E && (b.copy(y), v && v.copy(S), E = G, T = C, _ = M), G < r)
3486
+ const G = p.distanceToTriangle(f, y, b);
3487
+ if (G < E && (_.copy(y), v && v.copy(b), E = G, T = C, S = M), G < r)
3487
3488
  return !0;
3488
3489
  }
3489
3490
  }
3490
3491
  }
3491
3492
  }
3492
3493
  }
3493
- ), ht.releasePrimitive(p), ht.releasePrimitive(f), 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(v) : s.point = v.clone(), s.point.applyMatrix4(Cs), b.applyMatrix4(Cs), s.distance = b.sub(s.point).length(), s.faceIndex = _), n);
3494
+ ), ht.releasePrimitive(p), ht.releasePrimitive(f), E === 1 / 0 ? null : (n.point ? n.point.copy(_) : n.point = _.clone(), n.distance = E, n.faceIndex = T, s && (s.point ? s.point.copy(v) : s.point = v.clone(), s.point.applyMatrix4(Cs), _.applyMatrix4(Cs), s.distance = _.sub(s.point).length(), s.faceIndex = S), n);
3494
3495
  }
3495
3496
  function Yr(i, e, t) {
3496
3497
  return i === null ? null : (i.point.applyMatrix4(e.matrixWorld), i.distance = i.point.distanceTo(t.ray.origin), i.object = e, i);
@@ -3561,9 +3562,9 @@ class Zs extends il {
3561
3562
  function c(u) {
3562
3563
  for (let d = 0; d < u.length; d++) {
3563
3564
  const h = u[d], p = new Uint32Array(h), f = new Uint16Array(h);
3564
- for (let y = 0, b = h.byteLength / qe; y < b; y++) {
3565
- const S = Oe * y, v = 2 * S;
3566
- De(v, f) || (p[S + 6] = p[S + 6] / Oe - y);
3565
+ for (let y = 0, _ = h.byteLength / qe; y < _; y++) {
3566
+ const b = Oe * y, v = 2 * b;
3567
+ De(v, f) || (p[b + 6] = p[b + 6] / Oe - y);
3567
3568
  }
3568
3569
  }
3569
3570
  }
@@ -3607,11 +3608,11 @@ class Zs extends il {
3607
3608
  let d = u + 0, h = u + 1, p = u + 2;
3608
3609
  a && (d = a[d], h = a[h], p = a[p]);
3609
3610
  for (let f = 0; f < 3; f++) {
3610
- const y = o[pi[f]](d), b = o[pi[f]](h), S = o[pi[f]](p);
3611
+ const y = o[pi[f]](d), _ = o[pi[f]](h), b = o[pi[f]](p);
3611
3612
  let v = y;
3612
- b < v && (v = b), S < v && (v = S);
3613
+ _ < v && (v = _), b < v && (v = b);
3613
3614
  let E = y;
3614
- b > E && (E = b), S > E && (E = S), t[n + f] = v, t[n + f + 3] = E;
3615
+ _ > E && (E = _), b > E && (E = b), t[n + f] = v, t[n + f + 3] = E;
3615
3616
  }
3616
3617
  return t;
3617
3618
  }
@@ -3627,13 +3628,13 @@ class Zs extends il {
3627
3628
  let h = 3;
3628
3629
  o.isInterleavedBufferAttribute && (h = o.data.stride);
3629
3630
  const p = ["getX", "getY", "getZ"], f = n.offset;
3630
- for (let y = e, b = e + t; y < b; y++) {
3631
+ for (let y = e, _ = e + t; y < _; y++) {
3631
3632
  const v = (r ? r[y] : y) * 3, E = (y - f) * 6;
3632
- let T = v + 0, _ = v + 1, x = v + 2;
3633
- a && (T = a[T], _ = a[_], x = a[x]), c || (T = T * h + d, _ = _ * h + d, x = x * h + d);
3633
+ let T = v + 0, S = v + 1, x = v + 2;
3634
+ a && (T = a[T], S = a[S], x = a[x]), c || (T = T * h + d, S = S * h + d, x = x * h + d);
3634
3635
  for (let P = 0; P < 3; P++) {
3635
3636
  let I, M, O;
3636
- c ? (I = o[p[P]](T), M = o[p[P]](_), O = o[p[P]](x)) : (I = u[T + P], M = u[_ + P], O = u[x + P]);
3637
+ c ? (I = o[p[P]](T), M = o[p[P]](S), O = o[p[P]](x)) : (I = u[T + P], M = u[S + P], O = u[x + P]);
3637
3638
  let C = I;
3638
3639
  M < C && (C = M), O < C && (C = O);
3639
3640
  let k = I;
@@ -3722,7 +3723,7 @@ class Zs extends il {
3722
3723
  raycastFirst(e, t = vi, n = 0, s = 1 / 0) {
3723
3724
  const r = this._roots;
3724
3725
  let o = null;
3725
- const a = this.indirect ? Pl : Sl;
3726
+ const a = this.indirect ? Pl : bl;
3726
3727
  for (let c = 0, u = r.length; c < u; c++) {
3727
3728
  const d = a(this, c, t, e, n, s);
3728
3729
  d != null && (o == null || d.distance < o.distance) && (o = d);
@@ -3743,7 +3744,7 @@ class Zs extends il {
3743
3744
  */
3744
3745
  intersectsGeometry(e, t) {
3745
3746
  let n = !1;
3746
- const s = this._roots, r = this.indirect ? Ll : _l;
3747
+ const s = this._roots, r = this.indirect ? Ll : Sl;
3747
3748
  for (let o = 0, a = s.length; o < a && (n = r(this, o, e, t), !n); o++)
3748
3749
  ;
3749
3750
  return n;
@@ -3796,32 +3797,32 @@ class Zs extends il {
3796
3797
  intersectsTriangles: r
3797
3798
  } = n;
3798
3799
  const o = ht.getPrimitive(), a = this.geometry.index, c = this.geometry.attributes.position, u = this.indirect ? (y) => {
3799
- const b = this.resolveTriangleIndex(y);
3800
- Ie(o, b * 3, a, c);
3800
+ const _ = this.resolveTriangleIndex(y);
3801
+ Ie(o, _ * 3, a, c);
3801
3802
  } : (y) => {
3802
3803
  Ie(o, y * 3, a, c);
3803
3804
  }, d = ht.getPrimitive(), h = e.geometry.index, p = e.geometry.attributes.position, f = e.indirect ? (y) => {
3804
- const b = e.resolveTriangleIndex(y);
3805
- Ie(d, b * 3, h, p);
3805
+ const _ = e.resolveTriangleIndex(y);
3806
+ Ie(d, _ * 3, h, p);
3806
3807
  } : (y) => {
3807
3808
  Ie(d, y * 3, h, p);
3808
3809
  };
3809
3810
  if (r) {
3810
3811
  if (!(e instanceof Zs))
3811
3812
  throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');
3812
- const y = (b, S, v, E, T, _, x, P) => {
3813
+ const y = (_, b, v, E, T, S, x, P) => {
3813
3814
  for (let I = v, M = v + E; I < M; I++) {
3814
3815
  f(I), d.a.applyMatrix4(t), d.b.applyMatrix4(t), d.c.applyMatrix4(t), d.needsUpdate = !0;
3815
- for (let O = b, C = b + S; O < C; O++)
3816
- if (u(O), o.needsUpdate = !0, r(o, d, O, I, T, _, x, P))
3816
+ for (let O = _, C = _ + b; O < C; O++)
3817
+ if (u(O), o.needsUpdate = !0, r(o, d, O, I, T, S, x, P))
3817
3818
  return !0;
3818
3819
  }
3819
3820
  return !1;
3820
3821
  };
3821
3822
  if (s) {
3822
- const b = s;
3823
- s = function(S, v, E, T, _, x, P, I) {
3824
- return b(S, v, E, T, _, x, P, I) ? !0 : y(S, v, E, T, _, x, P, I);
3823
+ const _ = s;
3824
+ s = function(b, v, E, T, S, x, P, I) {
3825
+ return _(b, v, E, T, S, x, P, I) ? !0 : y(b, v, E, T, S, x, P, I);
3825
3826
  };
3826
3827
  } else
3827
3828
  s = y;
@@ -3929,7 +3930,7 @@ class Zs extends il {
3929
3930
  );
3930
3931
  }
3931
3932
  }
3932
- const Sn = {
3933
+ const bn = {
3933
3934
  Mesh: wt.prototype.raycast,
3934
3935
  Line: Ji.prototype.raycast,
3935
3936
  LineSegments: $i.prototype.raycast,
@@ -3947,15 +3948,15 @@ function zl(i, e) {
3947
3948
  else {
3948
3949
  let n;
3949
3950
  if (this instanceof wt)
3950
- n = Sn.Mesh;
3951
+ n = bn.Mesh;
3951
3952
  else if (this instanceof $i)
3952
- n = Sn.LineSegments;
3953
+ n = bn.LineSegments;
3953
3954
  else if (this instanceof Qi)
3954
- n = Sn.LineLoop;
3955
+ n = bn.LineLoop;
3955
3956
  else if (this instanceof Ji)
3956
- n = Sn.Line;
3957
+ n = bn.Line;
3957
3958
  else if (this instanceof er)
3958
- n = Sn.Points;
3959
+ n = bn.Points;
3959
3960
  else
3960
3961
  throw new Error("BVH: Fallback raycast function not found.");
3961
3962
  n.call(this, i, e);
@@ -3967,7 +3968,7 @@ function Bl(i, e) {
3967
3968
  const t = this.boundsTrees, n = this._drawInfo || this._instanceInfo, s = this._drawRanges || this._geometryInfo, r = this.matrixWorld;
3968
3969
  He.material = this.material, He.geometry = this.geometry;
3969
3970
  const o = He.geometry.boundsTree, a = He.geometry.drawRange;
3970
- He.geometry.boundingSphere === null && (He.geometry.boundingSphere = new bo());
3971
+ He.geometry.boundingSphere === null && (He.geometry.boundingSphere = new _o());
3971
3972
  for (let c = 0, u = n.length; c < u; c++) {
3972
3973
  if (!this.getVisibleAt(c))
3973
3974
  continue;
@@ -3986,7 +3987,7 @@ function Bl(i, e) {
3986
3987
  }
3987
3988
  He.geometry.boundsTree = o, He.geometry.drawRange = a, He.material = null, He.geometry = null;
3988
3989
  } else
3989
- Sn.BatchedMesh.call(this, i, e);
3990
+ bn.BatchedMesh.call(this, i, e);
3990
3991
  }
3991
3992
  function Ho(i) {
3992
3993
  i.traverse((e) => {
@@ -5275,14 +5276,14 @@ class uh {
5275
5276
  return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((u) => {
5276
5277
  const d = u.pop(), h = d.isGroup ? d.children : [d], p = u[0].count, f = [];
5277
5278
  for (const y of h) {
5278
- const b = new ut(), S = new $(), v = new Rn(), E = new $(1, 1, 1), T = new Ro(y.geometry, y.material, p);
5279
- for (let _ = 0; _ < p; _++)
5280
- c.TRANSLATION && S.fromBufferAttribute(c.TRANSLATION, _), c.ROTATION && v.fromBufferAttribute(c.ROTATION, _), c.SCALE && E.fromBufferAttribute(c.SCALE, _), T.setMatrixAt(_, b.compose(S, v, E));
5281
- for (const _ in c)
5282
- if (_ === "_COLOR_0") {
5283
- const x = c[_];
5279
+ const _ = new ut(), b = new $(), v = new Rn(), E = new $(1, 1, 1), T = new Ro(y.geometry, y.material, p);
5280
+ for (let S = 0; S < p; S++)
5281
+ c.TRANSLATION && b.fromBufferAttribute(c.TRANSLATION, S), c.ROTATION && v.fromBufferAttribute(c.ROTATION, S), c.SCALE && E.fromBufferAttribute(c.SCALE, S), T.setMatrixAt(S, _.compose(b, v, E));
5282
+ for (const S in c)
5283
+ if (S === "_COLOR_0") {
5284
+ const x = c[S];
5284
5285
  T.instanceColor = new tc(x.array, x.itemSize, x.normalized);
5285
- } else _ !== "TRANSLATION" && _ !== "ROTATION" && _ !== "SCALE" && y.geometry.setAttribute(_, c[_]);
5286
+ } else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && y.geometry.setAttribute(S, c[S]);
5286
5287
  tr.prototype.copy.call(T, y), this.parser.assignFinalMaterial(T), f.push(T);
5287
5288
  }
5288
5289
  return d.isGroup ? (d.clear(), d.add(...f), d) : f[0];
@@ -5344,8 +5345,8 @@ class ph {
5344
5345
  return new Promise(function(h, p) {
5345
5346
  s.decodeDracoFile(d, function(f) {
5346
5347
  for (const y in f.attributes) {
5347
- const b = f.attributes[y], S = c[y];
5348
- S !== void 0 && (b.normalized = S);
5348
+ const _ = f.attributes[y], b = c[y];
5349
+ b !== void 0 && (_.normalized = b);
5349
5350
  }
5350
5351
  h(f);
5351
5352
  }, a, u, Ge, p);
@@ -5366,7 +5367,7 @@ class mh {
5366
5367
  this.name = ce.KHR_MESH_QUANTIZATION;
5367
5368
  }
5368
5369
  }
5369
- class Vo extends _c {
5370
+ class Vo extends Sc {
5370
5371
  constructor(e, t, n, s) {
5371
5372
  super(e, t, n, s);
5372
5373
  }
@@ -5377,10 +5378,10 @@ class Vo extends _c {
5377
5378
  return t;
5378
5379
  }
5379
5380
  interpolate_(e, t, n, s) {
5380
- const r = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = a * 2, u = a * 3, d = s - t, h = (n - t) / d, p = h * h, f = p * h, y = e * u, b = y - u, S = -2 * f + 3 * p, v = f - p, E = 1 - S, T = v - p + h;
5381
- for (let _ = 0; _ !== a; _++) {
5382
- const x = o[b + _ + a], P = o[b + _ + c] * d, I = o[y + _ + a], M = o[y + _] * d;
5383
- r[_] = E * x + T * P + S * I + v * M;
5381
+ const r = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = a * 2, u = a * 3, d = s - t, h = (n - t) / d, p = h * h, f = p * h, y = e * u, _ = y - u, b = -2 * f + 3 * p, v = f - p, E = 1 - b, T = v - p + h;
5382
+ for (let S = 0; S !== a; S++) {
5383
+ const x = o[_ + S + a], P = o[_ + S + c] * d, I = o[y + S + a], M = o[y + S] * d;
5384
+ r[S] = E * x + T * P + b * I + v * M;
5384
5385
  }
5385
5386
  return r;
5386
5387
  }
@@ -5447,7 +5448,7 @@ const ct = {
5447
5448
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
5448
5449
  // keyframe track will be initialized with a default interpolation type, then modified.
5449
5450
  LINEAR: Io,
5450
- STEP: Sc
5451
+ STEP: bc
5451
5452
  }, mi = {
5452
5453
  OPAQUE: "OPAQUE",
5453
5454
  MASK: "MASK",
@@ -5503,7 +5504,7 @@ function Th(i, e, t) {
5503
5504
  return n && (i.morphAttributes.position = d), s && (i.morphAttributes.normal = h), r && (i.morphAttributes.color = p), i.morphTargetsRelative = !0, i;
5504
5505
  });
5505
5506
  }
5506
- function Sh(i, e) {
5507
+ function bh(i, e) {
5507
5508
  if (i.updateMorphTargets(), e.weights !== void 0)
5508
5509
  for (let t = 0, n = e.weights.length; t < n; t++)
5509
5510
  i.morphTargetInfluences[t] = e.weights[t];
@@ -5517,7 +5518,7 @@ function Sh(i, e) {
5517
5518
  console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
5518
5519
  }
5519
5520
  }
5520
- function _h(i) {
5521
+ function Sh(i) {
5521
5522
  let e;
5522
5523
  const t = i.extensions && i.extensions[ce.KHR_DRACO_MESH_COMPRESSION];
5523
5524
  if (t ? e = "draco:" + t.bufferView + ":" + t.indices + ":" + gi(t.attributes) : e = i.indices + ":" + gi(i.attributes) + ":" + i.mode, i.targets !== void 0)
@@ -5546,7 +5547,7 @@ function ji(i) {
5546
5547
  throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
5547
5548
  }
5548
5549
  }
5549
- function bh(i) {
5550
+ function _h(i) {
5550
5551
  return i.search(/\.jpe?g($|\?)/i) > 0 || i.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : i.search(/\.webp($|\?)/i) > 0 || i.search(/^data\:image\/webp/) === 0 ? "image/webp" : i.search(/\.ktx2($|\?)/i) > 0 || i.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
5551
5552
  }
5552
5553
  const xh = new ut();
@@ -5806,23 +5807,23 @@ class vh {
5806
5807
  const r = [];
5807
5808
  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) {
5808
5809
  const a = o[0], c = fi[s.type], u = vn[s.componentType], d = u.BYTES_PER_ELEMENT, h = d * c, p = s.byteOffset || 0, f = s.bufferView !== void 0 ? n.bufferViews[s.bufferView].byteStride : void 0, y = s.normalized === !0;
5809
- let b, S;
5810
+ let _, b;
5810
5811
  if (f && f !== h) {
5811
5812
  const v = Math.floor(p / f), E = "InterleavedBuffer:" + s.bufferView + ":" + s.componentType + ":" + v + ":" + s.count;
5812
5813
  let T = t.cache.get(E);
5813
- T || (b = new u(a, v * f, s.count * f / d), T = new ic(b, f / d), t.cache.add(E, T)), S = new rc(T, c, p % f / d, y);
5814
+ T || (_ = new u(a, v * f, s.count * f / d), T = new ic(_, f / d), t.cache.add(E, T)), b = new rc(T, c, p % f / d, y);
5814
5815
  } else
5815
- a === null ? b = new u(s.count * c) : b = new u(a, p, s.count * c), S = new Kn(b, c, y);
5816
+ a === null ? _ = new u(s.count * c) : _ = new u(a, p, s.count * c), b = new Kn(_, c, y);
5816
5817
  if (s.sparse !== void 0) {
5817
- const v = fi.SCALAR, E = vn[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, _ = s.sparse.values.byteOffset || 0, x = new E(o[1], T, s.sparse.count * v), P = new u(o[2], _, s.sparse.count * c);
5818
- a !== null && (S = new Kn(S.array.slice(), S.itemSize, S.normalized)), S.normalized = !1;
5818
+ const v = fi.SCALAR, E = vn[s.sparse.indices.componentType], T = s.sparse.indices.byteOffset || 0, S = s.sparse.values.byteOffset || 0, x = new E(o[1], T, s.sparse.count * v), P = new u(o[2], S, s.sparse.count * c);
5819
+ a !== null && (b = new Kn(b.array.slice(), b.itemSize, b.normalized)), b.normalized = !1;
5819
5820
  for (let I = 0, M = x.length; I < M; I++) {
5820
5821
  const O = x[I];
5821
- if (S.setX(O, P[I * c]), c >= 2 && S.setY(O, P[I * c + 1]), c >= 3 && S.setZ(O, P[I * c + 2]), c >= 4 && S.setW(O, P[I * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
5822
+ if (b.setX(O, P[I * c]), c >= 2 && b.setY(O, P[I * c + 1]), c >= 3 && b.setZ(O, P[I * c + 2]), c >= 4 && b.setW(O, P[I * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
5822
5823
  }
5823
- S.normalized = y;
5824
+ b.normalized = y;
5824
5825
  }
5825
- return S;
5826
+ return b;
5826
5827
  });
5827
5828
  }
5828
5829
  /**
@@ -5871,13 +5872,13 @@ class vh {
5871
5872
  const d = Promise.resolve(c).then(function(h) {
5872
5873
  return new Promise(function(p, f) {
5873
5874
  let y = p;
5874
- t.isImageBitmapLoader === !0 && (y = function(b) {
5875
- const S = new Rr(b);
5876
- S.needsUpdate = !0, p(S);
5875
+ t.isImageBitmapLoader === !0 && (y = function(_) {
5876
+ const b = new Rr(_);
5877
+ b.needsUpdate = !0, p(b);
5877
5878
  }), t.load(Xn.resolveURL(h, r.path), y, void 0, f);
5878
5879
  });
5879
5880
  }).then(function(h) {
5880
- return u === !0 && a.revokeObjectURL(c), Rt(h, o), h.userData.mimeType = o.mimeType || bh(o.uri), h;
5881
+ return u === !0 && a.revokeObjectURL(c), Rt(h, o), h.userData.mimeType = o.mimeType || _h(o.uri), h;
5881
5882
  }).catch(function(h) {
5882
5883
  throw console.error("THREE.GLTFLoader: Couldn't load texture", c), h;
5883
5884
  });
@@ -5967,7 +5968,7 @@ class vh {
5967
5968
  return p.extendMaterialParams && p.extendMaterialParams(e, a);
5968
5969
  })));
5969
5970
  }
5970
- r.doubleSided === !0 && (a.side = So);
5971
+ r.doubleSided === !0 && (a.side = bo);
5971
5972
  const d = r.alphaMode || mi.OPAQUE;
5972
5973
  if (d === mi.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === mi.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && o !== Wn && (u.push(t.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new fe(1, 1), r.normalTexture.scale !== void 0)) {
5973
5974
  const h = r.normalTexture.scale;
@@ -6011,7 +6012,7 @@ class vh {
6011
6012
  }
6012
6013
  const o = [];
6013
6014
  for (let a = 0, c = e.length; a < c; a++) {
6014
- const u = e[a], d = _h(u), h = s[d];
6015
+ const u = e[a], d = Sh(u), h = s[d];
6015
6016
  if (h)
6016
6017
  o.push(h.promise);
6017
6018
  else {
@@ -6037,22 +6038,22 @@ class vh {
6037
6038
  return a.push(t.loadGeometries(o)), Promise.all(a).then(function(c) {
6038
6039
  const u = c.slice(0, c.length - 1), d = c[c.length - 1], h = [];
6039
6040
  for (let f = 0, y = d.length; f < y; f++) {
6040
- const b = d[f], S = o[f];
6041
+ const _ = d[f], b = o[f];
6041
6042
  let v;
6042
6043
  const E = u[f];
6043
- if (S.mode === ct.TRIANGLES || S.mode === ct.TRIANGLE_STRIP || S.mode === ct.TRIANGLE_FAN || S.mode === void 0)
6044
- v = r.isSkinnedMesh === !0 ? new mc(b, E) : new wt(b, E), v.isSkinnedMesh === !0 && v.normalizeSkinWeights(), S.mode === ct.TRIANGLE_STRIP ? v.geometry = to(v.geometry, xo) : S.mode === ct.TRIANGLE_FAN && (v.geometry = to(v.geometry, Ai));
6045
- else if (S.mode === ct.LINES)
6046
- v = new $i(b, E);
6047
- else if (S.mode === ct.LINE_STRIP)
6048
- v = new Ji(b, E);
6049
- else if (S.mode === ct.LINE_LOOP)
6050
- v = new Qi(b, E);
6051
- else if (S.mode === ct.POINTS)
6052
- v = new er(b, E);
6044
+ if (b.mode === ct.TRIANGLES || b.mode === ct.TRIANGLE_STRIP || b.mode === ct.TRIANGLE_FAN || b.mode === void 0)
6045
+ v = r.isSkinnedMesh === !0 ? new mc(_, E) : new wt(_, E), v.isSkinnedMesh === !0 && v.normalizeSkinWeights(), b.mode === ct.TRIANGLE_STRIP ? v.geometry = to(v.geometry, xo) : b.mode === ct.TRIANGLE_FAN && (v.geometry = to(v.geometry, Ai));
6046
+ else if (b.mode === ct.LINES)
6047
+ v = new $i(_, E);
6048
+ else if (b.mode === ct.LINE_STRIP)
6049
+ v = new Ji(_, E);
6050
+ else if (b.mode === ct.LINE_LOOP)
6051
+ v = new Qi(_, E);
6052
+ else if (b.mode === ct.POINTS)
6053
+ v = new er(_, E);
6053
6054
  else
6054
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + S.mode);
6055
- Object.keys(v.geometry.morphAttributes).length > 0 && Sh(v, r), v.name = t.createUniqueName(r.name || "mesh_" + e), Rt(v, r), S.extensions && tn(s, v, S), t.assignFinalMaterial(v), h.push(v);
6055
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + b.mode);
6056
+ Object.keys(v.geometry.morphAttributes).length > 0 && bh(v, r), v.name = t.createUniqueName(r.name || "mesh_" + e), Rt(v, r), b.extensions && tn(s, v, b), t.assignFinalMaterial(v), h.push(v);
6056
6057
  }
6057
6058
  for (let f = 0, y = h.length; f < y; f++)
6058
6059
  t.associations.set(h[f], {
@@ -6119,8 +6120,8 @@ class vh {
6119
6120
  loadAnimation(e) {
6120
6121
  const t = this.json, n = this, s = t.animations[e], r = s.name ? s.name : "animation_" + e, o = [], a = [], c = [], u = [], d = [];
6121
6122
  for (let h = 0, p = s.channels.length; h < p; h++) {
6122
- const f = s.channels[h], y = s.samplers[f.sampler], b = f.target, S = b.node, v = s.parameters !== void 0 ? s.parameters[y.input] : y.input, E = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
6123
- b.node !== void 0 && (o.push(this.getDependency("node", S)), a.push(this.getDependency("accessor", v)), c.push(this.getDependency("accessor", E)), u.push(y), d.push(b));
6123
+ const f = s.channels[h], y = s.samplers[f.sampler], _ = f.target, b = _.node, v = s.parameters !== void 0 ? s.parameters[y.input] : y.input, E = s.parameters !== void 0 ? s.parameters[y.output] : y.output;
6124
+ _.node !== void 0 && (o.push(this.getDependency("node", b)), a.push(this.getDependency("accessor", v)), c.push(this.getDependency("accessor", E)), u.push(y), d.push(_));
6124
6125
  }
6125
6126
  return Promise.all([
6126
6127
  Promise.all(o),
@@ -6129,9 +6130,9 @@ class vh {
6129
6130
  Promise.all(u),
6130
6131
  Promise.all(d)
6131
6132
  ]).then(function(h) {
6132
- const p = h[0], f = h[1], y = h[2], b = h[3], S = h[4], v = [];
6133
- for (let T = 0, _ = p.length; T < _; T++) {
6134
- const x = p[T], P = f[T], I = y[T], M = b[T], O = S[T];
6133
+ const p = h[0], f = h[1], y = h[2], _ = h[3], b = h[4], v = [];
6134
+ for (let T = 0, S = p.length; T < S; T++) {
6135
+ const x = p[T], P = f[T], I = y[T], M = _[T], O = b[T];
6135
6136
  if (x === void 0) continue;
6136
6137
  x.updateMatrix && x.updateMatrix();
6137
6138
  const C = n._createAnimationTracks(x, P, I, M, O);
@@ -6281,13 +6282,13 @@ class vh {
6281
6282
  }
6282
6283
  const h = s.interpolation !== void 0 ? wh[s.interpolation] : Io, p = this._getArrayFromAccessor(n);
6283
6284
  for (let f = 0, y = c.length; f < y; f++) {
6284
- const b = new d(
6285
+ const _ = new d(
6285
6286
  c[f] + "." + Ht[r.path],
6286
6287
  t.array,
6287
6288
  p,
6288
6289
  h
6289
6290
  );
6290
- s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(b), o.push(b);
6291
+ s.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(_), o.push(_);
6291
6292
  }
6292
6293
  return o;
6293
6294
  }
@@ -6309,7 +6310,7 @@ class vh {
6309
6310
  }
6310
6311
  }
6311
6312
  function Ah(i, e, t) {
6312
- const n = e.attributes, s = new _t();
6313
+ const n = e.attributes, s = new St();
6313
6314
  if (n.POSITION !== void 0) {
6314
6315
  const a = t.json.accessors[n.POSITION], c = a.min, u = a.max;
6315
6316
  if (c !== void 0 && u !== void 0) {
@@ -6335,8 +6336,8 @@ function Ah(i, e, t) {
6335
6336
  const p = t.json.accessors[h.POSITION], f = p.min, y = p.max;
6336
6337
  if (f !== void 0 && y !== void 0) {
6337
6338
  if (c.setX(Math.max(Math.abs(f[0]), Math.abs(y[0]))), c.setY(Math.max(Math.abs(f[1]), Math.abs(y[1]))), c.setZ(Math.max(Math.abs(f[2]), Math.abs(y[2]))), p.normalized) {
6338
- const b = ji(vn[p.componentType]);
6339
- c.multiplyScalar(b);
6339
+ const _ = ji(vn[p.componentType]);
6340
+ c.multiplyScalar(_);
6340
6341
  }
6341
6342
  a.max(c);
6342
6343
  } else
@@ -6346,7 +6347,7 @@ function Ah(i, e, t) {
6346
6347
  s.expandByVector(a);
6347
6348
  }
6348
6349
  i.boundingBox = s;
6349
- const o = new bo();
6350
+ const o = new _o();
6350
6351
  s.getCenter(o.center), o.radius = s.min.distanceTo(s.max) / 2, i.boundingSphere = o;
6351
6352
  }
6352
6353
  function oo(i, e, t) {
@@ -7006,7 +7007,7 @@ function Gh(i) {
7006
7007
  function jh(i) {
7007
7008
  i.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, { passive: !0, capture: !0 }));
7008
7009
  }
7009
- const wi = new ts(), Ns = new bc(), wn = new fe(), Ei = new $();
7010
+ const wi = new ts(), Ns = new _c(), wn = new fe(), Ei = new $();
7010
7011
  class Vh extends Ko {
7011
7012
  constructor(e, t) {
7012
7013
  super(e, t), this.screenSpacePanning = !1, this.mouseButtons = { LEFT: Be.PAN, MIDDLE: Be.DOLLY, RIGHT: Be.ROTATE }, this.touches = { ONE: Ye.PAN, TWO: Ye.DOLLY_ROTATE }, this._panWorldStart = new $();
@@ -7234,7 +7235,7 @@ const Vi = "contact-shadow-baked", nn = "contact-shadow-live", dr = "softboxCont
7234
7235
  const t = new g.Box3().setFromObject(e);
7235
7236
  if (t.isEmpty() || !Number.isFinite(t.min.x) || !Number.isFinite(t.max.x))
7236
7237
  return null;
7237
- const n = t.getSize(new g.Vector3()), s = t.getCenter(new g.Vector3()), o = Math.max(Math.max(n.x, n.z) * 1.6 + n.y, 0.05);
7238
+ const n = t.getSize(new g.Vector3()), s = t.getCenter(new g.Vector3()), o = Math.max(Math.max(n.x, n.z) * 1.4 + n.y * 0.65, 0.05);
7238
7239
  return { center: s, halfExtent: o, objectHeight: n.y };
7239
7240
  }
7240
7241
  accumulateShadowPasses(e, t, n, s, r, o) {
@@ -7256,15 +7257,15 @@ const Vi = "contact-shadow-baked", nn = "contact-shadow-live", dr = "softboxCont
7256
7257
  p.rotation.x = -Math.PI / 2, p.position.set(s.center.x, 0, s.center.z), p.receiveShadow = !0, a.add(p);
7257
7258
  const f = this.createBakeCamera(s);
7258
7259
  a.add(f);
7259
- const y = e.getRenderTarget(), b = e.autoClear, S = e.getClearColor(new g.Color()), v = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
7260
+ const y = e.getRenderTarget(), _ = e.autoClear, b = e.getClearColor(new g.Color()), v = e.getClearAlpha(), E = e.shadowMap.autoUpdate;
7260
7261
  try {
7261
7262
  e.shadowMap.autoUpdate = !0, e.setRenderTarget(r), e.setClearColor(0, 0), e.clear(!0, !1, !1), e.autoClear = !1;
7262
7263
  const T = this.explicitPasses ?? this.measureAffordablePasses(e, a, f, n, d, r);
7263
7264
  h.opacity = 1 / T;
7264
- for (const _ of this.sampleLightPositions(n, T))
7265
- d.position.copy(_), e.render(a, f);
7265
+ for (const S of this.sampleLightPositions(n, T))
7266
+ d.position.copy(S), e.render(a, f);
7266
7267
  } finally {
7267
- e.autoClear = b, e.setClearColor(S, v), e.setRenderTarget(y), e.shadowMap.autoUpdate = E, this.restoreColorWrite(u), c ? c.add(t) : a.remove(t), d.dispose(), h.dispose();
7268
+ e.autoClear = _, e.setClearColor(b, v), e.setRenderTarget(y), e.shadowMap.autoUpdate = E, this.restoreColorWrite(u), c ? c.add(t) : a.remove(t), d.dispose(), h.dispose();
7268
7269
  }
7269
7270
  }
7270
7271
  /**
@@ -7313,7 +7314,7 @@ const Vi = "contact-shadow-baked", nn = "contact-shadow-live", dr = "softboxCont
7313
7314
  t.castShadow = !0, t.shadow.mapSize.set(
7314
7315
  xe.BAKE_SHADOW_MAP_SIZE,
7315
7316
  xe.BAKE_SHADOW_MAP_SIZE
7316
- ), t.shadow.bias = e.shadow.bias, t.shadow.normalBias = e.shadow.normalBias, t.shadow.radius = 4;
7317
+ ), t.shadow.bias = e.shadow.bias, t.shadow.normalBias = e.shadow.normalBias, t.shadow.radius = 6;
7317
7318
  const n = e.shadow.camera, s = t.shadow.camera;
7318
7319
  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;
7319
7320
  }
@@ -7343,16 +7344,16 @@ const Vi = "contact-shadow-baked", nn = "contact-shadow-live", dr = "softboxCont
7343
7344
  n.clone().addScaledVector(c, E * Math.cos(T)).addScaledVector(u, E * Math.sin(T))
7344
7345
  );
7345
7346
  }
7346
- const b = Math.sin(
7347
+ const _ = Math.sin(
7347
7348
  g.MathUtils.degToRad(xe.AMBIENT_MIN_ELEVATION_DEGREES)
7348
- ), S = 0.98;
7349
+ ), b = 0.98;
7349
7350
  for (let v = 0; v < d; v++) {
7350
- const E = Math.sqrt((v + 0.5) / d), T = b + (S - b) * E, _ = Math.sqrt(1 - T * T), x = v * ho;
7351
+ const E = Math.sqrt((v + 0.5) / d), T = _ + (b - _) * E, S = Math.sqrt(1 - T * T), x = v * ho;
7351
7352
  y.push(
7352
7353
  new g.Vector3(
7353
- _ * Math.cos(x),
7354
+ S * Math.cos(x),
7354
7355
  T,
7355
- _ * Math.sin(x)
7356
+ S * Math.sin(x)
7356
7357
  ).multiplyScalar(o).add(s)
7357
7358
  );
7358
7359
  }
@@ -7398,7 +7399,7 @@ const Vi = "contact-shadow-baked", nn = "contact-shadow-live", dr = "softboxCont
7398
7399
  });
7399
7400
  }
7400
7401
  };
7401
- xe.AMBIENT_RATIO = 0.45, xe.LIGHT_APERTURE_DEGREES = 9, xe.AMBIENT_MIN_ELEVATION_DEGREES = 55, xe.ACCUMULATION_TEXTURE_SIZE = 1024, xe.BAKE_SHADOW_MAP_SIZE = 1024, xe.SHADOW_STRENGTH = 0.85, xe.BAKE_BUDGET_MS = 100, xe.MIN_PASSES = 24, xe.MAX_PASSES = 96;
7402
+ xe.AMBIENT_RATIO = 0.45, xe.LIGHT_APERTURE_DEGREES = 13, xe.AMBIENT_MIN_ELEVATION_DEGREES = 55, xe.ACCUMULATION_TEXTURE_SIZE = 1024, xe.BAKE_SHADOW_MAP_SIZE = 1024, xe.SHADOW_STRENGTH = 0.55, xe.BAKE_BUDGET_MS = 100, xe.MIN_PASSES = 24, xe.MAX_PASSES = 96;
7402
7403
  let Wi = xe;
7403
7404
  const Mn = (i, e) => {
7404
7405
  if (i && typeof i == "object") {
@@ -7414,7 +7415,7 @@ function Pt(i) {
7414
7415
  function ns(i) {
7415
7416
  return Mn(i, "getThreeCamera") ?? (i instanceof g.Camera ? i : null);
7416
7417
  }
7417
- function St(i) {
7418
+ function bt(i) {
7418
7419
  return Mn(i, "getThreeScene") ?? (i instanceof g.Scene ? i : null);
7419
7420
  }
7420
7421
  function Kh(i) {
@@ -7456,13 +7457,13 @@ class Yh {
7456
7457
  for (let h = -n; h <= n; h++) {
7457
7458
  const p = Math.max(-n, -h - n), f = Math.min(n, -h + n);
7458
7459
  for (let y = p; y <= f; y++) {
7459
- const b = c * (h + y / 2), S = u * 0.75 * y, v = [], E = Math.PI * 2 / 6;
7460
+ const _ = c * (h + y / 2), b = u * 0.75 * y, v = [], E = Math.PI * 2 / 6;
7460
7461
  for (let x = 0; x <= 6; x++) {
7461
- const P = x * E + Math.PI / 6, I = b + s * Math.cos(P), M = S + s * Math.sin(P);
7462
+ const P = x * E + Math.PI / 6, I = _ + s * Math.cos(P), M = b + s * Math.sin(P);
7462
7463
  v.push(new g.Vector3(I, 0, M));
7463
7464
  }
7464
- const T = new g.BufferGeometry().setFromPoints(v), _ = new g.Line(T, a);
7465
- t.add(_);
7465
+ const T = new g.BufferGeometry().setFromPoints(v), S = new g.Line(T, a);
7466
+ t.add(S);
7466
7467
  }
7467
7468
  }
7468
7469
  return t;
@@ -7601,13 +7602,13 @@ class Qh {
7601
7602
  this.name = "Hexagonal Glass Grid";
7602
7603
  }
7603
7604
  createGrid(e) {
7604
- var y, b, S, v, E, T, _;
7605
- 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, u = new qh(new g.Vector3(0, 0, 0), s, r, {
7606
- metalness: (S = e.styleOptions) == null ? void 0 : S.metalness,
7605
+ var y, _, b, v, E, T, S;
7606
+ const t = new g.Group(), n = ((y = e.styleOptions) == null ? void 0 : y.hexRadius) ?? Math.floor(e.divisions / 2), s = ((_ = e.styleOptions) == null ? void 0 : _.tileSize) || 1, r = String(e.color || "#ffffff"), o = on.getGridSpacing(s), a = o.width, c = o.height, u = new qh(new g.Vector3(0, 0, 0), s, r, {
7607
+ metalness: (b = e.styleOptions) == null ? void 0 : b.metalness,
7607
7608
  roughness: (v = e.styleOptions) == null ? void 0 : v.roughness,
7608
7609
  transmission: (E = e.styleOptions) == null ? void 0 : E.transmission,
7609
7610
  thickness: (T = e.styleOptions) == null ? void 0 : T.thickness,
7610
- ior: (_ = e.styleOptions) == null ? void 0 : _.ior
7611
+ ior: (S = e.styleOptions) == null ? void 0 : S.ior
7611
7612
  }), d = u.createGeometry(), h = on.getYPosition(s), p = [];
7612
7613
  for (let x = -n; x <= n; x++) {
7613
7614
  const P = Math.max(-n, -x - n), I = Math.min(n, -x + n);
@@ -7635,11 +7636,11 @@ class Jh {
7635
7636
  this.name = "Stone Tile Grid", this.textureLoader = new g.TextureLoader();
7636
7637
  }
7637
7638
  createGrid(e) {
7638
- var f, y, b, S;
7639
- 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 = ((f = e.styleOptions) == null ? void 0 : f.height) || r * 0.05, u = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((b = e.styleOptions) == null ? void 0 : b.randomHeight) || !1, h = ((S = e.styleOptions) == null ? void 0 : S.randomRotation) || !1, p = this.createStoneMaterial(e);
7639
+ var f, y, _, b;
7640
+ 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 = ((f = e.styleOptions) == null ? void 0 : f.height) || r * 0.05, u = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, d = ((_ = e.styleOptions) == null ? void 0 : _.randomHeight) || !1, h = ((b = e.styleOptions) == null ? void 0 : b.randomRotation) || !1, p = this.createStoneMaterial(e);
7640
7641
  for (let v = 0; v < s; v++)
7641
7642
  for (let E = 0; E < s; E++) {
7642
- const T = (v - s / 2) * r + r / 2, _ = (E - s / 2) * r + r / 2, x = d ? c * (0.8 + Math.random() * 0.4) : c, P = new g.Shape(), I = a / 2;
7643
+ const T = (v - s / 2) * r + r / 2, S = (E - s / 2) * r + r / 2, x = d ? c * (0.8 + Math.random() * 0.4) : c, P = new g.Shape(), I = a / 2;
7643
7644
  P.moveTo(-I, -I), P.lineTo(I, -I), P.lineTo(I, I), P.lineTo(-I, I), P.closePath();
7644
7645
  const M = {
7645
7646
  depth: x,
@@ -7650,7 +7651,7 @@ class Jh {
7650
7651
  }, O = new g.ExtrudeGeometry(P, M);
7651
7652
  O.rotateX(-Math.PI / 2);
7652
7653
  const C = new g.Mesh(O, p);
7653
- C.position.set(T, -x / 2, _), C.castShadow = !0, C.receiveShadow = !0, h && (C.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(C);
7654
+ C.position.set(T, -x / 2, S), C.castShadow = !0, C.receiveShadow = !0, h && (C.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(C);
7654
7655
  }
7655
7656
  return t;
7656
7657
  }
@@ -7698,7 +7699,7 @@ class eu {
7698
7699
  createShadowCatcher(e) {
7699
7700
  const t = new g.Mesh(
7700
7701
  new g.CircleGeometry(Math.max(e, 1), 64),
7701
- new g.ShadowMaterial({ opacity: 0.35 })
7702
+ new g.ShadowMaterial({ opacity: 0.28 })
7702
7703
  );
7703
7704
  return t.name = nn, t.userData[dr] = !0, t.rotation.x = -Math.PI / 2, t.position.y = 2e-3, t.receiveShadow = !0, t;
7704
7705
  }
@@ -7785,7 +7786,7 @@ gr.gridStyles = /* @__PURE__ */ new Map([
7785
7786
  let Ks = gr;
7786
7787
  function tu(i, e) {
7787
7788
  try {
7788
- const t = St(i);
7789
+ const t = bt(i);
7789
7790
  if (!t)
7790
7791
  return D.err(
7791
7792
  new W(
@@ -7837,7 +7838,7 @@ function tu(i, e) {
7837
7838
  function nu(i, e, t = 1.2) {
7838
7839
  var n;
7839
7840
  try {
7840
- const s = St(i);
7841
+ const s = bt(i);
7841
7842
  if (!s)
7842
7843
  return D.err(
7843
7844
  new W(
@@ -7866,23 +7867,23 @@ function nu(i, e, t = 1.2) {
7866
7867
  const u = new g.Box3().setFromObject(c), d = u.getSize(new g.Vector3());
7867
7868
  if (u.isEmpty() || !Number.isFinite(d.x) || !Number.isFinite(d.z))
7868
7869
  return console.warn("Skipping dynamic grid: object has an empty or non-finite bounding box"), D.ok(void 0);
7869
- const h = (n = o.styleOptions) == null ? void 0 : n.tileSize, p = typeof h == "number" ? h : 1, y = on.getGridSpacing(p).width, b = Math.max(d.x, d.z) * t + d.y;
7870
- let S = b <= y ? 0 : Math.ceil((b / y - 1) / 2);
7870
+ const h = (n = o.styleOptions) == null ? void 0 : n.tileSize, p = typeof h == "number" ? h : 1, y = on.getGridSpacing(p).width, _ = Math.max(d.x, d.z) * t + d.y;
7871
+ let b = _ <= y ? 0 : Math.ceil((_ / y - 1) / 2);
7871
7872
  const v = 60;
7872
- S > v && (console.warn(
7873
- `Dynamic grid would need ${S} rings to cover the object; capping at ${v}. The floor will not fully reach the configured coverage for this tileSize/object-size combination.`
7874
- ), S = v), b < y * 0.8 ? S = 0 : S < 3 && b > y * 2 && (S = 3);
7875
- const E = o.type || Ct.HEXAGONAL_GLASS, _ = {
7873
+ b > v && (console.warn(
7874
+ `Dynamic grid would need ${b} rings to cover the object; capping at ${v}. The floor will not fully reach the configured coverage for this tileSize/object-size combination.`
7875
+ ), b = v), _ < y * 0.8 ? b = 0 : b < 3 && _ > y * 2 && (b = 3);
7876
+ const E = o.type || Ct.HEXAGONAL_GLASS, S = {
7876
7877
  size: Math.max(d.x, d.z) * t,
7877
- divisions: S * 2 + 1,
7878
+ divisions: b * 2 + 1,
7878
7879
  color: o.color,
7879
7880
  opacity: o.opacity,
7880
7881
  styleOptions: {
7881
- hexRadius: S,
7882
+ hexRadius: b,
7882
7883
  tileSize: p,
7883
7884
  ...o.styleOptions
7884
7885
  }
7885
- }, x = Ks.createGrid(E, _);
7886
+ }, x = Ks.createGrid(E, S);
7886
7887
  x.userData.isGrid = !0, x.userData.isHexGrid = !0;
7887
7888
  const P = g.MathUtils.clamp(d.y * 25e-4, 2e-4, 2e-3), I = x.getObjectByName(nn);
7888
7889
  I && (I.position.y = P), x.traverse((O) => {
@@ -7903,7 +7904,7 @@ function nu(i, e, t = 1.2) {
7903
7904
  }
7904
7905
  function su(i, e) {
7905
7906
  try {
7906
- const t = St(i);
7907
+ const t = bt(i);
7907
7908
  if (!t)
7908
7909
  return D.err(
7909
7910
  new W(
@@ -7921,19 +7922,19 @@ function su(i, e) {
7921
7922
  );
7922
7923
  const s = (T) => {
7923
7924
  var x, P, I;
7924
- let _ = T;
7925
- for (; _; ) {
7926
- if ((x = _.userData) != null && x.isGrid || (P = _.userData) != null && P.isHexGrid || (I = _.userData) != null && I.isDefaultGrid)
7925
+ let S = T;
7926
+ for (; S; ) {
7927
+ if ((x = S.userData) != null && x.isGrid || (P = S.userData) != null && P.isHexGrid || (I = S.userData) != null && I.isDefaultGrid)
7927
7928
  return !0;
7928
- _ = _.parent;
7929
+ S = S.parent;
7929
7930
  }
7930
7931
  return !1;
7931
7932
  };
7932
7933
  t.updateMatrixWorld(!0);
7933
7934
  const r = [];
7934
7935
  t.traverse((T) => {
7935
- var _;
7936
- (_ = T.userData) != null && _[pr] || T.isMesh && s(T) && r.push(T);
7936
+ var S;
7937
+ (S = T.userData) != null && S[pr] || T.isMesh && s(T) && r.push(T);
7937
7938
  });
7938
7939
  const o = [];
7939
7940
  if (n.traverse((T) => {
@@ -7949,17 +7950,17 @@ function su(i, e) {
7949
7950
  const u = new g.Box3().setFromObject(n);
7950
7951
  if (u.isEmpty() || !Number.isFinite(u.min.x) || !Number.isFinite(u.max.x))
7951
7952
  return D.ok(void 0);
7952
- const d = 40, h = Math.max(1, u.max.y - u.min.y), p = u.max.y + h, f = u.min.y - h, y = new g.Raycaster(), b = new g.Vector3(0, -1, 0), S = new g.Vector3(0, 1, 0);
7953
+ const d = 40, h = Math.max(1, u.max.y - u.min.y), p = u.max.y + h, f = u.min.y - h, y = new g.Raycaster(), _ = new g.Vector3(0, -1, 0), b = new g.Vector3(0, 1, 0);
7953
7954
  let v = 1 / 0;
7954
- const E = (T, _, x, P) => {
7955
- y.set(new g.Vector3(T, _, x), P);
7955
+ const E = (T, S, x, P) => {
7956
+ y.set(new g.Vector3(T, S, x), P);
7956
7957
  for (const I of y.intersectObjects(o, !1))
7957
7958
  I.point.y < v && (v = I.point.y);
7958
7959
  };
7959
7960
  for (let T = 0; T <= d; T++)
7960
- for (let _ = 0; _ <= d; _++) {
7961
- const x = u.min.x + (u.max.x - u.min.x) * (T / d), P = u.min.z + (u.max.z - u.min.z) * (_ / d);
7962
- E(x, p, P, b), E(x, f, P, S);
7961
+ for (let S = 0; S <= d; S++) {
7962
+ const x = u.min.x + (u.max.x - u.min.x) * (T / d), P = u.min.z + (u.max.z - u.min.z) * (S / d);
7963
+ E(x, p, P, _), E(x, f, P, b);
7963
7964
  }
7964
7965
  if (Number.isFinite(v)) {
7965
7966
  const T = v - a;
@@ -7984,7 +7985,7 @@ const qo = (i) => {
7984
7985
  };
7985
7986
  function iu(i, e) {
7986
7987
  try {
7987
- const t = St(i);
7988
+ const t = bt(i);
7988
7989
  if (!t)
7989
7990
  return D.err(
7990
7991
  new W(
@@ -8024,7 +8025,7 @@ function iu(i, e) {
8024
8025
  }
8025
8026
  function ru(i, e, t, n) {
8026
8027
  try {
8027
- const s = St(i);
8028
+ const s = bt(i);
8028
8029
  if (!s)
8029
8030
  return D.err(
8030
8031
  new W(
@@ -8062,7 +8063,7 @@ function ru(i, e, t, n) {
8062
8063
  }
8063
8064
  function ou(i, e) {
8064
8065
  try {
8065
- const t = St(i);
8066
+ const t = bt(i);
8066
8067
  if (!t)
8067
8068
  return D.err(
8068
8069
  new W(
@@ -8106,7 +8107,7 @@ function au(i, e) {
8106
8107
  }
8107
8108
  function cu(i, e) {
8108
8109
  try {
8109
- const t = St(i);
8110
+ const t = bt(i);
8110
8111
  if (!t)
8111
8112
  return D.err(
8112
8113
  new W(
@@ -8159,7 +8160,7 @@ function cu(i, e) {
8159
8160
  }
8160
8161
  function lu(i, e) {
8161
8162
  try {
8162
- const t = St(i);
8163
+ const t = bt(i);
8163
8164
  if (!t)
8164
8165
  return D.err(
8165
8166
  new W(
@@ -8168,7 +8169,7 @@ function lu(i, e) {
8168
8169
  )
8169
8170
  );
8170
8171
  const n = document.createElement("canvas");
8171
- n.width = 2, n.height = 512;
8172
+ n.width = e.radial ? 512 : 2, n.height = 512;
8172
8173
  const s = n.getContext("2d");
8173
8174
  if (!s)
8174
8175
  return D.err(
@@ -8177,7 +8178,12 @@ function lu(i, e) {
8177
8178
  Z.SCENE_OPERATION_FAILED
8178
8179
  )
8179
8180
  );
8180
- const r = s.createLinearGradient(0, 0, 0, n.height);
8181
+ const r = e.radial ? (
8182
+ // Centre sits slightly ABOVE the middle (y=205 of 512 ≈ 40% down) so the
8183
+ // bright lift lands behind the subject, and the outer radius reaches the
8184
+ // corners/bottom so they fall off to the dark edge — a studio vignette.
8185
+ s.createRadialGradient(256, 205, 0, 256, 256, 380)
8186
+ ) : s.createLinearGradient(0, 0, 0, n.height);
8181
8187
  r.addColorStop(0, e.topColor), r.addColorStop(1, e.bottomColor), s.fillStyle = r, s.fillRect(0, 0, n.width, n.height);
8182
8188
  const o = new g.CanvasTexture(n);
8183
8189
  o.needsUpdate = !0;
@@ -8223,9 +8229,9 @@ function hu(i, e, t) {
8223
8229
  let d;
8224
8230
  "fov" in s ? d = s.fov * (Math.PI / 180) : d = 50 * (Math.PI / 180);
8225
8231
  let h = Math.abs(u / 2 / Math.tan(d / 2));
8226
- h *= 2;
8227
- const p = -Math.PI / 4, f = Math.PI / 8, y = a.x + h * Math.sin(p) * Math.cos(f), b = a.y + h * Math.sin(f), S = a.z + h * Math.cos(p) * Math.cos(f);
8228
- return s.position.set(y, b, S), s.lookAt(a), s.updateProjectionMatrix(), r.target && (r.target.copy(a), r.update()), D.ok(void 0);
8232
+ h *= 1.65;
8233
+ const p = -Math.PI / 4, f = Math.PI / 8, y = a.x + h * Math.sin(p) * Math.cos(f), _ = a.y + h * Math.sin(f), b = a.z + h * Math.cos(p) * Math.cos(f);
8234
+ return s.position.set(y, _, b), s.lookAt(a), s.updateProjectionMatrix(), r.target && (r.target.copy(a), r.update()), D.ok(void 0);
8229
8235
  } catch (n) {
8230
8236
  return D.err(
8231
8237
  new W(
@@ -8276,7 +8282,7 @@ class du {
8276
8282
  this.events = new sr(), this.disposed = !1;
8277
8283
  }
8278
8284
  async initialize(e) {
8279
- const { ThreePathTracingService: t } = await import("./ThreePathTracingService-BbJAL8DY.js");
8285
+ const { ThreePathTracingService: t } = await import("./ThreePathTracingService-D40s_tO4.js");
8280
8286
  if (this.disposed)
8281
8287
  return D.ok(void 0);
8282
8288
  const n = new t();
@@ -8328,7 +8334,7 @@ fflate - fast JavaScript compression/decompression
8328
8334
  Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
8329
8335
  version 0.8.2
8330
8336
  */
8331
- var lt = Uint8Array, bn = Uint16Array, pu = Int32Array, $o = new lt([
8337
+ var lt = Uint8Array, _n = Uint16Array, pu = Int32Array, $o = new lt([
8332
8338
  0,
8333
8339
  0,
8334
8340
  0,
@@ -8398,7 +8404,7 @@ var lt = Uint8Array, bn = Uint16Array, pu = Int32Array, $o = new lt([
8398
8404
  0,
8399
8405
  0
8400
8406
  ]), fu = new lt([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Jo = function(i, e) {
8401
- for (var t = new bn(31), n = 0; n < 31; ++n)
8407
+ for (var t = new _n(31), n = 0; n < 31; ++n)
8402
8408
  t[n] = e += 1 << i[n - 1];
8403
8409
  for (var s = new pu(t[30]), n = 1; n < 30; ++n)
8404
8410
  for (var r = t[n]; r < t[n + 1]; ++r)
@@ -8406,41 +8412,41 @@ var lt = Uint8Array, bn = Uint16Array, pu = Int32Array, $o = new lt([
8406
8412
  return { b: t, r: s };
8407
8413
  }, ea = Jo($o, 2), ta = ea.b, mu = ea.r;
8408
8414
  ta[28] = 258, mu[258] = 28;
8409
- var gu = Jo(Qo, 0), yu = gu.b, Zi = new bn(32768);
8410
- for (var _e = 0; _e < 32768; ++_e) {
8411
- var Gt = (_e & 43690) >> 1 | (_e & 21845) << 1;
8412
- Gt = (Gt & 52428) >> 2 | (Gt & 13107) << 2, Gt = (Gt & 61680) >> 4 | (Gt & 3855) << 4, Zi[_e] = ((Gt & 65280) >> 8 | (Gt & 255) << 8) >> 1;
8415
+ var gu = Jo(Qo, 0), yu = gu.b, Zi = new _n(32768);
8416
+ for (var Se = 0; Se < 32768; ++Se) {
8417
+ var Gt = (Se & 43690) >> 1 | (Se & 21845) << 1;
8418
+ Gt = (Gt & 52428) >> 2 | (Gt & 13107) << 2, Gt = (Gt & 61680) >> 4 | (Gt & 3855) << 4, Zi[Se] = ((Gt & 65280) >> 8 | (Gt & 255) << 8) >> 1;
8413
8419
  }
8414
8420
  var $n = (function(i, e, t) {
8415
- for (var n = i.length, s = 0, r = new bn(e); s < n; ++s)
8421
+ for (var n = i.length, s = 0, r = new _n(e); s < n; ++s)
8416
8422
  i[s] && ++r[i[s] - 1];
8417
- var o = new bn(e);
8423
+ var o = new _n(e);
8418
8424
  for (s = 1; s < e; ++s)
8419
8425
  o[s] = o[s - 1] + r[s - 1] << 1;
8420
8426
  var a;
8421
8427
  if (t) {
8422
- a = new bn(1 << e);
8428
+ a = new _n(1 << e);
8423
8429
  var c = 15 - e;
8424
8430
  for (s = 0; s < n; ++s)
8425
8431
  if (i[s])
8426
8432
  for (var u = s << 4 | i[s], d = e - i[s], h = o[i[s] - 1]++ << d, p = h | (1 << d) - 1; h <= p; ++h)
8427
8433
  a[Zi[h] >> c] = u;
8428
8434
  } else
8429
- for (a = new bn(n), s = 0; s < n; ++s)
8435
+ for (a = new _n(n), s = 0; s < n; ++s)
8430
8436
  i[s] && (a[s] = Zi[o[i[s] - 1]++] >> 15 - i[s]);
8431
8437
  return a;
8432
8438
  }), ss = new lt(288);
8433
- for (var _e = 0; _e < 144; ++_e)
8434
- ss[_e] = 8;
8435
- for (var _e = 144; _e < 256; ++_e)
8436
- ss[_e] = 9;
8437
- for (var _e = 256; _e < 280; ++_e)
8438
- ss[_e] = 7;
8439
- for (var _e = 280; _e < 288; ++_e)
8440
- ss[_e] = 8;
8439
+ for (var Se = 0; Se < 144; ++Se)
8440
+ ss[Se] = 8;
8441
+ for (var Se = 144; Se < 256; ++Se)
8442
+ ss[Se] = 9;
8443
+ for (var Se = 256; Se < 280; ++Se)
8444
+ ss[Se] = 7;
8445
+ for (var Se = 280; Se < 288; ++Se)
8446
+ ss[Se] = 8;
8441
8447
  var na = new lt(32);
8442
- for (var _e = 0; _e < 32; ++_e)
8443
- na[_e] = 5;
8448
+ for (var Se = 0; Se < 32; ++Se)
8449
+ na[Se] = 5;
8444
8450
  var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = function(i) {
8445
8451
  for (var e = i[0], t = 1; t < i.length; ++t)
8446
8452
  i[t] > e && (e = i[t]);
@@ -8448,14 +8454,14 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8448
8454
  }, mt = function(i, e, t) {
8449
8455
  var n = e / 8 | 0;
8450
8456
  return (i[n] | i[n + 1] << 8) >> (e & 7) & t;
8451
- }, Si = function(i, e) {
8457
+ }, bi = function(i, e) {
8452
8458
  var t = e / 8 | 0;
8453
8459
  return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7);
8454
8460
  }, Tu = function(i) {
8455
8461
  return (i + 7) / 8 | 0;
8456
- }, Su = function(i, e, t) {
8462
+ }, bu = function(i, e, t) {
8457
8463
  return (t == null || t > i.length) && (t = i.length), new lt(i.subarray(e, t));
8458
- }, _u = [
8464
+ }, Su = [
8459
8465
  "unexpected EOF",
8460
8466
  "invalid block type",
8461
8467
  "invalid length/literal",
@@ -8472,11 +8478,11 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8472
8478
  "invalid zip data"
8473
8479
  // determined by unknown compression method
8474
8480
  ], yt = function(i, e, t) {
8475
- var n = new Error(e || _u[i]);
8481
+ var n = new Error(e || Su[i]);
8476
8482
  if (n.code = i, Error.captureStackTrace && Error.captureStackTrace(n, yt), !t)
8477
8483
  throw n;
8478
8484
  return n;
8479
- }, bu = function(i, e, t, n) {
8485
+ }, _u = function(i, e, t, n) {
8480
8486
  var s = i.length, r = 0;
8481
8487
  if (!s || e.f && !e.l)
8482
8488
  return t || new lt(0);
@@ -8488,14 +8494,14 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8488
8494
  var is = new lt(Math.max(Lt * 2, an));
8489
8495
  is.set(t), t = is;
8490
8496
  }
8491
- }, d = e.f || 0, h = e.p || 0, p = e.b || 0, f = e.l, y = e.d, b = e.m, S = e.n, v = s * 8;
8497
+ }, d = e.f || 0, h = e.p || 0, p = e.b || 0, f = e.l, y = e.d, _ = e.m, b = e.n, v = s * 8;
8492
8498
  do {
8493
8499
  if (!f) {
8494
8500
  d = mt(i, h, 1);
8495
8501
  var E = mt(i, h + 1, 3);
8496
8502
  if (h += 3, E)
8497
8503
  if (E == 1)
8498
- f = wu, y = Eu, b = 9, S = 5;
8504
+ f = wu, y = Eu, _ = 9, b = 5;
8499
8505
  else if (E == 2) {
8500
8506
  var P = mt(i, h, 31) + 257, I = mt(i, h + 10, 15) + 4, M = P + mt(i, h + 5, 31) + 1;
8501
8507
  h += 14;
@@ -8515,16 +8521,16 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8515
8521
  }
8516
8522
  }
8517
8523
  var dt = O.subarray(0, P), Me = O.subarray(P);
8518
- b = Ti(dt), S = Ti(Me), f = $n(dt, b, 1), y = $n(Me, S, 1);
8524
+ _ = Ti(dt), b = Ti(Me), f = $n(dt, _, 1), y = $n(Me, b, 1);
8519
8525
  } else
8520
8526
  yt(1);
8521
8527
  else {
8522
- var T = Tu(h) + 4, _ = i[T - 4] | i[T - 3] << 8, x = T + _;
8528
+ var T = Tu(h) + 4, S = i[T - 4] | i[T - 3] << 8, x = T + S;
8523
8529
  if (x > s) {
8524
8530
  c && yt(0);
8525
8531
  break;
8526
8532
  }
8527
- a && u(p + _), t.set(i.subarray(T, x), p), e.b = p += _, e.p = h = x * 8, e.f = d;
8533
+ a && u(p + S), t.set(i.subarray(T, x), p), e.b = p += S, e.p = h = x * 8, e.f = d;
8528
8534
  continue;
8529
8535
  }
8530
8536
  if (h > v) {
@@ -8533,8 +8539,8 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8533
8539
  }
8534
8540
  }
8535
8541
  a && u(p + 131072);
8536
- for (var Ue = (1 << b) - 1, Ve = (1 << S) - 1, Ae = h; ; Ae = h) {
8537
- var ie = f[Si(i, h) & Ue], ge = ie >> 4;
8542
+ for (var Ue = (1 << _) - 1, Ve = (1 << b) - 1, Ae = h; ; Ae = h) {
8543
+ var ie = f[bi(i, h) & Ue], ge = ie >> 4;
8538
8544
  if (h += ie & 15, h > v) {
8539
8545
  c && yt(0);
8540
8546
  break;
@@ -8545,24 +8551,24 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8545
8551
  Ae = h, f = null;
8546
8552
  break;
8547
8553
  } else {
8548
- var bt = ge - 254;
8554
+ var _t = ge - 254;
8549
8555
  if (ge > 264) {
8550
8556
  var k = ge - 257, We = $o[k];
8551
- bt = mt(i, h, (1 << We) - 1) + ta[k], h += We;
8557
+ _t = mt(i, h, (1 << We) - 1) + ta[k], h += We;
8552
8558
  }
8553
- var zt = y[Si(i, h) & Ve], me = zt >> 4;
8559
+ var zt = y[bi(i, h) & Ve], me = zt >> 4;
8554
8560
  zt || yt(3), h += zt & 15;
8555
8561
  var Me = yu[me];
8556
8562
  if (me > 3) {
8557
8563
  var We = Qo[me];
8558
- Me += Si(i, h) & (1 << We) - 1, h += We;
8564
+ Me += bi(i, h) & (1 << We) - 1, h += We;
8559
8565
  }
8560
8566
  if (h > v) {
8561
8567
  c && yt(0);
8562
8568
  break;
8563
8569
  }
8564
8570
  a && u(p + 131072);
8565
- var pt = p + bt;
8571
+ var pt = p + _t;
8566
8572
  if (p < Me) {
8567
8573
  var ft = r - Me, Cn = Math.min(Me, pt);
8568
8574
  for (ft + p < 0 && yt(3); p < Cn; ++p)
@@ -8572,14 +8578,14 @@ var wu = /* @__PURE__ */ $n(ss, 9, 1), Eu = /* @__PURE__ */ $n(na, 5, 1), Ti = f
8572
8578
  t[p] = t[p - Me];
8573
8579
  }
8574
8580
  }
8575
- e.l = f, e.p = Ae, e.b = p, e.f = d, f && (d = 1, e.m = b, e.d = y, e.n = S);
8581
+ e.l = f, e.p = Ae, e.b = p, e.f = d, f && (d = 1, e.m = _, e.d = y, e.n = b);
8576
8582
  } while (!d);
8577
- return p != t.length && o ? Su(t, 0, p) : t.subarray(0, p);
8583
+ return p != t.length && o ? bu(t, 0, p) : t.subarray(0, p);
8578
8584
  }, xu = /* @__PURE__ */ new lt(0), vu = function(i, e) {
8579
8585
  return ((i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31) && yt(6, "invalid zlib data"), (i[1] >> 5 & 1) == 1 && yt(6, "invalid zlib data: " + (i[1] & 32 ? "need" : "unexpected") + " dictionary"), (i[1] >> 3 & 4) + 2;
8580
8586
  };
8581
8587
  function Gn(i, e) {
8582
- return bu(i.subarray(vu(i), -4), { i: 2 }, e, e);
8588
+ return _u(i.subarray(vu(i), -4), { i: 2 }, e, e);
8583
8589
  }
8584
8590
  var Au = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Ru = 0;
8585
8591
  try {
@@ -8619,7 +8625,7 @@ class Mu extends Lo {
8619
8625
  const G = { l: 0, c: 0, lc: 0 };
8620
8626
  function z(l, m, w, R, L) {
8621
8627
  for (; w < l; )
8622
- m = m << 8 | _r(R, L), w += 8;
8628
+ m = m << 8 | Sr(R, L), w += 8;
8623
8629
  w -= l, G.l = m >> w & (1 << l) - 1, G.c = m, G.lc = w;
8624
8630
  }
8625
8631
  const X = new Array(59);
@@ -8699,10 +8705,10 @@ class Mu extends Lo {
8699
8705
  }
8700
8706
  const Ve = { c: 0, lc: 0 };
8701
8707
  function Ae(l, m, w, R) {
8702
- l = l << 8 | _r(w, R), m += 8, Ve.c = l, Ve.lc = m;
8708
+ l = l << 8 | Sr(w, R), m += 8, Ve.c = l, Ve.lc = m;
8703
8709
  }
8704
8710
  const ge = { c: 0, lc: 0 };
8705
- function bt(l, m, w, R, L, B, A, H, F) {
8711
+ function _t(l, m, w, R, L, B, A, H, F) {
8706
8712
  if (l == m) {
8707
8713
  R < 8 && (Ae(w, R, L, B), w = Ve.c, R = Ve.lc), R -= 8;
8708
8714
  let U = w >> R;
@@ -8772,7 +8778,7 @@ class Mu extends Lo {
8772
8778
  for (Ae(U, j, w, R), U = Ve.c, j = Ve.lc; j >= 14; ) {
8773
8779
  const ee = U >> j - 14 & 16383, Y = m[ee];
8774
8780
  if (Y.len)
8775
- j -= Y.len, bt(Y.lit, B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8781
+ j -= Y.len, _t(Y.lit, B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8776
8782
  else {
8777
8783
  if (!Y.p)
8778
8784
  throw new Error("THREE.EXRLoader: hufDecode issues");
@@ -8782,7 +8788,7 @@ class Mu extends Lo {
8782
8788
  for (; j < re && R.value < V; )
8783
8789
  Ae(U, j, w, R), U = Ve.c, j = Ve.lc;
8784
8790
  if (j >= re && Me(l[Y.p[Q]]) == (U >> j - re & (1 << re) - 1)) {
8785
- j -= re, bt(Y.p[Q], B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8791
+ j -= re, _t(Y.p[Q], B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8786
8792
  break;
8787
8793
  }
8788
8794
  }
@@ -8794,7 +8800,7 @@ class Mu extends Lo {
8794
8800
  for (U >>= q, j -= q; j > 0; ) {
8795
8801
  const ee = m[U << 14 - j & 16383];
8796
8802
  if (ee.len)
8797
- j -= ee.len, bt(ee.lit, B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8803
+ j -= ee.len, _t(ee.lit, B, U, j, w, R, H, F, K), U = ge.c, j = ge.lc;
8798
8804
  else
8799
8805
  throw new Error("THREE.EXRLoader: hufDecode issues");
8800
8806
  }
@@ -8874,15 +8880,15 @@ class Mu extends Lo {
8874
8880
  for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
8875
8881
  pe = ue[ae][Ce];
8876
8882
  for (let it = 0; it < j; ++it) {
8877
- const Se = it * 64 + (Ce & 7) * 8;
8878
- A.setUint16(pe + 0 * he, oe[ae][Se + 0], !0), A.setUint16(pe + 2 * he, oe[ae][Se + 1], !0), A.setUint16(pe + 4 * he, oe[ae][Se + 2], !0), A.setUint16(pe + 6 * he, oe[ae][Se + 3], !0), A.setUint16(pe + 8 * he, oe[ae][Se + 4], !0), A.setUint16(pe + 10 * he, oe[ae][Se + 5], !0), A.setUint16(pe + 12 * he, oe[ae][Se + 6], !0), A.setUint16(pe + 14 * he, oe[ae][Se + 7], !0), pe += 16 * he;
8883
+ const be = it * 64 + (Ce & 7) * 8;
8884
+ A.setUint16(pe + 0 * he, oe[ae][be + 0], !0), A.setUint16(pe + 2 * he, oe[ae][be + 1], !0), A.setUint16(pe + 4 * he, oe[ae][be + 2], !0), A.setUint16(pe + 6 * he, oe[ae][be + 3], !0), A.setUint16(pe + 8 * he, oe[ae][be + 4], !0), A.setUint16(pe + 10 * he, oe[ae][be + 5], !0), A.setUint16(pe + 12 * he, oe[ae][be + 6], !0), A.setUint16(pe + 14 * he, oe[ae][be + 7], !0), pe += 16 * he;
8879
8885
  }
8880
8886
  }
8881
8887
  if (j != K)
8882
8888
  for (let Ce = 8 * te; Ce < 8 * te + se; ++Ce) {
8883
- const it = ue[ae][Ce] + 8 * j * 2 * he, Se = j * 64 + (Ce & 7) * 8;
8889
+ const it = ue[ae][Ce] + 8 * j * 2 * he, be = j * 64 + (Ce & 7) * 8;
8884
8890
  for (let xt = 0; xt < ye; ++xt)
8885
- A.setUint16(it + xt * 2 * he, oe[ae][Se + xt], !0);
8891
+ A.setUint16(it + xt * 2 * he, oe[ae][be + xt], !0);
8886
8892
  }
8887
8893
  }
8888
8894
  }
@@ -9031,7 +9037,7 @@ class Mu extends Lo {
9031
9037
  }
9032
9038
  return B;
9033
9039
  }
9034
- function Sa(l) {
9040
+ function ba(l) {
9035
9041
  const m = l.array;
9036
9042
  let w = l.offset.value;
9037
9043
  const R = l.columns, L = l.lines, B = l.inputChannels, A = l.totalBytes, H = Ke.compression === "B44A_COMPRESSION", F = new Uint8Array(L * R * A), U = new Uint16Array(16);
@@ -9056,7 +9062,7 @@ class Mu extends Lo {
9056
9062
  const ne = m[w] << 8 | m[w + 1], te = ne & 32768 ? ne & 32767 : ~ne & 65535;
9057
9063
  U.fill(te), w += 3;
9058
9064
  } else {
9059
- const ne = m[w] << 8 | m[w + 1], te = m[w + 2] >> 2, se = 32 << te, ye = ne + ((m[w + 2] << 4 | m[w + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = ye + ((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 = ye + ((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, Se = 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, vt = Se + (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, ps = Pn + ((m[w + 12] << 2 | m[w + 13] >> 6) & 63) * (1 << te) - se & 65535, fs = vt + (m[w + 13] & 63) * (1 << te) - se & 65535, Ln = [ne, he, xt, qt, ye, Ce, cn, ds, pe, it, Pn, ps, ae, Se, vt, fs];
9065
+ const ne = m[w] << 8 | m[w + 1], te = m[w + 2] >> 2, se = 32 << te, ye = ne + ((m[w + 2] << 4 | m[w + 3] >> 4) & 63) * (1 << te) - se & 65535, pe = ye + ((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 = ye + ((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, be = 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, vt = be + (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, ps = Pn + ((m[w + 12] << 2 | m[w + 13] >> 6) & 63) * (1 << te) - se & 65535, fs = vt + (m[w + 13] & 63) * (1 << te) - se & 65535, Ln = [ne, he, xt, qt, ye, Ce, cn, ds, pe, it, Pn, ps, ae, be, vt, fs];
9060
9066
  for (let ln = 0; ln < 16; ln++)
9061
9067
  U[ln] = Ln[ln] & 32768 ? Ln[ln] & 32767 : ~Ln[ln] & 65535;
9062
9068
  w += 14;
@@ -9087,8 +9093,8 @@ class Mu extends Lo {
9087
9093
  for (let Ce = 0; Ce < V.xSampling; Ce++) {
9088
9094
  const it = ye * V.xSampling + Ce;
9089
9095
  if (it >= R) continue;
9090
- const Se = he * R * A + j * R + it * 2;
9091
- F[Se] = pe & 255, F[Se + 1] = pe >> 8 & 255;
9096
+ const be = he * R * A + j * R + it * 2;
9097
+ F[be] = pe & 255, F[be + 1] = pe >> 8 & 255;
9092
9098
  }
9093
9099
  }
9094
9100
  }
@@ -9098,7 +9104,7 @@ class Mu extends Lo {
9098
9104
  }
9099
9105
  return new DataView(F.buffer);
9100
9106
  }
9101
- function Sr(l) {
9107
+ function br(l) {
9102
9108
  const m = l.viewer, w = { value: l.offset.value }, R = new Uint8Array(l.columns * l.lines * (l.inputChannels.length * l.type * 2)), L = {
9103
9109
  version: ke(m, w),
9104
9110
  unknownUncompressedSize: ke(m, w),
@@ -9206,13 +9212,13 @@ class Mu extends Lo {
9206
9212
  );
9207
9213
  return m.value = m.value + R + 1, L;
9208
9214
  }
9209
- function _a(l, m, w) {
9215
+ function Sa(l, m, w) {
9210
9216
  const R = new TextDecoder().decode(
9211
9217
  new Uint8Array(l).slice(m.value, m.value + w)
9212
9218
  );
9213
9219
  return m.value = m.value + w, R;
9214
9220
  }
9215
- function ba(l, m) {
9221
+ function _a(l, m) {
9216
9222
  const w = et(l, m), R = st(l, m);
9217
9223
  return [w, R];
9218
9224
  }
@@ -9228,7 +9234,7 @@ class Mu extends Lo {
9228
9234
  const w = l.getUint32(m.value, !0);
9229
9235
  return m.value = m.value + 4, w;
9230
9236
  }
9231
- function _r(l, m) {
9237
+ function Sr(l, m) {
9232
9238
  const w = l[m.value];
9233
9239
  return m.value = m.value + 1, w;
9234
9240
  }
@@ -9338,7 +9344,7 @@ class Mu extends Lo {
9338
9344
  }
9339
9345
  function ka(l, m, w, R, L) {
9340
9346
  if (R === "string" || R === "stringvector" || R === "iccProfile")
9341
- return _a(m, w, L);
9347
+ return Sa(m, w, L);
9342
9348
  if (R === "chlist")
9343
9349
  return Ra(l, m, w, L);
9344
9350
  if (R === "chromaticities")
@@ -9362,7 +9368,7 @@ class Mu extends Lo {
9362
9368
  if (R === "int")
9363
9369
  return et(l, w);
9364
9370
  if (R === "rational")
9365
- return ba(l, w);
9371
+ return _a(l, w);
9366
9372
  if (R === "timecode")
9367
9373
  return xa(l, w);
9368
9374
  if (R === "preview" || R === "deepImageState" || R === "idmanifest")
@@ -9387,7 +9393,7 @@ class Mu extends Lo {
9387
9393
  }
9388
9394
  return R;
9389
9395
  }
9390
- function br(l, m, w, R) {
9396
+ function _r(l, m, w, R) {
9391
9397
  const L = new Array(l);
9392
9398
  for (let B = 0; B < l; B++) {
9393
9399
  const A = 1 << B;
@@ -9521,8 +9527,8 @@ class Mu extends Lo {
9521
9527
  if (ae === 0) continue;
9522
9528
  const he = new Float32Array(F);
9523
9529
  let Ce = 0;
9524
- for (let Se = 0; Se < ae; Se++) {
9525
- const xt = ye + Se, cn = 1 - Ce;
9530
+ for (let be = 0; be < ae; be++) {
9531
+ const xt = ye + be, cn = 1 - Ce;
9526
9532
  if (cn <= 0) break;
9527
9533
  let Pn = 1;
9528
9534
  if (j >= 0) {
@@ -9539,8 +9545,8 @@ class Mu extends Lo {
9539
9545
  }
9540
9546
  H.A !== void 0 && (he[H.A] = Ce);
9541
9547
  const it = te + se * F;
9542
- for (let Se = 0; Se < F; Se++)
9543
- l.byteArray[it + Se] = U ? Et.toHalfFloat(he[Se]) : he[Se];
9548
+ for (let be = 0; be < F; be++)
9549
+ l.byteArray[it + be] = U ? Et.toHalfFloat(he[be]) : he[be];
9544
9550
  }
9545
9551
  }
9546
9552
  }
@@ -9623,13 +9629,13 @@ class Mu extends Lo {
9623
9629
  break;
9624
9630
  case "B44_COMPRESSION":
9625
9631
  case "B44A_COMPRESSION":
9626
- A.blockHeight = 32, A.uncompress = Sa;
9632
+ A.blockHeight = 32, A.uncompress = ba;
9627
9633
  break;
9628
9634
  case "DWAA_COMPRESSION":
9629
- A.blockHeight = 32, A.uncompress = Sr;
9635
+ A.blockHeight = 32, A.uncompress = br;
9630
9636
  break;
9631
9637
  case "DWAB_COMPRESSION":
9632
- A.blockHeight = 256, A.uncompress = Sr;
9638
+ A.blockHeight = 256, A.uncompress = br;
9633
9639
  break;
9634
9640
  default:
9635
9641
  throw new Error("THREE.EXRLoader: " + l.compression + " is unsupported");
@@ -9715,7 +9721,7 @@ class Mu extends Lo {
9715
9721
  A.deepBytesPerSample = V, A.chunkOffsets = l._chunkOffsets, A.multiPart = l.spec.multiPart, A.decode = Ga.bind(A);
9716
9722
  } else if (l.spec.singleTile) {
9717
9723
  A.blockHeight = l.tiles.ySize, A.blockWidth = l.tiles.xSize;
9718
- const V = za(l.tiles, A.width, A.height), q = br(V, A.width, l.tiles.xSize, l.tiles.roundingMode), ee = br(V, A.height, l.tiles.ySize, l.tiles.roundingMode);
9724
+ const V = za(l.tiles, A.width, A.height), q = _r(V, A.width, l.tiles.xSize, l.tiles.roundingMode), ee = _r(V, A.height, l.tiles.ySize, l.tiles.roundingMode);
9719
9725
  A.tileCount = q[0] * ee[0];
9720
9726
  for (let Y = 0; Y < V; Y++)
9721
9727
  for (let Q = 0; Q < ee[Y]; Q++)
@@ -9899,7 +9905,7 @@ class Cu extends Lo {
9899
9905
  const Ae = Ue > 128;
9900
9906
  if (Ae && (Ue -= 128), (Ue === 0 || Me + Ue > X) && o(3, "bad scanline data"), Ae) {
9901
9907
  const ge = M[z++];
9902
- for (let bt = 0; bt < Ue; bt++)
9908
+ for (let _t = 0; _t < Ue; _t++)
9903
9909
  Ne[Me++] = ge;
9904
9910
  } else
9905
9911
  Ne.set(M.subarray(z, z + Ue), Me), Me += Ue, z += Ue;
@@ -9915,26 +9921,26 @@ class Cu extends Lo {
9915
9921
  }, y = function(M, O, C, k) {
9916
9922
  const N = M[O + 3], G = Math.pow(2, N - 128) / 255;
9917
9923
  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;
9918
- }, b = function(M, O, C, k) {
9924
+ }, _ = function(M, O, C, k) {
9919
9925
  const N = M[O + 3], G = Math.pow(2, N - 128) / 255;
9920
9926
  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);
9921
- }, S = new Uint8Array(e);
9922
- S.pos = 0;
9923
- const v = p(S), E = v.width, T = v.height, _ = f(S.subarray(S.pos), E, T);
9927
+ }, b = new Uint8Array(e);
9928
+ b.pos = 0;
9929
+ const v = p(b), E = v.width, T = v.height, S = f(b.subarray(b.pos), E, T);
9924
9930
  let x, P, I;
9925
9931
  switch (this.type) {
9926
9932
  case Yn:
9927
- I = _.length / 4;
9933
+ I = S.length / 4;
9928
9934
  const M = new Float32Array(I * 4);
9929
9935
  for (let C = 0; C < I; C++)
9930
- y(_, C * 4, M, C * 4);
9936
+ y(S, C * 4, M, C * 4);
9931
9937
  x = M, P = Yn;
9932
9938
  break;
9933
9939
  case Zt:
9934
- I = _.length / 4;
9940
+ I = S.length / 4;
9935
9941
  const O = new Uint16Array(I * 4);
9936
9942
  for (let C = 0; C < I; C++)
9937
- b(_, C * 4, O, C * 4);
9943
+ _(S, C * 4, O, C * 4);
9938
9944
  x = O, P = Zt;
9939
9945
  break;
9940
9946
  default:
@@ -10113,7 +10119,7 @@ class Lu {
10113
10119
  }
10114
10120
  applyToScene(e, t, n) {
10115
10121
  try {
10116
- const s = St(e);
10122
+ const s = bt(e);
10117
10123
  if (!s)
10118
10124
  return D.err(
10119
10125
  new W(
@@ -10170,7 +10176,7 @@ class Lu {
10170
10176
  */
10171
10177
  async setBackgroundImage(e, t) {
10172
10178
  try {
10173
- const n = St(e);
10179
+ const n = bt(e);
10174
10180
  if (!n)
10175
10181
  return D.err(
10176
10182
  new W("Scene must be ThreeSceneAdapter", Z.INVALID_PARAMETER)
@@ -10552,18 +10558,18 @@ class Gu {
10552
10558
  renderer: n.getThreeRenderer() ?? void 0,
10553
10559
  bvh: (v = t.selection) == null ? void 0 : v.bvh,
10554
10560
  ...t.loaders
10555
- }), c = new uu(), u = new Lu(), d = new du(), h = new Du(), p = new Nu(), f = new zu(), y = new Bu(), b = Hu.convertRendererOptions(
10561
+ }), c = new uu(), u = new Lu(), d = new du(), h = new Du(), p = new Nu(), f = new zu(), y = new Bu(), _ = Hu.convertRendererOptions(
10556
10562
  t.renderer || {}
10557
10563
  );
10558
- b.preserveDrawingBuffer = !0;
10559
- const S = {
10564
+ _.preserveDrawingBuffer = !0;
10565
+ const b = {
10560
10566
  renderer: n,
10561
10567
  scene: s,
10562
10568
  camera: r,
10563
10569
  controls: o,
10564
10570
  modelLoader: a,
10565
10571
  options: t,
10566
- rendererOptions: b,
10572
+ rendererOptions: _,
10567
10573
  sceneSetupService: c,
10568
10574
  environmentService: u,
10569
10575
  pathTracingService: d,
@@ -10572,7 +10578,7 @@ class Gu {
10572
10578
  anchorProjectionService: f,
10573
10579
  animationService: y
10574
10580
  };
10575
- return new Fc(S);
10581
+ return new Fc(b);
10576
10582
  }
10577
10583
  static createCamera(e) {
10578
10584
  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, u = hr.create(
@@ -10620,7 +10626,8 @@ const Vu = ["toneMappingExposure"], Wu = ["environmentIntensity"], Zu = ["autoRo
10620
10626
  function sa(i) {
10621
10627
  var t, n, s, r, o, a, c, u, d, h, p;
10622
10628
  const e = {
10623
- backgroundColor: i.backgroundColor
10629
+ backgroundColor: i.backgroundColor,
10630
+ backgroundColorEdge: i.backgroundColorEdge
10624
10631
  };
10625
10632
  return ((t = i.renderer) == null ? void 0 : t.toneMappingExposure) !== void 0 && (e.renderer = { toneMappingExposure: i.renderer.toneMappingExposure }), ((n = i.environment) == null ? void 0 : n.environmentIntensity) !== void 0 && (e.environment = { environmentIntensity: i.environment.environmentIntensity }), (((s = i.controls) == null ? void 0 : s.autoRotate) !== void 0 || ((r = i.controls) == null ? void 0 : r.autoRotateSpeed) !== void 0) && (e.controls = {
10626
10633
  autoRotate: (o = i.controls) == null ? void 0 : o.autoRotate,
@@ -10812,9 +10819,14 @@ const Ki = {
10812
10819
  environment: { environmentIntensity: 0.45 }
10813
10820
  },
10814
10821
  dark: {
10815
- backgroundColor: "#1a1a1f",
10816
- renderer: { toneMappingExposure: 1.2 },
10817
- environment: { environmentIntensity: 0.5 }
10822
+ // A radial cove: a slightly-lifted centre behind the subject falling off to
10823
+ // a near-black edge, so the model floats in a dark studio instead of on a
10824
+ // flat grey scrim. Lower env intensity + a touch more exposure deepen the
10825
+ // contrast while keeping the subject bright — a punchier hero read.
10826
+ backgroundColor: "#242430",
10827
+ backgroundColorEdge: "#050507",
10828
+ renderer: { toneMappingExposure: 1.3 },
10829
+ environment: { environmentIntensity: 0.42 }
10818
10830
  },
10819
10831
  outdoor: {
10820
10832
  backgroundColor: "#bcd4e6",
@@ -10889,7 +10901,7 @@ function Yu(i) {
10889
10901
  ), t = Nt(() => {
10890
10902
  const s = Xi(Ki, i);
10891
10903
  return JSON.stringify(sa(s));
10892
- }, [i.preset, i.backgroundColor, i.renderer, i.environment, i.controls, i.animations, i.pathTracing]);
10904
+ }, [i.preset, i.backgroundColor, i.backgroundColorEdge, i.renderer, i.environment, i.controls, i.animations, i.pathTracing]);
10893
10905
  return { options: Nt(() => i, [e, t]), structuralKey: e, runtimeKey: t };
10894
10906
  }
10895
10907
  const qu = "200px";
@@ -10926,14 +10938,14 @@ function Qu(i, e) {
10926
10938
  let f;
10927
10939
  try {
10928
10940
  f = Gu.createViewer(i.current, p);
10929
- } catch (b) {
10930
- console.error("Failed to create viewer:", b), a(b instanceof Error ? b : new Error(String(b)));
10941
+ } catch (_) {
10942
+ console.error("Failed to create viewer:", _), a(_ instanceof Error ? _ : new Error(String(_)));
10931
10943
  return;
10932
10944
  }
10933
10945
  t.current = f, n.current = { width: 0, height: 0 };
10934
10946
  let y = !1;
10935
- return f.initialize().then((b) => {
10936
- y || (b.ok ? r(!0) : (console.error("Failed to initialize viewer:", b.error), a(b.error)));
10947
+ return f.initialize().then((_) => {
10948
+ y || (_.ok ? r(!0) : (console.error("Failed to initialize viewer:", _.error), a(_.error)));
10937
10949
  }), () => {
10938
10950
  y = !0, f.dispose(), t.current = null, r(!1);
10939
10951
  };
@@ -10946,13 +10958,13 @@ function Qu(i, e) {
10946
10958
  if (!t.current || !i.current)
10947
10959
  return;
10948
10960
  let p = null;
10949
- const f = (S) => {
10961
+ const f = (b) => {
10950
10962
  if (i.current && t.current) {
10951
10963
  const v = i.current.parentElement || i.current;
10952
10964
  let { clientWidth: E, clientHeight: T } = v;
10953
- if (S && S[0]) {
10954
- const { width: _, height: x } = S[0].contentRect;
10955
- E = Math.floor(_), T = Math.floor(x);
10965
+ if (b && b[0]) {
10966
+ const { width: S, height: x } = b[0].contentRect;
10967
+ E = Math.floor(S), T = Math.floor(x);
10956
10968
  }
10957
10969
  if (n.current.width === E && n.current.height === T)
10958
10970
  return;
@@ -10964,9 +10976,9 @@ function Qu(i, e) {
10964
10976
  f();
10965
10977
  const y = () => f();
10966
10978
  window.addEventListener("resize", y);
10967
- let b = null;
10968
- return typeof ResizeObserver < "u" && i.current.parentElement && (b = new ResizeObserver(f), b.observe(i.current.parentElement)), () => {
10969
- window.removeEventListener("resize", y), b == null || b.disconnect(), p !== null && cancelAnimationFrame(p);
10979
+ let _ = null;
10980
+ return typeof ResizeObserver < "u" && i.current.parentElement && (_ = new ResizeObserver(f), _.observe(i.current.parentElement)), () => {
10981
+ window.removeEventListener("resize", y), _ == null || _.disconnect(), p !== null && cancelAnimationFrame(p);
10970
10982
  };
10971
10983
  }, [s, i]), {
10972
10984
  viewer: t.current,
@@ -11055,7 +11067,7 @@ function td(i, e, t) {
11055
11067
  };
11056
11068
  }, [i, e, n]), s;
11057
11069
  }
11058
- class _i {
11070
+ class Si {
11059
11071
  /**
11060
11072
  * Convert IObject3D to THREE.Object3D
11061
11073
  */
@@ -11129,11 +11141,11 @@ function nd(i) {
11129
11141
  () => ({
11130
11142
  "model:loading": (n) => e.current.emit("model:loading", n),
11131
11143
  "model:progress": (n) => e.current.emit("model:progress", n),
11132
- "model:loaded": (n) => e.current.emit("model:loaded", _i.convertModelLoaded(n)),
11144
+ "model:loaded": (n) => e.current.emit("model:loaded", Si.convertModelLoaded(n)),
11133
11145
  "model:error": (n) => e.current.emit("model:error", n),
11134
11146
  "render:complete": (n) => e.current.emit("render:complete", n),
11135
- "controls:change": (n) => e.current.emit("controls:change", _i.convertControlsChange(n)),
11136
- "object:selected": (n) => e.current.emit("object:selected", _i.convertObjectSelected(n)),
11147
+ "controls:change": (n) => e.current.emit("controls:change", Si.convertControlsChange(n)),
11148
+ "object:selected": (n) => e.current.emit("object:selected", Si.convertObjectSelected(n)),
11137
11149
  error: (n) => e.current.emit("error", n)
11138
11150
  }),
11139
11151
  []
@@ -11230,7 +11242,7 @@ const od = (i, e, t, n, s, r) => {
11230
11242
  TOUCH_PAN: 4,
11231
11243
  TOUCH_DOLLY_PAN: 5,
11232
11244
  TOUCH_DOLLY_ROTATE: 6
11233
- }, bi = 1e-6;
11245
+ }, _i = 1e-6;
11234
11246
  class la extends Po {
11235
11247
  /**
11236
11248
  * Constructs a new controls instance.
@@ -11335,7 +11347,7 @@ class la extends Po {
11335
11347
  const o = this.object.zoom;
11336
11348
  this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), o !== this.object.zoom && (this.object.updateProjectionMatrix(), r = !0);
11337
11349
  }
11338
- return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > bi || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > bi || this._lastTargetPosition.distanceToSquared(this.target) > bi ? (this.dispatchEvent(fo), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
11350
+ return this._scale = 1, this._performCursorZoom = !1, r || this._lastPosition.distanceToSquared(this.object.position) > _i || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > _i || this._lastTargetPosition.distanceToSquared(this.target) > _i ? (this.dispatchEvent(fo), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
11339
11351
  }
11340
11352
  _getAutoRotationAngle(e) {
11341
11353
  return e !== null ? nt / 60 * this.autoRotateSpeed * e : nt / 60 / 60 * this.autoRotateSpeed;
@@ -11696,7 +11708,7 @@ const de = {
11696
11708
  };
11697
11709
  var Wt = /* @__PURE__ */ ((i) => (i.FRONT = "FRONT", i.BACK = "BACK", i.RIGHT = "RIGHT", i.LEFT = "LEFT", i.TOP = "TOP", i.BOTTOM = "BOTTOM", i))(Wt || {});
11698
11710
  new g.Vector3(0, 1, 0);
11699
- const es = "rotation-arrows-name", Yi = "left-rotation-arrow-name", Ys = "right-rotation-arrow-name", Sd = "gizmo-group-name", _d = [
11711
+ const es = "rotation-arrows-name", Yi = "left-rotation-arrow-name", Ys = "right-rotation-arrow-name", bd = "gizmo-group-name", Sd = [
11700
11712
  Ys,
11701
11713
  Yi
11702
11714
  ], Gs = {
@@ -11704,7 +11716,7 @@ const es = "rotation-arrows-name", Yi = "left-rotation-arrow-name", Ys = "right-
11704
11716
  DEFAULT_UP: new g.Vector3(0, 1, 0),
11705
11717
  FORWARD: new g.Vector3(0, 0, -1)
11706
11718
  }, xi = (i) => Gs.FORWARD.clone().applyQuaternion(i), go = (i, e, t = new g.Vector3()) => t.clone().add(i.multiplyScalar(-e));
11707
- class bd {
11719
+ class _d {
11708
11720
  constructor(e, t = es) {
11709
11721
  this.gizmoScene = e, this.gizmoArrowsName = t;
11710
11722
  }
@@ -11734,7 +11746,7 @@ class bd {
11734
11746
  e.position.copy(a), e.up.copy(o), e.camera.lookAt(n);
11735
11747
  }
11736
11748
  }
11737
- const ha = (i) => new bd(i), yo = (i, e, t) => {
11749
+ const ha = (i) => new _d(i), yo = (i, e, t) => {
11738
11750
  ha(t).syncGizmoWithMain(
11739
11751
  {
11740
11752
  camera: i,
@@ -11957,8 +11969,8 @@ class Id {
11957
11969
  createAxis(e) {
11958
11970
  const { color: t, direction: n, length: s, origin: r, lineWidth: o, label: a } = e, c = new g.Group(), u = o / 2, d = new g.CylinderGeometry(u, u, s, 32), h = new g.MeshBasicMaterial({ color: t }), p = new g.Mesh(d, h);
11959
11971
  if (p.position.copy(r).add(n.clone().multiplyScalar(s / 2)), !n.equals(new g.Vector3(0, 1, 0))) {
11960
- const y = new g.Vector3(0, 1, 0).cross(n).normalize(), b = Math.acos(new g.Vector3(0, 1, 0).dot(n));
11961
- p.setRotationFromAxisAngle(y, b);
11972
+ const y = new g.Vector3(0, 1, 0).cross(n).normalize(), _ = Math.acos(new g.Vector3(0, 1, 0).dot(n));
11973
+ p.setRotationFromAxisAngle(y, _);
11962
11974
  }
11963
11975
  c.add(p);
11964
11976
  const f = Cd(a, t);
@@ -12004,7 +12016,7 @@ class Id {
12004
12016
  }
12005
12017
  create() {
12006
12018
  const e = new g.Group();
12007
- e.name = Sd;
12019
+ e.name = bd;
12008
12020
  const t = this.createWireframe();
12009
12021
  e.add(t), this.createEdges(e), this.createCorners(e), this.createFaces(e);
12010
12022
  const n = this.createCoordinateAxes();
@@ -12219,30 +12231,30 @@ function Hd({
12219
12231
  gizmoControlRef: s
12220
12232
  }) {
12221
12233
  const r = je(null), o = je(null), a = je(new g.Raycaster()).current, c = je(new g.Vector2()).current, u = Mt(() => {
12222
- const b = e.getObjectByName(es), S = zd(t);
12223
- if (b && S) {
12224
- e.remove(b);
12234
+ const _ = e.getObjectByName(es), b = zd(t);
12235
+ if (_ && b) {
12236
+ e.remove(_);
12225
12237
  return;
12226
12238
  }
12227
- if (b || S) return;
12239
+ if (_ || b) return;
12228
12240
  const v = new Fd().create();
12229
12241
  v.rotation.copy(t.rotation), e.add(v);
12230
12242
  }, [e, t]), d = Mt(() => {
12231
- const b = e.getObjectByName(es);
12232
- b && e.remove(b);
12243
+ const _ = e.getObjectByName(es);
12244
+ _ && e.remove(_);
12233
12245
  }, [e]), h = Mt(
12234
- Ld((b) => {
12246
+ Ld((_) => {
12235
12247
  if (!s.current || !i) return;
12236
- wo(b, i, c);
12237
- const S = ua(
12248
+ wo(_, i, c);
12249
+ const b = ua(
12238
12250
  c,
12239
12251
  t,
12240
12252
  e,
12241
12253
  a
12242
- ), v = da(S);
12254
+ ), v = da(b);
12243
12255
  v != null && v.userData.gizmoCube ? v.userData.gizmoCube.highlightObject(v) : e.traverse((E) => {
12244
12256
  E.userData.gizmoCube && E.userData.gizmoCube.highlightObject(null);
12245
- }), S.length > 0 ? u() : d();
12257
+ }), b.length > 0 ? u() : d();
12246
12258
  }, 1e3 / Bd),
12247
12259
  [
12248
12260
  s,
@@ -12254,26 +12266,26 @@ function Hd({
12254
12266
  u,
12255
12267
  d
12256
12268
  ]
12257
- ), p = Mt((b) => {
12258
- r.current = Date.now(), o.current = { x: b.clientX, y: b.clientY };
12269
+ ), p = Mt((_) => {
12270
+ r.current = Date.now(), o.current = { x: _.clientX, y: _.clientY };
12259
12271
  }, []), f = Mt(
12260
- (b) => {
12261
- var S;
12262
- const v = b.name === Ys ? 1 : -1, E = 90 * Math.PI / 180, T = new g.Vector3(0, 0, 0), _ = v * E, x = new g.Matrix4();
12263
- x.makeRotationZ(_), t.up.applyMatrix4(x), t.lookAt(T), (S = s.current) == null || S.gizmoControls.update();
12272
+ (_) => {
12273
+ var b;
12274
+ const v = _.name === Ys ? 1 : -1, E = 90 * Math.PI / 180, T = new g.Vector3(0, 0, 0), S = v * E, x = new g.Matrix4();
12275
+ x.makeRotationZ(S), t.up.applyMatrix4(x), t.lookAt(T), (b = s.current) == null || b.gizmoControls.update();
12264
12276
  },
12265
12277
  [t, s]
12266
12278
  ), y = Mt(
12267
- (b) => {
12279
+ (_) => {
12268
12280
  if ((r.current ? Date.now() - r.current : 0) < Ud) {
12269
- wo(b, i, c);
12270
- const S = Od(
12281
+ wo(_, i, c);
12282
+ const b = Od(
12271
12283
  c,
12272
12284
  t,
12273
12285
  e,
12274
12286
  a
12275
12287
  );
12276
- S != null && S.name && _d.includes(S.name) ? f(S) : Dd(S, n);
12288
+ b != null && b.name && Sd.includes(b.name) ? f(b) : Dd(b, n);
12277
12289
  }
12278
12290
  r.current = null, o.current = null;
12279
12291
  },
@@ -12306,9 +12318,9 @@ const Gd = ({
12306
12318
  u,
12307
12319
  d,
12308
12320
  h
12309
- ), f = je(p).current, y = je(null), b = Mt(() => {
12321
+ ), f = je(p).current, y = je(null), _ = Mt(() => {
12310
12322
  a && (n(), a.render(o, f));
12311
- }, [n, a, o, f]), S = Mt(
12323
+ }, [n, a, o, f]), b = Mt(
12312
12324
  (x) => {
12313
12325
  if (!i || !e) return;
12314
12326
  const P = i.position.length(), I = x.clone().multiplyScalar(P), M = 400, O = new g.Matrix4();
@@ -12320,15 +12332,15 @@ const Gd = ({
12320
12332
  i.position.clone(),
12321
12333
  I,
12322
12334
  M,
12323
- b
12335
+ _
12324
12336
  ), i.up.set(0, 1, 0), i.lookAt(new g.Vector3(0, 0, 0)), e.target.set(0, 0, 0), e.update();
12325
12337
  },
12326
- [i, e, b, o]
12327
- ), { onMouseDown: v, onMouseMove: E, onMouseUp: T, onMouseLeave: _ } = Hd({
12338
+ [i, e, _, o]
12339
+ ), { onMouseDown: v, onMouseMove: E, onMouseUp: T, onMouseLeave: S } = Hd({
12328
12340
  gizmoRenderer: a,
12329
12341
  gizmoScene: o,
12330
12342
  gizmoCamera: f,
12331
- alignCameraWithVector: S,
12343
+ alignCameraWithVector: b,
12332
12344
  gizmoControlRef: y
12333
12345
  });
12334
12346
  return rt(() => {
@@ -12343,7 +12355,7 @@ const Gd = ({
12343
12355
  }, I = {
12344
12356
  mainCamera: i,
12345
12357
  mainControls: e,
12346
- renderGizmo: b
12358
+ renderGizmo: _
12347
12359
  }, M = {
12348
12360
  syncGizmoCameraWithMain: yo,
12349
12361
  syncMainCameraWithGizmo: xd
@@ -12353,12 +12365,12 @@ const Gd = ({
12353
12365
  mainParams: I,
12354
12366
  syncFunctions: M,
12355
12367
  options: s
12356
- }), x.addEventListener("mousedown", v), x.addEventListener("mousemove", E), x.addEventListener("mouseup", T), x.addEventListener("mouseleave", _), () => {
12357
- y.current && (y.current.dispose(), y.current = null), x.removeEventListener("mousedown", v), x.removeEventListener("mousemove", E), x.removeEventListener("mouseup", T), x.removeEventListener("mouseleave", _);
12368
+ }), x.addEventListener("mousedown", v), x.addEventListener("mousemove", E), x.addEventListener("mouseup", T), x.addEventListener("mouseleave", S), () => {
12369
+ y.current && (y.current.dispose(), y.current = null), x.removeEventListener("mousedown", v), x.removeEventListener("mousemove", E), x.removeEventListener("mouseup", T), x.removeEventListener("mouseleave", S);
12358
12370
  };
12359
- }, [i, e, b, E, v, T]), rt(() => {
12360
- i && (yo(f, i, o), b());
12361
- }, [i, b]), /* @__PURE__ */ Te(
12371
+ }, [i, e, _, E, v, T]), rt(() => {
12372
+ i && (yo(f, i, o), _());
12373
+ }, [i, _]), /* @__PURE__ */ Te(
12362
12374
  "div",
12363
12375
  {
12364
12376
  className: t ? `${t}` : "gizmo-default",
@@ -12575,19 +12587,19 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), pa =
12575
12587
  n,
12576
12588
  s,
12577
12589
  r
12578
- ), { viewer: y, isInitialized: b, initError: S } = Qu(c, f), v = td(y, b, i), E = nd(y);
12579
- sd(y, S, e);
12580
- const T = y ? ns(y.getCamera()) : null, _ = y ? fr(y.getControls()) : null, x = y ? Yo(y.getRenderer()) : null, P = Mt(() => {
12590
+ ), { viewer: y, isInitialized: _, initError: b } = Qu(c, f), v = td(y, _, i), E = nd(y);
12591
+ sd(y, b, e);
12592
+ const T = y ? ns(y.getCamera()) : null, S = y ? fr(y.getControls()) : null, x = y ? Yo(y.getRenderer()) : null, P = Mt(() => {
12581
12593
  y == null || y.requestRender();
12582
12594
  }, [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(
12583
12595
  () => $d(e.loadingIndicator),
12584
12596
  [e.loadingIndicator]
12585
- ), C = v.status === "error" || !!S, k = O.enabled && (v.status === "loading" || C);
12597
+ ), C = v.status === "error" || !!b, k = O.enabled && (v.status === "loading" || C);
12586
12598
  return Ya(a, () => ({
12587
- scene: y ? St(y.getScene()) : null,
12599
+ scene: y ? bt(y.getScene()) : null,
12588
12600
  camera: T,
12589
12601
  renderer: x,
12590
- controls: _,
12602
+ controls: S,
12591
12603
  events: E,
12592
12604
  loadModel: async (z) => {
12593
12605
  if (!y)
@@ -12654,13 +12666,13 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), pa =
12654
12666
  dispose: () => {
12655
12667
  y == null || y.dispose();
12656
12668
  }
12657
- }), [y, T, x, _, E]), /* @__PURE__ */ Te(Wd, { children: /* @__PURE__ */ Te(id, { viewer: y, canvasRef: c, children: /* @__PURE__ */ Zn("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
12669
+ }), [y, T, x, S, E]), /* @__PURE__ */ Te(Wd, { children: /* @__PURE__ */ Te(id, { viewer: y, canvasRef: c, children: /* @__PURE__ */ Zn("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
12658
12670
  /* @__PURE__ */ Te(rd, {}),
12659
- I && b && T && _ && /* @__PURE__ */ Te(
12671
+ I && _ && T && S && /* @__PURE__ */ Te(
12660
12672
  Vd,
12661
12673
  {
12662
12674
  camera: T,
12663
- controls: _,
12675
+ controls: S,
12664
12676
  render: P,
12665
12677
  placement: M.placement,
12666
12678
  size: M.size
@@ -12670,7 +12682,7 @@ const jt = () => new W("Viewer is not ready yet", Z.COMPONENT_NOT_MOUNTED), pa =
12670
12682
  Zd,
12671
12683
  {
12672
12684
  status: C ? "error" : "loading",
12673
- label: C ? O.errorLabel ?? (S == null ? void 0 : S.message) ?? v.error ?? "Failed to load model" : O.label,
12685
+ label: C ? O.errorLabel ?? (b == null ? void 0 : b.message) ?? v.error ?? "Failed to load model" : O.label,
12674
12686
  color: O.color,
12675
12687
  backdrop: O.backdrop
12676
12688
  }
@@ -12714,25 +12726,25 @@ function op({ position: i, occlude: e = !1, children: t }) {
12714
12726
  if (!d)
12715
12727
  return;
12716
12728
  const h = { x: r, y: o, z: a }, p = () => {
12717
- const S = d.project(h, e);
12718
- if (S) {
12719
- if (!S.visible) {
12729
+ const b = d.project(h, e);
12730
+ if (b) {
12731
+ if (!b.visible) {
12720
12732
  u.style.visibility = "hidden";
12721
12733
  return;
12722
12734
  }
12723
- u.style.visibility = "visible", u.style.left = `${S.left}px`, u.style.top = `${S.top}px`;
12735
+ u.style.visibility = "visible", u.style.left = `${b.left}px`, u.style.top = `${b.top}px`;
12724
12736
  }
12725
12737
  }, f = () => {
12726
12738
  d.invalidate(), p();
12727
12739
  };
12728
12740
  p();
12729
- const y = n.getEvents(), b = [
12741
+ const y = n.getEvents(), _ = [
12730
12742
  y.on("render:complete", p),
12731
12743
  y.on("controls:change", p),
12732
12744
  y.on("model:loaded", f)
12733
12745
  ];
12734
12746
  return window.addEventListener("resize", f), () => {
12735
- b.forEach((S) => S()), window.removeEventListener("resize", f);
12747
+ _.forEach((b) => b()), window.removeEventListener("resize", f);
12736
12748
  };
12737
12749
  }, [n, r, o, a, e]);
12738
12750
  const c = t != null && t !== !1;