@needle-tools/engine 4.8.9-next.5e888f7 → 4.9.0-alpha

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/{needle-engine.bundle-CBk4h0tH.js → needle-engine.bundle-BmZiljES.js} +657 -639
  3. package/dist/{needle-engine.bundle-CF7LvCm4.min.js → needle-engine.bundle-D_zlE1Pj.min.js} +42 -42
  4. package/dist/{needle-engine.bundle-B8QgMEWj.umd.cjs → needle-engine.bundle-n9XV_9nh.umd.cjs} +67 -67
  5. package/dist/needle-engine.js +2 -2
  6. package/dist/needle-engine.min.js +1 -1
  7. package/dist/needle-engine.umd.cjs +1 -1
  8. package/dist/rapier-BJaux8TQ.js +5217 -0
  9. package/dist/rapier-Bd0qRV1r.umd.cjs +1 -0
  10. package/dist/rapier-CnHGx3sO.min.js +1 -0
  11. package/lib/engine/engine_physics_rapier.js +3 -2
  12. package/lib/engine/engine_physics_rapier.js.map +1 -1
  13. package/lib/engine/engine_three_utils.js +4 -2
  14. package/lib/engine/engine_three_utils.js.map +1 -1
  15. package/lib/engine/xr/NeedleXRController.js +30 -9
  16. package/lib/engine/xr/NeedleXRController.js.map +1 -1
  17. package/lib/engine/xr/NeedleXRSession.js +18 -13
  18. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  19. package/lib/engine-components/webxr/controllers/XRControllerModel.js +2 -2
  20. package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
  21. package/lib/engine-components/webxr/controllers/XRControllerMovement.js +4 -0
  22. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  23. package/package.json +3 -3
  24. package/src/engine/engine_physics_rapier.ts +3 -2
  25. package/src/engine/engine_three_utils.ts +5 -2
  26. package/src/engine/xr/NeedleXRController.ts +39 -15
  27. package/src/engine/xr/NeedleXRSession.ts +18 -13
  28. package/src/engine-components/webxr/controllers/XRControllerModel.ts +3 -2
  29. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +5 -1
  30. package/dist/rapier--oeYP_h7.umd.cjs +0 -1
  31. package/dist/rapier-B3xpyPtq.js +0 -5142
  32. package/dist/rapier-CyWhltHY.min.js +0 -1
@@ -1,7 +1,7 @@
1
- import { Vector2 as J, Vector3 as y, Vector4 as de, Quaternion as U, PlaneGeometry as Nn, WebGLRenderer as mr, PerspectiveCamera as me, OrthographicCamera as Dd, Scene as yi, Mesh as H, Texture as Te, Uniform$1 as Ui, Color as se, ShaderMaterial as Dn, Box3 as mi, ShadowMaterial as fb, Euler as Tt, MeshStandardMaterial as ht, Box3Helper as Kw, GridHelper as fm, Object3D as M, Material as _e, Matrix3 as pb, Matrix4 as te, Layers as ho, Ray as uo, MathUtils as ys, AxesHelper as gi, MeshBasicMaterial as we, DoubleSide as _i, BufferGeometry as on, Group as oo, CylinderGeometry as mb, SphereGeometry as jd, BoxGeometry as ua, SpriteMaterial as Zw, Sprite as Jw, Shape as ex, ExtrudeGeometry as tx, Fog as gb, DirectionalLight as lp, PointLight as pm, EdgesGeometry as ix, LineSegments as yb, LineBasicMaterial as mm, Line as fa, BufferAttribute as dt, Raycaster as Bd, Sphere as Fd, ArrayCamera as nx, Plane as rr, SkinnedMesh as _s, InterleavedBufferAttribute as _b, Skeleton as sx, Bone as ox, Source as rx, WebGLCubeRenderTarget as ax, CubeCamera as lx, AnimationClip as ro, FileLoader as gm, TextureLoader as sc, PropertyBinding as pa, LinearSRGBColorSpace as Cs, ShaderChunk as Vt, UniformsLib as cx, DataTexture as ym, RGBAFormat as zd, EquirectangularReflectionMapping as bs, SRGBColorSpace as Ps, Clock as hx, NeutralToneMapping as ma, AgXToneMapping as Ud, ACESFilmicToneMapping as Nd, NoToneMapping as Kh, PCFSoftShadowMap$1 as dx, BasicNodeLibrary as ux, WebGLRenderTarget as jn, DepthTexture as bb, NearestFilter as Zh, LoopRepeat as fx, LoopOnce as cp, AnimationMixer as _m, CompressedTexture as px, FrontSide as fo, Camera as mx, Frustum as Zg, AudioListener as gx, PositionalAudio as yx, AudioLoader as hp, EventDispatcher as bm, BackSide as $d, MeshDepthMaterial as _x, CustomBlending as bx, MaxEquation as vx, AmbientLight as wx, HemisphereLight as xx, AlwaysStencilFunc as Sx, GreaterEqualStencilFunc as Cx, NotEqualStencilFunc as Px, GreaterStencilFunc as Ox, LessEqualStencilFunc as kx, EqualStencilFunc as Mx, LessStencilFunc as Rx, NeverStencilFunc as Jg, InvertStencilOp as Tx, DecrementWrapStencilOp as Ex, IncrementWrapStencilOp as Ax, DecrementStencilOp as Ix, IncrementStencilOp as Lx, ReplaceStencilOp as Dx, ZeroStencilOp as jx, KeepStencilOp as Bx, RawShaderMaterial as vb, GLSL3 as Fx, AlwaysDepth as zx, GreaterEqualDepth as Ux, GreaterDepth as Nx, LessEqualDepth as $x, LessDepth as Wx, NotEqualDepth as Vx, EqualDepth as Hx, BatchedMesh as ey, MeshPhysicalMaterial as dp, LinearFilter as Jh, UnsignedByteType as Gx, RingGeometry as qx, Line3 as Xx, AdditiveBlending as wb, BoxHelper as Qx, SpotLight as Yx, DirectionalLightHelper as Kx, CameraHelper as Zx, LOD as Jx, Triangle as eS, NormalBlending as tS, ReinhardToneMapping as vm, LinearToneMapping as wm, HalfFloatType as Yu, VideoTexture as iS, CubeUVReflectionMapping as xb, CubeTexture as nS, CompressedCubeTexture as sS, EquirectangularRefractionMapping as oS, CatmullRomCurve3 as rS, VectorKeyframeTrack as aS, QuaternionKeyframeTrack as lS, Audio as cS, ShaderLib as ed, UniformsUtils as Sb, MirroredRepeatWrapping as ty, MeshNormalMaterial as hS, AudioContext as dS, PMREMGenerator$1 as uS } from "./three-CsHK73Zc.js";
2
- import { createLoaders as xm, getRaycastMesh as Cb, LODsManager as Do, NEEDLE_progressive as We, addDracoAndKTX2Loaders as fS, configureLoader as pS, setKTX2TranscoderLocation as mS, setDracoDecoderLocation as gS } from "./gltf-progressive-egsMzRdv.js";
3
- import { GroundedSkybox as ga, Font as yS, TextGeometry as _S, FontLoader as bS, GLTFLoader as Os, TransformControlsGizmo as Pb, EXRLoader as Sm, RGBELoader as Ob, Stats as vS, nodeFrame as wS, OrbitControls as kb, PositionalAudioHelper as xS, HorizontalBlurShader as SS, VerticalBlurShader as CS, GLTFExporter as Mb, strToU8 as Rb, zipSync as PS, XRControllerModelFactory as OS, XRHandMeshModel as kS, Line2 as MS, LineGeometry as RS, LineMaterial as TS, TransformControls as ES, InteractiveGroup as AS, HTMLMesh as IS, VertexNormalsHelper as LS, OBJLoader as Cm, FBXLoader as Tb, mergeVertices as DS } from "./three-examples-BvMpKSun.js";
4
- import { fetchProfile as jS, MotionController as BS, $70d766613f57b014$export$2e2bcd8739ae039 as iy, ByteBuffer as FS, v5 as ny, md5 as sy, SIZE_PREFIX_LENGTH as Eb, Builder as Pm, createNoise4D as zS, Matrix4 as Ku, BatchedParticleRenderer as US, ParticleSystem as NS, RenderMode as ls, ConstantColor as $S, Vector4 as WS, ConstantValue as VS, TrailParticle as oy, WorkerBase as HS, MeshBVH as GS } from "./vendor-Msb9AgYE.js";
1
+ import { Vector2 as J, Vector3 as y, Vector4 as de, Quaternion as U, PlaneGeometry as Nn, WebGLRenderer as mr, PerspectiveCamera as me, OrthographicCamera as Dd, Scene as yi, Mesh as H, Texture as Te, Uniform$1 as Ui, Color as se, ShaderMaterial as Dn, Box3 as mi, ShadowMaterial as fb, Euler as Tt, MeshStandardMaterial as ht, Box3Helper as Kw, GridHelper as fm, Object3D as M, Material as _e, Matrix3 as pb, Matrix4 as te, Layers as ho, Ray as uo, MathUtils as gs, AxesHelper as gi, MeshBasicMaterial as we, DoubleSide as _i, BufferGeometry as on, Group as oo, CylinderGeometry as mb, SphereGeometry as jd, BoxGeometry as ua, SpriteMaterial as Zw, Sprite as Jw, Shape as ex, ExtrudeGeometry as tx, Fog as gb, DirectionalLight as lp, PointLight as pm, EdgesGeometry as ix, LineSegments as yb, LineBasicMaterial as mm, Line as fa, BufferAttribute as dt, Raycaster as Bd, Sphere as Fd, ArrayCamera as nx, Plane as rr, SkinnedMesh as ys, InterleavedBufferAttribute as _b, Skeleton as sx, Bone as ox, Source as rx, WebGLCubeRenderTarget as ax, CubeCamera as lx, AnimationClip as ro, FileLoader as gm, TextureLoader as sc, PropertyBinding as pa, LinearSRGBColorSpace as Ss, ShaderChunk as Vt, UniformsLib as cx, DataTexture as ym, RGBAFormat as zd, EquirectangularReflectionMapping as _s, SRGBColorSpace as Cs, Clock as hx, NeutralToneMapping as ma, AgXToneMapping as Ud, ACESFilmicToneMapping as Nd, NoToneMapping as Kh, PCFSoftShadowMap$1 as dx, BasicNodeLibrary as ux, WebGLRenderTarget as jn, DepthTexture as bb, NearestFilter as Zh, LoopRepeat as fx, LoopOnce as cp, AnimationMixer as _m, CompressedTexture as px, FrontSide as fo, Camera as mx, Frustum as Zg, AudioListener as gx, PositionalAudio as yx, AudioLoader as hp, EventDispatcher as bm, BackSide as $d, MeshDepthMaterial as _x, CustomBlending as bx, MaxEquation as vx, AmbientLight as wx, HemisphereLight as xx, AlwaysStencilFunc as Sx, GreaterEqualStencilFunc as Cx, NotEqualStencilFunc as Px, GreaterStencilFunc as Ox, LessEqualStencilFunc as kx, EqualStencilFunc as Mx, LessStencilFunc as Rx, NeverStencilFunc as Jg, InvertStencilOp as Tx, DecrementWrapStencilOp as Ex, IncrementWrapStencilOp as Ax, DecrementStencilOp as Ix, IncrementStencilOp as Lx, ReplaceStencilOp as Dx, ZeroStencilOp as jx, KeepStencilOp as Bx, RawShaderMaterial as vb, GLSL3 as Fx, AlwaysDepth as zx, GreaterEqualDepth as Ux, GreaterDepth as Nx, LessEqualDepth as $x, LessDepth as Wx, NotEqualDepth as Vx, EqualDepth as Hx, BatchedMesh as ey, MeshPhysicalMaterial as dp, LinearFilter as Jh, UnsignedByteType as Gx, RingGeometry as qx, Line3 as Xx, AdditiveBlending as wb, BoxHelper as Qx, SpotLight as Yx, DirectionalLightHelper as Kx, CameraHelper as Zx, LOD as Jx, Triangle as eS, NormalBlending as tS, ReinhardToneMapping as vm, LinearToneMapping as wm, HalfFloatType as Yu, VideoTexture as iS, CubeUVReflectionMapping as xb, CubeTexture as nS, CompressedCubeTexture as sS, EquirectangularRefractionMapping as oS, CatmullRomCurve3 as rS, VectorKeyframeTrack as aS, QuaternionKeyframeTrack as lS, Audio as cS, ShaderLib as ed, UniformsUtils as Sb, MirroredRepeatWrapping as ty, MeshNormalMaterial as hS, AudioContext as dS, PMREMGenerator$1 as uS } from "./three-CsHK73Zc.js";
2
+ import { createLoaders as xm, getRaycastMesh as Cb, LODsManager as Do, NEEDLE_progressive as Ve, addDracoAndKTX2Loaders as fS, configureLoader as pS, setKTX2TranscoderLocation as mS, setDracoDecoderLocation as gS } from "./gltf-progressive-egsMzRdv.js";
3
+ import { GroundedSkybox as ga, Font as yS, TextGeometry as _S, FontLoader as bS, GLTFLoader as Ps, TransformControlsGizmo as Pb, EXRLoader as Sm, RGBELoader as Ob, Stats as vS, nodeFrame as wS, OrbitControls as kb, PositionalAudioHelper as xS, HorizontalBlurShader as SS, VerticalBlurShader as CS, GLTFExporter as Mb, strToU8 as Rb, zipSync as PS, XRControllerModelFactory as OS, XRHandMeshModel as kS, Line2 as MS, LineGeometry as RS, LineMaterial as TS, TransformControls as ES, InteractiveGroup as AS, HTMLMesh as IS, VertexNormalsHelper as LS, OBJLoader as Cm, FBXLoader as Tb, mergeVertices as DS } from "./three-examples-BvMpKSun.js";
4
+ import { fetchProfile as jS, MotionController as BS, $70d766613f57b014$export$2e2bcd8739ae039 as iy, ByteBuffer as FS, v5 as ny, md5 as sy, SIZE_PREFIX_LENGTH as Eb, Builder as Pm, createNoise4D as zS, Matrix4 as Ku, BatchedParticleRenderer as US, ParticleSystem as NS, RenderMode as as, ConstantColor as $S, Vector4 as WS, ConstantValue as VS, TrailParticle as oy, WorkerBase as HS, MeshBVH as GS } from "./vendor-Msb9AgYE.js";
5
5
  import { __webpack_exports__default as Ce, __webpack_exports__Text as Ab, __webpack_exports__Block as Ib, __webpack_exports__update as qS, SimpleStateBehavior as XS, __webpack_exports__Inline as Zu, __webpack_exports__FontLibrary as ry, ThreeMeshUI as ay } from "./three-mesh-ui-CN6aRT7i.js";
6
6
  import { EffectAttribute as QS } from "./postprocessing-DP1U_BpT.js";
7
7
  const Ju = /* @__PURE__ */ new Map();
@@ -205,7 +205,7 @@ function Vd(s, e) {
205
205
  }
206
206
  return s;
207
207
  }
208
- function ks(s) {
208
+ function Os(s) {
209
209
  return new Promise((e, t) => {
210
210
  setTimeout(e, s);
211
211
  });
@@ -410,14 +410,14 @@ var q;
410
410
  return E !== void 0 || (E = document.createElement("a").relList.supports("ar")), E;
411
411
  }
412
412
  s.supportsQuickLookAR = B;
413
- async function L() {
413
+ async function D() {
414
414
  try {
415
415
  return (await navigator.permissions.query({ name: "microphone" })).state !== "denied";
416
416
  } catch (V) {
417
417
  return console.error("Error querying `microphone` permissions.", V), !1;
418
418
  }
419
419
  }
420
- s.microphonePermissionsGranted = L;
420
+ s.microphonePermissionsGranted = D;
421
421
  let W;
422
422
  function X() {
423
423
  if (W !== void 0) return W;
@@ -583,8 +583,8 @@ async function mC(s, e) {
583
583
  _ > 1 ? b = g / _ : g = b * _;
584
584
  const x = n * s.width, I = Math.max(g, b), O = Math.round(I + x), k = Math.round(I + x), E = (d.width - I) / 2, B = (d.height - I) / 2;
585
585
  f.shadowColor = o, f.shadowBlur = i;
586
- const L = r, W = Math.round(E - x / 2), X = Math.round(B - x / 2);
587
- f.beginPath(), f.moveTo(W + L, X), f.lineTo(W + O - L, X), f.quadraticCurveTo(W + O, X, W + O, X + L), f.lineTo(W + O, X + k - L), f.quadraticCurveTo(W + O, X + k, W + O - L, X + k), f.lineTo(W + L, X + k), f.quadraticCurveTo(W, X + k, W, X + k - L), f.lineTo(W, X + L), f.quadraticCurveTo(W, X, W + L, X), f.fillStyle = "#ffffff", f.closePath(), f.fill(), f.clip(), f.shadowColor = "transparent";
586
+ const D = r, W = Math.round(E - x / 2), X = Math.round(B - x / 2);
587
+ f.beginPath(), f.moveTo(W + D, X), f.lineTo(W + O - D, X), f.quadraticCurveTo(W + O, X, W + O, X + D), f.lineTo(W + O, X + k - D), f.quadraticCurveTo(W + O, X + k, W + O - D, X + k), f.lineTo(W + D, X + k), f.quadraticCurveTo(W, X + k, W, X + k - D), f.lineTo(W, X + D), f.quadraticCurveTo(W, X, W + D, X), f.fillStyle = "#ffffff", f.closePath(), f.fill(), f.clip(), f.shadowColor = "transparent";
588
588
  const A = (d.width - g) / 2, $ = (d.height - b) / 2;
589
589
  f.drawImage(a, A, $, g, b);
590
590
  }
@@ -1051,7 +1051,7 @@ function Vb(s, e, t, i, n) {
1051
1051
  Ko.set(e, t, i, n), cn(s, Ko);
1052
1052
  }
1053
1053
  const BC = new Wi(() => new y(), 100), FC = new y();
1054
- function $e(s, e = null) {
1054
+ function We(s, e = null) {
1055
1055
  return e || (e = BC.get()), s ? s.parent ? (s.getWorldScale(e), e) : e.copy(s.scale) : e.set(0, 0, 0);
1056
1056
  }
1057
1057
  function rc(s, e) {
@@ -1195,7 +1195,7 @@ class ar {
1195
1195
  const h = this.mesh;
1196
1196
  h.material = o, h.frustumCulled = !1, this.scene.children.length = 0, this.scene.add(h);
1197
1197
  const d = n.getRenderTarget(), f = n.getContext(), p = f.getParameter(f.DEPTH_TEST), g = f.getParameter(f.DEPTH_WRITEMASK), b = f.getParameter(f.DEPTH_FUNC);
1198
- l ? n.getContext().enable(n.getContext().DEPTH_TEST) : n.getContext().disable(n.getContext().DEPTH_TEST), n.state.buffers.depth.setMask(c), n.setClearColor(new se(0, 0, 0), 0), n.setPixelRatio(window.devicePixelRatio), n.setRenderTarget(t), n.clear(), n.render(this.scene, this.perspectiveCam), n.setRenderTarget(d);
1198
+ l ? n.getContext().enable(n.getContext().DEPTH_TEST) : n.getContext().disable(n.getContext().DEPTH_TEST), n.state.buffers.depth.setMask(c), n.setClearColor(new se(0, 0, 0), 0), n.pixelRatio !== window.devicePixelRatio && n.xr.isPresenting === !1 && n.setPixelRatio(window.devicePixelRatio), n.setRenderTarget(t), n.clear(), n.render(this.scene, this.perspectiveCam), n.setRenderTarget(d);
1199
1199
  const m = n.state.buffers.depth;
1200
1200
  m.setTest(p), m.setMask(g), m.setFunc(b);
1201
1201
  }
@@ -1290,7 +1290,7 @@ function QC(s, e, t) {
1290
1290
  const l = new y();
1291
1291
  l.set(r.x / n.x, r.y / n.y, r.z / n.z);
1292
1292
  const c = Math.min(l.x, l.y, l.z), h = t?.scale !== !1;
1293
- if (h && rc(s, $e(s).multiplyScalar(c)), t?.position !== !1) {
1293
+ if (h && rc(s, We(s).multiplyScalar(c)), t?.position !== !1) {
1294
1294
  const d = new y();
1295
1295
  i.getCenter(d), d.y = i.min.y;
1296
1296
  const f = new y();
@@ -1330,7 +1330,7 @@ function Xb(s, e, t, i) {
1330
1330
  }
1331
1331
  let Kc = !1;
1332
1332
  yC((...s) => {
1333
- D() && he.Current?.isInXR && (ea(!0), Qb("error", ...s));
1333
+ L() && he.Current?.isInXR && (ea(!0), Qb("error", ...s));
1334
1334
  });
1335
1335
  function ea(s) {
1336
1336
  if (s) {
@@ -1589,7 +1589,7 @@ function Xd(s) {
1589
1589
  Be(s, Ni.Error);
1590
1590
  }
1591
1591
  let yp, rf;
1592
- function D() {
1592
+ function L() {
1593
1593
  if (e1) return !1;
1594
1594
  if (yp !== void 0) return yp;
1595
1595
  if (rf !== void 0) return rf;
@@ -1763,11 +1763,11 @@ go('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"]
1763
1763
  go('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');
1764
1764
  go('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');
1765
1765
  go('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
1766
- go('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.8.9";');
1766
+ go('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.9.0-alpha";');
1767
1767
  go('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
1768
- go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Sep 08 2025 11:19:54 GMT+0000 (Coordinated Universal Time)";');
1768
+ go('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Sep 08 2025 15:02:56 GMT+0000 (Coordinated Universal Time)";');
1769
1769
  go('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
1770
- const An = "4.8.9", Tm = "undefined", Jb = "Mon Sep 08 2025 11:19:54 GMT+0000 (Coordinated Universal Time)";
1770
+ const An = "4.9.0-alpha", Tm = "undefined", Jb = "Mon Sep 08 2025 15:02:56 GMT+0000 (Coordinated Universal Time)";
1771
1771
  Zb && console.log(`Engine version: ${An} (generator: ${Tm})
1772
1772
  Project built at ${Jb}`);
1773
1773
  const Pl = NEEDLE_PUBLIC_KEY, lo = "needle_isActiveInHierarchy", Nr = "builtin_components", Ih = "needle_editor_guid";
@@ -2665,7 +2665,7 @@ class _1 {
2665
2665
  }
2666
2666
  }
2667
2667
  }
2668
- const Kn = w("debugwebxr"), Jc = w("debugcustomgesture"), b1 = "https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles", v1 = "generic-trigger", w1 = new U().setFromEuler(new Tt(ys.degToRad(0), ys.degToRad(-90), ys.degToRad(-90))), x1 = new y(0.04, -0.04, 0);
2668
+ const Kn = w("debugwebxr"), Jc = w("debugcustomgesture"), b1 = "https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles", v1 = "generic-trigger", w1 = new U().setFromEuler(new Tt(gs.degToRad(0), gs.degToRad(-90), gs.degToRad(-90))), x1 = new y(0.04, -0.04, 0);
2669
2669
  class o0 {
2670
2670
  /** the Needle XR Session */
2671
2671
  xr;
@@ -2961,7 +2961,7 @@ Pinch: ${this.getGesture("pinch")?.value.toFixed(3)}`), n += `
2961
2961
  z.DrawLabel(t, n, 6e-3);
2962
2962
  }
2963
2963
  onUpdateFrame(e) {
2964
- if (this._handJointPoses.clear(), this._hand_wristDotUp = void 0, !this.xr.referenceSpace) {
2964
+ if (this._handJointPoses.clear(), this._hand_wristDotUp = void 0, !this.xr.referenceSpace || !this.inputSource.gamepad?.connected) {
2965
2965
  this._isTracking = !1;
2966
2966
  return;
2967
2967
  }
@@ -3023,6 +3023,18 @@ Pinch: ${this.getGesture("pinch")?.value.toFixed(3)}`), n += `
3023
3023
  break;
3024
3024
  case "primary":
3025
3025
  return this.hand ? this.getGesture("pinch") : this.toNeedleGamepadButton(0, e);
3026
+ case "xr-standard-trigger":
3027
+ if (this.inputSource.gamepad)
3028
+ return this.toNeedleGamepadButton(0, e);
3029
+ break;
3030
+ case "xr-standard-squeeze":
3031
+ if (this.inputSource.gamepad)
3032
+ return this.toNeedleGamepadButton(1, e);
3033
+ break;
3034
+ case "xr-standard-thumbstick":
3035
+ if (this.inputSource.gamepad)
3036
+ return this.toNeedleGamepadButton(3, e);
3037
+ break;
3026
3038
  }
3027
3039
  if (this._buttonMap.has(e))
3028
3040
  return this.toNeedleGamepadButton(this._buttonMap.get(e), e);
@@ -3073,19 +3085,18 @@ Pinch: ${this.getGesture("pinch")?.value.toFixed(3)}`), n += `
3073
3085
  */
3074
3086
  getStick(e) {
3075
3087
  if (!this._layout) return { x: 0, y: 0, z: 0 };
3076
- if (e === "primary") {
3077
- const i = this.inputSource.gamepad?.axes[0] || 0, n = this.inputSource.gamepad?.axes[1] || 0, o = this.inputSource.gamepad?.buttons[3]?.value || 0;
3078
- return { x: i, y: n, z: o };
3079
- }
3088
+ if (this.isHand)
3089
+ return { x: 0, y: 0, z: 0 };
3090
+ e === "primary" && this._layout.components["xr-standard-thumbstick"] && (e = "xr-standard-thumbstick");
3080
3091
  const t = this._layout?.components[e];
3081
3092
  if (t?.gamepadIndices)
3082
3093
  switch (t.type) {
3083
3094
  case "thumbstick":
3084
3095
  if (this.inputSource.gamepad) {
3085
3096
  const i = t.gamepadIndices.xAxis, n = t.gamepadIndices.yAxis;
3086
- let o = this.inputSource.gamepad?.axes[i], r = this.inputSource.gamepad?.axes[n];
3097
+ let o = this.inputSource.gamepad.axes[i] || 0, r = this.inputSource.gamepad.axes[n] || 0;
3087
3098
  o *= -1, r *= -1;
3088
- const a = t.gamepadIndices.button, l = this.inputSource.gamepad?.buttons[a]?.value;
3099
+ const a = t.gamepadIndices.button, l = this.inputSource.gamepad?.buttons[a]?.value || 0;
3089
3100
  return { x: o, y: r, z: l };
3090
3101
  }
3091
3102
  }
@@ -3268,7 +3279,7 @@ let od = !1;
3268
3279
  const Xr = [];
3269
3280
  function yr() {
3270
3281
  if (od) return;
3271
- D() && console.debug("User interaction registered: audio can now be played"), od = !0;
3282
+ L() && console.debug("User interaction registered: audio can now be played"), od = !0;
3272
3283
  const s = [...Xr];
3273
3284
  Xr.length = 0, s.forEach((e) => e());
3274
3285
  }
@@ -3352,7 +3363,7 @@ class Fn extends EventTarget {
3352
3363
  }
3353
3364
  const ia = /* @__PURE__ */ new Map(), Qr = /* @__PURE__ */ new Map();
3354
3365
  let My = 0;
3355
- function Rs(s, e, t) {
3366
+ function Ms(s, e, t) {
3356
3367
  if (ia.has(e) || ia.set(e, new Array()), ia.get(e).push({
3357
3368
  method: s,
3358
3369
  options: { once: !1, ...t }
@@ -3866,7 +3877,7 @@ class E1 {
3866
3877
  console.debug(`⊡ Connecting to networking backend on
3867
3878
  ` + Ri);
3868
3879
  const o = await import("./vendor-Msb9AgYE.js").then((c) => c.index), r = o.default?.WebsocketBuilder ?? o.WebsocketBuilder, a = o.default?.ExponentialBackoff ?? o.ExponentialBackoff, l = new r(Ri).withMaxRetries(10).withBackoff(new a(2e3, 4)).onOpen(() => {
3869
- this._connectingToWebsocketPromise = null, this._ws = l, this.connected = !0, D() || ri ? console.log(`⊞ Connected to networking backend
3880
+ this._connectingToWebsocketPromise = null, this._ws = l, this.connected = !0, L() || ri ? console.log(`⊞ Connected to networking backend
3870
3881
  ` + Ri) : console.debug("⊞ Connected to networking backend", Ri), n(!0), this.onSendQueued(xn.OnConnection);
3871
3882
  }).onClose((c) => {
3872
3883
  this._connectingToWebsocketPromise = null, this.connected = !1, this._isInRoom = !1, n(!1);
@@ -3896,7 +3907,7 @@ class E1 {
3896
3907
  else this.handleIncomingStringMessage(n);
3897
3908
  return;
3898
3909
  } catch (n) {
3899
- ri && i === "pong" ? console.log("<<", i) : D() && console.error("Failed to parse message", n);
3910
+ ri && i === "pong" ? console.log("<<", i) : L() && console.error("Failed to parse message", n);
3900
3911
  }
3901
3912
  }
3902
3913
  async handleIncomingBinaryMessage(e) {
@@ -3926,7 +3937,7 @@ class E1 {
3926
3937
  if (ri && console.log(e), e) {
3927
3938
  this._isInRoom = !0;
3928
3939
  const r = e;
3929
- this._currentRoomName = r.room, this._currentRoomViewId = r.viewId, this._currentRoomAllowEditing = r.allowEditing ?? !0, this._currentInRoom.length = 0, this._currentInRoom.push(...r.inRoom), (ih || D()) && console.debug("Joined Needle Engine Room: " + r.room);
3940
+ this._currentRoomName = r.room, this._currentRoomViewId = r.viewId, this._currentRoomAllowEditing = r.allowEditing ?? !0, this._currentInRoom.length = 0, this._currentInRoom.push(...r.inRoom), (ih || L()) && console.debug("Joined Needle Engine Room: " + r.room);
3930
3941
  const a = new URL(window.location.href);
3931
3942
  a.searchParams.has("room") && a.searchParams.delete("room"), a.searchParams.set("view", this._currentRoomViewId), console.debug(`Room view id: ${this._currentRoomViewId}
3932
3943
  ${a.href}`);
@@ -3935,7 +3946,7 @@ ${a.href}`);
3935
3946
  break;
3936
3947
  case "left-room":
3937
3948
  const n = e;
3938
- n.room === this.currentRoomName && (this._isInRoom = !1, this._currentRoomName = null, this._currentRoomAllowEditing = !0, this._currentInRoom.length = 0, (ih || D()) && console.debug("Left Needle Engine Room: " + n.room));
3949
+ n.room === this.currentRoomName && (this._isInRoom = !1, this._currentRoomName = null, this._currentRoomAllowEditing = !0, this._currentInRoom.length = 0, (ih || L()) && console.debug("Left Needle Engine Room: " + n.room));
3939
3950
  break;
3940
3951
  case "user-joined-room":
3941
3952
  if (e.data) {
@@ -4294,7 +4305,7 @@ function L1(s) {
4294
4305
  let cf = !1, hf = null;
4295
4306
  function D1(s, e) {
4296
4307
  if (hf === null) {
4297
- const t = "https://cdn.needle.tools/static/models/shaderball.glb", i = new Os(), n = xm(null);
4308
+ const t = "https://cdn.needle.tools/static/models/shaderball.glb", i = new Ps(), n = xm(null);
4298
4309
  i.setDRACOLoader(n.dracoLoader), i.setKTX2Loader(n.ktx2Loader), cf = !0, hf = i.loadAsync(t).then((o) => {
4299
4310
  const r = o.scene;
4300
4311
  return r.position.y -= 0.5, r;
@@ -4351,7 +4362,7 @@ class wa {
4351
4362
  return this._active ? this._active.handoff() : null;
4352
4363
  }
4353
4364
  static async stop() {
4354
- this._requestInFlight = !1, this._active && (await this._active.end(), await ks(100)), this._active = null;
4365
+ this._requestInFlight = !1, this._active && (await this._active.end(), await Os(100)), this._active = null;
4355
4366
  }
4356
4367
  _session;
4357
4368
  _mode;
@@ -4388,7 +4399,7 @@ class wa {
4388
4399
  };
4389
4400
  /** can be used to prepare the user or fade to black */
4390
4401
  async onBeforeHandoff() {
4391
- await ks(1e3), this._scene.clear();
4402
+ await Os(1e3), this._scene.clear();
4392
4403
  }
4393
4404
  _objects = [];
4394
4405
  setupScene() {
@@ -4444,7 +4455,7 @@ var ac;
4444
4455
  }
4445
4456
  s.unregisterExporter = n;
4446
4457
  })(ac || (ac = {}));
4447
- const He = w("debugwebxr"), jy = w("stats");
4458
+ const $e = w("debugwebxr"), jy = w("stats");
4448
4459
  let df = 0;
4449
4460
  function j1(s) {
4450
4461
  let e = null;
@@ -4476,7 +4487,7 @@ async function B1() {
4476
4487
  return;
4477
4488
  }
4478
4489
  navigator.xr?.addEventListener("sessiongranted", async () => {
4479
- ea(!0), console.log("Received Session Granted..."), await ks(100);
4490
+ ea(!0), console.log("Received Session Granted..."), await Os(100);
4480
4491
  const s = sessionStorage.getItem("needle_xr_session_mode"), e = sessionStorage.getItem("needle_xr_session_init") ?? null, t = e ? JSON.parse(e) : null;
4481
4492
  let i = null;
4482
4493
  if (h0() && (await wa.start(s || "immersive-vr", t || K.getDefaultSessionInit("immersive-vr")), await U1(), i = await wa.handoff()), i)
@@ -4515,7 +4526,7 @@ function U1() {
4515
4526
  }, 100);
4516
4527
  });
4517
4528
  }
4518
- q.isDesktop() && D() && window.addEventListener("keydown", (s) => {
4529
+ q.isDesktop() && L() && window.addEventListener("keydown", (s) => {
4519
4530
  (s.key === "x" || s.key === "Escape") && K.active && K.stop();
4520
4531
  });
4521
4532
  function N1(s) {
@@ -4581,7 +4592,7 @@ class K {
4581
4592
  * @returns true if the browser supports the given XRSessionMode
4582
4593
  */
4583
4594
  static isSessionSupported(e) {
4584
- return this.xrSystem?.isSessionSupported(e).catch((t) => (He && console.error(t), !1)) ?? Promise.resolve(!1);
4595
+ return this.xrSystem?.isSessionSupported(e).catch((t) => ($e && console.error(t), !1)) ?? Promise.resolve(!1);
4585
4596
  }
4586
4597
  static _currentSessionRequest;
4587
4598
  static _activeSession;
@@ -4688,10 +4699,10 @@ class K {
4688
4699
  else
4689
4700
  return ac.exportAndOpen(), null;
4690
4701
  } else e == "ar" && (e = "immersive-ar");
4691
- if (D() && w("debugxrpreroom"))
4702
+ if (L() && w("debugxrpreroom"))
4692
4703
  return console.warn("Debug: Starting temporary XR session"), await wa.start(e, t || K.getDefaultSessionInit(e)), null;
4693
4704
  if (this._currentSessionRequest)
4694
- return console.warn("A XRSession is already being requested"), (He || D()) && ge("A XRSession is already being requested"), this._currentSessionRequest.then(() => this._activeSession);
4705
+ return console.warn("A XRSession is already being requested"), ($e || L()) && ge("A XRSession is already being requested"), this._currentSessionRequest.then(() => this._activeSession);
4695
4706
  if (this._activeSession)
4696
4707
  return console.error("A XRSession is already running"), this._activeSession;
4697
4708
  if (i || (i = N.Current), i || (i = he.All[0]), !i) throw new Error("No Needle Engine Context found");
@@ -4725,12 +4736,12 @@ class K {
4725
4736
  }
4726
4737
  t.optionalFeatures ??= [], t.requiredFeatures ??= [], await wa.stop();
4727
4738
  const n = e == "immersive-ar" ? i.scripts_immersive_ar : i.scripts_immersive_vr;
4728
- He ? console.log(`%cRequesting ${e} session`, "font-weight:bold;", t, n) : console.log(`%cRequesting ${e} session`, "font-weight:bold;");
4739
+ $e ? console.log(`%cRequesting ${e} session`, "font-weight:bold;", t, n) : console.log(`%cRequesting ${e} session`, "font-weight:bold;");
4729
4740
  for (const a of n)
4730
4741
  a.onBeforeXR && a.onBeforeXR(e, t);
4731
4742
  for (const a of this._sessionRequestStartListeners)
4732
4743
  a({ mode: e, init: t });
4733
- He && Be("Requesting " + e + " session (" + Date.now() + ")"), this._currentSessionRequest = navigator.xr?.requestSession(e, t), this._currentSessionRequestMode = e;
4744
+ $e && Be("Requesting " + e + " session (" + Date.now() + ")"), this._currentSessionRequest = navigator?.xr?.requestSession(e, t), this._currentSessionRequestMode = e;
4734
4745
  const o = await this._currentSessionRequest?.catch((a) => {
4735
4746
  console.error(a, "Code: " + a.code), a.code === 9 && ge("Make sure your device has the required permissions (e.g. camera access)"), console.log("If the specified XR configuration is not supported (e.g. entering AR doesnt work) - make sure you access the website on a secure connection (HTTPS) and your device has the required permissions (e.g. camera access)"), location.protocol === "http:" && ge("XR requires a secure connection (HTTPS)");
4736
4747
  });
@@ -4748,18 +4759,18 @@ class K {
4748
4759
  controller_added: this._controllerAddedListeners,
4749
4760
  controller_removed: this._controllerRemovedListeners,
4750
4761
  init: i
4751
- }), t.addEventListener("end", this.onEnd), He ? console.log(`%cStarted ${e} session`, "font-weight:bold;", o) : console.log(`%cStarted ${e} session`, "font-weight:bold;"), this._activeSession;
4762
+ }), t.addEventListener("end", this.onEnd), $e ? console.log(`%cStarted ${e} session`, "font-weight:bold;", o) : console.log(`%cStarted ${e} session`, "font-weight:bold;"), this._activeSession;
4752
4763
  }
4753
4764
  static $_stop_request = Symbol();
4754
4765
  /** stops the active XR session */
4755
4766
  static stop() {
4756
4767
  const e = this._activeSession;
4757
- e && (e[this.$_stop_request] === void 0 ? (He && console.log("[NeedleXRSession] Stopping XR Session... (new)"), e[this.$_stop_request] = setTimeout(() => {
4768
+ e && (e[this.$_stop_request] === void 0 ? ($e && console.log("[NeedleXRSession] Stopping XR Session... (new)"), e[this.$_stop_request] = setTimeout(() => {
4758
4769
  e.end();
4759
- })) : He && console.warn("[NeedleXRSession] XR Session stop already requested"));
4770
+ })) : $e && console.warn("[NeedleXRSession] XR Session stop already requested"));
4760
4771
  }
4761
4772
  static onEnd = () => {
4762
- He && console.log("XR Session ended"), this._activeSession = null;
4773
+ $e && console.log("XR Session ended"), this._activeSession = null;
4763
4774
  };
4764
4775
  /** The needle engine context this session was started from */
4765
4776
  context;
@@ -4831,7 +4842,7 @@ class K {
4831
4842
  }
4832
4843
  /** Returns true if running in pass through mode in immersive AR (e.g. user is wearing a headset while in AR) */
4833
4844
  get isPassThrough() {
4834
- return !!(this.environmentBlendMode !== "opaque" && this.interactionMode === "world-space" || this.mode === "immersive-ar" && this.environmentBlendMode !== "opaque" && this.controllers.some((e) => e.inputSource.targetRayMode === "tracked-pointer") || D() && q.isDesktop() && this.mode === "immersive-ar");
4845
+ return !!(this.environmentBlendMode !== "opaque" && this.interactionMode === "world-space" || this.mode === "immersive-ar" && this.environmentBlendMode !== "opaque" && this.controllers.some((e) => e.inputSource.targetRayMode === "tracked-pointer") || L() && q.isDesktop() && this.mode === "immersive-ar");
4835
4846
  }
4836
4847
  get isAR() {
4837
4848
  return this.mode === "immersive-ar";
@@ -4928,7 +4939,7 @@ class K {
4928
4939
  const i = this._rigs.indexOf(t);
4929
4940
  i >= 0 && this._rigs.splice(i, 1), this._rigs.unshift(t);
4930
4941
  }
4931
- He && (e === t ? console.log("Updated Active XR Rig:", t, "prev:", e) : console.log("Updated Active XRRig:", t, " (the same as before)"));
4942
+ $e && (e === t ? console.log("Updated Active XR Rig:", t, "prev:", e) : console.log("Updated Active XRRig:", t, " (the same as before)"));
4932
4943
  }
4933
4944
  _rigs = [];
4934
4945
  _viewerHitTestSource = null;
@@ -4995,7 +5006,7 @@ class K {
4995
5006
  */
4996
5007
  _mainCamera = null;
4997
5008
  constructor(e, t, i, n) {
4998
- F1(e, n.init), this.session = t, this.mode = e, this.context = i, (He || w("console")) && ea(!0), this._xr_scripts = [...n.scripts], this._xr_update_scripts = this._xr_scripts.filter((o) => typeof o.onUpdateXR == "function"), this._controllerAdded = n.controller_added, this._controllerRemoved = n.controller_removed, Rs(this.onBefore, xe.LateUpdate), this.context.pre_render_callbacks.push(this.onBeforeRender), this.context.post_render_callbacks.push(this.onAfterRender), (n.init.optionalFeatures?.includes("hit-test") || n.init.requiredFeatures?.includes("hit-test")) && t.requestReferenceSpace("viewer").then((o) => t.requestHitTestSource?.call(t, { space: o })?.then((r) => this._viewerHitTestSource = r).catch((r) => console.error(r))).catch((o) => console.error(o)), this.context.mainCamera && (this._originalCameraWorldPosition = Z(this.context.mainCamera, new y()), this._originalCameraWorldRotation = be(this.context.mainCamera, new U()), this._originalCameraWorldScale = $e(this.context.mainCamera, new y()), this._originalCameraParent = this.context.mainCamera.parent), this._defaultRig = new _1(), this.context.scene.add(this._defaultRig.gameObject), this.addRig(this._defaultRig);
5009
+ F1(e, n.init), this.session = t, this.mode = e, this.context = i, ($e || w("console")) && ea(!0), this._xr_scripts = [...n.scripts], this._xr_update_scripts = this._xr_scripts.filter((o) => typeof o.onUpdateXR == "function"), this._controllerAdded = n.controller_added, this._controllerRemoved = n.controller_removed, Ms(this.onBefore, xe.LateUpdate), this.context.pre_render_callbacks.push(this.onBeforeRender), this.context.post_render_callbacks.push(this.onAfterRender), (n.init.optionalFeatures?.includes("hit-test") || n.init.requiredFeatures?.includes("hit-test")) && t.requestReferenceSpace("viewer").then((o) => t.requestHitTestSource?.call(t, { space: o })?.then((r) => this._viewerHitTestSource = r).catch((r) => console.error(r))).catch((o) => console.error(o)), this.context.mainCamera && (this._originalCameraWorldPosition = Z(this.context.mainCamera, new y()), this._originalCameraWorldRotation = be(this.context.mainCamera, new U()), this._originalCameraWorldScale = We(this.context.mainCamera, new y()), this._originalCameraParent = this.context.mainCamera.parent), this._defaultRig = new _1(), this.context.scene.add(this._defaultRig.gameObject), this.addRig(this._defaultRig);
4999
5010
  for (let o = 0; o < t.inputSources.length; o++) {
5000
5011
  const r = t.inputSources[o];
5001
5012
  if (!r.handedness) {
@@ -5013,7 +5024,7 @@ class K {
5013
5024
  for (const r of o.added)
5014
5025
  this.onInputSourceAdded(r);
5015
5026
  }
5016
- ), this.context.xr = this, this.context.renderer.xr.setSession(this.session).then(this.onRendererSessionSet), "controllerAutoUpdate" in this.context.renderer.xr ? (console.debug("Disabling three.js controllerAutoUpdate"), this.context.renderer.xr.controllerAutoUpdate = !1) : He && console.warn("controllerAutoUpdate is not available in three.js - cannot disable it");
5027
+ ), this.context.xr = this, this.context.renderer.xr.setSession(this.session).then(this.onRendererSessionSet), "controllerAutoUpdate" in this.context.renderer.xr ? (console.debug("Disabling three.js controllerAutoUpdate"), this.context.renderer.xr.controllerAutoUpdate = !1) : $e && console.warn("controllerAutoUpdate is not available in three.js - cannot disable it");
5017
5028
  }
5018
5029
  /** called when renderer.setSession is fulfilled */
5019
5030
  onRendererSessionSet = () => {
@@ -5040,26 +5051,29 @@ class K {
5040
5051
  };
5041
5052
  /** Disconnects the controller, invokes events and notifies previou controller (if any) */
5042
5053
  disconnectInputSource(e) {
5043
- const t = (i, n, o) => {
5044
- if (i.inputSource === e) {
5045
- He && console.log("Disconnecting controller", i.index), this.controllers.splice(o, 1), this.invokeControllerEvent(i, this._controllerRemoved, "removed");
5046
- const r = {
5054
+ const t = (o, r) => {
5055
+ if (o.inputSource === e) {
5056
+ $e && console.log("Disconnecting controller", o.index);
5057
+ const a = r.indexOf(o);
5058
+ a >= 0 && r.splice(a, 1), this.invokeControllerEvent(o, this._controllerRemoved, "removed");
5059
+ const l = {
5047
5060
  xr: this,
5048
- controller: i,
5061
+ controller: o,
5049
5062
  change: "removed"
5050
5063
  };
5051
- for (const a of this._xr_scripts)
5052
- a.onXRControllerRemoved && a.onXRControllerRemoved(r);
5053
- i.onDisconnected();
5064
+ for (const c of this._xr_scripts)
5065
+ c.onXRControllerRemoved && c.onXRControllerRemoved(l);
5066
+ o.onDisconnected();
5054
5067
  }
5055
- };
5056
- for (let i = this.controllers.length - 1; i >= 0; i--) {
5057
- const n = this.controllers[i];
5058
- t(n, this.controllers, i);
5068
+ }, i = [...this.controllers];
5069
+ for (let o = i.length - 1; o >= 0; o--) {
5070
+ const r = i[o];
5071
+ t(r, this.controllers);
5059
5072
  }
5060
- for (let i = this._newControllers.length - 1; i >= 0; i--) {
5061
- const n = this._newControllers[i];
5062
- t(n, this._newControllers, i);
5073
+ const n = [...this._newControllers];
5074
+ for (let o = n.length - 1; o >= 0; o--) {
5075
+ const r = n[o];
5076
+ t(r, this._newControllers);
5063
5077
  }
5064
5078
  }
5065
5079
  /** End the XR Session */
@@ -5082,7 +5096,7 @@ class K {
5082
5096
  const n = [...this.controllers];
5083
5097
  for (let o = 0; o < n.length; o++)
5084
5098
  this.disconnectInputSource(n[o].inputSource);
5085
- this._newControllers.length = 0, this.controllers.length = 0;
5099
+ this.controllers.length = 0, this._newControllers.length = 0;
5086
5100
  for (const o of this._xr_scripts)
5087
5101
  o?.onLeaveXR?.({ xr: this });
5088
5102
  this.sync?.onExitXR(this), this.context.mainCamera && (this._originalCameraParent?.add(this.context.mainCamera), this._originalCameraWorldPosition && ft(this.context.mainCamera, this._originalCameraWorldPosition), this._originalCameraWorldRotation && cn(this.context.mainCamera, this._originalCameraWorldRotation), this._originalCameraWorldScale && rc(this.context.mainCamera, this._originalCameraWorldScale)), this.context.requestSizeUpdate(), this._defaultRig.gameObject.removeFromParent(), ea(!1);
@@ -5092,7 +5106,7 @@ class K {
5092
5106
  onBefore = (e) => {
5093
5107
  const t = e.xrFrame;
5094
5108
  if (!t) return;
5095
- this.context.xr = this, this.context.mainCameraComponent && this.context.mainCameraComponent !== this._mainCamera && (this._mainCamera = this.context.mainCameraComponent), this.rig?.isActive == !1 && (He && console.warn("Latest rig is not active - trying to activate a different rig", this.rig), this.updateActiveXRRig()), this.rig && this._mainCamera?.gameObject && this._mainCamera?.gameObject?.parent !== this.rig.gameObject && this.rig.gameObject.add(this._mainCamera?.gameObject), this.internalUpdateState(), this.applyCustomForward();
5109
+ this.context.xr = this, this.context.mainCameraComponent && this.context.mainCameraComponent !== this._mainCamera && (this._mainCamera = this.context.mainCameraComponent), this.rig?.isActive == !1 && ($e && console.warn("Latest rig is not active - trying to activate a different rig", this.rig), this.updateActiveXRRig()), this.rig && this._mainCamera?.gameObject && this._mainCamera?.gameObject?.parent !== this.rig.gameObject && this.rig.gameObject.add(this._mainCamera?.gameObject), this.internalUpdateState(), this.applyCustomForward();
5096
5110
  const i = { xr: this };
5097
5111
  if (this._didStart) {
5098
5112
  if (this.context.new_scripts_xr.length > 0) {
@@ -5131,7 +5145,7 @@ class K {
5131
5145
  for (const o of K._xrStartListeners)
5132
5146
  o(i);
5133
5147
  const n = [...this._xr_scripts];
5134
- He && console.log("NeedleXRSession start, handle scripts:", n);
5148
+ $e && console.log("NeedleXRSession start, handle scripts:", n);
5135
5149
  for (const o of n) {
5136
5150
  if (o.destroyed) {
5137
5151
  this._script_to_remove.push(o);
@@ -5168,7 +5182,7 @@ class K {
5168
5182
  }
5169
5183
  this.controllers.sort((o, r) => o.index - r.index);
5170
5184
  }
5171
- He && this.context.time.frame % 30 === 0 && this.controllers.length <= 0 && this.session.inputSources.length > 0 && (ea(!0), console.error("XRControllers are not added but inputSources are present"));
5185
+ $e && this.context.time.frame % 30 === 0 && this.controllers.length <= 0 && this.session.inputSources.length > 0 && (ea(!0), console.error("XRControllers are not added but inputSources are present"));
5172
5186
  for (const n of this._xr_update_scripts) {
5173
5187
  if (n.destroyed === !0) {
5174
5188
  this._script_to_remove.push(n);
@@ -5189,16 +5203,16 @@ class K {
5189
5203
  this.sync?.onUpdate(this), this.onRenderDebug();
5190
5204
  };
5191
5205
  onRenderDebug() {
5192
- if (He)
5206
+ if ($e)
5193
5207
  for (const e of this.controllers)
5194
5208
  e.onRenderDebug();
5195
- if ((He || jy) && this.rig && (df++, df >= 20)) {
5209
+ if (($e || jy) && this.rig && (df++, df >= 20)) {
5196
5210
  const e = this.rig.gameObject.worldPosition, t = this.rig.gameObject.worldForward;
5197
5211
  e.add(t.multiplyScalar(1.5));
5198
5212
  const i = this.rig.gameObject.worldUp;
5199
5213
  e.add(i.multiplyScalar(2.5));
5200
5214
  let n = "";
5201
- if (n += `${this.context.time.smoothedFps.toFixed(0)} FPS`, n += `, calls: ${this.context.renderer.info.render.calls}, tris: ${this.context.renderer.info.render.triangles.toLocaleString()}`, He || jy)
5215
+ if (n += `${this.context.time.smoothedFps.toFixed(0)} FPS`, n += `, calls: ${this.context.renderer.info.render.calls}, tris: ${this.context.renderer.info.render.triangles.toLocaleString()}`, $e || jy)
5202
5216
  for (const o of this.controllers)
5203
5217
  n += `
5204
5218
  ${o.hand ? "hand" : "ctrl"} ${o.inputSource.handedness}[${o.index}] con:${o.connected} tr:${o.isTracking} hts:${o.hasHitTestSource ? "yes" : "no"}`;
@@ -5220,7 +5234,7 @@ ${o.hand ? "hand" : "ctrl"} ${o.inputSource.handedness}[${o.index}] con:${o.conn
5220
5234
  };
5221
5235
  /** register a new XR script if it hasnt added yet */
5222
5236
  addScript(e) {
5223
- return this._xr_scripts.includes(e) ? !1 : (He && console.log("Register new XRScript", e), this._xr_scripts.push(e), typeof e.onUpdateXR == "function" && this._xr_update_scripts.push(e), !0);
5237
+ return this._xr_scripts.includes(e) ? !1 : ($e && console.log("Register new XRScript", e), this._xr_scripts.push(e), typeof e.onUpdateXR == "function" && this._xr_update_scripts.push(e), !0);
5224
5238
  }
5225
5239
  /** mark a script as inactive and invokes callbacks */
5226
5240
  markInactive(e) {
@@ -5242,7 +5256,7 @@ ${o.hand ? "hand" : "ctrl"} ${o.inputSource.handedness}[${o.index}] con:${o.conn
5242
5256
  }
5243
5257
  _script_to_remove = [];
5244
5258
  removeScript(e, t = !0) {
5245
- He && console.log("Remove XRScript", e);
5259
+ $e && console.log("Remove XRScript", e);
5246
5260
  const i = this._xr_scripts.indexOf(e);
5247
5261
  i >= 0 && this._xr_scripts.splice(i, 1);
5248
5262
  const n = this._xr_update_scripts.indexOf(e);
@@ -5301,14 +5315,14 @@ ${o.hand ? "hand" : "ctrl"} ${o.inputSource.handedness}[${o.index}] con:${o.conn
5301
5315
  this._camera = this.context.mainCamera, this._camera.parent !== this._cameraRenderParent && (this._previousCameraParent = this._camera.parent, this._previousCameraParent?.add(this._cameraRenderParent)), this._cameraRenderParent.name = "XR Camera Render Parent", this._cameraRenderParent.add(this._camera);
5302
5316
  let e = 0.02;
5303
5317
  if (this.rig) {
5304
- const t = $e(this.rig.gameObject);
5318
+ const t = We(this.rig.gameObject);
5305
5319
  e *= t.x;
5306
5320
  }
5307
- this._camera instanceof me && this._camera.near > e && (this.originalCameraNearPlane = this._camera.near, this._camera.near = e);
5321
+ this._camera instanceof me && Math.abs(this._camera.near - e) > 1e-4 && (this.originalCameraNearPlane = this._camera.near, this._camera.near = e, $e && console.debug(`Setting camera near plane to ${e} (was ${this.originalCameraNearPlane}) to account for XR rendering scale`));
5308
5322
  }
5309
5323
  }
5310
5324
  revertCustomForward() {
5311
- this._camera && this._previousCameraParent && this._previousCameraParent.add(this._camera), this._previousCameraParent = null, this._camera instanceof me && this.originalCameraNearPlane != null && (this._camera.near = this.originalCameraNearPlane);
5325
+ this._camera && this._previousCameraParent && this._previousCameraParent.add(this._camera), this._previousCameraParent = null, this._camera instanceof me && this.originalCameraNearPlane != null && (this._camera.near = this.originalCameraNearPlane, this.originalCameraNearPlane = void 0);
5312
5326
  }
5313
5327
  _viewerPose;
5314
5328
  _transformOrientation = new U();
@@ -5929,8 +5943,8 @@ var rd;
5929
5943
  if (!E.staticGenerator)
5930
5944
  a(), o && (E.staticGenerator = new o(_), E.staticGenerator.applyWorldTransforms = !1, E.staticGeometry = E.staticGenerator.generate(), k.boundsTree = r?.call(E.staticGeometry), E.staticGeometryLastUpdate = performance.now() + Math.random() * 200, E.bvhNeedsUpdate = !0);
5931
5945
  else if (k.boundsTree && (E.autoUpdateMeshBvhInterval !== void 0 && E.autoUpdateMeshBvhInterval >= 0 || B === !0)) {
5932
- const L = performance.now(), W = L - E.staticGeometryLastUpdate, X = E.autoUpdateMeshBvhInterval ?? 100;
5933
- (B || W > X) && (Wt && console.warn(`Physics: updating skinned mesh bvh for ${_.name} after ${W.toFixed(2)}ms`), E.bvhNeedsUpdate = !1, E.staticGeometryLastUpdate = L, E.staticGenerator?.generate(E.staticGeometry), k.boundsTree.refit());
5946
+ const D = performance.now(), W = D - E.staticGeometryLastUpdate, X = E.autoUpdateMeshBvhInterval ?? 100;
5947
+ (B || W > X) && (Wt && console.warn(`Physics: updating skinned mesh bvh for ${_.name} after ${W.toFixed(2)}ms`), E.bvhNeedsUpdate = !1, E.staticGeometryLastUpdate = D, E.staticGenerator?.generate(E.staticGeometry), k.boundsTree.refit());
5934
5948
  }
5935
5949
  } else if (!k.boundsTree) {
5936
5950
  c || m();
@@ -5939,12 +5953,12 @@ var rd;
5939
5953
  if (k[f] === void 0) {
5940
5954
  let B = null;
5941
5955
  if (b.length > 0) {
5942
- const L = b.shift();
5943
- L && !L.running && (B = L);
5956
+ const D = b.shift();
5957
+ D && !D.running && (B = D);
5944
5958
  }
5945
5959
  if (!B && g.length < 3 && (B = new d(), g.push(B)), B != null && !B.running) {
5946
- const L = _.name;
5947
- Wt && console.log("<<<< worker start", L, B), k[f] = "queued", performance.mark("bvh.create.start");
5960
+ const D = _.name;
5961
+ Wt && console.log("<<<< worker start", D, B), k[f] = "queued", performance.mark("bvh.create.start");
5948
5962
  const W = k.clone();
5949
5963
  try {
5950
5964
  B.generate(W).then((X) => {
@@ -5952,7 +5966,7 @@ var rd;
5952
5966
  }).catch((X) => {
5953
5967
  k[f] = "failed - " + X?.message, k[p] = !1, Wt && console.error("Failed to generate mesh bvh on worker", X);
5954
5968
  }).finally(() => {
5955
- Wt && console.log(">>>>> worker done", L, { hasBoundsTre: k.boundsTree != null }), b.push(B), W.dispose(), performance.mark("bvh.create.end"), performance.measure("bvh.create (worker)", "bvh.create.start", "bvh.create.end");
5969
+ Wt && console.log(">>>>> worker done", D, { hasBoundsTre: k.boundsTree != null }), b.push(B), W.dispose(), performance.mark("bvh.create.end"), performance.measure("bvh.create (worker)", "bvh.create.start", "bvh.create.end");
5956
5970
  });
5957
5971
  } catch (X) {
5958
5972
  console.error("Failed to generate mesh bvh on worker", X);
@@ -5968,8 +5982,8 @@ var rd;
5968
5982
  a(), i && (_.acceleratedRaycast || (_.acceleratedRaycast = i.bind(_), Wt && console.debug(`Physics: bind acceleratedRaycast fn to "${_.name}"`)), _.raycast = _.acceleratedRaycast);
5969
5983
  else if (Wt && console.warn("No bounds tree found for mesh", _.name, { workerTask: k[f], hasAcceleratedRaycast: i != null }), O.allowSlowRaycastFallback === !1)
5970
5984
  return Wt && console.warn("Skipping raycast because no bounds tree is available and allowSlowRaycastFallback is false"), !1;
5971
- const L = E.firstHitOnly;
5972
- return E.firstHitOnly = !1, E.intersectObject(_, !1, x), E.firstHitOnly = L, _.raycast = B, !0;
5985
+ const D = E.firstHitOnly;
5986
+ return E.firstHitOnly = !1, E.intersectObject(_, !1, x), E.firstHitOnly = D, _.raycast = B, !0;
5973
5987
  } else if (v instanceof Fd) {
5974
5988
  const E = k.boundsTree;
5975
5989
  if (E) {
@@ -5989,7 +6003,7 @@ var rd;
5989
6003
  t || (t = !0, import("./vendor-Msb9AgYE.js").then((v) => v.index$1).then((v) => {
5990
6004
  i = v.acceleratedRaycast, n = v.MeshBVH, o = v.StaticGeometryGenerator, r = v.computeBoundsTree;
5991
6005
  }).catch((v) => {
5992
- (Wt || D()) && console.error("Failed to load BVH library...", v.message);
6006
+ (Wt || L()) && console.error("Failed to load BVH library...", v.message);
5993
6007
  }));
5994
6008
  }
5995
6009
  const l = new te();
@@ -5999,7 +6013,7 @@ var rd;
5999
6013
  c = !0, h = !0, Promise.resolve().then(() => sI).then((v) => {
6000
6014
  d = v.GenerateMeshBVHWorker;
6001
6015
  }).catch((v) => {
6002
- (Wt || D()) && console.warn("Failed to setup mesh bvh worker");
6016
+ (Wt || L()) && console.warn("Failed to setup mesh bvh worker");
6003
6017
  }).finally(() => {
6004
6018
  h = !1;
6005
6019
  });
@@ -6091,7 +6105,7 @@ function Re(s) {
6091
6105
  }
6092
6106
  if (typeof s == "object" && (s[p0] = !0), s instanceof yi)
6093
6107
  Re(s.environment), Re(s.background), Re(s.customDepthMaterial), Re(s.customDistanceMaterial);
6094
- else if (s instanceof _s)
6108
+ else if (s instanceof ys)
6095
6109
  Re(s.geometry), Re(s.material), Re(s.skeleton), Re(s.bindMatrix), Re(s.bindMatrixInverse), Re(s.customDepthMaterial), Re(s.customDistanceMaterial), s.geometry = {}, s.material = {}, s.visible = !1;
6096
6110
  else if (s instanceof H)
6097
6111
  Re(s.geometry), Re(s.material), Re(s.customDepthMaterial), Re(s.customDistanceMaterial), s.geometry = {}, s.material = {}, s.visible = !1;
@@ -6125,7 +6139,7 @@ function Ar(s) {
6125
6139
  s && ((Jo || u0() || Qd) && console.warn("🧨 FREE", s), s instanceof ImageBitmap ? s.close() : s instanceof rx ? s.data = null : s.dispose());
6126
6140
  }
6127
6141
  function K1(s) {
6128
- (s instanceof H || s instanceof _s) && (s.material = {}, s.geometry = {});
6142
+ (s instanceof H || s instanceof ys) && (s.material = {}, s.geometry = {});
6129
6143
  }
6130
6144
  const Z1 = /* @__PURE__ */ new Set();
6131
6145
  function m0(s, e, t = null, i) {
@@ -6266,7 +6280,7 @@ function cd(s) {
6266
6280
  try {
6267
6281
  const t = ke[e];
6268
6282
  if (t.isComponent !== !0) {
6269
- (D() || Sp) && console.error(`Registered script is not a Needle Engine component.
6283
+ (L() || Sp) && console.error(`Registered script is not a Needle Engine component.
6270
6284
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
6271
6285
  `, t), ke.splice(e, 1), e--;
6272
6286
  continue;
@@ -6279,13 +6293,13 @@ Did you add and remove a component in the same frame?`), ke.splice(e, 1), e--;
6279
6293
  }
6280
6294
  t.context = s, Hl(t.gameObject), zm(t, s);
6281
6295
  } catch (t) {
6282
- console.error(t), hs(ke[e], s), ke.splice(e, 1), e--;
6296
+ console.error(t), cs(ke[e], s), ke.splice(e, 1), e--;
6283
6297
  }
6284
6298
  for (let e = 0; e < ke.length; e++)
6285
6299
  try {
6286
6300
  const t = ke[e];
6287
6301
  if (t.destroyed) {
6288
- hs(ke[e], s), ke.splice(e, 1), e--;
6302
+ cs(ke[e], s), ke.splice(e, 1), e--;
6289
6303
  continue;
6290
6304
  }
6291
6305
  if (t.registering)
@@ -6296,7 +6310,7 @@ Did you add and remove a component in the same frame?`), ke.splice(e, 1), e--;
6296
6310
  }
6297
6311
  t.__internalAwake !== void 0 && (t.gameObject || console.error("Calling awake for a component without a GameObject", t, t.gameObject), Hl(t.gameObject), t.activeAndEnabled && sa(t.__internalAwake.bind(t)));
6298
6312
  } catch (t) {
6299
- console.error(t), hs(ke[e], s), ke.splice(e, 1), e--;
6313
+ console.error(t), cs(ke[e], s), ke.splice(e, 1), e--;
6300
6314
  }
6301
6315
  for (let e = 0; e < ke.length; e++)
6302
6316
  try {
@@ -6304,7 +6318,7 @@ Did you add and remove a component in the same frame?`), ke.splice(e, 1), e--;
6304
6318
  if (t.destroyed || t.enabled === !1 || (Hl(t.gameObject), t.activeAndEnabled === !1)) continue;
6305
6319
  t.__internalEnable !== void 0 && (t.enabled = !0, sa(t.__internalEnable.bind(t)));
6306
6320
  } catch (t) {
6307
- console.error(t), hs(ke[e], s), ke.splice(e, 1), e--;
6321
+ console.error(t), cs(ke[e], s), ke.splice(e, 1), e--;
6308
6322
  }
6309
6323
  for (let e = 0; e < ke.length; e++)
6310
6324
  try {
@@ -6312,7 +6326,7 @@ Did you add and remove a component in the same frame?`), ke.splice(e, 1), e--;
6312
6326
  if (t.destroyed || !t.gameObject) continue;
6313
6327
  s.new_script_start.push(t);
6314
6328
  } catch (t) {
6315
- console.error(t), hs(ke[e], s), ke.splice(e, 1), e--;
6329
+ console.error(t), cs(ke[e], s), ke.splice(e, 1), e--;
6316
6330
  }
6317
6331
  ke.length = 0;
6318
6332
  for (const e of s.new_scripts_post_setup_callbacks)
@@ -6321,7 +6335,7 @@ Did you add and remove a component in the same frame?`), ke.splice(e, 1), e--;
6321
6335
  }
6322
6336
  }
6323
6337
  function iP(s) {
6324
- s && (s.__internalDisable(!0), hs(s, s.context));
6338
+ s && (s.__internalDisable(!0), cs(s, s.context));
6325
6339
  }
6326
6340
  function _0(s, e) {
6327
6341
  for (let t = 0; t < s.new_script_start.length; t++)
@@ -6331,13 +6345,13 @@ function _0(s, e) {
6331
6345
  continue;
6332
6346
  sa(i.__internalAwake.bind(i)), i.enabled && (sa(i.__internalEnable.bind(i)), sa(i.__internalStart.bind(i)), s.new_script_start.splice(t, 1), t--);
6333
6347
  } catch (i) {
6334
- console.error(i), hs(s.new_script_start[t], s), s.new_script_start.splice(t, 1), t--;
6348
+ console.error(i), cs(s.new_script_start[t], s), s.new_script_start.splice(t, 1), t--;
6335
6349
  }
6336
6350
  }
6337
6351
  function zm(s, e) {
6338
6352
  e.scripts.indexOf(s) === -1 && (e.scripts.push(s), s.earlyUpdate && e.scripts_earlyUpdate.push(s), s.update && e.scripts_update.push(s), s.lateUpdate && e.scripts_lateUpdate.push(s), s.onBeforeRender && e.scripts_onBeforeRender.push(s), s.onAfterRender && e.scripts_onAfterRender.push(s), s.onPausedChanged && e.scripts_pausedChanged.push(s), pf(s, null) && e.new_scripts_xr.push(s), pf(s, "immersive-vr") && e.scripts_immersive_vr.push(s), pf(s, "immersive-ar") && e.scripts_immersive_ar.push(s));
6339
6353
  }
6340
- function hs(s, e) {
6354
+ function cs(s, e) {
6341
6355
  Ei(s, e.new_scripts), Ei(s, e.new_script_start), Ei(s, e.scripts), Ei(s, e.scripts_earlyUpdate), Ei(s, e.scripts_update), Ei(s, e.scripts_lateUpdate), Ei(s, e.scripts_onBeforeRender), Ei(s, e.scripts_onAfterRender), Ei(s, e.scripts_pausedChanged), Ei(s, e.new_scripts_xr), Ei(s, e.scripts_immersive_vr), Ei(s, e.scripts_immersive_ar), e.stopAllCoroutinesFrom(s);
6342
6356
  }
6343
6357
  function Ei(s, e) {
@@ -6367,7 +6381,7 @@ function Lh(s, e = !1) {
6367
6381
  return;
6368
6382
  }
6369
6383
  const t = xc(s);
6370
- b0(s, t, !0) || (Sp || D() ? console.error(`Error updating hierarchy
6384
+ b0(s, t, !0) || (Sp || L() ? console.error(`Error updating hierarchy
6371
6385
  Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`, s) : console.error('Failed to update active state in hierarchy of "' + s.name + '"', s), console.warn(" ↑ this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."));
6372
6386
  }
6373
6387
  function b0(s, e, t, i = 0) {
@@ -6486,7 +6500,7 @@ function Yd(s, e, t = !0, i) {
6486
6500
  return;
6487
6501
  }
6488
6502
  if (!e.isConnected) {
6489
- D() && console.debug("Can not send destroy: not connected", s.guid);
6503
+ L() && console.debug("Can not send destroy: not connected", s.guid);
6490
6504
  return;
6491
6505
  }
6492
6506
  let o = s.guid;
@@ -6551,7 +6565,7 @@ function x0(s, e, t, i) {
6551
6565
  if (l.guid) {
6552
6566
  hd && console.log("[Local] new instance", "gameobject:", r?.guid);
6553
6567
  const c = new cP(n.guid, l.guid);
6554
- c.seed = a, e.deleteOnDisconnect === !0 && (c.deleteStateOnDisconnect = !0), o && (o.position && (c.position = { x: o.position.x, y: o.position.y, z: o.position.z }), o.rotation && (c.rotation = { x: o.rotation.x, y: o.rotation.y, z: o.rotation.z, w: o.rotation.w }), o.scale && (c.scale = { x: o.scale.x, y: o.scale.y, z: o.scale.z })), c.position || (c.position = { x: l.position.x, y: l.position.y, z: l.position.z }), c.rotation || (c.rotation = { x: l.quaternion.x, y: l.quaternion.y, z: l.quaternion.z, w: l.quaternion.w }), c.scale || (c.scale = { x: l.scale.x, y: l.scale.y, z: l.scale.z }), c.visible = n.visible, o?.parent && (typeof o.parent == "string" ? c.parent = o.parent : c.parent = o.parent.guid), c.hostData = t, i === !1 && (c.dontSave = !0), !e?.context?.connection && D() && console.debug("Object will be instantiated but it will not be synced: not connected", n.guid), e.context.connection.isInRoom && $r.push(new WeakRef(l)), e?.context?.connection.send("new-instance-created", c);
6568
+ c.seed = a, e.deleteOnDisconnect === !0 && (c.deleteStateOnDisconnect = !0), o && (o.position && (c.position = { x: o.position.x, y: o.position.y, z: o.position.z }), o.rotation && (c.rotation = { x: o.rotation.x, y: o.rotation.y, z: o.rotation.z, w: o.rotation.w }), o.scale && (c.scale = { x: o.scale.x, y: o.scale.y, z: o.scale.z })), c.position || (c.position = { x: l.position.x, y: l.position.y, z: l.position.z }), c.rotation || (c.rotation = { x: l.quaternion.x, y: l.quaternion.y, z: l.quaternion.z, w: l.quaternion.w }), c.scale || (c.scale = { x: l.scale.x, y: l.scale.y, z: l.scale.z }), c.visible = n.visible, o?.parent && (typeof o.parent == "string" ? c.parent = o.parent : c.parent = o.parent.guid), c.hostData = t, i === !1 && (c.dontSave = !0), !e?.context?.connection && L() && console.debug("Object will be instantiated but it will not be synced: not connected", n.guid), e.context.connection.isInRoom && $r.push(new WeakRef(l)), e?.context?.connection.send("new-instance-created", c);
6555
6569
  } else console.warn("Missing guid, can not send new instance event", l);
6556
6570
  }
6557
6571
  return r;
@@ -7126,7 +7140,7 @@ function EP(s, e) {
7126
7140
  return t;
7127
7141
  }
7128
7142
  const M0 = Symbol("customVisibilityFlag");
7129
- function ds(s, e) {
7143
+ function hs(s, e) {
7130
7144
  s.layers[M0] = e;
7131
7145
  }
7132
7146
  const Qy = Symbol("DidPatchLayers");
@@ -7254,7 +7268,7 @@ function zP(s) {
7254
7268
  const e = s.gameObject.userData.components.indexOf(s);
7255
7269
  s.gameObject.userData.components.splice(e, 1);
7256
7270
  }
7257
- s.__internalDisable && s.__internalDisable(), hs(s, s.context ?? N.Current), s.destroy(), s.gameObject = null;
7271
+ s.__internalDisable && s.__internalDisable(), cs(s, s.context ?? N.Current), s.destroy(), s.gameObject = null;
7258
7272
  }
7259
7273
  let Ky = !1;
7260
7274
  function A0(s, e, t) {
@@ -7426,7 +7440,7 @@ Object.getOwnPropertyDescriptor(M.prototype, "worldRotation") || Object.definePr
7426
7440
  });
7427
7441
  Object.getOwnPropertyDescriptor(M.prototype, "worldScale") || Object.defineProperty(M.prototype, "worldScale", {
7428
7442
  get: function() {
7429
- return $e(this);
7443
+ return We(this);
7430
7444
  },
7431
7445
  set: function(s) {
7432
7446
  rc(this, s);
@@ -7803,7 +7817,7 @@ var Oa;
7803
7817
  s.hashSha256 = o;
7804
7818
  function r(h) {
7805
7819
  const d = h.filesize / 1024 / 1024;
7806
- return ws() ? d < 50 : d < 5;
7820
+ return vs() ? d < 50 : d < 5;
7807
7821
  }
7808
7822
  s.canUpload = r;
7809
7823
  async function a(h, d) {
@@ -7817,7 +7831,7 @@ var Oa;
7817
7831
  const g = p.byteLength, b = g / 1024 / 1024;
7818
7832
  if (b > 50)
7819
7833
  return d?.silent !== !0 && ge(`File (${b.toFixed(1)}MB) is too large for uploading (see console for details)`), console.warn(`Your file is too large for uploading (${b.toFixed(1)}MB). Max allowed size is 50MB`), null;
7820
- if (!ws() && b > 5)
7834
+ if (!vs() && b > 5)
7821
7835
  return d?.silent !== !0 && ge('File is too large for uploading. Please get a <a href="https://needle.tools/pricing" target="_blank">commercial license</a> to upload files larger than 5MB'), console.warn(`Your file is too large for uploading (${b.toFixed(1)}MB). Max size is 5MB for non-commercial users. Please get a commercial license at https://needle.tools/pricing for larger files (up to 50MB)`), null;
7822
7836
  if (g < 1)
7823
7837
  return console.warn(`Your file is too small for uploading (${b.toFixed(1)}MB). Min size is 1 byte`), null;
@@ -7858,7 +7872,7 @@ var Oa;
7858
7872
  if (d?.abort?.aborted)
7859
7873
  return console.debug("Aborted upload"), null;
7860
7874
  const E = await x(_.upload);
7861
- E instanceof Error ? (O = E, await ks(1e3 * k)) : E.ok && (console.debug("File uploaded successfully"), I = !0);
7875
+ E instanceof Error ? (O = E, await Os(1e3 * k)) : E.ok && (console.debug("File uploaded successfully"), I = !0);
7862
7876
  } catch (E) {
7863
7877
  console.error(E);
7864
7878
  }
@@ -7890,7 +7904,7 @@ var Oa;
7890
7904
  }
7891
7905
  s.download = c;
7892
7906
  })(Oa || (Oa = {}));
7893
- const zs = w("debugaddressables");
7907
+ const Fs = w("debugaddressables");
7894
7908
  class GP {
7895
7909
  _context;
7896
7910
  _assetReferences = {};
@@ -7954,7 +7968,7 @@ class ie {
7954
7968
  } else
7955
7969
  i = e.context, e = e.sourceId;
7956
7970
  const n = gr(e, t);
7957
- zs && console.log("GetOrCreate Addressable from", e, t, "FinalPath=", n);
7971
+ Fs && console.log("GetOrCreate Addressable from", e, t, "FinalPath=", n);
7958
7972
  const o = i.addressables, r = o.findAssetReference(n);
7959
7973
  if (r) return r;
7960
7974
  const a = new ie(n, i.hash);
@@ -8031,13 +8045,13 @@ class ie {
8031
8045
  }
8032
8046
  /** frees previously allocated memory and destroys the current `asset` instance (if any) */
8033
8047
  unload() {
8034
- this.asset && (zs && console.log("Unload", this.asset), "scene" in this.asset && this.asset.scene && Vi(this.asset.scene, !0, !0), Vi(this.asset, !0, !0)), this.asset = null, this._rawBinary = void 0, this._glbRoot = null, this._loadingPromise = null, N.Current && N.Current.addressables.unregisterAssetReference(this);
8048
+ this.asset && (Fs && console.log("Unload", this.asset), "scene" in this.asset && this.asset.scene && Vi(this.asset.scene, !0, !0), Vi(this.asset, !0, !0)), this.asset = null, this._rawBinary = void 0, this._glbRoot = null, this._loadingPromise = null, N.Current && N.Current.addressables.unregisterAssetReference(this);
8035
8049
  }
8036
8050
  /** loads the asset binary without creating an instance */
8037
8051
  async preload() {
8038
8052
  if (!this.mustLoad || this._isLoadingRawBinary) return null;
8039
8053
  if (this._rawBinary !== void 0) return this._rawBinary;
8040
- this._isLoadingRawBinary = !0, zs && console.log("Preload", this.url);
8054
+ this._isLoadingRawBinary = !0, Fs && console.log("Preload", this.url);
8041
8055
  const e = await Oa.download(this.url, (t) => {
8042
8056
  this.raiseProgressEvent(t);
8043
8057
  });
@@ -8048,7 +8062,7 @@ class ie {
8048
8062
  * @returns the loaded asset
8049
8063
  */
8050
8064
  async loadAssetAsync(e) {
8051
- if (zs && console.log("[AssetReference] loadAssetAsync", this.url), !this.mustLoad) return this.asset;
8065
+ if (Fs && console.log("[AssetReference] loadAssetAsync", this.url), !this.mustLoad) return this.asset;
8052
8066
  if (e && this._progressListeners.push(e), this._loadingPromise !== null)
8053
8067
  return this._loadingPromise.then((n) => this.asset);
8054
8068
  const t = N.Current;
@@ -8057,7 +8071,7 @@ class ie {
8057
8071
  return console.error("[AssetReference] Failed loading – Invalid data. Must be of type ArrayBuffer. " + typeof this._rawBinary), null;
8058
8072
  this._loadingPromise = Bn().parseSync(t, this._rawBinary, this.url, null), this.raiseProgressEvent(new ProgressEvent("progress", { loaded: this._rawBinary.byteLength, total: this._rawBinary.byteLength }));
8059
8073
  } else
8060
- zs && console.log("Load async", this.url), this._loadingPromise = Bn().loadSync(t, this.url, this.url, null, (n) => {
8074
+ Fs && console.log("Load async", this.url), this._loadingPromise = Bn().loadSync(t, this.url, this.url, null, (n) => {
8061
8075
  this.raiseProgressEvent(n);
8062
8076
  });
8063
8077
  this._loadingPromise.finally(() => this._loadingPromise = null);
@@ -8086,8 +8100,8 @@ class ie {
8086
8100
  static currentlyInstantiating = /* @__PURE__ */ new Map();
8087
8101
  async onInstantiate(e, t = !1, i) {
8088
8102
  const n = N.Current, o = new $n();
8089
- if (e instanceof M ? o.parent = e : e && (Object.assign(o, e), o.cloneAssign(e)), o.parent === void 0 && (o.parent = n.scene), this.mustLoad && await this.loadAssetAsync(), zs && console.log("Instantiate", this.url, "parent:", e), this.asset) {
8090
- zs && console.log("Add to scene", this.asset);
8103
+ if (e instanceof M ? o.parent = e : e && (Object.assign(o, e), o.cloneAssign(e)), o.parent === void 0 && (o.parent = n.scene), this.mustLoad && await this.loadAssetAsync(), Fs && console.log("Instantiate", this.url, "parent:", e), this.asset) {
8104
+ Fs && console.log("Add to scene", this.asset);
8091
8105
  let r = ie.currentlyInstantiating.get(this.url);
8092
8106
  if (r !== void 0 && r >= 1e4)
8093
8107
  return console.error("Recursive or too many instantiations of " + this.url + " in the same frame (" + r + ")"), null;
@@ -8109,7 +8123,7 @@ class ie {
8109
8123
  r === void 0 || r < 0 ? r = 0 : r -= 1, ie.currentlyInstantiating.set(this.url, r);
8110
8124
  });
8111
8125
  }
8112
- } else zs && console.warn("Failed to load asset", this.url);
8126
+ } else Fs && console.warn("Failed to load asset", this.url);
8113
8127
  return null;
8114
8128
  }
8115
8129
  /**
@@ -8395,7 +8409,7 @@ class JP {
8395
8409
  h && a.push(h);
8396
8410
  }
8397
8411
  const l = await Bb(a);
8398
- l?.anyFailed && D() && console.error("Failed to load lightmap extension", l), o();
8412
+ l?.anyFailed && L() && console.error("Failed to load lightmap extension", l), o();
8399
8413
  })) : null;
8400
8414
  }
8401
8415
  }
@@ -8403,7 +8417,7 @@ class JP {
8403
8417
  }
8404
8418
  resolveTexture(e, t) {
8405
8419
  const i = t;
8406
- al && console.log("Lightmap loaded:", i), i?.isTexture && (this.registry ? (i.colorSpace = Cs, this.registry.registerTexture(this.source, e.type, i, e.index)) : console.log(Cn[e.type], e.pointer, i));
8420
+ al && console.log("Lightmap loaded:", i), i?.isTexture && (this.registry ? (i.colorSpace = Ss, this.registry.registerTexture(this.source, e.type, i, e.index)) : console.log(Cn[e.type], e.pointer, i));
8407
8421
  }
8408
8422
  }
8409
8423
  const Ir = !!w("debuglightmaps");
@@ -8520,7 +8534,7 @@ class tO {
8520
8534
  bf && this.onRenderDebug(i, n, o);
8521
8535
  }
8522
8536
  onRenderDebug(e, t, i) {
8523
- if (!t.geometry || !We.hasLODLevelAvailable(t.geometry) && !We.hasLODLevelAvailable(t.material)) return;
8537
+ if (!t.geometry || !Ve.hasLODLevelAvailable(t.geometry) && !Ve.hasLODLevelAvailable(t.material)) return;
8524
8538
  const n = Do.getObjectLODState(t);
8525
8539
  if (!n) return;
8526
8540
  let o = i.mesh_lod;
@@ -8532,7 +8546,7 @@ class tO {
8532
8546
  if (r)
8533
8547
  z.DrawWireSphere(l, c, h[o], 0.1);
8534
8548
  else {
8535
- const d = t.geometry.index?.count ?? 0, f = We.getMeshLODExtension(t.geometry)?.lods;
8549
+ const d = t.geometry.index?.count ?? 0, f = Ve.getMeshLODExtension(t.geometry)?.lods;
8536
8550
  o = f ? Math.min(f?.length - 1, o) : 0;
8537
8551
  let p = "";
8538
8552
  if (f && n.lastScreenCoverage > 0)
@@ -8777,7 +8791,7 @@ class dO {
8777
8791
  if (i && i.Source) {
8778
8792
  en && console.log("Setting environment reflection", i);
8779
8793
  const n = this.context.scene, o = i.Source;
8780
- o.mapping = bs, n.environment = o;
8794
+ o.mapping = _s, n.environment = o;
8781
8795
  return;
8782
8796
  } else en && console.warn("Could not find reflection for source", e);
8783
8797
  break;
@@ -8787,13 +8801,13 @@ class dO {
8787
8801
  case 1:
8788
8802
  if (t.ambientTrilight) {
8789
8803
  const i = t.ambientTrilight, n = rO(i[0], i[1], i[2], 64, 64);
8790
- n.colorSpace = Ps, n.mapping = bs, this.context.scene.environment = n;
8804
+ n.colorSpace = Cs, n.mapping = _s, this.context.scene.environment = n;
8791
8805
  } else console.error("Missing ambient trilight", t.sourceId);
8792
8806
  return;
8793
8807
  case 3:
8794
8808
  if (t.ambientLight) {
8795
8809
  const i = Gm(t.ambientLight, 64);
8796
- i.colorSpace = Ps, i.mapping = bs, this.context.scene.environment = i;
8810
+ i.colorSpace = Cs, i.mapping = _s, this.context.scene.environment = i;
8797
8811
  } else console.error("Missing ambientlight", t.sourceId);
8798
8812
  return;
8799
8813
  default:
@@ -8824,7 +8838,7 @@ class uO {
8824
8838
  // private _ambientScale: number = 1;
8825
8839
  // private _lightProbe?: LightProbe;
8826
8840
  constructor(e, t, i = 1) {
8827
- this._source = t, t.mapping = bs;
8841
+ this._source = t, t.mapping = _s;
8828
8842
  }
8829
8843
  /* REMOVED, no LightProbe / custom shader lighting support for now
8830
8844
  getSphericalHarmonicsArray(intensityFactor: number = 1): SphericalHarmonicsData | null {
@@ -8983,7 +8997,7 @@ vec3 NeutralToneMapping( vec3 color ) {
8983
8997
  if (i >= 0 && n >= 0) {
8984
8998
  const o = Vt.tonemapping_pars_fragment.substring(i, n + t.length);
8985
8999
  Vt.tonemapping_pars_fragment = Vt.tonemapping_pars_fragment.replace(o, s);
8986
- } else D() && console.error("Couldn't find NeutralToneMapping in ShaderChunk.tonemapping_pars_fragment");
9000
+ } else L() && console.error("Couldn't find NeutralToneMapping in ShaderChunk.tonemapping_pars_fragment");
8987
9001
  }
8988
9002
  function mO() {
8989
9003
  const s = `
@@ -9101,7 +9115,7 @@ vec3 AgXToneMapping( vec3 color ) {
9101
9115
  if (i >= 0 && n >= 0) {
9102
9116
  const o = Vt.tonemapping_pars_fragment.substring(i, n + t.length);
9103
9117
  Vt.tonemapping_pars_fragment = Vt.tonemapping_pars_fragment.replace(o, s);
9104
- } else D() && console.error("Couldn't find AgXToneMapping in ShaderChunk.tonemapping_pars_fragment");
9118
+ } else L() && console.error("Couldn't find AgXToneMapping in ShaderChunk.tonemapping_pars_fragment");
9105
9119
  }
9106
9120
  function z0(s) {
9107
9121
  if (typeof s == "string")
@@ -9177,7 +9191,7 @@ class Mn {
9177
9191
  if (this._fullscreenButton)
9178
9192
  return this._fullscreenButton;
9179
9193
  if (!document.fullscreenEnabled)
9180
- return D() && console.warn("NeedleMenu: Fullscreen button could not be created, device doesn't support the Fullscreen API"), null;
9194
+ return L() && console.warn("NeedleMenu: Fullscreen button could not be created, device doesn't support the Fullscreen API"), null;
9181
9195
  const t = document.createElement("button");
9182
9196
  this._fullscreenButton = t, t.classList.add("fullscreen-button"), t.title = "Click to enter fullscreen mode";
9183
9197
  const i = Rt("fullscreen"), n = Rt("fullscreen_exit");
@@ -9249,7 +9263,7 @@ class Mn {
9249
9263
  const n = document.createElement("div");
9250
9264
  n.classList.add("qr-code-container"), i.appendChild(n), t.addEventListener("click", () => {
9251
9265
  if (i.parentNode) return r();
9252
- D() && window.location.href.includes("://localhost") && ge("To access your website from another device in the same local network you have to use the IP address instead of localhost. The IP address is logged in your development server console when you start the server."), o();
9266
+ L() && window.location.href.includes("://localhost") && ge("To access your website from another device in the same local network you have to use the IP address instead of localhost. The IP address is logged in your development server console when you start the server."), o();
9253
9267
  });
9254
9268
  async function o() {
9255
9269
  await a();
@@ -9521,7 +9535,7 @@ class yO {
9521
9535
  }
9522
9536
  if (this.menu) {
9523
9537
  const e = this.menu.children.indexOf(this._poweredByNeedleElement);
9524
- if (!this._showNeedleLogo && vs())
9538
+ if (!this._showNeedleLogo && bs())
9525
9539
  e >= 0 && (this._poweredByNeedleElement.removeFromParent(), this.markDirty());
9526
9540
  else {
9527
9541
  this._poweredByNeedleElement.visible = !0, this.menu.add(this._poweredByNeedleElement);
@@ -10188,7 +10202,7 @@ class tu extends HTMLElement {
10188
10202
  });
10189
10203
  try {
10190
10204
  window.requestAnimationFrame(() => CO((h) => {
10191
- if (h == !0 && ws() && !r_) {
10205
+ if (h == !0 && vs() && !r_) {
10192
10206
  let d = this._userRequestedLogoVisible;
10193
10207
  d === void 0 && (d = !1), this.___onSetLogoVisible(d);
10194
10208
  } else
@@ -10212,7 +10226,7 @@ class tu extends HTMLElement {
10212
10226
  try {
10213
10227
  l = !0, this.onChangeDetected(h);
10214
10228
  const d = this?.parentNode;
10215
- if ((this.style.display != "flex" || this.style.visibility != "visible" || this.style.opacity != "1" || d != this._domElement?.shadowRoot) && !ws()) {
10229
+ if ((this.style.display != "flex" || this.style.visibility != "visible" || this.style.opacity != "1" || d != this._domElement?.shadowRoot) && !vs()) {
10216
10230
  const f = r++;
10217
10231
  ln() && this._userRequestedMenuVisible === !1 ? (f === 0 && a(d, this._userRequestedMenuVisible), f === 1 && console.warn("Needle Menu Warning: You need a PRO license to hide the Needle Engine menu → The menu will be visible in your deployed website if you don't have a PRO license. See https://needle.tools/pricing for details.")) : f === 0 ? a(d, !0) : setTimeout(() => a(d, !0), 5);
10218
10232
  }
@@ -10238,7 +10252,7 @@ class tu extends HTMLElement {
10238
10252
  };
10239
10253
  _userRequestedLogoVisible = void 0;
10240
10254
  showNeedleLogo(e) {
10241
- this._userRequestedLogoVisible = e, !(!e && (!ws() || r_) && (console.warn("[Needle Engine] You need a PRO license to hide the Needle Engine logo in production."), !ln())) && this.___onSetLogoVisible(e);
10255
+ this._userRequestedLogoVisible = e, !(!e && (!vs() || r_) && (console.warn("[Needle Engine] You need a PRO license to hide the Needle Engine logo in production."), !ln())) && this.___onSetLogoVisible(e);
10242
10256
  }
10243
10257
  /** @returns true if the logo is visible */
10244
10258
  get logoIsVisible() {
@@ -10418,7 +10432,7 @@ var xe = /* @__PURE__ */ ((s) => (s[s.Start = -1] = "Start", s[s.EarlyUpdate = 0
10418
10432
  function qm(s, e) {
10419
10433
  if (!s) return;
10420
10434
  if (!s.isComponent) {
10421
- (D() || Xe) && console.error(`Registered script is not a Needle Engine component.
10435
+ (L() || Xe) && console.error(`Registered script is not a Needle Engine component.
10422
10436
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
10423
10437
  `, s);
10424
10438
  return;
@@ -10774,7 +10788,7 @@ class N {
10774
10788
  const t = this.domElement?.shadowRoot?.querySelector("canvas");
10775
10789
  t && (e.canvas = t, Xe && console.log("Using canvas from shadow root", t));
10776
10790
  }
10777
- return Xe && console.log("Using Renderer Parameters:", e, this.domElement), this.renderer = new mr(e), this.renderer.debug.checkShaderErrors = D() || w("checkshadererrors") === !0, this.renderer.toneMappingExposure = 1, this.renderer.toneMapping = Kh, this.renderer.setClearColor(new se("lightgrey"), 0), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = dx, this.renderer.setSize(this.domWidth, this.domHeight), this.renderer.outputColorSpace = Ps, this.renderer.nodes = {
10791
+ return Xe && console.log("Using Renderer Parameters:", e, this.domElement), this.renderer = new mr(e), this.renderer.debug.checkShaderErrors = L() || w("checkshadererrors") === !0, this.renderer.toneMappingExposure = 1, this.renderer.toneMapping = Kh, this.renderer.setClearColor(new se("lightgrey"), 0), this.renderer.shadowMap.enabled = !0, this.renderer.shadowMap.type = dx, this.renderer.setSize(this.domWidth, this.domHeight), this.renderer.outputColorSpace = Cs, this.renderer.nodes = {
10778
10792
  library: new ux(),
10779
10793
  modelViewMatrix: null,
10780
10794
  modelNormalViewMatrix: null
@@ -11022,7 +11036,7 @@ Start a coroutine from a component by calling "this.startCoroutine(myCoroutine()
11022
11036
  Xe && console.log("Creating context", this.name, e);
11023
11037
  const i = globalThis["needle:dependencies:ready"];
11024
11038
  i instanceof Promise && (Xe && console.log("Waiting for dependencies to be ready"), await i.catch((c) => {
11025
- if (Xe || D()) {
11039
+ if (Xe || L()) {
11026
11040
  if (Xd("Needle Engine dependencies failed to load. Please check the console for more details"), c instanceof ReferenceError) {
11027
11041
  let h = "YourComponentName";
11028
11042
  const d = c.message.indexOf("'");
@@ -11163,11 +11177,11 @@ Possible solutions:
11163
11177
  _renderlooperrors = 0;
11164
11178
  /** Performs a full update step including script callbacks, rendering (unless isManagedExternally is set to false) and post render callbacks */
11165
11179
  update(e, t) {
11166
- if (t === void 0 && (t = null), D() || Xe || tP())
11180
+ if (t === void 0 && (t = null), L() || Xe || tP())
11167
11181
  try {
11168
11182
  this.internalStep(e, t), this._renderlooperrors = 0;
11169
11183
  } catch (i) {
11170
- this._renderlooperrors += 1, (D() || Xe) && (i instanceof Error || i instanceof TypeError) && Be("Caught unhandled exception during render-loop - see console for details.", Ni.Error), console.error("Frame #" + this.time.frame + `
11184
+ this._renderlooperrors += 1, (L() || Xe) && (i instanceof Error || i instanceof TypeError) && Be("Caught unhandled exception during render-loop - see console for details.", Ni.Error), console.error("Frame #" + this.time.frame + `
11171
11185
  `, i), this._renderlooperrors >= 3 && (console.warn("Stopping render loop due to error"), this.renderer.setAnimationLoop(null)), this.domElement.dispatchEvent(new CustomEvent("error", { detail: i }));
11172
11186
  }
11173
11187
  else
@@ -11425,7 +11439,7 @@ Target Framerate: ` + this.targetFrameRate)), this._dispatchReadyAfterFrame && (
11425
11439
  const di = w("debuglicense"), $0 = [];
11426
11440
  let Ln = "basic";
11427
11441
  di && console.log("License Type: " + Ln);
11428
- function vs() {
11442
+ function bs() {
11429
11443
  switch (Ln) {
11430
11444
  case "pro":
11431
11445
  case "enterprise":
@@ -11447,11 +11461,11 @@ function Xm() {
11447
11461
  }
11448
11462
  return !1;
11449
11463
  }
11450
- function ws() {
11451
- return vs() || iu() || Xm();
11464
+ function vs() {
11465
+ return bs() || iu() || Xm();
11452
11466
  }
11453
11467
  function CO(s) {
11454
- if (vs() || iu() || Xm())
11468
+ if (bs() || iu() || Xm())
11455
11469
  return s(!0);
11456
11470
  $0.push(s);
11457
11471
  }
@@ -11529,7 +11543,7 @@ async function OO(s) {
11529
11543
  }
11530
11544
  async function kO(s) {
11531
11545
  try {
11532
- if (!vs() && !iu())
11546
+ if (!bs() && !iu())
11533
11547
  return xf(s);
11534
11548
  } catch (e) {
11535
11549
  return di && console.log("License check failed", e), xf(s);
@@ -11539,7 +11553,7 @@ async function kO(s) {
11539
11553
  async function xf(s) {
11540
11554
  let e = !1;
11541
11555
  s.domElement.addEventListener("ready", () => e = !0), await ka?.catch(() => {
11542
- }), !(vs() || iu()) && (ws() === !1 && MO(), e ? Fp(s) : s.domElement.addEventListener("ready", () => {
11556
+ }), !(bs() || iu()) && (vs() === !1 && MO(), e ? Fp(s) : s.domElement.addEventListener("ready", () => {
11543
11557
  Fp(s);
11544
11558
  }));
11545
11559
  }
@@ -11658,25 +11672,25 @@ async function RO(s) {
11658
11672
  }
11659
11673
  }
11660
11674
  function TO(s, e) {
11661
- return Rs(s, ce.ContextCreated, e), () => yo(s, ce.ContextCreated);
11675
+ return Ms(s, ce.ContextCreated, e), () => yo(s, ce.ContextCreated);
11662
11676
  }
11663
11677
  function tL(s, e) {
11664
- return Rs(s, ce.ContextClearing, e), () => yo(s, ce.ContextClearing);
11678
+ return Ms(s, ce.ContextClearing, e), () => yo(s, ce.ContextClearing);
11665
11679
  }
11666
11680
  function iL(s, e) {
11667
- return Rs(s, ce.ContextDestroying, e), () => yo(s, ce.ContextDestroying);
11681
+ return Ms(s, ce.ContextDestroying, e), () => yo(s, ce.ContextDestroying);
11668
11682
  }
11669
11683
  function V0(s, e) {
11670
- return Rs(s, xe.Start, e), () => yo(s, xe.Start);
11684
+ return Ms(s, xe.Start, e), () => yo(s, xe.Start);
11671
11685
  }
11672
11686
  function EO(s, e) {
11673
- return Rs(s, xe.Update, e), () => yo(s, xe.Update);
11687
+ return Ms(s, xe.Update, e), () => yo(s, xe.Update);
11674
11688
  }
11675
11689
  function nL(s, e) {
11676
- return Rs(s, xe.OnBeforeRender, e), () => yo(s, xe.OnBeforeRender);
11690
+ return Ms(s, xe.OnBeforeRender, e), () => yo(s, xe.OnBeforeRender);
11677
11691
  }
11678
11692
  function sL(s, e) {
11679
- return Rs(s, xe.OnAfterRender, e), () => yo(s, xe.OnAfterRender);
11693
+ return Ms(s, xe.OnAfterRender, e), () => yo(s, xe.OnAfterRender);
11680
11694
  }
11681
11695
  const AO = w("debugdecoders");
11682
11696
  let Sf = null;
@@ -11803,7 +11817,7 @@ function rL(s) {
11803
11817
  for (const d of n) {
11804
11818
  const f = d, p = f.isComponent === !0, g = p ? f.activeAndEnabled : !0, b = p ? f.context : void 0;
11805
11819
  try {
11806
- if (p && b && hs(f, b), p && g && (f.enabled = !1), d.onBeforeHotReloadFields && d.onBeforeHotReloadFields() === !1)
11820
+ if (p && b && cs(f, b), p && g && (f.enabled = !1), d.onBeforeHotReloadFields && d.onBeforeHotReloadFields() === !1)
11807
11821
  continue;
11808
11822
  for (const m in h)
11809
11823
  if (h[m].writable) {
@@ -12349,7 +12363,7 @@ class R {
12349
12363
  }
12350
12364
  /** @internal */
12351
12365
  __internalEnable(e) {
12352
- return this.__destroyed ? (D() && console.warn("[Needle Engine Dev] Trying to enable destroyed component"), !1) : this.__didAwake ? this.__didEnable ? (e !== !0 && (this.__isEnabled = !0), !1) : (this.__didEnable = !0, this.__isEnabled = !0, this.onEnable(), !0) : !1;
12366
+ return this.__destroyed ? (L() && console.warn("[Needle Engine Dev] Trying to enable destroyed component"), !1) : this.__didAwake ? this.__didEnable ? (e !== !0 && (this.__isEnabled = !0), !1) : (this.__didEnable = !0, this.__isEnabled = !0, this.onEnable(), !0) : !1;
12353
12367
  }
12354
12368
  /** @internal */
12355
12369
  __internalDisable(e) {
@@ -12374,7 +12388,7 @@ class R {
12374
12388
  }
12375
12389
  set enabled(e) {
12376
12390
  if (this.__destroyed) {
12377
- D() && console.warn(`[Needle Engine Dev] Trying to ${e ? "enable" : "disable"} destroyed component`);
12391
+ L() && console.warn(`[Needle Engine Dev] Trying to ${e ? "enable" : "disable"} destroyed component`);
12378
12392
  return;
12379
12393
  }
12380
12394
  if (typeof e == "number" && (e >= 0.5 ? e = !0 : e = !1), !this.__didAwake) {
@@ -12562,7 +12576,7 @@ var BO = Object.defineProperty, FO = Object.getOwnPropertyDescriptor, vr = (s, e
12562
12576
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
12563
12577
  return i && n && BO(e, t, n), n;
12564
12578
  };
12565
- const Us = w("debuganimation");
12579
+ const zs = w("debuganimation");
12566
12580
  let q0 = class {
12567
12581
  x;
12568
12582
  y;
@@ -12608,7 +12622,7 @@ class vi extends R {
12608
12622
  */
12609
12623
  set clip(e) {
12610
12624
  if (!this.__didAwake) {
12611
- Us && console.warn("Assign clip during serialization", e), this._tempAnimationClipBeforeGameObjectExisted = e;
12625
+ zs && console.warn("Assign clip during serialization", e), this._tempAnimationClipBeforeGameObjectExisted = e;
12612
12626
  return;
12613
12627
  }
12614
12628
  e && (this.gameObject.animations || (this.gameObject.animations = []), !this.animations.includes(e) && (this.animations.length > 0 ? this.animations.splice(0, 0, e) : this.animations.push(e)));
@@ -12637,7 +12651,7 @@ class vi extends R {
12637
12651
  _handles;
12638
12652
  /** @internal */
12639
12653
  awake() {
12640
- this.mixer = void 0, Us && console.log("Animation Awake", this.name, this), this._tempAnimationsArray && (this.animations = this._tempAnimationsArray, this._tempAnimationsArray = void 0), this._tempAnimationClipBeforeGameObjectExisted && (this.clip = this._tempAnimationClipBeforeGameObjectExisted, this._tempAnimationClipBeforeGameObjectExisted = null), this.actions = [], this._handles = [];
12654
+ this.mixer = void 0, zs && console.log("Animation Awake", this.name, this), this._tempAnimationsArray && (this.animations = this._tempAnimationsArray, this._tempAnimationsArray = void 0), this._tempAnimationClipBeforeGameObjectExisted && (this.clip = this._tempAnimationClipBeforeGameObjectExisted, this._tempAnimationClipBeforeGameObjectExisted = null), this.actions = [], this._handles = [];
12641
12655
  }
12642
12656
  /** @internal */
12643
12657
  onEnable() {
@@ -12692,7 +12706,7 @@ class vi extends R {
12692
12706
  return;
12693
12707
  } else if (typeof e == "number") {
12694
12708
  if (e >= this.animations.length) {
12695
- Us && console.log("No animation at index", e);
12709
+ zs && console.log("No animation at index", e);
12696
12710
  return;
12697
12711
  }
12698
12712
  e = this.animations[e];
@@ -12720,7 +12734,7 @@ class vi extends R {
12720
12734
  return;
12721
12735
  } else if (typeof e == "number") {
12722
12736
  if (e >= this.animations.length) {
12723
- Us && console.log("No animation at index", e);
12737
+ zs && console.log("No animation at index", e);
12724
12738
  return;
12725
12739
  }
12726
12740
  e = this.animations[e];
@@ -12751,15 +12765,15 @@ class vi extends R {
12751
12765
  * @returns a promise that resolves when the animation is finished (note that it will not resolve if the animation is looping)
12752
12766
  */
12753
12767
  play(e = 0, t) {
12754
- if (Us && console.log("PLAY", e), this.ensureMixer(), !this.mixer) {
12755
- Us && console.warn("Missing mixer", this);
12768
+ if (zs && console.log("PLAY", e), this.ensureMixer(), !this.mixer) {
12769
+ zs && console.warn("Missing mixer", this);
12756
12770
  return;
12757
12771
  }
12758
12772
  e === void 0 && (e = 0);
12759
12773
  let i = e;
12760
12774
  if (typeof e == "number") {
12761
12775
  if (e >= this.animations.length) {
12762
- Us && console.log("No animation at index", e);
12776
+ zs && console.log("No animation at index", e);
12763
12777
  return;
12764
12778
  }
12765
12779
  i = this.animations[e];
@@ -12794,7 +12808,7 @@ class vi extends R {
12794
12808
  const r = e.getClip();
12795
12809
  e.time = j.lerp(t.minMaxOffsetNormalized.x, t.minMaxOffsetNormalized.y, Math.random()) * r.duration;
12796
12810
  } else e.time >= e.getClip().duration && (e.time = 0);
12797
- t?.minMaxSpeed ? e.timeScale = j.lerp(t.minMaxSpeed.x, t.minMaxSpeed.y, Math.random()) : e.timeScale = t?.speed ?? 1, t?.loop != null ? e.loop = t.loop ? fx : cp : e.loop = cp, t?.clampWhenFinished && (e.clampWhenFinished = !0), e.paused = !1, e.play(), Us && console.log("PLAY", e.getClip().name, e);
12811
+ t?.minMaxSpeed ? e.timeScale = j.lerp(t.minMaxSpeed.x, t.minMaxSpeed.y, Math.random()) : e.timeScale = t?.speed ?? 1, t?.loop != null ? e.loop = t.loop ? fx : cp : e.loop = cp, t?.clampWhenFinished && (e.clampWhenFinished = !0), e.paused = !1, e.play(), zs && console.log("PLAY", e.getClip().name, e);
12798
12812
  const o = new zO(e, this.mixer, t, (r) => {
12799
12813
  this._handles.splice(this._handles.indexOf(o), 1);
12800
12814
  });
@@ -12913,7 +12927,7 @@ function NO(s, e) {
12913
12927
  return {
12914
12928
  name: "Empty",
12915
12929
  isLooping: !1,
12916
- guid: e?.generateUUID() ?? ys.generateUUID(),
12930
+ guid: e?.generateUUID() ?? gs.generateUUID(),
12917
12931
  index: -1,
12918
12932
  clip: new ro(s, 0, [])
12919
12933
  };
@@ -13252,7 +13266,7 @@ class an {
13252
13266
  }
13253
13267
  }
13254
13268
  setStartTransition() {
13255
- this.model.layers.length > 1 && (et || D()) && console.warn("Multiple layers are not supported yet " + this.animator?.name);
13269
+ this.model.layers.length > 1 && (et || L()) && console.warn("Multiple layers are not supported yet " + this.animator?.name);
13256
13270
  for (const e of this.model.layers) {
13257
13271
  const t = e.stateMachine;
13258
13272
  t.defaultState === void 0 && (et && console.warn("AnimatorController default state is undefined, will assign state 0 as default", e), t.defaultState = 0);
@@ -13403,7 +13417,7 @@ Exit Time: ` + c, o.hasExitTime);
13403
13417
  r.conditions || (r.conditions = []);
13404
13418
  if (o.motion || (et && console.warn("No motion", o), o.motion = NO(o.name)), this.animator && o.motion.clips) {
13405
13419
  const r = o.motion.clips?.find((a) => a.node.name === this.animator?.gameObject?.name);
13406
- r ? o.motion.clip = r.clip : (et || D()) && console.warn('Could not find clip for animator "' + this.animator?.gameObject?.name + '"', o.motion.clips.map((a) => a.node.name));
13420
+ r ? o.motion.clip = r.clip : (et || L()) && console.warn('Could not find clip for animator "' + this.animator?.gameObject?.name + '"', o.motion.clips.map((a) => a.node.name));
13407
13421
  }
13408
13422
  if (!o.motion.clip) {
13409
13423
  et && console.warn("No clip assigned to state", o);
@@ -13416,7 +13430,7 @@ Exit Time: ` + c, o.hasExitTime);
13416
13430
  const a = this.createAction(r);
13417
13431
  o.motion.action = a;
13418
13432
  } else
13419
- (et || D()) && console.warn("No valid animationclip assigned", o);
13433
+ (et || L()) && console.warn("No valid animationclip assigned", o);
13420
13434
  }
13421
13435
  if (o.behaviours && Array.isArray(o.behaviours))
13422
13436
  for (const r of o.behaviours) {
@@ -13426,7 +13440,7 @@ Exit Time: ` + c, o.hasExitTime);
13426
13440
  const l = new a();
13427
13441
  l.isStateMachineBehaviour && (l._context = this.context ?? void 0, xa(l, r.properties), r.instance = l), et && console.log("Created animator controller behaviour", o.name, r.typeName, r.properties, l);
13428
13442
  } else
13429
- (et || D()) && console.warn("Could not find AnimatorBehaviour type: " + r.typeName);
13443
+ (et || L()) && console.warn("Could not find AnimatorBehaviour type: " + r.typeName);
13430
13444
  }
13431
13445
  }
13432
13446
  }
@@ -13884,7 +13898,7 @@ su([
13884
13898
  u()
13885
13899
  ], It.prototype, "runtimeAnimatorController", 1);
13886
13900
  const g_ = Symbol("previous-visibility");
13887
- class ps extends jn {
13901
+ class fs extends jn {
13888
13902
  /**
13889
13903
  * Render the scene to the texture
13890
13904
  * @param scene The scene to render
@@ -13902,15 +13916,15 @@ class ps extends jn {
13902
13916
  }
13903
13917
  static _userSet = /* @__PURE__ */ new Set();
13904
13918
  onBeforeRender() {
13905
- ps._userSet.clear();
13906
- const e = m0(this.texture, !0, null, ps._userSet);
13919
+ fs._userSet.clear();
13920
+ const e = m0(this.texture, !0, null, fs._userSet);
13907
13921
  for (const t of e)
13908
13922
  t instanceof H && (t[g_] = t.visible, t.visible = !1);
13909
13923
  }
13910
13924
  onAfterRender() {
13911
- for (const e of ps._userSet)
13925
+ for (const e of fs._userSet)
13912
13926
  e instanceof H && (e.visible = e[g_]);
13913
- ps._userSet.clear();
13927
+ fs._userSet.clear();
13914
13928
  }
13915
13929
  }
13916
13930
  var GO = Object.defineProperty, qO = Object.getOwnPropertyDescriptor, Cc = (s, e, t, i) => {
@@ -13919,7 +13933,7 @@ var GO = Object.defineProperty, qO = Object.getOwnPropertyDescriptor, Cc = (s, e
13919
13933
  return i && n && GO(e, t, n), n;
13920
13934
  };
13921
13935
  const dh = w("debuggroundprojection");
13922
- class Ts extends R {
13936
+ class Rs extends R {
13923
13937
  applyOnAwake = !1;
13924
13938
  autoFit = !0;
13925
13939
  set radius(e) {
@@ -14016,7 +14030,7 @@ class Ts extends R {
14016
14030
  if (r < 1 / 0) {
14017
14031
  const a = G();
14018
14032
  a.x = o.min.x + (o.max.x - o.min.x) * 0.5;
14019
- const l = $e(this.gameObject).x;
14033
+ const l = We(this.gameObject).x;
14020
14034
  a.y = r + this._height * l - i, a.z = o.min.z + (o.max.z - o.min.z) * 0.5, ft(this._projection, a);
14021
14035
  }
14022
14036
  dh && z.DrawWireBox3(o, 65280, 5);
@@ -14047,19 +14061,19 @@ class Ts extends R {
14047
14061
  }
14048
14062
  Cc([
14049
14063
  u()
14050
- ], Ts.prototype, "applyOnAwake", 2);
14064
+ ], Rs.prototype, "applyOnAwake", 2);
14051
14065
  Cc([
14052
14066
  u()
14053
- ], Ts.prototype, "autoFit", 2);
14067
+ ], Rs.prototype, "autoFit", 2);
14054
14068
  Cc([
14055
14069
  u()
14056
- ], Ts.prototype, "radius", 1);
14070
+ ], Rs.prototype, "radius", 1);
14057
14071
  Cc([
14058
14072
  u()
14059
- ], Ts.prototype, "height", 1);
14073
+ ], Rs.prototype, "height", 1);
14060
14074
  Cc([
14061
14075
  u()
14062
- ], Ts.prototype, "arBlending", 1);
14076
+ ], Rs.prototype, "arBlending", 1);
14063
14077
  const XO = `
14064
14078
  varying vec2 vUv;
14065
14079
 
@@ -14200,17 +14214,17 @@ class Q0 {
14200
14214
  return e.prep(4, 36), e.prep(4, 12), e.writeFloat32(h), e.writeFloat32(c), e.writeFloat32(l), e.prep(4, 12), e.writeFloat32(a), e.writeFloat32(r), e.writeFloat32(o), e.prep(4, 12), e.writeFloat32(n), e.writeFloat32(i), e.writeFloat32(t), e.offset();
14201
14215
  }
14202
14216
  }
14203
- class us {
14217
+ class ds {
14204
14218
  bb = null;
14205
14219
  bb_pos = 0;
14206
14220
  __init(e, t) {
14207
14221
  return this.bb_pos = e, this.bb = t, this;
14208
14222
  }
14209
14223
  static getRootAsSyncedTransformModel(e, t) {
14210
- return (t || new us()).__init(e.readInt32(e.position()) + e.position(), e);
14224
+ return (t || new ds()).__init(e.readInt32(e.position()) + e.position(), e);
14211
14225
  }
14212
14226
  static getSizePrefixedRootAsSyncedTransformModel(e, t) {
14213
- return e.setPosition(e.position() + Eb), (t || new us()).__init(e.readInt32(e.position()) + e.position(), e);
14227
+ return e.setPosition(e.position() + Eb), (t || new ds()).__init(e.readInt32(e.position()) + e.position(), e);
14214
14228
  }
14215
14229
  guid(e) {
14216
14230
  const t = this.bb.__offset(this.bb_pos, 4);
@@ -14272,7 +14286,7 @@ var T;
14272
14286
  e.ready = i;
14273
14287
  async function n() {
14274
14288
  if (e.MODULE) return e.MODULE;
14275
- const o = await import("./rapier-B3xpyPtq.js");
14289
+ const o = await import("./rapier-BJaux8TQ.js");
14276
14290
  return e.MODULE = o, e.MAYBEMODULE = o, t.forEach((r) => r(o)), t.length = 0, o;
14277
14291
  }
14278
14292
  e.load = n;
@@ -14325,7 +14339,7 @@ function KO(s, e, t, i, n) {
14325
14339
  const r = Symbol(o), a = s.__internalAwake;
14326
14340
  s.__internalAwake = function() {
14327
14341
  if (!this.onValidate) {
14328
- D() && console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "' + s.constructor?.name + '"');
14342
+ L() && console.warn('Usage of @validate decorate detected but there is no onValidate method in your class: "' + s.constructor?.name + '"');
14329
14343
  return;
14330
14344
  }
14331
14345
  if (this[r] === void 0) {
@@ -14543,7 +14557,7 @@ const ti = class $h extends R {
14543
14557
  this._watch = void 0, this._propertiesChanged = !1;
14544
14558
  }
14545
14559
  onEnable() {
14546
- this._watch || (this._watch = new ek(this.gameObject, this.context)), this._watch.start(!0, !0), this.startCoroutine(this.beforePhysics(), xe.LateUpdate), D() && (globalThis.NEEDLE_USE_RAPIER ? T.RAPIER_PHYSICS.ready().then(async () => {
14560
+ this._watch || (this._watch = new ek(this.gameObject, this.context)), this._watch.start(!0, !0), this.startCoroutine(this.beforePhysics(), xe.LateUpdate), L() && (globalThis.NEEDLE_USE_RAPIER ? T.RAPIER_PHYSICS.ready().then(async () => {
14547
14561
  await Hd(3), this.context.physics.engine?.getBody(this) || console.warn(`Rigidbody could not be created. Ensure "${this.name}" has a Collider component.`);
14548
14562
  }) : console.warn("Rigidbody could not be created: Rapier physics are explicitly disabled."));
14549
14563
  }
@@ -14713,15 +14727,15 @@ let pt = ti;
14713
14727
  new y();
14714
14728
  new y();
14715
14729
  const qs = w("debugsync"), fc = "STRS";
14716
- l0(fc, us.getRootAsSyncedTransformModel);
14730
+ l0(fc, ds.getRootAsSyncedTransformModel);
14717
14731
  const _n = new Pm();
14718
14732
  function Y0(s, e, t = !0) {
14719
14733
  _n.clear();
14720
14734
  const i = _n.createString(s);
14721
- us.startSyncedTransformModel(_n), us.addGuid(_n, i), us.addFast(_n, t);
14735
+ ds.startSyncedTransformModel(_n), ds.addGuid(_n, i), ds.addFast(_n, t);
14722
14736
  const n = e.worldPosition, o = e.worldEuler, r = e.gameObject.scale;
14723
- us.addTransform(_n, Q0.createTransform(_n, n.x, n.y, n.z, o.x, o.y, o.z, r.x, r.y, r.z));
14724
- const a = us.endSyncedTransformModel(_n);
14737
+ ds.addTransform(_n, Q0.createTransform(_n, n.x, n.y, n.z, o.x, o.y, o.z, r.x, r.y, r.z));
14738
+ const a = ds.endSyncedTransformModel(_n);
14725
14739
  return _n.finish(a, fc), _n.asUint8Array();
14726
14740
  }
14727
14741
  let zp = 0, Ql = 0;
@@ -15053,7 +15067,7 @@ class ue {
15053
15067
  if (l) {
15054
15068
  const c = o.arguments?.map((h) => h instanceof Object && h.uuid ? e[h.uuid] : h?.isComponent ? e[h.guid] : h);
15055
15069
  t.push(new Zs(l.clone, o.methodName, c, o.enabled));
15056
- } else D() && console.warn("Could not find target for event listener");
15070
+ } else L() && console.warn("Could not find target for event listener");
15057
15071
  }
15058
15072
  }
15059
15073
  }
@@ -15176,7 +15190,7 @@ class sk extends Qi {
15176
15190
  if (e.endsWith(".glb") || e.endsWith(".gltf")) {
15177
15191
  if (t.serializable instanceof Array && t.serializable.includes(ie))
15178
15192
  return;
15179
- D() && ge("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");
15193
+ L() && ge("Detected wrong usage of @serializable with Object3D or GameObject. Instead you should use AssetReference here! Please see the console for details.");
15180
15194
  const i = t.target?.constructor?.name;
15181
15195
  console.warn(`Wrong usage of @serializable detected in your script "${i}"
15182
15196
 
@@ -15201,7 +15215,7 @@ ${t.path}! : AssetReference;
15201
15215
  }
15202
15216
  let i;
15203
15217
  const n = t.gltf?.scene;
15204
- return n && (i = S.findByGuid(e.guid, n)), i || (i = S.findByGuid(e.guid, t.context.scene)), i ? (i && i.isComponent === !0 && (ut && console.warn("Deserialized object reference is a component"), i = i.gameObject), ut && console.log("Deserialized object reference?", e, i, t?.nodeToObject)) : ((D() || ut) && console.warn("Could not resolve object reference", t.path, e, t.target, t.context.scene), e.could_not_resolve = !0), i;
15218
+ return n && (i = S.findByGuid(e.guid, n)), i || (i = S.findByGuid(e.guid, t.context.scene)), i ? (i && i.isComponent === !0 && (ut && console.warn("Deserialized object reference is a component"), i = i.gameObject), ut && console.log("Deserialized object reference?", e, i, t?.nodeToObject)) : ((L() || ut) && console.warn("Could not resolve object reference", t.path, e, t.target, t.context.scene), e.could_not_resolve = !0), i;
15205
15219
  }
15206
15220
  }
15207
15221
  }
@@ -15226,7 +15240,7 @@ class rk extends Qi {
15226
15240
  let n = this.findObjectForGuid(e.guid, t.root);
15227
15241
  if (n || t.context && (n = this.findObjectForGuid(e.guid, t.context?.scene), n))
15228
15242
  return n;
15229
- (D() || ut) && console.warn('Could not resolve component reference: "' + i + '" using guid ' + e.guid, t.target), e.could_not_resolve = !0;
15243
+ (L() || ut) && console.warn('Could not resolve component reference: "' + i + '" using guid ' + e.guid, t.target), e.could_not_resolve = !0;
15230
15244
  return;
15231
15245
  }
15232
15246
  }
@@ -15293,7 +15307,7 @@ Could not find method ${r.method} on object ${l.name}`, l, typeof l[r.method]);
15293
15307
  }
15294
15308
  p = Object.getPrototypeOf(p);
15295
15309
  }
15296
- !f && (D() || ut) && h();
15310
+ !f && (L() || ut) && h();
15297
15311
  }
15298
15312
  }
15299
15313
  if (l) {
@@ -15305,7 +15319,7 @@ Could not find method ${r.method} on object ${l.name}`, l, typeof l[r.method]);
15305
15319
  const f = new Zs(l, r.method, h, r.enabled);
15306
15320
  i.push(f);
15307
15321
  }
15308
- } else D() && console.warn(`[Dev] EventList: Could not find event listener in scene (${t.object?.name})`, r);
15322
+ } else L() && console.warn(`[Dev] EventList: Could not find event listener in scene (${t.object?.name})`, r);
15309
15323
  }
15310
15324
  const n = new ue(i);
15311
15325
  ut && console.log(n);
@@ -15345,16 +15359,16 @@ Te.prototype.clone = function() {
15345
15359
  };
15346
15360
  class ck extends Qi {
15347
15361
  constructor() {
15348
- super([ps, jn]);
15362
+ super([fs, jn]);
15349
15363
  }
15350
15364
  onSerialize(e, t) {
15351
15365
  }
15352
15366
  onDeserialize(e, t) {
15353
- if (e instanceof Te && t.type === ps) {
15367
+ if (e instanceof Te && t.type === fs) {
15354
15368
  let i = e;
15355
15369
  gd.has(i) && (i = gd.get(i)), i.isRenderTargetTexture = !0, i.flipY = !0, i.offset.y = 1, i.repeat.y = -1, i.needsUpdate = !0, i.mipmaps = [], i instanceof px && (i.isCompressedTexture = !1, i.format = zd);
15356
- const n = new ps(i.image.width, i.image.height, {
15357
- colorSpace: Cs
15370
+ const n = new fs(i.image.width, i.image.height, {
15371
+ colorSpace: Ss
15358
15372
  });
15359
15373
  return n.texture = i, n;
15360
15374
  }
@@ -15401,7 +15415,7 @@ class Hi extends Ma {
15401
15415
  if (!this.targets) return null;
15402
15416
  e ??= new _r(), e.targets = this.targets, e.results = this.raycastHits, e.useAcceleratedRaycast = !0;
15403
15417
  const t = e.testObject;
15404
- this.ignoreSkinnedMeshes && (e.testObject = (n) => n instanceof _s ? "continue in children" : t ? t(n) : !0);
15418
+ this.ignoreSkinnedMeshes && (e.testObject = (n) => n instanceof ys ? "continue in children" : t ? t(n) : !0);
15405
15419
  const i = this.context.physics.raycast(e);
15406
15420
  return e.testObject = t, i;
15407
15421
  }
@@ -15790,7 +15804,7 @@ class ei extends R {
15790
15804
  const n = this._capturedPointer[i] || [];
15791
15805
  n.push(t), this._capturedPointer[i] = n;
15792
15806
  } else
15793
- D() && !t.z__warned_no_pointermove && (t.z__warned_no_pointermove = !0, console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"));
15807
+ L() && !t.z__warned_no_pointermove && (t.z__warned_no_pointermove = !0, console.warn("PointerCapture was requested but the component doesn't implement onPointerMove. It will not receive any pointer events"));
15794
15808
  } else e.z__pointer_cture_rleased && (e.z__pointer_cture_rleased = !1, this.releasePointerCapture(e, t));
15795
15809
  }
15796
15810
  /** removes the component from the pointer capture list */
@@ -16234,9 +16248,9 @@ class ye extends R {
16234
16248
  */
16235
16249
  setCameraAndLookTarget(e, t = !1) {
16236
16250
  if (!e)
16237
- return (D() || Ii) && console.warn("[OrbitControls] setCameraAndLookTarget target is null"), !1;
16251
+ return (L() || Ii) && console.warn("[OrbitControls] setCameraAndLookTarget target is null"), !1;
16238
16252
  if (!(e instanceof M) && !(e instanceof fi))
16239
- return (D() || Ii) && console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"), !1;
16253
+ return (L() || Ii) && console.warn("[OrbitControls] setCameraAndLookTarget target is not an Object3D or Camera"), !1;
16240
16254
  e instanceof fi && (e = e.gameObject);
16241
16255
  const i = e.worldPosition, n = e.worldForward;
16242
16256
  e instanceof mx && (Ii && console.debug("[OrbitControls] setCameraAndLookTarget flip forward direction for camera"), n.multiplyScalar(-1));
@@ -16362,15 +16376,15 @@ class ye extends R {
16362
16376
  cl && console.log("Fit camera to objects", { fitHeightDistance: _, fitWidthDistance: x, distance: I, verticalFov: m, horizontalFov: v }), this.maxZoom = I * 10, this.minZoom = I * 0.01;
16363
16377
  const O = 0.05, k = f.clone();
16364
16378
  if (k.y -= d.y * O, t.targetOffset && (t.targetOffset.x !== void 0 && (k.x += t.targetOffset.x), t.targetOffset.y !== void 0 && (k.y += t.targetOffset.y), t.targetOffset.z !== void 0 && (k.z += t.targetOffset.z)), t.relativeTargetOffset && (t.relativeTargetOffset.x !== void 0 && (k.x += t.relativeTargetOffset.x * d.x), t.relativeTargetOffset.y !== void 0 && (k.y += t.relativeTargetOffset.y * d.y), t.relativeTargetOffset.z !== void 0 && (k.z += t.relativeTargetOffset.z * d.z)), this.setLookTargetPosition(k, r), this.setFieldOfView(t.fov, r), l == null || l == "auto") {
16365
- const W = S.findObjectOfType(Ts), X = W ? W.radius : 0, A = Math.max(b.x, b.y, b.z, X);
16379
+ const W = S.findObjectOfType(Rs), X = W ? W.radius : 0, A = Math.max(b.x, b.y, b.z, X);
16366
16380
  n.near = I / 100, n.far = A + I * 10, n.updateProjectionMatrix(), W && (this.maxZoom = Math.max(Math.min(this.maxZoom, X * 0.5), I));
16367
16381
  }
16368
16382
  const E = o.getDistance();
16369
16383
  E < this.minZoom && (this.minZoom = E * 0.9), E > this.maxZoom && (this.maxZoom = E * 1.1);
16370
16384
  const B = f.clone();
16371
16385
  t.fitDirection ? B.sub(new y().copy(t.fitDirection).multiplyScalar(1e6)) : B.sub(n.worldPosition), a === "y" && (B.y = 0), B.normalize(), B.multiplyScalar(I), a === "y" && (B.y += -O * 4 * I);
16372
- let L = f.clone().sub(B);
16373
- t.cameraOffset && (t.cameraOffset.x !== void 0 && (L.x += t.cameraOffset.x), t.cameraOffset.y !== void 0 && (L.y += t.cameraOffset.y), t.cameraOffset.z !== void 0 && (L.z += t.cameraOffset.z)), t.relativeCameraOffset && (t.relativeCameraOffset.x !== void 0 && (L.x += t.relativeCameraOffset.x * d.x), t.relativeCameraOffset.y !== void 0 && (L.y += t.relativeCameraOffset.y * d.y), t.relativeCameraOffset.z !== void 0 && (L.z += t.relativeCameraOffset.z * d.z)), n.parent && (L = n.parent.worldToLocal(L)), this.setCameraTargetPosition(L, r), (cl || t.debug) && (z.DrawWireBox3(p, 16777011, 10), z.DrawWireBox3(g, 65280, 10), !this._haveAttachedKeyboardEvents && cl && (this._haveAttachedKeyboardEvents = !0, document.body.addEventListener("keydown", (W) => {
16386
+ let D = f.clone().sub(B);
16387
+ t.cameraOffset && (t.cameraOffset.x !== void 0 && (D.x += t.cameraOffset.x), t.cameraOffset.y !== void 0 && (D.y += t.cameraOffset.y), t.cameraOffset.z !== void 0 && (D.z += t.cameraOffset.z)), t.relativeCameraOffset && (t.relativeCameraOffset.x !== void 0 && (D.x += t.relativeCameraOffset.x * d.x), t.relativeCameraOffset.y !== void 0 && (D.y += t.relativeCameraOffset.y * d.y), t.relativeCameraOffset.z !== void 0 && (D.z += t.relativeCameraOffset.z * d.z)), n.parent && (D = n.parent.worldToLocal(D)), this.setCameraTargetPosition(D, r), (cl || t.debug) && (z.DrawWireBox3(p, 16777011, 10), z.DrawWireBox3(g, 65280, 10), !this._haveAttachedKeyboardEvents && cl && (this._haveAttachedKeyboardEvents = !0, document.body.addEventListener("keydown", (W) => {
16374
16388
  if (W.code === "KeyF") {
16375
16389
  let X;
16376
16390
  this._cameraObject instanceof me && (X = Math.random() * Math.random() * 170 + 10), this.fitCamera({ objects: i, fitOffset: c, immediate: !1, fov: X });
@@ -16826,7 +16840,7 @@ Gt([
16826
16840
  u(oe)
16827
16841
  ], Dt.prototype, "backgroundColor", 1);
16828
16842
  Gt([
16829
- u(ps)
16843
+ u(fs)
16830
16844
  ], Dt.prototype, "targetTexture", 1);
16831
16845
  let fi = Dt;
16832
16846
  class bk {
@@ -16847,7 +16861,7 @@ class bk {
16847
16861
  this._did_log_failed_to_find_skybox || (this._did_log_failed_to_find_skybox = !0, console.warn(`Camera "${this._camera.name}" has no skybox texture. ${this._camera.sourceId}`));
16848
16862
  else if (this.context.scene.background !== this._skybox) {
16849
16863
  const e = this.context.domElement.getAttribute("background-image") || this.context.domElement.getAttribute("background-color");
16850
- Qs && console.debug(`[Camera] Apply Skybox ${this._skybox?.name} ${e} - "${this._camera.name}"`), e?.length || (this._skybox.mapping = bs, this.context.scene.background = this._skybox);
16864
+ Qs && console.debug(`[Camera] Apply Skybox ${this._skybox?.name} ${e} - "${this._camera.name}"`), e?.length || (this._skybox.mapping = _s, this.context.scene.background = this._skybox);
16851
16865
  }
16852
16866
  }
16853
16867
  }
@@ -17159,7 +17173,7 @@ const vt = w("debugaudio"), Yi = class Ys extends R {
17159
17173
  * @param clip - Optional audio clip or {@link MediaStream} to play
17160
17174
  */
17161
17175
  play(e = void 0) {
17162
- !e && this.clip && (e = this.clip), e !== void 0 && typeof e != "string" && !(e instanceof MediaStream) && (D() && console.warn("Called play on AudioSource with unknown argument type:", e + `
17176
+ !e && this.clip && (e = this.clip), e !== void 0 && typeof e != "string" && !(e instanceof MediaStream) && (L() && console.warn("Called play on AudioSource with unknown argument type:", e + `
17163
17177
  Using the assigned clip instead:`, this.clip), e = this.clip);
17164
17178
  let t = !this.sound || e && e !== this.clip;
17165
17179
  if (typeof e == "string" && !this.audioLoader && (t = !0), (e instanceof MediaStream || typeof e == "string") && (this.clip = e), t) {
@@ -17395,7 +17409,7 @@ class Rk {
17395
17409
  }
17396
17410
  }
17397
17411
  const Le = w("debugnetworkingstreams");
17398
- var ms = /* @__PURE__ */ ((s) => (s.Connected = "peer-user-connected", s.StreamReceived = "receive-stream", s.StreamEnded = "call-ended", s.Disconnected = "peer-user-disconnected", s.UserJoined = "user-joined", s))(ms || {});
17412
+ var ps = /* @__PURE__ */ ((s) => (s.Connected = "peer-user-connected", s.StreamReceived = "receive-stream", s.StreamEnded = "call-ended", s.Disconnected = "peer-user-disconnected", s.UserJoined = "user-joined", s))(ps || {});
17399
17413
  class Z0 {
17400
17414
  type = "call-ended";
17401
17415
  userId;
@@ -17435,7 +17449,7 @@ class Ik extends bm {
17435
17449
  _stream = null;
17436
17450
  _isDisposed = !1;
17437
17451
  close() {
17438
- this._isDisposed || (this._isDisposed = !0, this.call.close(), gs(this._stream));
17452
+ this._isDisposed || (this._isDisposed = !0, this.call.close(), ms(this._stream));
17439
17453
  }
17440
17454
  get isOpen() {
17441
17455
  return this.call.peerConnection?.connectionState === "connected";
@@ -17770,7 +17784,7 @@ class ru extends bm {
17770
17784
  }
17771
17785
  // const call = peer.call(peerId, stream);
17772
17786
  }
17773
- function gs(s) {
17787
+ function ms(s) {
17774
17788
  if (s && s instanceof MediaStream)
17775
17789
  for (const e of s.getTracks())
17776
17790
  e.stop();
@@ -17810,11 +17824,11 @@ class wr extends R {
17810
17824
  }
17811
17825
  /** @internal */
17812
17826
  onEnable() {
17813
- this._net || (this._net = ru.create(this)), this.debug && (this._net.debug = !0), this._net.addEventListener(ms.StreamReceived, this.onReceiveStream), this._net.addEventListener(ms.StreamEnded, this.onStreamEnded), this._net.enable(), this.autoConnect && this.context.connection.isConnected && this.connect(), this.context.connection.beginListen(ee.JoinedRoom, this.onJoinedRoom), this.context.connection.beginListen(ee.LeftRoom, this.onLeftRoom), this.onEnabledChanged(), this.updateButton(), window.addEventListener("visibilitychange", this.onVisibilityChanged);
17827
+ this._net || (this._net = ru.create(this)), this.debug && (this._net.debug = !0), this._net.addEventListener(ps.StreamReceived, this.onReceiveStream), this._net.addEventListener(ps.StreamEnded, this.onStreamEnded), this._net.enable(), this.autoConnect && this.context.connection.isConnected && this.connect(), this.context.connection.beginListen(ee.JoinedRoom, this.onJoinedRoom), this.context.connection.beginListen(ee.LeftRoom, this.onLeftRoom), this.onEnabledChanged(), this.updateButton(), window.addEventListener("visibilitychange", this.onVisibilityChanged);
17814
17828
  }
17815
17829
  /** @internal */
17816
17830
  onDisable() {
17817
- this._net && (this._net.stopSendingStream(this._outputStream), this._net.removeEventListener(ms.StreamReceived, this.onReceiveStream), this._net.removeEventListener(ms.StreamEnded, this.onStreamEnded), this._net?.disable()), this.context.connection.stopListen(ee.JoinedRoom, this.onJoinedRoom), this.context.connection.stopListen(ee.LeftRoom, this.onLeftRoom), this.onEnabledChanged(), this.updateButton(), window.removeEventListener("visibilitychange", this.onVisibilityChanged);
17831
+ this._net && (this._net.stopSendingStream(this._outputStream), this._net.removeEventListener(ps.StreamReceived, this.onReceiveStream), this._net.removeEventListener(ps.StreamEnded, this.onStreamEnded), this._net?.disable()), this.context.connection.stopListen(ee.JoinedRoom, this.onJoinedRoom), this.context.connection.stopListen(ee.LeftRoom, this.onLeftRoom), this.onEnabledChanged(), this.updateButton(), window.removeEventListener("visibilitychange", this.onVisibilityChanged);
17818
17832
  }
17819
17833
  /** @internal */
17820
17834
  onDestroy() {
@@ -17837,11 +17851,11 @@ class wr extends R {
17837
17851
  if (!await q.microphonePermissionsGranted())
17838
17852
  return console.error("Cannot connect to voice chat - microphone permissions not granted"), this.updateButton(), !1;
17839
17853
  } else return console.error("Cannot connect to voice chat - not connected to server"), this.updateButton(), !1;
17840
- return this._allowSending = !0, this._net?.stopSendingStream(this._outputStream), gs(this._outputStream), this._outputStream = await this.getAudioStream(e), this._outputStream ? (this.debug && console.log("VOIP: Got audio stream"), this._net?.startSendingStream(this._outputStream), this.updateButton(), !0) : (this.updateButton(), await q.microphonePermissionsGranted() ? console.error("VOIP: Could not get audio stream - please make sure to connect an audio device and grant microphone permissions") : Xd("Microphone permissions not granted: Please grant microphone permissions to use voice chat"), (this.debug || D()) && console.log("VOIP: Failed to get audio stream"), !1);
17854
+ return this._allowSending = !0, this._net?.stopSendingStream(this._outputStream), ms(this._outputStream), this._outputStream = await this.getAudioStream(e), this._outputStream ? (this.debug && console.log("VOIP: Got audio stream"), this._net?.startSendingStream(this._outputStream), this.updateButton(), !0) : (this.updateButton(), await q.microphonePermissionsGranted() ? console.error("VOIP: Could not get audio stream - please make sure to connect an audio device and grant microphone permissions") : Xd("Microphone permissions not granted: Please grant microphone permissions to use voice chat"), (this.debug || L()) && console.log("VOIP: Failed to get audio stream"), !1);
17841
17855
  }
17842
17856
  /** Stop sending audio (muting your own microphone) */
17843
17857
  disconnect(e) {
17844
- e?.remember && (this._allowSending = !1), this._net?.stopSendingStream(this._outputStream), gs(this._outputStream), this._outputStream = null, this.updateButton();
17858
+ e?.remember && (this._allowSending = !1), this._net?.stopSendingStream(this._outputStream), ms(this._outputStream), this._outputStream = null, this.updateButton();
17845
17859
  }
17846
17860
  /**
17847
17861
  * Mute or unmute the audio stream (this will only mute incoming streams and not mute your own microphone. Use disconnect() to mute your own microphone)
@@ -17878,7 +17892,7 @@ class wr extends R {
17878
17892
  // private _analyzer?: AudioAnalyser;
17879
17893
  /** @deprecated */
17880
17894
  getFrequency(e) {
17881
- return this.unsupported_getfrequency || (this.unsupported_getfrequency = !0, D() && ge("VOIP: getFrequency is currently not supported"), console.warn("VOIP: getFrequency is currently not supported")), null;
17895
+ return this.unsupported_getfrequency || (this.unsupported_getfrequency = !0, L() && ge("VOIP: getFrequency is currently not supported"), console.warn("VOIP: getFrequency is currently not supported")), null;
17882
17896
  }
17883
17897
  async getAudioStream(e) {
17884
17898
  if (!navigator.mediaDevices.getUserMedia)
@@ -17896,12 +17910,12 @@ class wr extends R {
17896
17910
  }
17897
17911
  // we have to wait for the user to connect to a room when "auto connect" is enabled
17898
17912
  onJoinedRoom = async () => {
17899
- this.debug && console.log("VOIP: Joined room"), await ks(300), this.autoConnect && !this.isSending && this._allowSending && this.connect();
17913
+ this.debug && console.log("VOIP: Joined room"), await Os(300), this.autoConnect && !this.isSending && this._allowSending && this.connect();
17900
17914
  };
17901
17915
  onLeftRoom = () => {
17902
17916
  this.debug && console.log("VOIP: Left room"), this.disconnect();
17903
17917
  for (const e of this._incomingStreams.values())
17904
- gs(e.srcObject);
17918
+ ms(e.srcObject);
17905
17919
  this._incomingStreams.clear();
17906
17920
  };
17907
17921
  _incomingStreams = /* @__PURE__ */ new Map();
@@ -17916,7 +17930,7 @@ class wr extends R {
17916
17930
  };
17917
17931
  onStreamEnded = (e) => {
17918
17932
  const t = this._incomingStreams.get(e.userId);
17919
- gs(t?.srcObject), this._incomingStreams.delete(e.userId);
17933
+ ms(t?.srcObject), this._incomingStreams.delete(e.userId);
17920
17934
  };
17921
17935
  onEnabledChanged = () => {
17922
17936
  for (const e of this._incomingStreams) {
@@ -18034,7 +18048,7 @@ var zk = Object.defineProperty, Uk = (s, e, t, i) => {
18034
18048
  };
18035
18049
  const Vr = w("debugxrflags"), tv = w("disablexrflags");
18036
18050
  tv && console.warn("XRFlags are disabled");
18037
- var fs = /* @__PURE__ */ ((s) => (s[s.Never = 0] = "Never", s[s.Browser = 1] = "Browser", s[s.AR = 2] = "AR", s[s.VR = 4] = "VR", s[s.FirstPerson = 8] = "FirstPerson", s[s.ThirdPerson = 16] = "ThirdPerson", s[s.All = 4294967295] = "All", s))(fs || {});
18051
+ var us = /* @__PURE__ */ ((s) => (s[s.Never = 0] = "Never", s[s.Browser = 1] = "Browser", s[s.AR = 2] = "AR", s[s.VR = 4] = "VR", s[s.FirstPerson = 8] = "FirstPerson", s[s.ThirdPerson = 16] = "ThirdPerson", s[s.All = 4294967295] = "All", s))(us || {});
18038
18052
  class Jt {
18039
18053
  static Global = new Jt();
18040
18054
  Mask = 17;
@@ -18060,7 +18074,7 @@ class Jt {
18060
18074
  this.Mask = 0, sn.Apply();
18061
18075
  }
18062
18076
  }
18063
- const iv = class ns extends R {
18077
+ const iv = class is extends R {
18064
18078
  static registry = [];
18065
18079
  static Apply() {
18066
18080
  for (const e of this.registry) e.UpdateVisible(Jt.Global);
@@ -18069,14 +18083,14 @@ const iv = class ns extends R {
18069
18083
  static buffer = new Jt();
18070
18084
  visibleIn;
18071
18085
  awake() {
18072
- ns.registry.push(this);
18086
+ is.registry.push(this);
18073
18087
  }
18074
18088
  onEnable() {
18075
- ns.firstApply ? this.UpdateVisible(Jt.Global) : (ns.firstApply = !0, ns.Apply());
18089
+ is.firstApply ? this.UpdateVisible(Jt.Global) : (is.firstApply = !0, is.Apply());
18076
18090
  }
18077
18091
  onDestroy() {
18078
- const e = ns.registry.indexOf(this);
18079
- e >= 0 && ns.registry.splice(e, 1);
18092
+ const e = is.registry.indexOf(this);
18093
+ e >= 0 && is.registry.splice(e, 1);
18080
18094
  }
18081
18095
  get isOn() {
18082
18096
  return this.gameObject.visible;
@@ -18086,7 +18100,7 @@ const iv = class ns extends R {
18086
18100
  return;
18087
18101
  let t;
18088
18102
  const i = e;
18089
- if (i && typeof i == "number" && (console.assert(typeof i == "number", "XRFlag.UpdateVisible: state must be a number", i), Vr && console.log(i), ns.buffer.Mask = i, e = ns.buffer), e instanceof Jt ? (Vr && console.warn(this.name, "use passed in mask", e.Mask, this.visibleIn), t = e.Has(this.visibleIn)) : (Vr && console.log(this.name, "use global mask"), Jt.Global.Has(this.visibleIn)), t !== void 0)
18103
+ if (i && typeof i == "number" && (console.assert(typeof i == "number", "XRFlag.UpdateVisible: state must be a number", i), Vr && console.log(i), is.buffer.Mask = i, e = is.buffer), e instanceof Jt ? (Vr && console.warn(this.name, "use passed in mask", e.Mask, this.visibleIn), t = e.Has(this.visibleIn)) : (Vr && console.log(this.name, "use global mask"), Jt.Global.Has(this.visibleIn)), t !== void 0)
18090
18104
  if (t)
18091
18105
  Vr && console.log(this.name, "is visible", this.gameObject.uuid), S.setActive(this.gameObject, !0);
18092
18106
  else {
@@ -18278,7 +18292,7 @@ class Pt extends R {
18278
18292
  if (this.box || (this.box = new mi()), e || this.context.time.frameCount != this._lastMatrixUpdateFrame) {
18279
18293
  const t = this._lastMatrixUpdateFrame < 0;
18280
18294
  this._lastMatrixUpdateFrame = this.context.time.frameCount;
18281
- const i = t, n = Z(this.gameObject, Pt._position, i), o = $e(this.gameObject, Pt._size);
18295
+ const i = t, n = Z(this.gameObject, Pt._position, i), o = We(this.gameObject, Pt._size);
18282
18296
  this.box.setFromCenterAndSize(n, o);
18283
18297
  }
18284
18298
  return this.box;
@@ -18469,7 +18483,7 @@ class xr extends xi {
18469
18483
  this.sharedMesh?.isMesh || (this.gameObject instanceof H || this.gameObject instanceof oo) && (this.sharedMesh = this.gameObject);
18470
18484
  const e = 0;
18471
18485
  if (this.sharedMesh?.isMesh)
18472
- this.context.physics.engine.addMeshCollider(this, this.sharedMesh, this.convex), We.assignMeshLOD(this.sharedMesh, e).then((t) => {
18486
+ this.context.physics.engine.addMeshCollider(this, this.sharedMesh, this.convex), Ve.assignMeshLOD(this.sharedMesh, e).then((t) => {
18473
18487
  t && this.activeAndEnabled && this.context.physics.engine && this.sharedMesh && (this.context.physics.engine.removeBody(this), this.sharedMesh.geometry = t, this.context.physics.engine.addMeshCollider(this, this.sharedMesh, this.convex));
18474
18488
  });
18475
18489
  else {
@@ -18479,7 +18493,7 @@ class xr extends xi {
18479
18493
  const i = new Array();
18480
18494
  for (const n in t.children) {
18481
18495
  const o = t.children[n];
18482
- o.isMesh && (this.context.physics.engine.addMeshCollider(this, o, this.convex), i.push(We.assignMeshLOD(o, e)));
18496
+ o.isMesh && (this.context.physics.engine.addMeshCollider(this, o, this.convex), i.push(Ve.assignMeshLOD(o, e)));
18483
18497
  }
18484
18498
  Promise.all(i).then((n) => {
18485
18499
  if (n.some((r) => r) == !1) return;
@@ -18489,7 +18503,7 @@ class xr extends xi {
18489
18503
  r && this.activeAndEnabled && (o.geometry = r, this.context.physics.engine?.addMeshCollider(this, o, this.convex));
18490
18504
  });
18491
18505
  } else
18492
- (D() || w("showcolliders")) && console.warn(`[MeshCollider] A MeshCollider mesh is assigned to an unknown object on "${this.gameObject.name}", but it's neither a Mesh nor a Group. Please double check that you attached the collider component to the right object and report a bug otherwise!`, this);
18506
+ (L() || w("showcolliders")) && console.warn(`[MeshCollider] A MeshCollider mesh is assigned to an unknown object on "${this.gameObject.name}", but it's neither a Mesh nor a Group. Please double check that you attached the collider component to the right object and report a bug otherwise!`, this);
18493
18507
  }
18494
18508
  }
18495
18509
  }
@@ -18519,7 +18533,7 @@ ii([
18519
18533
  ii([
18520
18534
  u()
18521
18535
  ], po.prototype, "height");
18522
- var qk = Object.defineProperty, Es = (s, e, t, i) => {
18536
+ var qk = Object.defineProperty, Ts = (s, e, t, i) => {
18523
18537
  for (var n = void 0, o = s.length - 1, r; o >= 0; o--)
18524
18538
  (r = s[o]) && (n = r(e, t, n) || n);
18525
18539
  return n && qk(e, t, n), n;
@@ -18568,13 +18582,13 @@ class Da extends R {
18568
18582
  return this._contactVelocity;
18569
18583
  }
18570
18584
  }
18571
- Es([
18585
+ Ts([
18572
18586
  u(y)
18573
18587
  ], Da.prototype, "center");
18574
- Es([
18588
+ Ts([
18575
18589
  u()
18576
18590
  ], Da.prototype, "radius");
18577
- Es([
18591
+ Ts([
18578
18592
  u()
18579
18593
  ], Da.prototype, "height");
18580
18594
  class _o extends R {
@@ -18638,22 +18652,22 @@ class _o extends R {
18638
18652
  }
18639
18653
  _raycastOptions = new _r();
18640
18654
  }
18641
- Es([
18655
+ Ts([
18642
18656
  u(Da)
18643
18657
  ], _o.prototype, "controller");
18644
- Es([
18658
+ Ts([
18645
18659
  u()
18646
18660
  ], _o.prototype, "movementSpeed");
18647
- Es([
18661
+ Ts([
18648
18662
  u()
18649
18663
  ], _o.prototype, "rotationSpeed");
18650
- Es([
18664
+ Ts([
18651
18665
  u()
18652
18666
  ], _o.prototype, "jumpForce");
18653
- Es([
18667
+ Ts([
18654
18668
  u()
18655
18669
  ], _o.prototype, "doubleJumpForce");
18656
- Es([
18670
+ Ts([
18657
18671
  u(It)
18658
18672
  ], _o.prototype, "animator");
18659
18673
  var Xk = Object.defineProperty, ja = (s, e, t, i) => {
@@ -18752,7 +18766,7 @@ const Sr = class Tl extends R {
18752
18766
  start() {
18753
18767
  hl && console.log("Create ContactShadows on " + this.gameObject.name, this), this.gameObject.add(this.shadowsRoot), this.shadowsRoot.add(this.shadowGroup), this.renderTarget = new jn(this.textureSize, this.textureSize), this.renderTarget.texture.generateMipmaps = !1, this.renderTargetBlur = new jn(this.textureSize, this.textureSize), this.renderTargetBlur.texture.generateMipmaps = !1;
18754
18768
  const e = new Nn(1, 1).rotateX(Math.PI / 2);
18755
- this.gameObject instanceof H && (console.warn("ContactShadows can not be added to a Mesh. Please add it to a Group or an empty Object"), ds(this.gameObject, !1));
18769
+ this.gameObject instanceof H && (console.warn("ContactShadows can not be added to a Mesh. Please add it to a Group or an empty Object"), hs(this.gameObject, !1));
18756
18770
  const t = new we({
18757
18771
  map: this.renderTarget.texture,
18758
18772
  opacity: this.opacity,
@@ -18798,7 +18812,7 @@ const Sr = class Tl extends R {
18798
18812
  const t = this.context.scene, i = this.context.renderer, n = i.getRenderTarget();
18799
18813
  this.shadowGroup.visible = !0, this.occluderMesh && (this.occluderMesh.visible = !1);
18800
18814
  const o = this.plane.visible;
18801
- this.plane.visible = !1, this.gameObject instanceof H && ds(this.gameObject, !1);
18815
+ this.plane.visible = !1, this.gameObject instanceof H && hs(this.gameObject, !1);
18802
18816
  const r = t.background;
18803
18817
  t.background = null, t.overrideMaterial = this.depthMaterial, this.backfaceShadows ? this.depthMaterial.side = _i : this.depthMaterial.side = fo;
18804
18818
  const a = i.getClearAlpha();
@@ -19427,9 +19441,9 @@ class Tf {
19427
19441
  const O = this._draggedOverObjectDuration >= 0.15, E = this._totalMovement.length() >= 1e-3, B = G(x.normal || x.face.normal).applyQuaternion(x.object.worldQuaternion);
19428
19442
  if ((O || E) && (this._draggedOverObjectLastSetUp !== this._draggedOverObject || this._draggedOverObjectLastNormal.dot(B) < 0.999999 || this.context.time.frame % 60 === 0)) {
19429
19443
  this._draggedOverObjectLastSetUp = this._draggedOverObject, this._draggedOverObjectLastNormal.copy(x.face.normal);
19430
- const L = G(), W = G();
19431
- this._bounds.getCenter(L), this._bounds.getSize(W), L.sub(W.multiplyScalar(0.5).multiply(B)), this._hitPointInLocalSpace.copy(L), this._hitNormalInLocalSpace.copy(x.face.normal), this._bounds.getCenter(L), this._bounds.getSize(W), L.add(W.multiplyScalar(0.5).multiply(x.face.normal));
19432
- const X = G(this._hitPointInLocalSpace).add(L);
19444
+ const D = G(), W = G();
19445
+ this._bounds.getCenter(D), this._bounds.getSize(W), D.sub(W.multiplyScalar(0.5).multiply(B)), this._hitPointInLocalSpace.copy(D), this._hitNormalInLocalSpace.copy(x.face.normal), this._bounds.getCenter(D), this._bounds.getSize(W), D.add(W.multiplyScalar(0.5).multiply(x.face.normal));
19446
+ const X = G(this._hitPointInLocalSpace).add(D);
19433
19447
  this._followObject.localToWorld(X);
19434
19448
  const A = x.point;
19435
19449
  this._dragPlane.setFromNormalAndCoplanarPoint(B, A);
@@ -19793,7 +19807,7 @@ function nM(s, e, t) {
19793
19807
  if (r)
19794
19808
  return Yl && console.debug(`Mimetype callback returned: ${r}`), r;
19795
19809
  }
19796
- if (D() || Yl) {
19810
+ if (L() || Yl) {
19797
19811
  const o = new TextDecoder().decode(e.slice(0, Math.min(e.byteLength, 32)));
19798
19812
  console.warn(`Could not determine file type.
19799
19813
 
@@ -20086,7 +20100,7 @@ class vo extends R {
20086
20100
  recursive: !0,
20087
20101
  testObject: (n) => !this._addedObjects.includes(n)
20088
20102
  }).length)
20089
- return D() && console.log(`Dropped outside of drop area for DropListener "${this.name}".`), !1;
20103
+ return L() && console.log(`Dropped outside of drop area for DropListener "${this.name}".`), !1;
20090
20104
  }
20091
20105
  return !0;
20092
20106
  }
@@ -20194,7 +20208,7 @@ const uu = class uv extends R {
20194
20208
  const t = this.handleDuplication();
20195
20209
  if (t) {
20196
20210
  const i = S.getComponent(t, Yr);
20197
- i ? (i.onPointerDown(e), this._forwardPointerEvents.set(e.event.space, i)) : D() && console.warn(`Duplicated object (${t.name}) does not have DragControls`);
20211
+ i ? (i.onPointerDown(e), this._forwardPointerEvents.set(e.event.space, i)) : L() && console.warn(`Duplicated object (${t.name}) does not have DragControls`);
20198
20212
  } else
20199
20213
  this._currentCount >= this.limitCount ? console.warn(`[Duplicatable] Limit of ${this.limitCount} objects created within a few seconds reached. Please wait a moment before creating more objects.`) : console.warn("[Duplicatable] Could not duplicate object.");
20200
20214
  }
@@ -20229,7 +20243,7 @@ lg([
20229
20243
  u()
20230
20244
  ], uu.prototype, "limitCount");
20231
20245
  let fv = uu;
20232
- var ss = /* @__PURE__ */ ((s) => (s[s.PointerEnter = 0] = "PointerEnter", s[s.PointerExit = 1] = "PointerExit", s[s.PointerDown = 2] = "PointerDown", s[s.PointerUp = 3] = "PointerUp", s[s.PointerClick = 4] = "PointerClick", s[s.Drag = 5] = "Drag", s[s.Drop = 6] = "Drop", s[s.Scroll = 7] = "Scroll", s[s.UpdateSelected = 8] = "UpdateSelected", s[s.Select = 9] = "Select", s[s.Deselect = 10] = "Deselect", s[s.Move = 11] = "Move", s[s.InitializePotentialDrag = 12] = "InitializePotentialDrag", s[s.BeginDrag = 13] = "BeginDrag", s[s.EndDrag = 14] = "EndDrag", s[s.Submit = 15] = "Submit", s[s.Cancel = 16] = "Cancel", s))(ss || {}), cM = Object.defineProperty, cg = (s, e, t, i) => {
20246
+ var ns = /* @__PURE__ */ ((s) => (s[s.PointerEnter = 0] = "PointerEnter", s[s.PointerExit = 1] = "PointerExit", s[s.PointerDown = 2] = "PointerDown", s[s.PointerUp = 3] = "PointerUp", s[s.PointerClick = 4] = "PointerClick", s[s.Drag = 5] = "Drag", s[s.Drop = 6] = "Drop", s[s.Scroll = 7] = "Scroll", s[s.UpdateSelected = 8] = "UpdateSelected", s[s.Select = 9] = "Select", s[s.Deselect = 10] = "Deselect", s[s.Move = 11] = "Move", s[s.InitializePotentialDrag = 12] = "InitializePotentialDrag", s[s.BeginDrag = 13] = "BeginDrag", s[s.EndDrag = 14] = "EndDrag", s[s.Submit = 15] = "Submit", s[s.Cancel = 16] = "Cancel", s))(ns || {}), cM = Object.defineProperty, cg = (s, e, t, i) => {
20233
20247
  for (var n = void 0, o = s.length - 1, r; o >= 0; o--)
20234
20248
  (r = s[o]) && (n = r(e, t, n) || n);
20235
20249
  return n && cM(e, t, n), n;
@@ -20256,27 +20270,27 @@ class dg extends R {
20256
20270
  return this.triggers?.some((t) => t.eventID === e) ?? !1;
20257
20271
  }
20258
20272
  shouldChangeCursor() {
20259
- return this.hasTrigger(ss.PointerClick) || this.hasTrigger(ss.PointerDown) || this.hasTrigger(ss.PointerUp);
20273
+ return this.hasTrigger(ns.PointerClick) || this.hasTrigger(ns.PointerDown) || this.hasTrigger(ns.PointerUp);
20260
20274
  }
20261
20275
  /** @internal */
20262
20276
  onPointerClick(e) {
20263
- this.invoke(ss.PointerClick);
20277
+ this.invoke(ns.PointerClick);
20264
20278
  }
20265
20279
  /** @internal */
20266
20280
  onPointerEnter(e) {
20267
- this.shouldChangeCursor() && this.context.input.setCursor("pointer"), this.invoke(ss.PointerEnter);
20281
+ this.shouldChangeCursor() && this.context.input.setCursor("pointer"), this.invoke(ns.PointerEnter);
20268
20282
  }
20269
20283
  /** @internal */
20270
20284
  onPointerExit(e) {
20271
- this.shouldChangeCursor() && this.context.input.unsetCursor("pointer"), this.invoke(ss.PointerExit);
20285
+ this.shouldChangeCursor() && this.context.input.unsetCursor("pointer"), this.invoke(ns.PointerExit);
20272
20286
  }
20273
20287
  /** @internal */
20274
20288
  onPointerDown(e) {
20275
- this.invoke(ss.PointerDown);
20289
+ this.invoke(ns.PointerDown);
20276
20290
  }
20277
20291
  /** @internal */
20278
20292
  onPointerUp(e) {
20279
- this.invoke(ss.PointerUp);
20293
+ this.invoke(ns.PointerUp);
20280
20294
  }
20281
20295
  }
20282
20296
  cg([
@@ -20917,7 +20931,7 @@ class xM {
20917
20931
  const I = x.substring(10), O = Number.parseInt(I);
20918
20932
  if (O >= 0) {
20919
20933
  const k = await this.parser.getDependency("texture", O);
20920
- k instanceof Te && (k.colorSpace = Cs, k.needsUpdate = !0), d[_] = { value: k };
20934
+ k instanceof Te && (k.colorSpace = Ss, k.needsUpdate = !0), d[_] = { value: k };
20921
20935
  continue;
20922
20936
  }
20923
20937
  }
@@ -21034,7 +21048,7 @@ function _L(s) {
21034
21048
  e >= 0 && lr.splice(e, 1);
21035
21049
  }
21036
21050
  function bv(s) {
21037
- if (s instanceof Os) {
21051
+ if (s instanceof Ps) {
21038
21052
  const e = new gv();
21039
21053
  return s.register((t) => (e.parser = t, e)), e;
21040
21054
  }
@@ -21047,13 +21061,13 @@ class PM {
21047
21061
  }
21048
21062
  async function Vp(s, e, t) {
21049
21063
  const i = t.indexOf("?");
21050
- i >= 0 && (t = t.substring(0, i)), s.register((n) => new mM(n)), s.register((n) => new xP(n)), s.register((n) => new JP(n, e.lightmaps, t)), s.register((n) => new gM(n, t, e)), s.register((n) => new xM(n, t)), s.register((n) => new Js(n, t)), s.register((n) => new We(n)), s.register((n) => new dM(n)), Q1() && s.register((n) => new na(n)), await CM.catch((n) => {
21064
+ i >= 0 && (t = t.substring(0, i)), s.register((n) => new mM(n)), s.register((n) => new xP(n)), s.register((n) => new JP(n, e.lightmaps, t)), s.register((n) => new gM(n, t, e)), s.register((n) => new xM(n, t)), s.register((n) => new Js(n, t)), s.register((n) => new Ve(n)), s.register((n) => new dM(n)), Q1() && s.register((n) => new na(n)), await CM.catch((n) => {
21051
21065
  }), s.register((n) => {
21052
21066
  if (wd) {
21053
21067
  const o = new wd(n);
21054
21068
  return o.setAnimationPointerResolver.bind(o)(new PM()), o;
21055
21069
  } else
21056
- return (SM || D()) && console.error("Missing KHR_animation_pointer extension..."), {
21070
+ return (SM || L()) && console.error("Missing KHR_animation_pointer extension..."), {
21057
21071
  name: "KHR_animation_pointer_NOT_AVAILABLE"
21058
21072
  };
21059
21073
  });
@@ -21096,14 +21110,14 @@ var kM = Object.defineProperty, xv = (s, e, t, i) => {
21096
21110
  (r = s[o]) && (n = r(e, t, n) || n);
21097
21111
  return n && kM(e, t, n), n;
21098
21112
  };
21099
- const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("reflectionProbeKey"), k_ = Symbol("original material"), ug = class os extends R {
21113
+ const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("reflectionProbeKey"), k_ = Symbol("original material"), ug = class ss extends R {
21100
21114
  static _probes = /* @__PURE__ */ new Map();
21101
21115
  static isUsingReflectionProbe(e) {
21102
21116
  return !!(e[Lf] || e[k_]?.[Lf]);
21103
21117
  }
21104
21118
  static get(e, t, i, n) {
21105
21119
  if (!e || e.isObject3D !== !0 || O_) return null;
21106
- const o = os._probes.get(t);
21120
+ const o = ss._probes.get(t);
21107
21121
  if (o) {
21108
21122
  for (const r of o)
21109
21123
  if (r.__didAwake || r.__internalAwake(), r.activeAndEnabled) {
@@ -21123,7 +21137,7 @@ const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("
21123
21137
  console.error("ReflectionProbe.texture must be a Texture", e);
21124
21138
  return;
21125
21139
  }
21126
- this._texture = e, e && (e.mapping = bs, e.colorSpace = Cs, e.needsUpdate = !0);
21140
+ this._texture = e, e && (e.mapping = _s, e.colorSpace = Ss, e.needsUpdate = !0);
21127
21141
  }
21128
21142
  get texture() {
21129
21143
  return this._texture;
@@ -21135,16 +21149,16 @@ const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("
21135
21149
  return this._boxHelper?.isInBox(e);
21136
21150
  }
21137
21151
  constructor() {
21138
- super(), os._probes.has(this.context) || os._probes.set(this.context, []), os._probes.get(this.context)?.push(this);
21152
+ super(), ss._probes.has(this.context) || ss._probes.set(this.context, []), ss._probes.get(this.context)?.push(this);
21139
21153
  }
21140
21154
  awake() {
21141
- this._boxHelper = this.gameObject.addComponent(Pt), this._boxHelper.updateBox(!0), dl && this._boxHelper.showHelper(5592320, !0), this._texture && (this._texture.mapping = bs, this._texture.colorSpace = Cs, this._texture.needsUpdate = !0);
21155
+ this._boxHelper = this.gameObject.addComponent(Pt), this._boxHelper.updateBox(!0), dl && this._boxHelper.showHelper(5592320, !0), this._texture && (this._texture.mapping = _s, this._texture.colorSpace = Ss, this._texture.needsUpdate = !0);
21142
21156
  }
21143
21157
  start() {
21144
- !this._texture && D() && (console.warn(`[ReflectionProbe] Missing texture. Please assign a custom cubemap texture. To use reflection probes assign them to your renderer's "anchor" property.`), ge("ReflectionProbe configuration hint: See browser console for details"));
21158
+ !this._texture && L() && (console.warn(`[ReflectionProbe] Missing texture. Please assign a custom cubemap texture. To use reflection probes assign them to your renderer's "anchor" property.`), ge("ReflectionProbe configuration hint: See browser console for details"));
21145
21159
  }
21146
21160
  onDestroy() {
21147
- const e = os._probes.get(this.context);
21161
+ const e = ss._probes.get(this.context);
21148
21162
  if (e) {
21149
21163
  const t = e.indexOf(this);
21150
21164
  t >= 0 && e.splice(t, 1);
@@ -21156,8 +21170,8 @@ const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("
21156
21170
  static _rendererMaterialsCache = /* @__PURE__ */ new Map();
21157
21171
  onSet(e) {
21158
21172
  if (O_ || !this.enabled || e.sharedMaterials?.length <= 0 || !this.texture) return;
21159
- let t = os._rendererMaterialsCache.get(e);
21160
- t || (t = [], os._rendererMaterialsCache.set(e, t));
21173
+ let t = ss._rendererMaterialsCache.get(e);
21174
+ t || (t = [], ss._rendererMaterialsCache.set(e, t));
21161
21175
  for (let i = 0; i < e.sharedMaterials.length; i++) {
21162
21176
  const n = e.sharedMaterials[i];
21163
21177
  if (!n || n.envMap === void 0 || n instanceof we)
@@ -21184,7 +21198,7 @@ const dl = w("debugreflectionprobe"), O_ = w("noreflectionprobe"), Lf = Symbol("
21184
21198
  }
21185
21199
  }
21186
21200
  onUnset(e) {
21187
- const t = os._rendererMaterialsCache.get(e);
21201
+ const t = ss._rendererMaterialsCache.get(e);
21188
21202
  if (t)
21189
21203
  for (let i = 0; i < t.length; i++) {
21190
21204
  const n = t[i];
@@ -21215,10 +21229,10 @@ class Ta {
21215
21229
  e.applySettings(t);
21216
21230
  const a = this.tryCreateOrAddInstance(t, i, o);
21217
21231
  if (a) {
21218
- n === null && (n = []), n.push(a), We.assignTextureLOD(a.renderer.material, 0);
21232
+ n === null && (n = []), n.push(a), Ve.assignTextureLOD(a.renderer.material, 0);
21219
21233
  for (let l = 0; l < e.sharedMeshes.length; l++) {
21220
21234
  const c = e.sharedMeshes[l], h = c.geometry;
21221
- We.assignMeshLOD(c, 0).then((d) => {
21235
+ Ve.assignMeshLOD(c, 0).then((d) => {
21222
21236
  d && e.activeAndEnabled && h != d && a.setGeometry(d);
21223
21237
  });
21224
21238
  }
@@ -21329,7 +21343,7 @@ class ha {
21329
21343
  return i(`Instancing: Can not update geometry (${this.name}), reserved index range is too small: ${this.__reservedIndexRange.toLocaleString()} < ${this.indexCount.toLocaleString()} indices for ${this.name}`);
21330
21344
  return this.renderer.updateGeometry(e, this.__geometryIndex);
21331
21345
  function i(n) {
21332
- return t.updateMeshInformation() && (t.renderer.remove(t, !0), t.renderer.add(t)) ? !0 : ((D() || Yt) && console.error(n), !1);
21346
+ return t.updateMeshInformation() && (t.renderer.remove(t, !0), t.renderer.add(t)) ? !0 : ((L() || Yt) && console.error(n), !1);
21333
21347
  }
21334
21348
  }
21335
21349
  /** Adds this object to the instancing renderer (effectively activating instancing) */
@@ -21426,7 +21440,7 @@ class MM {
21426
21440
  this.add(t);
21427
21441
  } catch (i) {
21428
21442
  if (console.error(`Failed adding mesh to instancing (object name: "${e.name}", instances: ${this._currentInstanceCount.toLocaleString()}/${this._maxInstanceCount.toLocaleString()}, vertices: ${this._currentVertexCount.toLocaleString()}/${this._maxVertexCount.toLocaleString()}, indices: ${this._currentIndexCount.toLocaleString()}/${this._maxIndexCount.toLocaleString()})
21429
- `, i), D()) {
21443
+ `, i), L()) {
21430
21444
  Xd("Failed instancing mesh. See the browser console for details.");
21431
21445
  debugger;
21432
21446
  }
@@ -21464,7 +21478,7 @@ class MM {
21464
21478
  const t = this.geometry;
21465
21479
  for (const i in t.attributes)
21466
21480
  if (i !== "batchId" && !e.hasAttribute(i))
21467
- return D() && console.warn(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`), !1;
21481
+ return L() && console.warn(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`), !1;
21468
21482
  return !0;
21469
21483
  }
21470
21484
  markNeedsUpdate() {
@@ -21489,7 +21503,7 @@ ${c.vertexCount} vertices, ${c.indexCount} indices
21489
21503
  Max count ${this._maxInstanceCount} → ${i}
21490
21504
  Max vertex count ${this._maxVertexCount} -> ${o}
21491
21505
  Max index count ${this._maxIndexCount} -> ${r}`), this._debugMaterial = M_();
21492
- } else D() && console.debug(`[Instancing] Growing Buffer
21506
+ } else L() && console.debug(`[Instancing] Growing Buffer
21493
21507
  Mesh: "${this.name}${e.name?.length ? "/" + e.name : ""}"
21494
21508
  Max count ${this._maxInstanceCount} → ${i}
21495
21509
  Max vertex count ${this._maxVertexCount} -> ${o}
@@ -21553,9 +21567,9 @@ Index: ${e.__instanceIndex}`), this._batchedMesh.deleteInstance(e.__instanceInde
21553
21567
  }
21554
21568
  function qo(s) {
21555
21569
  if (!s)
21556
- return D() && console.error("Cannot get mesh information from null geometry"), { vertexCount: 0, indexCount: 0 };
21570
+ return L() && console.error("Cannot get mesh information from null geometry"), { vertexCount: 0, indexCount: 0 };
21557
21571
  let e = s.attributes?.position?.count || 0, t = s.index ? s.index.count : 0;
21558
- const i = We.getMeshLODExtension(s);
21572
+ const i = Ve.getMeshLODExtension(s);
21559
21573
  if (i) {
21560
21574
  const n = i.lods[0];
21561
21575
  let o = n.vertexCount, r = n.indexCount;
@@ -21574,7 +21588,7 @@ class Hp {
21574
21588
  return this.lightmapTexture;
21575
21589
  }
21576
21590
  set lightmap(e) {
21577
- e !== this.lightmapTexture && (this.lightmapTexture = e, this.applyLightmap(), this.lightmapTexture && We.assignTextureLOD(this.lightmapTexture, 0).then((t) => {
21591
+ e !== this.lightmapTexture && (this.lightmapTexture = e, this.applyLightmap(), this.lightmapTexture && Ve.assignTextureLOD(this.lightmapTexture, 0).then((t) => {
21578
21592
  t?.isTexture && (this.lightmapTexture = t);
21579
21593
  }));
21580
21594
  }
@@ -21589,7 +21603,7 @@ class Hp {
21589
21603
  this.gameObject = e, this.context = t;
21590
21604
  }
21591
21605
  init(e, t, i) {
21592
- console.assert(this.gameObject !== void 0 && this.gameObject !== null, "Missing gameobject", this), this.lightmapIndex = e, !(this.lightmapIndex < 0) && (this.lightmapScaleOffset = t, this.lightmapTexture = i, We.assignTextureLOD(i, 0).then((n) => {
21606
+ console.assert(this.gameObject !== void 0 && this.gameObject !== null, "Missing gameobject", this), this.lightmapIndex = e, !(this.lightmapIndex < 0) && (this.lightmapScaleOffset = t, this.lightmapTexture = i, Ve.assignTextureLOD(i, 0).then((n) => {
21593
21607
  n?.isTexture && (this.lightmapTexture = n);
21594
21608
  }), Dr == "show" ? (console.log("Lightmap:", this.gameObject.name, e, `
21595
21609
  ScaleOffset:`, t, `
@@ -21671,7 +21685,7 @@ Texture:`, i), this.setLightmapDebugMaterial()) : Dr && console.log("Use debugli
21671
21685
  });
21672
21686
  }
21673
21687
  }
21674
- var RM = Object.defineProperty, As = (s, e, t, i) => {
21688
+ var RM = Object.defineProperty, Es = (s, e, t, i) => {
21675
21689
  for (var n = void 0, o = s.length - 1, r; o >= 0; o--)
21676
21690
  (r = s[o]) && (n = r(e, t, n) || n);
21677
21691
  return n && RM(e, t, n), n;
@@ -21793,7 +21807,7 @@ const Wn = class Vh extends R {
21793
21807
  *
21794
21808
  * If you want to activate or deactivate a complete object you can use obj.visible as usual (it acts the same as setActive in Unity) */
21795
21809
  static setVisible(e, t) {
21796
- ds(e, t);
21810
+ hs(e, t);
21797
21811
  }
21798
21812
  receiveShadows = !1;
21799
21813
  shadowCastingMode = 0;
@@ -22034,7 +22048,7 @@ const Wn = class Vh extends R {
22034
22048
  if (this._handles && this._handles.length <= 0 && S.markAsInstancedRendered(this.gameObject, !1), this._isInstancingEnabled && this._handles)
22035
22049
  for (let e = 0; e < this._handles.length; e++) {
22036
22050
  const t = this._handles[e];
22037
- ds(t.object, !1);
22051
+ hs(t.object, !1);
22038
22052
  }
22039
22053
  this.reflectionProbeUsage !== 0 && this._reflectionProbe && (this._lightmaps?.length || this._reflectionProbe.onSet(this));
22040
22054
  for (const e of this._sharedMaterials)
@@ -22054,7 +22068,7 @@ const Wn = class Vh extends R {
22054
22068
  if (this._isInstancingEnabled && this._handles)
22055
22069
  for (let e = 0; e < this._handles.length; e++) {
22056
22070
  const t = this._handles[e];
22057
- ds(t.object, !0);
22071
+ hs(t.object, !0);
22058
22072
  }
22059
22073
  this.reflectionProbeUsage !== 0 && this._reflectionProbe && this._reflectionProbe.onUnset(this), this.static && this.gameObject.matrixAutoUpdate && (this.gameObject.matrixAutoUpdate = !1);
22060
22074
  }
@@ -22078,10 +22092,10 @@ const Wn = class Vh extends R {
22078
22092
  }
22079
22093
  setVisibility(e) {
22080
22094
  if (!this.isMultiMaterialObject(this.gameObject))
22081
- ds(this.gameObject, e);
22095
+ hs(this.gameObject, e);
22082
22096
  else
22083
22097
  for (const t of this.gameObject.children)
22084
- this.isMeshOrSkinnedMesh(t) && ds(t, e);
22098
+ this.isMeshOrSkinnedMesh(t) && hs(t, e);
22085
22099
  }
22086
22100
  isMultiMaterialObject(e) {
22087
22101
  return e.type === "Group";
@@ -22090,31 +22104,31 @@ const Wn = class Vh extends R {
22090
22104
  return e.type === "Mesh" || e.type === "SkinnedMesh";
22091
22105
  }
22092
22106
  };
22093
- As([
22107
+ Es([
22094
22108
  u()
22095
22109
  ], Wn.prototype, "receiveShadows");
22096
- As([
22110
+ Es([
22097
22111
  u()
22098
22112
  ], Wn.prototype, "shadowCastingMode");
22099
- As([
22113
+ Es([
22100
22114
  u()
22101
22115
  ], Wn.prototype, "lightmapIndex");
22102
- As([
22116
+ Es([
22103
22117
  u(de)
22104
22118
  ], Wn.prototype, "lightmapScaleOffset");
22105
- As([
22119
+ Es([
22106
22120
  u()
22107
22121
  ], Wn.prototype, "enableInstancing");
22108
- As([
22122
+ Es([
22109
22123
  u()
22110
22124
  ], Wn.prototype, "renderOrder");
22111
- As([
22125
+ Es([
22112
22126
  u()
22113
22127
  ], Wn.prototype, "allowOcclusionWhenDynamic");
22114
- As([
22128
+ Es([
22115
22129
  u(M)
22116
22130
  ], Wn.prototype, "probeAnchor");
22117
- As([
22131
+ Es([
22118
22132
  u()
22119
22133
  ], Wn.prototype, "reflectionProbeUsage");
22120
22134
  let Gi = Wn;
@@ -22131,7 +22145,7 @@ class Sv extends fu {
22131
22145
  onAfterRender() {
22132
22146
  if (super.onAfterRender(), this._needUpdateBoundingSphere) {
22133
22147
  for (const e of this.sharedMeshes)
22134
- if (e instanceof _s) {
22148
+ if (e instanceof ys) {
22135
22149
  this._needUpdateBoundingSphere = !1;
22136
22150
  try {
22137
22151
  const t = e.geometry, i = Cb(e);
@@ -22143,7 +22157,7 @@ class Sv extends fu {
22143
22157
  }
22144
22158
  if (R_) {
22145
22159
  for (const e of this.sharedMeshes)
22146
- if (e instanceof _s && e.boundingSphere) {
22160
+ if (e instanceof ys && e.boundingSphere) {
22147
22161
  const t = G(e.boundingSphere.center).applyMatrix4(e.matrixWorld);
22148
22162
  z.DrawWireSphere(t, e.boundingSphere.radius, "red");
22149
22163
  }
@@ -22762,11 +22776,11 @@ class st {
22762
22776
  needsOrient = !1;
22763
22777
  needsScale = !1;
22764
22778
  static createEmptyParent(e) {
22765
- const t = new st(ys.generateUUID(), e.name + "_empty_" + st.USDObject_export_id++, e.transform), i = e.parent;
22779
+ const t = new st(gs.generateUUID(), e.name + "_empty_" + st.USDObject_export_id++, e.transform), i = e.parent;
22766
22780
  return i && i.add(t), t.add(e), t.isDynamic = !0, e.transform = null, t;
22767
22781
  }
22768
22782
  static createEmpty() {
22769
- const e = new st(ys.generateUUID(), "Empty_" + st.USDObject_export_id++);
22783
+ const e = new st(gs.generateUUID(), "Empty_" + st.USDObject_export_id++);
22770
22784
  return e.isDynamic = !0, e;
22771
22785
  }
22772
22786
  constructor(e, t, i = null, n = null, o = null, r = null, a = null, l = null) {
@@ -22783,7 +22797,7 @@ class st {
22783
22797
  return !this.geometry;
22784
22798
  }
22785
22799
  clone() {
22786
- const e = new st(ys.generateUUID(), this.name, this.transform, this.geometry, this.material);
22800
+ const e = new st(gs.generateUUID(), this.name, this.transform, this.geometry, this.material);
22787
22801
  return e.isDynamic = this.isDynamic, e;
22788
22802
  }
22789
22803
  deepClone() {
@@ -22971,7 +22985,7 @@ let qM = class {
22971
22985
  le.report("export-usdz", "Invoking onBeforeBuildDocument"), await Hh(i, "onBeforeBuildDocument"), le.report("export-usdz", "Done onBeforeBuildDocument"), le.report("export-usdz", "Reparent bones to common ancestor");
22972
22986
  const l = [], c = /* @__PURE__ */ new Set();
22973
22987
  e?.traverse((_) => {
22974
- if (!(!t.exportInvisible && !_.visible) && _ instanceof _s) {
22988
+ if (!(!t.exportInvisible && !_.visible) && _ instanceof ys) {
22975
22989
  const x = _.skeleton.bones, I = Mv(x);
22976
22990
  if (I) {
22977
22991
  const O = { object: _, originalParent: _.parent, newParent: I };
@@ -23018,13 +23032,13 @@ let qM = class {
23018
23032
  le.report("export-usdz-textures", { message: "read back texture", autoStep: !0 });
23019
23033
  const E = x.scale !== void 0 && x.scale.x !== 1 && x.scale.y !== 1 && x.scale.z !== 1 && x.scale.w !== 1;
23020
23034
  (I.isCompressedTexture || I.isRenderTargetTexture || E) && (k = await QM(I, t.maxTextureSize, g, x.scale)), le.report("export-usdz-textures", { message: "convert texture to canvas", autoStep: !0 });
23021
- const B = await KM(k.imageBitmap || k.imageData, t.maxTextureSize).catch((L) => {
23022
- console.error("Error converting texture to canvas", I, L);
23035
+ const B = await KM(k.imageBitmap || k.imageData, t.maxTextureSize).catch((D) => {
23036
+ console.error("Error converting texture to canvas", I, D);
23023
23037
  });
23024
23038
  if (B) {
23025
23039
  le.report("export-usdz-textures", { message: "convert canvas to blob", autoStep: !0 });
23026
- const L = await B.convertToBlob({ type: O ? "image/png" : "image/jpeg", quality: 0.95 });
23027
- n[`textures/${_}.${O ? "png" : "jpg"}`] = new Uint8Array(await L.arrayBuffer());
23040
+ const D = await B.convertToBlob({ type: O ? "image/png" : "image/jpeg", quality: 0.95 });
23041
+ n[`textures/${_}.${O ? "png" : "jpg"}`] = new Uint8Array(await D.arrayBuffer());
23028
23042
  } else
23029
23043
  console.warn("Can`t export texture: ", I);
23030
23044
  };
@@ -23049,9 +23063,9 @@ function Ev(s, e, t, i) {
23049
23063
  if (!t.exportInvisible && !s.visible) return;
23050
23064
  let n, o, r;
23051
23065
  const a = { position: s.position, quaternion: s.quaternion, scale: s.scale };
23052
- if (s.position.x === 0 && s.position.y === 0 && s.position.z === 0 && (a.position = null), s.quaternion.x === 0 && s.quaternion.y === 0 && s.quaternion.z === 0 && s.quaternion.w === 1 && (a.quaternion = null), s.scale.x === 1 && s.scale.y === 1 && s.scale.z === 1 && (a.scale = null), (s instanceof H || s instanceof _s) && (o = s.geometry, r = s.material), i && !i(s) && (o = void 0, r = void 0), (s instanceof H || s instanceof _s) && r && typeof r == "object" && (r instanceof ht || r instanceof we || // material instanceof MeshPhysicalNodeMaterial ||
23066
+ if (s.position.x === 0 && s.position.y === 0 && s.position.z === 0 && (a.position = null), s.quaternion.x === 0 && s.quaternion.y === 0 && s.quaternion.z === 0 && s.quaternion.w === 1 && (a.quaternion = null), s.scale.x === 1 && s.scale.y === 1 && s.scale.z === 1 && (a.scale = null), (s instanceof H || s instanceof ys) && (o = s.geometry, r = s.material), i && !i(s) && (o = void 0, r = void 0), (s instanceof H || s instanceof ys) && r && typeof r == "object" && (r instanceof ht || r instanceof we || // material instanceof MeshPhysicalNodeMaterial ||
23053
23067
  r.isMeshPhysicalNodeMaterial || r instanceof _e && r.type === "MeshLineMaterial")) {
23054
- const l = _h(s), c = s instanceof _s ? s : null;
23068
+ const l = _h(s), c = s instanceof ys ? s : null;
23055
23069
  n = new st(s.uuid, l, a, o, r, void 0, c, s.animations);
23056
23070
  } else if (s instanceof me || s instanceof Dd) {
23057
23071
  const l = _h(s);
@@ -23206,7 +23220,7 @@ async function QM(s, e = 1 / 0, t = null, i = void 0) {
23206
23220
  }`
23207
23221
  }));
23208
23222
  const n = Br.uniforms;
23209
- n.blitTexture.value = s, n.flipY.value = !1, n.scale.value = new de(1, 1, 1, 1), i !== void 0 && n.scale.value.copy(i), Br.defines.IS_SRGB = s.colorSpace == Ps, Br.needsUpdate = !0, yh || (yh = new H(jf, Br), yh.frustumCulled = !1);
23223
+ n.blitTexture.value = s, n.flipY.value = !1, n.scale.value = new de(1, 1, 1, 1), i !== void 0 && n.scale.value.copy(i), Br.defines.IS_SRGB = s.colorSpace == Cs, Br.needsUpdate = !0, yh || (yh = new H(jf, Br), yh.frustumCulled = !1);
23210
23224
  const o = new me(), r = new yi();
23211
23225
  r.add(yh), t || (t = gh = new mr({ antialias: !1, alpha: !0, premultipliedAlpha: !1, preserveDrawingBuffer: !0 }));
23212
23226
  const a = Math.min(s.image.width, e), l = Math.min(s.image.height, e);
@@ -23498,7 +23512,7 @@ ${i.join("")}
23498
23512
  function Di(s) {
23499
23513
  return dn(s.name) + "_" + (s.source?.id ?? s.id);
23500
23514
  }
23501
- function Ns(s, e, t, i, n, o, r = void 0, a = void 0) {
23515
+ function Us(s, e, t, i, n, o, r = void 0, a = void 0) {
23502
23516
  const l = Di(s), c = l + (a !== void 0 && a !== 1 ? "_" + a : ""), h = t && a !== void 0 && a !== 1, d = h ? new de(1, 1, 1, a) : void 0;
23503
23517
  a === void 0 && (a = 1), h && (a = 1), d && d.w <= 0.05 && (d.w = 0.05), i[c] = { texture: s, scale: d };
23504
23518
  const f = s.channel > 0 ? "st" + s.channel : "st";
@@ -23512,7 +23526,7 @@ function Ns(s, e, t, i, n, o, r = void 0, a = void 0) {
23512
23526
  // MirroredRepeatWrapping
23513
23527
  }, b = s.repeat.clone(), m = s.offset.clone(), v = s.rotation, _ = Math.sin(v), x = Math.cos(v);
23514
23528
  m.y = 1 - m.y - b.y, t ? (b.x === 0 && (b.x = 1e-4), b.y === 0 && (b.y = 1e-4), m.x = m.x / b.x, m.y = m.y / b.y, m.x += _ / b.x, m.y += x - 1) : (m.x += _ * b.x, m.y += (1 - x) * b.y);
23515
- const I = pu(n), O = b.x != 1 || b.y != 1 || m.x != 0 || m.y != 0 || v != 0, k = `${Nt}/${I}/${"uvReader_" + f}.outputs:result>`, E = `${Nt}/${I}/Transform2d_${e}.outputs:result>`, B = e !== "normal" && r && (r.r !== 1 || r.g !== 1 || r.b !== 1 || a !== 1) || !1, L = e === "normal", W = n instanceof ht && n.normalScale ? n.normalScale.x * 2 : 2, X = W.toFixed(Oe), A = (-1 * (W / 2)).toFixed(Oe), $ = (1 - W).toFixed(Oe);
23529
+ const I = pu(n), O = b.x != 1 || b.y != 1 || m.x != 0 || m.y != 0 || v != 0, k = `${Nt}/${I}/${"uvReader_" + f}.outputs:result>`, E = `${Nt}/${I}/Transform2d_${e}.outputs:result>`, B = e !== "normal" && r && (r.r !== 1 || r.g !== 1 || r.b !== 1 || a !== 1) || !1, D = e === "normal", W = n instanceof ht && n.normalScale ? n.normalScale.x * 2 : 2, X = W.toFixed(Oe), A = (-1 * (W / 2)).toFixed(Oe), $ = (1 - W).toFixed(Oe);
23516
23530
  return `
23517
23531
  ${O ? `def Shader "Transform2d_${e}" (
23518
23532
  sdrMetadata = {
@@ -23537,7 +23551,7 @@ function Ns(s, e, t, i, n, o, r = void 0, a = void 0) {
23537
23551
  ${B ? `
23538
23552
  float4 inputs:scale = (${r ? r.r + ", " + r.g + ", " + r.b : "1, 1, 1"}, ${a})
23539
23553
  ` : ""}
23540
- ${L ? `
23554
+ ${D ? `
23541
23555
  float4 inputs:scale = (${X}, ${X}, ${X}, 1)
23542
23556
  float4 inputs:bias = (${A}, ${A}, ${$}, 0)
23543
23557
  ` : ""}
@@ -23573,18 +23587,18 @@ function oR(s, e, t = !1) {
23573
23587
  if (s.isMeshPhysicalNodeMaterial === !0)
23574
23588
  return BM(s, i, e);
23575
23589
  let c = s.transparent || s.alphaTest ? s.opacity : 1, h = !1, d = !1;
23576
- if (s instanceof dp && s.transmission !== void 0 && (c *= 1 - s.transmission * (1 - s.roughness * 0.5)), s.map ? (r.push(`${o}color3f inputs:diffuseColor.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:rgb>`), s instanceof we && s.transparent && s.alphaTest == 0 && t ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0, r.push(`${o}float inputs:opacityThreshold = ${1e-10}`), d = !0) : s.transparent ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0) : s.alphaTest > 0 && (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0, r.push(`${o}float inputs:opacityThreshold = ${s.alphaTest}`), d = !0), a.push(Ns(s.map, "diffuse", t, e, s, l, s.color, c))) : r.push(`${o}color3f inputs:diffuseColor = ${D_(s.color)}`), s.alphaHash && t && (d ? console.warn("Opacity threshold for " + s.name + " was already connected. Skipping alphaHash opacity threshold.") : (r.push(`${o}float inputs:opacityThreshold = 0.0000000001`), d = !0)), s.aoMap && (r.push(`${o}float inputs:occlusion.connect = ${Nt}/${i}/${Di(s.aoMap)}_occlusion.outputs:r>`), a.push(Ns(s.aoMap, "occlusion", t, e, s, l))), s.alphaMap ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.alphaMap)}_opacity.outputs:r>`), r.push(`${o}float inputs:opacityThreshold = 0.0000000001`), h = !0, d = !0, a.push(Ns(s.alphaMap, "opacity", t, e, s, l, new se(1, 1, 1), c))) : (h ? console.warn("Opacity for " + s.name + " was already connected. Skipping default opacity.") : (r.push(`${o}float inputs:opacity = ${c}`), h = !0), s.alphaTest > 0 && (d ? console.warn("Opacity threshold for " + s.name + " was already connected. Skipping default opacity threshold.") : (r.push(`${o}float inputs:opacityThreshold = ${s.alphaTest}`), d = !0))), s instanceof ht) {
23590
+ if (s instanceof dp && s.transmission !== void 0 && (c *= 1 - s.transmission * (1 - s.roughness * 0.5)), s.map ? (r.push(`${o}color3f inputs:diffuseColor.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:rgb>`), s instanceof we && s.transparent && s.alphaTest == 0 && t ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0, r.push(`${o}float inputs:opacityThreshold = ${1e-10}`), d = !0) : s.transparent ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0) : s.alphaTest > 0 && (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.map)}_diffuse.outputs:a>`), h = !0, r.push(`${o}float inputs:opacityThreshold = ${s.alphaTest}`), d = !0), a.push(Us(s.map, "diffuse", t, e, s, l, s.color, c))) : r.push(`${o}color3f inputs:diffuseColor = ${D_(s.color)}`), s.alphaHash && t && (d ? console.warn("Opacity threshold for " + s.name + " was already connected. Skipping alphaHash opacity threshold.") : (r.push(`${o}float inputs:opacityThreshold = 0.0000000001`), d = !0)), s.aoMap && (r.push(`${o}float inputs:occlusion.connect = ${Nt}/${i}/${Di(s.aoMap)}_occlusion.outputs:r>`), a.push(Us(s.aoMap, "occlusion", t, e, s, l))), s.alphaMap ? (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.alphaMap)}_opacity.outputs:r>`), r.push(`${o}float inputs:opacityThreshold = 0.0000000001`), h = !0, d = !0, a.push(Us(s.alphaMap, "opacity", t, e, s, l, new se(1, 1, 1), c))) : (h ? console.warn("Opacity for " + s.name + " was already connected. Skipping default opacity.") : (r.push(`${o}float inputs:opacity = ${c}`), h = !0), s.alphaTest > 0 && (d ? console.warn("Opacity threshold for " + s.name + " was already connected. Skipping default opacity threshold.") : (r.push(`${o}float inputs:opacityThreshold = ${s.alphaTest}`), d = !0))), s instanceof ht) {
23577
23591
  if (s.emissiveMap) {
23578
23592
  r.push(`${o}color3f inputs:emissiveColor.connect = ${Nt}/${i}/${Di(s.emissiveMap)}_emissive.outputs:rgb>`);
23579
23593
  const f = s.emissive.clone();
23580
- f.multiplyScalar(s.emissiveIntensity), a.push(Ns(s.emissiveMap, "emissive", t, e, s, l, f));
23594
+ f.multiplyScalar(s.emissiveIntensity), a.push(Us(s.emissiveMap, "emissive", t, e, s, l, f));
23581
23595
  } else if (s.emissive?.getHex() > 0) {
23582
23596
  const f = s.emissive.clone();
23583
23597
  f.multiplyScalar(s.emissiveIntensity), r.push(`${o}color3f inputs:emissiveColor = ${D_(f)}`);
23584
23598
  }
23585
- s.normalMap && (r.push(`${o}normal3f inputs:normal.connect = ${Nt}/${i}/${Di(s.normalMap)}_normal.outputs:rgb>`), a.push(Ns(s.normalMap, "normal", t, e, s, l))), s.roughnessMap && s.roughness === 1 ? (r.push(`${o}float inputs:roughness.connect = ${Nt}/${i}/${Di(s.roughnessMap)}_roughness.outputs:g>`), a.push(Ns(s.roughnessMap, "roughness", t, e, s, l))) : r.push(`${o}float inputs:roughness = ${s.roughness !== void 0 ? s.roughness : 1}`), s.metalnessMap && s.metalness === 1 ? (r.push(`${o}float inputs:metallic.connect = ${Nt}/${i}/${Di(s.metalnessMap)}_metallic.outputs:b>`), a.push(Ns(s.metalnessMap, "metallic", t, e, s, l))) : r.push(`${o}float inputs:metallic = ${s.metalness !== void 0 ? s.metalness : 0}`);
23599
+ s.normalMap && (r.push(`${o}normal3f inputs:normal.connect = ${Nt}/${i}/${Di(s.normalMap)}_normal.outputs:rgb>`), a.push(Us(s.normalMap, "normal", t, e, s, l))), s.roughnessMap && s.roughness === 1 ? (r.push(`${o}float inputs:roughness.connect = ${Nt}/${i}/${Di(s.roughnessMap)}_roughness.outputs:g>`), a.push(Us(s.roughnessMap, "roughness", t, e, s, l))) : r.push(`${o}float inputs:roughness = ${s.roughness !== void 0 ? s.roughness : 1}`), s.metalnessMap && s.metalness === 1 ? (r.push(`${o}float inputs:metallic.connect = ${Nt}/${i}/${Di(s.metalnessMap)}_metallic.outputs:b>`), a.push(Us(s.metalnessMap, "metallic", t, e, s, l))) : r.push(`${o}float inputs:metallic = ${s.metalness !== void 0 ? s.metalness : 0}`);
23586
23600
  }
23587
- return s instanceof dp && (r.push(`${o}float inputs:clearcoat = ${s.clearcoat}`), r.push(`${o}float inputs:clearcoatRoughness = ${s.clearcoatRoughness}`), r.push(`${o}float inputs:ior = ${s.ior}`), !s.transparent && !(s.alphaTest > 0) && s.transmissionMap && (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.transmissionMap)}_transmission.outputs:r>`), a.push(Ns(s.transmissionMap, "transmission", t, e, s, l)))), l.size > 2 ? console.warn("USDZExporter: Material " + s.name + " uses more than 2 UV channels. Currently, only UV0 and UV1 are supported.") : l.size === 2 && (!l.has(0) || !l.has(1)) && console.warn("USDZExporter: Material " + s.name + " uses UV channels other than 0 and 1. Currently, only UV0 and UV1 are supported."), `
23601
+ return s instanceof dp && (r.push(`${o}float inputs:clearcoat = ${s.clearcoat}`), r.push(`${o}float inputs:clearcoatRoughness = ${s.clearcoatRoughness}`), r.push(`${o}float inputs:ior = ${s.ior}`), !s.transparent && !(s.alphaTest > 0) && s.transmissionMap && (r.push(`${o}float inputs:opacity.connect = ${Nt}/${i}/${Di(s.transmissionMap)}_transmission.outputs:r>`), a.push(Us(s.transmissionMap, "transmission", t, e, s, l)))), l.size > 2 ? console.warn("USDZExporter: Material " + s.name + " uses more than 2 UV channels. Currently, only UV0 and UV1 are supported.") : l.size === 2 && (!l.has(0) || !l.has(1)) && console.warn("USDZExporter: Material " + s.name + " uses UV channels other than 0 and 1. Currently, only UV0 and UV1 are supported."), `
23588
23602
 
23589
23603
  def Material "${i}" ${s.name ? `(
23590
23604
  displayName = "${kv(s.name)}"
@@ -24105,7 +24119,7 @@ class Ue {
24105
24119
  console.error("This is a rest clip but you're trying to add tracks to it – this is likely a bug");
24106
24120
  return;
24107
24121
  }
24108
- e.name.endsWith("position") ? this.pos = e : e.name.endsWith("quaternion") ? this.rot = e : e.name.endsWith("scale") ? this.scale = e : (e.name.endsWith("activeSelf") ? console.warn("[USDZ] Animation of enabled/disabled state is not supported for USDZ export and will NOT be exported: " + e.name + " on " + (this.root?.name ?? this.target.name) + ". Animate scale 0/1 instead.") : console.warn("[USDZ] Animation track type not supported for USDZ export and will NOT be exported: " + e.name + " on " + (this.root?.name ?? this.target.name) + ". Only .position, .rotation, .scale are supported."), D() && ge("[USDZ] Some animations can't be exported. See console for details."));
24122
+ e.name.endsWith("position") ? this.pos = e : e.name.endsWith("quaternion") ? this.rot = e : e.name.endsWith("scale") ? this.scale = e : (e.name.endsWith("activeSelf") ? console.warn("[USDZ] Animation of enabled/disabled state is not supported for USDZ export and will NOT be exported: " + e.name + " on " + (this.root?.name ?? this.target.name) + ". Animate scale 0/1 instead.") : console.warn("[USDZ] Animation track type not supported for USDZ export and will NOT be exported: " + e.name + " on " + (this.root?.name ?? this.target.name) + ". Only .position, .rotation, .scale are supported."), L() && ge("[USDZ] Some animations can't be exported. See console for details."));
24109
24123
  }
24110
24124
  getFrames() {
24111
24125
  return this.clip ? Math.max(this.pos?.times?.length ?? 0, this.rot?.times?.length ?? 0, this.scale?.times?.length ?? 0) : 2;
@@ -24408,8 +24422,8 @@ class lR {
24408
24422
  for (let Je = 0; Je < Se.length; Je++) {
24409
24423
  const Mi = Se[Je], Qc = i.getStartTimeByClip(Mi.clip);
24410
24424
  re.length <= Je && re.push({ pos: [], rot: [], scale: [], timeOffset: Qc });
24411
- const Fs = re[Je];
24412
- Fs.pos.push(...Mi.getSortedTimesArray(!0, !1, !1)), Fs.rot.push(...Mi.getSortedTimesArray(!1, !0, !1)), Fs.scale.push(...Mi.getSortedTimesArray(!1, !1, !0));
24425
+ const Bs = re[Je];
24426
+ Bs.pos.push(...Mi.getSortedTimesArray(!0, !1, !1)), Bs.rot.push(...Mi.getSortedTimesArray(!1, !0, !1)), Bs.scale.push(...Mi.getSortedTimesArray(!1, !1, !0));
24413
24427
  }
24414
24428
  for (const fe of re)
24415
24429
  fe.pos.sort((Se, Je) => Se - Je), fe.rot.sort((Se, Je) => Se - Je), fe.scale.sort((Se, Je) => Se - Je), fe.pos = [...new Set(fe.pos)], fe.rot = [...new Set(fe.rot)], fe.scale = [...new Set(fe.scale)];
@@ -24420,8 +24434,8 @@ class lR {
24420
24434
  const Mi = A.get(Je);
24421
24435
  let Qc;
24422
24436
  Mi ? console.assert(Mi.length === Se, "We should have the same number of TransformData entries for each bone", Mi, $) : Qc = new Ue(null, Je, null);
24423
- for (let Fs = 0; Fs < Se; Fs++) {
24424
- const Qu = Mi ? Mi[Fs] : Qc, Er = $[Fs];
24437
+ for (let Bs = 0; Bs < Se; Bs++) {
24438
+ const Qu = Mi ? Mi[Bs] : Qc, Er = $[Bs];
24425
24439
  for (const { time: il, translation: nl } of Qu.getValues(Er.pos, !0, !1, !1)) {
24426
24440
  const Zi = (il + Er.timeOffset) * 60;
24427
24441
  ne.has(Zi) || ne.set(Zi, new Array()), ne.get(Zi).push(nl.clone());
@@ -24501,8 +24515,8 @@ class lR {
24501
24515
  O.push(A.matrix.clone());
24502
24516
  k.push(A.position), E.push(A.quaternion), B.push(A.scale);
24503
24517
  }
24504
- const L = b.map((A) => '"' + da(A.bone, x) + '"').join(", "), W = b.map((A) => I_(A.inverse.clone().invert())).join(", ");
24505
- e.beginBlock('def Skeleton "Rig"'), e.appendLine(`uniform matrix4d[] bindTransforms = [${W}]`), e.appendLine(`uniform token[] joints = [${L}]`), e.appendLine('uniform token purpose = "guide"'), e.appendLine(`uniform matrix4d[] restTransforms = [${O.map((A) => I_(A)).join(", ")}]`);
24518
+ const D = b.map((A) => '"' + da(A.bone, x) + '"').join(", "), W = b.map((A) => I_(A.inverse.clone().invert())).join(", ");
24519
+ e.beginBlock('def Skeleton "Rig"'), e.appendLine(`uniform matrix4d[] bindTransforms = [${W}]`), e.appendLine(`uniform token[] joints = [${D}]`), e.appendLine('uniform token purpose = "guide"'), e.appendLine(`uniform matrix4d[] restTransforms = [${O.map((A) => I_(A)).join(", ")}]`);
24506
24520
  const X = p(b.map((A) => A.bone));
24507
24521
  if (Pn) {
24508
24522
  let A = 1e7, $ = 0;
@@ -24510,7 +24524,7 @@ class lR {
24510
24524
  A = Math.min(A, V), $ = Math.max($, V);
24511
24525
  console.log("Time samples", A, $, X);
24512
24526
  }
24513
- if (e.beginBlock('def SkelAnimation "_anim"'), e.appendLine(`uniform token[] joints = [${L}]`), e.appendLine(`quatf[] rotations = [${d(E)}]`), X && X.quaternion) {
24527
+ if (e.beginBlock('def SkelAnimation "_anim"'), e.appendLine(`uniform token[] joints = [${D}]`), e.appendLine(`quatf[] rotations = [${d(E)}]`), X && X.quaternion) {
24514
24528
  e.beginBlock("quatf[] rotations.timeSamples = {", "");
24515
24529
  const A = a(X.quaternion);
24516
24530
  for (const $ of A)
@@ -24649,7 +24663,7 @@ var hR = Object.defineProperty, Fe = (s, e, t, i) => {
24649
24663
  };
24650
24664
  const F_ = w("debugusdzbehaviours");
24651
24665
  function kc(s) {
24652
- s && (s.getComponentInParent(Ma) || (D() && console.debug('Raycaster on "' + s.name + '" was automatically added, because no raycaster was found in the parent hierarchy.'), s.addComponent(Hi)));
24666
+ s && (s.getComponentInParent(Ma) || (L() && console.debug('Raycaster on "' + s.name + '" was automatically added, because no raycaster was found in the parent hierarchy.'), s.addComponent(Hi)));
24653
24667
  }
24654
24668
  class za extends R {
24655
24669
  object;
@@ -24668,7 +24682,7 @@ class za extends R {
24668
24682
  }
24669
24683
  *moveToTarget() {
24670
24684
  if (!this.target || !this.object) return;
24671
- const e = Z(this.object).clone(), t = Z(this.target).clone(), i = be(this.object).clone(), n = be(this.target).clone(), o = $e(this.object).clone(), r = $e(this.target).clone(), a = e.distanceTo(t), l = i.angleTo(n), c = o.distanceTo(r);
24685
+ const e = Z(this.object).clone(), t = Z(this.target).clone(), i = be(this.object).clone(), n = be(this.target).clone(), o = We(this.object).clone(), r = We(this.target).clone(), a = e.distanceTo(t), l = i.angleTo(n), c = o.distanceTo(r);
24672
24686
  if (a < 0.01 && l < 0.01 && c < 0.01) {
24673
24687
  ft(this.object, t), cn(this.object, n), rc(this.object, r), this.coroutine = null;
24674
24688
  return;
@@ -24715,7 +24729,7 @@ const mu = class Ut extends R {
24715
24729
  variantMaterial;
24716
24730
  fadeDuration = 0;
24717
24731
  start() {
24718
- this._objectsWithThisMaterial = this.objectsWithThisMaterial, kc(this.gameObject), D() && this._objectsWithThisMaterial.length <= 0 && console.warn('ChangeMaterialOnClick: No objects found with material "' + this.materialToSwitch?.name + '"');
24732
+ this._objectsWithThisMaterial = this.objectsWithThisMaterial, kc(this.gameObject), L() && this._objectsWithThisMaterial.length <= 0 && console.warn('ChangeMaterialOnClick: No objects found with material "' + this.materialToSwitch?.name + '"');
24719
24733
  }
24720
24734
  onPointerEnter(e) {
24721
24735
  this.context.input.setCursor("pointer");
@@ -24751,7 +24765,7 @@ const mu = class Ut extends R {
24751
24765
  static _startHiddenBehaviour = null;
24752
24766
  static _parallelStartHiddenActions = [];
24753
24767
  async beforeCreateDocument(e, t) {
24754
- this.targetModels = [], Ut._materialTriggersPerId = {}, Ut.variantSwitchIndex = 0, this.materialToSwitch && await We.assignTextureLOD(this.materialToSwitch, 0), this.variantMaterial && await We.assignTextureLOD(this.variantMaterial, 0);
24768
+ this.targetModels = [], Ut._materialTriggersPerId = {}, Ut.variantSwitchIndex = 0, this.materialToSwitch && await Ve.assignTextureLOD(this.materialToSwitch, 0), this.variantMaterial && await Ve.assignTextureLOD(this.variantMaterial, 0);
24755
24769
  }
24756
24770
  createBehaviours(e, t, i) {
24757
24771
  this.objectsWithThisMaterial.find((o) => o.uuid === t.uuid) && this.targetModels.push(t), this.gameObject.uuid === t.uuid && (this.selfModel = t, this.materialToSwitch && (Ut._materialTriggersPerId[this.materialToSwitch.uuid] || (Ut._materialTriggersPerId[this.materialToSwitch.uuid] = []), Ut._materialTriggersPerId[this.materialToSwitch.uuid].push(this)));
@@ -25054,7 +25068,7 @@ const gg = class bn extends R {
25054
25068
  afterSerialize() {
25055
25069
  if (bn.rootsWithExclusivePlayback.size > 1) {
25056
25070
  const e = 'Multiple root objects targeted by more than one animation. To work around QuickLook bug FB13410767, animations will be set as "exclusive" and activating them will stop other animations being marked as exclusive.';
25057
- D() && ge(e), console.warn(e, ...bn.rootsWithExclusivePlayback);
25071
+ L() && ge(e), console.warn(e, ...bn.rootsWithExclusivePlayback);
25058
25072
  }
25059
25073
  bn.animationActions = [], bn.rootsWithExclusivePlayback = /* @__PURE__ */ new Set();
25060
25074
  }
@@ -25063,7 +25077,7 @@ const gg = class bn extends R {
25063
25077
  const i = t.document, n = t.extensions.find((a) => a instanceof mg);
25064
25078
  if (!n) return;
25065
25079
  const o = n.getClipCount(this.target) > 1;
25066
- o && (D() && console.warn("Setting exclusive playback for " + this.target.name + "@" + this.stateName + " because it has " + n.getClipCount(this.target) + " animations. This works around QuickLook bug FB13410767."), bn.rootsWithExclusivePlayback.add(this.target));
25080
+ o && (L() && console.warn("Setting exclusive playback for " + this.target.name + "@" + this.stateName + " because it has " + n.getClipCount(this.target) + " animations. This works around QuickLook bug FB13410767."), bn.rootsWithExclusivePlayback.add(this.target));
25067
25081
  const r = this.name ? this.name : "";
25068
25082
  i.traverse((a) => {
25069
25083
  if (a.uuid === this.target?.uuid) {
@@ -25161,8 +25175,8 @@ const gg = class bn extends R {
25161
25175
  _.tracks = v.tracks.map((O) => {
25162
25176
  const k = O.clone();
25163
25177
  k.times = new Float32Array([0, I]);
25164
- const E = O.values.length, B = O.getValueSize(), L = O.values.slice(E - B, E);
25165
- return k.values = new Float32Array(2 * B), k.values.set(L, 0), k.values.set(L, B), k;
25178
+ const E = O.values.length, B = O.getValueSize(), D = O.values.slice(E - B, E);
25179
+ return k.values = new Float32Array(2 * B), k.values.set(D, 0), k.values.set(D, B), k;
25166
25180
  }), _.name = x, e.holdClipMap.set(v, _);
25167
25181
  }
25168
25182
  if (_) {
@@ -25309,7 +25323,7 @@ class or {
25309
25323
  e.innerText = "View in AR", e.prepend(Rt("view_in_ar"));
25310
25324
  let i = !1, n = null;
25311
25325
  return e.addEventListener("click", () => {
25312
- n = eu(xs), n || (i = !0, n = new xs()), i && (n.objectToExport = N.Current.scene), n ? (e.classList.add("this-mode-is-requested"), n.exportAndOpen().then(() => {
25326
+ n = eu(ws), n || (i = !0, n = new ws()), i && (n.objectToExport = N.Current.scene), n ? (e.classList.add("this-mode-is-requested"), n.exportAndOpen().then(() => {
25313
25327
  e.classList.remove("this-mode-is-requested");
25314
25328
  }).catch((o) => {
25315
25329
  e.classList.remove("this-mode-is-requested"), console.error(o);
@@ -25366,7 +25380,7 @@ class or {
25366
25380
  return;
25367
25381
  }
25368
25382
  K.isSessionSupported(t).then((i) => {
25369
- e.style.display = i ? "" : "none", D() && !i && console.log('[WebXR] "' + t + '" is not supported on this device – make sure your server runs using HTTPS and you have a device connected that supports ' + t);
25383
+ e.style.display = i ? "" : "none", L() && !i && console.log('[WebXR] "' + t + '" is not supported on this device – make sure your server runs using HTTPS and you have a device connected that supports ' + t);
25370
25384
  });
25371
25385
  }
25372
25386
  hideElementDuringXRSession(e) {
@@ -25413,7 +25427,7 @@ class pR {
25413
25427
  y;
25414
25428
  }
25415
25429
  function Uv(s) {
25416
- s && (s.colorSpace != Ps && (s.colorSpace = Ps, s.needsUpdate = !0), s.minFilter == Zh && s.magFilter == Zh && (s.anisotropy = 1, s.needsUpdate = !0));
25430
+ s && (s.colorSpace != Cs && (s.colorSpace = Cs, s.needsUpdate = !0), s.minFilter == Zh && s.magFilter == Zh && (s.anisotropy = 1, s.needsUpdate = !0));
25417
25431
  }
25418
25432
  let wo = class {
25419
25433
  constructor(e) {
@@ -25513,7 +25527,7 @@ const yg = class Qp {
25513
25527
  if (n && (Uv(n), !i.__hasLoadedProgressive)) {
25514
25528
  i.__hasLoadedProgressive = !0;
25515
25529
  const o = n;
25516
- We.assignTextureLOD(n, 0).then((r) => {
25530
+ Ve.assignTextureLOD(n, 0).then((r) => {
25517
25531
  r instanceof Te && (i.texture = r, e?.map === o && (e.map = r, e.needsUpdate = !0));
25518
25532
  });
25519
25533
  }
@@ -25622,7 +25636,7 @@ class Si extends R {
25622
25636
  let o = i.texture;
25623
25637
  o[Uf] !== void 0 && o[Uf] !== this && this.spriteFrames > 1 && (o = i.texture = o.clone()), o[Uf] = this, n.map = o;
25624
25638
  }
25625
- this.sharedMaterial = n, this._currentSprite = new H(hr.getOrCreateGeometry(i), n), this._currentSprite.renderOrder = Math.round(this.renderOrder), We.assignTextureLOD(n, 0);
25639
+ this.sharedMaterial = n, this._currentSprite = new H(hr.getOrCreateGeometry(i), n), this._currentSprite.renderOrder = Math.round(this.renderOrder), Ve.assignTextureLOD(n, 0);
25626
25640
  }
25627
25641
  return this._currentSprite.parent !== this.gameObject && (this.drawMode === 2 && this._currentSprite.scale.set(this.size.x, this.size.y, 1), this.gameObject && this.gameObject.add(this._currentSprite)), this._currentSprite && this._currentSprite.layers.set(this.layer), this.sharedMaterial && (this.sharedMaterial.alphaTest = this.cutoutThreshold, this.sharedMaterial.transparent = this.transparent), this._currentSprite.castShadow = this.castShadows, t?.update(this.sharedMaterial), !0;
25628
25642
  }
@@ -25873,7 +25887,7 @@ class $i extends R {
25873
25887
  }
25874
25888
  async onCreateAnchor(e, t) {
25875
25889
  if (t.createAnchor === void 0) {
25876
- console.warn("Hit does not support creating an anchor", t), D() && ge("Hit does not support creating an anchor");
25890
+ console.warn("Hit does not support creating an anchor", t), L() && ge("Hit does not support creating an anchor");
25877
25891
  return;
25878
25892
  } else {
25879
25893
  const i = await t.createAnchor(e.viewerPose.transform);
@@ -26130,10 +26144,10 @@ const Nv = function(s = null) {
26130
26144
  let i = "";
26131
26145
  typeof t == "string" ? i = t : i = t.name;
26132
26146
  let n = null, o;
26133
- typeof s == "string" ? o = e[s] : typeof s == "function" && (o = s), o == null && (D() || eo) && s != null && console.warn('syncField: no callback function found for property "' + i + '"', '"' + s + '"');
26147
+ typeof s == "string" ? o = e[s] : typeof s == "function" && (o = s), o == null && (L() || eo) && s != null && console.warn('syncField: no callback function found for property "' + i + '"', '"' + s + '"');
26134
26148
  const r = e, a = r.__internalAwake;
26135
26149
  if (typeof a != "function") {
26136
- (eo || D()) && console.error('@syncField can currently only used on Needle Engine Components, custom object of type "' + e?.constructor?.name + '" is not supported', e);
26150
+ (eo || L()) && console.error('@syncField can currently only used on Needle Engine Components, custom object of type "' + e?.constructor?.name + '" is not supported', e);
26137
26151
  return;
26138
26152
  }
26139
26153
  eo && console.log(i);
@@ -26147,7 +26161,7 @@ const Nv = function(s = null) {
26147
26161
  set: function(f) {
26148
26162
  const p = this[l];
26149
26163
  if (this[l] = f, d) {
26150
- (D() || eo) && console.warn("Recursive call detected", i);
26164
+ (L() || eo) && console.warn("Recursive call detected", i);
26151
26165
  return;
26152
26166
  }
26153
26167
  d = !0;
@@ -26374,7 +26388,7 @@ const Yp = class St extends R {
26374
26388
  }
26375
26389
  /** @internal */
26376
26390
  async start() {
26377
- $t && console.log("PLAYERSTATE.START, owner: " + this.owner, this.context.connection.usersInRoom([])), this.owner ? (this.context.connection.isInRoom || await ks(300), this.context.connection.userIsInRoom(this.owner) == !1 && ($t && console.log(`PlayerSync.start → doDestroy "${this.name}" because user "${this.owner}" is not in room anymore...`, "Currently in room:", ...this.context.connection.usersInRoom()), this.doDestroy())) : this.owner || ($t && console.warn("PlayerState.start → owner is undefined!", this.name), setTimeout(() => {
26391
+ $t && console.log("PLAYERSTATE.START, owner: " + this.owner, this.context.connection.usersInRoom([])), this.owner ? (this.context.connection.isInRoom || await Os(300), this.context.connection.userIsInRoom(this.owner) == !1 && ($t && console.log(`PlayerSync.start → doDestroy "${this.name}" because user "${this.owner}" is not in room anymore...`, "Currently in room:", ...this.context.connection.usersInRoom()), this.doDestroy())) : this.owner || ($t && console.warn("PlayerState.start → owner is undefined!", this.name), setTimeout(() => {
26378
26392
  !this.destroyed && !this.owner ? this.dontDestroy ? $t && console.warn("PlayerState.start → owner is still undefined but dontDestroy is set to true", this.name) : ($t && console.warn(`PlayerState.start → owner is still undefined: destroying "${this.name}" instance now`), this.doDestroy()) : $t && console.log("PlayerState.start → owner is assigned", this.owner);
26379
26393
  }, 2e3));
26380
26394
  }
@@ -26409,7 +26423,7 @@ var SR = Object.defineProperty, Ua = (s, e, t, i) => {
26409
26423
  (r = s[o]) && (n = r(e, t, n) || n);
26410
26424
  return n && SR(e, t, n), n;
26411
26425
  };
26412
- class Is extends R {
26426
+ class As extends R {
26413
26427
  position = "bottom";
26414
26428
  showNeedleLogo = !1;
26415
26429
  showSpatialMenu;
@@ -26432,22 +26446,22 @@ class Is extends R {
26432
26446
  }
26433
26447
  Ua([
26434
26448
  u()
26435
- ], Is.prototype, "position");
26449
+ ], As.prototype, "position");
26436
26450
  Ua([
26437
26451
  u()
26438
- ], Is.prototype, "showNeedleLogo");
26452
+ ], As.prototype, "showNeedleLogo");
26439
26453
  Ua([
26440
26454
  u()
26441
- ], Is.prototype, "showSpatialMenu");
26455
+ ], As.prototype, "showSpatialMenu");
26442
26456
  Ua([
26443
26457
  u()
26444
- ], Is.prototype, "createFullscreenButton");
26458
+ ], As.prototype, "createFullscreenButton");
26445
26459
  Ua([
26446
26460
  u()
26447
- ], Is.prototype, "createMuteButton");
26461
+ ], As.prototype, "createMuteButton");
26448
26462
  Ua([
26449
26463
  u()
26450
- ], Is.prototype, "createQRCodeButton");
26464
+ ], As.prototype, "createQRCodeButton");
26451
26465
  var CR = Object.defineProperty, bg = (s, e, t, i) => {
26452
26466
  for (var n = void 0, o = s.length - 1, r; o >= 0; o--)
26453
26467
  (r = s[o]) && (n = r(e, t, n) || n);
@@ -26502,7 +26516,7 @@ class dr extends R {
26502
26516
  if (i) {
26503
26517
  const n = e.model && e.model.visible && e.model !== t;
26504
26518
  i.forEach((o) => {
26505
- ds(o, !n);
26519
+ hs(o, !n);
26506
26520
  });
26507
26521
  }
26508
26522
  }
@@ -26580,7 +26594,7 @@ var PR = Object.defineProperty, vu = (s, e, t, i) => {
26580
26594
  (r = s[o]) && (n = r(e, t, n) || n);
26581
26595
  return n && PR(e, t, n), n;
26582
26596
  };
26583
- const es = w("debugwebxr"), $s = new Array();
26597
+ const Ns = w("debugwebxr"), $s = new Array();
26584
26598
  class mo extends R {
26585
26599
  createControllerModel = !0;
26586
26600
  createHandModel = !0;
@@ -26593,8 +26607,9 @@ class mo extends R {
26593
26607
  _models = new Array();
26594
26608
  async onXRControllerAdded(e) {
26595
26609
  if (!(e.xr.isVR || e.xr.isPassThrough)) return;
26610
+ console.debug("XR Controller Added", e.controller.side, e.controller.index);
26596
26611
  const { controller: i } = e;
26597
- if (es && console.warn("Add Controller Model for", i.side, i.index), this.createControllerModel || this.createHandModel) {
26612
+ if (this.createControllerModel || this.createHandModel) {
26598
26613
  if (i.hand) {
26599
26614
  if (this.createHandModel) {
26600
26615
  const n = await this.loadHandModel(this, i);
@@ -26631,7 +26646,7 @@ class mo extends R {
26631
26646
  this._models.length = 0;
26632
26647
  }
26633
26648
  onBeforeRender() {
26634
- if (K.active && (es && ($s[0] = Date.now()), this.updateRendering(K.active), es)) {
26649
+ if (K.active && (Ns && ($s[0] = Date.now()), this.updateRendering(K.active), Ns)) {
26635
26650
  const e = Date.now() - $s[0];
26636
26651
  $s.push(e), $s.length >= 30 && ($s[0] = 0, $s.reduce((t, i) => t + i, 0) / $s.length, $s.length = 0);
26637
26652
  }
@@ -26642,7 +26657,7 @@ class mo extends R {
26642
26657
  if (!i) continue;
26643
26658
  const n = i.controller;
26644
26659
  if (!n.connected) {
26645
- es && console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore", n.side, n.hand);
26660
+ Ns && console.warn("XRControllerModel.onUpdateXR: controller is not connected anymore", n.side, n.hand);
26646
26661
  continue;
26647
26662
  }
26648
26663
  if (i.model && !i.handmesh)
@@ -26676,8 +26691,8 @@ class mo extends R {
26676
26691
  }
26677
26692
  async loadHandModel(e, t) {
26678
26693
  const i = this.context, n = i.renderer.xr.getHand(t.index);
26679
- n || (es ? z.DrawLabel(t.rayWorldPosition, "No hand found for index " + t.index, 0.05, 5) : console.warn("No hand found for index " + t.index));
26680
- const o = new Os();
26694
+ n || (Ns ? z.DrawLabel(t.rayWorldPosition, "No hand found for index " + t.index, 0.05, 5) : console.warn("No hand found for index " + t.index));
26695
+ const o = new Ps();
26681
26696
  Qm(o, i), await Vp(o, i, this.sourceId ?? "");
26682
26697
  const r = bv(o);
26683
26698
  let a = "";
@@ -26688,18 +26703,18 @@ class mo extends R {
26688
26703
  const h = new kS(c, n, o.path, a, o, (d) => {
26689
26704
  const f = r?.gltf;
26690
26705
  f?.scene.children?.length === 0 && (f.scene.children[0] = d), r?.gltf && Bn().createBuiltinComponents(e.context, e.sourceId || a, r.gltf, null, r), d.traverse((p) => {
26691
- p.layers.set(2), K.active?.isPassThrough && !l && this.makeOccluder(p), p instanceof H && We.assignMeshLOD(p, 0);
26692
- }), t.connected || (es && z.DrawLabel(t.rayWorldPosition, "Hand is loaded but not connected anymore", 0.05, 5), d.removeFromParent());
26706
+ p.layers.set(2), K.active?.isPassThrough && !l && this.makeOccluder(p), p instanceof H && Ve.assignMeshLOD(p, 0);
26707
+ }), t.connected || (Ns && z.DrawLabel(t.rayWorldPosition, "Hand is loaded but not connected anymore", 0.05, 5), d.removeFromParent());
26693
26708
  });
26694
- if (es && c.add(new gi(0.5)), t.inputSource.hand) {
26695
- es && console.log(t.inputSource.hand);
26709
+ if (Ns && c.add(new gi(0.5)), t.inputSource.hand) {
26710
+ Ns && console.log(t.inputSource.hand);
26696
26711
  for (const d of t.inputSource.hand.values())
26697
26712
  if (n.joints[d.jointName] === void 0) {
26698
26713
  const f = new oo();
26699
26714
  f.matrixAutoUpdate = !1, f.visible = !0, n.joints[d.jointName] = f, n.add(f);
26700
26715
  }
26701
26716
  } else
26702
- es && z.DrawLabel(t.rayWorldPosition, "No inputSource.hand found for index " + t.index, 0.05, 5);
26717
+ Ns && z.DrawLabel(t.rayWorldPosition, "No inputSource.hand found for index " + t.index, 0.05, 5);
26703
26718
  return { handObject: c, handmesh: h };
26704
26719
  }
26705
26720
  makeOccluder(e) {
@@ -26763,8 +26778,8 @@ class qi extends R {
26763
26778
  if (i.x != 0 || i.y != 0) {
26764
26779
  const n = G(i.x, 0, i.y);
26765
26780
  n.multiplyScalar(this.context.time.deltaTimeUnscaled * this.movementSpeed);
26766
- const o = $e(t);
26767
- n.multiplyScalar(o.x), n.applyQuaternion(e.xr.poseOrientation), n.y = 0, n.applyQuaternion(t.worldQuaternion), t.position.add(n), t.updateWorldMatrix(!1, !1);
26781
+ const o = We(t);
26782
+ n.multiplyScalar(o.x), n.applyQuaternion(e.xr.poseOrientation), n.y = 0, n.applyQuaternion(t.worldQuaternion), L() && Number.isNaN(n.x) && console.error("Stick movement resulted in NaN", { stick: i, vec: n }), t.position.add(n), t.updateWorldMatrix(!1, !1);
26768
26783
  for (const r of t.children) r.updateWorldMatrix(!1, !1);
26769
26784
  }
26770
26785
  }
@@ -27013,7 +27028,7 @@ const fl = w("debugwebxr"), RR = w("debugusdz"), at = class qr extends R {
27013
27028
  * @internal
27014
27029
  */
27015
27030
  onEnable() {
27016
- window.location.protocol !== "https:" && ge('<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API" target="_blank">WebXR</a> only works on secure connections (https).'), this.useQuicklookExport && (S.findObjectOfType(xs) || (fl && console.log("WebXR: Adding USDZExporter"), this._usdzExporter = S.addComponent(this.gameObject, xs), this._usdzExporter.objectToExport = this.context.scene, this._usdzExporter.autoExportAnimations = !0, this._usdzExporter.autoExportAudioSources = !0)), this.handleCreatingHTML(), this.handleOfferSession(), this.defaultAvatar === !0 && (fl && console.warn("WebXR: No default avatar set, using static default avatar"), this.defaultAvatar = new ie("https://cdn.needle.tools/static/avatars/DefaultAvatar.glb")), this.defaultAvatar && (this._playerSync = this.gameObject.getOrAddComponent(Wv), this._playerSync.autoSync = !1), this._playerSync && typeof this.defaultAvatar != "boolean" && (this._playerSync.asset = this.defaultAvatar, this._playerSync.onPlayerSpawned?.removeEventListener(this.onAvatarSpawned), this._playerSync.onPlayerSpawned?.addEventListener(this.onAvatarSpawned));
27031
+ window.location.protocol !== "https:" && ge('<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API" target="_blank">WebXR</a> only works on secure connections (https).'), this.useQuicklookExport && (S.findObjectOfType(ws) || (fl && console.log("WebXR: Adding USDZExporter"), this._usdzExporter = S.addComponent(this.gameObject, ws), this._usdzExporter.objectToExport = this.context.scene, this._usdzExporter.autoExportAnimations = !0, this._usdzExporter.autoExportAudioSources = !0)), this.handleCreatingHTML(), this.handleOfferSession(), this.defaultAvatar === !0 && (fl && console.warn("WebXR: No default avatar set, using static default avatar"), this.defaultAvatar = new ie("https://cdn.needle.tools/static/avatars/DefaultAvatar.glb")), this.defaultAvatar && (this._playerSync = this.gameObject.getOrAddComponent(Wv), this._playerSync.autoSync = !1), this._playerSync && typeof this.defaultAvatar != "boolean" && (this._playerSync.asset = this.defaultAvatar, this._playerSync.onPlayerSpawned?.removeEventListener(this.onAvatarSpawned), this._playerSync.onPlayerSpawned?.addEventListener(this.onAvatarSpawned));
27017
27032
  }
27018
27033
  /**
27019
27034
  * Cleans up resources when the component is disabled.
@@ -27096,7 +27111,7 @@ const fl = w("debugwebxr"), RR = w("debugusdz"), at = class qr extends R {
27096
27111
  if (!this.isActiveWebXR) return;
27097
27112
  fl && console.log("WebXR onEnterXR"), this._previousXRState = Jt.Global.Mask;
27098
27113
  const t = e.xr.isVR;
27099
- if (Jt.Global.Set(t ? fs.VR : fs.AR), e.xr.isAR) {
27114
+ if (Jt.Global.Set(t ? us.VR : us.AR), e.xr.isAR) {
27100
27115
  let i = S.findObjectOfType($i);
27101
27116
  if (!i)
27102
27117
  if (this.usePlacementReticle) {
@@ -27104,7 +27119,7 @@ const fl = w("debugwebxr"), RR = w("debugusdz"), at = class qr extends R {
27104
27119
  for (const o of this.context.scene.children)
27105
27120
  n.add(o);
27106
27121
  this.context.scene.add(n), i = S.addComponent(n, $i), this._createdComponentsInSession.push(i);
27107
- } else (fl || D()) && console.warn("WebXR: No WebARSessionRoot found in scene and usePlacementReticle is disabled in WebXR component.");
27122
+ } else (fl || L()) && console.warn("WebXR: No WebARSessionRoot found in scene and usePlacementReticle is disabled in WebXR component.");
27108
27123
  this._activeWebARSessionRoot = i, i && (i.customReticle = this.customARPlacementReticle, i.arScale = this.arScale, i.arTouchTransform = this.usePlacementAdjustment, i.autoPlace = this.autoPlace, i.autoCenter = this.autoCenter, i.useXRAnchor = this.useXRAnchor);
27109
27124
  }
27110
27125
  this.useDefaultControls && this.setDefaultMovementEnabled(!0), (this.showControllerModels || this.showHandModels) && this.setDefaultControllerRenderingEnabled(!0), this.useSpatialGrab && (this._spatialGrabRaycaster = S.findObjectOfType(Ra) ?? void 0, this._spatialGrabRaycaster || (this._spatialGrabRaycaster = this.gameObject.addComponent(Ra))), this.createLocalAvatar(e.xr), e.xr.isScreenBasedAR || (this._exitXRMenuButton = this.context.menu.appendChild({
@@ -27188,7 +27203,7 @@ const fl = w("debugwebxr"), RR = w("debugusdz"), at = class qr extends R {
27188
27203
  handleCreatingHTML() {
27189
27204
  if (this.createARButton || this.createVRButton || this.useQuicklookExport) {
27190
27205
  if ((q.isiOS() && q.isSafari() || RR) && this.useQuicklookExport) {
27191
- const t = S.findObjectOfType(xs);
27206
+ const t = S.findObjectOfType(ws);
27192
27207
  if (!t || t && t.allowCreateQuicklookButton) {
27193
27208
  const i = this.getButtonsFactory().createQuicklookButton();
27194
27209
  this.addButton(i, 50);
@@ -27209,9 +27224,9 @@ const fl = w("debugwebxr"), RR = w("debugusdz"), at = class qr extends R {
27209
27224
  this.addButton(i, 50);
27210
27225
  }
27211
27226
  }), this.createQRCode) {
27212
- const t = eu(Is);
27227
+ const t = eu(As);
27213
27228
  if (t && t.createQRCodeButton === !1)
27214
- D() && console.warn("WebXR: QRCode button is disabled in the Needle Menu component");
27229
+ L() && console.warn("WebXR: QRCode button is disabled in the Needle Menu component");
27215
27230
  else if (!q.isMobileDevice()) {
27216
27231
  const i = Mn.getOrCreate().createQRCode();
27217
27232
  this.addButton(i, 50);
@@ -27926,9 +27941,9 @@ const xh = {
27926
27941
  e = Il.textureCache.get(e);
27927
27942
  else if (!e.isRenderTargetTexture) {
27928
27943
  const t = e.clone();
27929
- t.colorSpace = Cs, Il.textureCache.set(e, t), e = t;
27944
+ t.colorSpace = Ss, Il.textureCache.set(e, t), e = t;
27930
27945
  }
27931
- this.setOptions({ backgroundImage: e, borderRadius: 0, backgroundOpacity: this.color.alpha, backgroundSize: "stretch" }), We.assignTextureLOD(e, 0).then((t) => {
27946
+ this.setOptions({ backgroundImage: e, borderRadius: 0, backgroundOpacity: this.color.alpha, backgroundSize: "stretch" }), Ve.assignTextureLOD(e, 0).then((t) => {
27932
27947
  t instanceof Te && (e && Il.textureCache.set(e, t), this.setOptions({ backgroundImage: t }), this.markDirty());
27933
27948
  });
27934
27949
  } else
@@ -27952,7 +27967,7 @@ class Su extends xu {
27952
27967
  this.uiObject && !this._flippedObject && (this._flippedObject = !0, this.uiObject.scale.y *= -1);
27953
27968
  }
27954
27969
  }
27955
- var FR = Object.defineProperty, zR = Object.getOwnPropertyDescriptor, Ls = (s, e, t, i) => {
27970
+ var FR = Object.defineProperty, zR = Object.getOwnPropertyDescriptor, Is = (s, e, t, i) => {
27956
27971
  for (var n = i > 1 ? void 0 : i ? zR(e, t) : e, o = s.length - 1, r; o >= 0; o--)
27957
27972
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
27958
27973
  return i && n && FR(e, t, n), n;
@@ -28242,31 +28257,31 @@ class qt extends xu {
28242
28257
  }
28243
28258
  }
28244
28259
  }
28245
- Ls([
28260
+ Is([
28246
28261
  u()
28247
28262
  ], qt.prototype, "alignment", 2);
28248
- Ls([
28263
+ Is([
28249
28264
  u()
28250
28265
  ], qt.prototype, "verticalOverflow", 2);
28251
- Ls([
28266
+ Is([
28252
28267
  u()
28253
28268
  ], qt.prototype, "horizontalOverflow", 2);
28254
- Ls([
28269
+ Is([
28255
28270
  u()
28256
28271
  ], qt.prototype, "lineSpacing", 2);
28257
- Ls([
28272
+ Is([
28258
28273
  u()
28259
28274
  ], qt.prototype, "supportRichText", 2);
28260
- Ls([
28275
+ Is([
28261
28276
  u(URL)
28262
28277
  ], qt.prototype, "font", 2);
28263
- Ls([
28278
+ Is([
28264
28279
  u()
28265
28280
  ], qt.prototype, "fontStyle", 2);
28266
- Ls([
28281
+ Is([
28267
28282
  u()
28268
28283
  ], qt.prototype, "text", 1);
28269
- Ls([
28284
+ Is([
28270
28285
  u()
28271
28286
  ], qt.prototype, "fontSize", 1);
28272
28287
  class Hf {
@@ -28533,8 +28548,8 @@ class So extends Ci {
28533
28548
  a ? m += this.padding.left : m += this.padding.top;
28534
28549
  let v = 0, _ = 0;
28535
28550
  for (let E = 0; E < this.gameObject.children.length; E++) {
28536
- const B = this.gameObject.children[E], L = S.getComponent(B, Un);
28537
- L?.activeAndEnabled && (_ += 1, a ? v += L.width : v += L.height);
28551
+ const B = this.gameObject.children[E], D = S.getComponent(B, Un);
28552
+ D?.activeAndEnabled && (_ += 1, a ? v += D.width : v += D.height);
28538
28553
  }
28539
28554
  let x = 0;
28540
28555
  const I = this.spacing * (_ - 1);
@@ -28546,20 +28561,20 @@ class So extends Ci {
28546
28561
  O += this.padding.left, O -= this.padding.right, b !== 0 && (m = g - v, m *= b, m -= I * b, a ? (m -= this.padding.right * b, m += this.padding.left * (1 - b), m < this.padding.left && (m = this.padding.left)) : (m -= this.padding.bottom * b, m += this.padding.top * (1 - b), m < this.padding.top && (m = this.padding.top)));
28547
28562
  let k = 1;
28548
28563
  for (let E = 0; E < this.gameObject.children.length; E++) {
28549
- const B = this.gameObject.children[E], L = S.getComponent(B, Un);
28550
- if (L?.activeAndEnabled) {
28551
- L.pivot?.set(0.5, 0.5), L.anchorMin.set(0, 1), L.anchorMax.set(0, 1);
28564
+ const B = this.gameObject.children[E], D = S.getComponent(B, Un);
28565
+ if (D?.activeAndEnabled) {
28566
+ D.pivot?.set(0.5, 0.5), D.anchorMin.set(0, 1), D.anchorMax.set(0, 1);
28552
28567
  const W = i * 0.5 + O * 0.5;
28553
- L.anchoredPosition.x !== W && (L.anchoredPosition.x = W);
28568
+ D.anchoredPosition.x !== W && (D.anchoredPosition.x = W);
28554
28569
  const X = o * -0.5;
28555
- L.anchoredPosition.y !== X && (L.anchoredPosition.y = X), f && h && L.sizeDelta[l] !== p && (L.sizeDelta[l] = p), d && c && L.sizeDelta[t] !== x && (L.sizeDelta[t] = x);
28556
- const A = a ? L.width : L.height, $ = A * 0.5;
28570
+ D.anchoredPosition.y !== X && (D.anchoredPosition.y = X), f && h && D.sizeDelta[l] !== p && (D.sizeDelta[l] = p), d && c && D.sizeDelta[t] !== x && (D.sizeDelta[t] = x);
28571
+ const A = a ? D.width : D.height, $ = A * 0.5;
28557
28572
  if (m += $, d) {
28558
28573
  const ne = x * k - x * 0.5;
28559
28574
  ne > m && (m = ne - x * 0.5 + A + this.padding.left, m -= $);
28560
28575
  }
28561
28576
  let V = m;
28562
- t === "y" && (V = -V), L.anchoredPosition[t] !== V && (L.anchoredPosition[t] = V), m += $, m += this.spacing, k += 1;
28577
+ t === "y" && (V = -V), D.anchoredPosition[t] !== V && (D.anchoredPosition[t] = V), m += $, m += this.spacing, k += 1;
28563
28578
  }
28564
28579
  }
28565
28580
  }
@@ -29118,7 +29133,7 @@ const ni = class jl extends R {
29118
29133
  */
29119
29134
  async exportAndOpen() {
29120
29135
  let e = this.exportFileName ?? this.objectToExport?.name ?? this.name;
29121
- if (e += "-" + DM(), vs() || (e !== "" && (e += "-"), e += "MadeWithNeedle"), this.link || (this.link = $_(this.context, q.supportsQuickLookAR())), this.customUsdzFile)
29136
+ if (e += "-" + DM(), bs() || (e !== "" && (e += "-"), e += "MadeWithNeedle"), this.link || (this.link = $_(this.context, q.supportsQuickLookAR())), this.customUsdzFile)
29122
29137
  return si && console.log("Exporting custom usdz", this.customUsdzFile), this.openInQuickLook(this.customUsdzFile, e), null;
29123
29138
  if (!this.objectToExport)
29124
29139
  return console.warn("No object to export", this), null;
@@ -29157,30 +29172,30 @@ const ni = class jl extends R {
29157
29172
  for (const O of i) {
29158
29173
  for (const k of O.sharedMeshes)
29159
29174
  if (k) {
29160
- const E = We.assignMeshLOD(k, 0);
29161
- E instanceof Promise && n.push(new Promise((B, L) => {
29175
+ const E = Ve.assignMeshLOD(k, 0);
29176
+ E instanceof Promise && n.push(new Promise((B, D) => {
29162
29177
  E.then(() => {
29163
29178
  o++, le.report("export-usdz-textures", { message: "Loaded progressive mesh", currentStep: o, totalSteps: n.length }), B();
29164
- }).catch((W) => L(W));
29179
+ }).catch((W) => D(W));
29165
29180
  }));
29166
29181
  }
29167
29182
  for (const k of O.sharedMaterials)
29168
29183
  if (k) {
29169
- const E = We.assignTextureLOD(k, 0);
29170
- E instanceof Promise && n.push(new Promise((B, L) => {
29184
+ const E = Ve.assignTextureLOD(k, 0);
29185
+ E instanceof Promise && n.push(new Promise((B, D) => {
29171
29186
  E.then(() => {
29172
29187
  o++, le.report("export-usdz-textures", { message: "Loaded progressive texture", currentStep: o, totalSteps: n.length }), B();
29173
- }).catch((W) => L(W));
29188
+ }).catch((W) => D(W));
29174
29189
  }));
29175
29190
  }
29176
29191
  }
29177
29192
  si && Be("Progressive Loading: " + n.length), await Promise.all(n), si && Be("Progressive Loading: done"), le.end("export-usdz-textures");
29178
29193
  const r = Jt.Global.Mask;
29179
- Jt.Global.Set(fs.AR);
29194
+ Jt.Global.Set(us.AR);
29180
29195
  const a = new qM(), l = new mg(this.quickLookCompatible);
29181
29196
  let c;
29182
29197
  const h = [];
29183
- this.interactive && (h.push(new Vv()), h.push(new Fa()), globalThis.NEEDLE_USE_RAPIER && S.getComponentsInChildren(e, pt).length > 0 && (this.physics ? (c = new Hv(), h.push(c)) : D() && console.warn("USDZExporter: Physics export is disabled, but there are active Rigidbody components in the scene. They will not be exported.")), h.push(new Sg()), h.push(new iw()));
29198
+ this.interactive && (h.push(new Vv()), h.push(new Fa()), globalThis.NEEDLE_USE_RAPIER && S.getComponentsInChildren(e, pt).length > 0 && (this.physics ? (c = new Hv(), h.push(c)) : L() && console.warn("USDZExporter: Physics export is disabled, but there are active Rigidbody components in the scene. They will not be exported.")), h.push(new Sg()), h.push(new iw()));
29184
29199
  const d = [l, ...h, ...this.extensions], f = { self: this, exporter: a, extensions: d, object: e };
29185
29200
  le.report("export-usdz", "Invoking before-export"), this.dispatchEvent(new CustomEvent("before-export", { detail: f })), this.applyWebARSessionRoot(), this._previousTimeScale = this.context.time.timeScale, this.context.time.timeScale = 0, le.report("export-usdz", "auto export animations and audio sources");
29186
29201
  const p = new Array();
@@ -29189,12 +29204,12 @@ const ni = class jl extends R {
29189
29204
  a.keepObject = (O) => {
29190
29205
  let k = !0;
29191
29206
  const E = S.getComponent(O, Gi);
29192
- return E && !E.enabled && (k = !1), k && b.includes(O) && (k = !1), k && S.getComponentInParent(O, hu) && (k = !1), k && S.getComponentInParent(O, Ts) && (k = !1), si && !k && console.log("USDZExporter: Discarding object", O), k;
29207
+ return E && !E.enabled && (k = !1), k && b.includes(O) && (k = !1), k && S.getComponentInParent(O, hu) && (k = !1), k && S.getComponentInParent(O, Rs) && (k = !1), si && !k && console.log("USDZExporter: Discarding object", O), k;
29193
29208
  }, a.beforeWritingDocument = () => {
29194
- if (D() && l && c) {
29209
+ if (L() && l && c) {
29195
29210
  const O = l.animatedRoots;
29196
29211
  for (const k of O) {
29197
- const E = S.getComponentsInChildren(k, pt).filter((L) => L.enabled), B = S.getComponents(k, xi).filter((L) => L.enabled && !L.isTrigger);
29212
+ const E = S.getComponentsInChildren(k, pt).filter((D) => D.enabled), B = S.getComponents(k, xi).filter((D) => D.enabled && !D.isTrigger);
29198
29213
  (E.length > 0 || B.length > 0) && console.error("An animated object has physics components in its child hierarchy. This can lead to undefined behaviour due to a bug in Apple's QuickLook (FB15925487). Remove the physics components from child objects or verify that you get the expected results.", k);
29199
29214
  }
29200
29215
  }
@@ -29257,14 +29272,14 @@ const ni = class jl extends R {
29257
29272
  const i = new URLSearchParams(this.link.href);
29258
29273
  if (i) {
29259
29274
  const n = i.get("callToActionURL");
29260
- si && Be("Quicklook url: " + n), n && (vs() ? globalThis.open(n, "_blank") : console.warn("Quicklook closed: custom redirects require a Needle Engine Pro license: https://needle.tools/pricing", n));
29275
+ si && Be("Quicklook url: " + n), n && (bs() ? globalThis.open(n, "_blank") : console.warn("Quicklook closed: custom redirects require a Needle Engine Pro license: https://needle.tools/pricing", n));
29261
29276
  }
29262
29277
  }
29263
29278
  }
29264
29279
  }
29265
29280
  buildQuicklookOverlay() {
29266
29281
  const e = {};
29267
- return this.customBranding && Object.assign(e, this.customBranding), vs() || (console.log("Custom Quicklook banner text requires pro license: https://needle.tools/pricing"), e.callToAction = "Close", e.checkoutTitle = "🌵 Made with Needle", e.checkoutSubtitle = "_"), (e.callToAction?.length || e.checkoutTitle?.length || e.checkoutSubtitle?.length) && (e.callToAction?.length || (e.callToAction = "\0"), e.checkoutTitle?.length || (e.checkoutTitle = "\0"), e.checkoutSubtitle?.length || (e.checkoutSubtitle = "\0")), this.dispatchEvent(new CustomEvent("quicklook-overlay", { detail: e })), e;
29282
+ return this.customBranding && Object.assign(e, this.customBranding), bs() || (console.log("Custom Quicklook banner text requires pro license: https://needle.tools/pricing"), e.callToAction = "Close", e.checkoutTitle = "🌵 Made with Needle", e.checkoutSubtitle = "_"), (e.callToAction?.length || e.checkoutTitle?.length || e.checkoutSubtitle?.length) && (e.callToAction?.length || (e.callToAction = "\0"), e.checkoutTitle?.length || (e.checkoutTitle = "\0"), e.checkoutSubtitle?.length || (e.checkoutSubtitle = "\0")), this.dispatchEvent(new CustomEvent("quicklook-overlay", { detail: e })), e;
29268
29283
  }
29269
29284
  static invertForwardMatrix = new te().makeRotationY(Math.PI);
29270
29285
  static invertForwardQuaternion = new U().setFromEuler(new Tt(0, Math.PI, 0));
@@ -29335,7 +29350,7 @@ Ot([
29335
29350
  Ot([
29336
29351
  u()
29337
29352
  ], ni.prototype, "quickLookCompatible");
29338
- let xs = ni;
29353
+ let ws = ni;
29339
29354
  var JR = Object.defineProperty, eT = Object.getOwnPropertyDescriptor, Pg = (s, e, t, i) => {
29340
29355
  for (var n = eT(e, t), o = s.length - 1, r; o >= 0; o--)
29341
29356
  (r = s[o]) && (n = r(e, t, n) || n);
@@ -30141,7 +30156,7 @@ var pT = Object.defineProperty, C = (s, e, t, i) => {
30141
30156
  return n && pT(e, t, n), n;
30142
30157
  };
30143
30158
  const Ch = w("debugparticles");
30144
- var cs = /* @__PURE__ */ ((s) => (s[s.Billboard = 0] = "Billboard", s[s.Stretch = 1] = "Stretch", s[s.HorizontalBillboard = 2] = "HorizontalBillboard", s[s.VerticalBillboard = 3] = "VerticalBillboard", s[s.Mesh = 4] = "Mesh", s))(cs || {});
30159
+ var ls = /* @__PURE__ */ ((s) => (s[s.Billboard = 0] = "Billboard", s[s.Stretch = 1] = "Stretch", s[s.HorizontalBillboard = 2] = "HorizontalBillboard", s[s.VerticalBillboard = 3] = "VerticalBillboard", s[s.Mesh = 4] = "Mesh", s))(ls || {});
30145
30160
  class Ga {
30146
30161
  alphaKeys = [];
30147
30162
  colorKeys = [];
@@ -30180,7 +30195,7 @@ C([
30180
30195
  u()
30181
30196
  ], Ga.prototype, "colorKeys");
30182
30197
  var gc = /* @__PURE__ */ ((s) => (s[s.Local = 0] = "Local", s[s.World = 1] = "World", s[s.Custom = 2] = "Custom", s))(gc || {}), Zp = /* @__PURE__ */ ((s) => (s[s.Sphere = 0] = "Sphere", s[s.SphereShell = 1] = "SphereShell", s[s.Hemisphere = 2] = "Hemisphere", s[s.HemisphereShell = 3] = "HemisphereShell", s[s.Cone = 4] = "Cone", s[s.Box = 5] = "Box", s[s.Mesh = 6] = "Mesh", s[s.ConeShell = 7] = "ConeShell", s[s.ConeVolume = 8] = "ConeVolume", s[s.ConeVolumeShell = 9] = "ConeVolumeShell", s[s.Circle = 10] = "Circle", s[s.CircleEdge = 11] = "CircleEdge", s[s.SingleSidedEdge = 12] = "SingleSidedEdge", s[s.MeshRenderer = 13] = "MeshRenderer", s[s.SkinnedMeshRenderer = 14] = "SkinnedMeshRenderer", s[s.BoxShell = 15] = "BoxShell", s[s.BoxEdge = 16] = "BoxEdge", s[s.Donut = 17] = "Donut", s[s.Rectangle = 18] = "Rectangle", s[s.Sprite = 19] = "Sprite", s[s.SpriteRenderer = 20] = "SpriteRenderer", s))(Zp || {});
30183
- const Ds = class Fl {
30198
+ const Ls = class Fl {
30184
30199
  static constant(e) {
30185
30200
  const t = new Fl();
30186
30201
  return t.setConstant(e), t;
@@ -30266,29 +30281,29 @@ const Ds = class Fl {
30266
30281
  };
30267
30282
  C([
30268
30283
  u()
30269
- ], Ds.prototype, "mode");
30284
+ ], Ls.prototype, "mode");
30270
30285
  C([
30271
30286
  u()
30272
- ], Ds.prototype, "constant");
30287
+ ], Ls.prototype, "constant");
30273
30288
  C([
30274
30289
  u()
30275
- ], Ds.prototype, "constantMin");
30290
+ ], Ls.prototype, "constantMin");
30276
30291
  C([
30277
30292
  u()
30278
- ], Ds.prototype, "constantMax");
30293
+ ], Ls.prototype, "constantMax");
30279
30294
  C([
30280
30295
  u(Ru)
30281
- ], Ds.prototype, "curve");
30296
+ ], Ls.prototype, "curve");
30282
30297
  C([
30283
30298
  u(Ru)
30284
- ], Ds.prototype, "curveMin");
30299
+ ], Ls.prototype, "curveMin");
30285
30300
  C([
30286
30301
  u(Ru)
30287
- ], Ds.prototype, "curveMax");
30302
+ ], Ls.prototype, "curveMax");
30288
30303
  C([
30289
30304
  u()
30290
- ], Ds.prototype, "curveMultiplier");
30291
- let Y = Ds;
30305
+ ], Ls.prototype, "curveMultiplier");
30306
+ let Y = Ls;
30292
30307
  const Po = class Ct {
30293
30308
  static constant(e) {
30294
30309
  const t = new Ct();
@@ -30677,7 +30692,7 @@ const Ke = class zl {
30677
30692
  }
30678
30693
  break;
30679
30694
  default:
30680
- this._vector.set(0, 0, 0), D() && !globalThis.__particlesystem_shapetype_unsupported && (console.warn("ParticleSystem ShapeType is not supported:", Zp[this.shapeType]), globalThis.__particlesystem_shapetype_unsupported = !0);
30695
+ this._vector.set(0, 0, 0), L() && !globalThis.__particlesystem_shapetype_unsupported && (console.warn("ParticleSystem ShapeType is not supported:", Zp[this.shapeType]), globalThis.__particlesystem_shapetype_unsupported = !0);
30681
30696
  break;
30682
30697
  }
30683
30698
  this.randomizePosition(this._vector, this.randomPositionAmount);
@@ -31052,7 +31067,7 @@ C([
31052
31067
  C([
31053
31068
  u()
31054
31069
  ], Ne.prototype, "worldSpace");
31055
- class Ve {
31070
+ class He {
31056
31071
  enabled;
31057
31072
  space = 0;
31058
31073
  orbitalX;
@@ -31090,7 +31105,7 @@ class Ve {
31090
31105
  if (!this.enabled) return;
31091
31106
  const l = r / a, c = this.speedModifier.evaluate(l) * this.speedModifierMultiplier, h = this.x.evaluate(l), d = this.y.evaluate(l), f = this.z.evaluate(l);
31092
31107
  if (this._temp.set(-h, d, f), this._system && this._system.main.simulationSpace === 1 && this._temp.applyQuaternion(this._system.worldQuaternion), this._hasOrbital && this._system?.worldPos) {
31093
- const g = this._temp2.set(i.x, i.y, i.z), b = this.orbitalXMultiplier, m = this.orbitalYMultiplier, v = this.orbitalZMultiplier, _ = c * Math.PI * 2 * 10, x = Math.cos(_ * b), I = Math.sin(_ * b), O = Math.cos(_ * m), k = Math.sin(_ * m), E = Math.cos(_ * v), B = Math.sin(_ * v), L = g.x * (O * E) + g.y * (O * B) + g.z * -k, W = g.x * (I * k * E - x * B) + g.y * (I * k * B + x * E) + g.z * (I * O), X = g.x * (x * k * E + I * B) + g.y * (x * k * B - I * E) + g.z * (x * O), A = this._temp3.set(g.x - L, g.y - W, g.z - X);
31108
+ const g = this._temp2.set(i.x, i.y, i.z), b = this.orbitalXMultiplier, m = this.orbitalYMultiplier, v = this.orbitalZMultiplier, _ = c * Math.PI * 2 * 10, x = Math.cos(_ * b), I = Math.sin(_ * b), O = Math.cos(_ * m), k = Math.sin(_ * m), E = Math.cos(_ * v), B = Math.sin(_ * v), D = g.x * (O * E) + g.y * (O * B) + g.z * -k, W = g.x * (I * k * E - x * B) + g.y * (I * k * B + x * E) + g.z * (I * O), X = g.x * (x * k * E + I * B) + g.y * (x * k * B - I * E) + g.z * (x * O), A = this._temp3.set(g.x - D, g.y - W, g.z - X);
31094
31109
  A.normalize(), A.multiplyScalar(0.2 / o * Math.max(this.orbitalXMultiplier, this.orbitalYMultiplier, this.orbitalZMultiplier)), n.x += A.x, n.y += A.y, n.z += A.z;
31095
31110
  }
31096
31111
  n.x += this._temp.x, n.y += this._temp.y, n.z += this._temp.z, n.x *= c, n.y *= c, n.z *= c;
@@ -31098,61 +31113,61 @@ class Ve {
31098
31113
  }
31099
31114
  C([
31100
31115
  u()
31101
- ], Ve.prototype, "enabled");
31116
+ ], He.prototype, "enabled");
31102
31117
  C([
31103
31118
  u()
31104
- ], Ve.prototype, "space");
31119
+ ], He.prototype, "space");
31105
31120
  C([
31106
31121
  u(Y)
31107
- ], Ve.prototype, "orbitalX");
31122
+ ], He.prototype, "orbitalX");
31108
31123
  C([
31109
31124
  u(Y)
31110
- ], Ve.prototype, "orbitalY");
31125
+ ], He.prototype, "orbitalY");
31111
31126
  C([
31112
31127
  u(Y)
31113
- ], Ve.prototype, "orbitalZ");
31128
+ ], He.prototype, "orbitalZ");
31114
31129
  C([
31115
31130
  u()
31116
- ], Ve.prototype, "orbitalXMultiplier");
31131
+ ], He.prototype, "orbitalXMultiplier");
31117
31132
  C([
31118
31133
  u()
31119
- ], Ve.prototype, "orbitalYMultiplier");
31134
+ ], He.prototype, "orbitalYMultiplier");
31120
31135
  C([
31121
31136
  u()
31122
- ], Ve.prototype, "orbitalZMultiplier");
31137
+ ], He.prototype, "orbitalZMultiplier");
31123
31138
  C([
31124
31139
  u()
31125
- ], Ve.prototype, "orbitalOffsetX");
31140
+ ], He.prototype, "orbitalOffsetX");
31126
31141
  C([
31127
31142
  u()
31128
- ], Ve.prototype, "orbitalOffsetY");
31143
+ ], He.prototype, "orbitalOffsetY");
31129
31144
  C([
31130
31145
  u()
31131
- ], Ve.prototype, "orbitalOffsetZ");
31146
+ ], He.prototype, "orbitalOffsetZ");
31132
31147
  C([
31133
31148
  u(Y)
31134
- ], Ve.prototype, "speedModifier");
31149
+ ], He.prototype, "speedModifier");
31135
31150
  C([
31136
31151
  u()
31137
- ], Ve.prototype, "speedModifierMultiplier");
31152
+ ], He.prototype, "speedModifierMultiplier");
31138
31153
  C([
31139
31154
  u(Y)
31140
- ], Ve.prototype, "x");
31155
+ ], He.prototype, "x");
31141
31156
  C([
31142
31157
  u()
31143
- ], Ve.prototype, "xMultiplier");
31158
+ ], He.prototype, "xMultiplier");
31144
31159
  C([
31145
31160
  u(Y)
31146
- ], Ve.prototype, "y");
31161
+ ], He.prototype, "y");
31147
31162
  C([
31148
31163
  u()
31149
- ], Ve.prototype, "yMultiplier");
31164
+ ], He.prototype, "yMultiplier");
31150
31165
  C([
31151
31166
  u(Y)
31152
- ], Ve.prototype, "z");
31167
+ ], He.prototype, "z");
31153
31168
  C([
31154
31169
  u()
31155
- ], Ve.prototype, "zMultiplier");
31170
+ ], He.prototype, "zMultiplier");
31156
31171
  class Qt {
31157
31172
  animation;
31158
31173
  enabled;
@@ -31603,7 +31618,7 @@ class mn extends R {
31603
31618
  cameraVelocityScale;
31604
31619
  lengthScale;
31605
31620
  start() {
31606
- if (this.maxParticleSize !== 0.5 && this.minParticleSize !== 0 && D()) {
31621
+ if (this.maxParticleSize !== 0.5 && this.minParticleSize !== 0 && L()) {
31607
31622
  const e = `ParticleSystem "${this.name}" has non-default min/max particle size. This may not render correctly. Please set min size to 0 and the max size to 0.5 and use the "StartSize" setting instead`;
31608
31623
  console.warn(e);
31609
31624
  }
@@ -31615,13 +31630,13 @@ class mn extends R {
31615
31630
  let t = e === !0 && this.trailMaterial ? this.trailMaterial : this.particleMaterial;
31616
31631
  if (t) {
31617
31632
  if (t.type === "MeshStandardMaterial") {
31618
- Ks && console.debug("ParticleSystemRenderer.getMaterial: MeshStandardMaterial detected, converting to MeshBasicMaterial. See https://github.com/Alchemist0823/three.quarks/issues/101"), "map" in t && t.map && (t.map.colorSpace = Cs, t.map.premultiplyAlpha = !1);
31633
+ Ks && console.debug("ParticleSystemRenderer.getMaterial: MeshStandardMaterial detected, converting to MeshBasicMaterial. See https://github.com/Alchemist0823/three.quarks/issues/101"), "map" in t && t.map && (t.map.colorSpace = Ss, t.map.premultiplyAlpha = !1);
31619
31634
  const i = new we();
31620
31635
  i.copy(t), e ? this.trailMaterial = i : this.particleMaterial = i;
31621
31636
  }
31622
- t.map && (t.map.colorSpace = Cs, t.map.premultiplyAlpha = !1), e && t.side === fo && (t = t.clone(), t.side = $d, e ? this.trailMaterial = t : this.particleMaterial = t);
31637
+ t.map && (t.map.colorSpace = Ss, t.map.premultiplyAlpha = !1), e && t.side === fo && (t = t.clone(), t.side = $d, e ? this.trailMaterial = t : this.particleMaterial = t);
31623
31638
  }
31624
- return t && !gT && t._didRequestTextureLOD === void 0 && (t._didRequestTextureLOD = 0, yT && console.log("Load material LOD", t.name), We.assignTextureLOD(t, 0)), t;
31639
+ return t && !gT && t._didRequestTextureLOD === void 0 && (t._didRequestTextureLOD = 0, yT && console.log("Load material LOD", t.name), Ve.assignTextureLOD(t, 0)), t;
31625
31640
  }
31626
31641
  getMesh(e) {
31627
31642
  let t = null;
@@ -31769,7 +31784,7 @@ class xT extends Pr {
31769
31784
  update(e, t) {
31770
31785
  if (e.rotation === void 0) return;
31771
31786
  const i = e.age / e.life;
31772
- if (typeof e.rotation == "number" && (this.system.rotationOverLifetime.enabled ? e.rotation += this.system.rotationOverLifetime.evaluate(i, e[V_]) * t : this.system.renderer.renderMode === cs.Billboard && (e.rotation = Math.PI), this.system.rotationBySpeed.enabled)) {
31787
+ if (typeof e.rotation == "number" && (this.system.rotationOverLifetime.enabled ? e.rotation += this.system.rotationOverLifetime.evaluate(i, e[V_]) * t : this.system.renderer.renderMode === ls.Billboard && (e.rotation = Math.PI), this.system.rotationBySpeed.enabled)) {
31773
31788
  const n = e.velocity.length();
31774
31789
  e.rotation += this.system.rotationBySpeed.evaluate(i, n) * t;
31775
31790
  }
@@ -31788,7 +31803,7 @@ class CT extends Pr {
31788
31803
  let n = 1;
31789
31804
  this.system.sizeOverLifetime.enabled && (n *= this.system.sizeOverLifetime.evaluate(i, void 0, e[H_]).x);
31790
31805
  let o = 1;
31791
- this.system.renderer.renderMode !== cs.Mesh && (o = this.system.worldScale.x / this.system.cameraScale);
31806
+ this.system.renderer.renderMode !== ls.Mesh && (o = this.system.worldScale.x / this.system.cameraScale);
31792
31807
  const r = G(e.startSize).multiplyScalar(n * o);
31793
31808
  if (e.size.set(r.x, r.y, r.z), this.system.localspace) {
31794
31809
  const a = dw(this.system, ST);
@@ -31939,20 +31954,20 @@ class MT {
31939
31954
  }
31940
31955
  get renderMode() {
31941
31956
  if (this.system.trails.enabled === !0)
31942
- return ls.Trail;
31957
+ return as.Trail;
31943
31958
  switch (this.system.renderer.renderMode) {
31944
- case cs.Billboard:
31945
- return ls.BillBoard;
31946
- case cs.Stretch:
31947
- return ls.StretchedBillBoard;
31948
- case cs.HorizontalBillboard:
31949
- return ls.HorizontalBillBoard;
31950
- case cs.VerticalBillboard:
31951
- return ls.VerticalBillBoard;
31952
- case cs.Mesh:
31953
- return ls.Mesh;
31954
- }
31955
- return ls.BillBoard;
31959
+ case ls.Billboard:
31960
+ return as.BillBoard;
31961
+ case ls.Stretch:
31962
+ return as.StretchedBillBoard;
31963
+ case ls.HorizontalBillboard:
31964
+ return as.HorizontalBillBoard;
31965
+ case ls.VerticalBillboard:
31966
+ return as.VerticalBillBoard;
31967
+ case ls.Mesh:
31968
+ return as.Mesh;
31969
+ }
31970
+ return as.BillBoard;
31956
31971
  }
31957
31972
  rendererEmitterSettings = {
31958
31973
  startLength: new VS(220),
@@ -31960,7 +31975,7 @@ class MT {
31960
31975
  };
31961
31976
  get speedFactor() {
31962
31977
  let e = this.system.main.simulationSpeed;
31963
- return this.system.renderer?.renderMode === cs.Stretch && (e *= this.system.renderer.velocityScale ?? 1), e;
31978
+ return this.system.renderer?.renderMode === ls.Stretch && (e *= this.system.renderer.velocityScale ?? 1), e;
31964
31979
  }
31965
31980
  flatWhiteTexture;
31966
31981
  clonedTexture = { original: void 0, clone: void 0 };
@@ -31970,7 +31985,7 @@ class MT {
31970
31985
  const t = e.map;
31971
31986
  if (this.clonedTexture.original !== t || !this.clonedTexture.clone) {
31972
31987
  const i = t.clone();
31973
- i.premultiplyAlpha = !1, i.colorSpace = Cs, this.clonedTexture.original = t, this.clonedTexture.clone = i;
31988
+ i.premultiplyAlpha = !1, i.colorSpace = Ss, this.clonedTexture.original = t, this.clonedTexture.clone = i;
31974
31989
  }
31975
31990
  return this.clonedTexture.clone;
31976
31991
  }
@@ -32145,7 +32160,7 @@ const jt = class qh extends R {
32145
32160
  if (!this._particleSystem)
32146
32161
  return !1;
32147
32162
  const t = this._particleSystem.behaviors, i = t.indexOf(e);
32148
- return i !== -1 && ((D() || Ks) && console.debug("Remove custom ParticleSystem Behaviour", i, e), t.splice(i, 1)), !0;
32163
+ return i !== -1 && ((L() || Ks) && console.debug("Remove custom ParticleSystem Behaviour", i, e), t.splice(i, 1)), !0;
32149
32164
  }
32150
32165
  /** Removes all behaviours from the particle system
32151
32166
  * **Note:** this will also remove the default behaviours like SizeBehaviour, ColorBehaviour etc.
@@ -32215,8 +32230,8 @@ const jt = class qh extends R {
32215
32230
  }
32216
32231
  /** @internal */
32217
32232
  start() {
32218
- this.addSubParticleSystems(), this.updateLayers(), this.renderer.particleMesh instanceof H && this._interface.renderMode == ls.Mesh && We.assignMeshLOD(this.renderer.particleMesh, 0).then((e) => {
32219
- e && this.particleSystem && this._interface.renderMode == ls.Mesh && (this.particleSystem.instancingGeometry = e);
32233
+ this.addSubParticleSystems(), this.updateLayers(), this.renderer.particleMesh instanceof H && this._interface.renderMode == as.Mesh && Ve.assignMeshLOD(this.renderer.particleMesh, 0).then((e) => {
32234
+ e && this.particleSystem && this._interface.renderMode == as.Mesh && (this.particleSystem.instancingGeometry = e);
32220
32235
  });
32221
32236
  }
32222
32237
  /** @internal */
@@ -32269,11 +32284,11 @@ const jt = class qh extends R {
32269
32284
  if (this._bursts && (this.emission.bursts = this._bursts, delete this._bursts), !this._isPlaying) return;
32270
32285
  const e = this.context.mainCamera;
32271
32286
  if (e) {
32272
- const n = $e(e);
32287
+ const n = We(e);
32273
32288
  this._cameraScale = n.x;
32274
32289
  }
32275
32290
  const t = !this.worldspace, i = this.gameObject;
32276
- if (be(i, this.__worldQuaternion), this._worldQuaternionInverted.copy(this.__worldQuaternion).invert(), $e(this.gameObject, this._worldScale), t && this._container && this.gameObject?.parent) {
32291
+ if (be(i, this.__worldQuaternion), this._worldQuaternionInverted.copy(this.__worldQuaternion).invert(), We(this.gameObject, this._worldScale), t && this._container && this.gameObject?.parent) {
32277
32292
  const n = dw(this, im);
32278
32293
  this._container.matrix.makeScale(n.x, n.y, n.z), this._container.matrix.makeRotationFromQuaternion(this.__worldQuaternion), this._container.matrix.setPosition(this.worldPos), this._container.matrix.scale(this.gameObject.scale);
32279
32294
  }
@@ -32282,7 +32297,7 @@ const jt = class qh extends R {
32282
32297
  addSubParticleSystems() {
32283
32298
  if (this._subEmitterSystems && this._particleSystem)
32284
32299
  for (const e of this._subEmitterSystems) {
32285
- e.particleSystem && (e.particleSystem.__internalAwake ? e.particleSystem.__internalAwake() : D() && console.warn("SubParticleSystem serialization issue(?)", e.particleSystem, e));
32300
+ e.particleSystem && (e.particleSystem.__internalAwake ? e.particleSystem.__internalAwake() : L() && console.warn("SubParticleSystem serialization issue(?)", e.particleSystem, e));
32286
32301
  const t = e.particleSystem?._particleSystem;
32287
32302
  if (t) {
32288
32303
  e.particleSystem._isUsedAsSubsystem = !0;
@@ -32314,7 +32329,7 @@ ze([
32314
32329
  u(Ne)
32315
32330
  ], jt.prototype, "trails");
32316
32331
  ze([
32317
- u(Ve)
32332
+ u(He)
32318
32333
  ], jt.prototype, "velocityOverLifetime");
32319
32334
  ze([
32320
32335
  u(_t)
@@ -32354,15 +32369,15 @@ function dw(s, e) {
32354
32369
  if (e.set(1, 1, 1), s.gameObject.parent && s.localspace)
32355
32370
  switch (s.main.scalingMode) {
32356
32371
  case Jp.Local:
32357
- e = $e(s.gameObject.parent, e), e.x = 1 / e.x, e.y = 1 / e.y, e.z = 1 / e.z;
32372
+ e = We(s.gameObject.parent, e), e.x = 1 / e.x, e.y = 1 / e.y, e.z = 1 / e.z;
32358
32373
  break;
32359
32374
  default:
32360
32375
  if (!s.unsupported_scaling_mode) {
32361
32376
  s.unsupported_scaling_mode = !0;
32362
32377
  const t = "ParticleSystem scale mode " + Jp[s.main.scalingMode] + " is not supported";
32363
- D() && ge(t), console.warn(t, s.name, s);
32378
+ L() && ge(t), console.warn(t, s.name, s);
32364
32379
  }
32365
- e = $e(s.gameObject, e);
32380
+ e = We(s.gameObject, e);
32366
32381
  break;
32367
32382
  }
32368
32383
  return e;
@@ -32436,7 +32451,7 @@ function ET(s) {
32436
32451
  const t = s.scene;
32437
32452
  e = In(t, sm);
32438
32453
  } else
32439
- D() && console.warn("No post processing manager found");
32454
+ L() && console.warn("No post processing manager found");
32440
32455
  return e;
32441
32456
  }
32442
32457
  const ct = {
@@ -32745,7 +32760,7 @@ const Eu = class pw extends ot {
32745
32760
  }, this.threshold.onValueChanged = (t) => {
32746
32761
  e.luminanceMaterial.threshold = Math.pow(t, 2.2);
32747
32762
  }, this.scatter.onValueChanged = (t) => {
32748
- e.luminancePass.enabled = !0, e.luminanceMaterial.smoothing = t, e.mipmapBlurPass && (e.mipmapBlurPass.radius = ys.lerp(0.1, 0.9, t));
32763
+ e.luminancePass.enabled = !0, e.luminanceMaterial.smoothing = t, e.mipmapBlurPass && (e.mipmapBlurPass.radius = gs.lerp(0.1, 0.9, t));
32749
32764
  }, e;
32750
32765
  }
32751
32766
  };
@@ -33295,7 +33310,7 @@ var lE = Object.defineProperty, Qa = (s, e, t, i) => {
33295
33310
  (r = s[o]) && (n = r(e, t, n) || n);
33296
33311
  return n && lE(e, t, n), n;
33297
33312
  };
33298
- class js extends ot {
33313
+ class Ds extends ot {
33299
33314
  get typeName() {
33300
33315
  return "TiltShiftEffect";
33301
33316
  }
@@ -33321,23 +33336,23 @@ class js extends ot {
33321
33336
  }
33322
33337
  Qa([
33323
33338
  u(F)
33324
- ], js.prototype, "offset");
33339
+ ], Ds.prototype, "offset");
33325
33340
  Qa([
33326
33341
  u(F)
33327
- ], js.prototype, "rotation");
33342
+ ], Ds.prototype, "rotation");
33328
33343
  Qa([
33329
33344
  u(F)
33330
- ], js.prototype, "focusArea");
33345
+ ], Ds.prototype, "focusArea");
33331
33346
  Qa([
33332
33347
  u(F)
33333
- ], js.prototype, "feather");
33348
+ ], Ds.prototype, "feather");
33334
33349
  Qa([
33335
33350
  u(F)
33336
- ], js.prototype, "kernelSize");
33351
+ ], Ds.prototype, "kernelSize");
33337
33352
  Qa([
33338
33353
  u(F)
33339
- ], js.prototype, "resolutionScale");
33340
- gn("TiltShiftEffect", js);
33354
+ ], Ds.prototype, "resolutionScale");
33355
+ gn("TiltShiftEffect", Ds);
33341
33356
  var cE = Object.defineProperty, jg = (s, e, t, i) => {
33342
33357
  for (var n = void 0, o = s.length - 1, r; o >= 0; o--)
33343
33358
  (r = s[o]) && (n = r(e, t, n) || n);
@@ -33377,7 +33392,7 @@ jg([
33377
33392
  ], Ya.prototype, "center");
33378
33393
  gn("Vignette", Ya);
33379
33394
  globalThis.NEEDLE_USE_POSTPROCESSING = globalThis.NEEDLE_USE_POSTPROCESSING !== void 0 ? globalThis.NEEDLE_USE_POSTPROCESSING : !0;
33380
- const ts = w("debugpost"), tp = Symbol("needle:postprocessing-handler"), ml = Symbol("needle:previous-autoclear-state"), gl = Symbol("needle:previous-tone-mapping");
33395
+ const es = w("debugpost"), tp = Symbol("needle:postprocessing-handler"), ml = Symbol("needle:previous-autoclear-state"), gl = Symbol("needle:previous-tone-mapping");
33381
33396
  class yw {
33382
33397
  _composer = null;
33383
33398
  _lastVolumeComponents;
@@ -33403,7 +33418,7 @@ class yw {
33403
33418
  return this._isActive = !0, this.onApply(this.context, e);
33404
33419
  }
33405
33420
  unapply(e = !0) {
33406
- if (ts && console.log("Unapplying postprocessing effects"), this._isActive = !1, this._lastVolumeComponents) {
33421
+ if (es && console.log("Unapplying postprocessing effects"), this._isActive = !1, this._lastVolumeComponents) {
33407
33422
  for (const n of this._lastVolumeComponents)
33408
33423
  n.unapply();
33409
33424
  this._lastVolumeComponents.length = 0;
@@ -33423,7 +33438,7 @@ class yw {
33423
33438
  T.POSTPROCESSING.load(),
33424
33439
  T.POSTPROCESSING_AO.load()
33425
33440
  // import("./Effects/Sharpening.effect")
33426
- ]), e[tp] = this, ts && console.log("Apply Postprocessing Effects", t), this._lastVolumeComponents = [...t], this._effects.length = 0;
33441
+ ]), e[tp] = this, es && console.log("Apply Postprocessing Effects", t), this._lastVolumeComponents = [...t], this._effects.length = 0;
33427
33442
  const i = {
33428
33443
  handler: this,
33429
33444
  components: this._lastVolumeComponents
@@ -33521,7 +33536,7 @@ class yw {
33521
33536
  minFilter: d.texture.minFilter ?? Jh,
33522
33537
  magFilter: d.texture.magFilter ?? Jh,
33523
33538
  generateMipmaps: d.texture.generateMipmaps
33524
- }), this._customInputBufferId++, this._customInputBuffer.texture.name = `CustomInputBuffer-${this._customInputBufferId}`, this._customInputBuffer.depthTexture && d.depthTexture && (this._customInputBuffer.depthTexture.format = d.depthTexture.format, this._customInputBuffer.depthTexture.type = d.depthTexture.type), this._customInputBuffer.samples > 0 && (this._customInputBuffer.ignoreDepthForMultisampleCopy = !1), ts && console.warn(`[PostProcessing] Input buffer created with size ${this._customInputBuffer.width}x${this._customInputBuffer.height} and samples ${this._customInputBuffer.samples}`)), l.call(a, h, this._customInputBuffer, f, p, g), ar.blit(this._customInputBuffer.texture, d, {
33539
+ }), this._customInputBufferId++, this._customInputBuffer.texture.name = `CustomInputBuffer-${this._customInputBufferId}`, this._customInputBuffer.depthTexture && d.depthTexture && (this._customInputBuffer.depthTexture.format = d.depthTexture.format, this._customInputBuffer.depthTexture.type = d.depthTexture.type), this._customInputBuffer.samples > 0 && (this._customInputBuffer.ignoreDepthForMultisampleCopy = !1), es && console.warn(`[PostProcessing] Input buffer created with size ${this._customInputBuffer.width}x${this._customInputBuffer.height} and samples ${this._customInputBuffer.samples}`)), l.call(a, h, this._customInputBuffer, f, p, g), ar.blit(this._customInputBuffer.texture, d, {
33525
33540
  renderer: h,
33526
33541
  depthTexture: this._customInputBuffer.depthTexture,
33527
33542
  depthWrite: !0,
@@ -33535,7 +33550,7 @@ class yw {
33535
33550
  const b = this._effects[g].effect;
33536
33551
  if (b instanceof T.POSTPROCESSING.MODULE.ToneMappingEffect) {
33537
33552
  if (h) {
33538
- ts && console.warn(`[PostProcessing] Found multiple tonemapping effects in the scene: ${b.name} and ${d?.name}. Only the last one added will be used.`), this._effects.splice(g, 1);
33553
+ es && console.warn(`[PostProcessing] Found multiple tonemapping effects in the scene: ${b.name} and ${d?.name}. Only the last one added will be used.`), this._effects.splice(g, 1);
33539
33554
  continue;
33540
33555
  }
33541
33556
  d = b, h = !0;
@@ -33548,7 +33563,7 @@ class yw {
33548
33563
  if (m instanceof T.POSTPROCESSING.MODULE.SMAAEffect ? this._hasSmaaEffect = !0 : m instanceof T.POSTPROCESSING.MODULE.NormalPass && (this._anyPassHasNormal = !0), !(m instanceof T.POSTPROCESSING.MODULE.ToneMappingEffect && d !== m))
33549
33564
  if (m instanceof T.POSTPROCESSING.MODULE.Effect) {
33550
33565
  const v = m.getAttributes(), _ = T.POSTPROCESSING.MODULE.EffectAttribute.CONVOLUTION;
33551
- v & _ && (ts && console.log("[PostProcessing] Convolution effect: " + m.name), p && (ts && console.log("[PostProcessing] → Merging effects [" + f.map((x) => x.name).join(", ") + "]"), this.createPassForMergeableEffects(f, r, o, n)), p = !0), f.push(m);
33566
+ v & _ && (es && console.log("[PostProcessing] Convolution effect: " + m.name), p && (es && console.log("[PostProcessing] → Merging effects [" + f.map((x) => x.name).join(", ") + "]"), this.createPassForMergeableEffects(f, r, o, n)), p = !0), f.push(m);
33552
33567
  } else m instanceof T.POSTPROCESSING.MODULE.Pass ? (p = !1, this.createPassForMergeableEffects(f, r, o, n), m.renderToScreen = !1, r.addPass(m)) : (p = !1, this.createPassForMergeableEffects(f, r, o, n), r.addPass(m));
33553
33568
  }
33554
33569
  this.createPassForMergeableEffects(f, r, o, n);
@@ -33561,11 +33576,11 @@ class yw {
33561
33576
  let f = !1, p = !1;
33562
33577
  d.enabled && (c || (f = !0, p = !0), c = !0), d.renderToScreen = p, d?.configuration !== void 0 ? d.configuration.gammaCorrection = f : "autosetGamma" in d && (d.autosetGamma = f), this._anyPassHasDepth ||= d.needsDepthTexture;
33563
33578
  }
33564
- this.handleDevicePixelRatio(), ts && console.log("[PostProcessing] Passes →", [...r.passes], `
33579
+ this.handleDevicePixelRatio(), es && console.log("[PostProcessing] Passes →", [...r.passes], `
33565
33580
  ---------------------------------
33566
33581
  • ` + r.passes.map((h) => h.name || h.constructor.name + "*").join(`
33567
33582
  • `) + `
33568
- `), ts && this._onCreateEffectsDebug(this._composer, o);
33583
+ `), es && this._onCreateEffectsDebug(this._composer, o);
33569
33584
  }
33570
33585
  /** Should be called before `composer.addPass()` to create an effect pass with all previously collected effects that can be merged up to that point */
33571
33586
  createPassForMergeableEffects(e, t, i, n) {
@@ -33580,7 +33595,7 @@ class yw {
33580
33595
  _menuEntry = null;
33581
33596
  _passIndices = null;
33582
33597
  _onCreateEffectsDebug(e, t) {
33583
- if (ts === "passes") {
33598
+ if (es === "passes") {
33584
33599
  const i = new T.POSTPROCESSING.MODULE.DepthEffect({
33585
33600
  blendFunction: T.POSTPROCESSING.MODULE.BlendFunction.NORMAL,
33586
33601
  inverted: !0
@@ -33687,7 +33702,7 @@ class Uc extends R {
33687
33702
  if (!this.context.isInXR && (this.context.mainCamera && this._isDirty && this.apply(), this.context.composer && this._postprocessing && this._postprocessing.composer === this.context.composer)) {
33688
33703
  if (this.context.renderer.getContext().isContextLost() && this.context.renderer.forceContextRestore(), this.context.composer.getRenderer() !== this.context.renderer && this.context.composer.setRenderer(this.context.renderer), this.context.composer.setMainScene(this.context.scene), this.multisampling === "auto")
33689
33704
  if (this._postprocessing && this._postprocessing.hasSmaaEffect)
33690
- this._postprocessing.multisampling !== 0 && (this._postprocessing.multisampling = 0, (Uo || D()) && console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
33705
+ this._postprocessing.multisampling !== 0 && (this._postprocessing.multisampling = 0, (Uo || L()) && console.log(`[PostProcessing] multisampling is disabled because it's set to 'auto' on your PostprocessingManager/Volume component that also has an SMAA effect.
33691
33706
 
33692
33707
  If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`));
33693
33708
  else {
@@ -33727,7 +33742,7 @@ If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`))
33727
33742
  _rapidApplyCount = 0;
33728
33743
  _isDirty = !1;
33729
33744
  apply() {
33730
- if (Uo && console.log(`Apply PostProcessing "${this.name || "unnamed"}"`), D() && (this._lastApplyTime !== void 0 && Date.now() - this._lastApplyTime < 100 && (this._rapidApplyCount++, this._rapidApplyCount === 5 && console.warn("Detected rapid post processing modifications - this might be a bug", this)), this._lastApplyTime = Date.now()), this._isDirty = !1, this._activeEffects.length = 0, this.sharedProfile?.components) {
33745
+ if (Uo && console.log(`Apply PostProcessing "${this.name || "unnamed"}"`), L() && (this._lastApplyTime !== void 0 && Date.now() - this._lastApplyTime < 100 && (this._rapidApplyCount++, this._rapidApplyCount === 5 && console.warn("Detected rapid post processing modifications - this might be a bug", this)), this._lastApplyTime = Date.now()), this._isDirty = !1, this._activeEffects.length = 0, this.sharedProfile?.components) {
33731
33746
  const e = this.sharedProfile.components;
33732
33747
  for (const t of e)
33733
33748
  t.active && t.enabled && !this._activeEffects.includes(t) && this._activeEffects.push(t);
@@ -34107,7 +34122,7 @@ class Ze extends R {
34107
34122
  }
34108
34123
  if (S.add(e.asset, this.gameObject), this.useSceneLighting && this.context.sceneLighting.enable(e), this.useSceneBackground) {
34109
34124
  const a = this.context.lightmaps.tryGetSkybox(e.url);
34110
- a ? (a.mapping = bs, this.context.scene.background = a) : Mt && console.warn("SceneSwitcher: Can't find skybox for scene " + e.url);
34125
+ a ? (a.mapping = _s, this.context.scene.background = a) : Mt && console.warn("SceneSwitcher: Can't find skybox for scene " + e.url);
34111
34126
  }
34112
34127
  if (this.useHistory && t >= 0) {
34113
34128
  let a = t.toString();
@@ -34508,7 +34523,7 @@ class mt extends R {
34508
34523
  return this.clip;
34509
34524
  }
34510
34525
  set audioOutputMode(e) {
34511
- e !== this._audioOutputMode && (e === 1 && D() && console.warn("VideoAudioOutputMode.AudioSource is not yet implemented"), this._audioOutputMode = e, this.updateVideoElementSettings());
34526
+ e !== this._audioOutputMode && (e === 1 && L() && console.warn("VideoAudioOutputMode.AudioSource is not yet implemented"), this._audioOutputMode = e, this.updateVideoElementSettings());
34512
34527
  }
34513
34528
  get audioOutputMode() {
34514
34529
  return this._audioOutputMode;
@@ -34614,7 +34629,7 @@ class mt extends R {
34614
34629
  t = this.url, !t?.length && typeof this.clip == "string" && (t = this.clip);
34615
34630
  break;
34616
34631
  }
34617
- return t ? (this._videoElement || (lt && console.warn("Create VideoElement", this), this._videoElement = this.createVideoElement(), this.context.domElement.shadowRoot.prepend(this._videoElement), this.updateVideoElementStyles()), typeof t == "string" ? (lt && console.log("Set Video src", t), this._videoElement.src = t) : (lt && console.log("Set Video srcObject", t), this._videoElement.srcObject = t), this._videoTexture || (this._videoTexture = new iS(this._videoElement)), this._videoTexture.flipY = !1, this._videoTexture.colorSpace = Ps, e && this.handleBeginPlaying(e), lt && console.log("Video: handle playing done...", t, e), !0) : (lt && console.warn("No video source set", this), !1);
34632
+ return t ? (this._videoElement || (lt && console.warn("Create VideoElement", this), this._videoElement = this.createVideoElement(), this.context.domElement.shadowRoot.prepend(this._videoElement), this.updateVideoElementStyles()), typeof t == "string" ? (lt && console.log("Set Video src", t), this._videoElement.src = t) : (lt && console.log("Set Video srcObject", t), this._videoElement.srcObject = t), this._videoTexture || (this._videoTexture = new iS(this._videoElement)), this._videoTexture.flipY = !1, this._videoTexture.colorSpace = Cs, e && this.handleBeginPlaying(e), lt && console.log("Video: handle playing done...", t, e), !0) : (lt && console.warn("No video source set", this), !1);
34618
34633
  }
34619
34634
  updateAspect() {
34620
34635
  this.aspectMode !== 0 && this.startCoroutine(this.updateAspectImpl());
@@ -34710,7 +34725,7 @@ class mt extends R {
34710
34725
  for (const o of this._targetObjects) {
34711
34726
  let r = 1;
34712
34727
  if (o.parent) {
34713
- const a = $e(o.parent);
34728
+ const a = We(o.parent);
34714
34729
  r = a.x / a.y;
34715
34730
  }
34716
34731
  switch (this.aspectMode) {
@@ -35060,14 +35075,14 @@ class Rr extends R {
35060
35075
  }
35061
35076
  /** @internal */
35062
35077
  onEnable() {
35063
- this._net?.enable(), this._net?.addEventListener(ms.StreamReceived, this.onReceiveStream), this._net?.addEventListener(ms.StreamEnded, this.onCallEnded), this.context.connection.beginListen(ee.JoinedRoom, this.onJoinedRoom), this.autoConnect && ks(1e3).then(() => (this.enabled && this.autoConnect && !this.isReceiving && !this.isSending && this.context.connection.isInRoom && this.share(), 0));
35078
+ this._net?.enable(), this._net?.addEventListener(ps.StreamReceived, this.onReceiveStream), this._net?.addEventListener(ps.StreamEnded, this.onCallEnded), this.context.connection.beginListen(ee.JoinedRoom, this.onJoinedRoom), this.autoConnect && Os(1e3).then(() => (this.enabled && this.autoConnect && !this.isReceiving && !this.isSending && this.context.connection.isInRoom && this.share(), 0));
35064
35079
  }
35065
35080
  /** @internal */
35066
35081
  onDisable() {
35067
- this._net?.removeEventListener(ms.StreamReceived, this.onReceiveStream), this._net?.removeEventListener(ms.StreamEnded, this.onCallEnded), this.context.connection.stopListen(ee.JoinedRoom, this.onJoinedRoom), this._net?.disable(), this.close();
35082
+ this._net?.removeEventListener(ps.StreamReceived, this.onReceiveStream), this._net?.removeEventListener(ps.StreamEnded, this.onCallEnded), this.context.connection.stopListen(ee.JoinedRoom, this.onJoinedRoom), this._net?.disable(), this.close();
35068
35083
  }
35069
35084
  onJoinedRoom = async () => {
35070
- await ks(1e3), this.autoConnect && !this.isSending && !this.isReceiving && this.context.connection.isInRoom && this.share();
35085
+ await Os(1e3), this.autoConnect && !this.isSending && !this.isReceiving && this.context.connection.isInRoom && this.share();
35071
35086
  };
35072
35087
  _ensureVideoPlayer() {
35073
35088
  const e = new mt();
@@ -35080,7 +35095,7 @@ class Rr extends R {
35080
35095
  }
35081
35096
  async internalShare(e) {
35082
35097
  if (this.context.connection.isInRoom === !1) {
35083
- console.warn("Can not start screensharing: requires network connection"), D() && ge("Can not start screensharing: requires network connection. Add a SyncedRoom component or join a room first.");
35098
+ console.warn("Can not start screensharing: requires network connection"), L() && ge("Can not start screensharing: requires network connection. Add a SyncedRoom component or join a room first.");
35084
35099
  return;
35085
35100
  }
35086
35101
  if (e?.device && (this.device = e.device), !this.videoPlayer && this.requiresVideoPlayer && (this._videoPlayer || (this._videoPlayer = S.getComponent(this.gameObject, mt) ?? void 0), this.videoPlayer || this._ensureVideoPlayer(), !this.videoPlayer)) {
@@ -35113,7 +35128,7 @@ class Rr extends R {
35113
35128
  a,
35114
35129
  1
35115
35130
  /* Sending */
35116
- ) : gs(a);
35131
+ ) : ms(a);
35117
35132
  }
35118
35133
  break;
35119
35134
  // capture the canvas meaning the threejs view
@@ -35137,7 +35152,7 @@ class Rr extends R {
35137
35152
  a,
35138
35153
  1
35139
35154
  /* Sending */
35140
- ) : gs(a);
35155
+ ) : ms(a);
35141
35156
  }
35142
35157
  break;
35143
35158
  default:
@@ -35152,7 +35167,7 @@ class Rr extends R {
35152
35167
  }
35153
35168
  }
35154
35169
  close() {
35155
- this._requestOpen = !1, this._currentStream && (wt && console.warn("Close current stream / disposing resources, stream was active?", this._currentStream.active), this._net?.stopSendingStream(this._currentStream), gs(this._currentStream), this._currentMode = 0, this._currentStream = null);
35170
+ this._requestOpen = !1, this._currentStream && (wt && console.warn("Close current stream / disposing resources, stream was active?", this._currentStream.active), this._net?.stopSendingStream(this._currentStream), ms(this._currentStream), this._currentMode = 0, this._currentStream = null);
35156
35171
  }
35157
35172
  setStream(e, t) {
35158
35173
  if (e === this._currentStream || (this.close(), !e)) return;
@@ -35219,7 +35234,7 @@ class Rr extends R {
35219
35234
  l,
35220
35235
  1
35221
35236
  /* Sending */
35222
- ), wt && console.log("Selected camera", o)) : (gs(l), wt && console.log("Camera selection cancelled"));
35237
+ ), wt && console.log("Selected camera", o)) : (ms(l), wt && console.log("Camera selection cancelled"));
35223
35238
  break;
35224
35239
  } catch (r) {
35225
35240
  if (r.message === "Failed to allocate videosource" || r.message === "Could not start video source") {
@@ -35228,7 +35243,7 @@ class Rr extends R {
35228
35243
  } else
35229
35244
  console.error("Failed to get user media", r.message, r.code, r);
35230
35245
  }
35231
- !n && D() && (ge("No camera found for sharing. Please connect a camera (see console for more information)"), console.warn("No camera found for sharing. Please connect a camera", i, this.deviceName, "Using deviceFilter? " + this.deviceFilter != null, "Using options? " + t != null, "Using deviceName? " + this.deviceName != null, "Using options.deviceId? " + t?.deviceId != null, "Using options.deviceFilter? " + t?.deviceFilter != null));
35246
+ !n && L() && (ge("No camera found for sharing. Please connect a camera (see console for more information)"), console.warn("No camera found for sharing. Please connect a camera", i, this.deviceName, "Using deviceFilter? " + this.deviceFilter != null, "Using options? " + t != null, "Using deviceName? " + this.deviceName != null, "Using options.deviceId? " + t?.deviceId != null, "Using options.deviceFilter? " + t?.deviceFilter != null));
35232
35247
  }
35233
35248
  // private _cameraSelectionWindow : Window | null = null;
35234
35249
  // private openWindowToSelectCamera(){
@@ -35376,7 +35391,7 @@ async function OE(s, e) {
35376
35391
  return await a.loadAsync(l).then((d) => {
35377
35392
  if (d) {
35378
35393
  const f = t.lastIndexOf("/");
35379
- d.name = t.substring(f >= 0 ? f + 1 : 0), i && (d.mapping = xb), a instanceof sc && (d.colorSpace = Ps);
35394
+ d.name = t.substring(f >= 0 ? f + 1 : 0), i && (d.mapping = xb), a instanceof sc && (d.colorSpace = Cs);
35380
35395
  }
35381
35396
  return d;
35382
35397
  }).catch((d) => (console.warn("Failed to load texture from url:", s), null));
@@ -35616,7 +35631,7 @@ const Jl = w("debugspatialtrigger"), J_ = new ho(), eb = new ho();
35616
35631
  function EE(s, e) {
35617
35632
  return J_.mask = s, eb.mask = e, J_.test(eb);
35618
35633
  }
35619
- class Ss extends R {
35634
+ class xs extends R {
35620
35635
  triggerMask = 0;
35621
35636
  onEnter;
35622
35637
  onStay;
@@ -35673,16 +35688,16 @@ class Ss extends R {
35673
35688
  }
35674
35689
  Vc([
35675
35690
  u()
35676
- ], Ss.prototype, "triggerMask");
35691
+ ], xs.prototype, "triggerMask");
35677
35692
  Vc([
35678
35693
  u(ue)
35679
- ], Ss.prototype, "onEnter");
35694
+ ], xs.prototype, "onEnter");
35680
35695
  Vc([
35681
35696
  u(ue)
35682
- ], Ss.prototype, "onStay");
35697
+ ], xs.prototype, "onStay");
35683
35698
  Vc([
35684
35699
  u(ue)
35685
- ], Ss.prototype, "onExit");
35700
+ ], xs.prototype, "onExit");
35686
35701
  const Pw = class Yh extends R {
35687
35702
  /** Global registry of all active spatial triggers in the scene */
35688
35703
  static triggers = [];
@@ -35722,7 +35737,7 @@ const Pw = class Yh extends R {
35722
35737
  */
35723
35738
  raiseOnEnterEvent(e) {
35724
35739
  S.foreachComponent(this.gameObject, (t) => {
35725
- t !== e && t instanceof Ss && t.onEnterTrigger(this);
35740
+ t !== e && t instanceof xs && t.onEnterTrigger(this);
35726
35741
  }, !1);
35727
35742
  }
35728
35743
  /**
@@ -35731,7 +35746,7 @@ const Pw = class Yh extends R {
35731
35746
  */
35732
35747
  raiseOnStayEvent(e) {
35733
35748
  S.foreachComponent(this.gameObject, (t) => {
35734
- t !== e && t instanceof Ss && t.onStayTrigger(this);
35749
+ t !== e && t instanceof xs && t.onStayTrigger(this);
35735
35750
  }, !1);
35736
35751
  }
35737
35752
  /**
@@ -35740,7 +35755,7 @@ const Pw = class Yh extends R {
35740
35755
  */
35741
35756
  raiseOnExitEvent(e) {
35742
35757
  S.foreachComponent(this.gameObject, (t) => {
35743
- t !== e && t instanceof Ss && t.onExitTrigger(this);
35758
+ t !== e && t instanceof xs && t.onExitTrigger(this);
35744
35759
  }, !1);
35745
35760
  }
35746
35761
  };
@@ -35919,8 +35934,8 @@ class Ng extends R {
35919
35934
  const e = this._mode === 0;
35920
35935
  for (const t of je.instances)
35921
35936
  if (t.avatar && "isLocalAvatar" in t.avatar && "flags" in t.avatar) {
35922
- let i = fs.All;
35923
- this.isSpectatingSelf && (i = e && t.avatar.isLocalAvatar ? fs.FirstPerson : fs.ThirdPerson);
35937
+ let i = us.All;
35938
+ this.isSpectatingSelf && (i = e && t.avatar.isLocalAvatar ? us.FirstPerson : us.ThirdPerson);
35924
35939
  const n = t.avatar.flags;
35925
35940
  if (!n) continue;
35926
35941
  for (const o of n)
@@ -35936,7 +35951,7 @@ class Ng extends R {
35936
35951
  const t = e.avatar.flags;
35937
35952
  if (!t) continue;
35938
35953
  for (const i of t)
35939
- "isLocalAvatar" in e.avatar && e.avatar?.isLocalAvatar ? i.UpdateVisible(fs.FirstPerson) : i.UpdateVisible(fs.ThirdPerson);
35954
+ "isLocalAvatar" in e.avatar && e.avatar?.isLocalAvatar ? i.UpdateVisible(us.FirstPerson) : i.UpdateVisible(us.ThirdPerson);
35940
35955
  }
35941
35956
  }
35942
35957
  }
@@ -36173,7 +36188,7 @@ var UE = Object.defineProperty, NE = Object.getOwnPropertyDescriptor, Ka = (s, e
36173
36188
  return i && n && UE(e, t, n), n;
36174
36189
  };
36175
36190
  const tb = w("debugsplines");
36176
- class Ms {
36191
+ class ks {
36177
36192
  position = new y();
36178
36193
  rotation = new U();
36179
36194
  tangentIn = new y();
@@ -36181,25 +36196,25 @@ class Ms {
36181
36196
  }
36182
36197
  Ka([
36183
36198
  rt(y)
36184
- ], Ms.prototype, "position", 2);
36199
+ ], ks.prototype, "position", 2);
36185
36200
  Ka([
36186
36201
  rt(U)
36187
- ], Ms.prototype, "rotation", 2);
36202
+ ], ks.prototype, "rotation", 2);
36188
36203
  Ka([
36189
36204
  rt(y)
36190
- ], Ms.prototype, "tangentIn", 2);
36205
+ ], ks.prototype, "tangentIn", 2);
36191
36206
  Ka([
36192
36207
  rt(y)
36193
- ], Ms.prototype, "tangentOut", 2);
36208
+ ], ks.prototype, "tangentOut", 2);
36194
36209
  class Za extends R {
36195
36210
  /**
36196
36211
  * Adds a knot to the end of the spline.
36197
36212
  */
36198
36213
  addKnot(e) {
36199
- if (e instanceof Ms)
36214
+ if (e instanceof ks)
36200
36215
  this.spline.push(e), this._isDirty = !0;
36201
36216
  else {
36202
- const t = new Ms();
36217
+ const t = new ks();
36203
36218
  t.position.copy(e.position), this.spline.push(t), this._isDirty = !0;
36204
36219
  }
36205
36220
  return this;
@@ -36292,7 +36307,7 @@ Ka([
36292
36307
  rt()
36293
36308
  ], Za.prototype, "closed", 1);
36294
36309
  Ka([
36295
- rt(Ms)
36310
+ rt(ks)
36296
36311
  ], Za.prototype, "spline", 2);
36297
36312
  function $E(s, e) {
36298
36313
  const t = s.map((o) => new y(-o.position.x, o.position.y, o.position.z));
@@ -36305,7 +36320,7 @@ var WE = Object.defineProperty, VE = Object.getOwnPropertyDescriptor, Tr = (s, e
36305
36320
  (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
36306
36321
  return i && n && WE(e, t, n), n;
36307
36322
  };
36308
- class Bs extends R {
36323
+ class js extends R {
36309
36324
  spline = null;
36310
36325
  object = void 0;
36311
36326
  lookAt = null;
@@ -36345,25 +36360,25 @@ class Bs extends R {
36345
36360
  }
36346
36361
  Tr([
36347
36362
  rt(Za)
36348
- ], Bs.prototype, "spline", 2);
36363
+ ], js.prototype, "spline", 2);
36349
36364
  Tr([
36350
36365
  rt(M)
36351
- ], Bs.prototype, "object", 2);
36366
+ ], js.prototype, "object", 2);
36352
36367
  Tr([
36353
36368
  rt(M)
36354
- ], Bs.prototype, "lookAt", 2);
36369
+ ], js.prototype, "lookAt", 2);
36355
36370
  Tr([
36356
36371
  rt()
36357
- ], Bs.prototype, "clamp", 2);
36372
+ ], js.prototype, "clamp", 2);
36358
36373
  Tr([
36359
36374
  rt()
36360
- ], Bs.prototype, "position01", 1);
36375
+ ], js.prototype, "position01", 1);
36361
36376
  Tr([
36362
36377
  rt()
36363
- ], Bs.prototype, "autoRun", 2);
36378
+ ], js.prototype, "autoRun", 2);
36364
36379
  Tr([
36365
36380
  rt()
36366
- ], Bs.prototype, "duration", 2);
36381
+ ], js.prototype, "duration", 2);
36367
36382
  class On {
36368
36383
  bb = null;
36369
36384
  bb_pos = 0;
@@ -36486,7 +36501,7 @@ const Ow = class am extends R {
36486
36501
  for (const n in this.remoteCams) {
36487
36502
  const o = this.remoteCams[n], r = this.context.time.realtimeSinceStartup - o.lastUpdate;
36488
36503
  if (!o || r > this._camTimeoutInSeconds) {
36489
- D() && console.log("Remote cam timeout", n), o?.obj && S.destroy(o.obj), delete this.remoteCams[n], o && delete this.userToCamMap[o.userId], am.instances.push(o), this.context.players.removePlayerView(o.userId, tr.Browser);
36504
+ L() && console.log("Remote cam timeout", n), o?.obj && S.destroy(o.obj), delete this.remoteCams[n], o && delete this.userToCamMap[o.userId], am.instances.push(o), this.context.players.removePlayerView(o.userId, tr.Browser);
36490
36505
  continue;
36491
36506
  }
36492
36507
  }
@@ -36601,7 +36616,7 @@ class Qn extends R {
36601
36616
  return this.tryJoinRoom(e + 1);
36602
36617
  } else
36603
36618
  this.joinRandomRoom && (this.roomName === null || this.roomName === void 0 || this.roomName.length <= 0) && (this.roomName = this.generateRoomName());
36604
- return this.requireRoomParameter && !t ? ((np || D()) && console.warn('[SyncedRoom] Missing required room parameter "' + this.urlParameterName + `" in url - will not connect.
36619
+ return this.requireRoomParameter && !t ? ((np || L()) && console.warn('[SyncedRoom] Missing required room parameter "' + this.urlParameterName + `" in url - will not connect.
36605
36620
  To allow joining a room without a query parameter you can set "requireRoomParameter" to false.`), !1) : (this.context.connection.isConnected || this.context.connection.connect(), this._lastJoinedRoom = this.roomName, this._roomPrefix && (this.roomName = this._roomPrefix + this.roomName), this.roomName.length <= 0 ? (console.warn(`[SyncedRoom] Room name is not set so we can not join a networked room.
36606
36621
  Please choose one of the following options to fix this:
36607
36622
  A) Set a room name in the SyncedRoom component
@@ -36613,7 +36628,7 @@ C) Set "joinRandomRoom" to true`), !1) : (np && console.log("Join " + this.roomN
36613
36628
  _userWantsToBeInARoom = !1;
36614
36629
  /** @internal */
36615
36630
  update() {
36616
- this.context.connection.isConnected && (this.context.time.time - this._lastPingTime > 3 && (this._lastPingTime = this.context.time.time, this.context.connection.sendPing()), this.context.connection.isInRoom && (this._lastRoomTime = this.context.time.time)), this._lastRoomTime > 0 && this.context.time.time - this._lastRoomTime > 0.3 && (this._lastRoomTime = -1, this.autoRejoin ? this._userWantsToBeInARoom && (console.log("Disconnected from networking backend - attempt reconnecting now"), this.tryJoinRoom()) : D() && console.warn("You are not connected to a room anymore (possibly because the tab was inactive for too long and the server kicked you?)"));
36631
+ this.context.connection.isConnected && (this.context.time.time - this._lastPingTime > 3 && (this._lastPingTime = this.context.time.time, this.context.connection.sendPing()), this.context.connection.isInRoom && (this._lastRoomTime = this.context.time.time)), this._lastRoomTime > 0 && this.context.time.time - this._lastRoomTime > 0.3 && (this._lastRoomTime = -1, this.autoRejoin ? this._userWantsToBeInARoom && (console.log("Disconnected from networking backend - attempt reconnecting now"), this.tryJoinRoom()) : L() && console.warn("You are not connected to a room anymore (possibly because the tab was inactive for too long and the server kicked you?)"));
36617
36632
  }
36618
36633
  /**
36619
36634
  * Get the URL to view the current room in view only mode.
@@ -36826,11 +36841,11 @@ Fu([
36826
36841
  Fu([
36827
36842
  u(ue)
36828
36843
  ], zu.prototype, "reaction");
36829
- const Tw = class rs extends R {
36844
+ const Tw = class os extends R {
36830
36845
  static receivers = {};
36831
36846
  static invoke(e) {
36832
- if (rs.receivers[e]) {
36833
- const t = rs.receivers[e];
36847
+ if (os.receivers[e]) {
36848
+ const t = os.receivers[e];
36834
36849
  if (!t) return;
36835
36850
  for (const i of t)
36836
36851
  i.invoke(e);
@@ -36845,15 +36860,15 @@ const Tw = class rs extends R {
36845
36860
  onEnable() {
36846
36861
  if (this.events)
36847
36862
  for (const e of this.events)
36848
- rs.receivers[e.signal.guid] || (rs.receivers[e.signal.guid] = []), rs.receivers[e.signal.guid].push(this);
36863
+ os.receivers[e.signal.guid] || (os.receivers[e.signal.guid] = []), os.receivers[e.signal.guid].push(this);
36849
36864
  }
36850
36865
  /** @internal */
36851
36866
  onDisable() {
36852
36867
  if (this.events) {
36853
36868
  for (const e of this.events)
36854
- if (rs.receivers[e.signal.guid]) {
36855
- const t = rs.receivers[e.signal.guid].indexOf(this);
36856
- t >= 0 && rs.receivers[e.signal.guid].splice(t, 1);
36869
+ if (os.receivers[e.signal.guid]) {
36870
+ const t = os.receivers[e.signal.guid].indexOf(this);
36871
+ t >= 0 && os.receivers[e.signal.guid].splice(t, 1);
36857
36872
  }
36858
36873
  }
36859
36874
  }
@@ -36893,7 +36908,7 @@ Fu([
36893
36908
  u(zu)
36894
36909
  ], Tw.prototype, "events");
36895
36910
  let Uu = Tw;
36896
- var ji = /* @__PURE__ */ ((s) => (s.Activation = "ActivationTrack", s.Animation = "AnimationTrack", s.Audio = "AudioTrack", s.Control = "ControlTrack", s.Marker = "MarkerTrack", s.Signal = "SignalTrack", s))(ji || {}), as = /* @__PURE__ */ ((s) => (s[s.None = 0] = "None", s[s.Hold = 1] = "Hold", s[s.Loop = 2] = "Loop", s[s.PingPong = 3] = "PingPong", s[s.Continue = 4] = "Continue", s))(as || {}), Ew = /* @__PURE__ */ ((s) => (s.Signal = "SignalEmitter", s))(Ew || {});
36911
+ var ji = /* @__PURE__ */ ((s) => (s.Activation = "ActivationTrack", s.Animation = "AnimationTrack", s.Audio = "AudioTrack", s.Control = "ControlTrack", s.Marker = "MarkerTrack", s.Signal = "SignalTrack", s))(ji || {}), rs = /* @__PURE__ */ ((s) => (s[s.None = 0] = "None", s[s.Hold = 1] = "Hold", s[s.Loop = 2] = "Loop", s[s.PingPong = 3] = "PingPong", s[s.Continue = 4] = "Continue", s))(rs || {}), Ew = /* @__PURE__ */ ((s) => (s.Signal = "SignalEmitter", s))(Ew || {});
36897
36912
  const En = w("debugtimeline");
36898
36913
  class Nu {
36899
36914
  director;
@@ -37068,15 +37083,15 @@ class Wg extends Nu {
37068
37083
  c.weight = 0;
37069
37084
  const d = e >= l.start && e <= l.end, f = l.preExtrapolationMode, p = l.postExtrapolationMode, g = a < this.clips.length - 1 ? this.models[a + 1] : null;
37070
37085
  let b = d, m = !1;
37071
- if (!b && !n && l.end < e && p !== as.None ? (!g || g.start > e) && (b = !0, n = !0) : a == 0 && !b && !o && l.start > e && f !== as.None && (!g || g.start < e) && (b = !0, m = !0, o = !0), b) {
37086
+ if (!b && !n && l.end < e && p !== rs.None ? (!g || g.start > e) && (b = !0, n = !0) : a == 0 && !b && !o && l.start > e && f !== rs.None && (!g || g.start < e) && (b = !0, m = !0, o = !0), b) {
37072
37087
  let v = this.weight;
37073
37088
  v *= this.evaluateWeight(e, a, this.models, b), v *= this.director.weight;
37074
37089
  let _ = d;
37075
37090
  if (m)
37076
37091
  switch (f) {
37077
- case as.Hold:
37092
+ case rs.Hold:
37078
37093
  break;
37079
- case as.Loop:
37094
+ case rs.Loop:
37080
37095
  e += l.start, _ = !0;
37081
37096
  break;
37082
37097
  default:
@@ -37085,19 +37100,19 @@ class Wg extends Nu {
37085
37100
  }
37086
37101
  let x = this.getClipTime(e, l), I = 0;
37087
37102
  const O = h.duration;
37088
- if (m && f === as.Hold && (x = 0), _) {
37103
+ if (m && f === rs.Hold && (x = 0), _) {
37089
37104
  if (h.loop)
37090
37105
  for (I += Math.floor(x / (O + 1e-6)); x > O; )
37091
37106
  x -= O;
37092
37107
  } else if (!d && n)
37093
37108
  switch (p) {
37094
- case as.Hold:
37109
+ case rs.Hold:
37095
37110
  x = this.getClipTime(l.end, l);
37096
37111
  break;
37097
- case as.Loop:
37112
+ case rs.Loop:
37098
37113
  x %= O;
37099
37114
  break;
37100
- case as.PingPong:
37115
+ case rs.PingPong:
37101
37116
  const B = Math.floor(x / O) % 2 !== 0;
37102
37117
  x %= O, B && (x = O - x);
37103
37118
  break;
@@ -37107,17 +37122,17 @@ class Wg extends Nu {
37107
37122
  if (c.weight = k, r += k, c.clampWhenFinished = !1, c.isRunning() || c.play(), this._useclipOffsets) {
37108
37123
  const E = t == 0 ? this._totalOffsetPosition : this._totalOffsetPosition2, B = t == 0 ? this._totalOffsetRotation : this._totalOffsetRotation2;
37109
37124
  t < 1 && (i = 1 - v), t += 1;
37110
- const L = this._summedPos.set(0, 0, 0), W = this._tempPos.set(0, 0, 0), X = this._summedRot.identity(), A = this._tempRot.identity(), $ = h.rotation;
37125
+ const D = this._summedPos.set(0, 0, 0), W = this._tempPos.set(0, 0, 0), X = this._summedRot.identity(), A = this._tempRot.identity(), $ = h.rotation;
37111
37126
  $ && (this._clipRotQuat.identity(), this._clipRotQuat.slerp($, v));
37112
37127
  const V = this._actionOffsets[a];
37113
37128
  if (V.hasOffsets)
37114
37129
  for (let ne = 0; ne < I; ne++)
37115
- V.rootPositionOffset ? W.copy(V.rootPositionOffset) : W.set(0, 0, 0), W.applyQuaternion(X), this._clipRotQuat && W.applyQuaternion(this._clipRotQuat), V.rootQuaternionOffset && (A.copy(V.rootQuaternionOffset), X.multiply(A)), L.add(W);
37116
- this._clipRotQuat && B.multiply(this._clipRotQuat), B.multiply(X), h.position && L.add(h.position), E.add(L);
37130
+ V.rootPositionOffset ? W.copy(V.rootPositionOffset) : W.set(0, 0, 0), W.applyQuaternion(X), this._clipRotQuat && W.applyQuaternion(this._clipRotQuat), V.rootQuaternionOffset && (A.copy(V.rootQuaternionOffset), X.multiply(A)), D.add(W);
37131
+ this._clipRotQuat && B.multiply(this._clipRotQuat), B.multiply(X), h.position && D.add(h.position), E.add(D);
37117
37132
  }
37118
37133
  }
37119
37134
  }
37120
- if (this._useclipOffsets && (this._totalOffsetPosition.lerp(this._totalOffsetPosition2, i), this._totalOffsetRotation.slerp(this._totalOffsetRotation2, i)), this.__mixerError === void 0 && (En || D()) && this._animator?.runtimeAnimatorController?.mixer && this.mixer !== this._animator?.runtimeAnimatorController?.mixer && (this.__mixerError = !0, console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!", this)), this._animator?.runtimeAnimatorController) {
37135
+ if (this._useclipOffsets && (this._totalOffsetPosition.lerp(this._totalOffsetPosition2, i), this._totalOffsetRotation.slerp(this._totalOffsetRotation2, i)), this.__mixerError === void 0 && (En || L()) && this._animator?.runtimeAnimatorController?.mixer && this.mixer !== this._animator?.runtimeAnimatorController?.mixer && (this.__mixerError = !0, console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!", this)), this._animator?.runtimeAnimatorController) {
37121
37136
  const a = Math.max(0, 1 - r);
37122
37137
  this._animator?.runtimeAnimatorController?.update(a);
37123
37138
  } else
@@ -37369,7 +37384,7 @@ var nA = Object.defineProperty, Aw = (s, e, t, i) => {
37369
37384
  (r = s[o]) && (n = r(e, t, n) || n);
37370
37385
  return n && nA(e, t, n), n;
37371
37386
  };
37372
- const is = w("debugtimeline"), Hg = class lm extends R {
37387
+ const ts = w("debugtimeline"), Hg = class lm extends R {
37373
37388
  static createTrackFunctions = {};
37374
37389
  static registerCreateTrack(e, t) {
37375
37390
  this.createTrackFunctions[e] = t;
@@ -37390,7 +37405,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37390
37405
  return this._time;
37391
37406
  }
37392
37407
  set time(e) {
37393
- typeof e == "number" && !Number.isNaN(e) ? this._time = e : (is || ln()) && console.error("INVALID TIMELINE.TIME VALUE", e, this.name);
37408
+ typeof e == "number" && !Number.isNaN(e) ? this._time = e : (ts || ln()) && console.error("INVALID TIMELINE.TIME VALUE", e, this.name);
37394
37409
  }
37395
37410
  /** the duration of the timeline */
37396
37411
  get duration() {
@@ -37420,7 +37435,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37420
37435
  _speed = 1;
37421
37436
  /** @internal */
37422
37437
  awake() {
37423
- is && console.log(this, this.playableAsset?.tracks), this.rebuildGraph(), !this.isValid() && (is || D()) && (is ? console.warn("PlayableDirector is not valid", "Asset?", this.playableAsset, "Tracks:", this.playableAsset?.tracks, "IsArray?", Array.isArray(this.playableAsset?.tracks), this) : this.playableAsset?.tracks?.length ? console.warn("PlayableDirector is not valid") : console.warn("PlayableDirector has no tracks"));
37438
+ ts && console.log(this, this.playableAsset?.tracks), this.rebuildGraph(), !this.isValid() && (ts || L()) && (ts ? console.warn("PlayableDirector is not valid", "Asset?", this.playableAsset, "Tracks:", this.playableAsset?.tracks, "IsArray?", Array.isArray(this.playableAsset?.tracks), this) : this.playableAsset?.tracks?.length ? console.warn("PlayableDirector is not valid") : console.warn("PlayableDirector has no tracks"));
37424
37439
  }
37425
37440
  /** @internal */
37426
37441
  onEnable() {
@@ -37479,7 +37494,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37479
37494
  if (t.length > 0 && (await Promise.all(t), !this._isPlaying))
37480
37495
  return;
37481
37496
  for (; this._audioTracks.length > 0 && this._isPlaying && !hn.userInteractionRegistered && this.waitForAudio; )
37482
- await ks(200);
37497
+ await Os(200);
37483
37498
  }
37484
37499
  this.invokeStateChangedMethodsOnTracks(), this._internalUpdateRoutine = this.startCoroutine(this.internalUpdate(), xe.LateUpdate);
37485
37500
  }
@@ -37605,7 +37620,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37605
37620
  for (const c of n.clips)
37606
37621
  c.start <= i && i <= c.end && (a = !0);
37607
37622
  const l = r;
37608
- l.visible !== void 0 && l.visible !== a && (l.visible = a, is && console.warn(this.name, "set ActivationTrack-" + o, l.name, a, i));
37623
+ l.visible !== void 0 && l.visible !== a && (l.visible = a, ts && console.warn(this.name, "set ActivationTrack-" + o, l.name, a, i));
37609
37624
  }
37610
37625
  }
37611
37626
  break;
@@ -37631,7 +37646,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37631
37646
  if (typeof n == "string") {
37632
37647
  this._guidsMap && this._guidsMap[n] && (n = this._guidsMap[n]);
37633
37648
  const o = S.findByGuid(n, e);
37634
- o === null || typeof o != "object" ? (t.outputs.splice(i, 1), console.warn("Failed to resolve binding", n, t.name, t.type)) : (is && console.log("Resolved binding", n, "to", o), t.outputs[i] = o);
37649
+ o === null || typeof o != "object" ? (t.outputs.splice(i, 1), console.warn("Failed to resolve binding", n, t.name, t.type)) : (ts && console.log("Resolved binding", n, "to", o), t.outputs[i] = o);
37635
37650
  } else if (n === null) {
37636
37651
  if (t.outputs.splice(i, 1), lm.createTrackFunctions[t.type])
37637
37652
  continue;
@@ -37645,7 +37660,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37645
37660
  if (typeof o == "string") {
37646
37661
  this._guidsMap && this._guidsMap[o] && (o = this._guidsMap[o]);
37647
37662
  const r = S.findByGuid(o, e);
37648
- r === null || typeof r != "object" ? console.warn("Failed to resolve sourceObject binding", o, t.name, n) : (is && console.log("Resolved binding", o, "to", r), n.asset.sourceObject = r);
37663
+ r === null || typeof r != "object" ? console.warn("Failed to resolve sourceObject binding", o, t.name, n) : (ts && console.log("Resolved binding", o, "to", r), n.asset.sourceObject = r);
37649
37664
  }
37650
37665
  }
37651
37666
  }
@@ -37680,7 +37695,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37680
37695
  }
37681
37696
  if (t.type === ji.Animation) {
37682
37697
  if (!t.clips || t.clips.length <= 0) {
37683
- is && console.warn("Animation track has no clips", t);
37698
+ ts && console.warn("Animation track has no clips", t);
37684
37699
  continue;
37685
37700
  }
37686
37701
  for (let o = t.outputs.length - 1; o >= 0; o--) {
@@ -37701,7 +37716,7 @@ const is = w("debugtimeline"), Hg = class lm extends R {
37701
37716
  }
37702
37717
  const f = d.clip;
37703
37718
  let p = f;
37704
- if ((typeof p == "string" || typeof p == "number") && (p = a.find((b) => b.name === f)), is && console.log(d, f, "→", p), !p) {
37719
+ if ((typeof p == "string" || typeof p == "number") && (p = a.find((b) => b.name === f)), ts && console.log(d, f, "→", p), !p) {
37705
37720
  console.warn("Could not find animationClip for model", h, t.name, this.name, this.playableAsset?.name, a, r);
37706
37721
  continue;
37707
37722
  }
@@ -37814,7 +37829,7 @@ class Ja extends R {
37814
37829
  * This applies the translationSnap, rotationSnapAngle, and scaleSnap properties to the controls.
37815
37830
  */
37816
37831
  enableSnapping() {
37817
- this._control && (this._control.setTranslationSnap(this.translationSnap), this._control.setRotationSnap(ys.degToRad(this.rotationSnapAngle)), this._control.setScaleSnap(this.scaleSnap));
37832
+ this._control && (this._control.setTranslationSnap(this.translationSnap), this._control.setRotationSnap(gs.degToRad(this.rotationSnapAngle)), this._control.setScaleSnap(this.scaleSnap));
37818
37833
  }
37819
37834
  /**
37820
37835
  * Disables grid snapping for transform operations.
@@ -38622,7 +38637,7 @@ class Xc extends R {
38622
38637
  }
38623
38638
  this._validateUrl();
38624
38639
  let e = this.url;
38625
- switch (!e.startsWith("mailto:") && e.includes("@") && (e = "mailto:" + e), D() && Be("Open URL: " + e), this.mode) {
38640
+ switch (!e.startsWith("mailto:") && e.includes("@") && (e = "mailto:" + e), L() && Be("Open URL: " + e), this.mode) {
38626
38641
  case 0:
38627
38642
  q.isSafari(), globalThis.open(e, "_blank");
38628
38643
  break;
@@ -38651,7 +38666,7 @@ class Xc extends R {
38651
38666
  this.clickable && !e.used && this.url?.length && this.open();
38652
38667
  }
38653
38668
  _validateUrl() {
38654
- this.url && this.url.startsWith("www.") && (D() && console.warn("URL is not valid, adding https:// to the start of the URL", this.url), this.url = "https://" + this.url);
38669
+ this.url && this.url.startsWith("www.") && (L() && console.warn("URL is not valid, adding https:// to the start of the URL", this.url), this.url = "https://" + this.url);
38655
38670
  }
38656
38671
  }
38657
38672
  Qg([
@@ -38737,7 +38752,7 @@ NeedleXRSession.onSessionRequestStart(evt => {
38737
38752
  evt.init.optionalFeatures = evt.init.optionalFeatures || [];
38738
38753
  evt.init.optionalFeatures.push('camera-access');
38739
38754
  });
38740
- `), D() && Xd("No camera feed available - please request the 'camera-access' feature before starting WebXR or add the ARCameraBackground component to your scene"), !1;
38755
+ `), L() && Xd("No camera feed available - please request the 'camera-access' feature before starting WebXR or add the ARCameraBackground component to your scene"), !1;
38741
38756
  const n = t.getViewerPose(s.xr.getReferenceSpace());
38742
38757
  if (n)
38743
38758
  for (const o of n.views)
@@ -38785,9 +38800,9 @@ function Fw(s) {
38785
38800
  const a = i.renderer, l = a.xr.enabled && a.xr.isPresenting;
38786
38801
  if (l && i.currentFrameEvent != xe.EarlyUpdate)
38787
38802
  return console.warn("Screenshot: defer to access XR frame"), new Promise((E) => {
38788
- Rs((B) => {
38789
- const L = Fw(s);
38790
- E(L);
38803
+ Ms((B) => {
38804
+ const D = Fw(s);
38805
+ E(D);
38791
38806
  }, xe.EarlyUpdate, { once: !0 });
38792
38807
  });
38793
38808
  const c = a.domElement, h = c.width, d = c.height;
@@ -38804,18 +38819,18 @@ function Fw(s) {
38804
38819
  if (A?.onBeforeRender(), A.isInstancingActive && A.instances)
38805
38820
  for (let $ = 0; $ < A.instances?.length; $++) {
38806
38821
  const V = A.instances[$];
38807
- ds(V.object, !0);
38822
+ hs(V.object, !0);
38808
38823
  }
38809
38824
  })), e && (i.scene.background = null, a.setClearColor(0, 0)), s.background && (i.scene.background = null, a.setClearColor(s.background), s.background instanceof oe && a.setClearAlpha(s.background.a)), e && a.setClearAlpha(0), a.setSize(n, o, !1), "cam" in r && (r = r.threeCamera), r instanceof me && (r.aspect = n / o, r.updateProjectionMatrix());
38810
38825
  const B = "type" in s && s.type === "texture";
38811
- let L = null;
38812
- B && (L = new jn(n, o, {
38826
+ let D = null;
38827
+ B && (D = new jn(n, o, {
38813
38828
  wrapS: ty,
38814
38829
  wrapT: ty,
38815
38830
  format: 1023
38816
- }), a.setRenderTarget(L));
38831
+ }), a.setRenderTarget(D));
38817
38832
  let W = c;
38818
- if (l ? (L && console.error('Taking XR screenshots with { type: "texture" } is currently not supported.'), W = Ed.compositeWithCameraImage({
38833
+ if (l ? (D && console.error('Taking XR screenshots with { type: "texture" } is currently not supported.'), W = Ed.compositeWithCameraImage({
38819
38834
  width: f,
38820
38835
  height: p,
38821
38836
  scene: i.scene,
@@ -38840,7 +38855,7 @@ function Fw(s) {
38840
38855
  }
38841
38856
  if ("type" in s) {
38842
38857
  if (s.type === "texture")
38843
- return L ? (s.target && (s.target.image = L?.texture.image, s.target.needsUpdate = !0), L.texture.offset.set(0, -1), L.texture.needsUpdate = !0, L.texture) : (console.error("No target texture found"), null);
38858
+ return D ? (s.target && (s.target.image = D?.texture.image, s.target.needsUpdate = !0), D.texture.offset.set(0, -1), D.texture.needsUpdate = !0, D.texture) : (console.error("No target texture found"), null);
38844
38859
  if (s.type === "blob")
38845
38860
  return new Promise(($, V) => {
38846
38861
  W.toBlob((ne) => {
@@ -38920,7 +38935,7 @@ var Ed;
38920
38935
  let e = null, t = null, i = null, n = null, o = null;
38921
38936
  function r(c) {
38922
38937
  const { renderer: h, width: d, height: f } = c, p = h.xr.enabled, g = h.getRenderTarget(), b = h.autoClear, m = d, v = f, _ = d / f;
38923
- (!i || i.width !== m || i.height !== v) && (i ??= new jn(m, v, { colorSpace: Ps }), i.width = m, i.height = v, i.samples = 4, i.texture.repeat.y = -1, i.texture.offset.y = 1), (!o || o.width !== m || o.height !== v) && (o = document.createElement("canvas"), o.width = m, o.height = v, o.style.position = "fixed", o.style.top = "0px", o.style.right = "0px", o.style.width = "300px", o.style.height = `${300 / _}px`, o.style.zIndex = "1000", o.style.pointerEvents = "none", o.style.opacity = "1.0", o.style.willChange = "contents"), e || (e = l({
38938
+ (!i || i.width !== m || i.height !== v) && (i ??= new jn(m, v, { colorSpace: Cs }), i.width = m, i.height = v, i.samples = 4, i.texture.repeat.y = -1, i.texture.offset.y = 1), (!o || o.width !== m || o.height !== v) && (o = document.createElement("canvas"), o.width = m, o.height = v, o.style.position = "fixed", o.style.top = "0px", o.style.right = "0px", o.style.width = "300px", o.style.height = `${300 / _}px`, o.style.zIndex = "1000", o.style.pointerEvents = "none", o.style.opacity = "1.0", o.style.willChange = "contents"), e || (e = l({
38924
38939
  defines: {
38925
38940
  DECODE_VIDEO_TEXTURE: !0
38926
38941
  }
@@ -39169,7 +39184,7 @@ class CA {
39169
39184
  const n = i;
39170
39185
  return n.isImageTrackingExtension && n.component.activeAndEnabled && n.component.trackedImages?.length > 0;
39171
39186
  }).indexOf(this);
39172
- this.shouldExport = t === 0, this.shouldExport && this.component.trackedImages?.length > 1 && (Ad || D()) && (ge("USDZ: Only one tracked image is supported."), console.warn("USDZ: Only one tracked image is supported. Will choose the first one in the trackedImages list"));
39187
+ this.shouldExport = t === 0, this.shouldExport && this.component.trackedImages?.length > 1 && (Ad || L()) && (ge("USDZ: Only one tracked image is supported."), console.warn("USDZ: Only one tracked image is supported. Will choose the first one in the trackedImages list"));
39173
39188
  }
39174
39189
  onAfterHierarchy(e, t) {
39175
39190
  if (!this.shouldExport) return;
@@ -39214,10 +39229,10 @@ class Xu extends R {
39214
39229
  e.image && PA(e.image);
39215
39230
  }
39216
39231
  onEnable() {
39217
- xs.beforeExport.addEventListener(this.onBeforeUSDZExport);
39232
+ ws.beforeExport.addEventListener(this.onBeforeUSDZExport);
39218
39233
  }
39219
39234
  onDisable() {
39220
- xs.beforeExport.removeEventListener(this.onBeforeUSDZExport);
39235
+ ws.beforeExport.removeEventListener(this.onBeforeUSDZExport);
39221
39236
  }
39222
39237
  onBeforeUSDZExport = (e) => {
39223
39238
  this.activeAndEnabled && this.trackedImages?.length && e.exporter.extensions.push(new CA(e.exporter, this));
@@ -39717,11 +39732,11 @@ P.add("PreliminaryAction", Tc);
39717
39732
  P.add("PreliminaryTrigger", gu);
39718
39733
  P.add("VisibilityAction", yu);
39719
39734
  P.add("TapGestureTrigger", zv);
39720
- P.add("USDZExporter", xs);
39735
+ P.add("USDZExporter", ws);
39721
39736
  P.add("Fog", Ic);
39722
39737
  P.add("BoxGizmo", Va);
39723
39738
  P.add("GridHelper", Lc);
39724
- P.add("GroundProjectedEnv", Ts);
39739
+ P.add("GroundProjectedEnv", Rs);
39725
39740
  P.add("UsageMarker", du);
39726
39741
  P.add("Interactable", lv);
39727
39742
  P.add("FixedJoint", nw);
@@ -39729,7 +39744,7 @@ P.add("HingeJoint", Cu);
39729
39744
  P.add("Light", Ki);
39730
39745
  P.add("LODGroup", Pu);
39731
39746
  P.add("LookAtConstraint", Ia);
39732
- P.add("NeedleMenu", Is);
39747
+ P.add("NeedleMenu", As);
39733
39748
  P.add("NestedGltf", Ou);
39734
39749
  P.add("Networking", ow);
39735
39750
  P.add("OffsetConstraint", Ha);
@@ -39748,7 +39763,7 @@ P.add("PixelationEffect", Lu);
39748
39763
  P.add("ScreenSpaceAmbientOcclusion", ko);
39749
39764
  P.add("ScreenSpaceAmbientOcclusionN8", Xn);
39750
39765
  P.add("SharpeningEffect", Du);
39751
- P.add("TiltShiftEffect", js);
39766
+ P.add("TiltShiftEffect", Ds);
39752
39767
  P.add("ToneMappingEffect", fr);
39753
39768
  P.add("Vignette", Ya);
39754
39769
  P.add("Volume", Uc);
@@ -39762,11 +39777,11 @@ P.add("ScreenCapture", Rr);
39762
39777
  P.add("ShadowCatcher", ju);
39763
39778
  P.add("RemoteSkybox", Fg);
39764
39779
  P.add("SmoothFollow", zg);
39765
- P.add("SpatialTriggerReceiver", Ss);
39780
+ P.add("SpatialTriggerReceiver", xs);
39766
39781
  P.add("SpatialTrigger", Ug);
39767
39782
  P.add("SpectatorCamera", Ng);
39768
39783
  P.add("SplineContainer", Za);
39769
- P.add("SplineWalker", Bs);
39784
+ P.add("SplineWalker", js);
39770
39785
  P.add("SpriteRenderer", Si);
39771
39786
  P.add("SyncedCamera", kw);
39772
39787
  P.add("SyncedRoom", Qn);
@@ -39951,7 +39966,7 @@ async function Nw(s, e) {
39951
39966
  case "unknown": {
39952
39967
  console.warn(`Unknown file type (${t}). Needle Engine will fallback to the GLTFLoader - To support more model formats please create a Needle loader plugin.
39953
39968
  Use import { NeedleEngineModelLoader } from "@needle-tools/engine" namespace to register your loader.`, s);
39954
- const i = new Os();
39969
+ const i = new Ps();
39955
39970
  return await Vp(i, e, s), i;
39956
39971
  }
39957
39972
  case "model/fbx":
@@ -39966,7 +39981,7 @@ Use import { NeedleEngineModelLoader } from "@needle-tools/engine" namespace to
39966
39981
  case "model/gltf+json":
39967
39982
  case "model/gltf-binary":
39968
39983
  case "model/vrm": {
39969
- const i = new Os();
39984
+ const i = new Ps();
39970
39985
  return await Vp(i, e, s), i;
39971
39986
  }
39972
39987
  }
@@ -39985,7 +40000,7 @@ async function jA(s, e, t, i) {
39985
40000
  const a = n.parse(e);
39986
40001
  return await ic(n, s, t, a, i, o);
39987
40002
  }
39988
- if (!(n instanceof Os)) {
40003
+ if (!(n instanceof Ps)) {
39989
40004
  if (n.parse === void 0) {
39990
40005
  console.error("Loader does not support parse");
39991
40006
  return;
@@ -40015,7 +40030,7 @@ async function $w(s, e, t, i, n) {
40015
40030
  if (!o)
40016
40031
  return;
40017
40032
  const { componentsExtension: r } = Ww(o, s);
40018
- if (!(o instanceof Os)) {
40033
+ if (!(o instanceof Ps)) {
40019
40034
  const a = await o.loadAsync(e, n);
40020
40035
  return await ic(o, s, e, a, i, r);
40021
40036
  }
@@ -40037,7 +40052,7 @@ async function $w(s, e, t, i, n) {
40037
40052
  }
40038
40053
  function Ww(s, e) {
40039
40054
  const t = bv(s);
40040
- return s instanceof Os && Qm(s, e), { componentsExtension: t };
40055
+ return s instanceof Ps && Qm(s, e), { componentsExtension: t };
40041
40056
  }
40042
40057
  async function ic(s, e, t, i, n, o) {
40043
40058
  if (Uw && console.warn("Loaded", t, i), i == null)
@@ -40275,7 +40290,7 @@ class Id {
40275
40290
  Xo && !e && console.log("Creating loading element"), this._loadingElement = e || document.createElement("div");
40276
40291
  let t = this._element.getAttribute("loading-style");
40277
40292
  (!t || t === "auto") && (window.matchMedia("(prefers-color-scheme: dark)").matches ? t = "dark" : t = "light");
40278
- const i = vs();
40293
+ const i = bs();
40279
40294
  if (!e) {
40280
40295
  this._loadingElement.style.position = "absolute", this._loadingElement.style.width = "100%", this._loadingElement.style.height = "100%", this._loadingElement.style.left = "0", this._loadingElement.style.top = "0";
40281
40296
  const f = this._element.getAttribute("loading-background");
@@ -40321,12 +40336,12 @@ class Id {
40321
40336
  return this.handleRuntimeLicense(this._loadingElement), this._loadingElement;
40322
40337
  }
40323
40338
  async handleRuntimeLicense(e) {
40324
- let t = ws();
40339
+ let t = vs();
40325
40340
  if (t) return;
40326
40341
  ob && console.log("Loading UI has commercial license?", t);
40327
40342
  const i = document.createElement("div");
40328
40343
  i.style.paddingTop = ".6em", i.style.fontSize = ".8em", i.style.textTransform = "uppercase", i.innerText = `NEEDLE ENGINE NON COMMERCIAL VERSION
40329
- CLICK HERE TO GET A LICENSE`, i.style.cursor = "pointer", i.style.userSelect = "none", i.style.textAlign = "center", i.style.pointerEvents = "all", i.addEventListener("click", () => window.open("https://needle.tools/pricing", "_self")), i.style.opacity = "0", e.appendChild(i), !D() && ka && (ob && console.log("Waiting for runtime license check"), await ka, t = ws()), !t && (i.style.transition = "opacity .5s ease-in-out", i.style.opacity = "1");
40344
+ CLICK HERE TO GET A LICENSE`, i.style.cursor = "pointer", i.style.userSelect = "none", i.style.textAlign = "center", i.style.pointerEvents = "all", i.addEventListener("click", () => window.open("https://needle.tools/pricing", "_self")), i.style.opacity = "0", e.appendChild(i), !L() && ka && (ob && console.log("Waiting for runtime license check"), await ka, t = vs()), !t && (i.style.transition = "opacity .5s ease-in-out", i.style.opacity = "1");
40330
40345
  }
40331
40346
  }
40332
40347
  t0(zw);
@@ -40578,7 +40593,7 @@ changed from "`, t, '" to "', i, '"'), this.onLoad();
40578
40593
  return;
40579
40594
  const i = this.getAttribute("alias");
40580
40595
  this.classList.add("loading");
40581
- const n = ws();
40596
+ const n = vs();
40582
40597
  this.ensureLoadStartIsRegistered();
40583
40598
  let o = this.dispatchEvent(new CustomEvent("loadstart", {
40584
40599
  detail: {
@@ -40591,7 +40606,7 @@ changed from "`, t, '" to "', i, '"'), this.onLoad();
40591
40606
  const g = this.getAttribute("hide-loading-overlay");
40592
40607
  g != null && g !== "0" && (o = !1);
40593
40608
  }
40594
- o === !1 && !n && (D() || (o = !0), console.warn("Needle Engine: You need a commercial license to override the default loading view. Visit https://needle.tools/pricing"), D() && ge('You need a <a target="_blank" href="https://needle.tools/pricing">commercial license</a> to override the default loading view. This will not work in production.')), !this._loadingView && o && (this._loadingView = new Id(this)), o && (this._didFullyLoad !== !0 ? this._loadingView?.onLoadingBegin("begin load") : setTimeout(() => {
40609
+ o === !1 && !n && (L() || (o = !0), console.warn("Needle Engine: You need a commercial license to override the default loading view. Visit https://needle.tools/pricing"), L() && ge('You need a <a target="_blank" href="https://needle.tools/pricing">commercial license</a> to override the default loading view. This will not work in production.')), !this._loadingView && o && (this._loadingView = new Id(this)), o && (this._didFullyLoad !== !0 ? this._loadingView?.onLoadingBegin("begin load") : setTimeout(() => {
40595
40610
  this._loadingView && this._loadingProgress01 < 0.3 && this._loadId === t && this._loadingView.onLoadingBegin("begin load");
40596
40611
  }, 300)), Pe && console.warn(`--------------
40597
40612
  Needle Engine: Begin loading ` + t + `
@@ -40815,9 +40830,9 @@ function VA(s) {
40815
40830
  let f = t[d];
40816
40831
  (f === "_" || f === "-") && (f = " "), !(f === " " && l.length <= 0 || h.includes(f) || (l.length === 0 && (f = f.toUpperCase()), c && f === " ")) && (c && (f = f.toUpperCase()), c = !1, l += f, f === " " && (c = !0));
40817
40832
  }
40818
- return D() && t !== l && console.debug('Generated display name: "' + t + '" → "' + l + '"'), l.trim();
40833
+ return L() && t !== l && console.debug('Generated display name: "' + t + '" → "' + l + '"'), l.trim();
40819
40834
  }
40820
- return D() && console.debug("Loading: use default name", t), t;
40835
+ return L() && console.debug("Loading: use default name", t), t;
40821
40836
  }
40822
40837
  function HA(s) {
40823
40838
  V0((e) => {
@@ -40904,7 +40919,7 @@ class nc {
40904
40919
  this.world?.removeCollider(o, !0);
40905
40920
  const r = o.parent();
40906
40921
  r && r.numColliders() <= 0 && (r[Kt] || this.world?.removeRigidBody(r));
40907
- } else n instanceof T.RAPIER_PHYSICS.MODULE.RigidBody && (n.numColliders() <= 0 ? this.world?.removeRigidBody(n) : D() && (n.did_log_removing || setTimeout(() => {
40922
+ } else n instanceof T.RAPIER_PHYSICS.MODULE.RigidBody && (n.numColliders() <= 0 ? this.world?.removeRigidBody(n) : L() && (n.did_log_removing || setTimeout(() => {
40908
40923
  n.numColliders() > 0 && (n.did_log_removing = !0, console.warn("RapierPhysics: removing rigidbody with colliders from the physics world is not possible right now, please remove the colliders first"));
40909
40924
  }, 1)));
40910
40925
  }
@@ -41139,7 +41154,7 @@ class nc {
41139
41154
  Qe && console.warn("Physics are disabled");
41140
41155
  return;
41141
41156
  }
41142
- const i = e.gameObject, n = $e(i, this._tempPosition).multiply(t);
41157
+ const i = e.gameObject, n = We(i, this._tempPosition).multiply(t);
41143
41158
  n.multiplyScalar(0.5), n.x < 0 && (n.x = Math.abs(n.x)), n.y < 0 && (n.y = Math.abs(n.y)), n.z < 0 && (n.z = Math.abs(n.z));
41144
41159
  const o = 1e-7;
41145
41160
  n.x < o && (n.x = o), n.y < o && (n.y = o), n.z < o && (n.z = o);
@@ -41161,7 +41176,7 @@ class nc {
41161
41176
  Qe && console.warn("Physics are disabled");
41162
41177
  return;
41163
41178
  }
41164
- const n = e.gameObject, o = $e(n, this._tempPosition);
41179
+ const n = e.gameObject, o = We(n, this._tempPosition);
41165
41180
  o.x = Math.abs(o.x), o.y = Math.abs(o.y);
41166
41181
  const r = i * o.x;
41167
41182
  t = Math.max(t, r * 2);
@@ -41197,7 +41212,7 @@ class nc {
41197
41212
  if (this._meshCache.has(d))
41198
41213
  Qe && console.warn("Use cached mesh collider"), r = this._meshCache.get(d);
41199
41214
  else {
41200
- (Qe || D()) && console.debug(`[Performance] Your MeshCollider "${e.name}" is scaled: consider applying the scale to the collider mesh instead (${c.x}, ${c.y}, ${c.z})`);
41215
+ (Qe || L()) && console.debug(`[Performance] Your MeshCollider "${e.name}" is scaled: consider applying the scale to the collider mesh instead (${c.x}, ${c.y}, ${c.z})`);
41201
41216
  const f = new Float32Array(r.length);
41202
41217
  for (let p = 0; p < r.length; p += 3)
41203
41218
  f[p] = r[p] * c.x, f[p + 1] = r[p + 1] * c.y, f[p + 2] = r[p + 2] * c.z;
@@ -41351,12 +41366,12 @@ Error:`, r), null;
41351
41366
  switch (i.type) {
41352
41367
  // Sphere Collider
41353
41368
  case T.RAPIER_PHYSICS.MODULE.ShapeType.Ball: {
41354
- const f = i, p = e, g = e.gameObject, b = $e(g, this._tempPosition), m = Math.abs(p.radius * b.x);
41369
+ const f = i, p = e, g = e.gameObject, b = We(g, this._tempPosition), m = Math.abs(p.radius * b.x);
41355
41370
  n = f.radius !== m, f.radius = m, n && t.setShape(f);
41356
41371
  break;
41357
41372
  }
41358
41373
  case T.RAPIER_PHYSICS.MODULE.ShapeType.Cuboid:
41359
- const o = i, r = e, a = e.gameObject, l = $e(a, this._tempPosition), c = Math.abs(r.size.x * 0.5 * l.x), h = Math.abs(r.size.y * 0.5 * l.y), d = Math.abs(r.size.z * 0.5 * l.z);
41374
+ const o = i, r = e, a = e.gameObject, l = We(a, this._tempPosition), c = Math.abs(r.size.x * 0.5 * l.x), h = Math.abs(r.size.y * 0.5 * l.y), d = Math.abs(r.size.z * 0.5 * l.z);
41360
41375
  n = o.halfExtents.x !== c || o.halfExtents.y !== h || o.halfExtents.z !== d, o.halfExtents.x = c, o.halfExtents.y = h, o.halfExtents.z = d, n && t.setShape(o);
41361
41376
  break;
41362
41377
  }
@@ -41387,11 +41402,14 @@ Error:`, r), null;
41387
41402
  if (this._isUpdatingPhysicsWorld = !0, this.eventQueue || (this.eventQueue = new T.RAPIER_PHYSICS.MODULE.EventQueue(!1)), e === void 0 || e <= 0) {
41388
41403
  this._isUpdatingPhysicsWorld = !1;
41389
41404
  return;
41390
- } else e !== void 0 && (this.world.timestep = j.lerp(this.world.timestep, e, 0.8));
41405
+ } else if (e !== void 0) {
41406
+ const t = j.lerp(this.world.timestep, e, 0.8);
41407
+ this.world.timestep = t;
41408
+ }
41391
41409
  try {
41392
41410
  this.world.step(this.eventQueue);
41393
41411
  } catch (t) {
41394
- console.warn("Error running physics step", t);
41412
+ console.warn("Error running physics step", { timestep: this.world.timestep }, t);
41395
41413
  }
41396
41414
  this._isUpdatingPhysicsWorld = !1;
41397
41415
  }
@@ -41427,13 +41445,13 @@ Error:`, r), null;
41427
41445
  }
41428
41446
  const o = i.translation(), r = i.rotation();
41429
41447
  if (Number.isNaN(o.x) || Number.isNaN(r.x)) {
41430
- !n.__COLLIDER_NAN && D() && (console.warn("Collider has NaN values", n.name, n.gameObject, i), n.__COLLIDER_NAN = !0);
41448
+ !n.__COLLIDER_NAN && L() && (console.warn("Collider has NaN values", n.name, n.gameObject, i), n.__COLLIDER_NAN = !0);
41431
41449
  continue;
41432
41450
  }
41433
41451
  const a = t.center;
41434
41452
  if (a && a.isVector3) {
41435
41453
  this._tempQuaternion.set(r.x, r.y, r.z, r.w);
41436
- const l = this._tempPosition.copy(a).applyQuaternion(this._tempQuaternion), c = $e(t.gameObject);
41454
+ const l = this._tempPosition.copy(a).applyQuaternion(this._tempQuaternion), c = We(t.gameObject);
41437
41455
  l.multiply(c), o.x -= l.x, o.y -= l.y, o.z -= l.z;
41438
41456
  }
41439
41457
  ya(t.gameObject, o.x, o.y, o.z), Vb(t.gameObject, r.x, r.y, r.z, r.w);
@@ -41470,12 +41488,12 @@ Error:`, r), null;
41470
41488
  _tempCenterQuaternion = new U();
41471
41489
  tryApplyCenter(e, t) {
41472
41490
  const i = e.center;
41473
- i && e.gameObject && (i.x !== 0 || i.y !== 0 || i.z !== 0) && (this._tempCenterPos.x = i.x, this._tempCenterPos.y = i.y, this._tempCenterPos.z = i.z, $e(e.gameObject, this._tempCenterVec), this._tempCenterPos.multiply(this._tempCenterVec), e.attachedRigidbody ? this._tempCenterPos.applyQuaternion(e.gameObject.quaternion) : (be(e.gameObject, this._tempCenterQuaternion), this._tempCenterPos.applyQuaternion(this._tempCenterQuaternion)), t.x += this._tempCenterPos.x, t.y += this._tempCenterPos.y, t.z += this._tempCenterPos.z);
41491
+ i && e.gameObject && (i.x !== 0 || i.y !== 0 || i.z !== 0) && (this._tempCenterPos.x = i.x, this._tempCenterPos.y = i.y, this._tempCenterPos.z = i.z, We(e.gameObject, this._tempCenterVec), this._tempCenterPos.multiply(this._tempCenterVec), e.attachedRigidbody ? this._tempCenterPos.applyQuaternion(e.gameObject.quaternion) : (be(e.gameObject, this._tempCenterQuaternion), this._tempCenterPos.applyQuaternion(this._tempCenterQuaternion)), t.x += this._tempCenterPos.x, t.y += this._tempCenterPos.y, t.z += this._tempCenterPos.z);
41474
41492
  }
41475
41493
  static _matricesBuffer = [];
41476
41494
  getRigidbodyRelativeMatrix(e, t, i, n) {
41477
41495
  if (n === void 0 && (n = nc._matricesBuffer, n.length = 0), e === t) {
41478
- const o = $e(e, this._tempPosition);
41496
+ const o = We(e, this._tempPosition);
41479
41497
  i.makeScale(o.x, o.y, o.z);
41480
41498
  for (let r = n.length - 1; r >= 0; r--)
41481
41499
  i.multiply(n[r]);
@@ -41674,7 +41692,7 @@ class kL {
41674
41692
  }
41675
41693
  if (m) {
41676
41694
  const v = await m.loadAsync(l).catch((_) => (console.error(_), null));
41677
- v && (v.mapping = bs, v.needsUpdate = !0, o.background = v, o.environment = v, o.backgroundBlurriness = 0.75);
41695
+ v && (v.mapping = _s, v.needsUpdate = !0, o.background = v, o.environment = v, o.backgroundBlurriness = 0.75);
41678
41696
  } else console.warn("Unsupported environment map format", l);
41679
41697
  }
41680
41698
  const c = bi(o.children), h = c.getCenter(new y()), d = c.getSize(new y()), p = Math.max(d.x, d.y, d.z) / (2 * Math.tan(Math.PI * a.fov / 360));
@@ -41766,7 +41784,7 @@ function ZA(s, e, t) {
41766
41784
  const i = new Set(t);
41767
41785
  return Array.from(i);
41768
41786
  }
41769
- const db = "needle-button", ap = D();
41787
+ const db = "needle-button", ap = L();
41770
41788
  class JA extends HTMLElement {
41771
41789
  static observedAttributes = ["ar", "vr", "quicklook"];
41772
41790
  constructor() {
@@ -41910,7 +41928,7 @@ class eI {
41910
41928
  }
41911
41929
  return o ? (await Bn().parseSync(e, o, null, 0))?.scene ?? null : null;
41912
41930
  }
41913
- const i = new Os();
41931
+ const i = new Ps();
41914
41932
  return Qm(i, e), new Promise((n, o) => {
41915
41933
  const r = this.avatarRegistryUrl + "/" + t;
41916
41934
  i.load(
@@ -42077,7 +42095,7 @@ const TL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42077
42095
  GraphicRaycaster: Jm,
42078
42096
  GridHelper: Lc,
42079
42097
  GridLayoutGroup: Jv,
42080
- GroundProjectedEnv: Ts,
42098
+ GroundProjectedEnv: Rs,
42081
42099
  GroupActionModel: Zr,
42082
42100
  HideOnStart: nn,
42083
42101
  HingeJoint: Cu,
@@ -42102,7 +42120,7 @@ const TL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42102
42120
  MeshRenderer: fu,
42103
42121
  MinMaxCurve: Y,
42104
42122
  MinMaxGradient: qa,
42105
- NeedleMenu: Is,
42123
+ NeedleMenu: As,
42106
42124
  NestedGltf: Ou,
42107
42125
  Networking: ow,
42108
42126
  NoiseModule: ve,
@@ -42157,12 +42175,12 @@ const TL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42157
42175
  SpatialGrabRaycaster: Ra,
42158
42176
  SpatialHtml: Hu,
42159
42177
  SpatialTrigger: Ug,
42160
- SpatialTriggerReceiver: Ss,
42178
+ SpatialTriggerReceiver: xs,
42161
42179
  SpectatorCamera: Ng,
42162
42180
  SphereCollider: Oc,
42163
42181
  SplineContainer: Za,
42164
- SplineData: Ms,
42165
- SplineWalker: Bs,
42182
+ SplineData: ks,
42183
+ SplineWalker: js,
42166
42184
  Sprite: wo,
42167
42185
  SpriteData: Kl,
42168
42186
  SpriteRenderer: Si,
@@ -42179,7 +42197,7 @@ const TL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42179
42197
  TextBuilder: Yv,
42180
42198
  TextExtension: Sg,
42181
42199
  TextureSheetAnimationModule: Qt,
42182
- TiltShiftEffect: js,
42200
+ TiltShiftEffect: Ds,
42183
42201
  ToneMappingEffect: fr,
42184
42202
  TrailModule: Ne,
42185
42203
  TransformData: Ue,
@@ -42188,12 +42206,12 @@ const TL = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42188
42206
  TriggerModel: sr,
42189
42207
  UIRaycastUtils: K0,
42190
42208
  UIRootComponent: wu,
42191
- USDZExporter: xs,
42209
+ USDZExporter: ws,
42192
42210
  USDZText: Ll,
42193
42211
  USDZUIExtension: iw,
42194
42212
  UsageMarker: du,
42195
42213
  VariantAction: jv,
42196
- VelocityOverLifetimeModule: Ve,
42214
+ VelocityOverLifetimeModule: He,
42197
42215
  VerticalLayoutGroup: Kv,
42198
42216
  VideoPlayer: mt,
42199
42217
  Vignette: Ya,
@@ -42288,7 +42306,7 @@ var ub;
42288
42306
  return t.forEach((a, l) => {
42289
42307
  const c = new y();
42290
42308
  l < t.length - 1 ? c.subVectors(t[l + 1], a).normalize().multiplyScalar(r) : i && t.length > 1 && c.subVectors(t[0], a).normalize().multiplyScalar(r);
42291
- const h = new Ms();
42309
+ const h = new ks();
42292
42310
  h.position.copy(a), h.tangentIn.copy(c), h.tangentOut.copy(c), o.addKnot(h);
42293
42311
  }), o.closed = i, o;
42294
42312
  }
@@ -42404,7 +42422,7 @@ export {
42404
42422
  Au as ChromaticAberration,
42405
42423
  Wi as CircularBuffer,
42406
42424
  la as ClearFlags,
42407
- as as ClipExtrapolation,
42425
+ rs as ClipExtrapolation,
42408
42426
  xi as Collider,
42409
42427
  Mk as Collision,
42410
42428
  Km as CollisionDetectionMode,
@@ -42464,7 +42482,7 @@ export {
42464
42482
  ar as Graphics,
42465
42483
  Lc as GridHelper,
42466
42484
  Jv as GridLayoutGroup,
42467
- Ts as GroundProjectedEnv,
42485
+ Rs as GroundProjectedEnv,
42468
42486
  Zr as GroupActionModel,
42469
42487
  tg as HideFlags,
42470
42488
  nn as HideOnStart,
@@ -42516,7 +42534,7 @@ export {
42516
42534
  JA as NeedleButtonElement,
42517
42535
  S_ as NeedleEngineModelLoader,
42518
42536
  Xw as NeedleEngineWebComponent,
42519
- Is as NeedleMenu,
42537
+ As as NeedleMenu,
42520
42538
  af as NeedlePatchesKey,
42521
42539
  o0 as NeedleXRController,
42522
42540
  K as NeedleXRSession,
@@ -42524,7 +42542,7 @@ export {
42524
42542
  $1 as NeedleXRUtils,
42525
42543
  Ou as NestedGltf,
42526
42544
  E1 as NetworkConnection,
42527
- ms as NetworkedStreamEvents,
42545
+ ps as NetworkedStreamEvents,
42528
42546
  ru as NetworkedStreams,
42529
42547
  ow as Networking,
42530
42548
  cP as NewInstanceModel,
@@ -42583,7 +42601,7 @@ export {
42583
42601
  xd as ReflectionProbe,
42584
42602
  Yo as RegisteredAnimationInfo,
42585
42603
  Fg as RemoteSkybox,
42586
- ps as RenderTexture,
42604
+ fs as RenderTexture,
42587
42605
  ck as RenderTextureSerializer,
42588
42606
  Gi as Renderer,
42589
42607
  dO as RendererData,
@@ -42617,14 +42635,14 @@ export {
42617
42635
  Ra as SpatialGrabRaycaster,
42618
42636
  Hu as SpatialHtml,
42619
42637
  Ug as SpatialTrigger,
42620
- Ss as SpatialTriggerReceiver,
42638
+ xs as SpatialTriggerReceiver,
42621
42639
  Ng as SpectatorCamera,
42622
42640
  Oc as SphereCollider,
42623
42641
  d0 as SphereIntersection,
42624
42642
  Za as SplineContainer,
42625
- Ms as SplineData,
42643
+ ks as SplineData,
42626
42644
  ub as SplineUtils,
42627
- Bs as SplineWalker,
42645
+ js as SplineWalker,
42628
42646
  wo as Sprite,
42629
42647
  Kl as SpriteData,
42630
42648
  Si as SpriteRenderer,
@@ -42645,7 +42663,7 @@ export {
42645
42663
  Yv as TextBuilder,
42646
42664
  Sg as TextExtension,
42647
42665
  Qt as TextureSheetAnimationModule,
42648
- js as TiltShiftEffect,
42666
+ Ds as TiltShiftEffect,
42649
42667
  fO as Time,
42650
42668
  fr as ToneMappingEffect,
42651
42669
  Nu as TrackHandler,
@@ -42661,7 +42679,7 @@ export {
42661
42679
  Tv as USDDocument,
42662
42680
  st as USDObject,
42663
42681
  HM as USDWriter,
42664
- xs as USDZExporter,
42682
+ ws as USDZExporter,
42665
42683
  qM as USDZExporter$1,
42666
42684
  Ll as USDZText,
42667
42685
  iw as USDZUIExtension,
@@ -42670,7 +42688,7 @@ export {
42670
42688
  HI as UserJoinedOrLeftRoomModel,
42671
42689
  An as VERSION,
42672
42690
  jv as VariantAction,
42673
- Ve as VelocityOverLifetimeModule,
42691
+ He as VelocityOverLifetimeModule,
42674
42692
  Kv as VerticalLayoutGroup,
42675
42693
  mt as VideoPlayer,
42676
42694
  tr as ViewDevice,
@@ -42698,7 +42716,7 @@ export {
42698
42716
  sn as XRFlag,
42699
42717
  Yg as XRRig,
42700
42718
  Jt as XRState,
42701
- fs as XRStateFlag,
42719
+ us as XRStateFlag,
42702
42720
  iI as __Ignore,
42703
42721
  K1 as __internalNotifyObjectDestroyed,
42704
42722
  lo as activeInHierarchyFieldName,
@@ -42726,14 +42744,14 @@ export {
42726
42744
  th as debugOwner,
42727
42745
  QM as decompressGpuTexture,
42728
42746
  Vd as deepClone,
42729
- ks as delay,
42747
+ Os as delay,
42730
42748
  Hd as delayForFrames,
42731
42749
  Mp as deserializeObject,
42732
42750
  Vi as destroy,
42733
42751
  zP as destroyComponentInstance,
42734
42752
  tM as determineMimeTypeFromExtension,
42735
42753
  Re as disposeObjectResources,
42736
- gs as disposeStream,
42754
+ ms as disposeStream,
42737
42755
  Ih as editorGuidKeyName,
42738
42756
  ea as enableSpatialConsole,
42739
42757
  fL as euler,
@@ -42778,11 +42796,11 @@ export {
42778
42796
  Z as getWorldPosition,
42779
42797
  be as getWorldQuaternion,
42780
42798
  Rm as getWorldRotation,
42781
- $e as getWorldScale,
42782
- ws as hasCommercialLicense,
42799
+ We as getWorldScale,
42800
+ vs as hasCommercialLicense,
42783
42801
  iu as hasIndieLicense,
42784
42802
  Up as hasPointerEventComponent,
42785
- vs as hasProLicense,
42803
+ bs as hasProLicense,
42786
42804
  n1 as hideDebugConsole,
42787
42805
  ZM as imageToCanvas,
42788
42806
  Pa as instantiate,
@@ -42797,7 +42815,7 @@ export {
42797
42815
  uI as isDebugMode,
42798
42816
  yI as isDesktop,
42799
42817
  Sa as isDestroyed,
42800
- D as isDevEnvironment,
42818
+ L as isDevEnvironment,
42801
42819
  qI as isDisposed,
42802
42820
  ML as isExporting,
42803
42821
  Pk as isGLTFModel,