threedviewer 2.4.1 → 2.4.2

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,6 +1,6 @@
1
1
  import Ai, { useRef as $e, useMemo as Fn, useState as ns, useEffect as Dr, createContext as qa, useContext as Ya, useCallback as Ht, Component as Za, forwardRef as Ko, useImperativeHandle as Ka } from "react";
2
2
  import * as E from "three";
3
- import { TrianglesDrawMode as Xa, TriangleFanDrawMode as is, TriangleStripDrawMode as Xo, Quaternion as Or, Matrix4 as Ue, Loader as $a, LoaderUtils as Ln, FileLoader as $o, MeshPhysicalMaterial as Gt, Vector2 as he, Color as Rt, LinearSRGBColorSpace as Mt, SRGBColorSpace as Hn, SpotLight as Qa, PointLight as Qo, DirectionalLight as Ja, Vector3 as Y, InstancedMesh as ec, InstancedBufferAttribute as tc, Object3D as Jo, TextureLoader as rc, ImageBitmapLoader as nc, BufferAttribute as tt, InterleavedBuffer as ic, InterleavedBufferAttribute as sc, LinearMipmapLinearFilter as ea, NearestMipmapLinearFilter as oc, LinearMipmapNearestFilter as ac, NearestMipmapNearestFilter as cc, LinearFilter as Ye, NearestFilter as De, RepeatWrapping as Lt, MirroredRepeatWrapping as lc, ClampToEdgeWrapping as er, PointsMaterial as uc, Material as Pi, LineBasicMaterial as hc, MeshStandardMaterial as bi, DoubleSide as _s, MeshBasicMaterial as Cr, PropertyBinding as fc, BufferGeometry as ur, SkinnedMesh as dc, Mesh as Xe, LineSegments as pc, Line as mc, LineLoop as gc, Points as vc, Group as Di, PerspectiveCamera as Ss, MathUtils as Es, OrthographicCamera as ta, Skeleton as yc, AnimationClip as Tc, Bone as xc, InterpolateDiscrete as bc, InterpolateLinear as ra, Texture as Us, VectorKeyframeTrack as Hs, NumberKeyframeTrack as Gs, QuaternionKeyframeTrack as js, ColorManagement as Ws, FrontSide as wi, Interpolant as wc, Box3 as kt, Sphere as na, Ray as ia, Plane as Ri, Controls as sa, MOUSE as rt, TOUCH as ct, Spherical as Gn, Line3 as Jt, Triangle as Pn, BackSide as As, UnsignedIntType as Nn, DataTexture as At, IntType as Oi, FloatType as Oe, UnsignedByteType as ss, UnsignedShortType as _c, ByteType as Vs, ShortType as Sc, RGBAFormat as He, RGBAIntegerFormat as os, RGIntegerFormat as oa, RedIntegerFormat as Ec, RGFormat as aa, RedFormat as jn, Matrix3 as Ac, Vector4 as sn, Float32BufferAttribute as qs, ShaderMaterial as Mi, NoBlending as Wn, WebGLRenderTarget as kn, DataUtils as Je, HalfFloatType as We, Source as Rc, DataArrayTexture as Mc, WebGLArrayRenderTarget as Ic, NoToneMapping as Cc, NormalBlending as ca, EquirectangularReflectionMapping as la, LinearMipMapLinearFilter as Pc, Clock as Dc, Scene as ua, AdditiveBlending as Oc, DataTextureLoader as ha, NoColorSpace as Fc, BoxGeometry as Lc } from "three";
3
+ import { TrianglesDrawMode as Xa, TriangleFanDrawMode as is, TriangleStripDrawMode as Xo, Quaternion as Or, Matrix4 as Ue, Loader as $a, LoaderUtils as Ln, FileLoader as $o, MeshPhysicalMaterial as Gt, Vector2 as he, Color as Rt, LinearSRGBColorSpace as It, SRGBColorSpace as Hn, SpotLight as Qa, PointLight as Qo, DirectionalLight as Ja, Vector3 as Y, InstancedMesh as ec, InstancedBufferAttribute as tc, Object3D as Jo, TextureLoader as rc, ImageBitmapLoader as nc, BufferAttribute as tt, InterleavedBuffer as ic, InterleavedBufferAttribute as sc, LinearMipmapLinearFilter as ea, NearestMipmapLinearFilter as oc, LinearMipmapNearestFilter as ac, NearestMipmapNearestFilter as cc, LinearFilter as Ye, NearestFilter as De, RepeatWrapping as Lt, MirroredRepeatWrapping as lc, ClampToEdgeWrapping as er, PointsMaterial as uc, Material as Pi, LineBasicMaterial as hc, MeshStandardMaterial as bi, DoubleSide as _s, MeshBasicMaterial as Cr, PropertyBinding as fc, BufferGeometry as ur, SkinnedMesh as dc, Mesh as Xe, LineSegments as pc, Line as mc, LineLoop as gc, Points as vc, Group as Di, PerspectiveCamera as Ss, MathUtils as Es, OrthographicCamera as ta, Skeleton as yc, AnimationClip as xc, Bone as Tc, InterpolateDiscrete as bc, InterpolateLinear as ra, Texture as Us, VectorKeyframeTrack as Hs, NumberKeyframeTrack as Gs, QuaternionKeyframeTrack as js, ColorManagement as Ws, FrontSide as wi, Interpolant as wc, Box3 as kt, Sphere as na, Ray as ia, Plane as Ri, Controls as sa, MOUSE as rt, TOUCH as ct, Spherical as Gn, Line3 as Jt, Triangle as Pn, BackSide as As, UnsignedIntType as Nn, DataTexture as At, IntType as Oi, FloatType as Oe, UnsignedByteType as ss, UnsignedShortType as _c, ByteType as Vs, ShortType as Sc, RGBAFormat as He, RGBAIntegerFormat as os, RGIntegerFormat as oa, RedIntegerFormat as Ec, RGFormat as aa, RedFormat as jn, Matrix3 as Ac, Vector4 as sn, Float32BufferAttribute as qs, ShaderMaterial as Ii, NoBlending as Wn, WebGLRenderTarget as kn, DataUtils as Je, HalfFloatType as We, Source as Rc, DataArrayTexture as Ic, WebGLArrayRenderTarget as Mc, NoToneMapping as Cc, NormalBlending as ca, EquirectangularReflectionMapping as la, LinearMipMapLinearFilter as Pc, Clock as Dc, Scene as ua, AdditiveBlending as Oc, DataTextureLoader as ha, NoColorSpace as Fc, BoxGeometry as Lc } from "three";
4
4
  var Yn = { exports: {} }, bn = {};
5
5
  /**
6
6
  * @license React
@@ -63,10 +63,10 @@ function kc() {
63
63
  oe.unshift("Warning: " + R), Function.prototype.apply.call(console[p], console, oe);
64
64
  }
65
65
  }
66
- var S = !1, M = !1, I = !1, C = !1, D = !1, O;
66
+ var S = !1, I = !1, M = !1, C = !1, D = !1, O;
67
67
  O = Symbol.for("react.module.reference");
68
68
  function z(p) {
69
- return !!(typeof p == "string" || typeof p == "function" || p === r || p === o || D || p === n || p === h || p === f || C || p === g || S || M || I || typeof p == "object" && p !== null && (p.$$typeof === l || p.$$typeof === u || p.$$typeof === i || p.$$typeof === a || p.$$typeof === c || // This needs to include all possible module reference object
69
+ return !!(typeof p == "string" || typeof p == "function" || p === r || p === o || D || p === n || p === h || p === f || C || p === g || S || I || M || typeof p == "object" && p !== null && (p.$$typeof === l || p.$$typeof === u || p.$$typeof === i || p.$$typeof === a || p.$$typeof === c || // This needs to include all possible module reference object
70
70
  // types supported by any Flight configuration anywhere since
71
71
  // we don't know which Flight build this will end up being used
72
72
  // with.
@@ -127,14 +127,14 @@ function kc() {
127
127
  }
128
128
  return null;
129
129
  }
130
- var B = Object.assign, J = 0, ne, ge, Ie, ve, ye, Ve, xe;
130
+ var B = Object.assign, J = 0, ne, ge, Me, ve, ye, Ve, Te;
131
131
  function Se() {
132
132
  }
133
133
  Se.__reactDisabledLog = !0;
134
134
  function ut() {
135
135
  {
136
136
  if (J === 0) {
137
- ne = console.log, ge = console.info, Ie = console.warn, ve = console.error, ye = console.group, Ve = console.groupCollapsed, xe = console.groupEnd;
137
+ ne = console.log, ge = console.info, Me = console.warn, ve = console.error, ye = console.group, Ve = console.groupCollapsed, Te = console.groupEnd;
138
138
  var p = {
139
139
  configurable: !0,
140
140
  enumerable: !0,
@@ -170,7 +170,7 @@ function kc() {
170
170
  value: ge
171
171
  }),
172
172
  warn: B({}, p, {
173
- value: Ie
173
+ value: Me
174
174
  }),
175
175
  error: B({}, p, {
176
176
  value: ve
@@ -182,7 +182,7 @@ function kc() {
182
182
  value: Ve
183
183
  }),
184
184
  groupEnd: B({}, p, {
185
- value: xe
185
+ value: Te
186
186
  })
187
187
  });
188
188
  }
@@ -286,7 +286,7 @@ function kc() {
286
286
  var R = p.prototype;
287
287
  return !!(R && R.isReactComponent);
288
288
  }
289
- function Tt(p, R, F) {
289
+ function xt(p, R, F) {
290
290
  if (p == null)
291
291
  return "";
292
292
  if (typeof p == "function")
@@ -304,11 +304,11 @@ function kc() {
304
304
  case c:
305
305
  return Wt(p.render);
306
306
  case u:
307
- return Tt(p.type, R, F);
307
+ return xt(p.type, R, F);
308
308
  case l: {
309
309
  var V = p, ie = V._payload, oe = V._init;
310
310
  try {
311
- return Tt(oe(ie), R, F);
311
+ return xt(oe(ie), R, F);
312
312
  } catch {
313
313
  }
314
314
  }
@@ -316,9 +316,9 @@ function kc() {
316
316
  return "";
317
317
  }
318
318
  var ft = Object.prototype.hasOwnProperty, fr = {}, dr = T.ReactDebugCurrentFrame;
319
- function It(p) {
319
+ function Mt(p) {
320
320
  if (p) {
321
- var R = p._owner, F = Tt(p.type, p._source, R ? R.type : null);
321
+ var R = p._owner, F = xt(p.type, p._source, R ? R.type : null);
322
322
  dr.setExtraStackFrame(F);
323
323
  } else
324
324
  dr.setExtraStackFrame(null);
@@ -338,7 +338,7 @@ function kc() {
338
338
  } catch (v) {
339
339
  X = v;
340
340
  }
341
- X && !(X instanceof Error) && (It(ie), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", V || "React class", F, $, typeof X), It(null)), X instanceof Error && !(X.message in fr) && (fr[X.message] = !0, It(ie), x("Failed %s type: %s", F, X.message), It(null));
341
+ X && !(X instanceof Error) && (Mt(ie), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", V || "React class", F, $, typeof X), Mt(null)), X instanceof Error && !(X.message in fr) && (fr[X.message] = !0, Mt(ie), x("Failed %s type: %s", F, X.message), Mt(null));
342
342
  }
343
343
  }
344
344
  }
@@ -413,7 +413,7 @@ function kc() {
413
413
  });
414
414
  }
415
415
  }
416
- var xt = function(p, R, F, V, ie, oe, $) {
416
+ var Tt = function(p, R, F, V, ie, oe, $) {
417
417
  var X = {
418
418
  // This tag allows us to uniquely identify this as a React Element
419
419
  $$typeof: e,
@@ -457,13 +457,13 @@ function kc() {
457
457
  var b = typeof p == "function" ? p.displayName || p.name || "Unknown" : p;
458
458
  X && Ke($, b), d && kr($, b);
459
459
  }
460
- return xt(p, X, d, ie, V, gr.current, $);
460
+ return Tt(p, X, d, ie, V, gr.current, $);
461
461
  }
462
462
  }
463
463
  var Ce = T.ReactCurrentOwner, yr = T.ReactDebugCurrentFrame;
464
464
  function K(p) {
465
465
  if (p) {
466
- var R = p._owner, F = Tt(p.type, p._source, R ? R.type : null);
466
+ var R = p._owner, F = xt(p.type, p._source, R ? R.type : null);
467
467
  yr.setExtraStackFrame(F);
468
468
  } else
469
469
  yr.setExtraStackFrame(null);
@@ -473,7 +473,7 @@ function kc() {
473
473
  function Yt(p) {
474
474
  return typeof p == "object" && p !== null && p.$$typeof === e;
475
475
  }
476
- function Tr() {
476
+ function xr() {
477
477
  {
478
478
  if (Ce.current) {
479
479
  var p = H(Ce.current.type);
@@ -488,10 +488,10 @@ Check the render method of \`` + p + "`.";
488
488
  function dn(p) {
489
489
  return "";
490
490
  }
491
- var xr = {};
491
+ var Tr = {};
492
492
  function pn(p) {
493
493
  {
494
- var R = Tr();
494
+ var R = xr();
495
495
  if (!R) {
496
496
  var F = typeof p == "string" ? p : p.displayName || p.name;
497
497
  F && (R = `
@@ -507,9 +507,9 @@ Check the top-level render call using <` + F + ">.");
507
507
  return;
508
508
  p._store.validated = !0;
509
509
  var F = pn(R);
510
- if (xr[F])
510
+ if (Tr[F])
511
511
  return;
512
- xr[F] = !0;
512
+ Tr[F] = !0;
513
513
  var V = "";
514
514
  p && p._owner && p._owner !== Ce.current && (V = " It was passed a child from " + H(p._owner.type) + "."), K(p), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', F, V), K(null);
515
515
  }
@@ -578,7 +578,7 @@ Check the top-level render call using <` + F + ">.");
578
578
  var X = "";
579
579
  (p === void 0 || typeof p == "object" && p !== null && Object.keys(p).length === 0) && (X += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
580
580
  var d = dn();
581
- d ? X += d : X += Tr();
581
+ d ? X += d : X += xr();
582
582
  var v;
583
583
  p === null ? v = "null" : Vt(p) ? v = "array" : p !== void 0 && p.$$typeof === e ? (v = "<" + (H(p.type) || "Unknown") + " />", X = " Did you accidentally export a JSX literal instead of a component?") : v = typeof p, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, X);
584
584
  }
@@ -621,8 +621,8 @@ React keys must be passed directly to JSX without using spread:
621
621
  function yn(p, R, F) {
622
622
  return Sr(p, R, F, !1);
623
623
  }
624
- var zr = yn, Tn = vn;
625
- wn.Fragment = r, wn.jsx = zr, wn.jsxs = Tn;
624
+ var zr = yn, xn = vn;
625
+ wn.Fragment = r, wn.jsx = zr, wn.jsxs = xn;
626
626
  }()), wn;
627
627
  }
628
628
  var Ks;
@@ -768,8 +768,8 @@ class Bc {
768
768
  return;
769
769
  }
770
770
  (this.alwaysRender || this.needsRender || this.continuousRenderingEnabled) && (e(n), this.lastRenderTime = r, this.needsRender = !1, this.enableIdleDetection && !this.alwaysRender && (this.wakeUp(), this.continuousRenderingEnabled || (this.idleTimeout = window.setTimeout(() => {
771
- this.isIdle = !0, console.log("[RenderLoopManager] Entering idle state");
772
- }, this.idleDelay)))), this.alwaysRender || !this.enableIdleDetection || !this.isIdle || this.continuousRenderingEnabled || this.needsRender ? this.animationFrameId = requestAnimationFrame(t) : (console.log("[RenderLoopManager] Stopping render loop (idle)"), this.animationFrameId = null);
771
+ this.isIdle = !0;
772
+ }, this.idleDelay)))), this.alwaysRender || !this.enableIdleDetection || !this.isIdle || this.continuousRenderingEnabled || this.needsRender ? this.animationFrameId = requestAnimationFrame(t) : this.animationFrameId = null;
773
773
  };
774
774
  this.animationFrameId = requestAnimationFrame(t);
775
775
  }
@@ -1243,14 +1243,14 @@ class Fi {
1243
1243
  */
1244
1244
  static logMemoryUsage(e = "Memory") {
1245
1245
  const t = this.getMemoryInfo();
1246
- t ? (console.log(`[${e}] JS Heap: ${t.jsHeapUsed}MB / ${t.jsHeapTotal}MB (Limit: ${t.jsHeapLimit}MB)`), t.webglMemory && console.log(`[${e}] WebGL - Programs: ${t.webglMemory.programs}, Geometries: ${t.webglMemory.geometries}, Textures: ${t.webglMemory.textures}`)) : console.log(`[${e}] Memory info not available (use Chrome with --enable-precise-memory-info)`);
1246
+ t && t.webglMemory;
1247
1247
  }
1248
1248
  /**
1249
1249
  * Monitor memory usage over time
1250
1250
  */
1251
1251
  static startMonitoring(e = 5e3, t = "MemoryMonitor") {
1252
1252
  const r = setInterval(() => {
1253
- this.logMemoryUsage(t);
1253
+ this.getMemoryInfo();
1254
1254
  }, e);
1255
1255
  return () => clearInterval(r);
1256
1256
  }
@@ -1946,7 +1946,7 @@ class Xs {
1946
1946
  return this.fog;
1947
1947
  }
1948
1948
  }
1949
- class Ms extends Qe {
1949
+ class Is extends Qe {
1950
1950
  constructor(e) {
1951
1951
  super(e), this.camera = e;
1952
1952
  }
@@ -1984,7 +1984,7 @@ class Ms extends Qe {
1984
1984
  return this.camera;
1985
1985
  }
1986
1986
  }
1987
- class Is extends Ms {
1987
+ class Ms extends Is {
1988
1988
  constructor(e) {
1989
1989
  const t = e || new E.PerspectiveCamera();
1990
1990
  super(t), this.perspectiveCamera = t;
@@ -2005,7 +2005,7 @@ class Is extends Ms {
2005
2005
  this.perspectiveCamera.aspect = e;
2006
2006
  }
2007
2007
  static create(e = 75, t = 1, r = 0.1, n = 1e3) {
2008
- return new Is(
2008
+ return new Ms(
2009
2009
  new E.PerspectiveCamera(e, t, r, n)
2010
2010
  );
2011
2011
  }
@@ -2022,7 +2022,6 @@ class qc {
2022
2022
  return this._id;
2023
2023
  }
2024
2024
  initialize(e) {
2025
- console.log("[ThreeRendererAdapter] initialize() called");
2026
2025
  try {
2027
2026
  if (this.renderer = new E.WebGLRenderer({
2028
2027
  canvas: this.canvas,
@@ -2031,7 +2030,7 @@ class qc {
2031
2030
  premultipliedAlpha: e.premultipliedAlpha ?? !0,
2032
2031
  preserveDrawingBuffer: e.preserveDrawingBuffer ?? !1,
2033
2032
  powerPreference: e.powerPreference ?? "default"
2034
- }), console.log("[ThreeRendererAdapter] WebGLRenderer created successfully"), e.shadowMap && (this.renderer.shadowMap.enabled = e.shadowMap.enabled, this.renderer.shadowMap.autoUpdate = !0, e.shadowMap.type)) {
2033
+ }), e.shadowMap && (this.renderer.shadowMap.enabled = e.shadowMap.enabled, this.renderer.shadowMap.autoUpdate = !0, e.shadowMap.type)) {
2035
2034
  const t = {
2036
2035
  basic: E.BasicShadowMap,
2037
2036
  pcf: E.PCFShadowMap,
@@ -2081,7 +2080,7 @@ class qc {
2081
2080
  le.INVALID_PARAMETER
2082
2081
  )
2083
2082
  );
2084
- if (!(t instanceof Ms))
2083
+ if (!(t instanceof Is))
2085
2084
  return Z.err(
2086
2085
  new ae(
2087
2086
  "Camera must be a ThreeCameraAdapter",
@@ -2089,7 +2088,7 @@ class qc {
2089
2088
  )
2090
2089
  );
2091
2090
  const r = e.getThreeScene(), n = t.getThreeCamera();
2092
- return this.renderer.__pathTracingActive ? (console.log("[ThreeRenderer] Skipping standard render - path tracing is active"), Z.ok(void 0)) : (this.renderer.render(r, n), Z.ok(void 0));
2091
+ return this.renderer.__pathTracingActive || this.renderer.render(r, n), Z.ok(void 0);
2093
2092
  } catch (r) {
2094
2093
  return Z.err(
2095
2094
  new ae(
@@ -2150,7 +2149,7 @@ class qc {
2150
2149
  * Implementation of IRendererExtension interface
2151
2150
  */
2152
2151
  getInternalRenderer() {
2153
- return console.log("[ThreeRendererAdapter] getInternalRenderer called, renderer exists:", !!this.renderer), this.renderer;
2152
+ return this.renderer;
2154
2153
  }
2155
2154
  // Legacy method for backward compatibility
2156
2155
  getThreeRenderer() {
@@ -2389,7 +2388,7 @@ class Kc {
2389
2388
  const o = t.json, c = ((o.extensions && o.extensions[this.name] || {}).lights || [])[e];
2390
2389
  let h;
2391
2390
  const f = new Rt(16777215);
2392
- c.color !== void 0 && f.setRGB(c.color[0], c.color[1], c.color[2], Mt);
2391
+ c.color !== void 0 && f.setRGB(c.color[0], c.color[1], c.color[2], It);
2393
2392
  const u = c.range !== void 0 ? c.range : 0;
2394
2393
  switch (c.type) {
2395
2394
  case "directional":
@@ -2431,7 +2430,7 @@ class Xc {
2431
2430
  if (o) {
2432
2431
  if (Array.isArray(o.baseColorFactor)) {
2433
2432
  const i = o.baseColorFactor;
2434
- e.color.setRGB(i[0], i[1], i[2], Mt), e.opacity = i[3];
2433
+ e.color.setRGB(i[0], i[1], i[2], It), e.opacity = i[3];
2435
2434
  }
2436
2435
  o.baseColorTexture !== void 0 && n.push(r.assignTexture(e, "map", o.baseColorTexture, Hn));
2437
2436
  }
@@ -2519,7 +2518,7 @@ class tl {
2519
2518
  const i = n.extensions[this.name];
2520
2519
  if (i.sheenColorFactor !== void 0) {
2521
2520
  const a = i.sheenColorFactor;
2522
- t.sheenColor.setRGB(a[0], a[1], a[2], Mt);
2521
+ t.sheenColor.setRGB(a[0], a[1], a[2], It);
2523
2522
  }
2524
2523
  return i.sheenRoughnessFactor !== void 0 && (t.sheenRoughness = i.sheenRoughnessFactor), i.sheenColorTexture !== void 0 && o.push(r.assignTexture(t, "sheenColorMap", i.sheenColorTexture, Hn)), i.sheenRoughnessTexture !== void 0 && o.push(r.assignTexture(t, "sheenRoughnessMap", i.sheenRoughnessTexture)), Promise.all(o);
2525
2524
  }
@@ -2555,7 +2554,7 @@ class nl {
2555
2554
  const o = [], i = n.extensions[this.name];
2556
2555
  t.thickness = i.thicknessFactor !== void 0 ? i.thicknessFactor : 0, i.thicknessTexture !== void 0 && o.push(r.assignTexture(t, "thicknessMap", i.thicknessTexture)), t.attenuationDistance = i.attenuationDistance || 1 / 0;
2557
2556
  const a = i.attenuationColor || [1, 1, 1];
2558
- return t.attenuationColor = new Rt().setRGB(a[0], a[1], a[2], Mt), Promise.all(o);
2557
+ return t.attenuationColor = new Rt().setRGB(a[0], a[1], a[2], It), Promise.all(o);
2559
2558
  }
2560
2559
  }
2561
2560
  class il {
@@ -2589,7 +2588,7 @@ class sl {
2589
2588
  const o = [], i = n.extensions[this.name];
2590
2589
  t.specularIntensity = i.specularFactor !== void 0 ? i.specularFactor : 1, i.specularTexture !== void 0 && o.push(r.assignTexture(t, "specularIntensityMap", i.specularTexture));
2591
2590
  const a = i.specularColorFactor || [1, 1, 1];
2592
- return t.specularColor = new Rt().setRGB(a[0], a[1], a[2], Mt), i.specularColorTexture !== void 0 && o.push(r.assignTexture(t, "specularColorMap", i.specularColorTexture, Hn)), Promise.all(o);
2591
+ return t.specularColor = new Rt().setRGB(a[0], a[1], a[2], It), i.specularColorTexture !== void 0 && o.push(r.assignTexture(t, "specularColorMap", i.specularColorTexture, Hn)), Promise.all(o);
2593
2592
  }
2594
2593
  }
2595
2594
  class ol {
@@ -2750,8 +2749,8 @@ class fl {
2750
2749
  c.TRANSLATION && m.fromBufferAttribute(c.TRANSLATION, S), c.ROTATION && T.fromBufferAttribute(c.ROTATION, S), c.SCALE && x.fromBufferAttribute(c.SCALE, S), _.setMatrixAt(S, w.compose(m, T, x));
2751
2750
  for (const S in c)
2752
2751
  if (S === "_COLOR_0") {
2753
- const M = c[S];
2754
- _.instanceColor = new tc(M.array, M.itemSize, M.normalized);
2752
+ const I = c[S];
2753
+ _.instanceColor = new tc(I.array, I.itemSize, I.normalized);
2755
2754
  } else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && y.geometry.setAttribute(S, c[S]);
2756
2755
  Jo.prototype.copy.call(_, y), this.parser.assignFinalMaterial(_), g.push(_);
2757
2756
  }
@@ -2818,7 +2817,7 @@ class pl {
2818
2817
  m !== void 0 && (w.normalized = m);
2819
2818
  }
2820
2819
  u(g);
2821
- }, a, h, Mt, l);
2820
+ }, a, h, It, l);
2822
2821
  });
2823
2822
  });
2824
2823
  }
@@ -2849,8 +2848,8 @@ class pa extends wc {
2849
2848
  interpolate_(e, t, r, n) {
2850
2849
  const o = this.resultBuffer, i = this.sampleValues, a = this.valueSize, c = a * 2, h = a * 3, f = n - t, u = (r - t) / f, l = u * u, g = l * u, y = e * h, w = y - h, m = -2 * g + 3 * l, T = g - l, x = 1 - m, _ = T - l + u;
2851
2850
  for (let S = 0; S !== a; S++) {
2852
- const M = i[w + S + a], I = i[w + S + c] * f, C = i[y + S + a], D = i[y + S] * f;
2853
- o[S] = x * M + _ * I + m * C + T * D;
2851
+ const I = i[w + S + a], M = i[w + S + c] * f, C = i[y + S + a], D = i[y + S] * f;
2852
+ o[S] = x * I + _ * M + m * C + T * D;
2854
2853
  }
2855
2854
  return o;
2856
2855
  }
@@ -2912,7 +2911,7 @@ const wt = {
2912
2911
  translation: "position",
2913
2912
  rotation: "quaternion",
2914
2913
  weights: "morphTargetInfluences"
2915
- }, Tl = {
2914
+ }, xl = {
2916
2915
  CUBICSPLINE: void 0,
2917
2916
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
2918
2917
  // keyframe track will be initialized with a default interpolation type, then modified.
@@ -2923,7 +2922,7 @@ const wt = {
2923
2922
  MASK: "MASK",
2924
2923
  BLEND: "BLEND"
2925
2924
  };
2926
- function xl(s) {
2925
+ function Tl(s) {
2927
2926
  return s.DefaultMaterial === void 0 && (s.DefaultMaterial = new bi({
2928
2927
  color: 16777215,
2929
2928
  emissive: 0,
@@ -3260,11 +3259,11 @@ class Al {
3260
3259
  } else
3261
3260
  a === null ? w = new h(n.count * c) : w = new h(a, l, n.count * c), m = new tt(w, c, y);
3262
3261
  if (n.sparse !== void 0) {
3263
- const T = Li.SCALAR, x = nn[n.sparse.indices.componentType], _ = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, M = new x(i[1], _, n.sparse.count * T), I = new h(i[2], S, n.sparse.count * c);
3262
+ const T = Li.SCALAR, x = nn[n.sparse.indices.componentType], _ = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, I = new x(i[1], _, n.sparse.count * T), M = new h(i[2], S, n.sparse.count * c);
3264
3263
  a !== null && (m = new tt(m.array.slice(), m.itemSize, m.normalized));
3265
- for (let C = 0, D = M.length; C < D; C++) {
3266
- const O = M[C];
3267
- if (m.setX(O, I[C * c]), c >= 2 && m.setY(O, I[C * c + 1]), c >= 3 && m.setZ(O, I[C * c + 2]), c >= 4 && m.setW(O, I[C * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
3264
+ for (let C = 0, D = I.length; C < D; C++) {
3265
+ const O = I[C];
3266
+ if (m.setX(O, M[C * c]), c >= 2 && m.setY(O, M[C * c + 1]), c >= 3 && m.setZ(O, M[C * c + 2]), c >= 4 && m.setW(O, M[C * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
3268
3267
  }
3269
3268
  }
3270
3269
  return m;
@@ -3395,7 +3394,7 @@ class Al {
3395
3394
  const u = o.pbrMetallicRoughness || {};
3396
3395
  if (a.color = new Rt(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
3397
3396
  const l = u.baseColorFactor;
3398
- a.color.setRGB(l[0], l[1], l[2], Mt), a.opacity = l[3];
3397
+ a.color.setRGB(l[0], l[1], l[2], It), a.opacity = l[3];
3399
3398
  }
3400
3399
  u.baseColorTexture !== void 0 && h.push(t.assignTexture(a, "map", u.baseColorTexture, Hn)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (h.push(t.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), h.push(t.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), i = this._invokeOne(function(l) {
3401
3400
  return l.getMaterialType && l.getMaterialType(e);
@@ -3411,7 +3410,7 @@ class Al {
3411
3410
  }
3412
3411
  if (o.occlusionTexture !== void 0 && i !== Cr && (h.push(t.assignTexture(a, "aoMap", o.occlusionTexture)), o.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = o.occlusionTexture.strength)), o.emissiveFactor !== void 0 && i !== Cr) {
3413
3412
  const u = o.emissiveFactor;
3414
- a.emissive = new Rt().setRGB(u[0], u[1], u[2], Mt);
3413
+ a.emissive = new Rt().setRGB(u[0], u[1], u[2], It);
3415
3414
  }
3416
3415
  return o.emissiveTexture !== void 0 && i !== Cr && h.push(t.assignTexture(a, "emissiveMap", o.emissiveTexture, Hn)), Promise.all(h).then(function() {
3417
3416
  const u = new i(a);
@@ -3458,7 +3457,7 @@ class Al {
3458
3457
  loadMesh(e) {
3459
3458
  const t = this, r = this.json, n = this.extensions, o = r.meshes[e], i = o.primitives, a = [];
3460
3459
  for (let c = 0, h = i.length; c < h; c++) {
3461
- const f = i[c].material === void 0 ? xl(this.cache) : this.getDependency("material", i[c].material);
3460
+ const f = i[c].material === void 0 ? Tl(this.cache) : this.getDependency("material", i[c].material);
3462
3461
  a.push(f);
3463
3462
  }
3464
3463
  return a.push(t.loadGeometries(i)), Promise.all(a).then(function(c) {
@@ -3552,15 +3551,15 @@ class Al {
3552
3551
  ]).then(function(u) {
3553
3552
  const l = u[0], g = u[1], y = u[2], w = u[3], m = u[4], T = [];
3554
3553
  for (let x = 0, _ = l.length; x < _; x++) {
3555
- const S = l[x], M = g[x], I = y[x], C = w[x], D = m[x];
3554
+ const S = l[x], I = g[x], M = y[x], C = w[x], D = m[x];
3556
3555
  if (S === void 0) continue;
3557
3556
  S.updateMatrix && S.updateMatrix();
3558
- const O = r._createAnimationTracks(S, M, I, C, D);
3557
+ const O = r._createAnimationTracks(S, I, M, C, D);
3559
3558
  if (O)
3560
3559
  for (let z = 0; z < O.length; z++)
3561
3560
  T.push(O[z]);
3562
3561
  }
3563
- return new Tc(o, void 0, T);
3562
+ return new xc(o, void 0, T);
3564
3563
  });
3565
3564
  }
3566
3565
  createNodeMesh(e) {
@@ -3615,7 +3614,7 @@ class Al {
3615
3614
  a.push(h);
3616
3615
  }), this.nodeCache[e] = Promise.all(a).then(function(h) {
3617
3616
  let f;
3618
- if (o.isBone === !0 ? f = new xc() : h.length > 1 ? f = new Di() : h.length === 1 ? f = h[0] : f = new Jo(), f !== h[0])
3617
+ if (o.isBone === !0 ? f = new Tc() : h.length > 1 ? f = new Di() : h.length === 1 ? f = h[0] : f = new Jo(), f !== h[0])
3619
3618
  for (let u = 0, l = h.length; u < l; u++)
3620
3619
  f.add(h[u]);
3621
3620
  if (o.name && (f.userData.name = o.name, f.name = i), $t(f, o), o.extensions && Er(r, f, o), o.matrix !== void 0) {
@@ -3682,7 +3681,7 @@ class Al {
3682
3681
  }
3683
3682
  break;
3684
3683
  }
3685
- const f = n.interpolation !== void 0 ? Tl[n.interpolation] : ra, u = this._getArrayFromAccessor(r);
3684
+ const f = n.interpolation !== void 0 ? xl[n.interpolation] : ra, u = this._getArrayFromAccessor(r);
3686
3685
  for (let l = 0, g = c.length; l < g; l++) {
3687
3686
  const y = new h(
3688
3687
  c[l] + "." + rr[o.path],
@@ -3769,11 +3768,11 @@ function to(s, e, t) {
3769
3768
  });
3770
3769
  n.push(i);
3771
3770
  }
3772
- return Ws.workingColorSpace !== Mt && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ws.workingColorSpace}" not supported.`), $t(s, e), Rl(s, e, t), Promise.all(n).then(function() {
3771
+ return Ws.workingColorSpace !== It && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ws.workingColorSpace}" not supported.`), $t(s, e), Rl(s, e, t), Promise.all(n).then(function() {
3773
3772
  return e.targets !== void 0 ? bl(s, e.targets, t) : s;
3774
3773
  });
3775
3774
  }
3776
- class Ml {
3775
+ class Il {
3777
3776
  constructor() {
3778
3777
  this.loadingManager = new E.LoadingManager(), this.loader = new Yc(this.loadingManager);
3779
3778
  }
@@ -3803,10 +3802,7 @@ class Ml {
3803
3802
  t(Z.ok(n));
3804
3803
  },
3805
3804
  (r) => {
3806
- if (r.total > 0) {
3807
- const n = r.loaded / r.total * 100;
3808
- console.log(`Loading: ${n.toFixed(0)}%`);
3809
- }
3805
+ r.total > 0;
3810
3806
  },
3811
3807
  (r) => {
3812
3808
  t(Z.err(
@@ -3857,7 +3853,7 @@ class ro {
3857
3853
  switch (t) {
3858
3854
  case "gltf":
3859
3855
  case "glb":
3860
- return new Ml();
3856
+ return new Il();
3861
3857
  // Add more loaders here in the future (FBX, OBJ, etc.)
3862
3858
  default:
3863
3859
  throw new ae(
@@ -3868,7 +3864,7 @@ class ro {
3868
3864
  }
3869
3865
  }
3870
3866
  }
3871
- const no = { type: "change" }, Cs = { type: "start" }, ma = { type: "end" }, Kn = new ia(), io = new Ri(), Il = Math.cos(70 * Es.DEG2RAD), ze = new Y(), it = 2 * Math.PI, we = {
3867
+ const no = { type: "change" }, Cs = { type: "start" }, ma = { type: "end" }, Kn = new ia(), io = new Ri(), Ml = Math.cos(70 * Es.DEG2RAD), ze = new Y(), it = 2 * Math.PI, we = {
3872
3868
  NONE: -1,
3873
3869
  ROTATE: 0,
3874
3870
  DOLLY: 1,
@@ -3940,7 +3936,7 @@ class ga extends sa {
3940
3936
  h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), i = ze.length();
3941
3937
  } else
3942
3938
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
3943
- i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (Kn.origin.copy(this.object.position), Kn.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(Kn.direction)) < Il ? this.object.lookAt(this.target) : (io.setFromNormalAndCoplanarPoint(this.object.up, this.target), Kn.intersectPlane(io, this.target))));
3939
+ i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (Kn.origin.copy(this.object.position), Kn.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(Kn.direction)) < Ml ? this.object.lookAt(this.target) : (io.setFromNormalAndCoplanarPoint(this.object.up, this.target), Kn.intersectPlane(io, this.target))));
3944
3940
  } else if (this.object.isOrthographicCamera) {
3945
3941
  const i = this.object.zoom;
3946
3942
  this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), i !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
@@ -4432,7 +4428,7 @@ class ya extends va {
4432
4428
  this.orbitControls.autoRotateSpeed = e;
4433
4429
  }
4434
4430
  }
4435
- class Ta extends va {
4431
+ class xa extends va {
4436
4432
  constructor(e, t) {
4437
4433
  const r = new Gl(e, t);
4438
4434
  super(r), r.screenSpacePanning = !0;
@@ -4529,8 +4525,8 @@ class Wl {
4529
4525
  const l = Math.max(-r, -u - r), g = Math.min(r, -u + r);
4530
4526
  for (let y = l; y <= g; y++) {
4531
4527
  const w = c * (u + y / 2), m = h * 0.75 * y, T = [], x = Math.PI * 2 / 6;
4532
- for (let M = 0; M <= 6; M++) {
4533
- const I = M * x + Math.PI / 6, C = w + n * Math.cos(I), D = m + n * Math.sin(I);
4528
+ for (let I = 0; I <= 6; I++) {
4529
+ const M = I * x + Math.PI / 6, C = w + n * Math.cos(M), D = m + n * Math.sin(M);
4534
4530
  T.push(new E.Vector3(C, 0, D));
4535
4531
  }
4536
4532
  const _ = new E.BufferGeometry().setFromPoints(T), S = new E.Line(_, a);
@@ -4613,18 +4609,18 @@ class Yl {
4613
4609
  const t = new E.Group(), r = e.size, n = e.divisions, o = r / n, i = o * 0.02, a = o - i, c = ((g = e.styleOptions) == null ? void 0 : g.height) || o * 0.05, h = ((y = e.styleOptions) == null ? void 0 : y.bevelSize) || c * 0.2, f = ((w = e.styleOptions) == null ? void 0 : w.randomHeight) || !1, u = ((m = e.styleOptions) == null ? void 0 : m.randomRotation) || !1, l = this.createStoneMaterial(e);
4614
4610
  for (let T = 0; T < n; T++)
4615
4611
  for (let x = 0; x < n; x++) {
4616
- const _ = (T - n / 2) * o + o / 2, S = (x - n / 2) * o + o / 2, M = f ? c * (0.8 + Math.random() * 0.4) : c, I = new E.Shape(), C = a / 2;
4617
- I.moveTo(-C, -C), I.lineTo(C, -C), I.lineTo(C, C), I.lineTo(-C, C), I.closePath();
4612
+ const _ = (T - n / 2) * o + o / 2, S = (x - n / 2) * o + o / 2, I = f ? c * (0.8 + Math.random() * 0.4) : c, M = new E.Shape(), C = a / 2;
4613
+ M.moveTo(-C, -C), M.lineTo(C, -C), M.lineTo(C, C), M.lineTo(-C, C), M.closePath();
4618
4614
  const D = {
4619
- depth: M,
4615
+ depth: I,
4620
4616
  bevelEnabled: !0,
4621
4617
  bevelSize: h,
4622
4618
  bevelThickness: h,
4623
4619
  bevelSegments: 2
4624
- }, O = new E.ExtrudeGeometry(I, D);
4620
+ }, O = new E.ExtrudeGeometry(M, D);
4625
4621
  O.rotateX(-Math.PI / 2);
4626
4622
  const z = new E.Mesh(O, l);
4627
- z.position.set(_, -M / 2, S), z.castShadow = !0, z.receiveShadow = !0, u && (z.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(z);
4623
+ z.position.set(_, -I / 2, S), z.castShadow = !0, z.receiveShadow = !0, u && (z.rotation.y = Math.floor(Math.random() * 4) * (Math.PI / 2)), t.add(z);
4628
4624
  }
4629
4625
  return t;
4630
4626
  }
@@ -4773,25 +4769,17 @@ class Zl {
4773
4769
  if (!(i != null && i.enabled))
4774
4770
  return Z.ok(void 0);
4775
4771
  const a = [];
4776
- n.traverse((I) => {
4772
+ n.traverse((M) => {
4777
4773
  var C, D, O;
4778
- ((C = I.userData) != null && C.isGrid || (D = I.userData) != null && D.isHexGrid || (O = I.userData) != null && O.isDefaultGrid) && a.push(I);
4779
- }), a.forEach((I) => n.remove(I));
4774
+ ((C = M.userData) != null && C.isGrid || (D = M.userData) != null && D.isHexGrid || (O = M.userData) != null && O.isDefaultGrid) && a.push(M);
4775
+ }), a.forEach((M) => n.remove(M));
4780
4776
  let c;
4781
4777
  t instanceof Qe || "getThreeObject" in t && typeof t.getThreeObject == "function" ? c = t.getThreeObject() : c = t;
4782
- const f = new E.Box3().setFromObject(c).getSize(new E.Vector3());
4783
- console.log("Object size:", f);
4784
- const l = 1, y = Fr.getGridSpacing(l).width, w = Math.max(f.x, f.z) * r;
4778
+ const f = new E.Box3().setFromObject(c).getSize(new E.Vector3()), l = 1, y = Fr.getGridSpacing(l).width, w = Math.max(f.x, f.z) * r;
4785
4779
  let m = 0, T = y;
4786
4780
  for (; T < w && m < 20; )
4787
4781
  m++, T += 2 * y;
4788
- w < y * 0.8 ? m = 0 : m < 3 && w > y * 2 && (m = 3), console.log("Grid parameters:", {
4789
- tileSize: l,
4790
- gridRadius: m,
4791
- requiredWidth: w,
4792
- hexWidth: y,
4793
- actualCoverage: (2 * m + 1) * y
4794
- });
4782
+ w < y * 0.8 ? m = 0 : m < 3 && w > y * 2 && (m = 3);
4795
4783
  const x = i.type || Qt.HEXAGONAL_GLASS, S = {
4796
4784
  size: Math.max(f.x, f.z) * r,
4797
4785
  divisions: m * 2 + 1,
@@ -4802,8 +4790,8 @@ class Zl {
4802
4790
  tileSize: l,
4803
4791
  ...i.styleOptions
4804
4792
  }
4805
- }, M = _i.createGrid(x, S);
4806
- return M.userData.isGrid = !0, M.userData.isHexGrid = !0, n.add(M), Z.ok(void 0);
4793
+ }, I = _i.createGrid(x, S);
4794
+ return I.userData.isGrid = !0, I.userData.isHexGrid = !0, n.add(I), Z.ok(void 0);
4807
4795
  } catch (n) {
4808
4796
  return Z.err(
4809
4797
  new ae(
@@ -4905,22 +4893,16 @@ class Zl {
4905
4893
  let n;
4906
4894
  e instanceof Qe || "getThreeObject" in e && typeof e.getThreeObject == "function" ? n = e.getThreeObject() : n = e;
4907
4895
  let o;
4908
- t instanceof Ms || "getThreeCamera" in t && typeof t.getThreeCamera == "function" ? o = t.getThreeCamera() : o = t;
4896
+ t instanceof Is || "getThreeCamera" in t && typeof t.getThreeCamera == "function" ? o = t.getThreeCamera() : o = t;
4909
4897
  let i;
4910
- r instanceof ya || r instanceof Ta || "getThreeControls" in r && typeof r.getThreeControls == "function" ? i = r.getThreeControls() : i = r;
4911
- const a = new E.Box3().setFromObject(n), c = a.getCenter(new E.Vector3()), h = a.getSize(new E.Vector3());
4912
- console.log("Fitting camera to object:", {
4913
- center: c,
4914
- size: h,
4915
- maxDimension: Math.max(h.x, h.y, h.z)
4916
- });
4917
- const f = Math.max(h.x, h.y, h.z);
4898
+ r instanceof ya || r instanceof xa || "getThreeControls" in r && typeof r.getThreeControls == "function" ? i = r.getThreeControls() : i = r;
4899
+ const a = new E.Box3().setFromObject(n), c = a.getCenter(new E.Vector3()), h = a.getSize(new E.Vector3()), f = Math.max(h.x, h.y, h.z);
4918
4900
  let u;
4919
4901
  "fov" in o ? u = o.fov * (Math.PI / 180) : u = 50 * (Math.PI / 180);
4920
4902
  let l = Math.abs(f / 2 / Math.tan(u / 2));
4921
4903
  l *= 2;
4922
4904
  const g = -Math.PI / 4, y = Math.PI / 8, w = c.x + l * Math.sin(g) * Math.cos(y), m = c.y + l * Math.sin(y), T = c.z + l * Math.cos(g) * Math.cos(y);
4923
- return o.position.set(w, m, T), o.lookAt(c), o.updateProjectionMatrix(), i && i.target && (i.target.copy(c), i.update()), console.log("Camera positioned at:", { x: w, y: m, z: T }), console.log("Looking at:", c), Z.ok(void 0);
4905
+ return o.position.set(w, m, T), o.lookAt(c), o.updateProjectionMatrix(), i && i.target && (i.target.copy(c), i.update()), Z.ok(void 0);
4924
4906
  } catch (n) {
4925
4907
  return Z.err(
4926
4908
  new ae(
@@ -4932,7 +4914,7 @@ class Zl {
4932
4914
  }
4933
4915
  }
4934
4916
  }
4935
- const xa = 0, Kl = 1, ba = 2, so = 2, Bi = 1.25, oo = 1, lr = 6 * 4 + 4 + 4, Ii = 65535, Xl = Math.pow(2, -24), Ui = Symbol("SKIP_GENERATION");
4917
+ const Ta = 0, Kl = 1, ba = 2, so = 2, Bi = 1.25, oo = 1, lr = 6 * 4 + 4 + 4, Mi = 65535, Xl = Math.pow(2, -24), Ui = Symbol("SKIP_GENERATION");
4936
4918
  function wa(s) {
4937
4919
  return s.index ? s.index.count : s.attributes.position.count;
4938
4920
  }
@@ -4984,8 +4966,8 @@ function Ql(s, e) {
4984
4966
  function Hi(s, e, t, r, n) {
4985
4967
  let o = 1 / 0, i = 1 / 0, a = 1 / 0, c = -1 / 0, h = -1 / 0, f = -1 / 0, u = 1 / 0, l = 1 / 0, g = 1 / 0, y = -1 / 0, w = -1 / 0, m = -1 / 0;
4986
4968
  for (let T = e * 6, x = (e + t) * 6; T < x; T += 6) {
4987
- const _ = s[T + 0], S = s[T + 1], M = _ - S, I = _ + S;
4988
- M < o && (o = M), I > c && (c = I), _ < u && (u = _), _ > y && (y = _);
4969
+ const _ = s[T + 0], S = s[T + 1], I = _ - S, M = _ + S;
4970
+ I < o && (o = I), M > c && (c = M), _ < u && (u = _), _ > y && (y = _);
4989
4971
  const C = s[T + 2], D = s[T + 3], O = C - D, z = C + D;
4990
4972
  O < i && (i = O), z > h && (h = z), C < l && (l = C), C > w && (w = C);
4991
4973
  const U = s[T + 4], k = s[T + 5], H = U - k, B = U + k;
@@ -5006,12 +4988,12 @@ function Jl(s, e = null, t = null, r = null) {
5006
4988
  let m = y + 0, T = y + 1, x = y + 2;
5007
4989
  o && (m = o[m], T = o[T], x = o[x]), a || (m = m * u + f, T = T * u + f, x = x * u + f);
5008
4990
  for (let _ = 0; _ < 3; _++) {
5009
- let S, M, I;
5010
- a ? (S = n[l[_]](m), M = n[l[_]](T), I = n[l[_]](x)) : (S = h[m + _], M = h[T + _], I = h[x + _]);
4991
+ let S, I, M;
4992
+ a ? (S = n[l[_]](m), I = n[l[_]](T), M = n[l[_]](x)) : (S = h[m + _], I = h[T + _], M = h[x + _]);
5011
4993
  let C = S;
5012
- M < C && (C = M), I < C && (C = I);
4994
+ I < C && (C = I), M < C && (C = M);
5013
4995
  let D = S;
5014
- M > D && (D = M), I > D && (D = I);
4996
+ I > D && (D = I), M > D && (D = M);
5015
4997
  const O = (D - C) / 2, z = _ * 2;
5016
4998
  c[w + z + 0] = C + O, c[w + z + 1] = O + (Math.abs(C) + O) * Xl;
5017
4999
  }
@@ -5058,7 +5040,7 @@ const Xt = 32, eu = (s, e) => s.candidate - e.candidate, nr = new Array(Xt).fill
5058
5040
  })), $n = new Float32Array(6);
5059
5041
  function tu(s, e, t, r, n, o) {
5060
5042
  let i = -1, a = 0;
5061
- if (o === xa)
5043
+ if (o === Ta)
5062
5044
  i = ao(e), i !== -1 && (a = (e[i] + e[i + 3]) / 2);
5063
5045
  else if (o === Kl)
5064
5046
  i = ao(s), i !== -1 && (a = ru(t, r, n, i));
@@ -5073,64 +5055,64 @@ function tu(s, e, t, r, n, o) {
5073
5055
  T.length = n;
5074
5056
  let x = 0;
5075
5057
  for (let S = f; S < u; S += 6, x++) {
5076
- const M = T[x];
5077
- M.candidate = t[S + 2 * l], M.count = 0;
5058
+ const I = T[x];
5059
+ I.candidate = t[S + 2 * l], I.count = 0;
5078
5060
  const {
5079
- bounds: I,
5061
+ bounds: M,
5080
5062
  leftCacheBounds: C,
5081
5063
  rightCacheBounds: D
5082
- } = M;
5064
+ } = I;
5083
5065
  for (let O = 0; O < 3; O++)
5084
- D[O] = 1 / 0, D[O + 3] = -1 / 0, C[O] = 1 / 0, C[O + 3] = -1 / 0, I[O] = 1 / 0, I[O + 3] = -1 / 0;
5085
- Xn(S, t, I);
5066
+ D[O] = 1 / 0, D[O + 3] = -1 / 0, C[O] = 1 / 0, C[O + 3] = -1 / 0, M[O] = 1 / 0, M[O + 3] = -1 / 0;
5067
+ Xn(S, t, M);
5086
5068
  }
5087
5069
  T.sort(eu);
5088
5070
  let _ = n;
5089
5071
  for (let S = 0; S < _; S++) {
5090
- const M = T[S];
5091
- for (; S + 1 < _ && T[S + 1].candidate === M.candidate; )
5072
+ const I = T[S];
5073
+ for (; S + 1 < _ && T[S + 1].candidate === I.candidate; )
5092
5074
  T.splice(S + 1, 1), _--;
5093
5075
  }
5094
5076
  for (let S = f; S < u; S += 6) {
5095
- const M = t[S + 2 * l];
5096
- for (let I = 0; I < _; I++) {
5097
- const C = T[I];
5098
- M >= C.candidate ? Xn(S, t, C.rightCacheBounds) : (Xn(S, t, C.leftCacheBounds), C.count++);
5077
+ const I = t[S + 2 * l];
5078
+ for (let M = 0; M < _; M++) {
5079
+ const C = T[M];
5080
+ I >= C.candidate ? Xn(S, t, C.rightCacheBounds) : (Xn(S, t, C.leftCacheBounds), C.count++);
5099
5081
  }
5100
5082
  }
5101
5083
  for (let S = 0; S < _; S++) {
5102
- const M = T[S], I = M.count, C = n - M.count, D = M.leftCacheBounds, O = M.rightCacheBounds;
5084
+ const I = T[S], M = I.count, C = n - I.count, D = I.leftCacheBounds, O = I.rightCacheBounds;
5103
5085
  let z = 0;
5104
- I !== 0 && (z = Sn(D) / c);
5086
+ M !== 0 && (z = Sn(D) / c);
5105
5087
  let U = 0;
5106
5088
  C !== 0 && (U = Sn(O) / c);
5107
- const k = oo + Bi * (z * I + U * C);
5108
- k < h && (i = l, h = k, a = M.candidate);
5089
+ const k = oo + Bi * (z * M + U * C);
5090
+ k < h && (i = l, h = k, a = I.candidate);
5109
5091
  }
5110
5092
  } else {
5111
5093
  for (let _ = 0; _ < Xt; _++) {
5112
5094
  const S = nr[_];
5113
5095
  S.count = 0, S.candidate = g + m + _ * m;
5114
- const M = S.bounds;
5115
- for (let I = 0; I < 3; I++)
5116
- M[I] = 1 / 0, M[I + 3] = -1 / 0;
5096
+ const I = S.bounds;
5097
+ for (let M = 0; M < 3; M++)
5098
+ I[M] = 1 / 0, I[M + 3] = -1 / 0;
5117
5099
  }
5118
5100
  for (let _ = f; _ < u; _ += 6) {
5119
- let I = ~~((t[_ + 2 * l] - g) / m);
5120
- I >= Xt && (I = Xt - 1);
5121
- const C = nr[I];
5101
+ let M = ~~((t[_ + 2 * l] - g) / m);
5102
+ M >= Xt && (M = Xt - 1);
5103
+ const C = nr[M];
5122
5104
  C.count++, Xn(_, t, C.bounds);
5123
5105
  }
5124
5106
  const T = nr[Xt - 1];
5125
5107
  co(T.bounds, T.rightCacheBounds);
5126
5108
  for (let _ = Xt - 2; _ >= 0; _--) {
5127
- const S = nr[_], M = nr[_ + 1];
5128
- lo(S.bounds, M.rightCacheBounds, S.rightCacheBounds);
5109
+ const S = nr[_], I = nr[_ + 1];
5110
+ lo(S.bounds, I.rightCacheBounds, S.rightCacheBounds);
5129
5111
  }
5130
5112
  let x = 0;
5131
5113
  for (let _ = 0; _ < Xt - 1; _++) {
5132
- const S = nr[_], M = S.count, I = S.bounds, D = nr[_ + 1].rightCacheBounds;
5133
- M !== 0 && (x === 0 ? co(I, $n) : lo(I, $n, $n)), x += M;
5114
+ const S = nr[_], I = S.count, M = S.bounds, D = nr[_ + 1].rightCacheBounds;
5115
+ I !== 0 && (x === 0 ? co(M, $n) : lo(M, $n, $n)), x += I;
5134
5116
  let O = 0, z = 0;
5135
5117
  x !== 0 && (O = Sn($n) / c);
5136
5118
  const U = n - x;
@@ -5215,13 +5197,13 @@ function gt(s, e) {
5215
5197
  function Ps(s, e) {
5216
5198
  return e[s + 7];
5217
5199
  }
5218
- let Aa, Dn, xi, Ra;
5200
+ let Aa, Dn, Ti, Ra;
5219
5201
  const su = Math.pow(2, 32);
5220
5202
  function us(s) {
5221
5203
  return "count" in s ? 1 : 1 + us(s.left) + us(s.right);
5222
5204
  }
5223
5205
  function ou(s, e, t) {
5224
- return Aa = new Float32Array(t), Dn = new Uint32Array(t), xi = new Uint16Array(t), Ra = new Uint8Array(t), hs(s, e);
5206
+ return Aa = new Float32Array(t), Dn = new Uint32Array(t), Ti = new Uint16Array(t), Ra = new Uint8Array(t), hs(s, e);
5225
5207
  }
5226
5208
  function hs(s, e) {
5227
5209
  const t = s / 4, r = s / 2, n = "count" in e, o = e.boundingData;
@@ -5233,12 +5215,12 @@ function hs(s, e) {
5233
5215
  Ra.set(new Uint8Array(i), s);
5234
5216
  for (let a = s, c = s + i.byteLength; a < c; a += lr) {
5235
5217
  const h = a / 2;
5236
- et(h, xi) || (Dn[a / 4 + 6] += t);
5218
+ et(h, Ti) || (Dn[a / 4 + 6] += t);
5237
5219
  }
5238
5220
  return s + i.byteLength;
5239
5221
  } else {
5240
5222
  const i = e.offset, a = e.count;
5241
- return Dn[t + 6] = i, xi[r + 14] = a, xi[r + 15] = Ii, s + lr;
5223
+ return Dn[t + 6] = i, Ti[r + 14] = a, Ti[r + 15] = Mi, s + lr;
5242
5224
  }
5243
5225
  else {
5244
5226
  const i = e.left, a = e.right, c = e.splitAxis;
@@ -5266,26 +5248,26 @@ function cu(s, e, t, r, n) {
5266
5248
  let T = !1;
5267
5249
  const x = new Gi();
5268
5250
  return Hi(e, t, r, x.boundingData, m), S(x, t, r, m), x;
5269
- function _(M) {
5270
- h && h(M / w);
5251
+ function _(I) {
5252
+ h && h(I / w);
5271
5253
  }
5272
- function S(M, I, C, D = null, O = 0) {
5254
+ function S(I, M, C, D = null, O = 0) {
5273
5255
  if (!T && O >= o && (T = !0, i && (console.warn(`MeshBVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`), console.warn(l))), C <= a || O >= o)
5274
- return _(I + C), M.offset = I, M.count = C, M;
5275
- const z = tu(M.boundingData, D, e, I, C, c);
5256
+ return _(M + C), I.offset = M, I.count = C, I;
5257
+ const z = tu(I.boundingData, D, e, M, C, c);
5276
5258
  if (z.axis === -1)
5277
- return _(I + C), M.offset = I, M.count = C, M;
5278
- const U = y(u, g, e, I, C, z);
5279
- if (U === I || U === I + C)
5280
- _(I + C), M.offset = I, M.count = C;
5259
+ return _(M + C), I.offset = M, I.count = C, I;
5260
+ const U = y(u, g, e, M, C, z);
5261
+ if (U === M || U === M + C)
5262
+ _(M + C), I.offset = M, I.count = C;
5281
5263
  else {
5282
- M.splitAxis = z.axis;
5283
- const k = new Gi(), H = I, B = U - I;
5284
- M.left = k, Hi(e, H, B, k.boundingData, m), S(k, H, B, m, O + 1);
5264
+ I.splitAxis = z.axis;
5265
+ const k = new Gi(), H = M, B = U - M;
5266
+ I.left = k, Hi(e, H, B, k.boundingData, m), S(k, H, B, m, O + 1);
5285
5267
  const J = new Gi(), ne = U, ge = C - B;
5286
- M.right = J, Hi(e, ne, ge, J.boundingData, m), S(J, ne, ge, m, O + 1);
5268
+ I.right = J, Hi(e, ne, ge, J.boundingData, m), S(J, ne, ge, m, O + 1);
5287
5269
  }
5288
- return M;
5270
+ return I;
5289
5271
  }
5290
5272
  }
5291
5273
  function lu(s, e) {
@@ -5427,16 +5409,16 @@ Nt.prototype.intersectsTriangle = function() {
5427
5409
  function y(w, m, T) {
5428
5410
  const x = w.points;
5429
5411
  let _ = 0, S = -1;
5430
- for (let M = 0; M < 3; M++) {
5431
- const { start: I, end: C } = f;
5432
- I.copy(x[M]), C.copy(x[(M + 1) % 3]), f.delta(i);
5433
- const D = ji(m.distanceToPoint(I));
5412
+ for (let I = 0; I < 3; I++) {
5413
+ const { start: M, end: C } = f;
5414
+ M.copy(x[I]), C.copy(x[(I + 1) % 3]), f.delta(i);
5415
+ const D = ji(m.distanceToPoint(M));
5434
5416
  if (ji(m.normal.dot(i)) && D) {
5435
5417
  T.copy(f), _ = 2;
5436
5418
  break;
5437
5419
  }
5438
5420
  const O = m.intersectLine(f, g);
5439
- if (!O && D && g.copy(I), (O || D) && !ji(g.distanceTo(C))) {
5421
+ if (!O && D && g.copy(M), (O || D) && !ji(g.distanceTo(C))) {
5440
5422
  if (_ <= 1)
5441
5423
  (_ === 1 ? T.start : T.end).copy(g), D && (S = _);
5442
5424
  else if (_ >= 2) {
@@ -5453,10 +5435,10 @@ Nt.prototype.intersectsTriangle = function() {
5453
5435
  this.needsUpdate && this.update(), m.isExtendedTriangle ? m.needsUpdate && m.update() : (s.copy(m), s.update(), m = s);
5454
5436
  const _ = this.plane, S = m.plane;
5455
5437
  if (Math.abs(_.normal.dot(S.normal)) > 1 - 1e-10) {
5456
- const M = this.satBounds, I = this.satAxes;
5438
+ const I = this.satBounds, M = this.satAxes;
5457
5439
  t[0] = m.a, t[1] = m.b, t[2] = m.c;
5458
5440
  for (let O = 0; O < 4; O++) {
5459
- const z = M[O], U = I[O];
5441
+ const z = I[O], U = M[O];
5460
5442
  if (r.setFromPoints(U, t), z.isSeparated(r)) return !1;
5461
5443
  }
5462
5444
  const C = m.satBounds, D = m.satAxes;
@@ -5466,7 +5448,7 @@ Nt.prototype.intersectsTriangle = function() {
5466
5448
  if (r.setFromPoints(U, e), z.isSeparated(r)) return !1;
5467
5449
  }
5468
5450
  for (let O = 0; O < 4; O++) {
5469
- const z = I[O];
5451
+ const z = M[O];
5470
5452
  for (let U = 0; U < 4; U++) {
5471
5453
  const k = D[U];
5472
5454
  if (o.crossVectors(z, k), r.setFromPoints(o, e), n.setFromPoints(o, t), r.isSeparated(n)) return !1;
@@ -5474,15 +5456,15 @@ Nt.prototype.intersectsTriangle = function() {
5474
5456
  }
5475
5457
  return T && (x || console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."), T.start.set(0, 0, 0), T.end.set(0, 0, 0)), !0;
5476
5458
  } else {
5477
- const M = y(this, S, u);
5478
- if (M === 1 && m.containsPoint(u.end))
5459
+ const I = y(this, S, u);
5460
+ if (I === 1 && m.containsPoint(u.end))
5479
5461
  return T && (T.start.copy(u.end), T.end.copy(u.end)), !0;
5480
- if (M !== 2)
5462
+ if (I !== 2)
5481
5463
  return !1;
5482
- const I = y(m, _, l);
5483
- if (I === 1 && this.containsPoint(l.end))
5464
+ const M = y(m, _, l);
5465
+ if (M === 1 && this.containsPoint(l.end))
5484
5466
  return T && (T.start.copy(l.end), T.end.copy(l.end)), !0;
5485
- if (I !== 2)
5467
+ if (M !== 2)
5486
5468
  return !1;
5487
5469
  if (u.delta(a), l.delta(c), a.dot(c) < 0) {
5488
5470
  let H = l.start;
@@ -5622,7 +5604,7 @@ nt.prototype.distanceToBox = function() {
5622
5604
  for (let m = 0; m < 3; m++)
5623
5605
  for (let T = 0; T <= 1; T++)
5624
5606
  for (let x = 0; x <= 1; x++) {
5625
- const _ = (m + 1) % 3, S = (m + 2) % 3, M = T << _ | x << S, I = 1 << m | T << _ | x << S, C = g[M], D = g[I];
5607
+ const _ = (m + 1) % 3, S = (m + 2) % 3, I = T << _ | x << S, M = 1 << m | T << _ | x << S, C = g[I], D = g[M];
5626
5608
  e[w].set(C, D);
5627
5609
  const z = s[m], U = s[_], k = s[S], H = t[w], B = H.start, J = H.end;
5628
5610
  B[z] = u[z], B[U] = T ? u[U] : l[U], B[k] = x ? u[k] : l[U], J[z] = l[z], J[U] = T ? u[U] : l[U], J[k] = x ? u[k] : l[U], w++;
@@ -5678,31 +5660,31 @@ class pu {
5678
5660
  };
5679
5661
  }
5680
5662
  }
5681
- const Me = new pu();
5663
+ const Ie = new pu();
5682
5664
  let ar, tn;
5683
5665
  const Br = [], Qn = /* @__PURE__ */ new Os(() => new kt());
5684
5666
  function mu(s, e, t, r, n, o) {
5685
- ar = Qn.getPrimitive(), tn = Qn.getPrimitive(), Br.push(ar, tn), Me.setBuffer(s._roots[e]);
5667
+ ar = Qn.getPrimitive(), tn = Qn.getPrimitive(), Br.push(ar, tn), Ie.setBuffer(s._roots[e]);
5686
5668
  const i = fs(0, s.geometry, t, r, n, o);
5687
- Me.clearBuffer(), Qn.releasePrimitive(ar), Qn.releasePrimitive(tn), Br.pop(), Br.pop();
5669
+ Ie.clearBuffer(), Qn.releasePrimitive(ar), Qn.releasePrimitive(tn), Br.pop(), Br.pop();
5688
5670
  const a = Br.length;
5689
5671
  return a > 0 && (tn = Br[a - 1], ar = Br[a - 2]), i;
5690
5672
  }
5691
5673
  function fs(s, e, t, r, n = null, o = 0, i = 0) {
5692
- const { float32Array: a, uint16Array: c, uint32Array: h } = Me;
5674
+ const { float32Array: a, uint16Array: c, uint32Array: h } = Ie;
5693
5675
  let f = s * 2;
5694
5676
  if (et(f, c)) {
5695
5677
  const l = lt(s, h), g = mt(f, c);
5696
5678
  return Fe(s, a, ar), r(l, g, !1, i, o + s, ar);
5697
5679
  } else {
5698
5680
  let z = function(k) {
5699
- const { uint16Array: H, uint32Array: B } = Me;
5681
+ const { uint16Array: H, uint32Array: B } = Ie;
5700
5682
  let J = k * 2;
5701
5683
  for (; !et(J, H); )
5702
5684
  k = St(k), J = k * 2;
5703
5685
  return lt(k, B);
5704
5686
  }, U = function(k) {
5705
- const { uint16Array: H, uint32Array: B } = Me;
5687
+ const { uint16Array: H, uint32Array: B } = Ie;
5706
5688
  let J = k * 2;
5707
5689
  for (; !et(J, H); )
5708
5690
  k = gt(k, B), J = k * 2;
@@ -5716,13 +5698,13 @@ function fs(s, e, t, r, n = null, o = 0, i = 0) {
5716
5698
  m = T, T = k, x = _;
5717
5699
  }
5718
5700
  x || (x = ar, Fe(y, a, x));
5719
- const S = et(y * 2, c), M = t(x, S, m, i + 1, o + y);
5720
- let I;
5721
- if (M === so) {
5701
+ const S = et(y * 2, c), I = t(x, S, m, i + 1, o + y);
5702
+ let M;
5703
+ if (I === so) {
5722
5704
  const k = z(y), B = U(y) - k;
5723
- I = r(k, B, !0, i + 1, o + y, x);
5705
+ M = r(k, B, !0, i + 1, o + y, x);
5724
5706
  } else
5725
- I = M && fs(
5707
+ M = I && fs(
5726
5708
  y,
5727
5709
  e,
5728
5710
  t,
@@ -5731,7 +5713,7 @@ function fs(s, e, t, r, n = null, o = 0, i = 0) {
5731
5713
  o,
5732
5714
  i + 1
5733
5715
  );
5734
- if (I) return !0;
5716
+ if (M) return !0;
5735
5717
  _ = tn, Fe(w, a, _);
5736
5718
  const C = et(w * 2, c), D = t(_, C, T, i + 1, o + w);
5737
5719
  let O;
@@ -5808,12 +5790,12 @@ function Le(s, e, t, r) {
5808
5790
  let a = e, c = e + 1, h = e + 2;
5809
5791
  t && (a = t.getX(a), c = t.getX(c), h = t.getX(h)), n.x = r.getX(a), n.y = r.getY(a), n.z = r.getZ(a), o.x = r.getX(c), o.y = r.getY(c), o.z = r.getZ(c), i.x = r.getX(h), i.y = r.getY(h), i.z = r.getZ(h);
5810
5792
  }
5811
- function Tu(s, e, t, r, n, o, i, a) {
5793
+ function xu(s, e, t, r, n, o, i, a) {
5812
5794
  const { geometry: c, _indirectBuffer: h } = s;
5813
5795
  for (let f = r, u = r + n; f < u; f++)
5814
5796
  Ci(c, e, t, f, o, i, a);
5815
5797
  }
5816
- function xu(s, e, t, r, n, o, i) {
5798
+ function Tu(s, e, t, r, n, o, i) {
5817
5799
  const { geometry: a, _indirectBuffer: c } = s;
5818
5800
  let h = 1 / 0, f = null;
5819
5801
  for (let u = r, l = r + n; u < l; u++) {
@@ -5840,29 +5822,29 @@ function wu(s, e = null) {
5840
5822
  o = f[l], i = new Uint32Array(o), a = new Uint16Array(o), c = new Float32Array(o), u(0, h), h += o.byteLength;
5841
5823
  function u(l, g, y = !1) {
5842
5824
  const w = l * 2;
5843
- if (a[w + 15] === Ii) {
5825
+ if (a[w + 15] === Mi) {
5844
5826
  const T = i[l + 6], x = a[w + 14];
5845
- let _ = 1 / 0, S = 1 / 0, M = 1 / 0, I = -1 / 0, C = -1 / 0, D = -1 / 0;
5827
+ let _ = 1 / 0, S = 1 / 0, I = 1 / 0, M = -1 / 0, C = -1 / 0, D = -1 / 0;
5846
5828
  for (let O = 3 * T, z = 3 * (T + x); O < z; O++) {
5847
5829
  let U = r[O];
5848
5830
  const k = n.getX(U), H = n.getY(U), B = n.getZ(U);
5849
- k < _ && (_ = k), k > I && (I = k), H < S && (S = H), H > C && (C = H), B < M && (M = B), B > D && (D = B);
5831
+ k < _ && (_ = k), k > M && (M = k), H < S && (S = H), H > C && (C = H), B < I && (I = B), B > D && (D = B);
5850
5832
  }
5851
- return c[l + 0] !== _ || c[l + 1] !== S || c[l + 2] !== M || c[l + 3] !== I || c[l + 4] !== C || c[l + 5] !== D ? (c[l + 0] = _, c[l + 1] = S, c[l + 2] = M, c[l + 3] = I, c[l + 4] = C, c[l + 5] = D, !0) : !1;
5833
+ return c[l + 0] !== _ || c[l + 1] !== S || c[l + 2] !== I || c[l + 3] !== M || c[l + 4] !== C || c[l + 5] !== D ? (c[l + 0] = _, c[l + 1] = S, c[l + 2] = I, c[l + 3] = M, c[l + 4] = C, c[l + 5] = D, !0) : !1;
5852
5834
  } else {
5853
5835
  const T = l + 8, x = i[l + 6], _ = T + g, S = x + g;
5854
- let M = y, I = !1, C = !1;
5855
- e ? M || (I = e.has(_), C = e.has(S), M = !I && !C) : (I = !0, C = !0);
5856
- const D = M || I, O = M || C;
5836
+ let I = y, M = !1, C = !1;
5837
+ e ? I || (M = e.has(_), C = e.has(S), I = !M && !C) : (M = !0, C = !0);
5838
+ const D = I || M, O = I || C;
5857
5839
  let z = !1;
5858
- D && (z = u(T, g, M));
5840
+ D && (z = u(T, g, I));
5859
5841
  let U = !1;
5860
- O && (U = u(x, g, M));
5842
+ O && (U = u(x, g, I));
5861
5843
  const k = z || U;
5862
5844
  if (k)
5863
5845
  for (let H = 0; H < 3; H++) {
5864
- const B = T + H, J = x + H, ne = c[B], ge = c[B + 3], Ie = c[J], ve = c[J + 3];
5865
- c[l + H] = ne < Ie ? ne : Ie, c[l + H + 3] = ge > ve ? ge : ve;
5846
+ const B = T + H, J = x + H, ne = c[B], ge = c[B + 3], Me = c[J], ve = c[J + 3];
5847
+ c[l + H] = ne < Me ? ne : Me, c[l + H + 3] = ge > ve ? ge : ve;
5866
5848
  }
5867
5849
  return k;
5868
5850
  }
@@ -5871,8 +5853,8 @@ function wu(s, e = null) {
5871
5853
  function hr(s, e, t, r, n) {
5872
5854
  let o, i, a, c, h, f;
5873
5855
  const u = 1 / t.direction.x, l = 1 / t.direction.y, g = 1 / t.direction.z, y = t.origin.x, w = t.origin.y, m = t.origin.z;
5874
- let T = e[s], x = e[s + 3], _ = e[s + 1], S = e[s + 3 + 1], M = e[s + 2], I = e[s + 3 + 2];
5875
- return u >= 0 ? (o = (T - y) * u, i = (x - y) * u) : (o = (x - y) * u, i = (T - y) * u), l >= 0 ? (a = (_ - w) * l, c = (S - w) * l) : (a = (S - w) * l, c = (_ - w) * l), o > c || a > i || ((a > o || isNaN(o)) && (o = a), (c < i || isNaN(i)) && (i = c), g >= 0 ? (h = (M - m) * g, f = (I - m) * g) : (h = (I - m) * g, f = (M - m) * g), o > f || h > i) ? !1 : ((h > o || o !== o) && (o = h), (f < i || i !== i) && (i = f), o <= n && i >= r);
5856
+ let T = e[s], x = e[s + 3], _ = e[s + 1], S = e[s + 3 + 1], I = e[s + 2], M = e[s + 3 + 2];
5857
+ return u >= 0 ? (o = (T - y) * u, i = (x - y) * u) : (o = (x - y) * u, i = (T - y) * u), l >= 0 ? (a = (_ - w) * l, c = (S - w) * l) : (a = (S - w) * l, c = (_ - w) * l), o > c || a > i || ((a > o || isNaN(o)) && (o = a), (c < i || isNaN(i)) && (i = c), g >= 0 ? (h = (I - m) * g, f = (M - m) * g) : (h = (M - m) * g, f = (I - m) * g), o > f || h > i) ? !1 : ((h > o || o !== o) && (o = h), (f < i || i !== i) && (i = f), o <= n && i >= r);
5876
5858
  }
5877
5859
  function _u(s, e, t, r, n, o, i, a) {
5878
5860
  const { geometry: c, _indirectBuffer: h } = s;
@@ -5900,13 +5882,13 @@ function Eu(s, e, t, r, n, o, i) {
5900
5882
  return !1;
5901
5883
  }
5902
5884
  function Au(s, e, t, r, n, o, i) {
5903
- Me.setBuffer(s._roots[e]), ds(0, s, t, r, n, o, i), Me.clearBuffer();
5885
+ Ie.setBuffer(s._roots[e]), ds(0, s, t, r, n, o, i), Ie.clearBuffer();
5904
5886
  }
5905
5887
  function ds(s, e, t, r, n, o, i) {
5906
- const { float32Array: a, uint16Array: c, uint32Array: h } = Me, f = s * 2;
5888
+ const { float32Array: a, uint16Array: c, uint32Array: h } = Ie, f = s * 2;
5907
5889
  if (et(f, c)) {
5908
5890
  const l = lt(s, h), g = mt(f, c);
5909
- Tu(e, t, r, l, g, n, o, i);
5891
+ xu(e, t, r, l, g, n, o, i);
5910
5892
  } else {
5911
5893
  const l = St(s);
5912
5894
  hr(l, a, r, o, i) && ds(l, e, t, r, n, o, i);
@@ -5915,27 +5897,27 @@ function ds(s, e, t, r, n, o, i) {
5915
5897
  }
5916
5898
  }
5917
5899
  const Ru = ["x", "y", "z"];
5918
- function Mu(s, e, t, r, n, o) {
5919
- Me.setBuffer(s._roots[e]);
5900
+ function Iu(s, e, t, r, n, o) {
5901
+ Ie.setBuffer(s._roots[e]);
5920
5902
  const i = ps(0, s, t, r, n, o);
5921
- return Me.clearBuffer(), i;
5903
+ return Ie.clearBuffer(), i;
5922
5904
  }
5923
5905
  function ps(s, e, t, r, n, o) {
5924
- const { float32Array: i, uint16Array: a, uint32Array: c } = Me;
5906
+ const { float32Array: i, uint16Array: a, uint32Array: c } = Ie;
5925
5907
  let h = s * 2;
5926
5908
  if (et(h, a)) {
5927
5909
  const u = lt(s, c), l = mt(h, a);
5928
- return xu(e, t, r, u, l, n, o);
5910
+ return Tu(e, t, r, u, l, n, o);
5929
5911
  } else {
5930
5912
  const u = Ps(s, c), l = Ru[u], y = r.direction[l] >= 0;
5931
5913
  let w, m;
5932
5914
  y ? (w = St(s), m = gt(s, c)) : (w = gt(s, c), m = St(s));
5933
5915
  const x = hr(w, i, r, n, o) ? ps(w, e, t, r, n, o) : null;
5934
5916
  if (x) {
5935
- const M = x.point[l];
5936
- if (y ? M <= i[m + u] : (
5917
+ const I = x.point[l];
5918
+ if (y ? I <= i[m + u] : (
5937
5919
  // min bounding data
5938
- M >= i[m + u + 3]
5920
+ I >= i[m + u + 3]
5939
5921
  ))
5940
5922
  return x;
5941
5923
  }
@@ -5944,13 +5926,13 @@ function ps(s, e, t, r, n, o) {
5944
5926
  }
5945
5927
  }
5946
5928
  const ni = /* @__PURE__ */ new kt(), jr = /* @__PURE__ */ new Nt(), Wr = /* @__PURE__ */ new Nt(), An = /* @__PURE__ */ new Ue(), po = /* @__PURE__ */ new nt(), ii = /* @__PURE__ */ new nt();
5947
- function Iu(s, e, t, r) {
5948
- Me.setBuffer(s._roots[e]);
5929
+ function Mu(s, e, t, r) {
5930
+ Ie.setBuffer(s._roots[e]);
5949
5931
  const n = ms(0, s, t, r);
5950
- return Me.clearBuffer(), n;
5932
+ return Ie.clearBuffer(), n;
5951
5933
  }
5952
5934
  function ms(s, e, t, r, n = null) {
5953
- const { float32Array: o, uint16Array: i, uint32Array: a } = Me;
5935
+ const { float32Array: o, uint16Array: i, uint32Array: a } = Ie;
5954
5936
  let c = s * 2;
5955
5937
  if (n === null && (t.boundingBox || t.computeBoundingBox(), po.set(t.boundingBox.min, t.boundingBox.max, r), n = po), et(c, i)) {
5956
5938
  const f = e.geometry, u = f.index, l = f.attributes.position, g = t.index, y = t.attributes.position, w = lt(s, a), m = mt(c, i);
@@ -5985,9 +5967,9 @@ function Fu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
5985
5967
  let x = 1 / 0, _ = null, S = null;
5986
5968
  return si.copy(t).invert(), Rn.matrix.copy(si), s.shapecast(
5987
5969
  {
5988
- boundsTraverseOrder: (M) => Vi.distanceToBox(M),
5989
- intersectsBounds: (M, I, C) => C < x && C < i ? (I && (Rn.min.copy(M.min), Rn.max.copy(M.max), Rn.needsUpdate = !0), !0) : !1,
5990
- intersectsRange: (M, I) => {
5970
+ boundsTraverseOrder: (I) => Vi.distanceToBox(I),
5971
+ intersectsBounds: (I, M, C) => C < x && C < i ? (M && (Rn.min.copy(I.min), Rn.max.copy(I.max), Rn.needsUpdate = !0), !0) : !1,
5972
+ intersectsRange: (I, M) => {
5991
5973
  if (e.boundsTree)
5992
5974
  return e.boundsTree.shapecast({
5993
5975
  boundsTraverseOrder: (D) => Rn.distanceToBox(D),
@@ -5995,7 +5977,7 @@ function Fu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
5995
5977
  intersectsRange: (D, O) => {
5996
5978
  for (let z = D, U = D + O; z < U; z++) {
5997
5979
  Le(g, 3 * z, u, f), g.a.applyMatrix4(t), g.b.applyMatrix4(t), g.c.applyMatrix4(t), g.needsUpdate = !0;
5998
- for (let k = M, H = M + I; k < H; k++) {
5980
+ for (let k = I, H = I + M; k < H; k++) {
5999
5981
  Le(l, 3 * k, h, c), l.needsUpdate = !0;
6000
5982
  const B = l.distanceToTriangle(g, y, m);
6001
5983
  if (B < x && (w.copy(y), T && T.copy(m), x = B, _ = k, S = z), B < o)
@@ -6008,7 +5990,7 @@ function Fu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
6008
5990
  const C = an(e);
6009
5991
  for (let D = 0, O = C; D < O; D++) {
6010
5992
  Le(g, 3 * D, u, f), g.a.applyMatrix4(t), g.b.applyMatrix4(t), g.c.applyMatrix4(t), g.needsUpdate = !0;
6011
- for (let z = M, U = M + I; z < U; z++) {
5993
+ for (let z = I, U = I + M; z < U; z++) {
6012
5994
  Le(l, 3 * z, h, c), l.needsUpdate = !0;
6013
5995
  const k = l.distanceToTriangle(g, y, m);
6014
5996
  if (k < x && (w.copy(y), T && T.copy(m), x = k, _ = z, S = D), k < o)
@@ -6029,43 +6011,43 @@ function Lu(s, e = null) {
6029
6011
  o = f[l], i = new Uint32Array(o), a = new Uint16Array(o), c = new Float32Array(o), u(0, h), h += o.byteLength;
6030
6012
  function u(l, g, y = !1) {
6031
6013
  const w = l * 2;
6032
- if (a[w + 15] === Ii) {
6014
+ if (a[w + 15] === Mi) {
6033
6015
  const T = i[l + 6], x = a[w + 14];
6034
- let _ = 1 / 0, S = 1 / 0, M = 1 / 0, I = -1 / 0, C = -1 / 0, D = -1 / 0;
6016
+ let _ = 1 / 0, S = 1 / 0, I = 1 / 0, M = -1 / 0, C = -1 / 0, D = -1 / 0;
6035
6017
  for (let O = T, z = T + x; O < z; O++) {
6036
6018
  const U = 3 * s.resolveTriangleIndex(O);
6037
6019
  for (let k = 0; k < 3; k++) {
6038
6020
  let H = U + k;
6039
6021
  H = r ? r[H] : H;
6040
6022
  const B = n.getX(H), J = n.getY(H), ne = n.getZ(H);
6041
- B < _ && (_ = B), B > I && (I = B), J < S && (S = J), J > C && (C = J), ne < M && (M = ne), ne > D && (D = ne);
6023
+ B < _ && (_ = B), B > M && (M = B), J < S && (S = J), J > C && (C = J), ne < I && (I = ne), ne > D && (D = ne);
6042
6024
  }
6043
6025
  }
6044
- return c[l + 0] !== _ || c[l + 1] !== S || c[l + 2] !== M || c[l + 3] !== I || c[l + 4] !== C || c[l + 5] !== D ? (c[l + 0] = _, c[l + 1] = S, c[l + 2] = M, c[l + 3] = I, c[l + 4] = C, c[l + 5] = D, !0) : !1;
6026
+ return c[l + 0] !== _ || c[l + 1] !== S || c[l + 2] !== I || c[l + 3] !== M || c[l + 4] !== C || c[l + 5] !== D ? (c[l + 0] = _, c[l + 1] = S, c[l + 2] = I, c[l + 3] = M, c[l + 4] = C, c[l + 5] = D, !0) : !1;
6045
6027
  } else {
6046
6028
  const T = l + 8, x = i[l + 6], _ = T + g, S = x + g;
6047
- let M = y, I = !1, C = !1;
6048
- e ? M || (I = e.has(_), C = e.has(S), M = !I && !C) : (I = !0, C = !0);
6049
- const D = M || I, O = M || C;
6029
+ let I = y, M = !1, C = !1;
6030
+ e ? I || (M = e.has(_), C = e.has(S), I = !M && !C) : (M = !0, C = !0);
6031
+ const D = I || M, O = I || C;
6050
6032
  let z = !1;
6051
- D && (z = u(T, g, M));
6033
+ D && (z = u(T, g, I));
6052
6034
  let U = !1;
6053
- O && (U = u(x, g, M));
6035
+ O && (U = u(x, g, I));
6054
6036
  const k = z || U;
6055
6037
  if (k)
6056
6038
  for (let H = 0; H < 3; H++) {
6057
- const B = T + H, J = x + H, ne = c[B], ge = c[B + 3], Ie = c[J], ve = c[J + 3];
6058
- c[l + H] = ne < Ie ? ne : Ie, c[l + H + 3] = ge > ve ? ge : ve;
6039
+ const B = T + H, J = x + H, ne = c[B], ge = c[B + 3], Me = c[J], ve = c[J + 3];
6040
+ c[l + H] = ne < Me ? ne : Me, c[l + H + 3] = ge > ve ? ge : ve;
6059
6041
  }
6060
6042
  return k;
6061
6043
  }
6062
6044
  }
6063
6045
  }
6064
6046
  function Nu(s, e, t, r, n, o, i) {
6065
- Me.setBuffer(s._roots[e]), gs(0, s, t, r, n, o, i), Me.clearBuffer();
6047
+ Ie.setBuffer(s._roots[e]), gs(0, s, t, r, n, o, i), Ie.clearBuffer();
6066
6048
  }
6067
6049
  function gs(s, e, t, r, n, o, i) {
6068
- const { float32Array: a, uint16Array: c, uint32Array: h } = Me, f = s * 2;
6050
+ const { float32Array: a, uint16Array: c, uint32Array: h } = Ie, f = s * 2;
6069
6051
  if (et(f, c)) {
6070
6052
  const l = lt(s, h), g = mt(f, c);
6071
6053
  _u(e, t, r, l, g, n, o, i);
@@ -6078,12 +6060,12 @@ function gs(s, e, t, r, n, o, i) {
6078
6060
  }
6079
6061
  const ku = ["x", "y", "z"];
6080
6062
  function zu(s, e, t, r, n, o) {
6081
- Me.setBuffer(s._roots[e]);
6063
+ Ie.setBuffer(s._roots[e]);
6082
6064
  const i = vs(0, s, t, r, n, o);
6083
- return Me.clearBuffer(), i;
6065
+ return Ie.clearBuffer(), i;
6084
6066
  }
6085
6067
  function vs(s, e, t, r, n, o) {
6086
- const { float32Array: i, uint16Array: a, uint32Array: c } = Me;
6068
+ const { float32Array: i, uint16Array: a, uint32Array: c } = Ie;
6087
6069
  let h = s * 2;
6088
6070
  if (et(h, a)) {
6089
6071
  const u = lt(s, c), l = mt(h, a);
@@ -6094,10 +6076,10 @@ function vs(s, e, t, r, n, o) {
6094
6076
  y ? (w = St(s), m = gt(s, c)) : (w = gt(s, c), m = St(s));
6095
6077
  const x = hr(w, i, r, n, o) ? vs(w, e, t, r, n, o) : null;
6096
6078
  if (x) {
6097
- const M = x.point[l];
6098
- if (y ? M <= i[m + u] : (
6079
+ const I = x.point[l];
6080
+ if (y ? I <= i[m + u] : (
6099
6081
  // min bounding data
6100
- M >= i[m + u + 3]
6082
+ I >= i[m + u + 3]
6101
6083
  ))
6102
6084
  return x;
6103
6085
  }
@@ -6105,19 +6087,19 @@ function vs(s, e, t, r, n, o) {
6105
6087
  return x && S ? x.distance <= S.distance ? x : S : x || S || null;
6106
6088
  }
6107
6089
  }
6108
- const oi = /* @__PURE__ */ new kt(), Vr = /* @__PURE__ */ new Nt(), qr = /* @__PURE__ */ new Nt(), Mn = /* @__PURE__ */ new Ue(), mo = /* @__PURE__ */ new nt(), ai = /* @__PURE__ */ new nt();
6090
+ const oi = /* @__PURE__ */ new kt(), Vr = /* @__PURE__ */ new Nt(), qr = /* @__PURE__ */ new Nt(), In = /* @__PURE__ */ new Ue(), mo = /* @__PURE__ */ new nt(), ai = /* @__PURE__ */ new nt();
6109
6091
  function Bu(s, e, t, r) {
6110
- Me.setBuffer(s._roots[e]);
6092
+ Ie.setBuffer(s._roots[e]);
6111
6093
  const n = ys(0, s, t, r);
6112
- return Me.clearBuffer(), n;
6094
+ return Ie.clearBuffer(), n;
6113
6095
  }
6114
6096
  function ys(s, e, t, r, n = null) {
6115
- const { float32Array: o, uint16Array: i, uint32Array: a } = Me;
6097
+ const { float32Array: o, uint16Array: i, uint32Array: a } = Ie;
6116
6098
  let c = s * 2;
6117
6099
  if (n === null && (t.boundingBox || t.computeBoundingBox(), mo.set(t.boundingBox.min, t.boundingBox.max, r), n = mo), et(c, i)) {
6118
6100
  const f = e.geometry, u = f.index, l = f.attributes.position, g = t.index, y = t.attributes.position, w = lt(s, a), m = mt(c, i);
6119
- if (Mn.copy(r).invert(), t.boundsTree)
6120
- return Fe(s, o, ai), ai.matrix.copy(Mn), ai.needsUpdate = !0, t.boundsTree.shapecast({
6101
+ if (In.copy(r).invert(), t.boundsTree)
6102
+ return Fe(s, o, ai), ai.matrix.copy(In), ai.needsUpdate = !0, t.boundsTree.shapecast({
6121
6103
  intersectsBounds: (x) => ai.intersectsBox(x),
6122
6104
  intersectsTriangle: (x) => {
6123
6105
  x.a.applyMatrix4(r), x.b.applyMatrix4(r), x.c.applyMatrix4(r), x.needsUpdate = !0;
@@ -6129,8 +6111,8 @@ function ys(s, e, t, r, n = null) {
6129
6111
  });
6130
6112
  for (let T = w, x = m + w; T < x; T++) {
6131
6113
  const _ = e.resolveTriangleIndex(T);
6132
- Le(Vr, 3 * _, u, l), Vr.a.applyMatrix4(Mn), Vr.b.applyMatrix4(Mn), Vr.c.applyMatrix4(Mn), Vr.needsUpdate = !0;
6133
- for (let S = 0, M = g.count; S < M; S += 3)
6114
+ Le(Vr, 3 * _, u, l), Vr.a.applyMatrix4(In), Vr.b.applyMatrix4(In), Vr.c.applyMatrix4(In), Vr.needsUpdate = !0;
6115
+ for (let S = 0, I = g.count; S < I; S += 3)
6134
6116
  if (Le(qr, S, g, y), qr.needsUpdate = !0, Vr.intersectsTriangle(qr))
6135
6117
  return !0;
6136
6118
  }
@@ -6139,28 +6121,28 @@ function ys(s, e, t, r, n = null) {
6139
6121
  return Fe(f, o, oi), !!(n.intersectsBox(oi) && ys(f, e, t, r, n) || (Fe(u, o, oi), n.intersectsBox(oi) && ys(u, e, t, r, n)));
6140
6122
  }
6141
6123
  }
6142
- const ci = /* @__PURE__ */ new Ue(), qi = /* @__PURE__ */ new nt(), In = /* @__PURE__ */ new nt(), Uu = /* @__PURE__ */ new Y(), Hu = /* @__PURE__ */ new Y(), Gu = /* @__PURE__ */ new Y(), ju = /* @__PURE__ */ new Y();
6124
+ const ci = /* @__PURE__ */ new Ue(), qi = /* @__PURE__ */ new nt(), Mn = /* @__PURE__ */ new nt(), Uu = /* @__PURE__ */ new Y(), Hu = /* @__PURE__ */ new Y(), Gu = /* @__PURE__ */ new Y(), ju = /* @__PURE__ */ new Y();
6143
6125
  function Wu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
6144
6126
  e.boundingBox || e.computeBoundingBox(), qi.set(e.boundingBox.min, e.boundingBox.max, t), qi.needsUpdate = !0;
6145
6127
  const a = s.geometry, c = a.attributes.position, h = a.index, f = e.attributes.position, u = e.index, l = Et.getPrimitive(), g = Et.getPrimitive();
6146
6128
  let y = Uu, w = Hu, m = null, T = null;
6147
6129
  n && (m = Gu, T = ju);
6148
6130
  let x = 1 / 0, _ = null, S = null;
6149
- return ci.copy(t).invert(), In.matrix.copy(ci), s.shapecast(
6131
+ return ci.copy(t).invert(), Mn.matrix.copy(ci), s.shapecast(
6150
6132
  {
6151
- boundsTraverseOrder: (M) => qi.distanceToBox(M),
6152
- intersectsBounds: (M, I, C) => C < x && C < i ? (I && (In.min.copy(M.min), In.max.copy(M.max), In.needsUpdate = !0), !0) : !1,
6153
- intersectsRange: (M, I) => {
6133
+ boundsTraverseOrder: (I) => qi.distanceToBox(I),
6134
+ intersectsBounds: (I, M, C) => C < x && C < i ? (M && (Mn.min.copy(I.min), Mn.max.copy(I.max), Mn.needsUpdate = !0), !0) : !1,
6135
+ intersectsRange: (I, M) => {
6154
6136
  if (e.boundsTree) {
6155
6137
  const C = e.boundsTree;
6156
6138
  return C.shapecast({
6157
- boundsTraverseOrder: (D) => In.distanceToBox(D),
6139
+ boundsTraverseOrder: (D) => Mn.distanceToBox(D),
6158
6140
  intersectsBounds: (D, O, z) => z < x && z < i,
6159
6141
  intersectsRange: (D, O) => {
6160
6142
  for (let z = D, U = D + O; z < U; z++) {
6161
6143
  const k = C.resolveTriangleIndex(z);
6162
6144
  Le(g, 3 * k, u, f), g.a.applyMatrix4(t), g.b.applyMatrix4(t), g.c.applyMatrix4(t), g.needsUpdate = !0;
6163
- for (let H = M, B = M + I; H < B; H++) {
6145
+ for (let H = I, B = I + M; H < B; H++) {
6164
6146
  const J = s.resolveTriangleIndex(H);
6165
6147
  Le(l, 3 * J, h, c), l.needsUpdate = !0;
6166
6148
  const ne = l.distanceToTriangle(g, y, m);
@@ -6174,7 +6156,7 @@ function Wu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
6174
6156
  const C = an(e);
6175
6157
  for (let D = 0, O = C; D < O; D++) {
6176
6158
  Le(g, 3 * D, u, f), g.a.applyMatrix4(t), g.b.applyMatrix4(t), g.c.applyMatrix4(t), g.needsUpdate = !0;
6177
- for (let z = M, U = M + I; z < U; z++) {
6159
+ for (let z = I, U = I + M; z < U; z++) {
6178
6160
  const k = s.resolveTriangleIndex(z);
6179
6161
  Le(l, 3 * k, h, c), l.needsUpdate = !0;
6180
6162
  const H = l.distanceToTriangle(g, y, m);
@@ -6190,7 +6172,7 @@ function Wu(s, e, t, r = {}, n = {}, o = 0, i = 1 / 0) {
6190
6172
  function Vu() {
6191
6173
  return typeof SharedArrayBuffer < "u";
6192
6174
  }
6193
- const zn = new Me.constructor(), Si = new Me.constructor(), sr = new Os(() => new kt()), Yr = new kt(), Zr = new kt(), Yi = new kt(), Zi = new kt();
6175
+ const zn = new Ie.constructor(), Si = new Ie.constructor(), sr = new Os(() => new kt()), Yr = new kt(), Zr = new kt(), Yi = new kt(), Zi = new kt();
6194
6176
  let Ki = !1;
6195
6177
  function qu(s, e, t, r) {
6196
6178
  if (Ki)
@@ -6224,9 +6206,9 @@ function qu(s, e, t, r) {
6224
6206
  function Dt(s, e, t, r, n, o = 0, i = 0, a = 0, c = 0, h = null, f = !1) {
6225
6207
  let u, l;
6226
6208
  f ? (u = Si, l = zn) : (u = zn, l = Si);
6227
- const g = u.float32Array, y = u.uint32Array, w = u.uint16Array, m = l.float32Array, T = l.uint32Array, x = l.uint16Array, _ = s * 2, S = e * 2, M = et(_, w), I = et(S, x);
6209
+ const g = u.float32Array, y = u.uint32Array, w = u.uint16Array, m = l.float32Array, T = l.uint32Array, x = l.uint16Array, _ = s * 2, S = e * 2, I = et(_, w), M = et(S, x);
6228
6210
  let C = !1;
6229
- if (I && M)
6211
+ if (M && I)
6230
6212
  f ? C = n(
6231
6213
  lt(e, T),
6232
6214
  mt(e * 2, x),
@@ -6246,7 +6228,7 @@ function Dt(s, e, t, r, n, o = 0, i = 0, a = 0, c = 0, h = null, f = !1) {
6246
6228
  c,
6247
6229
  i + e
6248
6230
  );
6249
- else if (I) {
6231
+ else if (M) {
6250
6232
  const D = sr.getPrimitive();
6251
6233
  Fe(e, m, D), D.applyMatrix4(t);
6252
6234
  const O = St(s), z = gt(s, y);
@@ -6308,7 +6290,7 @@ function Dt(s, e, t, r, n, o = 0, i = 0, a = 0, c = 0, h = null, f = !1) {
6308
6290
  f
6309
6291
  );
6310
6292
  else if (z)
6311
- if (M)
6293
+ if (I)
6312
6294
  C = Dt(
6313
6295
  s,
6314
6296
  D,
@@ -6355,7 +6337,7 @@ function Dt(s, e, t, r, n, o = 0, i = 0, a = 0, c = 0, h = null, f = !1) {
6355
6337
  ), sr.releasePrimitive(k);
6356
6338
  }
6357
6339
  else if (U)
6358
- if (M)
6340
+ if (I)
6359
6341
  C = Dt(
6360
6342
  s,
6361
6343
  O,
@@ -6405,7 +6387,7 @@ function Dt(s, e, t, r, n, o = 0, i = 0, a = 0, c = 0, h = null, f = !1) {
6405
6387
  return C;
6406
6388
  }
6407
6389
  const li = /* @__PURE__ */ new nt(), go = /* @__PURE__ */ new kt(), Yu = {
6408
- strategy: xa,
6390
+ strategy: Ta,
6409
6391
  maxDepth: 40,
6410
6392
  maxLeafTris: 10,
6411
6393
  useSharedArrayBuffer: !1,
@@ -6473,7 +6455,7 @@ class Fs {
6473
6455
  const r = this._roots[t], n = new Uint32Array(r), o = new Uint16Array(r);
6474
6456
  i(0);
6475
6457
  function i(a, c = 0) {
6476
- const h = a * 2, f = o[h + 15] === Ii;
6458
+ const h = a * 2, f = o[h + 15] === Mi;
6477
6459
  if (f) {
6478
6460
  const u = n[a + 6], l = o[h + 14];
6479
6461
  e(c, f, new Float32Array(r, a * 4, 6), u, l);
@@ -6499,7 +6481,7 @@ class Fs {
6499
6481
  raycastFirst(e, t = wi, r = 0, n = 1 / 0) {
6500
6482
  const o = this._roots, i = this.geometry, a = t.isMaterial, c = Array.isArray(t);
6501
6483
  let h = null;
6502
- const f = i.groups, u = a ? t.side : t, l = this.indirect ? zu : Mu;
6484
+ const f = i.groups, u = a ? t.side : t, l = this.indirect ? zu : Iu;
6503
6485
  for (let g = 0, y = o.length; g < y; g++) {
6504
6486
  const w = c ? t[f[g].materialIndex].side : u, m = l(this, g, w, e, r, n);
6505
6487
  m != null && (h == null || m.distance < h.distance) && (h = m, c && (m.face.materialIndex = f[g].materialIndex));
@@ -6508,7 +6490,7 @@ class Fs {
6508
6490
  }
6509
6491
  intersectsGeometry(e, t) {
6510
6492
  let r = !1;
6511
- const n = this._roots, o = this.indirect ? Bu : Iu;
6493
+ const n = this._roots, o = this.indirect ? Bu : Mu;
6512
6494
  for (let i = 0, a = n.length; i < a && (r = o(this, i, e, t), !r); i++)
6513
6495
  ;
6514
6496
  return r;
@@ -6552,19 +6534,19 @@ class Fs {
6552
6534
  Le(f, y * 3, u, l);
6553
6535
  };
6554
6536
  if (o) {
6555
- const y = (w, m, T, x, _, S, M, I) => {
6537
+ const y = (w, m, T, x, _, S, I, M) => {
6556
6538
  for (let C = T, D = T + x; C < D; C++) {
6557
6539
  g(C), f.a.applyMatrix4(t), f.b.applyMatrix4(t), f.c.applyMatrix4(t), f.needsUpdate = !0;
6558
6540
  for (let O = w, z = w + m; O < z; O++)
6559
- if (h(O), i.needsUpdate = !0, o(i, f, O, C, _, S, M, I))
6541
+ if (h(O), i.needsUpdate = !0, o(i, f, O, C, _, S, I, M))
6560
6542
  return !0;
6561
6543
  }
6562
6544
  return !1;
6563
6545
  };
6564
6546
  if (n) {
6565
6547
  const w = n;
6566
- n = function(m, T, x, _, S, M, I, C) {
6567
- return w(m, T, x, _, S, M, I, C) ? !0 : y(m, T, x, _, S, M, I, C);
6548
+ n = function(m, T, x, _, S, I, M, C) {
6549
+ return w(m, T, x, _, S, I, M, C) ? !0 : y(m, T, x, _, S, I, M, C);
6568
6550
  };
6569
6551
  } else
6570
6552
  n = y;
@@ -6651,7 +6633,7 @@ function vo(s) {
6651
6633
  return os;
6652
6634
  }
6653
6635
  }
6654
- class Ma extends At {
6636
+ class Ia extends At {
6655
6637
  constructor() {
6656
6638
  super(), this.minFilter = De, this.magFilter = De, this.generateMipmaps = !1, this.overrideItemSize = null, this._forcedType = null;
6657
6639
  }
@@ -6695,26 +6677,26 @@ class Ma extends At {
6695
6677
  u === 3 && (g === He || g === os) && (u = 4);
6696
6678
  const T = Math.ceil(Math.sqrt(i)) || 1, x = u * T * T, _ = new w(x), S = e.normalized;
6697
6679
  e.normalized = !1;
6698
- for (let M = 0; M < i; M++) {
6699
- const I = u * M;
6700
- _[I] = e.getX(M) / y, o >= 2 && (_[I + 1] = e.getY(M) / y), o >= 3 && (_[I + 2] = e.getZ(M) / y, u === 4 && (_[I + 3] = 1)), o >= 4 && (_[I + 3] = e.getW(M) / y);
6680
+ for (let I = 0; I < i; I++) {
6681
+ const M = u * I;
6682
+ _[M] = e.getX(I) / y, o >= 2 && (_[M + 1] = e.getY(I) / y), o >= 3 && (_[M + 2] = e.getZ(I) / y, u === 4 && (_[M + 3] = 1)), o >= 4 && (_[M + 3] = e.getW(I) / y);
6701
6683
  }
6702
6684
  e.normalized = S, this.internalFormat = m, this.format = g, this.type = l, this.image.width = T, this.image.height = T, this.image.data = _, this.needsUpdate = !0, this.dispose(), e.itemSize = r, e.count = n;
6703
6685
  }
6704
6686
  }
6705
- class Ia extends Ma {
6687
+ class Ma extends Ia {
6706
6688
  constructor() {
6707
6689
  super(), this._forcedType = Nn;
6708
6690
  }
6709
6691
  }
6710
- class Ca extends Ma {
6692
+ class Ca extends Ia {
6711
6693
  constructor() {
6712
6694
  super(), this._forcedType = Oe;
6713
6695
  }
6714
6696
  }
6715
6697
  class Xu {
6716
6698
  constructor() {
6717
- this.index = new Ia(), this.position = new Ca(), this.bvhBounds = new At(), this.bvhContents = new At(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
6699
+ this.index = new Ma(), this.position = new Ca(), this.bvhBounds = new At(), this.bvhContents = new At(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
6718
6700
  }
6719
6701
  updateFrom(e) {
6720
6702
  const { geometry: t } = e;
@@ -7171,8 +7153,8 @@ function oh(s, e = {}, t = new ur()) {
7171
7153
  let w = 0;
7172
7154
  const m = t.getAttribute(y);
7173
7155
  for (let T = 0, x = s.length; T < x; T++) {
7174
- const _ = s[T], S = !n && !g && o[T], M = _.getAttribute(y);
7175
- S || Pa(M, m, w), w += M.count;
7156
+ const _ = s[T], S = !n && !g && o[T], I = _.getAttribute(y);
7157
+ S || Pa(I, m, w), w += I.count;
7176
7158
  }
7177
7159
  }
7178
7160
  }
@@ -7243,7 +7225,7 @@ function yo(s) {
7243
7225
  }
7244
7226
  return e;
7245
7227
  }
7246
- function To(s) {
7228
+ function xo(s) {
7247
7229
  const e = s.skeleton;
7248
7230
  return e ? (e.boneTexture || e.computeBoneTexture(), `${Ls(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`) : null;
7249
7231
  }
@@ -7253,14 +7235,14 @@ class lh {
7253
7235
  }
7254
7236
  updateFrom(e) {
7255
7237
  const t = e.geometry, r = (t.index ? t.index.count : t.attributes.position.count) / 3;
7256
- this.matrixWorld.copy(e.matrixWorld), this.geometryHash = yo(t), this.primitiveCount = r, this.skeletonHash = To(e);
7238
+ this.matrixWorld.copy(e.matrixWorld), this.geometryHash = yo(t), this.primitiveCount = r, this.skeletonHash = xo(e);
7257
7239
  }
7258
7240
  didChange(e) {
7259
7241
  const t = e.geometry, r = (t.index ? t.index.count : t.attributes.position.count) / 3;
7260
- return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === yo(t) && this.skeletonHash === To(e) && this.primitiveCount === r);
7242
+ return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === yo(t) && this.skeletonHash === xo(e) && this.primitiveCount === r);
7261
7243
  }
7262
7244
  }
7263
- const Ar = /* @__PURE__ */ new Y(), Rr = /* @__PURE__ */ new Y(), Mr = /* @__PURE__ */ new Y(), xo = /* @__PURE__ */ new sn(), ui = /* @__PURE__ */ new Y(), Xi = /* @__PURE__ */ new Y(), bo = /* @__PURE__ */ new sn(), wo = /* @__PURE__ */ new sn(), hi = /* @__PURE__ */ new Ue(), _o = /* @__PURE__ */ new Ue();
7245
+ const Ar = /* @__PURE__ */ new Y(), Rr = /* @__PURE__ */ new Y(), Ir = /* @__PURE__ */ new Y(), To = /* @__PURE__ */ new sn(), ui = /* @__PURE__ */ new Y(), Xi = /* @__PURE__ */ new Y(), bo = /* @__PURE__ */ new sn(), wo = /* @__PURE__ */ new sn(), hi = /* @__PURE__ */ new Ue(), _o = /* @__PURE__ */ new Ue();
7264
7246
  function So(s, e, t) {
7265
7247
  const r = s.skeleton, n = s.geometry, o = r.bones, i = r.boneInverses;
7266
7248
  bo.fromBufferAttribute(n.attributes.skinIndex, e), wo.fromBufferAttribute(n.attributes.skinWeight, e), hi.elements.fill(0);
@@ -7317,7 +7299,7 @@ function fh(s, e = {}, t = new ur()) {
7317
7299
  const h = a.position, f = o ? a.normal : null, u = i ? a.tangent : null, l = r.morphAttributes.position, g = r.morphAttributes.normal, y = r.morphAttributes.tangent, w = r.morphTargetsRelative, m = s.morphTargetInfluences, T = new Ac();
7318
7300
  T.getNormalMatrix(s.matrixWorld), r.index && t.index.array.set(r.index.array);
7319
7301
  for (let x = 0, _ = a.position.count; x < _; x++)
7320
- Ar.fromBufferAttribute(h, x), f && Rr.fromBufferAttribute(f, x), u && (xo.fromBufferAttribute(u, x), Mr.fromBufferAttribute(u, x)), m && (l && $i(l, m, w, x, Ar), g && $i(g, m, w, x, Rr), y && $i(y, m, w, x, Mr)), s.isSkinnedMesh && (s.applyBoneTransform(x, Ar), f && So(s, x, Rr), u && So(s, x, Mr)), n && Ar.applyMatrix4(s.matrixWorld), c.position.setXYZ(x, Ar.x, Ar.y, Ar.z), f && (n && Rr.applyNormalMatrix(T), c.normal.setXYZ(x, Rr.x, Rr.y, Rr.z)), u && (n && Mr.transformDirection(s.matrixWorld), c.tangent.setXYZW(x, Mr.x, Mr.y, Mr.z, xo.w));
7302
+ Ar.fromBufferAttribute(h, x), f && Rr.fromBufferAttribute(f, x), u && (To.fromBufferAttribute(u, x), Ir.fromBufferAttribute(u, x)), m && (l && $i(l, m, w, x, Ar), g && $i(g, m, w, x, Rr), y && $i(y, m, w, x, Ir)), s.isSkinnedMesh && (s.applyBoneTransform(x, Ar), f && So(s, x, Rr), u && So(s, x, Ir)), n && Ar.applyMatrix4(s.matrixWorld), c.position.setXYZ(x, Ar.x, Ar.y, Ar.z), f && (n && Rr.applyNormalMatrix(T), c.normal.setXYZ(x, Rr.x, Rr.y, Rr.z)), u && (n && Ir.transformDirection(s.matrixWorld), c.tangent.setXYZW(x, Ir.x, Ir.y, Ir.z, To.w));
7321
7303
  for (const x in e.attributes) {
7322
7304
  const _ = e.attributes[x];
7323
7305
  _ === "position" || _ === "tangent" || _ === "normal" || !(_ in a) || (c[_] || t.setAttribute(_, On(a[_])), en(a[_], c[_]), Pa(a[_], c[_]));
@@ -7344,7 +7326,7 @@ class dh extends ur {
7344
7326
  return r.didChange(e) ? (fh(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
7345
7327
  }
7346
7328
  }
7347
- const Ts = 0, Da = 1, Oa = 2;
7329
+ const xs = 0, Da = 1, Oa = 2;
7348
7330
  function ph(s, e) {
7349
7331
  for (let t = 0, r = s.length; t < r; t++)
7350
7332
  s[t].traverseVisible((o) => {
@@ -7422,7 +7404,7 @@ class vh {
7422
7404
  version: l.version,
7423
7405
  uuid: l.uuid
7424
7406
  })));
7425
- let u = Ts;
7407
+ let u = xs;
7426
7408
  return f ? u = Oa : a.includes(!1) && (u = Da), {
7427
7409
  changeType: u,
7428
7410
  materials: mh(i),
@@ -7441,7 +7423,7 @@ function yh(s) {
7441
7423
  }
7442
7424
  return Array.from(e);
7443
7425
  }
7444
- function Th(s) {
7426
+ function xh(s) {
7445
7427
  const e = [], t = /* @__PURE__ */ new Set();
7446
7428
  for (let n = 0, o = s.length; n < o; n++)
7447
7429
  s[n].traverse((i) => {
@@ -7450,7 +7432,7 @@ function Th(s) {
7450
7432
  const r = Array.from(t).sort((n, o) => n.uuid < o.uuid ? 1 : n.uuid > o.uuid ? -1 : 0);
7451
7433
  return { lights: e, iesTextures: r };
7452
7434
  }
7453
- class xh {
7435
+ class Th {
7454
7436
  get initialized() {
7455
7437
  return !!this.bvh;
7456
7438
  }
@@ -7481,8 +7463,8 @@ class xh {
7481
7463
  l.isSkinnedMesh && l.skeleton && l.skeleton.update();
7482
7464
  });
7483
7465
  });
7484
- const i = t.generate(r), a = i.materials, c = yh(a), { lights: h, iesTextures: f } = Th(o);
7485
- if (i.changeType !== Ts && ah(r, a, a), this.generateBVH) {
7466
+ const i = t.generate(r), a = i.materials, c = yh(a), { lights: h, iesTextures: f } = xh(o);
7467
+ if (i.changeType !== xs && ah(r, a, a), this.generateBVH) {
7486
7468
  if (this.bvh instanceof Promise)
7487
7469
  throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");
7488
7470
  if (i.changeType === Oa) {
@@ -7497,7 +7479,7 @@ class xh {
7497
7479
  } else i.changeType === Da && this.bvh.refit();
7498
7480
  }
7499
7481
  return {
7500
- bvhChanged: i.changeType !== Ts,
7482
+ bvhChanged: i.changeType !== xs,
7501
7483
  bvh: this.bvh,
7502
7484
  lights: h,
7503
7485
  iesTextures: f,
@@ -7532,7 +7514,7 @@ class on {
7532
7514
  this._mesh.material = e;
7533
7515
  }
7534
7516
  }
7535
- class Ns extends Mi {
7517
+ class Ns extends Ii {
7536
7518
  set needsUpdate(e) {
7537
7519
  super.needsUpdate = !0, this.dispatchEvent({
7538
7520
  type: "recompilation"
@@ -7874,7 +7856,7 @@ class Rh extends Ns {
7874
7856
  });
7875
7857
  }
7876
7858
  }
7877
- class Mh {
7859
+ class Ih {
7878
7860
  generate(e, t = 256) {
7879
7861
  const r = new kn(t, t, {
7880
7862
  type: Oe,
@@ -7888,7 +7870,7 @@ class Mh {
7888
7870
  return o.material.resolution.set(t, t), o.render(e), e.setRenderTarget(n), o.dispose(), r;
7889
7871
  }
7890
7872
  }
7891
- class Ih extends Ss {
7873
+ class Mh extends Ss {
7892
7874
  set bokehSize(e) {
7893
7875
  this.fStop = this.getFocalLength() / e;
7894
7876
  }
@@ -7907,7 +7889,7 @@ class Ch {
7907
7889
  this.bokehSize = 0, this.apertureBlades = 0, this.apertureRotation = 0, this.focusDistance = 10, this.anamorphicRatio = 1;
7908
7890
  }
7909
7891
  updateFrom(e) {
7910
- e instanceof Ih ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
7892
+ e instanceof Mh ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
7911
7893
  }
7912
7894
  }
7913
7895
  function Qi(s) {
@@ -7974,7 +7956,7 @@ class Oh {
7974
7956
  for (let m = 0; m < n; m++) {
7975
7957
  let T = 0;
7976
7958
  for (let x = 0; x < r; x++) {
7977
- const _ = m * r + x, S = Je.fromHalfFloat(o[4 * _ + 0]), M = Je.fromHalfFloat(o[4 * _ + 1]), I = Je.fromHalfFloat(o[4 * _ + 2]), C = Ph(S, M, I);
7959
+ const _ = m * r + x, S = Je.fromHalfFloat(o[4 * _ + 0]), I = Je.fromHalfFloat(o[4 * _ + 1]), M = Je.fromHalfFloat(o[4 * _ + 2]), C = Ph(S, I, M);
7978
7960
  T += C, f += C, i[_] = C, a[_] = T;
7979
7961
  }
7980
7962
  if (T !== 0)
@@ -8035,7 +8017,7 @@ class Uh {
8035
8017
  return this.hash !== a ? (this.hash = a, r.needsUpdate = !0, !0) : !1;
8036
8018
  }
8037
8019
  }
8038
- function Mo(s, e, t, r, n) {
8020
+ function Io(s, e, t, r, n) {
8039
8021
  if (e > r)
8040
8022
  throw new Error();
8041
8023
  const o = s.length / e, i = s.constructor.BYTES_PER_ELEMENT * 8;
@@ -8058,7 +8040,7 @@ function Mo(s, e, t, r, n) {
8058
8040
  t[n + h + u] = e >= u + 1 ? s[f + u] / a : 0;
8059
8041
  }
8060
8042
  }
8061
- class Hh extends Mc {
8043
+ class Hh extends Ic {
8062
8044
  constructor() {
8063
8045
  super(), this._textures = [], this.type = Oe, this.format = He, this.internalFormat = "RGBA32F";
8064
8046
  }
@@ -8070,7 +8052,7 @@ class Hh extends Mc {
8070
8052
  throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");
8071
8053
  const { width: i, height: a, data: c } = o, f = i * a * 4 * e;
8072
8054
  let u = t.itemSize;
8073
- u === 3 && (u = 4), Mo(r.image.data, u, c, 4, f), this.dispose(), this.needsUpdate = !0;
8055
+ u === 3 && (u = 4), Io(r.image.data, u, c, 4, f), this.dispose(), this.needsUpdate = !0;
8074
8056
  }
8075
8057
  setAttributes(e) {
8076
8058
  const t = e[0].count, r = e.length;
@@ -8092,7 +8074,7 @@ class Hh extends Mc {
8092
8074
  for (let u = 0, l = r; u < l; u++) {
8093
8075
  const g = n[u], w = h * f * 4 * u;
8094
8076
  let m = e[u].itemSize;
8095
- m === 3 && (m = 4), Mo(g.image.data, m, c, 4, w);
8077
+ m === 3 && (m = 4), Io(g.image.data, m, c, 4, w);
8096
8078
  }
8097
8079
  this.dispose(), this.needsUpdate = !0;
8098
8080
  }
@@ -8117,13 +8099,13 @@ class Gh extends Hh {
8117
8099
  function ks(s, e) {
8118
8100
  return s.uuid < e.uuid ? 1 : s.uuid > e.uuid ? -1 : 0;
8119
8101
  }
8120
- function xs(s) {
8102
+ function Ts(s) {
8121
8103
  return `${s.source.uuid}:${s.colorSpace}`;
8122
8104
  }
8123
8105
  function jh(s) {
8124
8106
  const e = /* @__PURE__ */ new Set(), t = [];
8125
8107
  for (let r = 0, n = s.length; r < n; r++) {
8126
- const o = s[r], i = xs(o);
8108
+ const o = s[r], i = Ts(o);
8127
8109
  e.has(i) || (e.add(i), t.push(o));
8128
8110
  }
8129
8111
  return t;
@@ -8150,7 +8132,7 @@ function qh(s) {
8150
8132
  t.visible && (t.isRectAreaLight || t.isSpotLight || t.isPointLight || t.isDirectionalLight) && e.push(t);
8151
8133
  }), e.sort(ks);
8152
8134
  }
8153
- const La = 45, Io = La * 4;
8135
+ const La = 45, Mo = La * 4;
8154
8136
  class Yh {
8155
8137
  constructor() {
8156
8138
  this._features = {};
@@ -8172,7 +8154,7 @@ class Zh extends At {
8172
8154
  updateFrom(e, t) {
8173
8155
  function r(y, w, m = -1) {
8174
8156
  if (w in y && y[w]) {
8175
- const T = xs(y[w]);
8157
+ const T = Ts(y[w]);
8176
8158
  return u[T];
8177
8159
  } else
8178
8160
  return m;
@@ -8193,7 +8175,7 @@ class Zh extends At {
8193
8175
  let i = 0;
8194
8176
  const a = e.length * La, c = Math.ceil(Math.sqrt(a)) || 1, { image: h, features: f } = this, u = {};
8195
8177
  for (let y = 0, w = t.length; y < w; y++)
8196
- u[xs(t[y])] = y;
8178
+ u[Ts(t[y])] = y;
8197
8179
  h.width !== c && (this.dispose(), h.data = new Float32Array(c * c * 4), h.width = c, h.height = c);
8198
8180
  const l = h.data;
8199
8181
  f.reset();
@@ -8201,9 +8183,9 @@ class Zh extends At {
8201
8183
  const m = e[y];
8202
8184
  if (m.isFogVolumeMaterial) {
8203
8185
  f.setUsed("FOG");
8204
- for (let _ = 0; _ < Io; _++)
8186
+ for (let _ = 0; _ < Mo; _++)
8205
8187
  l[i + _] = 0;
8206
- l[i + 0 * 4 + 0] = m.color.r, l[i + 0 * 4 + 1] = m.color.g, l[i + 0 * 4 + 2] = m.color.b, l[i + 2 * 4 + 3] = n(m, "emissiveIntensity", 0), l[i + 3 * 4 + 0] = m.emissive.r, l[i + 3 * 4 + 1] = m.emissive.g, l[i + 3 * 4 + 2] = m.emissive.b, l[i + 13 * 4 + 1] = m.density, l[i + 13 * 4 + 3] = 0, l[i + 14 * 4 + 2] = 4, i += Io;
8188
+ l[i + 0 * 4 + 0] = m.color.r, l[i + 0 * 4 + 1] = m.color.g, l[i + 0 * 4 + 2] = m.color.b, l[i + 2 * 4 + 3] = n(m, "emissiveIntensity", 0), l[i + 3 * 4 + 0] = m.emissive.r, l[i + 3 * 4 + 1] = m.emissive.g, l[i + 3 * 4 + 2] = m.emissive.b, l[i + 13 * 4 + 1] = m.density, l[i + 13 * 4 + 3] = 0, l[i + 14 * 4 + 2] = 4, i += Mo;
8207
8189
  continue;
8208
8190
  }
8209
8191
  l[i++] = m.color.r, l[i++] = m.color.g, l[i++] = m.color.b, l[i++] = r(m, "map"), l[i++] = n(m, "metalness", 0), l[i++] = r(m, "metalnessMap"), l[i++] = n(m, "roughness", 0), l[i++] = r(m, "roughnessMap"), l[i++] = n(m, "ior", 1.5), l[i++] = n(m, "transmission", 0), l[i++] = r(m, "transmissionMap"), l[i++] = n(m, "emissiveIntensity", 0), "emissive" in m ? (l[i++] = m.emissive.r, l[i++] = m.emissive.g, l[i++] = m.emissive.b) : (l[i++] = 0, l[i++] = 0, l[i++] = 0), l[i++] = r(m, "emissiveMap"), l[i++] = r(m, "normalMap"), "normalScale" in m ? (l[i++] = m.normalScale.x, l[i++] = m.normalScale.y) : (l[i++] = 1, l[i++] = 1), l[i++] = n(m, "clearcoat", 0), l[i++] = r(m, "clearcoatMap"), l[i++] = n(m, "clearcoatRoughness", 0), l[i++] = r(m, "clearcoatRoughnessMap"), l[i++] = r(m, "clearcoatNormalMap"), "clearcoatNormalScale" in m ? (l[i++] = m.clearcoatNormalScale.x, l[i++] = m.clearcoatNormalScale.y) : (l[i++] = 1, l[i++] = 1), i++, l[i++] = n(m, "sheen", 0), "sheenColor" in m ? (l[i++] = m.sheenColor.r, l[i++] = m.sheenColor.g, l[i++] = m.sheenColor.b) : (l[i++] = 0, l[i++] = 0, l[i++] = 0), l[i++] = r(m, "sheenColorMap"), l[i++] = n(m, "sheenRoughness", 0), l[i++] = r(m, "sheenRoughnessMap"), l[i++] = r(m, "iridescenceMap"), l[i++] = r(m, "iridescenceThicknessMap"), l[i++] = n(m, "iridescence", 0), l[i++] = n(m, "iridescenceIOR", 1.3);
@@ -8238,7 +8220,7 @@ function Xh(s, e) {
8238
8220
  for (const t in e)
8239
8221
  t in s && (s[t] = e[t]);
8240
8222
  }
8241
- class Po extends Ic {
8223
+ class Po extends Mc {
8242
8224
  constructor(e, t, r) {
8243
8225
  const n = {
8244
8226
  format: He,
@@ -8273,7 +8255,7 @@ class Po extends Ic {
8273
8255
  super.dispose(), this.fsQuad.dispose();
8274
8256
  }
8275
8257
  }
8276
- class $h extends Mi {
8258
+ class $h extends Ii {
8277
8259
  get map() {
8278
8260
  return this.uniforms.map.value;
8279
8261
  }
@@ -9437,7 +9419,7 @@ const uf = (
9437
9419
  }
9438
9420
 
9439
9421
  `
9440
- ), Tf = (
9422
+ ), xf = (
9441
9423
  /* glsl */
9442
9424
  `
9443
9425
 
@@ -9520,7 +9502,7 @@ const uf = (
9520
9502
  }
9521
9503
 
9522
9504
  `
9523
- ), xf = (
9505
+ ), Tf = (
9524
9506
  /* glsl */
9525
9507
  `
9526
9508
 
@@ -10645,7 +10627,7 @@ const uf = (
10645
10627
  }
10646
10628
 
10647
10629
  `
10648
- ), Mf = (
10630
+ ), If = (
10649
10631
  /* glsl */
10650
10632
  `
10651
10633
 
@@ -10709,7 +10691,7 @@ bool bvhIntersectFogVolumeHit(
10709
10691
  }
10710
10692
 
10711
10693
  `
10712
- ), If = (
10694
+ ), Mf = (
10713
10695
  /* glsl */
10714
10696
  `
10715
10697
 
@@ -11544,7 +11526,7 @@ class Lf extends Ns {
11544
11526
  // scene uniforms
11545
11527
  bvh: { value: new Xu() },
11546
11528
  attributesArray: { value: new Gh() },
11547
- materialIndexAttribute: { value: new Ia() },
11529
+ materialIndexAttribute: { value: new Ma() },
11548
11530
  materials: { value: new Zh() },
11549
11531
  textures: { value: new Po().texture },
11550
11532
  // light uniforms
@@ -11647,8 +11629,8 @@ class Lf extends Ns {
11647
11629
  ${bf}
11648
11630
  ${yf}
11649
11631
  ${Na}
11650
- ${Tf}
11651
11632
  ${xf}
11633
+ ${Tf}
11652
11634
 
11653
11635
  // environment
11654
11636
  uniform EquirectHdrInfo envMapInfo;
@@ -11708,7 +11690,7 @@ class Lf extends Ns {
11708
11690
  ${mf}
11709
11691
  ${gf}
11710
11692
 
11711
- ${Mf}
11693
+ ${If}
11712
11694
  ${Ef}
11713
11695
  ${Rf}
11714
11696
  ${Af}
@@ -11748,7 +11730,7 @@ class Lf extends Ns {
11748
11730
  ${Of}
11749
11731
  ${Cf}
11750
11732
  ${Ff}
11751
- ${If}
11733
+ ${Mf}
11752
11734
  ${Pf}
11753
11735
  ${Df}
11754
11736
 
@@ -12064,28 +12046,28 @@ function* Nf() {
12064
12046
  a ? (u.opacity = this._opacityFactor / (this.samples + 1), c.blending = Wn, c.opacity = 1) : (c.opacity = this._opacityFactor / (this.samples + 1), c.blending = ca);
12065
12047
  const [y, w, m, T] = i, x = r.width, _ = r.height;
12066
12048
  c.resolution.set(x * m, _ * T), c.sobolTexture = o.texture, c.stratifiedTexture.init(20, c.bounces + c.transmissiveBounces + 5), c.stratifiedTexture.next(), c.seed++;
12067
- const S = this.tiles.x || 1, M = this.tiles.y || 1, I = S * M, C = Math.ceil(x * m), D = Math.ceil(_ * T), O = Math.floor(y * x), z = Math.floor(w * _), U = Math.ceil(C / S), k = Math.ceil(D / M);
12068
- for (let H = 0; H < M; H++)
12049
+ const S = this.tiles.x || 1, I = this.tiles.y || 1, M = S * I, C = Math.ceil(x * m), D = Math.ceil(_ * T), O = Math.floor(y * x), z = Math.floor(w * _), U = Math.ceil(C / S), k = Math.ceil(D / I);
12050
+ for (let H = 0; H < I; H++)
12069
12051
  for (let B = 0; B < S; B++) {
12070
12052
  const J = s.getRenderTarget(), ne = s.autoClear, ge = s.getScissorTest();
12071
12053
  s.getScissor(h), s.getViewport(f);
12072
- let Ie = B, ve = H;
12054
+ let Me = B, ve = H;
12073
12055
  if (!this.stableTiles) {
12074
- const Ve = this._currentTile % (S * M);
12075
- Ie = Ve % S, ve = ~~(Ve / S), this._currentTile = Ve + 1;
12056
+ const Ve = this._currentTile % (S * I);
12057
+ Me = Ve % S, ve = ~~(Ve / S), this._currentTile = Ve + 1;
12076
12058
  }
12077
- const ye = M - ve - 1;
12059
+ const ye = I - ve - 1;
12078
12060
  r.scissor.set(
12079
- O + Ie * U,
12061
+ O + Me * U,
12080
12062
  z + ye * k,
12081
- Math.min(U, C - Ie * U),
12063
+ Math.min(U, C - Me * U),
12082
12064
  Math.min(k, D - ye * k)
12083
12065
  ), r.viewport.set(
12084
12066
  O,
12085
12067
  z,
12086
12068
  C,
12087
12069
  D
12088
- ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(f), s.setScissor(h), s.setScissorTest(ge), s.setRenderTarget(J), s.autoClear = ne, a && (u.target1 = l.texture, u.target2 = r.texture, s.setRenderTarget(g), t.render(s), s.setRenderTarget(J)), this.samples += 1 / I, B === S - 1 && H === M - 1 && (this.samples = Math.round(this.samples)), yield;
12070
+ ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(f), s.setScissor(h), s.setScissorTest(ge), s.setRenderTarget(J), s.autoClear = ne, a && (u.target1 = l.texture, u.target2 = r.texture, s.setRenderTarget(g), t.render(s), s.setRenderTarget(J)), this.samples += 1 / M, B === S - 1 && H === I - 1 && (this.samples = Math.round(this.samples)), yield;
12089
12071
  }
12090
12072
  [l, g] = [g, l];
12091
12073
  }
@@ -12111,7 +12093,7 @@ class Lo {
12111
12093
  return !!this._compilePromise;
12112
12094
  }
12113
12095
  constructor(e) {
12114
- this.camera = null, this.tiles = new he(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new sn(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new on(new Lf()), this._blendQuad = new on(new Sh()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Mh().generate(e), this._primaryTarget = new kn(1, 1, {
12096
+ this.camera = null, this.tiles = new he(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new sn(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new on(new Lf()), this._blendQuad = new on(new Sh()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Ih().generate(e), this._primaryTarget = new kn(1, 1, {
12115
12097
  format: He,
12116
12098
  type: Oe,
12117
12099
  magFilter: De,
@@ -12162,7 +12144,7 @@ class Lo {
12162
12144
  this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = Nf.call(this)), this._task.next());
12163
12145
  }
12164
12146
  }
12165
- const Ir = new he(), No = new he(), pi = new Gn(), mi = new Rt();
12147
+ const Mr = new he(), No = new he(), pi = new Gn(), mi = new Rt();
12166
12148
  class kf extends At {
12167
12149
  constructor(e = 512, t = 512) {
12168
12150
  super(
@@ -12183,7 +12165,7 @@ class kf extends At {
12183
12165
  const { data: e, width: t, height: r } = this.image;
12184
12166
  for (let n = 0; n < t; n++)
12185
12167
  for (let o = 0; o < r; o++) {
12186
- No.set(t, r), Ir.set(n / t, o / r), Ir.x -= 0.5, Ir.y = 1 - Ir.y, pi.theta = Ir.x * 2 * Math.PI, pi.phi = Ir.y * Math.PI, pi.radius = 1, this.generationCallback(pi, Ir, No, mi);
12168
+ No.set(t, r), Mr.set(n / t, o / r), Mr.x -= 0.5, Mr.y = 1 - Mr.y, pi.theta = Mr.x * 2 * Math.PI, pi.phi = Mr.y * Math.PI, pi.radius = 1, this.generationCallback(pi, Mr, No, mi);
12187
12169
  const a = 4 * (o * t + n);
12188
12170
  e[a + 0] = mi.r, e[a + 1] = mi.g, e[a + 2] = mi.b, e[a + 3] = 1;
12189
12171
  }
@@ -12205,7 +12187,7 @@ class zf extends kf {
12205
12187
  return super.copy(e), this.topColor.copy(e.topColor), this.bottomColor.copy(e.bottomColor), this;
12206
12188
  }
12207
12189
  }
12208
- class Bf extends Mi {
12190
+ class Bf extends Ii {
12209
12191
  get map() {
12210
12192
  return this.uniforms.map.value;
12211
12193
  }
@@ -12292,7 +12274,7 @@ class Bf extends Mi {
12292
12274
  }), this.setValues(e);
12293
12275
  }
12294
12276
  }
12295
- class Uf extends Mi {
12277
+ class Uf extends Ii {
12296
12278
  constructor() {
12297
12279
  super({
12298
12280
  uniforms: {
@@ -12410,7 +12392,7 @@ class Gf {
12410
12392
  return !!this._pathTracer.isCompiling;
12411
12393
  }
12412
12394
  constructor(e) {
12413
- this._renderer = e, this._generator = new xh(), this._pathTracer = new Lo(e), this._queueReset = !1, this._clock = new Dc(), this._compilePromise = null, this._lowResPathTracer = new Lo(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new on(new Bf({
12395
+ this._renderer = e, this._generator = new Th(), this._pathTracer = new Lo(e), this._queueReset = !1, this._clock = new Dc(), this._compilePromise = null, this._lowResPathTracer = new Lo(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new on(new Bf({
12414
12396
  map: null,
12415
12397
  transparent: !0,
12416
12398
  blending: Wn,
@@ -13023,7 +13005,7 @@ var Xf = /* @__PURE__ */ Bn(Vn, 9, 1), $f = /* @__PURE__ */ Bn(Ga, 5, 1), es = f
13023
13005
  if (x == 1)
13024
13006
  g = Xf, y = $f, w = 9, m = 5;
13025
13007
  else if (x == 2) {
13026
- var I = Pt(s, u, 31) + 257, C = Pt(s, u + 10, 15) + 4, D = I + Pt(s, u + 5, 31) + 1;
13008
+ var M = Pt(s, u, 31) + 257, C = Pt(s, u + 10, 15) + 4, D = M + Pt(s, u + 5, 31) + 1;
13027
13009
  u += 14;
13028
13010
  for (var O = new _t(D), z = new _t(19), U = 0; U < C; ++U)
13029
13011
  z[qf[U]] = Pt(s, u + U * 3, 7);
@@ -13040,17 +13022,17 @@ var Xf = /* @__PURE__ */ Bn(Vn, 9, 1), $f = /* @__PURE__ */ Bn(Ga, 5, 1), es = f
13040
13022
  O[U++] = ne;
13041
13023
  }
13042
13024
  }
13043
- var Ie = O.subarray(0, I), ve = O.subarray(I);
13044
- w = es(Ie), m = es(ve), g = Bn(Ie, w, 1), y = Bn(ve, m, 1);
13025
+ var Me = O.subarray(0, M), ve = O.subarray(M);
13026
+ w = es(Me), m = es(ve), g = Bn(Me, w, 1), y = Bn(ve, m, 1);
13045
13027
  } else
13046
13028
  Ft(1);
13047
13029
  else {
13048
- var _ = Qf(u) + 4, S = s[_ - 4] | s[_ - 3] << 8, M = _ + S;
13049
- if (M > n) {
13030
+ var _ = Qf(u) + 4, S = s[_ - 4] | s[_ - 3] << 8, I = _ + S;
13031
+ if (I > n) {
13050
13032
  c && Ft(0);
13051
13033
  break;
13052
13034
  }
13053
- a && h(l + S), t.set(s.subarray(_, M), l), e.b = l += S, e.p = u = M * 8, e.f = f;
13035
+ a && h(l + S), t.set(s.subarray(_, I), l), e.b = l += S, e.p = u = I * 8, e.f = f;
13054
13036
  continue;
13055
13037
  }
13056
13038
  if (u > T) {
@@ -13059,7 +13041,7 @@ var Xf = /* @__PURE__ */ Bn(Vn, 9, 1), $f = /* @__PURE__ */ Bn(Ga, 5, 1), es = f
13059
13041
  }
13060
13042
  }
13061
13043
  a && h(l + 131072);
13062
- for (var ye = (1 << w) - 1, Ve = (1 << m) - 1, xe = u; ; xe = u) {
13044
+ for (var ye = (1 << w) - 1, Ve = (1 << m) - 1, Te = u; ; Te = u) {
13063
13045
  var ne = g[ts(s, u) & ye], Se = ne >> 4;
13064
13046
  if (u += ne & 15, u > T) {
13065
13047
  c && Ft(0);
@@ -13068,7 +13050,7 @@ var Xf = /* @__PURE__ */ Bn(Vn, 9, 1), $f = /* @__PURE__ */ Bn(Ga, 5, 1), es = f
13068
13050
  if (ne || Ft(2), Se < 256)
13069
13051
  t[l++] = Se;
13070
13052
  else if (Se == 256) {
13071
- xe = u, g = null;
13053
+ Te = u, g = null;
13072
13054
  break;
13073
13055
  } else {
13074
13056
  var ut = Se - 254;
@@ -13098,7 +13080,7 @@ var Xf = /* @__PURE__ */ Bn(Vn, 9, 1), $f = /* @__PURE__ */ Bn(Ga, 5, 1), es = f
13098
13080
  t[l] = t[l - ve];
13099
13081
  }
13100
13082
  }
13101
- e.l = g, e.p = xe, e.b = l, e.f = f, g && (f = 1, e.m = w, e.d = y, e.n = m);
13083
+ e.l = g, e.p = Te, e.b = l, e.f = f, g && (f = 1, e.m = w, e.d = y, e.n = m);
13102
13084
  } while (!f);
13103
13085
  return l != t.length && i ? Jf(t, 0, l) : t.subarray(0, l);
13104
13086
  }, rd = /* @__PURE__ */ new _t(0), nd = function(s, e) {
@@ -13179,12 +13161,12 @@ class od extends ha {
13179
13161
  function ge(d) {
13180
13162
  return d & 63;
13181
13163
  }
13182
- function Ie(d) {
13164
+ function Me(d) {
13183
13165
  return d >> 6;
13184
13166
  }
13185
13167
  function ve(d, v, b, A) {
13186
13168
  for (; v <= b; v++) {
13187
- const L = Ie(d[v]), P = ge(d[v]);
13169
+ const L = Me(d[v]), P = ge(d[v]);
13188
13170
  if (L >> P)
13189
13171
  throw new Error("Invalid table entry");
13190
13172
  if (P > 14) {
@@ -13215,7 +13197,7 @@ class od extends ha {
13215
13197
  function Ve(d, v, b, A) {
13216
13198
  d = d << 8 | kr(b, A), v += 8, ye.c = d, ye.lc = v;
13217
13199
  }
13218
- const xe = { c: 0, lc: 0 };
13200
+ const Te = { c: 0, lc: 0 };
13219
13201
  function Se(d, v, b, A, L, P, N, q, W) {
13220
13202
  if (d == v) {
13221
13203
  A < 8 && (Ve(b, A, L, P), b = ye.c, A = ye.lc), A -= 8;
@@ -13229,7 +13211,7 @@ class od extends ha {
13229
13211
  N[q.value++] = d;
13230
13212
  else
13231
13213
  return !1;
13232
- xe.c = b, xe.lc = A;
13214
+ Te.c = b, Te.lc = A;
13233
13215
  }
13234
13216
  function ut(d) {
13235
13217
  return d & 65535;
@@ -13286,7 +13268,7 @@ class od extends ha {
13286
13268
  for (Ve(G, j, b, A), G = ye.c, j = ye.lc; j >= 14; ) {
13287
13269
  const ce = G >> j - 14 & 16383, te = v[ce];
13288
13270
  if (te.len)
13289
- j -= te.len, Se(te.lit, P, G, j, b, A, q, W, Q), G = xe.c, j = xe.lc;
13271
+ j -= te.len, Se(te.lit, P, G, j, b, A, q, W, Q), G = Te.c, j = Te.lc;
13290
13272
  else {
13291
13273
  if (!te.p)
13292
13274
  throw new Error("hufDecode issues");
@@ -13295,8 +13277,8 @@ class od extends ha {
13295
13277
  const ue = ge(d[te.p[se]]);
13296
13278
  for (; j < ue && A.value < re; )
13297
13279
  Ve(G, j, b, A), G = ye.c, j = ye.lc;
13298
- if (j >= ue && Ie(d[te.p[se]]) == (G >> j - ue & (1 << ue) - 1)) {
13299
- j -= ue, Se(te.p[se], P, G, j, b, A, q, W, Q), G = xe.c, j = xe.lc;
13280
+ if (j >= ue && Me(d[te.p[se]]) == (G >> j - ue & (1 << ue) - 1)) {
13281
+ j -= ue, Se(te.p[se], P, G, j, b, A, q, W, Q), G = Te.c, j = Te.lc;
13300
13282
  break;
13301
13283
  }
13302
13284
  }
@@ -13308,7 +13290,7 @@ class od extends ha {
13308
13290
  for (G >>= ee, j -= ee; j > 0; ) {
13309
13291
  const ce = v[G << 14 - j & 16383];
13310
13292
  if (ce.len)
13311
- j -= ce.len, Se(ce.lit, P, G, j, b, A, q, W, Q), G = xe.c, j = xe.lc;
13293
+ j -= ce.len, Se(ce.lit, P, G, j, b, A, q, W, Q), G = Te.c, j = Te.lc;
13312
13294
  else
13313
13295
  throw new Error("hufDecode issues");
13314
13296
  }
@@ -13343,7 +13325,7 @@ class od extends ha {
13343
13325
  for (; !(L > P || (v[L++] = d[b++], L > P)); )
13344
13326
  v[L++] = d[A++];
13345
13327
  }
13346
- function Tt(d) {
13328
+ function xt(d) {
13347
13329
  let v = d.byteLength;
13348
13330
  const b = new Array();
13349
13331
  let A = 0;
@@ -13374,29 +13356,29 @@ class od extends ha {
13374
13356
  let ke = 8;
13375
13357
  me == re - 1 && (ke = ce);
13376
13358
  let bt = 8;
13377
- for (let Te = 0; Te < Q; ++Te) {
13378
- Te == Q - 1 && (bt = ee);
13359
+ for (let xe = 0; xe < Q; ++xe) {
13360
+ xe == Q - 1 && (bt = ee);
13379
13361
  for (let Ee = 0; Ee < G; ++Ee)
13380
- be[Ee].fill(0), be[Ee][0] = L[se[Ee]++], fr(te, A, be[Ee]), dr(be[Ee], ue[Ee]), It(ue[Ee]);
13362
+ be[Ee].fill(0), be[Ee][0] = L[se[Ee]++], fr(te, A, be[Ee]), dr(be[Ee], ue[Ee]), Mt(ue[Ee]);
13381
13363
  cn(ue);
13382
13364
  for (let Ee = 0; Ee < G; ++Ee)
13383
- ln(ue[Ee], Pe[Ee], Te * 64);
13365
+ ln(ue[Ee], Pe[Ee], xe * 64);
13384
13366
  }
13385
13367
  let je = 0;
13386
- for (let Te = 0; Te < G; ++Te) {
13387
- const Ee = b[d.idx[Te]].type;
13368
+ for (let xe = 0; xe < G; ++xe) {
13369
+ const Ee = b[d.idx[xe]].type;
13388
13370
  for (let Zt = 8 * me; Zt < 8 * me + ke; ++Zt) {
13389
- je = pt[Te][Zt];
13390
- for (let xn = 0; xn < j; ++xn) {
13391
- const Ut = xn * 64 + (Zt & 7) * 8;
13392
- N.setUint16(je + 0 * 2 * Ee, Pe[Te][Ut + 0], !0), N.setUint16(je + 1 * 2 * Ee, Pe[Te][Ut + 1], !0), N.setUint16(je + 2 * 2 * Ee, Pe[Te][Ut + 2], !0), N.setUint16(je + 3 * 2 * Ee, Pe[Te][Ut + 3], !0), N.setUint16(je + 4 * 2 * Ee, Pe[Te][Ut + 4], !0), N.setUint16(je + 5 * 2 * Ee, Pe[Te][Ut + 5], !0), N.setUint16(je + 6 * 2 * Ee, Pe[Te][Ut + 6], !0), N.setUint16(je + 7 * 2 * Ee, Pe[Te][Ut + 7], !0), je += 8 * 2 * Ee;
13371
+ je = pt[xe][Zt];
13372
+ for (let Tn = 0; Tn < j; ++Tn) {
13373
+ const Ut = Tn * 64 + (Zt & 7) * 8;
13374
+ N.setUint16(je + 0 * 2 * Ee, Pe[xe][Ut + 0], !0), N.setUint16(je + 1 * 2 * Ee, Pe[xe][Ut + 1], !0), N.setUint16(je + 2 * 2 * Ee, Pe[xe][Ut + 2], !0), N.setUint16(je + 3 * 2 * Ee, Pe[xe][Ut + 3], !0), N.setUint16(je + 4 * 2 * Ee, Pe[xe][Ut + 4], !0), N.setUint16(je + 5 * 2 * Ee, Pe[xe][Ut + 5], !0), N.setUint16(je + 6 * 2 * Ee, Pe[xe][Ut + 6], !0), N.setUint16(je + 7 * 2 * Ee, Pe[xe][Ut + 7], !0), je += 8 * 2 * Ee;
13393
13375
  }
13394
13376
  }
13395
13377
  if (j != Q)
13396
13378
  for (let Zt = 8 * me; Zt < 8 * me + ke; ++Zt) {
13397
- const xn = pt[Te][Zt] + 8 * j * 2 * Ee, Ut = j * 64 + (Zt & 7) * 8;
13379
+ const Tn = pt[xe][Zt] + 8 * j * 2 * Ee, Ut = j * 64 + (Zt & 7) * 8;
13398
13380
  for (let qn = 0; qn < bt; ++qn)
13399
- N.setUint16(xn + qn * 2 * Ee, Pe[Te][Ut + qn], !0);
13381
+ N.setUint16(Tn + qn * 2 * Ee, Pe[xe][Ut + qn], !0);
13400
13382
  }
13401
13383
  }
13402
13384
  }
@@ -13408,10 +13390,10 @@ class od extends ha {
13408
13390
  if (b[me].type == 2)
13409
13391
  for (let bt = 0; bt < W; ++bt) {
13410
13392
  const je = pt[me][bt];
13411
- for (let Te = 0; Te < q; ++Te)
13412
- Ae[Te] = N.getUint16(je + Te * 2 * ke, !0);
13413
- for (let Te = 0; Te < q; ++Te)
13414
- N.setFloat32(je + Te * 2 * ke, K(Ae[Te]), !0);
13393
+ for (let xe = 0; xe < q; ++xe)
13394
+ Ae[xe] = N.getUint16(je + xe * 2 * ke, !0);
13395
+ for (let xe = 0; xe < q; ++xe)
13396
+ N.setFloat32(je + xe * 2 * ke, K(Ae[xe]), !0);
13415
13397
  }
13416
13398
  }
13417
13399
  }
@@ -13423,7 +13405,7 @@ class od extends ha {
13423
13405
  function dr(d, v) {
13424
13406
  v[0] = K(d[0]), v[1] = K(d[1]), v[2] = K(d[5]), v[3] = K(d[6]), v[4] = K(d[14]), v[5] = K(d[15]), v[6] = K(d[27]), v[7] = K(d[28]), v[8] = K(d[2]), v[9] = K(d[4]), v[10] = K(d[7]), v[11] = K(d[13]), v[12] = K(d[16]), v[13] = K(d[26]), v[14] = K(d[29]), v[15] = K(d[42]), v[16] = K(d[3]), v[17] = K(d[8]), v[18] = K(d[12]), v[19] = K(d[17]), v[20] = K(d[25]), v[21] = K(d[30]), v[22] = K(d[41]), v[23] = K(d[43]), v[24] = K(d[9]), v[25] = K(d[11]), v[26] = K(d[18]), v[27] = K(d[24]), v[28] = K(d[31]), v[29] = K(d[40]), v[30] = K(d[44]), v[31] = K(d[53]), v[32] = K(d[10]), v[33] = K(d[19]), v[34] = K(d[23]), v[35] = K(d[32]), v[36] = K(d[39]), v[37] = K(d[45]), v[38] = K(d[52]), v[39] = K(d[54]), v[40] = K(d[20]), v[41] = K(d[22]), v[42] = K(d[33]), v[43] = K(d[38]), v[44] = K(d[46]), v[45] = K(d[51]), v[46] = K(d[55]), v[47] = K(d[60]), v[48] = K(d[21]), v[49] = K(d[34]), v[50] = K(d[37]), v[51] = K(d[47]), v[52] = K(d[50]), v[53] = K(d[56]), v[54] = K(d[59]), v[55] = K(d[61]), v[56] = K(d[35]), v[57] = K(d[36]), v[58] = K(d[48]), v[59] = K(d[49]), v[60] = K(d[57]), v[61] = K(d[58]), v[62] = K(d[62]), v[63] = K(d[63]);
13425
13407
  }
13426
- function It(d) {
13408
+ function Mt(d) {
13427
13409
  const v = 0.5 * Math.cos(0.7853975), b = 0.5 * Math.cos(3.14159 / 16), A = 0.5 * Math.cos(3.14159 / 8), L = 0.5 * Math.cos(3 * 3.14159 / 16), P = 0.5 * Math.cos(5 * 3.14159 / 16), N = 0.5 * Math.cos(3 * 3.14159 / 8), q = 0.5 * Math.cos(7 * 3.14159 / 16), W = new Array(4), G = new Array(4), j = new Array(4), Q = new Array(4);
13428
13410
  for (let re = 0; re < 8; ++re) {
13429
13411
  const ee = re * 8;
@@ -13449,7 +13431,7 @@ class od extends ha {
13449
13431
  return new DataView(d.array.buffer, d.offset.value, d.size);
13450
13432
  }
13451
13433
  function un(d) {
13452
- const v = d.viewer.buffer.slice(d.offset.value, d.offset.value + d.size), b = new Uint8Array(Tt(v)), A = new Uint8Array(b.length);
13434
+ const v = d.viewer.buffer.slice(d.offset.value, d.offset.value + d.size), b = new Uint8Array(xt(v)), A = new Uint8Array(b.length);
13453
13435
  return Wt(b), Lr(b, A), new DataView(A.buffer);
13454
13436
  }
13455
13437
  function qt(d) {
@@ -13467,7 +13449,7 @@ class od extends ha {
13467
13449
  throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");
13468
13450
  if (q <= W)
13469
13451
  for (let ce = 0; ce < W - q + 1; ce++)
13470
- L[ce + q] = xt(v, b);
13452
+ L[ce + q] = Tt(v, b);
13471
13453
  const G = new Uint16Array(65536), j = z(L, G), Q = Ke(v, b);
13472
13454
  jt(d.array, v, b, Q, A, P);
13473
13455
  for (let ce = 0; ce < d.inputChannels.length; ++ce) {
@@ -13538,7 +13520,7 @@ class od extends ha {
13538
13520
  const P = new Array();
13539
13521
  let N = dt(v, b) - 2;
13540
13522
  for (; N > 0; ) {
13541
- const te = Bt(v.buffer, b), se = xt(v, b), ue = se >> 2 & 3, be = (se >> 4) - 1, Pe = new Int8Array([be])[0], pt = xt(v, b);
13523
+ const te = Bt(v.buffer, b), se = Tt(v, b), ue = se >> 2 & 3, be = (se >> 4) - 1, Pe = new Int8Array([be])[0], pt = Tt(v, b);
13542
13524
  P.push({
13543
13525
  name: te,
13544
13526
  index: Pe,
@@ -13582,7 +13564,7 @@ class od extends ha {
13582
13564
  }
13583
13565
  if (L.rleRawSize > 0) {
13584
13566
  const te = d.array.slice(b.value, b.value + L.rleCompressedSize), se = gi(te);
13585
- re = Tt(se.buffer), b.value += L.rleCompressedSize;
13567
+ re = xt(se.buffer), b.value += L.rleCompressedSize;
13586
13568
  }
13587
13569
  let ee = 0;
13588
13570
  const ce = new Array(W.length);
@@ -13652,7 +13634,7 @@ class od extends ha {
13652
13634
  const b = d[v.value];
13653
13635
  return v.value = v.value + 1, b;
13654
13636
  }
13655
- function xt(d, v) {
13637
+ function Tt(d, v) {
13656
13638
  const b = d.getUint8(v.value);
13657
13639
  return v.value = v.value + 1, b;
13658
13640
  }
@@ -13678,10 +13660,10 @@ class od extends ha {
13678
13660
  function Yt(d, v) {
13679
13661
  return K(dt(d, v));
13680
13662
  }
13681
- function Tr(d, v, b, A) {
13663
+ function xr(d, v, b, A) {
13682
13664
  const L = b.value, P = [];
13683
13665
  for (; b.value < L + A - 1; ) {
13684
- const N = Bt(v, b), q = Ze(d, b), W = xt(d, b);
13666
+ const N = Bt(v, b), q = Ze(d, b), W = Tt(d, b);
13685
13667
  b.value += 3;
13686
13668
  const G = Ze(d, b), j = Ze(d, b);
13687
13669
  P.push({
@@ -13698,7 +13680,7 @@ class od extends ha {
13698
13680
  const b = Ce(d, v), A = Ce(d, v), L = Ce(d, v), P = Ce(d, v), N = Ce(d, v), q = Ce(d, v), W = Ce(d, v), G = Ce(d, v);
13699
13681
  return { redX: b, redY: A, greenX: L, greenY: P, blueX: N, blueY: q, whiteX: W, whiteY: G };
13700
13682
  }
13701
- function xr(d, v) {
13683
+ function Tr(d, v) {
13702
13684
  const b = [
13703
13685
  "NO_COMPRESSION",
13704
13686
  "RLE_COMPRESSION",
@@ -13710,7 +13692,7 @@ class od extends ha {
13710
13692
  "B44A_COMPRESSION",
13711
13693
  "DWAA_COMPRESSION",
13712
13694
  "DWAB_COMPRESSION"
13713
- ], A = xt(d, v);
13695
+ ], A = Tt(d, v);
13714
13696
  return b[A];
13715
13697
  }
13716
13698
  function pn(d, v) {
@@ -13722,14 +13704,14 @@ class od extends ha {
13722
13704
  "INCREASING_Y",
13723
13705
  "DECREASING_Y",
13724
13706
  "RANDOM_Y"
13725
- ], A = xt(d, v);
13707
+ ], A = Tt(d, v);
13726
13708
  return b[A];
13727
13709
  }
13728
13710
  function wr(d, v) {
13729
13711
  const b = [
13730
13712
  "ENVMAP_LATLONG",
13731
13713
  "ENVMAP_CUBE"
13732
- ], A = xt(d, v);
13714
+ ], A = Tt(d, v);
13733
13715
  return b[A];
13734
13716
  }
13735
13717
  function mn(d, v) {
@@ -13740,7 +13722,7 @@ class od extends ha {
13740
13722
  ], A = [
13741
13723
  "ROUND_DOWN",
13742
13724
  "ROUND_UP"
13743
- ], L = Ke(d, v), P = Ke(d, v), N = xt(d, v);
13725
+ ], L = Ke(d, v), P = Ke(d, v), N = Tt(d, v);
13744
13726
  return {
13745
13727
  xSize: L,
13746
13728
  ySize: P,
@@ -13760,11 +13742,11 @@ class od extends ha {
13760
13742
  if (A === "string" || A === "stringvector" || A === "iccProfile")
13761
13743
  return vr(v, b, L);
13762
13744
  if (A === "chlist")
13763
- return Tr(d, v, b, L);
13745
+ return xr(d, v, b, L);
13764
13746
  if (A === "chromaticities")
13765
13747
  return dn(d, b);
13766
13748
  if (A === "compression")
13767
- return xr(d, b);
13749
+ return Tr(d, b);
13768
13750
  if (A === "box2i")
13769
13751
  return pn(d, b);
13770
13752
  if (A === "envmap")
@@ -13818,7 +13800,7 @@ class od extends ha {
13818
13800
  }
13819
13801
  return L;
13820
13802
  }
13821
- function Tn() {
13803
+ function xn() {
13822
13804
  const d = this, v = d.offset, b = { value: 0 };
13823
13805
  for (let A = 0; A < d.tileCount; A++) {
13824
13806
  const L = Ze(d.viewer, v), P = Ze(d.viewer, v);
@@ -13910,7 +13892,7 @@ class od extends ha {
13910
13892
  uncompress: null,
13911
13893
  getter: null,
13912
13894
  format: null,
13913
- colorSpace: Mt
13895
+ colorSpace: It
13914
13896
  };
13915
13897
  switch (d.compression) {
13916
13898
  case "NO_COMPRESSION":
@@ -13992,7 +13974,7 @@ class od extends ha {
13992
13974
  let G = 0;
13993
13975
  for (const j of d.channels)
13994
13976
  P.decodeChannels[j.name] !== void 0 && (P.channelByteOffsets[j.name] = G), G += j.pixelType * 2;
13995
- if (P.totalBytes = G, P.outLineWidth = P.width * P.outputChannels, d.lineOrder === "INCREASING_Y" ? P.scanOrder = (j) => j : P.scanOrder = (j) => P.height - 1 - j, P.outputChannels == 4 ? (P.format = He, P.colorSpace = Mt) : (P.format = jn, P.colorSpace = Fc), d.spec.singleTile) {
13977
+ if (P.totalBytes = G, P.outLineWidth = P.width * P.outputChannels, d.lineOrder === "INCREASING_Y" ? P.scanOrder = (j) => j : P.scanOrder = (j) => P.height - 1 - j, P.outputChannels == 4 ? (P.format = He, P.colorSpace = It) : (P.format = jn, P.colorSpace = Fc), d.spec.singleTile) {
13996
13978
  P.blockHeight = d.tiles.ySize, P.blockWidth = d.tiles.xSize;
13997
13979
  const j = yn(d.tiles, P.width, P.height), Q = zr(j, P.width, d.tiles.xSize, d.tiles.roundingMode), re = zr(j, P.height, d.tiles.ySize, d.tiles.roundingMode);
13998
13980
  P.tileCount = Q[0] * re[0];
@@ -14000,7 +13982,7 @@ class od extends ha {
14000
13982
  for (let ce = 0; ce < re[ee]; ce++)
14001
13983
  for (let te = 0; te < Q[ee]; te++)
14002
13984
  qe(v, A);
14003
- P.decode = Tn.bind(P);
13985
+ P.decode = xn.bind(P);
14004
13986
  } else {
14005
13987
  P.blockWidth = P.width;
14006
13988
  const j = Math.ceil(P.height / P.blockHeight);
@@ -14101,14 +14083,14 @@ class ad extends ha {
14101
14083
  k.length || i(4, "unable to allocate buffer space");
14102
14084
  let H = 0, B = 0;
14103
14085
  const J = 4 * U, ne = new Uint8Array(4), ge = new Uint8Array(J);
14104
- let Ie = z;
14105
- for (; Ie > 0 && B < D.byteLength; ) {
14086
+ let Me = z;
14087
+ for (; Me > 0 && B < D.byteLength; ) {
14106
14088
  B + 4 > D.byteLength && i(1), ne[0] = D[B++], ne[1] = D[B++], ne[2] = D[B++], ne[3] = D[B++], (ne[0] != 2 || ne[1] != 2 || (ne[2] << 8 | ne[3]) != U) && i(3, "bad rgbe scanline format");
14107
14089
  let ve = 0, ye;
14108
14090
  for (; ve < J && B < D.byteLength; ) {
14109
14091
  ye = D[B++];
14110
- const xe = ye > 128;
14111
- if (xe && (ye -= 128), (ye === 0 || ve + ye > J) && i(3, "bad scanline data"), xe) {
14092
+ const Te = ye > 128;
14093
+ if (Te && (ye -= 128), (ye === 0 || ve + ye > J) && i(3, "bad scanline data"), Te) {
14112
14094
  const Se = D[B++];
14113
14095
  for (let ut = 0; ut < ye; ut++)
14114
14096
  ge[ve++] = Se;
@@ -14116,11 +14098,11 @@ class ad extends ha {
14116
14098
  ge.set(D.subarray(B, B + ye), ve), ve += ye, B += ye;
14117
14099
  }
14118
14100
  const Ve = U;
14119
- for (let xe = 0; xe < Ve; xe++) {
14101
+ for (let Te = 0; Te < Ve; Te++) {
14120
14102
  let Se = 0;
14121
- k[H] = ge[xe + Se], Se += U, k[H + 1] = ge[xe + Se], Se += U, k[H + 2] = ge[xe + Se], Se += U, k[H + 3] = ge[xe + Se], H += 4;
14103
+ k[H] = ge[Te + Se], Se += U, k[H + 1] = ge[Te + Se], Se += U, k[H + 2] = ge[Te + Se], Se += U, k[H + 3] = ge[Te + Se], H += 4;
14122
14104
  }
14123
- Ie--;
14105
+ Me--;
14124
14106
  }
14125
14107
  return k;
14126
14108
  }, y = function(D, O, z, U) {
@@ -14132,21 +14114,21 @@ class ad extends ha {
14132
14114
  }, m = new Uint8Array(e);
14133
14115
  m.pos = 0;
14134
14116
  const T = l(m), x = T.width, _ = T.height, S = g(m.subarray(m.pos), x, _);
14135
- let M, I, C;
14117
+ let I, M, C;
14136
14118
  switch (this.type) {
14137
14119
  case Oe:
14138
14120
  C = S.length / 4;
14139
14121
  const D = new Float32Array(C * 4);
14140
14122
  for (let z = 0; z < C; z++)
14141
14123
  y(S, z * 4, D, z * 4);
14142
- M = D, I = Oe;
14124
+ I = D, M = Oe;
14143
14125
  break;
14144
14126
  case We:
14145
14127
  C = S.length / 4;
14146
14128
  const O = new Uint16Array(C * 4);
14147
14129
  for (let z = 0; z < C; z++)
14148
14130
  w(S, z * 4, O, z * 4);
14149
- M = O, I = We;
14131
+ I = O, M = We;
14150
14132
  break;
14151
14133
  default:
14152
14134
  throw new Error("THREE.RGBELoader: Unsupported type: " + this.type);
@@ -14154,11 +14136,11 @@ class ad extends ha {
14154
14136
  return {
14155
14137
  width: x,
14156
14138
  height: _,
14157
- data: M,
14139
+ data: I,
14158
14140
  header: T.string,
14159
14141
  gamma: T.gamma,
14160
14142
  exposure: T.exposure,
14161
- type: I
14143
+ type: M
14162
14144
  };
14163
14145
  }
14164
14146
  setDataType(e) {
@@ -14169,7 +14151,7 @@ class ad extends ha {
14169
14151
  switch (i.type) {
14170
14152
  case Oe:
14171
14153
  case We:
14172
- i.colorSpace = Mt, i.minFilter = Ye, i.magFilter = Ye, i.generateMipmaps = !1, i.flipY = !0;
14154
+ i.colorSpace = It, i.minFilter = Ye, i.magFilter = Ye, i.generateMipmaps = !1, i.flipY = !0;
14173
14155
  break;
14174
14156
  }
14175
14157
  t && t(i, a);
@@ -14257,75 +14239,56 @@ class ld {
14257
14239
  }
14258
14240
  }
14259
14241
  async loadEnvironmentMap(e) {
14260
- var t, r, n, o;
14242
+ var t;
14261
14243
  try {
14262
- const i = this.loadedTextures.get(e);
14263
- if (i)
14264
- return Z.ok(new Jr(i));
14265
- const a = (t = e.split(".").pop()) == null ? void 0 : t.toLowerCase();
14266
- let c;
14267
- switch (a) {
14244
+ const r = this.loadedTextures.get(e);
14245
+ if (r)
14246
+ return Z.ok(new Jr(r));
14247
+ const n = (t = e.split(".").pop()) == null ? void 0 : t.toLowerCase();
14248
+ let o;
14249
+ switch (n) {
14268
14250
  case "hdr":
14269
- c = new ad();
14251
+ o = new ad();
14270
14252
  break;
14271
14253
  case "exr":
14272
- c = new od();
14254
+ o = new od();
14273
14255
  break;
14274
14256
  case "jpg":
14275
14257
  case "jpeg":
14276
14258
  case "png":
14277
- c = new E.TextureLoader();
14259
+ o = new E.TextureLoader();
14278
14260
  break;
14279
14261
  default:
14280
14262
  return Z.err(
14281
14263
  new ae(
14282
- `Unsupported environment map format: ${a}`,
14264
+ `Unsupported environment map format: ${n}`,
14283
14265
  le.UNSUPPORTED_FORMAT,
14284
- { url: e, extension: a }
14266
+ { url: e, extension: n }
14285
14267
  )
14286
14268
  );
14287
14269
  }
14288
- const h = await new Promise((f, u) => {
14289
- c.load(
14270
+ const i = await new Promise((a, c) => {
14271
+ o.load(
14290
14272
  e,
14291
- (l) => {
14292
- var g, y, w, m, T;
14293
- console.log("[ThreeEnvironmentService] Texture loaded:", {
14294
- url: e,
14295
- format: l.format,
14296
- type: l.type,
14297
- mapping: l.mapping,
14298
- hasImage: !!l.image,
14299
- imageType: (y = (g = l.image) == null ? void 0 : g.constructor) == null ? void 0 : y.name,
14300
- imageData: (w = l.image) != null && w.data ? "has data" : "no data",
14301
- imageWidth: (m = l.image) == null ? void 0 : m.width,
14302
- imageHeight: (T = l.image) == null ? void 0 : T.height
14303
- }), f(l);
14273
+ (h) => {
14274
+ a(h);
14304
14275
  },
14305
14276
  void 0,
14306
- (l) => u(l)
14277
+ (h) => c(h)
14307
14278
  );
14308
14279
  });
14309
14280
  if (this.pmremGenerator) {
14310
- h.mapping = E.EquirectangularReflectionMapping;
14311
- const f = this.pmremGenerator.fromEquirectangular(h).texture;
14312
- return this.loadedTextures.set(e, f), this.loadedTextures.set(e + "_original", h), console.log("[ThreeEnvironmentService] Stored original texture for path tracing:", {
14313
- url: e + "_original",
14314
- format: h.format,
14315
- mapping: h.mapping,
14316
- hasImage: !!h.image,
14317
- imageComplete: (r = h.image) == null ? void 0 : r.complete,
14318
- imageNaturalWidth: (n = h.image) == null ? void 0 : n.naturalWidth,
14319
- imageNaturalHeight: (o = h.image) == null ? void 0 : o.naturalHeight
14320
- }), Z.ok(new Jr(f));
14281
+ i.mapping = E.EquirectangularReflectionMapping;
14282
+ const a = this.pmremGenerator.fromEquirectangular(i).texture;
14283
+ return this.loadedTextures.set(e, a), this.loadedTextures.set(e + "_original", i), Z.ok(new Jr(a));
14321
14284
  }
14322
- return this.loadedTextures.set(e, h), Z.ok(new Jr(h));
14323
- } catch (i) {
14285
+ return this.loadedTextures.set(e, i), Z.ok(new Jr(i));
14286
+ } catch (r) {
14324
14287
  return Z.err(
14325
14288
  new ae(
14326
14289
  "Failed to load environment map",
14327
14290
  le.TEXTURE_LOAD_FAILED,
14328
- { url: e, originalError: i }
14291
+ { url: e, originalError: r }
14329
14292
  )
14330
14293
  );
14331
14294
  }
@@ -14535,7 +14498,7 @@ class dd {
14535
14498
  return new Wc(y);
14536
14499
  }
14537
14500
  static createCamera(e) {
14538
- const r = e.camera || {}, n = r.fov || r.cameraFov || 75, o = r.near || r.cameraNear || 0.1, i = r.far || r.cameraFar || 1e5, a = r.position || r.cameraPosition, c = r.target || r.cameraTarget, h = Is.create(
14501
+ const r = e.camera || {}, n = r.fov || r.cameraFov || 75, o = r.near || r.cameraNear || 0.1, i = r.far || r.cameraFar || 1e5, a = r.position || r.cameraPosition, c = r.target || r.cameraTarget, h = Ms.create(
14539
14502
  n,
14540
14503
  1,
14541
14504
  // Aspect ratio will be set by resize
@@ -14566,7 +14529,7 @@ class dd {
14566
14529
  static createControls(e, t, r) {
14567
14530
  const n = r.controls || {}, o = n.type || Ei.OrbitControls;
14568
14531
  let i;
14569
- o === Ei.MapControls ? i = new Ta(e, t) : i = new ya(e, t), i.enabled = n.enabled ?? !0, i.enableDamping = n.enableDamping ?? !0, i.dampingFactor = n.dampingFactor ?? 0.25, i.enableZoom = n.enableZoom ?? !0, i.enableRotate = n.enableRotate ?? !0, i.enablePan = n.enablePan ?? !0, n.minDistance !== void 0 && (i.minDistance = n.minDistance), n.maxDistance !== void 0 && (i.maxDistance = n.maxDistance), n.minPolarAngle !== void 0 && (i.minPolarAngle = n.minPolarAngle), n.maxPolarAngle !== void 0 && (i.maxPolarAngle = n.maxPolarAngle);
14532
+ o === Ei.MapControls ? i = new xa(e, t) : i = new ya(e, t), i.enabled = n.enabled ?? !0, i.enableDamping = n.enableDamping ?? !0, i.dampingFactor = n.dampingFactor ?? 0.25, i.enableZoom = n.enableZoom ?? !0, i.enableRotate = n.enableRotate ?? !0, i.enablePan = n.enablePan ?? !0, n.minDistance !== void 0 && (i.minDistance = n.minDistance), n.maxDistance !== void 0 && (i.maxDistance = n.maxDistance), n.minPolarAngle !== void 0 && (i.minPolarAngle = n.minPolarAngle), n.maxPolarAngle !== void 0 && (i.maxPolarAngle = n.maxPolarAngle);
14570
14533
  const c = r.camera || {}, h = c.target || c.cameraTarget;
14571
14534
  return h && i.target && (i.target.set(h[0], h[1], h[2]), i.update()), i;
14572
14535
  }
@@ -14596,15 +14559,15 @@ const md = {
14596
14559
  camera: {
14597
14560
  position: [60, 60, 60],
14598
14561
  target: [0, 0, 0],
14599
- fov: 75,
14562
+ fov: 45,
14600
14563
  near: 0.1,
14601
14564
  far: 1e5,
14602
14565
  autoFitToObject: !0
14603
14566
  },
14604
14567
  // Environment
14605
14568
  environment: {
14606
- // url: 'https://dl.polyhaven.org/file/ph-assets/HDRIs/extra/Tonemapped%20JPG/industrial_sunset_puresky.jpg',
14607
- backgroundBlurriness: 0.5,
14569
+ url: "https://dl.polyhaven.org/file/ph-assets/HDRIs/extra/Tonemapped%20JPG/industrial_sunset_puresky.jpg",
14570
+ backgroundBlurriness: 0.15,
14608
14571
  backgroundIntensity: 1,
14609
14572
  environmentIntensity: 1
14610
14573
  },
@@ -14714,22 +14677,15 @@ function gd(s) {
14714
14677
  function vd(s, e) {
14715
14678
  const t = $e(null), [r, n] = ns(new Ot()), [o, i] = ns(!1), a = gd(e);
14716
14679
  Dr(() => {
14717
- var l;
14718
14680
  if (!s.current || t.current)
14719
14681
  return;
14720
- const h = { ...md, ...a };
14721
- console.log("[useViewerCore] Creating viewer with options:", {
14722
- pathTracingEnabled: (l = h.pathTracing) == null ? void 0 : l.enabled,
14723
- staticScene: h.staticScene,
14724
- pathTracing: h.pathTracing
14725
- });
14726
- const f = dd.createViewer(s.current, h);
14682
+ const h = { ...md, ...a }, f = dd.createViewer(s.current, h);
14727
14683
  t.current = f;
14728
- const u = f.onStateChange((g) => {
14729
- n(g);
14684
+ const u = f.onStateChange((l) => {
14685
+ n(l);
14730
14686
  });
14731
- return f.initialize().then((g) => {
14732
- g.ok ? i(!0) : console.error("Failed to initialize viewer:", g.error);
14687
+ return f.initialize().then((l) => {
14688
+ l.ok ? i(!0) : console.error("Failed to initialize viewer:", l.error);
14733
14689
  }), () => {
14734
14690
  u(), f.dispose(), t.current = null, i(!1);
14735
14691
  };
@@ -14787,17 +14743,17 @@ function yd(s, e) {
14787
14743
  }, [s]);
14788
14744
  }
14789
14745
  const ja = qa(null);
14790
- function Td({ viewer: s, canvasRef: e, children: t }) {
14746
+ function xd({ viewer: s, canvasRef: e, children: t }) {
14791
14747
  return /* @__PURE__ */ at.jsx(ja.Provider, { value: { viewer: s, canvasRef: e }, children: t });
14792
14748
  }
14793
- function xd() {
14749
+ function Td() {
14794
14750
  const s = Ya(ja);
14795
14751
  if (!s)
14796
14752
  throw new Error("useViewerContext must be used within ViewerProvider");
14797
14753
  return s;
14798
14754
  }
14799
14755
  function bd() {
14800
- const { canvasRef: s } = xd();
14756
+ const { canvasRef: s } = Td();
14801
14757
  return /* @__PURE__ */ at.jsx(
14802
14758
  "canvas",
14803
14759
  {
@@ -14886,10 +14842,10 @@ function _d() {
14886
14842
  oe.unshift("Warning: " + R), Function.prototype.apply.call(console[p], console, oe);
14887
14843
  }
14888
14844
  }
14889
- var S = !1, M = !1, I = !1, C = !1, D = !1, O;
14845
+ var S = !1, I = !1, M = !1, C = !1, D = !1, O;
14890
14846
  O = Symbol.for("react.module.reference");
14891
14847
  function z(p) {
14892
- return !!(typeof p == "string" || typeof p == "function" || p === r || p === o || D || p === n || p === h || p === f || C || p === g || S || M || I || typeof p == "object" && p !== null && (p.$$typeof === l || p.$$typeof === u || p.$$typeof === i || p.$$typeof === a || p.$$typeof === c || // This needs to include all possible module reference object
14848
+ return !!(typeof p == "string" || typeof p == "function" || p === r || p === o || D || p === n || p === h || p === f || C || p === g || S || I || M || typeof p == "object" && p !== null && (p.$$typeof === l || p.$$typeof === u || p.$$typeof === i || p.$$typeof === a || p.$$typeof === c || // This needs to include all possible module reference object
14893
14849
  // types supported by any Flight configuration anywhere since
14894
14850
  // we don't know which Flight build this will end up being used
14895
14851
  // with.
@@ -14950,14 +14906,14 @@ function _d() {
14950
14906
  }
14951
14907
  return null;
14952
14908
  }
14953
- var B = Object.assign, J = 0, ne, ge, Ie, ve, ye, Ve, xe;
14909
+ var B = Object.assign, J = 0, ne, ge, Me, ve, ye, Ve, Te;
14954
14910
  function Se() {
14955
14911
  }
14956
14912
  Se.__reactDisabledLog = !0;
14957
14913
  function ut() {
14958
14914
  {
14959
14915
  if (J === 0) {
14960
- ne = console.log, ge = console.info, Ie = console.warn, ve = console.error, ye = console.group, Ve = console.groupCollapsed, xe = console.groupEnd;
14916
+ ne = console.log, ge = console.info, Me = console.warn, ve = console.error, ye = console.group, Ve = console.groupCollapsed, Te = console.groupEnd;
14961
14917
  var p = {
14962
14918
  configurable: !0,
14963
14919
  enumerable: !0,
@@ -14993,7 +14949,7 @@ function _d() {
14993
14949
  value: ge
14994
14950
  }),
14995
14951
  warn: B({}, p, {
14996
- value: Ie
14952
+ value: Me
14997
14953
  }),
14998
14954
  error: B({}, p, {
14999
14955
  value: ve
@@ -15005,7 +14961,7 @@ function _d() {
15005
14961
  value: Ve
15006
14962
  }),
15007
14963
  groupEnd: B({}, p, {
15008
- value: xe
14964
+ value: Te
15009
14965
  })
15010
14966
  });
15011
14967
  }
@@ -15109,7 +15065,7 @@ function _d() {
15109
15065
  var R = p.prototype;
15110
15066
  return !!(R && R.isReactComponent);
15111
15067
  }
15112
- function Tt(p, R, F) {
15068
+ function xt(p, R, F) {
15113
15069
  if (p == null)
15114
15070
  return "";
15115
15071
  if (typeof p == "function")
@@ -15127,11 +15083,11 @@ function _d() {
15127
15083
  case c:
15128
15084
  return Wt(p.render);
15129
15085
  case u:
15130
- return Tt(p.type, R, F);
15086
+ return xt(p.type, R, F);
15131
15087
  case l: {
15132
15088
  var V = p, ie = V._payload, oe = V._init;
15133
15089
  try {
15134
- return Tt(oe(ie), R, F);
15090
+ return xt(oe(ie), R, F);
15135
15091
  } catch {
15136
15092
  }
15137
15093
  }
@@ -15139,9 +15095,9 @@ function _d() {
15139
15095
  return "";
15140
15096
  }
15141
15097
  var ft = Object.prototype.hasOwnProperty, fr = {}, dr = T.ReactDebugCurrentFrame;
15142
- function It(p) {
15098
+ function Mt(p) {
15143
15099
  if (p) {
15144
- var R = p._owner, F = Tt(p.type, p._source, R ? R.type : null);
15100
+ var R = p._owner, F = xt(p.type, p._source, R ? R.type : null);
15145
15101
  dr.setExtraStackFrame(F);
15146
15102
  } else
15147
15103
  dr.setExtraStackFrame(null);
@@ -15161,7 +15117,7 @@ function _d() {
15161
15117
  } catch (v) {
15162
15118
  X = v;
15163
15119
  }
15164
- X && !(X instanceof Error) && (It(ie), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", V || "React class", F, $, typeof X), It(null)), X instanceof Error && !(X.message in fr) && (fr[X.message] = !0, It(ie), x("Failed %s type: %s", F, X.message), It(null));
15120
+ X && !(X instanceof Error) && (Mt(ie), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", V || "React class", F, $, typeof X), Mt(null)), X instanceof Error && !(X.message in fr) && (fr[X.message] = !0, Mt(ie), x("Failed %s type: %s", F, X.message), Mt(null));
15165
15121
  }
15166
15122
  }
15167
15123
  }
@@ -15236,7 +15192,7 @@ function _d() {
15236
15192
  });
15237
15193
  }
15238
15194
  }
15239
- var xt = function(p, R, F, V, ie, oe, $) {
15195
+ var Tt = function(p, R, F, V, ie, oe, $) {
15240
15196
  var X = {
15241
15197
  // This tag allows us to uniquely identify this as a React Element
15242
15198
  $$typeof: e,
@@ -15280,13 +15236,13 @@ function _d() {
15280
15236
  var b = typeof p == "function" ? p.displayName || p.name || "Unknown" : p;
15281
15237
  X && Ke($, b), d && kr($, b);
15282
15238
  }
15283
- return xt(p, X, d, ie, V, gr.current, $);
15239
+ return Tt(p, X, d, ie, V, gr.current, $);
15284
15240
  }
15285
15241
  }
15286
15242
  var Ce = T.ReactCurrentOwner, yr = T.ReactDebugCurrentFrame;
15287
15243
  function K(p) {
15288
15244
  if (p) {
15289
- var R = p._owner, F = Tt(p.type, p._source, R ? R.type : null);
15245
+ var R = p._owner, F = xt(p.type, p._source, R ? R.type : null);
15290
15246
  yr.setExtraStackFrame(F);
15291
15247
  } else
15292
15248
  yr.setExtraStackFrame(null);
@@ -15296,7 +15252,7 @@ function _d() {
15296
15252
  function Yt(p) {
15297
15253
  return typeof p == "object" && p !== null && p.$$typeof === e;
15298
15254
  }
15299
- function Tr() {
15255
+ function xr() {
15300
15256
  {
15301
15257
  if (Ce.current) {
15302
15258
  var p = H(Ce.current.type);
@@ -15311,10 +15267,10 @@ Check the render method of \`` + p + "`.";
15311
15267
  function dn(p) {
15312
15268
  return "";
15313
15269
  }
15314
- var xr = {};
15270
+ var Tr = {};
15315
15271
  function pn(p) {
15316
15272
  {
15317
- var R = Tr();
15273
+ var R = xr();
15318
15274
  if (!R) {
15319
15275
  var F = typeof p == "string" ? p : p.displayName || p.name;
15320
15276
  F && (R = `
@@ -15330,9 +15286,9 @@ Check the top-level render call using <` + F + ">.");
15330
15286
  return;
15331
15287
  p._store.validated = !0;
15332
15288
  var F = pn(R);
15333
- if (xr[F])
15289
+ if (Tr[F])
15334
15290
  return;
15335
- xr[F] = !0;
15291
+ Tr[F] = !0;
15336
15292
  var V = "";
15337
15293
  p && p._owner && p._owner !== Ce.current && (V = " It was passed a child from " + H(p._owner.type) + "."), K(p), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', F, V), K(null);
15338
15294
  }
@@ -15401,7 +15357,7 @@ Check the top-level render call using <` + F + ">.");
15401
15357
  var X = "";
15402
15358
  (p === void 0 || typeof p == "object" && p !== null && Object.keys(p).length === 0) && (X += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
15403
15359
  var d = dn();
15404
- d ? X += d : X += Tr();
15360
+ d ? X += d : X += xr();
15405
15361
  var v;
15406
15362
  p === null ? v = "null" : Vt(p) ? v = "array" : p !== void 0 && p.$$typeof === e ? (v = "<" + (H(p.type) || "Unknown") + " />", X = " Did you accidentally export a JSX literal instead of a component?") : v = typeof p, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, X);
15407
15363
  }
@@ -15444,8 +15400,8 @@ React keys must be passed directly to JSX without using spread:
15444
15400
  function yn(p, R, F) {
15445
15401
  return Sr(p, R, F, !1);
15446
15402
  }
15447
- var zr = yn, Tn = vn;
15448
- vi.Fragment = r, vi.jsx = zr, vi.jsxs = Tn;
15403
+ var zr = yn, xn = vn;
15404
+ vi.Fragment = r, vi.jsx = zr, vi.jsxs = xn;
15449
15405
  }()), vi;
15450
15406
  }
15451
15407
  process.env.NODE_ENV === "production" ? ws.exports = wd() : ws.exports = _d();
@@ -15470,7 +15426,7 @@ const Ed = (s, e, t, r, n, o) => {
15470
15426
  } catch {
15471
15427
  return !1;
15472
15428
  }
15473
- }, Md = () => Rd() ? new E.WebGLRenderer({ alpha: !0, antialias: !1 }) : (console.error("WebGL is not supported in this environment."), null), Wo = { type: "change" }, zs = { type: "start" }, Wa = { type: "end" }, yi = new ia(), Vo = new Ri(), Id = Math.cos(70 * Es.DEG2RAD), Be = new Y(), ot = 2 * Math.PI, _e = {
15429
+ }, Id = () => Rd() ? new E.WebGLRenderer({ alpha: !0, antialias: !1 }) : (console.error("WebGL is not supported in this environment."), null), Wo = { type: "change" }, zs = { type: "start" }, Wa = { type: "end" }, yi = new ia(), Vo = new Ri(), Md = Math.cos(70 * Es.DEG2RAD), Be = new Y(), ot = 2 * Math.PI, _e = {
15474
15430
  NONE: -1,
15475
15431
  ROTATE: 0,
15476
15432
  DOLLY: 1,
@@ -15542,7 +15498,7 @@ class Cd extends sa {
15542
15498
  h.unproject(this.object), this.object.position.sub(h).add(a), this.object.updateMatrixWorld(), i = Be.length();
15543
15499
  } else
15544
15500
  console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
15545
- i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (yi.origin.copy(this.object.position), yi.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(yi.direction)) < Id ? this.object.lookAt(this.target) : (Vo.setFromNormalAndCoplanarPoint(this.object.up, this.target), yi.intersectPlane(Vo, this.target))));
15501
+ i !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position) : (yi.origin.copy(this.object.position), yi.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(yi.direction)) < Md ? this.object.lookAt(this.target) : (Vo.setFromNormalAndCoplanarPoint(this.object.up, this.target), yi.intersectPlane(Vo, this.target))));
15546
15502
  } else if (this.object.isOrthographicCamera) {
15547
15503
  const i = this.object.zoom;
15548
15504
  this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), i !== this.object.zoom && (this.object.updateProjectionMatrix(), o = !0);
@@ -15920,7 +15876,7 @@ class Wd {
15920
15876
  return n.needsUpdate = !0, n;
15921
15877
  }
15922
15878
  }
15923
- class Ti {
15879
+ class xi {
15924
15880
  static createWireframe([e, t, r]) {
15925
15881
  const n = new E.BoxGeometry(e, t, r), o = new E.EdgesGeometry(n), i = new E.LineBasicMaterial({ color: pe.LINE_COLOR }), a = new E.LineSegments(o, i);
15926
15882
  return a.name = "Wireframe", a;
@@ -15995,19 +15951,19 @@ class qd {
15995
15951
  }
15996
15952
  }
15997
15953
  createWireframe() {
15998
- const e = pe.CUBE_SIZE + pe.EDGE_SECTION_SIZE, t = Ti.createWireframe([e, e, e]);
15954
+ const e = pe.CUBE_SIZE + pe.EDGE_SECTION_SIZE, t = xi.createWireframe([e, e, e]);
15999
15955
  return t.userData.gizmoCube = this, t;
16000
15956
  }
16001
15957
  createEdgeBox(e, t, r) {
16002
- const n = Ti.createEdgeBox(e, t, r);
15958
+ const n = xi.createEdgeBox(e, t, r);
16003
15959
  return n.userData.gizmoCube = this, n;
16004
15960
  }
16005
15961
  createCornerCube(e, t) {
16006
- const r = Ti.createCornerCube(e, t);
15962
+ const r = xi.createCornerCube(e, t);
16007
15963
  return r.userData.gizmoCube = this, r;
16008
15964
  }
16009
15965
  createFace(e, t, r) {
16010
- const n = Ti.createFace(e, t, r), o = n.getObjectByName(`Face Box ${r}`);
15966
+ const n = xi.createFace(e, t, r), o = n.getObjectByName(`Face Box ${r}`);
16011
15967
  return o.userData.gizmoCube = this, n;
16012
15968
  }
16013
15969
  createEdges(e) {
@@ -16296,7 +16252,7 @@ const Jd = ({
16296
16252
  render: r,
16297
16253
  options: n
16298
16254
  }) => {
16299
- const o = $e(null), i = $e(new E.Scene()).current, [a] = ns(() => Md()), c = 30, h = 1, f = 0.1, u = 10, l = new E.PerspectiveCamera(
16255
+ const o = $e(null), i = $e(new E.Scene()).current, [a] = ns(() => Id()), c = 30, h = 1, f = 0.1, u = 10, l = new E.PerspectiveCamera(
16300
16256
  c,
16301
16257
  h,
16302
16258
  f,
@@ -16306,12 +16262,12 @@ const Jd = ({
16306
16262
  }, [r, a, i, g]), m = Ht(
16307
16263
  (S) => {
16308
16264
  if (!s || !e) return;
16309
- const M = s.position.length(), I = S.clone().multiplyScalar(M);
16265
+ const I = s.position.length(), M = S.clone().multiplyScalar(I);
16310
16266
  Ed(
16311
16267
  s,
16312
16268
  e,
16313
16269
  s.position.clone(),
16314
- I,
16270
+ M,
16315
16271
  400,
16316
16272
  w
16317
16273
  ), s.lookAt(new E.Vector3(0, 0, 0)), s.up.set(0, 1, 0), e.target.set(0, 0, 0);
@@ -16328,12 +16284,12 @@ const Jd = ({
16328
16284
  const S = o.current;
16329
16285
  if (!S || !s || !e || !a) return;
16330
16286
  y.current && y.current.dispose();
16331
- const M = {
16287
+ const I = {
16332
16288
  gizmoDiv: S,
16333
16289
  gizmoScene: i,
16334
16290
  gizmoRenderer: a,
16335
16291
  gizmoCamera: g
16336
- }, I = {
16292
+ }, M = {
16337
16293
  mainCamera: s,
16338
16294
  mainControls: e,
16339
16295
  renderGizmo: w
@@ -16342,8 +16298,8 @@ const Jd = ({
16342
16298
  syncMainCameraWithGizmo: Ad
16343
16299
  };
16344
16300
  return y.current = new Yd({
16345
- gizmoParams: M,
16346
- mainParams: I,
16301
+ gizmoParams: I,
16302
+ mainParams: M,
16347
16303
  syncFunctions: C,
16348
16304
  options: n
16349
16305
  }), S.addEventListener("mousedown", T), S.addEventListener("mousemove", x), S.addEventListener("mouseup", _), () => {
@@ -16497,7 +16453,7 @@ class Zo {
16497
16453
  }
16498
16454
  const Va = Ko(
16499
16455
  ({ object: s, options: e = {} }, t) => {
16500
- var S, M;
16456
+ var S, I;
16501
16457
  const r = $e(null), { viewer: n, isInitialized: o } = vd(r, e), i = $e(
16502
16458
  new Rs()
16503
16459
  ), a = $e(void 0), c = Fn(() => {
@@ -16511,60 +16467,60 @@ const Va = Ko(
16511
16467
  }, [c, s]), Dr(() => {
16512
16468
  if (!n || !o || !a.current)
16513
16469
  return;
16514
- const I = typeof a.current == "string" ? a.current : new Qe(a.current);
16515
- n.loadModel(I).then((C) => {
16470
+ const M = typeof a.current == "string" ? a.current : new Qe(a.current);
16471
+ n.loadModel(M).then((C) => {
16516
16472
  C.ok || console.error("Failed to load model:", C.error);
16517
16473
  });
16518
16474
  }, [n, o, c]);
16519
16475
  const h = Fn(() => ({
16520
- "model:loaded": (I) => i.current.emit("model:loaded", Zo.convertModelLoaded(I)),
16521
- "model:error": (I) => i.current.emit("model:error", I),
16522
- "render:complete": (I) => i.current.emit("render:complete", I),
16523
- "controls:change": (I) => i.current.emit("controls:change", Zo.convertControlsChange(I)),
16524
- error: (I) => i.current.emit("error", I)
16476
+ "model:loaded": (M) => i.current.emit("model:loaded", Zo.convertModelLoaded(M)),
16477
+ "model:error": (M) => i.current.emit("model:error", M),
16478
+ "render:complete": (M) => i.current.emit("render:complete", M),
16479
+ "controls:change": (M) => i.current.emit("controls:change", Zo.convertControlsChange(M)),
16480
+ error: (M) => i.current.emit("error", M)
16525
16481
  }), []);
16526
16482
  yd(n, h);
16527
- const f = Ht((I) => {
16528
- if (I && typeof I == "object") {
16529
- const C = I;
16483
+ const f = Ht((M) => {
16484
+ if (M && typeof M == "object") {
16485
+ const C = M;
16530
16486
  if (typeof C.getThreeScene == "function")
16531
16487
  return C.getThreeScene();
16532
16488
  }
16533
16489
  return null;
16534
- }, []), u = Ht((I) => {
16535
- if (I && typeof I == "object") {
16536
- const C = I;
16490
+ }, []), u = Ht((M) => {
16491
+ if (M && typeof M == "object") {
16492
+ const C = M;
16537
16493
  if (typeof C.getThreeCamera == "function")
16538
16494
  return C.getThreeCamera();
16539
16495
  }
16540
16496
  return null;
16541
- }, []), l = Ht((I) => {
16542
- if (I && typeof I == "object") {
16543
- const C = I;
16497
+ }, []), l = Ht((M) => {
16498
+ if (M && typeof M == "object") {
16499
+ const C = M;
16544
16500
  if (typeof C.getThreeRenderer == "function")
16545
16501
  return C.getThreeRenderer();
16546
16502
  }
16547
16503
  return null;
16548
- }, []), g = Ht((I) => {
16549
- if (I && typeof I == "object") {
16550
- const C = I;
16504
+ }, []), g = Ht((M) => {
16505
+ if (M && typeof M == "object") {
16506
+ const C = M;
16551
16507
  if (typeof C.getThreeControls == "function")
16552
16508
  return C.getThreeControls();
16553
16509
  }
16554
16510
  return null;
16555
16511
  }, []), y = n ? u(n.camera) : null, w = n ? g(n.controls) : null, m = n ? l(n.renderer) : null, T = Ht(() => {
16556
16512
  if (m && n) {
16557
- const I = n;
16558
- I.renderLoopManager && typeof I.renderLoopManager.requestRender == "function" && I.renderLoopManager.requestRender();
16513
+ const M = n;
16514
+ M.renderLoopManager && typeof M.renderLoopManager.requestRender == "function" && M.renderLoopManager.requestRender();
16559
16515
  }
16560
- }, [n, m]), x = ((S = e.helpers) == null ? void 0 : S.gizmo) !== void 0 && e.helpers.gizmo !== !1, _ = typeof ((M = e.helpers) == null ? void 0 : M.gizmo) == "object" ? e.helpers.gizmo : {};
16516
+ }, [n, m]), x = ((S = e.helpers) == null ? void 0 : S.gizmo) !== void 0 && e.helpers.gizmo !== !1, _ = typeof ((I = e.helpers) == null ? void 0 : I.gizmo) == "object" ? e.helpers.gizmo : {};
16561
16517
  return Ka(t, () => ({
16562
16518
  scene: n ? f(n.scene) : null,
16563
16519
  camera: y,
16564
16520
  renderer: m,
16565
16521
  controls: w,
16566
16522
  events: i.current
16567
- }), [n, y, m, w, f]), /* @__PURE__ */ at.jsx(tp, { children: /* @__PURE__ */ at.jsx(Td, { viewer: n, canvasRef: r, children: /* @__PURE__ */ at.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
16523
+ }), [n, y, m, w, f]), /* @__PURE__ */ at.jsx(tp, { children: /* @__PURE__ */ at.jsx(xd, { viewer: n, canvasRef: r, children: /* @__PURE__ */ at.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
16568
16524
  /* @__PURE__ */ at.jsx(bd, {}),
16569
16525
  x && o && y && w && /* @__PURE__ */ at.jsx(
16570
16526
  ep,