@needle-tools/engine 5.1.0-experimental.ab2b091 → 5.1.0-experimental.e1fca8a

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 (44) hide show
  1. package/dist/{needle-engine.bundle-BCYyOY9H.min.js → needle-engine.bundle-BVMcIQlw.min.js} +2 -2
  2. package/dist/{needle-engine.bundle-CqUYvUIH.umd.cjs → needle-engine.bundle-DN5GLt_w.umd.cjs} +3 -3
  3. package/dist/{needle-engine.bundle-DM0ePqto.js → needle-engine.bundle-h-83OjVL.js} +9 -9
  4. package/dist/needle-engine.d.ts +6 -6
  5. package/dist/needle-engine.js +226 -226
  6. package/dist/needle-engine.min.js +1 -1
  7. package/dist/needle-engine.umd.cjs +1 -1
  8. package/lib/engine/api.d.ts +1 -1
  9. package/lib/engine/api.js +1 -1
  10. package/lib/engine/api.js.map +1 -1
  11. package/lib/engine/engine_init.js +2 -2
  12. package/lib/engine/engine_init.js.map +1 -1
  13. package/lib/engine/engine_license.d.ts +7 -7
  14. package/lib/engine/engine_license.js +49 -49
  15. package/lib/engine/engine_license.js.map +1 -1
  16. package/lib/engine/engine_networking_blob.js +3 -3
  17. package/lib/engine/engine_networking_blob.js.map +1 -1
  18. package/lib/engine/engine_utils_qrcode.js +2 -2
  19. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  20. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  21. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  22. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  23. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  24. package/lib/engine/webcomponents/needle-engine.js +2 -2
  25. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  26. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  27. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  28. package/lib/engine/xr/TempXRContext.js +2 -2
  29. package/lib/engine/xr/TempXRContext.js.map +1 -1
  30. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  31. package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/engine/api.ts +1 -1
  34. package/src/engine/engine_init.ts +2 -2
  35. package/src/engine/engine_license.ts +47 -47
  36. package/src/engine/engine_networking_blob.ts +3 -3
  37. package/src/engine/engine_utils_qrcode.ts +2 -2
  38. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  39. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  40. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  41. package/src/engine/webcomponents/needle-engine.ts +2 -2
  42. package/src/engine/xr/TempXRContext.ts +2 -2
  43. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  44. package/src/vite-env.d.ts +0 -16
@@ -140,7 +140,7 @@ void main(){
140
140
  #__vconsole .vc-mask {
141
141
  overflow: hidden;
142
142
  }
143
- `,jo?.prepend(i),s===!0&&Rv()<=0&&Yv(),console.log("🌵 Debug console has loaded")}},e.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Ol=!1,ii=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function AC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+s._id+" iframe");return s.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const o=n.indexOf("?");o>-1&&(n=n.substring(0,o));const a=location.protocol+"//"+location.host+location.pathname+"/"+n,l=encodeURIComponent(a);s.fullUrl="https://viewer.needle.tools?inspect&file="+l;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),s.on("show",function(){const t=e();t&&t.src!==s.fullUrl&&(t.src=s.fullUrl)}),s.on("hide",function(){const t=e();t&&(t.src="")}),s.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(s.fullUrl,"_blank"),ii?.hide()}}),i.push({name:"Reload",onClick:function(n){const o=e();o&&(o.src=s.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const o=e();o.requestFullscreen?o.requestFullscreen():o.webkitRequestFullscreen instanceof Function&&o.webkitRequestFullscreen()}}),t(i)}),s}const Yp="padding: 10px; font-family: monospace;",x_="margin-bottom: 10px;",Bo="margin-bottom: 10px; margin-top: 15px;",DC="width: 100%; border-collapse: collapse; border: 1px solid rgba(0,0,0,0.1); table-layout: fixed;",Kv="border: 1px solid rgba(0,0,0,0.1); padding: 5px;",IC=Kv,LC=Kv+" word-break: break-all;";function En(s,e=!1){e&&s.sort((i,n)=>(n.value?1:0)-(i.value?1:0));let t=`<table style='${DC}'>`;t+="<tbody>";for(const i of s){const n=typeof i.value=="boolean"?i.value?"✅":"❌":i.value;t+=`<tr><td style='${IC}'>${i.label}</td><td style='${LC}'>${n}</td></tr>`}return t+="</tbody></table>",t}function Zv(){try{if(document.createElement("canvas").getContext("webgl2"))return"✅"}catch{}return"❌"}function jC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("device-utilities","📱 Device Info");return s.on("renderTab",function(e){let t=`<div style='${Yp}'>`;const i=HC();t+=`<h3 style='${x_}'>Device: ${i}</h3>`,t+=En([{label:"💻 Desktop",value:exports.DeviceUtilities.isDesktop()},{label:"📱 Mobile Device",value:exports.DeviceUtilities.isMobileDevice()},{label:"🍎 iOS",value:exports.DeviceUtilities.isiOS()},{label:"📱 iPad",value:exports.DeviceUtilities.isiPad()},{label:"🤖 Android",value:exports.DeviceUtilities.isAndroidDevice()},{label:"🦊 Mozilla XR",value:exports.DeviceUtilities.isMozillaXR()},{label:"🌵 Needle App Clip",value:exports.DeviceUtilities.isNeedleAppClip()},{label:"🍏 macOS",value:exports.DeviceUtilities.isMacOS()},{label:"👓 VisionOS",value:exports.DeviceUtilities.isVisionOS()},{label:"🧭 Safari",value:exports.DeviceUtilities.isSafari()},{label:"🕶️ Meta Quest",value:exports.DeviceUtilities.isQuest()},{label:"🔗 QuickLook AR Support",value:exports.DeviceUtilities.supportsQuickLookAR()}],!0);const n=[],o=exports.DeviceUtilities.getiOSVersion();o&&n.push({label:"🍎 iOS Version",value:o});const r=exports.DeviceUtilities.getChromeVersion();r&&n.push({label:"🌐 Chrome Version",value:r});const a=exports.DeviceUtilities.getSafariVersion();a&&n.push({label:"🧭 Safari Version",value:a}),n.length>0&&(t+=En(n,!1)),t+="</div>",t+=`<div style='${Yp} margin-top: 20px;'>`,t+=`<h3 style='${x_}'>User Agent Info</h3>`;const l=[{label:"User Agent",value:navigator.userAgent},{label:"Platform",value:navigator.platform},{label:"App Version",value:navigator.appVersion},{label:"User Agent Data",value:navigator.userAgentData?`Platform: ${navigator.userAgentData.platform}, Mobile: ${navigator.userAgentData.mobile}`:"Not supported"},{label:"WebXR",value:"xr"in navigator?"✅":"❌"},{label:"WebGPU",value:"gpu"in navigator?"✅":"❌"},{label:"WebGL 2",value:Zv()}];t+=En(l,!1),t+="</div>",e(t)}),s}function BC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("graphics-info","🎨 Graphics Info");return s.on("renderTab",async function(e){let t=`<div style='${Yp}'>`;const i=FC();i.length>0&&(t+=`<h3 style='${Bo}'>General GPU Info</h3>`,t+=En(i,!1));const n=zC();n.length>0&&(t+=`<h3 style='${Bo}'>WebGL</h3>`,t+=En(n,!1));const o=NC();o.length>0&&(t+=`<h3 style='${Bo}'>WebGL 2 Features</h3>`,t+=En(o,!1));const r=$C();r.length>0&&(t+=`<h3 style='${Bo}'>WebGL Limits</h3>`,t+=En(r,!1));const a=VC();a.length>0&&(t+=`<h3 style='${Bo}'>Texture Formats</h3>`,t+=En(a,!1));const l=await WC();if(l.length>0&&(t+=`<h3 style='${Bo}'>WebGPU</h3>`,t+=En(l,!1)),exports.DeviceUtilities.isSafari()){const h=GC();h.length>0&&(t+=`<h3 style='${Bo}'>Safari GPU Info</h3>`,t+=En(h,!1))}t+="</div>",e(t)}),s}function FC(){const s=[],e=window.devicePixelRatio;s.push({label:"Device Pixel Ratio",value:e.toString()}),s.push({label:"Width (px)",value:(window.innerWidth*e).toString()}),s.push({label:"Height (px)",value:(window.innerHeight*e).toString()});const i=exports.DeviceUtilities.isMobileDevice()?150:96,n=screen.width/i,o=screen.height/i,r=n*2.54,a=o*2.54;s.push({label:"Estimated Width (cm)",value:r.toFixed(1)}),s.push({label:"Estimated Height (cm)",value:a.toFixed(1)});const l=Jv();if(l){s.push({label:"GPU",value:l.renderer}),s.push({label:"Driver",value:l.vendor}),s.push({label:"ANGLE",value:l.angle||"Not detected"});const h=UC(l.renderer);h&&(h.manufacturer&&s.push({label:"Manufacturer",value:h.manufacturer}),h.cardVersion&&s.push({label:"Card Version",value:h.cardVersion}),h.brand&&s.push({label:"Brand",value:h.brand}),s.push({label:"Integrated",value:h.integrated?"Yes":"No"}),h.layer&&s.push({label:"WebGL Layer",value:h.layer}))}return s}function UC(s){if(!s)return null;const e=(h,d)=>{const u=d.match(h);return u&&u[0]},t=e(/(ANGLE)/g,s)||void 0,i=e(/((NVIDIA|AMD|Intel)[^\d]*[^\s]+)/,s)||s,n=i.split(" ");n.shift();const o=e(/(NVIDIA|AMD|Intel)/g,i)||void 0,r=n.length>0?n.pop():void 0,a=n.length>0?n.join(" "):void 0;return{manufacturer:o,cardVersion:r,brand:a,integrated:o==="Intel",layer:t,card:i}}function zC(){const s=[],e=Jv();return e&&(s.push({label:"📊 WebGL Version",value:e.version}),s.push({label:"🎮 WebGL 2 Available",value:Zv()})),s}function NC(){const s=[];try{const t=document.createElement("canvas").getContext("webgl2");if(!t)return s;s.push({label:"Float Color Buffer",value:t.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"Anisotropic Filtering",value:t.getExtension("EXT_texture_filter_anisotropic")?"✅":"❌"}),s.push({label:"Float Texture Linear",value:t.getExtension("OES_texture_float_linear")?"✅":"❌"}),s.push({label:"S3TC Compression",value:t.getExtension("WEBGL_compressed_texture_s3tc")?"✅":"❌"}),s.push({label:"ETC Compression",value:t.getExtension("WEBGL_compressed_texture_etc")?"✅":"❌"}),s.push({label:"PVRTC Compression",value:t.getExtension("WEBGL_compressed_texture_pvrtc")?"✅":"❌"}),s.push({label:"ASTC Compression",value:t.getExtension("WEBGL_compressed_texture_astc")?"✅":"❌"})}catch{}return s}function $C(){const s=[];try{const e=document.createElement("canvas"),t=e.getContext("webgl2")||e.getContext("webgl");if(!t)return s;const i=t instanceof WebGL2RenderingContext;s.push({label:"📏 Max Texture Size",value:t.getParameter(t.MAX_TEXTURE_SIZE).toString()}),s.push({label:"🎨 Max Renderbuffer Size",value:t.getParameter(t.MAX_RENDERBUFFER_SIZE).toString()}),s.push({label:"🔗 Max Vertex Attribs",value:t.getParameter(t.MAX_VERTEX_ATTRIBS).toString()}),s.push({label:"🎯 Max Texture Units",value:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS).toString()}),i&&(s.push({label:"⚡ Max Samples",value:t.getParameter(t.MAX_SAMPLES).toString()}),s.push({label:"🔄 Max Uniform Buffer Bindings",value:t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS).toString()}),s.push({label:"📐 Max 3D Texture Size",value:t.getParameter(t.MAX_3D_TEXTURE_SIZE).toString()}))}catch{}return s}function VC(){const s=[];try{document.createElement("canvas").getContext("webgl")&&(s.push({label:"WebGL 1 RGBA",value:"✅"}),s.push({label:"WebGL 1 RGB",value:"✅"}));const n=document.createElement("canvas").getContext("webgl2");n&&(s.push({label:"WebGL 2 RGBA32F",value:n.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"WebGL 2 RGB32F",value:n.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"WebGL 2 R11F_G11F_B10F",value:"✅"}),s.push({label:"WebGL 2 RGB565",value:"✅"}),s.push({label:"WebGL 2 RGB5_A1",value:"✅"}),s.push({label:"WebGL 2 RGBA4444",value:"✅"}))}catch{}return s}async function WC(){const s=[];if(!("gpu"in navigator))return s.push({label:"🚀 WebGPU Support",value:"❌ Not supported"}),s;s.push({label:"🚀 WebGPU Support",value:"✅ Supported"});try{const e=await navigator.gpu.requestAdapter();if(!e)return s.push({label:"🎯 Adapter",value:"No adapter available"}),s;s.push({label:"🎯 Adapter",value:e.name||"Unknown Adapter"});const t=await e.requestDevice();s.push({label:"🔧 Device",value:t.label||"WebGPU Device"}),s.push({label:"📏 Max Texture 2D",value:t.limits.maxTextureDimension2D.toString()}),s.push({label:"📐 Max Texture 3D",value:t.limits.maxTextureDimension3D.toString()}),s.push({label:"📊 Max Texture Array Layers",value:t.limits.maxTextureArrayLayers.toString()}),s.push({label:"💾 Max Buffer Size",value:`${(t.limits.maxBufferSize/1024/1024).toFixed(1)}MB`}),s.push({label:"🔗 Max Bind Groups",value:t.limits.maxBindGroups.toString()})}catch(e){s.push({label:"❌ Error",value:e.message})}return s}function Jv(){try{const s=document.createElement("canvas"),e=s.getContext("webgl2")||s.getContext("webgl");if(!e)return null;const t=e.getExtension("WEBGL_debug_renderer_info"),i=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER),n=t?e.getParameter(t.UNMASKED_VENDOR_WEBGL):e.getParameter(e.VENDOR),o=e.getParameter(e.VERSION);let r;if(i&&i.includes("ANGLE")){const a=i.match(/ANGLE \(([^)]+)\)/);a&&(r=a[1])}return{renderer:i,vendor:n,version:o,angle:r}}catch{return null}}function GC(){const s=[];try{const t=document.createElement("canvas").getContext("webgl");if(t){const i=t.getExtension("WEBGL_debug_renderer_info");if(i){const n=t.getParameter(i.UNMASKED_RENDERER_WEBGL);n&&n.includes("Apple")&&s.push({label:"🍎 Apple GPU",value:n})}}}catch{}try{const t=document.createElement("canvas").getContext("webgl");t&&(t.getSupportedExtensions()||[]).includes("WEBGL_compressed_texture_pvrtc")&&s.push({label:"🗜️ PVRTC Support",value:"✅"})}catch{}return s}function HC(){return exports.DeviceUtilities.isQuest()?"Meta Quest":exports.DeviceUtilities.isVisionOS()?"Vision Pro":exports.DeviceUtilities.isiOS()?exports.DeviceUtilities.isiPad()?"iPad":"iPhone/iPod":exports.DeviceUtilities.isAndroidDevice()?"Android Device":exports.DeviceUtilities.isMozillaXR()?"Mozilla XR Browser":exports.DeviceUtilities.isNeedleAppClip()?"Needle App Clip":exports.DeviceUtilities.isMacOS()?"Mac":exports.DeviceUtilities.isDesktop()?"Desktop PC":"Unknown Device"}function qC(){const s=document.querySelector("#__vconsole .vc-switch");return s||null}function XC(){const s=document.querySelector("#__vconsole");return s||null}const Fh=x("debugtypes");class QC{_types=new Map;_reverseTypes=new Map;_lazyLoaders=new Map;constructor(){Fh&&console.warn("TypeStore: Created",this)}add(e,t){Fh&&console.warn("ADD TYPE",e);const i=this._types.get(e);i?Fh&&i!==t&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",e):(this._types.set(e,t),this._reverseTypes.set(t,e))}addLazy(e,t){this._types.has(e)||this._lazyLoaders.set(e,t)}get(e){return this._types.get(e)||null}async getAsync(e){const t=this._types.get(e);if(t)return t;const i=this._lazyLoaders.get(e);if(i){Fh&&console.warn("LAZY LOAD TYPE",e);const n=await i();return this.add(e,n),this._lazyLoaders.delete(e),n}return null}getKey(e){return this._reverseTypes.get(e)||null}}const YC=Symbol("BuiltInType"),P=new QC,cg=function(s){P.get(s.name)||P.add(s.name,s)};class KC{context;mixers=[];constructor(e){this.context=e}onDestroy(){this.mixers.forEach(e=>e.stopAllAction()),this.mixers.length=0}registerAnimationMixer(e){if(!e){console.warn("AnimationsRegistry.registerAnimationMixer called with null or undefined mixer");return}this.mixers.includes(e)||this.mixers.push(e)}unregisterAnimationMixer(e){if(!e){console.warn("AnimationsRegistry.unregisterAnimationMixer called with null or undefined mixer");return}const t=this.mixers.indexOf(e);t!==-1&&this.mixers.splice(t,1)}}exports.AnimationUtils=void 0;(s=>{function e(d,u){const f=d.getRoot();return f&&(f.userData.static||f.matrixAutoUpdate===!1||f.matrixWorldAutoUpdate===!1)?((u===!0||u===void 0&&T())&&console.warn(`AnimationUtils: The root object (${f.name||f.type}) of this AnimationAction has matrixAutoUpdate or matrixWorldAutoUpdate set to false. This may prevent the animation from working correctly. If the object is marked as static, try to change it to dynamic.`,{static:f.userData.static,name:f.userData.name,tag:f.userData.tag,matrixAutoUpdate:f.matrixAutoUpdate,matrixWorldAutoUpdate:f.matrixWorldAutoUpdate}),!1):!0}s.testIfRootCanAnimate=e;function t(d){const u=d._actions;return u||null}s.tryGetActionsFromMixer=t;function i(d,u){if(u||(u=new Array),d)d.animations&&u.push(...d.animations);else return u;if(d.children)for(const f of d.children)i(f,u);return u}s.tryGetAnimationClipsFromObjectHierarchy=i;const n=Symbol("objectIsAnimatedData");function o(d,u,f){if(!d)return;if(d[n]===void 0){if(!f)return;d[n]=new Set}const m=d[n];f?m.add(u):m.has(u)&&m.delete(u)}s.setObjectAnimated=o;function r(d){if(!d)return!1;const u=d[n];return u!==void 0&&u.size>0}s.getObjectAnimated=r;function a(d){if(!d||!d.animations)return console.debug("No animations found in file"),null;const u="scene"in d?d.scene:d,f=new Array;for(let g=0;g<d.animations.length;g++){const b=d.animations[g];if(!b.tracks||b.tracks.length<=0){console.warn("Animation has no tracks");continue}for(const y in b.tracks){const _=b.tracks[y],v=c.PropertyBinding.parseTrackName(_.name);let w=c.PropertyBinding.findNode(u,v.nodeName);if(!w){const k=_.__objectName??_.name.substring(0,_.name.indexOf("."));if(w=u.getObjectByProperty("uuid",k),!w)continue}let M=m(w)||m(u);if(!M){const k=P.get("Animation");if(M=u.addComponent(k),!M){console.error("Failed creating Animation component: No 'Animation' component found in TypeStore");break}}f.push(M),M.addClip&&M.addClip(b)}}return f;function m(g){if(!g)return null;const b=g.userData?.components;if(b&&b.length>0)for(let y=0;y<b.length;y++){const _=b[y];if(_.isAnimationComponent===!0)return _}return m(g.parent)}}s.autoplayAnimations=a;function l(){return new c.AnimationClip("empty",0,[])}s.emptyClip=l;function h(d){const u=d?.duration??.3;let f={x:1,y:1,z:1};d?.scale!==void 0&&(typeof d.scale=="number"?f={x:d.scale,y:d.scale,z:d.scale}:f=d.scale);const m=d?.type??"linear",g=d?.scaleFactor??1.2,b=new Array,y=new Array;switch(m){case"linear":b.push(0,u),y.push(f.x,f.y,f.z,f.x*g,f.y*g,f.z*g);break;case"spring":b.push(0,u*.3,u*.5,u*.7,u*.9,u),y.push(f.x,f.y,f.z,f.x*g,f.y*g,f.z*g,f.x*.9,f.y*.9,f.z*.9,f.x*1.05,f.y*1.05,f.z*1.05,f.x*.98,f.y*.98,f.z*.98,f.x,f.y,f.z);break}const _=new c.KeyframeTrack(".scale",b,y);return new c.AnimationClip("scale",b[b.length-1],[_])}s.createScaleClip=h})(exports.AnimationUtils||(exports.AnimationUtils={}));const Be=function(s){return p(s)},p=function(s){if(s===void 0&&(s=null),!Array.isArray(s))s=S_(s);else for(let e=0;e<s.length;e++){const t=s[e];s[e]=S_(t)}return function(e,t){if(!e){const n=typeof t=="string"?t:t.name;console.warn(`@serializable without a target at '${n}'.`);return}typeof t!="string"&&(t=t.name),Object.getOwnPropertyDescriptor(e,"$serializedTypes")||(e.$serializedTypes={});const i=e.$serializedTypes=e.$serializedTypes||{};i[t]=s}};function S_(s){switch(s?.prototype?.constructor?.name){case"Number":case"String":case"Boolean":return null}return s}const C_=x("debugcomponentevents");class Pu{static eventListeners=new Map;static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let i=this.eventListeners.get(e);i||(i=[]),i.push(t),this.eventListeners.set(e,i),C_&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const i=this.eventListeners.get(e);if(!i)return;const n=i.indexOf(t);n<0||i.splice(n,1)}static dispatchComponentLifecycleEvent(e,t){const i=this.eventListeners.get(e);if(C_&&console.log("Dispatching event "+e,i),!!i)for(const n of i)n(t)}}const e0=x("debugdefines");bo('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');bo('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');bo('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');bo('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');bo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "5.1.0-alpha.5";');bo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');bo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 08 2026 11:31:15 GMT+0000 (Coordinated Universal Time)";');bo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const li="5.1.0-alpha.5",Aa="undefined",xc="Fri May 08 2026 11:31:15 GMT+0000 (Coordinated Universal Time)";e0&&console.log(`Engine version: ${li} (generator: ${Aa})
143
+ `,jo?.prepend(i),s===!0&&Rv()<=0&&Yv(),console.log("🌵 Debug console has loaded")}},e.onerror=()=>{console.warn("🌵 Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Ol=!1,ii=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function AC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("needle-console","🌵 Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+s._id+" iframe");return s.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const o=n.indexOf("?");o>-1&&(n=n.substring(0,o));const a=location.protocol+"//"+location.host+location.pathname+"/"+n,l=encodeURIComponent(a);s.fullUrl="https://viewer.needle.tools?inspect&file="+l;var h='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(h)}),s.on("show",function(){const t=e();t&&t.src!==s.fullUrl&&(t.src=s.fullUrl)}),s.on("hide",function(){const t=e();t&&(t.src="")}),s.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window ↗",onClick:function(n){window.open(s.fullUrl,"_blank"),ii?.hide()}}),i.push({name:"Reload",onClick:function(n){const o=e();o&&(o.src=s.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const o=e();o.requestFullscreen?o.requestFullscreen():o.webkitRequestFullscreen instanceof Function&&o.webkitRequestFullscreen()}}),t(i)}),s}const Yp="padding: 10px; font-family: monospace;",x_="margin-bottom: 10px;",Bo="margin-bottom: 10px; margin-top: 15px;",DC="width: 100%; border-collapse: collapse; border: 1px solid rgba(0,0,0,0.1); table-layout: fixed;",Kv="border: 1px solid rgba(0,0,0,0.1); padding: 5px;",IC=Kv,LC=Kv+" word-break: break-all;";function En(s,e=!1){e&&s.sort((i,n)=>(n.value?1:0)-(i.value?1:0));let t=`<table style='${DC}'>`;t+="<tbody>";for(const i of s){const n=typeof i.value=="boolean"?i.value?"✅":"❌":i.value;t+=`<tr><td style='${IC}'>${i.label}</td><td style='${LC}'>${n}</td></tr>`}return t+="</tbody></table>",t}function Zv(){try{if(document.createElement("canvas").getContext("webgl2"))return"✅"}catch{}return"❌"}function jC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("device-utilities","📱 Device Info");return s.on("renderTab",function(e){let t=`<div style='${Yp}'>`;const i=HC();t+=`<h3 style='${x_}'>Device: ${i}</h3>`,t+=En([{label:"💻 Desktop",value:exports.DeviceUtilities.isDesktop()},{label:"📱 Mobile Device",value:exports.DeviceUtilities.isMobileDevice()},{label:"🍎 iOS",value:exports.DeviceUtilities.isiOS()},{label:"📱 iPad",value:exports.DeviceUtilities.isiPad()},{label:"🤖 Android",value:exports.DeviceUtilities.isAndroidDevice()},{label:"🦊 Mozilla XR",value:exports.DeviceUtilities.isMozillaXR()},{label:"🌵 Needle App Clip",value:exports.DeviceUtilities.isNeedleAppClip()},{label:"🍏 macOS",value:exports.DeviceUtilities.isMacOS()},{label:"👓 VisionOS",value:exports.DeviceUtilities.isVisionOS()},{label:"🧭 Safari",value:exports.DeviceUtilities.isSafari()},{label:"🕶️ Meta Quest",value:exports.DeviceUtilities.isQuest()},{label:"🔗 QuickLook AR Support",value:exports.DeviceUtilities.supportsQuickLookAR()}],!0);const n=[],o=exports.DeviceUtilities.getiOSVersion();o&&n.push({label:"🍎 iOS Version",value:o});const r=exports.DeviceUtilities.getChromeVersion();r&&n.push({label:"🌐 Chrome Version",value:r});const a=exports.DeviceUtilities.getSafariVersion();a&&n.push({label:"🧭 Safari Version",value:a}),n.length>0&&(t+=En(n,!1)),t+="</div>",t+=`<div style='${Yp} margin-top: 20px;'>`,t+=`<h3 style='${x_}'>User Agent Info</h3>`;const l=[{label:"User Agent",value:navigator.userAgent},{label:"Platform",value:navigator.platform},{label:"App Version",value:navigator.appVersion},{label:"User Agent Data",value:navigator.userAgentData?`Platform: ${navigator.userAgentData.platform}, Mobile: ${navigator.userAgentData.mobile}`:"Not supported"},{label:"WebXR",value:"xr"in navigator?"✅":"❌"},{label:"WebGPU",value:"gpu"in navigator?"✅":"❌"},{label:"WebGL 2",value:Zv()}];t+=En(l,!1),t+="</div>",e(t)}),s}function BC(){if(!globalThis.VConsole)return;const s=new VConsole.VConsolePlugin("graphics-info","🎨 Graphics Info");return s.on("renderTab",async function(e){let t=`<div style='${Yp}'>`;const i=FC();i.length>0&&(t+=`<h3 style='${Bo}'>General GPU Info</h3>`,t+=En(i,!1));const n=zC();n.length>0&&(t+=`<h3 style='${Bo}'>WebGL</h3>`,t+=En(n,!1));const o=NC();o.length>0&&(t+=`<h3 style='${Bo}'>WebGL 2 Features</h3>`,t+=En(o,!1));const r=$C();r.length>0&&(t+=`<h3 style='${Bo}'>WebGL Limits</h3>`,t+=En(r,!1));const a=VC();a.length>0&&(t+=`<h3 style='${Bo}'>Texture Formats</h3>`,t+=En(a,!1));const l=await WC();if(l.length>0&&(t+=`<h3 style='${Bo}'>WebGPU</h3>`,t+=En(l,!1)),exports.DeviceUtilities.isSafari()){const h=GC();h.length>0&&(t+=`<h3 style='${Bo}'>Safari GPU Info</h3>`,t+=En(h,!1))}t+="</div>",e(t)}),s}function FC(){const s=[],e=window.devicePixelRatio;s.push({label:"Device Pixel Ratio",value:e.toString()}),s.push({label:"Width (px)",value:(window.innerWidth*e).toString()}),s.push({label:"Height (px)",value:(window.innerHeight*e).toString()});const i=exports.DeviceUtilities.isMobileDevice()?150:96,n=screen.width/i,o=screen.height/i,r=n*2.54,a=o*2.54;s.push({label:"Estimated Width (cm)",value:r.toFixed(1)}),s.push({label:"Estimated Height (cm)",value:a.toFixed(1)});const l=Jv();if(l){s.push({label:"GPU",value:l.renderer}),s.push({label:"Driver",value:l.vendor}),s.push({label:"ANGLE",value:l.angle||"Not detected"});const h=UC(l.renderer);h&&(h.manufacturer&&s.push({label:"Manufacturer",value:h.manufacturer}),h.cardVersion&&s.push({label:"Card Version",value:h.cardVersion}),h.brand&&s.push({label:"Brand",value:h.brand}),s.push({label:"Integrated",value:h.integrated?"Yes":"No"}),h.layer&&s.push({label:"WebGL Layer",value:h.layer}))}return s}function UC(s){if(!s)return null;const e=(h,d)=>{const u=d.match(h);return u&&u[0]},t=e(/(ANGLE)/g,s)||void 0,i=e(/((NVIDIA|AMD|Intel)[^\d]*[^\s]+)/,s)||s,n=i.split(" ");n.shift();const o=e(/(NVIDIA|AMD|Intel)/g,i)||void 0,r=n.length>0?n.pop():void 0,a=n.length>0?n.join(" "):void 0;return{manufacturer:o,cardVersion:r,brand:a,integrated:o==="Intel",layer:t,card:i}}function zC(){const s=[],e=Jv();return e&&(s.push({label:"📊 WebGL Version",value:e.version}),s.push({label:"🎮 WebGL 2 Available",value:Zv()})),s}function NC(){const s=[];try{const t=document.createElement("canvas").getContext("webgl2");if(!t)return s;s.push({label:"Float Color Buffer",value:t.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"Anisotropic Filtering",value:t.getExtension("EXT_texture_filter_anisotropic")?"✅":"❌"}),s.push({label:"Float Texture Linear",value:t.getExtension("OES_texture_float_linear")?"✅":"❌"}),s.push({label:"S3TC Compression",value:t.getExtension("WEBGL_compressed_texture_s3tc")?"✅":"❌"}),s.push({label:"ETC Compression",value:t.getExtension("WEBGL_compressed_texture_etc")?"✅":"❌"}),s.push({label:"PVRTC Compression",value:t.getExtension("WEBGL_compressed_texture_pvrtc")?"✅":"❌"}),s.push({label:"ASTC Compression",value:t.getExtension("WEBGL_compressed_texture_astc")?"✅":"❌"})}catch{}return s}function $C(){const s=[];try{const e=document.createElement("canvas"),t=e.getContext("webgl2")||e.getContext("webgl");if(!t)return s;const i=t instanceof WebGL2RenderingContext;s.push({label:"📏 Max Texture Size",value:t.getParameter(t.MAX_TEXTURE_SIZE).toString()}),s.push({label:"🎨 Max Renderbuffer Size",value:t.getParameter(t.MAX_RENDERBUFFER_SIZE).toString()}),s.push({label:"🔗 Max Vertex Attribs",value:t.getParameter(t.MAX_VERTEX_ATTRIBS).toString()}),s.push({label:"🎯 Max Texture Units",value:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS).toString()}),i&&(s.push({label:"⚡ Max Samples",value:t.getParameter(t.MAX_SAMPLES).toString()}),s.push({label:"🔄 Max Uniform Buffer Bindings",value:t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS).toString()}),s.push({label:"📐 Max 3D Texture Size",value:t.getParameter(t.MAX_3D_TEXTURE_SIZE).toString()}))}catch{}return s}function VC(){const s=[];try{document.createElement("canvas").getContext("webgl")&&(s.push({label:"WebGL 1 RGBA",value:"✅"}),s.push({label:"WebGL 1 RGB",value:"✅"}));const n=document.createElement("canvas").getContext("webgl2");n&&(s.push({label:"WebGL 2 RGBA32F",value:n.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"WebGL 2 RGB32F",value:n.getExtension("EXT_color_buffer_float")?"✅":"❌"}),s.push({label:"WebGL 2 R11F_G11F_B10F",value:"✅"}),s.push({label:"WebGL 2 RGB565",value:"✅"}),s.push({label:"WebGL 2 RGB5_A1",value:"✅"}),s.push({label:"WebGL 2 RGBA4444",value:"✅"}))}catch{}return s}async function WC(){const s=[];if(!("gpu"in navigator))return s.push({label:"🚀 WebGPU Support",value:"❌ Not supported"}),s;s.push({label:"🚀 WebGPU Support",value:"✅ Supported"});try{const e=await navigator.gpu.requestAdapter();if(!e)return s.push({label:"🎯 Adapter",value:"No adapter available"}),s;s.push({label:"🎯 Adapter",value:e.name||"Unknown Adapter"});const t=await e.requestDevice();s.push({label:"🔧 Device",value:t.label||"WebGPU Device"}),s.push({label:"📏 Max Texture 2D",value:t.limits.maxTextureDimension2D.toString()}),s.push({label:"📐 Max Texture 3D",value:t.limits.maxTextureDimension3D.toString()}),s.push({label:"📊 Max Texture Array Layers",value:t.limits.maxTextureArrayLayers.toString()}),s.push({label:"💾 Max Buffer Size",value:`${(t.limits.maxBufferSize/1024/1024).toFixed(1)}MB`}),s.push({label:"🔗 Max Bind Groups",value:t.limits.maxBindGroups.toString()})}catch(e){s.push({label:"❌ Error",value:e.message})}return s}function Jv(){try{const s=document.createElement("canvas"),e=s.getContext("webgl2")||s.getContext("webgl");if(!e)return null;const t=e.getExtension("WEBGL_debug_renderer_info"),i=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER),n=t?e.getParameter(t.UNMASKED_VENDOR_WEBGL):e.getParameter(e.VENDOR),o=e.getParameter(e.VERSION);let r;if(i&&i.includes("ANGLE")){const a=i.match(/ANGLE \(([^)]+)\)/);a&&(r=a[1])}return{renderer:i,vendor:n,version:o,angle:r}}catch{return null}}function GC(){const s=[];try{const t=document.createElement("canvas").getContext("webgl");if(t){const i=t.getExtension("WEBGL_debug_renderer_info");if(i){const n=t.getParameter(i.UNMASKED_RENDERER_WEBGL);n&&n.includes("Apple")&&s.push({label:"🍎 Apple GPU",value:n})}}}catch{}try{const t=document.createElement("canvas").getContext("webgl");t&&(t.getSupportedExtensions()||[]).includes("WEBGL_compressed_texture_pvrtc")&&s.push({label:"🗜️ PVRTC Support",value:"✅"})}catch{}return s}function HC(){return exports.DeviceUtilities.isQuest()?"Meta Quest":exports.DeviceUtilities.isVisionOS()?"Vision Pro":exports.DeviceUtilities.isiOS()?exports.DeviceUtilities.isiPad()?"iPad":"iPhone/iPod":exports.DeviceUtilities.isAndroidDevice()?"Android Device":exports.DeviceUtilities.isMozillaXR()?"Mozilla XR Browser":exports.DeviceUtilities.isNeedleAppClip()?"Needle App Clip":exports.DeviceUtilities.isMacOS()?"Mac":exports.DeviceUtilities.isDesktop()?"Desktop PC":"Unknown Device"}function qC(){const s=document.querySelector("#__vconsole .vc-switch");return s||null}function XC(){const s=document.querySelector("#__vconsole");return s||null}const Fh=x("debugtypes");class QC{_types=new Map;_reverseTypes=new Map;_lazyLoaders=new Map;constructor(){Fh&&console.warn("TypeStore: Created",this)}add(e,t){Fh&&console.warn("ADD TYPE",e);const i=this._types.get(e);i?Fh&&i!==t&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",e):(this._types.set(e,t),this._reverseTypes.set(t,e))}addLazy(e,t){this._types.has(e)||this._lazyLoaders.set(e,t)}get(e){return this._types.get(e)||null}async getAsync(e){const t=this._types.get(e);if(t)return t;const i=this._lazyLoaders.get(e);if(i){Fh&&console.warn("LAZY LOAD TYPE",e);const n=await i();return this.add(e,n),this._lazyLoaders.delete(e),n}return null}getKey(e){return this._reverseTypes.get(e)||null}}const YC=Symbol("BuiltInType"),P=new QC,cg=function(s){P.get(s.name)||P.add(s.name,s)};class KC{context;mixers=[];constructor(e){this.context=e}onDestroy(){this.mixers.forEach(e=>e.stopAllAction()),this.mixers.length=0}registerAnimationMixer(e){if(!e){console.warn("AnimationsRegistry.registerAnimationMixer called with null or undefined mixer");return}this.mixers.includes(e)||this.mixers.push(e)}unregisterAnimationMixer(e){if(!e){console.warn("AnimationsRegistry.unregisterAnimationMixer called with null or undefined mixer");return}const t=this.mixers.indexOf(e);t!==-1&&this.mixers.splice(t,1)}}exports.AnimationUtils=void 0;(s=>{function e(d,u){const f=d.getRoot();return f&&(f.userData.static||f.matrixAutoUpdate===!1||f.matrixWorldAutoUpdate===!1)?((u===!0||u===void 0&&T())&&console.warn(`AnimationUtils: The root object (${f.name||f.type}) of this AnimationAction has matrixAutoUpdate or matrixWorldAutoUpdate set to false. This may prevent the animation from working correctly. If the object is marked as static, try to change it to dynamic.`,{static:f.userData.static,name:f.userData.name,tag:f.userData.tag,matrixAutoUpdate:f.matrixAutoUpdate,matrixWorldAutoUpdate:f.matrixWorldAutoUpdate}),!1):!0}s.testIfRootCanAnimate=e;function t(d){const u=d._actions;return u||null}s.tryGetActionsFromMixer=t;function i(d,u){if(u||(u=new Array),d)d.animations&&u.push(...d.animations);else return u;if(d.children)for(const f of d.children)i(f,u);return u}s.tryGetAnimationClipsFromObjectHierarchy=i;const n=Symbol("objectIsAnimatedData");function o(d,u,f){if(!d)return;if(d[n]===void 0){if(!f)return;d[n]=new Set}const m=d[n];f?m.add(u):m.has(u)&&m.delete(u)}s.setObjectAnimated=o;function r(d){if(!d)return!1;const u=d[n];return u!==void 0&&u.size>0}s.getObjectAnimated=r;function a(d){if(!d||!d.animations)return console.debug("No animations found in file"),null;const u="scene"in d?d.scene:d,f=new Array;for(let g=0;g<d.animations.length;g++){const b=d.animations[g];if(!b.tracks||b.tracks.length<=0){console.warn("Animation has no tracks");continue}for(const y in b.tracks){const _=b.tracks[y],v=c.PropertyBinding.parseTrackName(_.name);let w=c.PropertyBinding.findNode(u,v.nodeName);if(!w){const k=_.__objectName??_.name.substring(0,_.name.indexOf("."));if(w=u.getObjectByProperty("uuid",k),!w)continue}let M=m(w)||m(u);if(!M){const k=P.get("Animation");if(M=u.addComponent(k),!M){console.error("Failed creating Animation component: No 'Animation' component found in TypeStore");break}}f.push(M),M.addClip&&M.addClip(b)}}return f;function m(g){if(!g)return null;const b=g.userData?.components;if(b&&b.length>0)for(let y=0;y<b.length;y++){const _=b[y];if(_.isAnimationComponent===!0)return _}return m(g.parent)}}s.autoplayAnimations=a;function l(){return new c.AnimationClip("empty",0,[])}s.emptyClip=l;function h(d){const u=d?.duration??.3;let f={x:1,y:1,z:1};d?.scale!==void 0&&(typeof d.scale=="number"?f={x:d.scale,y:d.scale,z:d.scale}:f=d.scale);const m=d?.type??"linear",g=d?.scaleFactor??1.2,b=new Array,y=new Array;switch(m){case"linear":b.push(0,u),y.push(f.x,f.y,f.z,f.x*g,f.y*g,f.z*g);break;case"spring":b.push(0,u*.3,u*.5,u*.7,u*.9,u),y.push(f.x,f.y,f.z,f.x*g,f.y*g,f.z*g,f.x*.9,f.y*.9,f.z*.9,f.x*1.05,f.y*1.05,f.z*1.05,f.x*.98,f.y*.98,f.z*.98,f.x,f.y,f.z);break}const _=new c.KeyframeTrack(".scale",b,y);return new c.AnimationClip("scale",b[b.length-1],[_])}s.createScaleClip=h})(exports.AnimationUtils||(exports.AnimationUtils={}));const Be=function(s){return p(s)},p=function(s){if(s===void 0&&(s=null),!Array.isArray(s))s=S_(s);else for(let e=0;e<s.length;e++){const t=s[e];s[e]=S_(t)}return function(e,t){if(!e){const n=typeof t=="string"?t:t.name;console.warn(`@serializable without a target at '${n}'.`);return}typeof t!="string"&&(t=t.name),Object.getOwnPropertyDescriptor(e,"$serializedTypes")||(e.$serializedTypes={});const i=e.$serializedTypes=e.$serializedTypes||{};i[t]=s}};function S_(s){switch(s?.prototype?.constructor?.name){case"Number":case"String":case"Boolean":return null}return s}const C_=x("debugcomponentevents");class Pu{static eventListeners=new Map;static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let i=this.eventListeners.get(e);i||(i=[]),i.push(t),this.eventListeners.set(e,i),C_&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const i=this.eventListeners.get(e);if(!i)return;const n=i.indexOf(t);n<0||i.splice(n,1)}static dispatchComponentLifecycleEvent(e,t){const i=this.eventListeners.get(e);if(C_&&console.log("Dispatching event "+e,i),!!i)for(const n of i)n(t)}}const e0=x("debugdefines");bo('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";');bo('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";');bo('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";');bo('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');bo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "5.1.0-alpha.5";');bo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');bo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 08 2026 11:49:38 GMT+0000 (Coordinated Universal Time)";');bo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const li="5.1.0-alpha.5",Aa="undefined",xc="Fri May 08 2026 11:49:38 GMT+0000 (Coordinated Universal Time)";e0&&console.log(`Engine version: ${li} (generator: ${Aa})
144
144
  Project built at ${xc}`);const oo=NEEDLE_PUBLIC_KEY,jn="needle_isActiveInHierarchy",Xo="builtin_components",oc="needle_editor_guid";function bo(s){try{(0,eval)(s)}catch(e){e0&&console.error(e)}}globalThis.NEEDLE_USE_RAPIER=globalThis.NEEDLE_USE_RAPIER!==void 0?globalThis.NEEDLE_USE_RAPIER:!0;globalThis.NEEDLE_USE_POSTPROCESSING=globalThis.NEEDLE_USE_POSTPROCESSING!==void 0?globalThis.NEEDLE_USE_POSTPROCESSING:!0;const hg={experimentalSmartHierarchyUpdate:!1},yi=Symbol("shadowDomOwner"),ZC=x("debugpatch");function ku(s,e,t,i){const n=ZC===e;if(!t&&!i)return;const o=e+"___needle";e1(s,e,t,i);const r=Object.getOwnPropertyDescriptor(s,e),a=s[e];n&&console.log("Patch",s.constructor.name,e,r,a),r?(n&&console.log("Apply patch with existing descriptor",s.constructor.name,e,r),typeof r.value=="function"&&(s[e]=k_(r.value,s,e))):(n&&console.log("Create patch with new property",s.constructor.name,e,r),Object.defineProperty(s,e,{set:function(l){if(typeof l=="function")this[o]=k_(l,s,e);else{const h=this[o];t0(s,e,this,h,l),this[o]=l,i0(s,e,this,h,l)}},get:function(){const l=this[o];return typeof l=="function"&&l[o]?l[o]:l}}))}function JC(s,e,t){const i=dg(s,e);if(i)for(let n=i.length-1;n>=0;n--){const o=i[n];o.prefix===t&&(o.prefix=null),o.postfix===t&&(o.postfix=null),!o.prefix&&!o.postfix&&i.splice(n,1)}}const P_=Symbol("Needle:Patches:WrappedFunction");function k_(s,e,t){if(s[P_])return s;const i=function(...n){t0(e,t,this,...n);const o=s.apply(this,n);return i0(e,t,this,o,...n),o};return i[P_]=!0,i}const xd="Needle:Patches";function Kp(){return globalThis[xd]||(globalThis[xd]=new WeakMap),globalThis[xd]}function dg(s,e){const t=Kp().get(s);return t?t.get(e):null}function e1(s,e,t,i){let n=Kp().get(s);n||(n=new Map,Kp().set(s,n));let o=n.get(e);o||(o=[],n.set(e,o)),o.push({prefix:t,postfix:i})}function t0(s,e,t,...i){if(!t)return;const n=dg(s,e);if(n)for(const o of n)o.prefix?.call(t,...i)}function i0(s,e,t,i,...n){if(!t)return;const o=dg(s,e);if(o)for(const r of o)r.postfix?.call(t,i,...n)}function t1(s,e){if(typeof window!==void 0&&window.SPECTOR){console.log(window.SPECTOR);const t=new URLSearchParams(window.location.search);if(t.has("spector")){let i=function(){if(n>s.time.frame)return window.requestAnimationFrame(()=>i());const r=o.captureCanvas(e);r&&r instanceof Promise?r.then(()=>o.displayUI()):o.displayUI()};const n=Number.parseInt(t.get("spector")||"0")||0;console.log("Scheduled Spector capture at frame #"+n);const o=new window.SPECTOR.Spector;o.spyCanvases=!0,i();return}else T()&&console.debug("Spector available: Add '?spector=<frame>' to the URL to enable it and capture a frame.")}}function n0(s){const e=s;return!!(e.parser&&e.parser.json)}var Ou=(s=>(s[s.None=0]="None",s[s.DontExport=1]="DontExport",s))(Ou||{});const Qd=Symbol("component-name");function Mu(s){return s&&typeof s=="object"&&s.isComponent}const i1=Symbol("object"),Vf=new wi(()=>new c.Vector3,20);class s0{_point;_normal;_tangentVelocity;distance;impulse;friction;get point(){return Vf.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return Vf.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return Vf.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}constructor(e,t,i,n,o,r){this._point=e,this.distance=t,this._normal=i,this.impulse=n,this.friction=o,this._tangentVelocity=r}}class o0{contacts;constructor(e,t,i){this.me=e,this._collider=t,this._gameObject=t.gameObject,this.contacts=i}me;_collider;get collider(){return this._collider}_gameObject;get gameObject(){return this._gameObject}get rigidBody(){return this.collider?.attachedRigidbody}}class r0{object;collider;constructor(e,t){this.object=e,this.collider=t}}class Yd{constructor(e){this.context=e,this.root.style.cssText=`
145
145
  position: absolute;
146
146
  width: 1px; height: 1px;
@@ -879,7 +879,7 @@ Possible solutions:
879
879
  `,i),this._renderlooperrors>=3&&(console.warn("Stopping render loop due to error"),this.renderer.setAnimationLoop(null),Xt.sendError(U.Current,"renderloop",i instanceof Error?i:new Error(String(i)))),this.domElement.dispatchEvent(new CustomEvent("error",{detail:i}))}else this.internalStep(e,t)}updatePhysics(e){this.internalUpdatePhysics(e)}setCameraFocusRect(e,t){const i=this._focusRect;if(this._focusRect=e,t&&Object.assign(this.focusRectSettings,t),t?.damping===void 0&&i){let n=i;i instanceof HTMLElement&&(n=i.getBoundingClientRect()),n&&"top"in n&&n.bottom>=-100&&n.right>=-100&&n.top<=window.innerHeight+100&&n.left<=window.innerWidth+100&&(this.focusRectSettings.damping=.2)}}get focusRect(){return this._focusRect}get focusRectSize(){const e=this._focusRect;if(e&&(e instanceof DOMRect||"width"in e&&"height"in e&&"x"in e&&"y"in e))return{x:e.x,y:e.y,width:e.width,height:e.height};if(e instanceof HTMLElement){const t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}return null}focusRectSettings={damping:0,zoom:1,offsetX:0,offsetY:0};_focusRect=null;_lastTimestamp=0;_accumulatedTime=0;_dispatchReadyAfterFrame=!1;internalStep(e,t){this.internalOnBeforeRender(e,t)!==!1&&(this.internalOnRender(),this.internalOnAfterRender())}internalOnBeforeRender(e,t){this.renderer.info.autoReset=!!t,this.renderer.info.autoReset===!1&&this.renderer.info.reset(),this._needsVisibleUpdate=!0;const i=t!==null&&this._xrFrame===null;if(this._xrFrame=t,i&&this.domElement.dispatchEvent(new CustomEvent("xr-session-started",{detail:{context:this,session:this.xrSession,frame:t}})),this._currentFrameEvent=-1,this.isManagedExternally===!1&&this.isInXR===!1&&this.targetFrameRate!==void 0){this._lastTimestamp===0&&(this._lastTimestamp=e),this._accumulatedTime+=(e-this._lastTimestamp)/1e3,this._lastTimestamp=e;let n=this.targetFrameRate;if(typeof n=="object"&&(n=n.value),this._accumulatedTime<1/(n+1))return!1;this._accumulatedTime=0}if(this._stats?.begin(),U.Current=this,this.onHandlePaused())return!1;for(U.Current=this,this.time.update(),zP&&console.log("FPS",this.time.smoothedFps.toFixed(0)),ru(this),Td(this.scene),Cw(this),xn(this,-1);this._cameraStack.length>0&&(!this.mainCameraComponent||this.mainCameraComponent.destroyed);){this._cameraStack.splice(this._cameraStack.length-1,1);const n=this._cameraStack[this._cameraStack.length-1];this.setCurrentCamera(n)}if(this.pre_update_oneshot_callbacks){for(const n in this.pre_update_oneshot_callbacks)this.pre_update_oneshot_callbacks[n]();this.pre_update_oneshot_callbacks.length=0}if(this.pre_update_callbacks)for(const n in this.pre_update_callbacks)this.pre_update_callbacks[n]();this._currentFrameEvent=0;for(let n=0;n<this.scripts_earlyUpdate.length;n++){const o=this.scripts_earlyUpdate[n];o.activeAndEnabled&&o.earlyUpdate!==void 0&&(U.Current=this,o.earlyUpdate())}this.executeCoroutines(0),xn(this,0),this._currentFrameEvent=1;for(let n=0;n<this.scripts_update.length;n++){const o=this.scripts_update[n];o.activeAndEnabled&&o.update!==void 0&&(U.Current=this,o.update())}this.executeCoroutines(1),xn(this,1),this._currentFrameEvent=2;for(let n=0;n<this.scripts_lateUpdate.length;n++){const o=this.scripts_lateUpdate[n];o.activeAndEnabled&&o.lateUpdate!==void 0&&(U.Current=this,o.lateUpdate())}if(this.executeCoroutines(2),xn(this,2),this.physicsSteps===void 0&&(this.physicsSteps=1),this.physics.engine&&this.physicsSteps>0&&this.internalUpdatePhysics(this.physicsSteps),this.isVisibleToUser||this.runInBackground){this._currentFrameEvent=3;for(let n=0;n<this.scripts_onBeforeRender.length;n++){const o=this.scripts_onBeforeRender[n];o.activeAndEnabled&&o.onBeforeRender!==void 0&&(U.Current=this,o.onBeforeRender(t))}if(this.executeCoroutines(3),xn(this,3),this._needsUpdateSize&&this.updateSize(),this.pre_render_callbacks)for(const n in this.pre_render_callbacks)this.pre_render_callbacks[n](t);if(this._focusRect&&this.mainCamera instanceof c.PerspectiveCamera){const n=this.focusRectSettings,o=n.damping>0?this.time.deltaTime/n.damping:1;oC(this._focusRect,this.focusRectSettings,o,this.mainCamera,this.renderer)}}return!0}internalUpdatePhysics(e){if(!this.physics.engine)return!1;const t=e,i=this.time.deltaTime/t;for(let n=0;n<t;n++)this._currentFrameEvent=9,this.executeCoroutines(9),this.physics.engine.step(i),this._currentFrameEvent=10,this.executeCoroutines(10);return this.physics.engine.postStep(),!0}internalOnRender(){this.isManagedExternally||(wk(this),this._currentFrameEvent=-1,X.nodeFrame.camera=this.mainCamera,X.nodeFrame.update(),this.renderNow(),this._currentFrameEvent=4)}internalOnAfterRender(){if(this.isVisibleToUser||this.runInBackground){for(let e=0;e<this.scripts_onAfterRender.length;e++){const t=this.scripts_onAfterRender[e];t.activeAndEnabled&&t.onAfterRender!==void 0&&(U.Current=this,t.onAfterRender())}if(this.executeCoroutines(4),xn(this,4),this.post_render_callbacks)for(const e in this.post_render_callbacks)this.post_render_callbacks[e]()}if(this._currentFrameEvent=-1,this.connection.sendBufferedMessagesNow(),this._stats){this._stats.end();const e=this.time.fps<20?50:150;if(this.time.frameCount%e===0||this.time.frameCount===1){const t=window.performance&&window.performance.memory?`${(window.performance.memory.usedJSHeapSize/1024/1024).toFixed(2)} MB`:"n/a";console.log(this.renderer.info.render.calls+" DrawCalls",`
880
880
  Render:`,{shaders:this.renderer.info.programs?.length,...this.renderer.info.render},`
881
881
  Memory:`,{usedMemory:t,...this.renderer.info.memory},`
882
- Target Framerate: `+this.targetFrameRate)}}this._dispatchReadyAfterFrame&&(this._dispatchReadyAfterFrame=!1,this.domElement.dispatchEvent(new CustomEvent("ready")),ae.dispatchCallback(le.ContextFirstFrameRendered,this))}_tempClearColor=new c.Color;_tempClearColor2=new c.Color;renderNow(e){if(!e&&(e=this.mainCamera,!e))return!1;if(this.handleRendererContextLost(),this._isRendering=!0,this.renderRequiredTextures(),this.renderer.toneMapping!==c.NoToneMapping&&H0(),this.postprocessing.update(),this.composer&&!this.isInXR){e&&"setMainCamera"in this.composer&&this.composer.passes[0]?.mainCamera!=e&&this.composer.setMainCamera(e);const t=this.renderer.getClearColor(this._tempClearColor),i=this.renderer.getClearAlpha();this._tempClearColor2.copy(t),this.renderer.setClearColor(t.convertSRGBToLinear(),this.renderer.getClearAlpha()),this.composer.render(this.time.deltaTime),this.renderer.setClearColor(this._tempClearColor2,i)}else e&&(this.isInXR&&exports.DeviceUtilities.isMacOS()&&this.renderer.clearDepth(),this.renderer.render(this.scene,e));return this._isRendering=!1,!0}_contextRestoreTries=0;handleRendererContextLost(){this.time.frame%10&&this.renderer.getContext().isContextLost()&&this._contextRestoreTries++<100&&(console.warn("Attempting to recover WebGL context..."),this.renderer.forceContextRestore())}_wasPaused=!1;onHandlePaused(){const e=this.evaluatePaused();if(this._wasPaused!==e){UP&&console.log("Paused?",e,"context:"+this.alias);for(let t=0;t<this.scripts_pausedChanged.length;t++){const i=this.scripts_pausedChanged[t];i.activeAndEnabled&&i.onPausedChanged!==void 0&&(U.Current=this,i.onPausedChanged(e,this._wasPaused))}}return this._wasPaused=e,e}evaluatePaused(){return this.isInXR?!1:this.isPaused?!0:this.runInBackground?!1:!this.isVisibleToUser}renderRequiredTextures(){if(!this.mainCamera||!this._requireDepthTexture&&!this._requireColorTexture)return;if(!this._renderTarget){if(this._renderTarget=new c.WebGLRenderTarget(this.domWidth,this.domHeight),this._requireDepthTexture){const i=new c.DepthTexture(this.domWidth,this.domHeight);this._renderTarget.depthTexture=i}this._requireColorTexture&&(this._renderTarget.texture=new c.Texture,this._renderTarget.texture.generateMipmaps=!1,this._renderTarget.texture.minFilter=c.NearestFilter,this._renderTarget.texture.magFilter=c.NearestFilter,this._renderTarget.texture.format=c.RGBAFormat)}const e=this._renderTarget;e.texture&&(e.texture.colorSpace=this.renderer.outputColorSpace);const t=this.renderer.getRenderTarget();this.renderer.setRenderTarget(e),this.renderer.render(this.scene,this.mainCamera),this.renderer.setRenderTarget(t)}executeCoroutines(e){if(this.coroutines[e]){const i=this.coroutines[e];for(let n=0;n<i.length;n++)try{const o=i[n];if(!o.comp||o.comp.destroyed||!o.main||o.comp.enabled===!1){NP&&console.log("Removing coroutine",o.comp,o.comp.enabled),i.splice(n,1),--n;continue}const a=o.chained;if(a&&a.length>0){const u=a[a.length-1].next();if(u.done&&a.pop(),t(u)&&(o.chained||(o.chained=[]),o.chained.push(u.value)),!u.done)continue}const l=o.main.next();if(l.done===!0){i.splice(n,1),--n;continue}const h=l.value;if(t(h)){if(h.next().done)continue;o.chained||(o.chained=[]),o.chained.push(h)}else if(h instanceof Promise){const d=h;o.chained||(o.chained=[]);const u=T0(d);o.chained?.push(u);continue}}catch(o){console.error(o)}}function t(i){return!!(i&&i.next&&i.return)}}}const ip=x("debugwebxr");class rw{static tryFindAvatarObjects(e,t,i){if(i.head&&i.leftHand&&i.rightHand)return;const n=e.name.toLocaleLowerCase();!i.head&&n.includes("head")&&(ip&&console.log("FOUND AVATAR HEAD",e.name),i.head=new Y("",t,e)),n.includes("hand")&&(!i.leftHand&&n.includes("left")&&(ip&&console.log("FOUND AVATAR LEFT HAND",e.name),i.leftHand=new Y("",t,e)),!i.rightHand&&n.includes("right")&&(ip&&console.log("FOUND AVATAR RIGHT HAND",e.name),i.rightHand=new Y("",t,e)));for(let o=0;o<e.children.length;o++){if(i.head&&i.leftHand&&i.rightHand)return;const r=e.children[o];this.tryFindAvatarObjects(r,t,i)}}}class ie extends c.Color{alpha=1;get isRGBAColor(){return!0}set a(e){this.alpha=e}get a(){return this.alpha}constructor(e,t,i,n){super(),typeof e=="number"&&typeof t=="number"&&typeof i=="number"?(this.set(e,t,i),this.alpha=typeof n=="number"?n:1):e!==void 0&&(this.set(e),this.alpha=1)}clone(){const e=super.clone();return e.alpha=this.alpha,e}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,"alpha"in e&&typeof e.alpha=="number"?this.alpha=e.alpha:typeof e.a=="number"&&(this.alpha=e.a),this}lerp(e,t){const i=e;return i.alpha!=null&&(this.alpha=j.lerp(this.alpha,i.alpha,t)),super.lerp(e,t)}lerpColors(e,t,i){const n=e,o=t;return n.alpha!=null&&o.alpha!=null&&(this.alpha=j.lerp(n.alpha,o.alpha,i)),super.lerpColors(e,t,i)}multiply(e){const t=e;return t.alpha!=null&&(this.alpha=this.alpha*t.alpha),super.multiply(e)}fromArray(e,t=0){return this.alpha=e[t+3],super.fromArray(e,t)}static fromColorRepresentation(e){if(typeof e=="string"){if(e.trim()==="transparent")return new ie(0,0,0,0);if(e.startsWith("#")&&e.length===9){const t=parseInt(e.slice(1,9),16),i=t>>24&255,n=t>>16&255,o=t>>8&255,r=t>>0&255;return new ie(i/255,n/255,o/255,r/255)}else if(e.startsWith("#")){const t=parseInt(e.slice(1),16),i=t>>16&255,n=t>>8&255,o=t>>0&255;return new ie(i/255,n/255,o/255,1)}else if(e.startsWith("rgba")){const t=e.slice(5,-1).split(",").map(Number);return new ie(t[0]/255,t[1]/255,t[2]/255,t[3])}else if(e.startsWith("rgb")){const t=e.slice(4,-1).split(",").map(Number);return new ie(t[0]/255,t[1]/255,t[2]/255,1)}}else if(Array.isArray(e)){if(e.length===4)return new ie(e[0],e[1],e[2],e[3]);if(e.length===3)return new ie(e[0],e[1],e[2],1);console.error("Invalid color array length. Expected 3 or 4, got "+e.length)}return new ie(e)}}const Mt=new c.Vector3,eb=new c.Vector3,tb=new c.Quaternion,WP=x("debuggizmos"),nn=8947848,np=32;class B{constructor(){}static enabled=!0;static isGizmo(e){return e[um]!==void 0}static setVisible(e){for(const t of Di.timedObjectsBuffer)t.visible=e}static DrawLabel(e,t,i=.05,n=0,o,r,a){if(!B.enabled)return null;o||(o=nn);const l=H.active?.rigScale??1,h=Di.getTextLabel(n,t,i*l,o,r);return a instanceof c.Object3D&&a.add(h),h.position.x=e.x,h.position.y=e.y,h.position.z=e.z,h}static DrawRay(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getLine(n),a=r.geometry.getAttribute("position");a.setXYZ(0,e.x,e.y,e.z),Mt.set(t.x,t.y,t.z).multiplyScalar(999999999),a.setXYZ(1,e.x+Mt.x,e.y+Mt.y,e.z+Mt.z),a.needsUpdate=!0,r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawDirection(e,t,i=nn,n=0,o=!0,r=1){if(!B.enabled)return;const a=Di.getLine(n),l=a.geometry.getAttribute("position");l.setXYZ(0,e.x,e.y,e.z),t.w!==void 0?(Mt.set(0,0,-r),tb.set(t.x,t.y,t.z,t.w),Mt.applyQuaternion(tb)):(Mt.set(t.x,t.y,t.z),Mt.multiplyScalar(r)),l.setXYZ(1,e.x+Mt.x,e.y+Mt.y,e.z+Mt.z),l.needsUpdate=!0,a.material.depthTest=o,a.material.depthWrite=!1,rn(a.material,i)}static DrawLine(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getLine(n),a=r.geometry.getAttribute("position");a.setXYZ(0,e.x,e.y,e.z),a.setXYZ(1,t.x,t.y,t.z),a.needsUpdate=!0,r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawCircle(e,t,i,n=nn,o=0,r=!0){if(!B.enabled)return;const a=Di.getCircle(o);a.position.set(e.x,e.y,e.z),a.scale.set(i,i,i),a.quaternion.setFromUnitVectors(this._up,Mt.set(t.x,t.y,t.z).normalize()),a.material.depthTest=r,a.material.depthWrite=!1,a.material.fog=!1,rn(a.material,n)}static DrawWireSphere(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getSphere(t,n,!0);fr(r,e.x,e.y,e.z),r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawSphere(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getSphere(t,n,!1);fr(r,e.x,e.y,e.z),r.material.depthTest=o,r.material.depthWrite=!1,rn(r.material,i)}static DrawWireBox(e,t,i=nn,n=0,o=!0,r=void 0){if(!B.enabled)return;const a=Di.getBox(n);a.position.set(e.x,e.y,e.z),a.scale.set(t.x,t.y,t.z),r?a.quaternion.copy(r):a.quaternion.identity(),a.material.depthTest=o,a.material.wireframe=!0,a.material.depthWrite=!1,a.material.fog=!1,rn(a.material,i)}static DrawWireBox3(e,t=nn,i=0,n=!0){if(!B.enabled)return;const o=Di.getBox(i);o.position.copy(e.getCenter(Mt)),o.scale.copy(e.getSize(Mt)),o.material.depthTest=n,o.material.wireframe=!0,o.material.depthWrite=!1,o.material.fog=!1,rn(o.material,t)}static _up=new c.Vector3(0,1,0);static DrawArrow(e,t,i=nn,n=0,o=!0,r=!1){if(!B.enabled)return;const a=Di.getArrowHead(n);a.position.set(t.x,t.y,t.z),a.quaternion.setFromUnitVectors(this._up.set(0,1,0),Mt.set(t.x,t.y,t.z).sub(eb.set(e.x,e.y,e.z)).normalize());const h=Mt.set(t.x,t.y,t.z).sub(eb.set(e.x,e.y,e.z)).length()*.1;a.scale.set(h,h,h),a.material.depthTest=o,a.material.wireframe=r,rn(a.material,i),this.DrawLine(e,t,i,n,o)}static DrawWireMesh(e){const t=Di.getMesh(e.duration??0);"mesh"in e?(t.geometry=e.mesh.geometry,t.matrixWorld.copy(e.mesh.matrixWorld)):(t.geometry=e.geometry,t.matrixWorld.copy(e.matrix)),t.matrixAutoUpdate=!1,t.matrixWorldAutoUpdate=!1,t.material.depthTest=e.depthTest??!0,t.material.wireframe=!0,rn(t.material,e.color??nn)}}const GP=new c.BoxGeometry(1,1,1);function Eg(s=null){const e=new c.Color(s??14540253),t=new c.EdgesGeometry(GP);return new c.LineSegments(t,new c.LineBasicMaterial({color:e}))}function rn(s,e){if(Array.isArray(s)){for(const i of s)rn(i,e);return}const t=e instanceof ie?e.a:1;s.color.set(e),s.opacity=t,s.transparent=t<1}const um=Symbol("GizmoCache");class Di{static familyName="needle-gizmos";static ensureFont(){let e=ne.__webpack_exports__default.FontLibrary.getFontFamily(this.familyName);e||(e=ne.__webpack_exports__default.FontLibrary.addFontFamily(this.familyName),e.addVariant("normal","normal","https://cdn.needle.tools/static/fonts/msdf/arial/arial-msdf.json","https://cdn.needle.tools/static/fonts/msdf/arial/arial.png")?.addEventListener("ready",()=>{ne.__webpack_exports__default.update()}))}static getTextLabel(e,t,i,n,o){this.ensureFont();let r=this.textLabelCache.pop(),a=1;o&&typeof o=="string"&&o?.length>=8&&o.startsWith("#")?(a=parseInt(o.substring(7),16)/255,o=o.substring(0,7),WP&&console.log(o,a)):typeof o=="object"&&o.a!==void 0&&(a=o.a);const l={boxSizing:"border-box",fontFamily:this.familyName,width:"auto",fontSize:i,color:n,lineHeight:1,backgroundColor:o??void 0,backgroundOpacity:a,textContent:t,borderRadius:.5*i,padding:.8*i,whiteSpace:"pre",offset:.05*i};if(r)r.set(l);else{r=new ne.__webpack_exports__Text(l);const h=this,d=r;d.setText=function(u){this.set({textContent:u}),h.tmuiNeedsUpdate=!0}}return this.tmuiNeedsUpdate=!0,this.registerTimedObject(U.Current,r,e,this.textLabelCache),r}static getBox(e){let t=this.boxesCache.pop();if(!t){const i=new c.BoxGeometry(1,1,1);t=new c.Mesh(i)}return this.registerTimedObject(U.Current,t,e,this.boxesCache),t}static getLine(e){let t=this.linesCache.pop();if(!t){t=new c.Line;let i=t.geometry.getAttribute("position");i||(i=new c.BufferAttribute(new Float32Array(6),3),t.geometry.setAttribute("position",i))}return t.frustumCulled=!1,this.registerTimedObject(U.Current,t,e,this.linesCache),t}static getCircle(e){let t=this.circlesCache.pop();if(!t){t=new c.Line;let i=t.geometry.getAttribute("position");if(!i){i=new c.BufferAttribute(new Float32Array(np*3),3),t.geometry.setAttribute("position",i);const n=F(0,1,0),o=F(0,0,1),r=F(o);r.cross(n).normalize();const a=F(r),l=Math.PI*2/(np-1);for(let h=0;h<np+1;h++){const d=l*h;n.copy(a).multiplyScalar(Math.cos(d)*1),r.copy(o).multiplyScalar(Math.sin(d)*1);const u=n.add(r);i.setXYZ(h,u.x,u.y,u.z)}}}return t.frustumCulled=!1,this.registerTimedObject(U.Current,t,e,this.circlesCache),t}static getSphere(e,t,i){let n=this.spheresCache.pop();return n||(n=new c.Mesh(new c.SphereGeometry(1,8,8))),n.scale.set(e,e,e),n.material.wireframe=i,this.registerTimedObject(U.Current,n,t,this.spheresCache),n}static getArrowHead(e){let t=this.arrowHeadsCache.pop();return t||(t=new c.Mesh(new c.CylinderGeometry(0,.5,1,8))),this.registerTimedObject(U.Current,t,e,this.arrowHeadsCache),t}static getMesh(e){let t=this.mesh.pop();return t||(t=new c.Mesh,t.material=new c.MeshBasicMaterial),this.registerTimedObject(U.Current,t,e,this.mesh),t}static linesCache=[];static circlesCache=[];static spheresCache=[];static boxesCache=[];static arrowHeadsCache=[];static mesh=[];static textLabelCache=[];static registerTimedObject(e,t,i,n){if(!e){console.error("No Needle Engine context available. Did you call a Gizmos function in global scope?");return}const o=this.contextBeforeRenderCallbacks.get(e),r=this.contextPostRenderCallbacks.get(e);if(o){if(e.pre_render_callbacks[e.pre_render_callbacks.length-1]!==o){const a=e.pre_render_callbacks.indexOf(o);a>=0&&e.pre_render_callbacks.splice(a,1),e.pre_render_callbacks.push(o)}}else{const a=()=>{this.onBeforeRender(e,this.timedObjectsBuffer)};this.contextBeforeRenderCallbacks.set(e,a),e.pre_render_callbacks.push(a)}if(r){if(e.post_render_callbacks[e.post_render_callbacks.length-1]!==r){const a=e.post_render_callbacks.indexOf(r);a>=0&&e.post_render_callbacks.splice(a,1),e.post_render_callbacks.push(r)}}else{const a=()=>{this.onPostRender(e,this.timedObjectsBuffer,this.timesBuffer)};this.contextPostRenderCallbacks.set(e,a),e.post_render_callbacks.push(a)}t.traverse(a=>{a.layers.disableAll(),a.layers.enable(2)}),t.renderOrder=999999,t[um]=n,t.castShadow=!1,t.receiveShadow=!1,t.isGizmo=!0,this.timedObjectsBuffer.push(t),this.timesBuffer.push(U.Current.time.realtimeSinceStartup+i),e.scene.add(t)}static timedObjectsBuffer=new Array;static timesBuffer=new Array;static contextPostRenderCallbacks=new Map;static contextBeforeRenderCallbacks=new Map;static tmuiNeedsUpdate=!1;static onBeforeRender(e,t){this.tmuiNeedsUpdate&&(this.tmuiNeedsUpdate=!1,ne.__webpack_exports__default.update());for(let i=0;i<t.length;i++){const n=t[i];if(e.mainCamera&&n instanceof ne.__webpack_exports__default.MeshUIBaseElement){if(mr(n))continue;const o=e.isInVR,r=!1,a=!o;Hc(n,e.mainCamera,r,a)}}}static onPostRender(e,t,i){const n=e.time.realtimeSinceStartup;for(let o=t.length-1;o>=0;o--){const r=t[o];n>=i[o]-1e-6&&(t.splice(o,1),i.splice(o,1),r.removeFromParent(),mr(r)!=!0&&r[um].push(r))}}}const Gt=x("debugphysics"),HP=x("debugworker"),ib=new c.Layers;class xo{static AllLayers=4294967295;ray;cam;screenPoint;raycaster;results;targets;recursive=!0;minDistance;maxDistance;lineThreshold;layerMask;ignore;testObject;useAcceleratedRaycast;allowSlowRaycastFallback=!0;screenPointFromOffset(e,t){this.screenPoint===void 0&&(this.screenPoint=new c.Vector2),this.screenPoint.x=e/window.innerWidth*2-1,this.screenPoint.y=-(t/window.innerHeight)*2+1}setLayer(e){ib.set(e),this.layerMask=ib}setMask(e){this.layerMask||(this.layerMask=new c.Layers);const t=this.layerMask;t?t.mask=e:this.layerMask=e}}class Tg{distance;point;object;constructor(e,t,i){this.object=e,this.distance=t,this.point=i}}class Ua{static _raycasting=0;static get raycasting(){return this._raycasting>0}raycastPhysicsFast(e,t=void 0,i=1/0,n=!0){return this.context.physics.engine?.raycast(e,t,{maxDistance:i,solid:n})??null}raycastPhysicsFastAndGetNormal(e,t=void 0,i=1/0,n=!0){return this.context.physics.engine?.raycastAndGetNormal(e,t,{maxDistance:i,solid:n})??null}sphereOverlapPhysics(e,t){return this.context.physics.engine?.sphereOverlap(e,t)??null}context;engine;constructor(e){this.context=e}raycaster=new c.Raycaster;defaultRaycastOptions=new xo;targetBuffer=new Array(1);defaultThresholds={Mesh:{},Line:{threshold:-1},LOD:{},Points:{threshold:0},Sprite:{}};sphereResults=new Array;sphereMask=new c.Layers;sphere=new c.Sphere;sphereOverlap(e,t,i=!0,n=!1,o=null){if(this.sphereResults.length=0,!this.context.scene)return this.sphereResults;const r=this.sphereMask;r.enableAll(),r.disable(2);for(const a of this.context.scene.children)this.intersectSphere(a,e,t,r,this.sphereResults,i,n,o);return this.sphereResults.sort((a,l)=>a.distance-l.distance)}raycastFromRay(e,t=null){const i=t??this.defaultRaycastOptions;i.ray=e;const n=this.raycast(i);return i===this.defaultRaycastOptions&&(i.ray=void 0),n}raycast(e=null){Gt&&performance.mark("raycast.start"),e||(e=this.defaultRaycastOptions);const t=e.screenPoint??this.context.input.mousePositionRC,i=e.raycaster??this.raycaster;if(i.near=e.minDistance??0,i.far=e.maxDistance??1/0,i.params=this.defaultThresholds,e.lineThreshold===void 0&&(e.lineThreshold=-1),i.params.Line={threshold:e.lineThreshold},e.ray)i.ray.copy(e.ray);else{const a=e.cam??this.context.mainCamera;if(!a)return Gt&&console.error("Can not perform raycast - no main camera found"),this.defaultRaycastOptions.results&&(this.defaultRaycastOptions.results.length=0),this.defaultRaycastOptions.results??[];const l=this.context.xrCamera;this.context.isInXR&&l instanceof c.ArrayCamera&&l.cameras.length>0?i.setFromCamera(t,l.cameras[0]):i.setFromCamera(t,a)}let n=e.targets;n||(n=this.targetBuffer,n.length=1,n[0]=this.context.scene);let o=e.results;this.defaultRaycastOptions.results&&(this.defaultRaycastOptions.results.length=0),o||(this.defaultRaycastOptions.results||(this.defaultRaycastOptions.results=new Array),o=this.defaultRaycastOptions.results),e.layerMask!==void 0?e.layerMask instanceof c.Layers?i.layers.mask=e.layerMask.mask:i.layers.mask=e.layerMask:(i.layers.enableAll(),i.layers.disable(2)),Gt&&console.time("raycast"),o.length=0,Ua._raycasting++,this.intersect(this.raycaster,n,o,e),o.sort((a,l)=>a.distance-l.distance);const r=e.ignore;return r!==void 0&&r.length>0&&(o=o.filter(a=>!r.includes(a.object))),Ua._raycasting--,Gt&&(console.timeEnd("raycast"),console.warn("#"+this.context.time.frame+", hits:",o?.length?[...o]:"nothing"),performance.mark("raycast.end"),performance.measure("raycast","raycast.start","raycast.end")),o}intersect(e,t,i,n){for(const o of t){if(!o||o.visible===!1||B.isGizmo(o)||n.lineThreshold!==void 0&&n.lineThreshold<0&&o instanceof c.Line)continue;let r=!0;const a=o,l=a.geometry;if(o.raycastAllowed===!1&&(r=!1),r&&n.testObject){const h=n.testObject?.(o);if(h===!1)continue;h==="continue in children"&&(r=!1)}else r&&(l&&nb(l)||(r=!1));if(r){const h=i.length,d=o.raycastPreference||"lod";let u=d!=="bounds";if(n.precise===!1&&(u=!1),l&&(u||=l.getAttribute("position")?.array?.length<64),a instanceof X.GroundedSkybox&&(u=!1),d==="lod"){const f=re.getRaycastMesh(o);f&&(a.geometry=f)}if(!u&&XP(a,e,i)||(n.useAcceleratedRaycast!==!1?su.runMeshBVHRaycast(e,a,i,this.context,n):e.intersectObject(a,!1,i)),a.geometry=l,Gt&&i.length!=h){const f=i[i.length-1];B.DrawWireSphere(f.point,.1,7798784,1,!1),B.DrawWireMesh({mesh:o,depthTest:!1,duration:.2,color:7798784})}}n.recursive!==!1&&this.intersect(e,o.children,i,n)}return i}tempBoundingBox=new c.Box3;intersectSphere(e,t,i,n,o,r,a,l){let h=e&&e.isMesh&&e.layers.test(n)&&!B.isGizmo(e);h&&=e.visible,h&&=!(e instanceof c.Line),h&&=!(e instanceof X.GroundedSkybox);const d=e,u=d.geometry;if(h&&l){const f=l(e);if(f===!1)return;f==="continue in children"&&(h=!1)}if(u&&nb(u)||(h=!1),h){if(a){const f=this.sphere;f.center.copy(t),f.radius=i;const m=o.length;if(su.runMeshBVHRaycast(this.sphere,d,o,this.context,{}),m!=o.length&&!r)return}else if(u.boundingBox||u.computeBoundingBox(),u.boundingBox){d.matrixWorldNeedsUpdate&&d.updateWorldMatrix(!1,!1);const f=this.tempBoundingBox.copy(u.boundingBox).applyMatrix4(d.matrixWorld),m=this.sphere;if(m.center.copy(t),m.radius=i,m.intersectsBox(f)){const g=J(e),b=g.distanceTo(m.center),y=new Tg(e,b,g);if(o.push(y),!r)return}}}if(e.children)for(const f of e.children){const m=o.length;if(this.intersectSphere(f,t,i,n,o,r,a,l),m!=o.length&&!r)return}}}function nb(s){return!(s.index&&s.index.array.length<3)}const Uo=new c.Sphere,Yh=new c.Plane,qP=new c.Matrix3;function XP(s,e,t){const i=s._computeIntersections;if(!i)return!1;let n=s["_computeIntersections:Needle"];return n||(n=s["_computeIntersections:Needle"]=function(o,r,a){const l=this,h=l.geometry.boundingSphere;if(h){if(l instanceof X.GroundedSkybox){Yh.setFromNormalAndCoplanarPoint(F(0,1,0),F(0,-l.position.y,0)),Yh.applyMatrix4(l.matrixWorld,qP);const u=o.ray.intersectPlane(Yh,F());if(u){Uo.copy(h),Uo.applyMatrix4(l.matrixWorld);const m=F(u).sub(o.ray.origin).length(),g=Uo.radius*.5;m<g&&r.push({distance:m,point:u,object:l,normal:Yh.normal.clone()})}return}Uo.copy(h),Uo.applyMatrix4(l.matrixWorld);const d=o.ray.intersectSphere(Uo,F());if(d){const u=F(d).sub(o.ray.origin),f=u.length();if(f>Uo.radius){const m=u.clone().normalize();r.push({distance:f,point:d,object:l,normal:m})}}}}),s._computeIntersections=n,e.intersectObject(s,!1,t),s._computeIntersections=i,!0}var su;(s=>{let e=0;function t(v,w,M,k,O){if(!w.geometry||!w.geometry.hasAttribute("position"))return!1;const D=w.geometry;if(w?.isSkinnedMesh){const I=w,L=I.bvhNeedsUpdate;if(!I.staticGenerator)l(),r&&(I.staticGenerator=new r(w),I.staticGenerator.applyWorldTransforms=!1,I.staticGeometry=I.staticGenerator.generate(),D.boundsTree=a?.call(I.staticGeometry),I.staticGeometryLastUpdate=performance.now()+Math.random()*200,I.bvhNeedsUpdate=!0);else if(D.boundsTree&&(I.autoUpdateMeshBvhInterval!==void 0&&I.autoUpdateMeshBvhInterval>=0||L===!0)){const $=performance.now(),W=$-I.staticGeometryLastUpdate,E=I.autoUpdateMeshBvhInterval??100;(L||W>E)&&(Gt&&console.warn(`Physics: updating skinned mesh bvh for ${w.name} after ${W.toFixed(2)}ms`),I.bvhNeedsUpdate=!1,I.staticGeometryLastUpdate=$,I.staticGenerator?.generate(I.staticGeometry),D.boundsTree.refit())}}else if(!D.boundsTree){d||_();let I=!0;if((k.xr||D[g]===!1||D.getAttribute("position")?.isInterleavedBufferAttribute||D.index&&D.index?.isInterleavedBufferAttribute||e>10)&&(I=!1),I&&f){if(D[m]===void 0){let L=null;if(y.length>0){const $=y.shift();$&&!$.running&&(L=$)}if(!L&&b.length<3)try{HP&&console.warn("[GenerateMeshBVHWorker] Creating worker with import.meta.url:",typeof document>"u"?require("url").pathToFileURL(__filename).href:va&&va.tagName.toUpperCase()==="SCRIPT"&&va.src||new URL("needle-engine.bundle-CqUYvUIH.umd.cjs",document.baseURI).href),L=new f,b.push(L)}catch($){$ instanceof DOMException&&$.name==="SecurityError"?(console.warn("Failed to create MeshBVH worker, falling back to main thread generation. This can happen when running from file://, if the browser does not support workers or if the browser is blocking workers for other reasons."),console.debug($),e+=10):(console.error("Failed to create MeshBVH worker. Please see below for more details:"),console.log($)),e++}if(L!=null&&!L.running){const $=w.name;Gt&&console.log("<<<< worker start",$,L),D[m]="queued",performance.mark("bvh.create.start");const W=D.clone();try{L.generate(W).then(E=>{D[m]="done",D.boundsTree=E}).catch(E=>{D[m]="failed - "+E?.message,D[g]=!1,Gt&&console.error("Failed to generate mesh bvh on worker",E)}).finally(()=>{Gt&&console.log(">>>>> worker done",$,{hasBoundsTre:D.boundsTree!=null}),y.push(L),W.dispose(),performance.mark("bvh.create.end"),performance.measure("bvh.create (worker)","bvh.create.start","bvh.create.end")})}catch(E){console.error("Failed to generate mesh bvh on worker",E)}}else Gt&&console.warn("No worker available")}}else(!u||!I)&&(l(),o&&(performance.mark("bvh.create.start"),D.boundsTree=new o(D),performance.mark("bvh.create.end"),performance.measure("bvh.create","bvh.create.start","bvh.create.end")))}if(v instanceof c.Raycaster){const I=v,L=w.raycast;if(D.boundsTree)l(),n&&(w.acceleratedRaycast||(w.acceleratedRaycast=n.bind(w),Gt&&console.debug(`Physics: bind acceleratedRaycast fn to "${w.name}"`)),w.raycast=w.acceleratedRaycast);else if(Gt&&console.warn("No bounds tree found for mesh",w.name,{workerTask:D[m],hasAcceleratedRaycast:n!=null}),O.allowSlowRaycastFallback===!1&&(D.getAttribute("position")?.array?.length??0)>2e3)return Gt&&console.warn("Skipping raycast because no bounds tree is available and allowSlowRaycastFallback is false"),!1;const $=I.firstHitOnly;return I.firstHitOnly=!1,I.intersectObject(w,!1,M),I.firstHitOnly=$,w.raycast=L,!0}else if(v instanceof c.Sphere){const I=D.boundsTree;if(I){const L=v;if(h.copy(w.matrixWorld).invert(),L.applyMatrix4(h),I.intersectsSphere(L)){const W=J(w),E=W.distanceTo(L.center),N=new Tg(w,E,W);M.push(N)}}return!0}return!1}s.runMeshBVHRaycast=t;let i=!1,n=null,o=null,r=null,a=null;function l(){i||(i=!0,Promise.resolve().then(()=>require("./vendor-DkMW3WY4.umd.cjs")).then(v=>v.index$1).then(v=>{n=v.acceleratedRaycast,o=v.MeshBVH,r=v.StaticGeometryGenerator,a=v.computeBoundsTree}).catch(v=>{(Gt||T())&&console.error("Failed to load BVH library...",v.message)}))}const h=new c.Matrix4;let d=!1,u=!1,f=null;const m=Symbol("Needle:MeshBVH-Worker"),g=Symbol("Needle:MeshBVH-CanUseWorker"),b=[],y=[];function _(){d=!0,u=!0,Promise.resolve().then(()=>FD).then(v=>{f=v.GenerateMeshBVHWorker}).catch(v=>{Gt||T()?console.warn("Failed to setup mesh bvh worker"):console.debug("Failed to setup mesh bvh worker",v)}).finally(()=>{u=!1})}})(su||(su={}));const sb=Symbol("gltf-loader-internal-usage-tracker"),QP=x("debugusers");class ka{get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(e){return ka._loadingProcesses>0}static _loadingProcesses=0;parser;_getDependency;_loadingId;_loadedObjects=new Set;constructor(e){this.parser=e,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}beforeRoot(){ka._loadingProcesses++;const e=this,t=this._getDependency;return this.parser.getDependency=function(i,n){const o=t.call(this,i,n);return o.then(r=>(r&&(e._loadedObjects.add(r),r[sb]=e._loadingId),r)),o},null}afterRoot(e){ka._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const t of this._loadedObjects)delete t[sb],t instanceof c.Object3D&&(t.parent||t instanceof c.Mesh&&setTimeout(()=>{QP&&console.warn("> GLTF LOADER: Mesh not used in scene!",t),t.material=null,t.geometry=null},1e3));return null}}class aw{constructor(){window.addEventListener("unhandledrejection",e=>{if(e.defaultPrevented)return;const t=e?.reason?.path;if(t){const i=t[0];i&&i.tagName==="IMG"&&(console.warn(`Could not load image:
882
+ Target Framerate: `+this.targetFrameRate)}}this._dispatchReadyAfterFrame&&(this._dispatchReadyAfterFrame=!1,this.domElement.dispatchEvent(new CustomEvent("ready")),ae.dispatchCallback(le.ContextFirstFrameRendered,this))}_tempClearColor=new c.Color;_tempClearColor2=new c.Color;renderNow(e){if(!e&&(e=this.mainCamera,!e))return!1;if(this.handleRendererContextLost(),this._isRendering=!0,this.renderRequiredTextures(),this.renderer.toneMapping!==c.NoToneMapping&&H0(),this.postprocessing.update(),this.composer&&!this.isInXR){e&&"setMainCamera"in this.composer&&this.composer.passes[0]?.mainCamera!=e&&this.composer.setMainCamera(e);const t=this.renderer.getClearColor(this._tempClearColor),i=this.renderer.getClearAlpha();this._tempClearColor2.copy(t),this.renderer.setClearColor(t.convertSRGBToLinear(),this.renderer.getClearAlpha()),this.composer.render(this.time.deltaTime),this.renderer.setClearColor(this._tempClearColor2,i)}else e&&(this.isInXR&&exports.DeviceUtilities.isMacOS()&&this.renderer.clearDepth(),this.renderer.render(this.scene,e));return this._isRendering=!1,!0}_contextRestoreTries=0;handleRendererContextLost(){this.time.frame%10&&this.renderer.getContext().isContextLost()&&this._contextRestoreTries++<100&&(console.warn("Attempting to recover WebGL context..."),this.renderer.forceContextRestore())}_wasPaused=!1;onHandlePaused(){const e=this.evaluatePaused();if(this._wasPaused!==e){UP&&console.log("Paused?",e,"context:"+this.alias);for(let t=0;t<this.scripts_pausedChanged.length;t++){const i=this.scripts_pausedChanged[t];i.activeAndEnabled&&i.onPausedChanged!==void 0&&(U.Current=this,i.onPausedChanged(e,this._wasPaused))}}return this._wasPaused=e,e}evaluatePaused(){return this.isInXR?!1:this.isPaused?!0:this.runInBackground?!1:!this.isVisibleToUser}renderRequiredTextures(){if(!this.mainCamera||!this._requireDepthTexture&&!this._requireColorTexture)return;if(!this._renderTarget){if(this._renderTarget=new c.WebGLRenderTarget(this.domWidth,this.domHeight),this._requireDepthTexture){const i=new c.DepthTexture(this.domWidth,this.domHeight);this._renderTarget.depthTexture=i}this._requireColorTexture&&(this._renderTarget.texture=new c.Texture,this._renderTarget.texture.generateMipmaps=!1,this._renderTarget.texture.minFilter=c.NearestFilter,this._renderTarget.texture.magFilter=c.NearestFilter,this._renderTarget.texture.format=c.RGBAFormat)}const e=this._renderTarget;e.texture&&(e.texture.colorSpace=this.renderer.outputColorSpace);const t=this.renderer.getRenderTarget();this.renderer.setRenderTarget(e),this.renderer.render(this.scene,this.mainCamera),this.renderer.setRenderTarget(t)}executeCoroutines(e){if(this.coroutines[e]){const i=this.coroutines[e];for(let n=0;n<i.length;n++)try{const o=i[n];if(!o.comp||o.comp.destroyed||!o.main||o.comp.enabled===!1){NP&&console.log("Removing coroutine",o.comp,o.comp.enabled),i.splice(n,1),--n;continue}const a=o.chained;if(a&&a.length>0){const u=a[a.length-1].next();if(u.done&&a.pop(),t(u)&&(o.chained||(o.chained=[]),o.chained.push(u.value)),!u.done)continue}const l=o.main.next();if(l.done===!0){i.splice(n,1),--n;continue}const h=l.value;if(t(h)){if(h.next().done)continue;o.chained||(o.chained=[]),o.chained.push(h)}else if(h instanceof Promise){const d=h;o.chained||(o.chained=[]);const u=T0(d);o.chained?.push(u);continue}}catch(o){console.error(o)}}function t(i){return!!(i&&i.next&&i.return)}}}const ip=x("debugwebxr");class rw{static tryFindAvatarObjects(e,t,i){if(i.head&&i.leftHand&&i.rightHand)return;const n=e.name.toLocaleLowerCase();!i.head&&n.includes("head")&&(ip&&console.log("FOUND AVATAR HEAD",e.name),i.head=new Y("",t,e)),n.includes("hand")&&(!i.leftHand&&n.includes("left")&&(ip&&console.log("FOUND AVATAR LEFT HAND",e.name),i.leftHand=new Y("",t,e)),!i.rightHand&&n.includes("right")&&(ip&&console.log("FOUND AVATAR RIGHT HAND",e.name),i.rightHand=new Y("",t,e)));for(let o=0;o<e.children.length;o++){if(i.head&&i.leftHand&&i.rightHand)return;const r=e.children[o];this.tryFindAvatarObjects(r,t,i)}}}class ie extends c.Color{alpha=1;get isRGBAColor(){return!0}set a(e){this.alpha=e}get a(){return this.alpha}constructor(e,t,i,n){super(),typeof e=="number"&&typeof t=="number"&&typeof i=="number"?(this.set(e,t,i),this.alpha=typeof n=="number"?n:1):e!==void 0&&(this.set(e),this.alpha=1)}clone(){const e=super.clone();return e.alpha=this.alpha,e}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,"alpha"in e&&typeof e.alpha=="number"?this.alpha=e.alpha:typeof e.a=="number"&&(this.alpha=e.a),this}lerp(e,t){const i=e;return i.alpha!=null&&(this.alpha=j.lerp(this.alpha,i.alpha,t)),super.lerp(e,t)}lerpColors(e,t,i){const n=e,o=t;return n.alpha!=null&&o.alpha!=null&&(this.alpha=j.lerp(n.alpha,o.alpha,i)),super.lerpColors(e,t,i)}multiply(e){const t=e;return t.alpha!=null&&(this.alpha=this.alpha*t.alpha),super.multiply(e)}fromArray(e,t=0){return this.alpha=e[t+3],super.fromArray(e,t)}static fromColorRepresentation(e){if(typeof e=="string"){if(e.trim()==="transparent")return new ie(0,0,0,0);if(e.startsWith("#")&&e.length===9){const t=parseInt(e.slice(1,9),16),i=t>>24&255,n=t>>16&255,o=t>>8&255,r=t>>0&255;return new ie(i/255,n/255,o/255,r/255)}else if(e.startsWith("#")){const t=parseInt(e.slice(1),16),i=t>>16&255,n=t>>8&255,o=t>>0&255;return new ie(i/255,n/255,o/255,1)}else if(e.startsWith("rgba")){const t=e.slice(5,-1).split(",").map(Number);return new ie(t[0]/255,t[1]/255,t[2]/255,t[3])}else if(e.startsWith("rgb")){const t=e.slice(4,-1).split(",").map(Number);return new ie(t[0]/255,t[1]/255,t[2]/255,1)}}else if(Array.isArray(e)){if(e.length===4)return new ie(e[0],e[1],e[2],e[3]);if(e.length===3)return new ie(e[0],e[1],e[2],1);console.error("Invalid color array length. Expected 3 or 4, got "+e.length)}return new ie(e)}}const Mt=new c.Vector3,eb=new c.Vector3,tb=new c.Quaternion,WP=x("debuggizmos"),nn=8947848,np=32;class B{constructor(){}static enabled=!0;static isGizmo(e){return e[um]!==void 0}static setVisible(e){for(const t of Di.timedObjectsBuffer)t.visible=e}static DrawLabel(e,t,i=.05,n=0,o,r,a){if(!B.enabled)return null;o||(o=nn);const l=H.active?.rigScale??1,h=Di.getTextLabel(n,t,i*l,o,r);return a instanceof c.Object3D&&a.add(h),h.position.x=e.x,h.position.y=e.y,h.position.z=e.z,h}static DrawRay(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getLine(n),a=r.geometry.getAttribute("position");a.setXYZ(0,e.x,e.y,e.z),Mt.set(t.x,t.y,t.z).multiplyScalar(999999999),a.setXYZ(1,e.x+Mt.x,e.y+Mt.y,e.z+Mt.z),a.needsUpdate=!0,r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawDirection(e,t,i=nn,n=0,o=!0,r=1){if(!B.enabled)return;const a=Di.getLine(n),l=a.geometry.getAttribute("position");l.setXYZ(0,e.x,e.y,e.z),t.w!==void 0?(Mt.set(0,0,-r),tb.set(t.x,t.y,t.z,t.w),Mt.applyQuaternion(tb)):(Mt.set(t.x,t.y,t.z),Mt.multiplyScalar(r)),l.setXYZ(1,e.x+Mt.x,e.y+Mt.y,e.z+Mt.z),l.needsUpdate=!0,a.material.depthTest=o,a.material.depthWrite=!1,rn(a.material,i)}static DrawLine(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getLine(n),a=r.geometry.getAttribute("position");a.setXYZ(0,e.x,e.y,e.z),a.setXYZ(1,t.x,t.y,t.z),a.needsUpdate=!0,r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawCircle(e,t,i,n=nn,o=0,r=!0){if(!B.enabled)return;const a=Di.getCircle(o);a.position.set(e.x,e.y,e.z),a.scale.set(i,i,i),a.quaternion.setFromUnitVectors(this._up,Mt.set(t.x,t.y,t.z).normalize()),a.material.depthTest=r,a.material.depthWrite=!1,a.material.fog=!1,rn(a.material,n)}static DrawWireSphere(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getSphere(t,n,!0);fr(r,e.x,e.y,e.z),r.material.depthTest=o,r.material.depthWrite=!1,r.material.fog=!1,rn(r.material,i)}static DrawSphere(e,t,i=nn,n=0,o=!0){if(!B.enabled)return;const r=Di.getSphere(t,n,!1);fr(r,e.x,e.y,e.z),r.material.depthTest=o,r.material.depthWrite=!1,rn(r.material,i)}static DrawWireBox(e,t,i=nn,n=0,o=!0,r=void 0){if(!B.enabled)return;const a=Di.getBox(n);a.position.set(e.x,e.y,e.z),a.scale.set(t.x,t.y,t.z),r?a.quaternion.copy(r):a.quaternion.identity(),a.material.depthTest=o,a.material.wireframe=!0,a.material.depthWrite=!1,a.material.fog=!1,rn(a.material,i)}static DrawWireBox3(e,t=nn,i=0,n=!0){if(!B.enabled)return;const o=Di.getBox(i);o.position.copy(e.getCenter(Mt)),o.scale.copy(e.getSize(Mt)),o.material.depthTest=n,o.material.wireframe=!0,o.material.depthWrite=!1,o.material.fog=!1,rn(o.material,t)}static _up=new c.Vector3(0,1,0);static DrawArrow(e,t,i=nn,n=0,o=!0,r=!1){if(!B.enabled)return;const a=Di.getArrowHead(n);a.position.set(t.x,t.y,t.z),a.quaternion.setFromUnitVectors(this._up.set(0,1,0),Mt.set(t.x,t.y,t.z).sub(eb.set(e.x,e.y,e.z)).normalize());const h=Mt.set(t.x,t.y,t.z).sub(eb.set(e.x,e.y,e.z)).length()*.1;a.scale.set(h,h,h),a.material.depthTest=o,a.material.wireframe=r,rn(a.material,i),this.DrawLine(e,t,i,n,o)}static DrawWireMesh(e){const t=Di.getMesh(e.duration??0);"mesh"in e?(t.geometry=e.mesh.geometry,t.matrixWorld.copy(e.mesh.matrixWorld)):(t.geometry=e.geometry,t.matrixWorld.copy(e.matrix)),t.matrixAutoUpdate=!1,t.matrixWorldAutoUpdate=!1,t.material.depthTest=e.depthTest??!0,t.material.wireframe=!0,rn(t.material,e.color??nn)}}const GP=new c.BoxGeometry(1,1,1);function Eg(s=null){const e=new c.Color(s??14540253),t=new c.EdgesGeometry(GP);return new c.LineSegments(t,new c.LineBasicMaterial({color:e}))}function rn(s,e){if(Array.isArray(s)){for(const i of s)rn(i,e);return}const t=e instanceof ie?e.a:1;s.color.set(e),s.opacity=t,s.transparent=t<1}const um=Symbol("GizmoCache");class Di{static familyName="needle-gizmos";static ensureFont(){let e=ne.__webpack_exports__default.FontLibrary.getFontFamily(this.familyName);e||(e=ne.__webpack_exports__default.FontLibrary.addFontFamily(this.familyName),e.addVariant("normal","normal","https://cdn.needle.tools/static/fonts/msdf/arial/arial-msdf.json","https://cdn.needle.tools/static/fonts/msdf/arial/arial.png")?.addEventListener("ready",()=>{ne.__webpack_exports__default.update()}))}static getTextLabel(e,t,i,n,o){this.ensureFont();let r=this.textLabelCache.pop(),a=1;o&&typeof o=="string"&&o?.length>=8&&o.startsWith("#")?(a=parseInt(o.substring(7),16)/255,o=o.substring(0,7),WP&&console.log(o,a)):typeof o=="object"&&o.a!==void 0&&(a=o.a);const l={boxSizing:"border-box",fontFamily:this.familyName,width:"auto",fontSize:i,color:n,lineHeight:1,backgroundColor:o??void 0,backgroundOpacity:a,textContent:t,borderRadius:.5*i,padding:.8*i,whiteSpace:"pre",offset:.05*i};if(r)r.set(l);else{r=new ne.__webpack_exports__Text(l);const h=this,d=r;d.setText=function(u){this.set({textContent:u}),h.tmuiNeedsUpdate=!0}}return this.tmuiNeedsUpdate=!0,this.registerTimedObject(U.Current,r,e,this.textLabelCache),r}static getBox(e){let t=this.boxesCache.pop();if(!t){const i=new c.BoxGeometry(1,1,1);t=new c.Mesh(i)}return this.registerTimedObject(U.Current,t,e,this.boxesCache),t}static getLine(e){let t=this.linesCache.pop();if(!t){t=new c.Line;let i=t.geometry.getAttribute("position");i||(i=new c.BufferAttribute(new Float32Array(6),3),t.geometry.setAttribute("position",i))}return t.frustumCulled=!1,this.registerTimedObject(U.Current,t,e,this.linesCache),t}static getCircle(e){let t=this.circlesCache.pop();if(!t){t=new c.Line;let i=t.geometry.getAttribute("position");if(!i){i=new c.BufferAttribute(new Float32Array(np*3),3),t.geometry.setAttribute("position",i);const n=F(0,1,0),o=F(0,0,1),r=F(o);r.cross(n).normalize();const a=F(r),l=Math.PI*2/(np-1);for(let h=0;h<np+1;h++){const d=l*h;n.copy(a).multiplyScalar(Math.cos(d)*1),r.copy(o).multiplyScalar(Math.sin(d)*1);const u=n.add(r);i.setXYZ(h,u.x,u.y,u.z)}}}return t.frustumCulled=!1,this.registerTimedObject(U.Current,t,e,this.circlesCache),t}static getSphere(e,t,i){let n=this.spheresCache.pop();return n||(n=new c.Mesh(new c.SphereGeometry(1,8,8))),n.scale.set(e,e,e),n.material.wireframe=i,this.registerTimedObject(U.Current,n,t,this.spheresCache),n}static getArrowHead(e){let t=this.arrowHeadsCache.pop();return t||(t=new c.Mesh(new c.CylinderGeometry(0,.5,1,8))),this.registerTimedObject(U.Current,t,e,this.arrowHeadsCache),t}static getMesh(e){let t=this.mesh.pop();return t||(t=new c.Mesh,t.material=new c.MeshBasicMaterial),this.registerTimedObject(U.Current,t,e,this.mesh),t}static linesCache=[];static circlesCache=[];static spheresCache=[];static boxesCache=[];static arrowHeadsCache=[];static mesh=[];static textLabelCache=[];static registerTimedObject(e,t,i,n){if(!e){console.error("No Needle Engine context available. Did you call a Gizmos function in global scope?");return}const o=this.contextBeforeRenderCallbacks.get(e),r=this.contextPostRenderCallbacks.get(e);if(o){if(e.pre_render_callbacks[e.pre_render_callbacks.length-1]!==o){const a=e.pre_render_callbacks.indexOf(o);a>=0&&e.pre_render_callbacks.splice(a,1),e.pre_render_callbacks.push(o)}}else{const a=()=>{this.onBeforeRender(e,this.timedObjectsBuffer)};this.contextBeforeRenderCallbacks.set(e,a),e.pre_render_callbacks.push(a)}if(r){if(e.post_render_callbacks[e.post_render_callbacks.length-1]!==r){const a=e.post_render_callbacks.indexOf(r);a>=0&&e.post_render_callbacks.splice(a,1),e.post_render_callbacks.push(r)}}else{const a=()=>{this.onPostRender(e,this.timedObjectsBuffer,this.timesBuffer)};this.contextPostRenderCallbacks.set(e,a),e.post_render_callbacks.push(a)}t.traverse(a=>{a.layers.disableAll(),a.layers.enable(2)}),t.renderOrder=999999,t[um]=n,t.castShadow=!1,t.receiveShadow=!1,t.isGizmo=!0,this.timedObjectsBuffer.push(t),this.timesBuffer.push(U.Current.time.realtimeSinceStartup+i),e.scene.add(t)}static timedObjectsBuffer=new Array;static timesBuffer=new Array;static contextPostRenderCallbacks=new Map;static contextBeforeRenderCallbacks=new Map;static tmuiNeedsUpdate=!1;static onBeforeRender(e,t){this.tmuiNeedsUpdate&&(this.tmuiNeedsUpdate=!1,ne.__webpack_exports__default.update());for(let i=0;i<t.length;i++){const n=t[i];if(e.mainCamera&&n instanceof ne.__webpack_exports__default.MeshUIBaseElement){if(mr(n))continue;const o=e.isInVR,r=!1,a=!o;Hc(n,e.mainCamera,r,a)}}}static onPostRender(e,t,i){const n=e.time.realtimeSinceStartup;for(let o=t.length-1;o>=0;o--){const r=t[o];n>=i[o]-1e-6&&(t.splice(o,1),i.splice(o,1),r.removeFromParent(),mr(r)!=!0&&r[um].push(r))}}}const Gt=x("debugphysics"),HP=x("debugworker"),ib=new c.Layers;class xo{static AllLayers=4294967295;ray;cam;screenPoint;raycaster;results;targets;recursive=!0;minDistance;maxDistance;lineThreshold;layerMask;ignore;testObject;useAcceleratedRaycast;allowSlowRaycastFallback=!0;screenPointFromOffset(e,t){this.screenPoint===void 0&&(this.screenPoint=new c.Vector2),this.screenPoint.x=e/window.innerWidth*2-1,this.screenPoint.y=-(t/window.innerHeight)*2+1}setLayer(e){ib.set(e),this.layerMask=ib}setMask(e){this.layerMask||(this.layerMask=new c.Layers);const t=this.layerMask;t?t.mask=e:this.layerMask=e}}class Tg{distance;point;object;constructor(e,t,i){this.object=e,this.distance=t,this.point=i}}class Ua{static _raycasting=0;static get raycasting(){return this._raycasting>0}raycastPhysicsFast(e,t=void 0,i=1/0,n=!0){return this.context.physics.engine?.raycast(e,t,{maxDistance:i,solid:n})??null}raycastPhysicsFastAndGetNormal(e,t=void 0,i=1/0,n=!0){return this.context.physics.engine?.raycastAndGetNormal(e,t,{maxDistance:i,solid:n})??null}sphereOverlapPhysics(e,t){return this.context.physics.engine?.sphereOverlap(e,t)??null}context;engine;constructor(e){this.context=e}raycaster=new c.Raycaster;defaultRaycastOptions=new xo;targetBuffer=new Array(1);defaultThresholds={Mesh:{},Line:{threshold:-1},LOD:{},Points:{threshold:0},Sprite:{}};sphereResults=new Array;sphereMask=new c.Layers;sphere=new c.Sphere;sphereOverlap(e,t,i=!0,n=!1,o=null){if(this.sphereResults.length=0,!this.context.scene)return this.sphereResults;const r=this.sphereMask;r.enableAll(),r.disable(2);for(const a of this.context.scene.children)this.intersectSphere(a,e,t,r,this.sphereResults,i,n,o);return this.sphereResults.sort((a,l)=>a.distance-l.distance)}raycastFromRay(e,t=null){const i=t??this.defaultRaycastOptions;i.ray=e;const n=this.raycast(i);return i===this.defaultRaycastOptions&&(i.ray=void 0),n}raycast(e=null){Gt&&performance.mark("raycast.start"),e||(e=this.defaultRaycastOptions);const t=e.screenPoint??this.context.input.mousePositionRC,i=e.raycaster??this.raycaster;if(i.near=e.minDistance??0,i.far=e.maxDistance??1/0,i.params=this.defaultThresholds,e.lineThreshold===void 0&&(e.lineThreshold=-1),i.params.Line={threshold:e.lineThreshold},e.ray)i.ray.copy(e.ray);else{const a=e.cam??this.context.mainCamera;if(!a)return Gt&&console.error("Can not perform raycast - no main camera found"),this.defaultRaycastOptions.results&&(this.defaultRaycastOptions.results.length=0),this.defaultRaycastOptions.results??[];const l=this.context.xrCamera;this.context.isInXR&&l instanceof c.ArrayCamera&&l.cameras.length>0?i.setFromCamera(t,l.cameras[0]):i.setFromCamera(t,a)}let n=e.targets;n||(n=this.targetBuffer,n.length=1,n[0]=this.context.scene);let o=e.results;this.defaultRaycastOptions.results&&(this.defaultRaycastOptions.results.length=0),o||(this.defaultRaycastOptions.results||(this.defaultRaycastOptions.results=new Array),o=this.defaultRaycastOptions.results),e.layerMask!==void 0?e.layerMask instanceof c.Layers?i.layers.mask=e.layerMask.mask:i.layers.mask=e.layerMask:(i.layers.enableAll(),i.layers.disable(2)),Gt&&console.time("raycast"),o.length=0,Ua._raycasting++,this.intersect(this.raycaster,n,o,e),o.sort((a,l)=>a.distance-l.distance);const r=e.ignore;return r!==void 0&&r.length>0&&(o=o.filter(a=>!r.includes(a.object))),Ua._raycasting--,Gt&&(console.timeEnd("raycast"),console.warn("#"+this.context.time.frame+", hits:",o?.length?[...o]:"nothing"),performance.mark("raycast.end"),performance.measure("raycast","raycast.start","raycast.end")),o}intersect(e,t,i,n){for(const o of t){if(!o||o.visible===!1||B.isGizmo(o)||n.lineThreshold!==void 0&&n.lineThreshold<0&&o instanceof c.Line)continue;let r=!0;const a=o,l=a.geometry;if(o.raycastAllowed===!1&&(r=!1),r&&n.testObject){const h=n.testObject?.(o);if(h===!1)continue;h==="continue in children"&&(r=!1)}else r&&(l&&nb(l)||(r=!1));if(r){const h=i.length,d=o.raycastPreference||"lod";let u=d!=="bounds";if(n.precise===!1&&(u=!1),l&&(u||=l.getAttribute("position")?.array?.length<64),a instanceof X.GroundedSkybox&&(u=!1),d==="lod"){const f=re.getRaycastMesh(o);f&&(a.geometry=f)}if(!u&&XP(a,e,i)||(n.useAcceleratedRaycast!==!1?su.runMeshBVHRaycast(e,a,i,this.context,n):e.intersectObject(a,!1,i)),a.geometry=l,Gt&&i.length!=h){const f=i[i.length-1];B.DrawWireSphere(f.point,.1,7798784,1,!1),B.DrawWireMesh({mesh:o,depthTest:!1,duration:.2,color:7798784})}}n.recursive!==!1&&this.intersect(e,o.children,i,n)}return i}tempBoundingBox=new c.Box3;intersectSphere(e,t,i,n,o,r,a,l){let h=e&&e.isMesh&&e.layers.test(n)&&!B.isGizmo(e);h&&=e.visible,h&&=!(e instanceof c.Line),h&&=!(e instanceof X.GroundedSkybox);const d=e,u=d.geometry;if(h&&l){const f=l(e);if(f===!1)return;f==="continue in children"&&(h=!1)}if(u&&nb(u)||(h=!1),h){if(a){const f=this.sphere;f.center.copy(t),f.radius=i;const m=o.length;if(su.runMeshBVHRaycast(this.sphere,d,o,this.context,{}),m!=o.length&&!r)return}else if(u.boundingBox||u.computeBoundingBox(),u.boundingBox){d.matrixWorldNeedsUpdate&&d.updateWorldMatrix(!1,!1);const f=this.tempBoundingBox.copy(u.boundingBox).applyMatrix4(d.matrixWorld),m=this.sphere;if(m.center.copy(t),m.radius=i,m.intersectsBox(f)){const g=J(e),b=g.distanceTo(m.center),y=new Tg(e,b,g);if(o.push(y),!r)return}}}if(e.children)for(const f of e.children){const m=o.length;if(this.intersectSphere(f,t,i,n,o,r,a,l),m!=o.length&&!r)return}}}function nb(s){return!(s.index&&s.index.array.length<3)}const Uo=new c.Sphere,Yh=new c.Plane,qP=new c.Matrix3;function XP(s,e,t){const i=s._computeIntersections;if(!i)return!1;let n=s["_computeIntersections:Needle"];return n||(n=s["_computeIntersections:Needle"]=function(o,r,a){const l=this,h=l.geometry.boundingSphere;if(h){if(l instanceof X.GroundedSkybox){Yh.setFromNormalAndCoplanarPoint(F(0,1,0),F(0,-l.position.y,0)),Yh.applyMatrix4(l.matrixWorld,qP);const u=o.ray.intersectPlane(Yh,F());if(u){Uo.copy(h),Uo.applyMatrix4(l.matrixWorld);const m=F(u).sub(o.ray.origin).length(),g=Uo.radius*.5;m<g&&r.push({distance:m,point:u,object:l,normal:Yh.normal.clone()})}return}Uo.copy(h),Uo.applyMatrix4(l.matrixWorld);const d=o.ray.intersectSphere(Uo,F());if(d){const u=F(d).sub(o.ray.origin),f=u.length();if(f>Uo.radius){const m=u.clone().normalize();r.push({distance:f,point:d,object:l,normal:m})}}}}),s._computeIntersections=n,e.intersectObject(s,!1,t),s._computeIntersections=i,!0}var su;(s=>{let e=0;function t(v,w,M,k,O){if(!w.geometry||!w.geometry.hasAttribute("position"))return!1;const D=w.geometry;if(w?.isSkinnedMesh){const I=w,L=I.bvhNeedsUpdate;if(!I.staticGenerator)l(),r&&(I.staticGenerator=new r(w),I.staticGenerator.applyWorldTransforms=!1,I.staticGeometry=I.staticGenerator.generate(),D.boundsTree=a?.call(I.staticGeometry),I.staticGeometryLastUpdate=performance.now()+Math.random()*200,I.bvhNeedsUpdate=!0);else if(D.boundsTree&&(I.autoUpdateMeshBvhInterval!==void 0&&I.autoUpdateMeshBvhInterval>=0||L===!0)){const $=performance.now(),W=$-I.staticGeometryLastUpdate,E=I.autoUpdateMeshBvhInterval??100;(L||W>E)&&(Gt&&console.warn(`Physics: updating skinned mesh bvh for ${w.name} after ${W.toFixed(2)}ms`),I.bvhNeedsUpdate=!1,I.staticGeometryLastUpdate=$,I.staticGenerator?.generate(I.staticGeometry),D.boundsTree.refit())}}else if(!D.boundsTree){d||_();let I=!0;if((k.xr||D[g]===!1||D.getAttribute("position")?.isInterleavedBufferAttribute||D.index&&D.index?.isInterleavedBufferAttribute||e>10)&&(I=!1),I&&f){if(D[m]===void 0){let L=null;if(y.length>0){const $=y.shift();$&&!$.running&&(L=$)}if(!L&&b.length<3)try{HP&&console.warn("[GenerateMeshBVHWorker] Creating worker with import.meta.url:",typeof document>"u"?require("url").pathToFileURL(__filename).href:va&&va.tagName.toUpperCase()==="SCRIPT"&&va.src||new URL("needle-engine.bundle-DN5GLt_w.umd.cjs",document.baseURI).href),L=new f,b.push(L)}catch($){$ instanceof DOMException&&$.name==="SecurityError"?(console.warn("Failed to create MeshBVH worker, falling back to main thread generation. This can happen when running from file://, if the browser does not support workers or if the browser is blocking workers for other reasons."),console.debug($),e+=10):(console.error("Failed to create MeshBVH worker. Please see below for more details:"),console.log($)),e++}if(L!=null&&!L.running){const $=w.name;Gt&&console.log("<<<< worker start",$,L),D[m]="queued",performance.mark("bvh.create.start");const W=D.clone();try{L.generate(W).then(E=>{D[m]="done",D.boundsTree=E}).catch(E=>{D[m]="failed - "+E?.message,D[g]=!1,Gt&&console.error("Failed to generate mesh bvh on worker",E)}).finally(()=>{Gt&&console.log(">>>>> worker done",$,{hasBoundsTre:D.boundsTree!=null}),y.push(L),W.dispose(),performance.mark("bvh.create.end"),performance.measure("bvh.create (worker)","bvh.create.start","bvh.create.end")})}catch(E){console.error("Failed to generate mesh bvh on worker",E)}}else Gt&&console.warn("No worker available")}}else(!u||!I)&&(l(),o&&(performance.mark("bvh.create.start"),D.boundsTree=new o(D),performance.mark("bvh.create.end"),performance.measure("bvh.create","bvh.create.start","bvh.create.end")))}if(v instanceof c.Raycaster){const I=v,L=w.raycast;if(D.boundsTree)l(),n&&(w.acceleratedRaycast||(w.acceleratedRaycast=n.bind(w),Gt&&console.debug(`Physics: bind acceleratedRaycast fn to "${w.name}"`)),w.raycast=w.acceleratedRaycast);else if(Gt&&console.warn("No bounds tree found for mesh",w.name,{workerTask:D[m],hasAcceleratedRaycast:n!=null}),O.allowSlowRaycastFallback===!1&&(D.getAttribute("position")?.array?.length??0)>2e3)return Gt&&console.warn("Skipping raycast because no bounds tree is available and allowSlowRaycastFallback is false"),!1;const $=I.firstHitOnly;return I.firstHitOnly=!1,I.intersectObject(w,!1,M),I.firstHitOnly=$,w.raycast=L,!0}else if(v instanceof c.Sphere){const I=D.boundsTree;if(I){const L=v;if(h.copy(w.matrixWorld).invert(),L.applyMatrix4(h),I.intersectsSphere(L)){const W=J(w),E=W.distanceTo(L.center),N=new Tg(w,E,W);M.push(N)}}return!0}return!1}s.runMeshBVHRaycast=t;let i=!1,n=null,o=null,r=null,a=null;function l(){i||(i=!0,Promise.resolve().then(()=>require("./vendor-DkMW3WY4.umd.cjs")).then(v=>v.index$1).then(v=>{n=v.acceleratedRaycast,o=v.MeshBVH,r=v.StaticGeometryGenerator,a=v.computeBoundsTree}).catch(v=>{(Gt||T())&&console.error("Failed to load BVH library...",v.message)}))}const h=new c.Matrix4;let d=!1,u=!1,f=null;const m=Symbol("Needle:MeshBVH-Worker"),g=Symbol("Needle:MeshBVH-CanUseWorker"),b=[],y=[];function _(){d=!0,u=!0,Promise.resolve().then(()=>FD).then(v=>{f=v.GenerateMeshBVHWorker}).catch(v=>{Gt||T()?console.warn("Failed to setup mesh bvh worker"):console.debug("Failed to setup mesh bvh worker",v)}).finally(()=>{u=!1})}})(su||(su={}));const sb=Symbol("gltf-loader-internal-usage-tracker"),QP=x("debugusers");class ka{get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(e){return ka._loadingProcesses>0}static _loadingProcesses=0;parser;_getDependency;_loadingId;_loadedObjects=new Set;constructor(e){this.parser=e,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}beforeRoot(){ka._loadingProcesses++;const e=this,t=this._getDependency;return this.parser.getDependency=function(i,n){const o=t.call(this,i,n);return o.then(r=>(r&&(e._loadedObjects.add(r),r[sb]=e._loadingId),r)),o},null}afterRoot(e){ka._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const t of this._loadedObjects)delete t[sb],t instanceof c.Object3D&&(t.parent||t instanceof c.Mesh&&setTimeout(()=>{QP&&console.warn("> GLTF LOADER: Mesh not used in scene!",t),t.material=null,t.geometry=null},1e3));return null}}class aw{constructor(){window.addEventListener("unhandledrejection",e=>{if(e.defaultPrevented)return;const t=e?.reason?.path;if(t){const i=t[0];i&&i.tagName==="IMG"&&(console.warn(`Could not load image:
883
883
  `+i.src),e.preventDefault())}})}}const ju=x("trackresources");function lw(){return ju==="dispose"}let Sr=!0;ju===0&&(Sr=!1);function YP(s){Sr=s}function cw(){return Sr}const hw=Symbol("disposable");function dw(s,e){s&&(s[hw]=e,rr&&console.warn("Set disposable",e,s))}const uw=Symbol("disposed");function KP(s){return s[uw]===!0}function xe(s){if(s){if(s[hw]===!1){rr&&console.warn("Object is marked as not disposable",s);return}if(typeof s=="object"&&(s[uw]=!0),s instanceof c.Scene)xe(s.environment),xe(s.background),xe(s.customDepthMaterial),xe(s.customDistanceMaterial);else if(s instanceof c.SkinnedMesh)xe(s.geometry),xe(s.material),xe(s.skeleton),xe(s.bindMatrix),xe(s.bindMatrixInverse),xe(s.customDepthMaterial),xe(s.customDistanceMaterial),s.visible=!1;else if(s instanceof c.Mesh)xe(s.geometry),xe(s.material),xe(s.customDepthMaterial),xe(s.customDistanceMaterial),s.visible=!1;else if(s instanceof c.Object3D)s.visible=!1;else if(s instanceof c.BufferGeometry){Xr(s);for(const e of Object.keys(s.attributes)){const t=s.attributes[e];xe(t)}}else if(s instanceof c.BufferAttribute||s instanceof c.InterleavedBufferAttribute)rr&&console.warn("BufferAttribute dispose not supported",s.count);else if(s instanceof Array)for(const e of s)e instanceof c.Material&&xe(e);else if(s instanceof c.Material){Xr(s);for(const t of Object.keys(s)){const i=s[t];i instanceof c.Texture&&xe(i)}const e=s.uniforms;if(e)for(const t of Object.keys(e)){const i=e[t];i instanceof c.Texture?xe(i):i instanceof c.Uniform$1&&xe(i.value)}}else s instanceof c.Texture?(Xr(s),Xr(s.source),s.source?.data instanceof ImageBitmap&&Xr(s.source.data)):s instanceof c.Skeleton?(Xr(s.boneTexture),s.boneTexture=null):s instanceof c.Bone||!(s instanceof c.Object3D)&&rr&&console.warn("Unknown object type",s)}}function Xr(s){s&&((rr||lw()||ju)&&console.warn("🧨 FREE",s),s instanceof ImageBitmap||"dispose"in s&&typeof s.dispose=="function"&&s.dispose())}function ZP(s){}const JP=new Set;function Rg(s,e,t=null,i){if(i||(i=JP,i.clear()),!s)return i;const n=s[Mc];if(n)for(const o of n)i.has(o)||t?.call(null,o)!==!1&&(i.add(o),e&&Rg(o,!0,t,i));return i}function ek(s){return s[Hl]}const rr=x("debugresourceusers")||x("debugmemory"),Mc=Symbol("needle-resource-users"),Hl=Symbol("needle-resource-users-count");function zt(s,e){ku(s,e,function(t,i){Sr&&!Ua.raycasting&&(ou(Mc,this,t,!1),ou(Mc,this,i,!0))})}Sr&&(zt(c.Mesh.prototype,"material"),zt(c.Mesh.prototype,"geometry"),zt(c.Material.prototype,"map"),zt(c.Material.prototype,"bumpMap"),zt(c.Material.prototype,"alphaMap"),zt(c.Material.prototype,"normalMap"),zt(c.Material.prototype,"displacementMap"),zt(c.Material.prototype,"roughnessMap"),zt(c.Material.prototype,"metalnessMap"),zt(c.Material.prototype,"emissiveMap"),zt(c.Material.prototype,"specularMap"),zt(c.Material.prototype,"envMap"),zt(c.Material.prototype,"lightMap"),zt(c.Material.prototype,"aoMap"),zt(c.Material.prototype,"gradientMap"));function tk(s){if(Sr===!1)return;const e=s[Mc];if(e)for(const t of e)ou(Mc,t,s,!1)}Sr&&ku(c.Material.prototype,"dispose",function(){tk(this)});let fm=0;function ou(s,e,t,i){if(fm>0)return;if(Array.isArray(t)){for(const o of t)ou(s,e,o,i);return}if(!t)return;let n=t[s];if(n||(n=new Set),i){if(e&&!n.has(e)){n.add(e);let o=t[Hl]||0;o+=1,t[Hl]=o,rr&&console.warn(`🟢 Added user of "${t.type}"`,e,t,o,"users:",n)}}else if(e&&n.has(e)){n.delete(e);let o=t[Hl]||0;o>0&&(o-=1,t[Hl]=o),rr&&console.warn(`🔴 Removed user of "${t.type}"`,e,t,o,"users:",n),o<=0&&(ka.isLoading(t)||(ju&&console.warn(`🔴 Removed all user of "${t.type}"`,t),lw()&&xe(t)))}t[s]=n}try{ku(c.WebGLRenderer.prototype,"render",function(){fm++},function(){fm--})}catch(s){console.warn("Could not wrap WebGLRenderer.render",s)}const Ec=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),fw=Symbol("isUsingInstancing"),pw=Symbol("instancingRenderer"),ql=Symbol("instancingAutoUpdateBounds");class Wi{static isUsingInstancing(e){return e[fw]===!0}static getRenderer(e){return e[pw]||null}setAutoUpdateBounds(e,t){const i=Wi.getRenderer(e);i&&(i[ql]=t)}static markDirty(e,t=!0){if(e&&(this.isUsingInstancing(e)&&(e[Ec]=!0,e.matrixWorldNeedsUpdate=!0),t))for(const i of e.children)Wi.markDirty(i,!0)}}const ar=x("debuginstantiate"),Qr=new Map,pm=Symbol("original-component-name");function mm(s,e,t){if(e===null||!s)return;const i=s.guid,n=s.guid;n?.length&&(Qr.has(n)||(ar&&console.log('Creating InstanceIdProvider with key "'+n+'" for object '+s.name),Qr.set(n,new nt(n))));const o=n&&Qr.get(n)||e;if(s.guid=o.generateUUID(),i&&i!=="invalid"&&(t[i]=s.guid),s&&s.userData&&s.userData.components)for(const r of s.userData.components){if(r===null)continue;const a=r.guid;a?Qr.has(a)||(ar&&console.log('Creating InstanceIdProvider with key "'+a+'" for component '+r[pm]),Qr.set(a,new nt(a))):ar&&console.warn("Can not create IdProvider: component "+r[pm]+" has no guid",r.guid);const l=Qr.get(a)||e,h=r.guid;r.guid=l.generateUUID(),h&&h!=="invalid"&&(t[h]=r.guid)}if(s.children)for(const r of s.children)mm(r,e,t)}function ik(s){for(const e in s){const i=s[e].clone;if(!(!i?.isObject3D||!i?.userData?.components))for(let n=0;n<i.userData.components.length;n++){const o=i.userData.components[n],r=Object.entries(o);for(const[a,l]of r){if(l==null||typeof l!="object"&&typeof l!="string")continue;const h=pr(a,l,s);h!==void 0&&(o[a]=h)}}}}function ob(s,e){mw(s,e)}function mw(s,e){if(s.userData?.components)for(const t of s.userData.components)t!==null&&gm(t,e);if(s.children)for(const t of s.children)mw(t,e)}function gm(s,e,t){if(t||(t=new WeakSet),!t.has(s)){t.add(s);for(const i of Object.keys(s)){const n=s[i];if(n!=null){if(typeof n=="string")e[n]&&(s[i]=e[n]);else if(Array.isArray(n))for(let o=0;o<n.length;o++)typeof n[o]=="string"&&e[n[o]]?n[o]=e[n[o]]:typeof n[o]=="object"&&n[o]!==null&&gm(n[o],e,t);else if(typeof n=="object"){if(n.isObject3D||n.isComponent)continue;gm(n,e,t)}}}}}function pr(s,e,t){if(e!==void 0){if(e===null)return null;if(typeof e=="string"){const i=t[e];return i?i.clone:void 0}if(typeof e=="object"){if(Mu(e))return nk(e,t);if(e.isObject3D===!0){if(s==="gameObject")return;const i=e.uuid,n=t[i]?.clone;return n?(ar&&console.log(s,"old",e,"new",n),n):void 0}if(hk(e))return e.clone();if(Array.isArray(e))return sk(s,e,t);if(e instanceof Map)return ok(e,t);if(e instanceof Set)return rk(e,t);if(!(e instanceof WeakMap||e instanceof WeakSet)){if(D1(e)&&e.$serializedTypes)return ak(e,t);if(ck(e))return lk(s,e,t)}}}}function nk(s,e){const t=s.gameObject;if(!t)return;const i=t.uuid,n=e[i]?.clone;if(!n){ar&&console.log("Component reference did not change (external)",s);return}const o=t.userData.components.indexOf(s);if(o>=0&&n.isObject3D)return ar&&console.log("Resolved component",i,"at index",o),n.userData.components[o];console.warn("Could not find component at expected index",s)}function sk(s,e,t){const i=[];for(let n=0;n<e.length;n++){const o=e[n];if(o==null){i.push(o);continue}if(typeof o!="object"&&typeof o!="string"){i.push(o);continue}const r=pr(s,o,t);i.push(r!==void 0?r:o)}return i}function ok(s,e){const t=new Map;let i=!1;for(const[n,o]of s){let r=n,a=o;if(typeof n=="object"&&n!==null){const l=pr("",n,e);l!==void 0&&(r=l,i=!0)}if(typeof o=="object"&&o!==null){const l=pr("",o,e);l!==void 0&&(a=l,i=!0)}t.set(r,a)}return t}function rk(s,e){const t=new Set;for(const i of s)if(typeof i=="object"&&i!==null){const n=pr("",i,e);t.add(n!==void 0?n:i)}else t.add(i);return t}function ak(s,e){const t=Object.assign(Object.create(Object.getPrototypeOf(s)),s);let i=!1;for(const n in t.$serializedTypes){const o=t[n];if(o!=null&&typeof o=="object"){ar&&console.log("Recursively resolve references for",n,o);const r=pr(n,o,e);r!==void 0&&(t[n]=r,i=!0)}}return i?t:void 0}function lk(s,e,t){let i=!1;const n={...e};for(const o of Object.keys(n)){const r=n[o];if(r==null||typeof r!="object"&&typeof r!="string")continue;const a=pr(o,r,t);a!==void 0&&(n[o]=a,i=!0)}return i?n:void 0}function ck(s){if(typeof s!="object"||s===null)return!1;const e=Object.getPrototypeOf(s);return e===Object.prototype||e===null}function hk(s){return s.isVector2===!0||s.isVector3===!0||s.isVector4===!0||s.isQuaternion===!0||s.isEuler===!0||s.isColor===!0||s.isMatrix2===!0||s.isMatrix3===!0||s.isMatrix4===!0}const gw=new Map;function yw(s,e){if(!s)return;if(!e){console.warn("No prototype found",s,s.prototype,s.constructor);return}const t=gw.get(e);t&&t.apply(s)}function Ag(s){const e=dk(s.prototype);gw.set(s,e)}function dk(s){return new uk(s)}class uk{$symbol;extensions;descriptors;constructor(e){this.$symbol=Symbol("prototype-extension"),this.extensions=Object.keys(e),this.descriptors=new Array;for(let t=0;t<this.extensions.length;t++){const i=this.extensions[t],n=Object.getOwnPropertyDescriptor(e,i);n&&this.descriptors.push(n)}}apply(e){if(!e[this.$symbol]){e[this.$symbol]=!0;for(let t=0;t<this.extensions.length;t++){const i=this.extensions[t],n=this.descriptors[t];n&&Object.defineProperty(e,i,n)}}}}function Bu(s){s&&s.isObject3D===!0&&yw(s,c.Object3D)}let rb=!1;function fk(){if(rb)return;if(rb=!0,hg.experimentalSmartHierarchyUpdate){const i=c.Object3D.prototype.add;c.Object3D.prototype.add=function(...r){return op(),i.apply(this,r)};const n=c.Object3D.prototype.attach;c.Object3D.prototype.attach=function(...r){return op(),n.apply(this,r)};const o=c.Object3D.prototype.remove;c.Object3D.prototype.remove=function(...r){return op(),o.apply(this,r)}}c.Object3D.prototype.SetActive=function(i){this.visible=i},c.Object3D.prototype.setActive=function(i){this.visible=i},c.Object3D.prototype.destroy=function(){xi(this)},c.Object3D.prototype.addComponent=function(i,n){return Wn(this,i,n)},c.Object3D.prototype.addNewComponent=function(i,n){return Wn(this,i,n)},c.Object3D.prototype.removeComponent=function(i){return jg(this,i)},c.Object3D.prototype.getOrAddComponent=function(i,n){return Jc(this,i,n)},c.Object3D.prototype.getComponent=function(i){return So(this,i)},c.Object3D.prototype.getComponents=function(i,n){return Xa(this,i,n)},c.Object3D.prototype.getComponentInChildren=function(i,n=!1){return eh(this,i,n)},c.Object3D.prototype.getComponentsInChildren=function(i,n){return Qa(this,i,n)},c.Object3D.prototype.getComponentInParent=function(i,n=!1){return Tc(this,i,n)},c.Object3D.prototype.getComponentsInParent=function(i,n){return Uu(this,i,n)},Object.getOwnPropertyDescriptor(c.Object3D.prototype,"activeSelf")||Object.defineProperty(c.Object3D.prototype,"activeSelf",{get:function(){return qa(this)},set:function(i){cc(this,i)}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"raycastAllowed")||Object.defineProperty(c.Object3D.prototype,"raycastAllowed",{get:function(){return this.userData&&this.userData.raycastAllowed!==!1},set:function(i){const n=this;n.userData||(n.userData={}),n.userData.raycastAllowed=i}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldPosition")||Object.defineProperty(c.Object3D.prototype,"worldPosition",{get:function(){return this instanceof X.TransformControlsGizmo?J(this.object):J(this)},set:function(i){At(this,i)}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldQuaternion")||Object.defineProperty(c.Object3D.prototype,"worldQuaternion",{get:function(){return this instanceof X.TransformControlsGizmo?ge(this.object):ge(this)},set:function(i){un(this,i)}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldRotation")||Object.defineProperty(c.Object3D.prototype,"worldRotation",{get:function(){return Cu(this)},set:function(i){$v(this,i)}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldScale")||Object.defineProperty(c.Object3D.prototype,"worldScale",{get:function(){return je(this)},set:function(i){Ra(this,i)}});const s=new c.Matrix4,e=new c.Vector3(0,0,0),t=new c.Vector3(0,1,0);Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldForward")||Object.defineProperty(c.Object3D.prototype,"worldForward",{get:function(){return F().set(0,0,1).applyQuaternion(ge(this))},set:function(i){const n=si().setFromRotationMatrix(s.lookAt(e.set(0,0,0),i,t.set(0,1,0)));this.worldQuaternion=n}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldRight")||Object.defineProperty(c.Object3D.prototype,"worldRight",{get:function(){return F().set(1,0,0).applyQuaternion(ge(this))}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"worldUp")||Object.defineProperty(c.Object3D.prototype,"worldUp",{get:function(){return F().set(0,1,0).applyQuaternion(ge(this))}}),Object.getOwnPropertyDescriptor(c.Object3D.prototype,"contains")||Object.defineProperty(c.Object3D.prototype,"contains",{value:function(i){if(!i)return!1;if(this===i)return!0;for(const n of this.children)if(n.contains(i))return!0;return!1}}),Ag(c.Object3D)}const Od=x("debuggetcomponent"),pk=x("debuginstantiate");class Qn{idProvider;parent;keepWorldPosition;position;rotation;scale;visible;context;components;clone(){const e=new Qn;return e.idProvider=this.idProvider,e.parent=this.parent,e.keepWorldPosition=this.keepWorldPosition,e.position=Array.isArray(this.position)?[...this.position]:this.position?.clone(),e.rotation=Array.isArray(this.rotation)?[...this.rotation]:this.rotation?.clone(),e.scale=Array.isArray(this.scale)?[...this.scale]:this.scale?.clone(),e.visible=this.visible,e.context=this.context,e.components=this.components,e}cloneAssign(e){this.idProvider=e.idProvider,this.parent=e.parent,this.keepWorldPosition=e.keepWorldPosition,this.position=Array.isArray(e.position)?[...e.position]:e.position?.clone(),this.rotation=Array.isArray(e.rotation)?[...e.rotation]:e.rotation?.clone(),this.scale=Array.isArray(e.scale)?[...e.scale]:e.scale?.clone(),this.visible=e.visible,this.context=e.context,this.components=e.components}}function qa(s){return s.visible}function cc(s,e){return typeof e=="number"&&(e=e>.5),s.visible=e,s.visible}function _w(s){return s[jn]||Fu(s)}function bw(s,e){s[fw]=e}function Fu(s){return Wi.isUsingInstancing(s)}function Dg(s,e){return wc(s,e,!0,!0)}const vw=Symbol("isDestroyed");function mr(s){return s[vw]}function ww(s,e){s[vw]=e}const ym=Symbol("isDontDestroy");function oa(s,e=!0){s[ym]=e}const Md=[],Ed=[];function xi(s,e=!0,t=!1){Md.length=0,Ed.length=0,_m(s,e,!0);for(const i of Md)i.gameObject=null,i.context=null;for(const i of Ed)ww(i,!0),t&&xe(i);Ed.length=0,Md.length=0}function _m(s,e=!0,t=!0){if(s==null)return;const i=s;if(i.isComponent){if(i[ym])return;Md.push(i);const r=i.gameObject;i.__internalDisable?.(),i.__internalDestroy?.(),i.gameObject=r;return}if(s[ym])return;const n=s;Od&&console.log(n),Ed.push(n);const o=n.userData?.components;if(o!=null&&Array.isArray(o)){let r=o.length;for(let a=0;a<o.length;a++){const l=o[a];_m(l,e,!1),o.length<r&&(r=o.length,a--)}}if(e&&n.children)for(const r of n.children)_m(r,e,!1);t&&n.removeFromParent()}function gr(s,e,t=!0){return xw(s,e,t)}function*Ig(s,e,t=!1,i=999,n=0){if(s?.userData.components&&!(n>i)){for(const o of s.userData.components)e&&o?.isComponent===!0&&o instanceof e?yield o:yield o;if(t===!0)for(const o of s.children)yield*Ig(o,e,!0,i,n+1)}}function xw(s,e,t,i=0){if(s){if(s.isObject3D,i>1e3){console.warn("Failed to iterate components: too many levels");return}if(s.userData?.components)for(let n=0;n<s.userData.components.length;n++){const o=s.userData.components[n];if(o?.isComponent===!0){const r=e(o);if(r!==void 0)return r}}if(t&&s.children){const n=i+1;for(let o=0;o<s.children.length;o++){const r=s.children[o];if(!r)continue;const a=xw(r,e,t,n);if(a!==void 0)return a}}}}function po(s,e){if("isAssetReference"in s)return s.instantiate(e??void 0);let t=null;e!=null&&(e.x!==void 0?(t=new Qn,t.position=e):t=e);let i=U.Current;t?.context&&(i=t.context),Od&&i.alias&&console.log("context",i.alias),t&&!t.idProvider&&(t.idProvider=new nt(Date.now()));const n=[],o={},r={},a=Sw(i,s,t,n,o,r);a&&(ik(o),gk(r,o)),Od&&(qd(s,!0),qd(a,!0));const l={};for(const h in o){const d=o[h],u=d.original,f=d.clone;u instanceof c.Object3D&&f instanceof c.Object3D&&(l[u.guid||u.uuid]=f.guid||f.uuid)}if(t?.components!==!1){for(const h in n){const d=n[h],u=d.guid;t&&t.idProvider&&(d.guid=t.idProvider.generateUUID(),l[u]=d.guid,Od&&console.log(d.name,d.guid)),Lu(d,i),d.__internalNewInstanceCreated&&d.__internalNewInstanceCreated()}for(const h in n){const d=n[h];d.enabled!==!1&&(d.enabled=!0)}ru(i)}return a}function Sw(s,e,t,i,n,o){if(!e||e[yi])return null;const r=e.userData;e.userData={};const a=e.children;e.children=[];const l=e.clone(!1);Bu(l),e.userData=r,e.children=a;const h={original:e,clone:l};if(n[e.uuid]=h,e.guid&&e.guid!==e.uuid&&(n[e.guid]=h),pk&&console.log("ADD",e,l),e.type==="SkinnedMesh"&&(o[e.uuid]={original:e,clone:l}),t?.visible!==void 0&&(l.visible=t.visible),t?.idProvider){l.uuid=t.idProvider.generateUUID();const u=l;u&&(u.guid=l.uuid)}e.animations&&e.animations.length>0&&(l.animations=[...e.animations]);const d=e.parent;if(d&&d.add(l),t?.position)if(Array.isArray(t.position)){const u=new c.Vector3;u.fromArray(t.position),l.worldPosition=u}else l.worldPosition=t.position;else l.position.copy(e.position);if(t?.rotation){if(t.rotation instanceof c.Quaternion)l.worldQuaternion=t.rotation;else if(t.rotation instanceof c.Euler)l.worldQuaternion=si().setFromEuler(t.rotation);else if(Array.isArray(t.rotation)){const u=new c.Euler;u.fromArray(t.rotation),l.worldQuaternion=si().setFromEuler(u)}}else l.quaternion.copy(e.quaternion);if(t?.scale)if(Array.isArray(t.scale)){const u=new c.Vector3;u.fromArray(t.scale),t.scale=u}else l.scale.copy(t.scale);else l.scale.copy(e.scale);if(t?.parent&&t.parent!=="scene"){let u=null;if(typeof t.parent=="string"?u=wc(t.parent,s.scene,!0):u=t.parent,u){const f=t.keepWorldPosition===!0?u.attach:u.add;f?f.call(u,l):console.error("Invalid parent object",u,"received when instantiating:",e)}else console.warn("could not find parent:",t.parent)}for(const[u,f]of Object.entries(e.userData))u!=="components"&&(l.userData[u]=f);if(e.userData?.components){const u=e.userData.components,f=[];l.userData.components=f;for(let m=0;m<u.length;m++){const g=u[m],b=new g.constructor;mk(g,b),g[oc]!==void 0&&(b[oc]=g[oc]),f.push(b),b.gameObject=l,i.push(b),n[g.guid]={original:g,clone:b},Pu.dispatchComponentLifecycleEvent("component-added",b)}}t&&(t.position=void 0,t.rotation=void 0,t.scale=void 0,t.parent=void 0,t.visible=void 0);for(const u in e.children){const f=e.children[u],m=Sw(s,f,t,i,n,o);m&&(n[m.uuid]={original:f,clone:m},l.add(m))}return l}function mk(s,e,t){Ia(e,s,void 0,{})}function gk(s,e){for(const t in s){const i=s[t],n=i.original,o=n.skeleton,r=i.clone;if(!o){console.warn("Skinned mesh has no skeleton?",i);continue}const a=o.bones,l=r.skeleton.clone();r.skeleton=l,r.bindMatrix.clone().copy(n.bindMatrix),r.bindMatrixInverse.copy(n.bindMatrixInverse);const h=[];l.bones=h;for(let d=0;d<a.length;d++){const u=a[d],m=e[u.uuid].clone;h.push(m)}}for(const t in s){const i=s[t].clone;i.skeleton.update(),i.bind(i.skeleton,i.bindMatrix),i.updateMatrixWorld(!0)}}function hc(s,e){try{e||s()}catch(t){return console.error(t),!1}return!0}const bm=x("debugnewscripts"),yk=x("debughierarchy"),Pe=[];function _k(){return Pe.length>0}function ru(s){if(bm&&console.log("Register new components",s.new_scripts.length,[...s.new_scripts],s.alias?"element: "+s.alias:s.hash,s),s.new_scripts_pre_setup_callbacks.length>0){for(const e of s.new_scripts_pre_setup_callbacks)e&&e();s.new_scripts_pre_setup_callbacks.length=0}if(!(s.new_scripts.length<=0)){Pe.length=0,s.new_scripts.length>0&&Pe.push(...s.new_scripts),s.new_scripts.length=0;for(let e=0;e<Pe.length;e++)try{const t=Pe[e];if(t.isComponent!==!0){(T()||bm)&&console.error(`Registered script is not a Needle Engine component.
884
884
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
885
885
  `,t),Pe.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.warn(`Component can not be initialized: no GameObject assigned.
@@ -1730,4 +1730,4 @@ Needle Engine: finished loading `+i+`
1730
1730
  ---------------------------------
1731
1731
  • `+r.passes.map(u=>u.name||u.constructor.name+"*").join(`
1732
1732
  • `)+`
1733
- `),ei&&this._onCreateEffectsDebug(this._composer,o)}createPassForMergeableEffects(e,t,i,n){if(e.length>0){const o=new A.POSTPROCESSING.MODULE.EffectPass(i,...e);o.name=e.map(r=>r.name).join(", "),o.mainScene=n,o.enabled=!0,o.renderToScreen=!1,t.addPass(o),e.length=0}}handleDevicePixelRatio(){typeof this.context.devicePixelRatio=="number"&&this.context.requestSizeUpdate()}_menuEntry=null;_passIndices=null;_onCreateEffectsDebug(e,t){if(ei==="passes"){const i=new A.POSTPROCESSING.MODULE.DepthEffect({blendFunction:A.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});i.name="Depth Effect";const n=new A.POSTPROCESSING.MODULE.EffectPass(t,i);if(n.name="Depth Effect Pass",n.enabled=!1,e.passes.push(n),this._passIndices!==null){const r=[e.passes[0]];this._passIndices.length>0&&r.push(...this._passIndices.filter(a=>a!==0).map(a=>e.passes[a]).filter(a=>a)),r.length>0&&console.log("[PostProcessing] Passes (selected) →",r),e.passes.length=0;for(const a of r)a.enabled=!0,a.renderToScreen=!1,e.addPass(a)}const o=this.context.menu;if(o&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const r=document.createElement("select");r.multiple=!0;const a=document.createElement("option");a.innerText="Final Output",a.value="-1",r.appendChild(a);for(const l of e.passes){const h=document.createElement("option");h.innerText=l.name,h.value=`${e.passes.indexOf(l)}`,h.title=l.name,r.appendChild(h)}o.appendChild(r),this._menuEntry=r,r.addEventListener("change",()=>{const l=Array.from(r.selectedOptions).map(h=>parseInt(h.value));l.length===1&&l[0]===-1?this._passIndices=null:this._passIndices=l,this.applyEffects(this.context)})}}}}const LD=Object.freeze(Object.defineProperty({__proto__:null,PostProcessingHandler:Ga},Symbol.toStringTag,{value:"Module"}));class Lf{_name;_tracks=[];_currentTrack=null;_pendingSignals=[];_idProvider;constructor(e,t){this._name=e,this._idProvider=new nt(t??Date.now())}static create(e,t){return new Lf(e??"Timeline",t)}animationTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Animation,t??null),this}audioTrack(e,t,i){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Audio,t??null),this._currentTrack.volume=i,this}activationTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Activation,t??null),this}controlTrack(e){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Control,null),this}signalTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Signal,t??null),this}markerTrack(e){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Marker,null),this}clip(e,t){if(!this._currentTrack)throw new Error("TimelineBuilder: .clip() must be called after a track method (e.g. .animationTrack())");this.commitInlineTracks();const i=this._currentTrack;switch(i.type){case me.Animation:{let n;if(e instanceof c.AnimationClip)n=e;else{const d=Array.isArray(e)?e:[e],u=i.outputs[0],f=u instanceof c.Object3D?u:u!=null&&"gameObject"in u?u.gameObject:void 0;n=Ac(d,f)}const o=t??{},r=o.duration??n.duration,a=o.start??i.cursor,l=a+r,h={start:a,end:l,duration:r,timeScale:o.speed??1,clipIn:o.clipIn??0,easeInDuration:o.easeIn??0,easeOutDuration:o.easeOut??0,preExtrapolationMode:o.preExtrapolation??Qe.None,postExtrapolationMode:o.postExtrapolation??Qe.None,reversed:o.reversed,asset:{clip:n,loop:o.loop??!1,duration:n.duration,removeStartOffset:o.removeStartOffset??!1}};i.clips.push(h),i.cursor=l;break}case me.Audio:{const n=e,o=t??{},r=o.duration,a=o.start??i.cursor,l=a+r,h={start:a,end:l,duration:r,timeScale:o.speed??1,clipIn:0,easeInDuration:o.easeIn??0,easeOutDuration:o.easeOut??0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{clip:n,loop:o.loop??!1,volume:o.volume??1}};i.clips.push(h),i.cursor=l;break}case me.Activation:{const n=e,o=n.start??i.cursor,r=o+n.duration,a={start:o,end:r,duration:n.duration,timeScale:1,clipIn:0,easeInDuration:n.easeIn??0,easeOutDuration:n.easeOut??0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{}};i.clips.push(a),i.cursor=r;break}case me.Control:{const n=e,o=t??{},r=o.start??i.cursor,a=o.duration,l=r+a,h={start:r,end:l,duration:a,timeScale:1,clipIn:0,easeInDuration:0,easeOutDuration:0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{sourceObject:n,controlActivation:o.controlActivation??!0,updateDirector:o.updateDirector??!0}};i.clips.push(h),i.cursor=l;break}default:throw new Error(`TimelineBuilder: .clip() is not supported on track type "${i.type}"`)}return this}marker(e,t,i){if(!this._currentTrack)throw new Error("TimelineBuilder: .marker() must be called after a track method");if(this._currentTrack.type!==me.Signal&&this._currentTrack.type!==me.Marker)throw new Error(`TimelineBuilder: .marker() is only supported on signal and marker tracks, not "${this._currentTrack.type}"`);const n={type:jc.Signal,time:e,retroActive:i?.retroActive??!1,emitOnce:i?.emitOnce??!1,asset:t};return this._currentTrack.markers.push(n),e>this._currentTrack.cursor&&(this._currentTrack.cursor=e),this}signal(e,t,i){if(!this._currentTrack)throw new Error("TimelineBuilder: .signal() must be called after a track method");if(this._currentTrack.type!==me.Signal&&this._currentTrack.type!==me.Marker)throw new Error(`TimelineBuilder: .signal() is only supported on signal and marker tracks, not "${this._currentTrack.type}"`);const n=this._idProvider.generateUUID(),o=this._tracks.indexOf(this._currentTrack),r={type:jc.Signal,time:e,retroActive:i?.retroActive??!1,emitOnce:i?.emitOnce??!1,asset:n};return this._currentTrack.markers.push(r),this._pendingSignals.push({trackIndex:o,guid:n,callback:t}),e>this._currentTrack.cursor&&(this._currentTrack.cursor=e),this}muted(e=!0){if(!this._currentTrack)throw new Error("TimelineBuilder: .muted() must be called after a track method");return this._currentTrack.muted=e,this}track(e,t,i,n){if(!this._currentTrack)throw new Error("TimelineBuilder: .track() must be called after .animationTrack()");if(this._currentTrack.type!==me.Animation)throw new Error("TimelineBuilder: .track() is only supported on animation tracks");return this._currentTrack.inlineTracks.push(Bg(e,t,i,n)),this}build(){this.commitInlineTracks();const e=this._tracks.map(t=>{const i={name:t.name,type:t.type,muted:t.muted,outputs:t.outputs};return t.clips.length>0&&(i.clips=t.clips),t.markers.length>0&&(i.markers=t.markers),t.volume!==void 0&&(i.volume=t.volume),t.trackOffset!==void 0&&(i.trackOffset=t.trackOffset),i});return{name:this._name,tracks:e}}install(e){const t=this.build();if(this._pendingSignals.length>0){const i=e.gameObject;let n=C.getComponent(i,_r);n||(n=C.addComponent(i,_r)),n.events||(n.events=[]);for(const o of this._pendingSignals){const r=new nh;r.guid=o.guid;const a=new Ka;a.signal=r,a.reaction=new Z([o.callback]),n.events.push(a);const l=t.tracks[o.trackIndex];l&&!l.outputs.includes(n)&&l.outputs.push(n)}}return e.playableAsset=t,t}pushTrack(e,t,i){const n={name:e,type:t,muted:!1,outputs:i?[i]:[],clips:[],markers:[],cursor:0,inlineTracks:[]};return this._tracks.push(n),n}commitInlineTracks(){if(!this._currentTrack||this._currentTrack.inlineTracks.length===0)return;const e=this._currentTrack,t=e.outputs[0],i=t instanceof c.Object3D?t:t!=null&&"gameObject"in t?t.gameObject:void 0,n=Ac(e.inlineTracks,i),o=e.cursor,r=n.duration,a={start:o,end:o+r,duration:r,timeScale:1,clipIn:0,easeInDuration:0,easeOutDuration:0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{clip:n,loop:!1,duration:n.duration,removeStartOffset:!1}};e.clips.push(a),e.cursor=o+r,e.inlineTracks=[]}}class wS{}const jD=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:ue,ActionCollection:Px,ActionModel:ni,AlignmentConstraint:oh,Animation:It,AnimationBuilder:zu,AnimationCurve:_h,AnimationExtension:of,Animator:dt,AnimatorController:Bn,Antialiasing:vh,Attractor:ul,AudioExtension:Er,AudioListener:ps,AudioSource:Si,Avatar:go,AvatarMarker:Ye,AxesHelper:Za,BaseUIComponent:Hi,BasicIKConstraint:qg,BehaviorExtension:wy,BehaviorModel:Pt,BloomEffect:vf,BoxCollider:Zu,BoxGizmo:Dr,BoxHelperComponent:St,Button:js,CallInfo:Fn,Camera:ci,CameraTargetReachedEvent:Lc,Canvas:$a,CanvasGroup:yo,CapsuleCollider:xs,ChangeMaterialOnClick:py,ChangeTransformOnClick:Tr,CharacterController:Or,CharacterControllerInput:ks,ChromaticAberration:wh,ClickThrough:Rf,ColorAdjustments:To,ColorBySpeedModule:dl,ColorOverLifetimeModule:yf,ContactShadows:rh,CursorFollow:Vr,CustomBranding:Ar,Deletable:Kg,DeleteBox:co,DepthOfField:bn,DeviceFlag:Ju,DocumentExtension:vS,DragControls:er,DropListener:Ms,Duplicatable:oy,EffectWrapper:$c,EmissionModule:As,EmphasizeOnClick:il,EnvironmentScene:Yu,EventList:Z,EventListEvent:Fg,EventSystem:Qt,EventTrigger:nf,FieldWithDefault:rx,FixedJoint:Ly,Fog:al,GltfExport:hy,GltfExportBox:ly,Gradient:Lr,Graphic:mh,GraphicRaycaster:Wu,GridHelper:ll,GridLayoutGroup:Oy,GroundProjectedEnv:Yn,GroupActionModel:tr,HideOnStart:Ui,HingeJoint:yh,HorizontalLayoutGroup:ky,get HoverAnimation(){return exports.HoverAnimation},Image:_l,InheritVelocityModule:zy,InputField:Zy,InstanceHandle:dr,InstancingHandler:wr,Interactable:Yg,Keyframe:hi,LODGroup:pf,LODModel:cl,Light:Ot,LimitVelocityOverLifetimeModule:rt,LogStats:Qg,LookAt:Jy,LookAtConstraint:Pr,MainModule:Bt,MaskableGraphic:gh,MeshCollider:Co,MeshRenderer:ch,MinMaxCurve:q,MinMaxGradient:jr,NeedleMenu:Jn,NestedGltf:hl,Networking:Fy,NoiseModule:pe,ObjectRaycaster:Gi,OffsetConstraint:Ir,OpenURL:bl,OrbitControls:ce,Outline:rl,Padding:Rr,ParticleBurst:_u,ParticleSubEmitter:Ny,ParticleSystem:Nc,ParticleSystemRenderer:Yi,PhysicsExtension:xy,PixelationEffect:xh,PlayAnimationOnClick:Uc,PlayAudioOnClick:mo,PlayableDirector:za,PlayerColor:Va,PointerEventData:ih,PostProcessingHandler:Ga,PreliminaryAction:nl,PreliminaryTrigger:dh,RawImage:Mf,Rect:Ix,RectTransform:mn,ReflectionProbe:cs,RegisteredAnimationInfo:ao,RemoteSkybox:Ku,Renderer:Yt,RendererLightmap:iy,Rigidbody:We,RotationBySpeedModule:Qi,RotationOverLifetimeModule:_n,SceneSwitcher:Ge,ScreenCapture:Ro,ScreenSpaceAmbientOcclusion:Ds,ScreenSpaceAmbientOcclusionN8:vn,ScrollFollow:Bs,SeeThrough:Is,SetActiveOnClick:my,ShadowCatcher:Oh,ShapeModule:Uy,SharpeningEffect:Ch,SignalAsset:nh,SignalReceiver:_r,SignalReceiverEvent:Ka,SignalTrackHandler:Fc,Size:Dx,SizeBySpeedModule:mi,SizeOverLifetimeModule:Br,SkinnedMeshRenderer:ny,SmoothFollow:Sf,SpatialGrabRaycaster:yr,SpatialHtml:Rh,SpatialTrigger:Cf,SpatialTriggerReceiver:Hn,SpectatorCamera:Pf,SphereCollider:Ja,SplineContainer:Nr,SplineData:qn,SplineWalker:Zi,Sprite:Es,SpriteData:Ea,SpriteRenderer:fi,SpriteSheet:Na,SubEmitterSystem:bu,SyncedCamera:Xy,SyncedRoom:wn,SyncedTransform:pn,TapGestureTrigger:yy,TeleportTarget:hf,TestRunner:Qy,TestSimulateUserData:Yy,Text:jt,TextBuilder:Cy,TextExtension:uf,TextureSheetAnimationModule:Ft,TiltShiftEffect:ts,TimelineActivationTrack:qu,TimelineAnimationTrack:Bc,TimelineAudioTrack:ms,TimelineBuilder:Lf,TimelineControlTrack:Xu,TimelineMarkerTrack:Hu,ToneMappingEffect:_o,TrailModule:Ie,TransformData:Ae,TransformGizmo:$r,TriggerBuilder:Dt,TriggerModel:ho,UIRaycastUtils:zg,UIRootComponent:fh,USDZExporter:Gn,USDZText:_a,USDZUIExtension:Ey,UsageMarker:ah,VariantAction:fy,VelocityOverLifetimeModule:Ue,VerticalLayoutGroup:Py,VideoPlayer:st,get ViewBox(){return exports.ViewBox},Vignette:zr,VisibilityAction:uh,Voip:Ls,Volume:pl,VolumeParameter:z,VolumeProfile:_f,WebARCameraBackground:Dh,WebARSessionRoot:$i,WebXR:df,WebXRImageTracking:Ih,WebXRImageTrackingModel:Us,WebXRPlaneTracking:zs,WebXRTrackedImage:Wa,XRControllerFollow:Fs,XRControllerModel:Ss,XRControllerMovement:Pi,XRFlag:cn,XRRig:If,XRState:qt,__Ignore:wS},Symbol.toStringTag,{value:"Module"}));exports.SplineUtils=void 0;(s=>{function e(t,i=!1,n=.75){const o=new Nr,r=1-j.clamp(n,0,1);return t.forEach((a,l)=>{const h=new c.Vector3;l<t.length-1?h.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&h.subVectors(t[0],a).normalize().multiplyScalar(r);const d=new qn;d.position.copy(a),d.tangentIn.copy(h),d.tangentOut.copy(h),o.addKnot(d)}),o.closed=i,o}s.createFromPoints=e})(exports.SplineUtils||(exports.SplineUtils={}));class BD extends de.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-DiCnZlf3.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:va&&va.tagName.toUpperCase()==="SCRIPT"&&va.src||new URL("needle-engine.bundle-CqUYvUIH.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,o)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=h=>{o(new Error(`[GenerateMeshBVHWorker] ${h.message||"Could not load worker."}`))},e.onmessage=h=>{const{data:d}=h;if(d.error)o(new Error(d.error)),e.onmessage=null;else if(d.serialized){const{serialized:u,position:f}=d,m=de.MeshBVH.deserialize(u,t,{setIndex:!1}),g=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=f,u.index)if(t.index)t.index.array=u.index;else{const b=new c.BufferAttribute(u.index,1,!1);t.setIndex(b)}g.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new c.Box3)),i.onProgress&&i.onProgress(d.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(d.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const FD=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:BD},Symbol.toStringTag,{value:"Module"}));exports.$componentName=Qd;exports.$physicsKey=i1;exports.ActionBuilder=ue;exports.ActionCollection=Px;exports.ActionModel=ni;exports.Addressables=k0;exports.AlignmentConstraint=oh;exports.AmbientMode=Ca;exports.Animation=It;exports.AnimationBuilder=zu;exports.AnimationCurve=_h;exports.AnimationExtension=of;exports.Animator=dt;exports.AnimatorConditionMode=ri;exports.AnimatorController=Bn;exports.AnimatorControllerBuilder=Nu;exports.AnimatorControllerParameterType=Jo;exports.AnimatorStateInfo=Xl;exports.Antialiasing=vh;exports.Application=fn;exports.AssetDatabase=aw;exports.AssetReference=Y;exports.Attractor=ul;exports.AudioClip=km;exports.AudioExtension=Er;exports.AudioListener=ps;exports.AudioSource=Si;exports.Avatar=go;exports.AvatarMarker=Ye;exports.Axes=ga;exports.AxesHelper=Za;exports.BUILD_TIME=xc;exports.BaseUIComponent=Hi;exports.BasicIKConstraint=qg;exports.BehaviorExtension=wy;exports.BehaviorModel=Pt;exports.BloomEffect=vf;exports.BoxCollider=Zu;exports.BoxGizmo=Dr;exports.BoxHelperComponent=St;exports.Button=js;exports.ButtonsFactory=Ni;exports.CallDirection=Qx;exports.CallInfo=Fn;exports.Camera=ci;exports.CameraTargetReachedEvent=Lc;exports.Canvas=$a;exports.CanvasGroup=yo;exports.CapsuleCollider=xs;exports.ChangeMaterialOnClick=py;exports.ChangeTransformOnClick=Tr;exports.CharacterController=Or;exports.CharacterControllerInput=ks;exports.ChromaticAberration=wh;exports.CircularBuffer=wi;exports.ClearFlags=hr;exports.ClickThrough=Rf;exports.ClipExtrapolation=Qe;exports.Collider=Mi;exports.Collision=o0;exports.CollisionDetectionMode=Vu;exports.ColorAdjustments=To;exports.ColorBySpeedModule=dl;exports.ColorOverLifetimeModule=yf;exports.Component=Ak;exports.Component$1=R;exports.ComponentLifecycleEvents=Pu;exports.Components=jD;exports.ConnectionEvents=j0;exports.ContactPoint=s0;exports.ContactShadows=rh;exports.Context=U;exports.ContextArgs=VP;exports.ContextEvent=le;exports.ContextRegistry=ae;exports.CursorFollow=Vr;exports.CustomBranding=Ar;exports.CustomShader=we;exports.DefaultReflectionMode=iu;exports.Deletable=Kg;exports.DeleteBox=co;exports.DepthOfField=bn;exports.DeviceFlag=Ju;exports.DirectorWrapMode=Gw;exports.DisposableStore=Ad;exports.DocumentExtension=vS;exports.DragControls=er;exports.DragMode=Zg;exports.DropListener=Ms;exports.Duplicatable=oy;exports.EffectWrapper=$c;exports.EmissionModule=As;exports.EmphasizeOnClick=il;exports.EngineLoadingView=Vc;exports.EnvironmentScene=Yu;exports.EventBus=am;exports.EventList=Z;exports.EventListEvent=Fg;exports.EventSystem=Qt;exports.EventTrigger=nf;exports.FieldWithDefault=rx;exports.FileReference=or;exports.FileReferenceSerializer=M0;exports.FileSpawnModel=OM;exports.File_Event=Zw;exports.FixedJoint=Ly;exports.Fog=al;exports.FontStyle=gu;exports.FrameEvent=ye;exports.GENERATOR=Aa;exports.GameObject=C;exports.Gizmos=B;exports.GltfExport=hy;exports.GltfExportBox=ly;exports.Gradient=Lr;exports.Graphic=mh;exports.GraphicRaycaster=Wu;exports.Graphics=fo;exports.GridHelper=ll;exports.GridLayoutGroup=Oy;exports.GroundProjectedEnv=Yn;exports.GroupActionModel=tr;exports.HideFlags=Ou;exports.HideOnStart=Ui;exports.HingeJoint=yh;exports.HorizontalLayoutGroup=ky;exports.HorizontalWrapMode=Ux;exports.HostData=x1;exports.Image=_l;exports.ImageReference=sr;exports.ImageReferenceSerializer=O0;exports.InheritVelocityModule=zy;exports.Input=R0;exports.InputEventQueue=oi;exports.InputEvents=ke;exports.InputField=Zy;exports.InstanceHandle=dr;exports.InstancingHandler=wr;exports.InstancingUtil=Wi;exports.InstantiateEvent=p0;exports.InstantiateIdProvider=nt;exports.InstantiateOptions=Qn;exports.Interactable=Yg;exports.JoinedRoomResponse=tP;exports.KeyEventArgs=H1;exports.Keyframe=hi;exports.LODGroup=pf;exports.LODModel=cl;exports.LeftRoomResponse=iP;exports.Light=Ot;exports.LightData=W0;exports.LimitVelocityOverLifetimeModule=rt;exports.LoadingElementOptions=wD;exports.LogStats=Qg;exports.LogType=bi;exports.LookAt=Jy;exports.LookAtConstraint=Pr;exports.MODULES=A;exports.MainModule=Bt;exports.MarkerType=jc;exports.MaskableGraphic=gh;exports.MaterialPropertyBlock=bs;exports.Mathf=j;exports.MeshCollider=Co;exports.MeshRenderer=ch;exports.MinMaxCurve=q;exports.MinMaxGradient=jr;exports.NEEDLE_ENGINE_FEATURE_FLAGS=hg;exports.NEKeyboardEvent=Gl;exports.NEPointerEvent=ls;exports.NeedleButtonElement=gS;exports.NeedleEngineWebComponent=o_;exports.NeedleMenu=Jn;exports.NeedlePatchesKey=xd;exports.NeedleXRController=Pg;exports.NeedleXRSession=H;exports.NeedleXRSync=Q0;exports.NeedleXRUtils=rw;exports.NestedGltf=hl;exports.NetworkConnection=Cc;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=Ph;exports.Networking=Fy;exports.NewInstanceModel=g0;exports.NoiseModule=pe;exports.ObjectRaycaster=Gi;exports.ObjectUtils=wo;exports.OffsetConstraint=Ir;exports.OneEuroFilter=vd;exports.OneEuroFilterXYZ=tg;exports.OpenURL=bl;exports.OrbitControls=ce;exports.Outline=rl;exports.OwnershipEvent=B0;exports.OwnershipModel=F0;exports.PUBLIC_KEY=oo;exports.Padding=Rr;exports.ParticleBurst=_u;exports.ParticleSubEmitter=Ny;exports.ParticleSystem=Nc;exports.ParticleSystemBaseBehaviour=Eo;exports.ParticleSystemRenderer=Yi;exports.ParticleSystemShapeType=yu;exports.PeerHandle=gs;exports.PeerNetworking=L0;exports.Physics=Ua;exports.PhysicsExtension=xy;exports.PhysicsMaterialCombine=at;exports.PixelationEffect=xh;exports.PlayAnimationOnClick=Uc;exports.PlayAudioOnClick=mo;exports.PlayableDirector=za;exports.PlayerColor=Va;exports.PlayerState=ai;exports.PlayerStateEvent=Mx;exports.PlayerSync=by;exports.PlayerView=U0;exports.PlayerViewManager=z0;exports.PointerEventData=ih;exports.PointerType=Ru;exports.PostProcessing=X0;exports.PostProcessingEffect=Ze;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=Ga;exports.Prefabs=Da;exports.PreliminaryAction=nl;exports.PreliminaryTrigger=dh;exports.PrimitiveType=Ha;exports.Progress=oe;exports.PromiseAllWithErrors=Jm;exports.PromiseErrorResult=Gp;exports.RGBAColor=ie;exports.RapierPhysics=Ta;exports.RawImage=Mf;exports.RaycastOptions=xo;exports.Rect=Ix;exports.RectTransform=mn;exports.ReflectionProbe=cs;exports.RegisteredAnimationInfo=ao;exports.RemoteSkybox=Ku;exports.RenderTexture=Un;exports.RenderTextureSerializer=jw;exports.Renderer=Yt;exports.RendererData=V0;exports.RendererLightmap=iy;exports.Rigidbody=We;exports.RigidbodyConstraints=Ve;exports.RoomEvents=K;exports.RotationBySpeedModule=Qi;exports.RotationOverLifetimeModule=_n;exports.SceneLightSettings=du;exports.SceneSwitcher=Ge;exports.ScreenCapture=Ro;exports.ScreenSpaceAmbientOcclusion=Ds;exports.ScreenSpaceAmbientOcclusionN8=vn;exports.ScrollFollow=Bs;exports.SeeThrough=Is;exports.SendQueue=ln;exports.SerializationContext=bg;exports.SetActiveOnClick=my;exports.ShadowCatcher=Oh;exports.ShapeModule=Uy;exports.ShapeOverlapResult=r0;exports.SharpeningEffect=Ch;exports.SignalAsset=nh;exports.SignalReceiver=_r;exports.SignalReceiverEvent=Ka;exports.SignalTrackHandler=Fc;exports.Size=Dx;exports.SizeBySpeedModule=mi;exports.SizeOverLifetimeModule=Br;exports.SkinnedMeshRenderer=ny;exports.SmoothFollow=Sf;exports.SpatialGrabRaycaster=yr;exports.SpatialHtml=Rh;exports.SpatialTrigger=Cf;exports.SpatialTriggerReceiver=Hn;exports.SpectatorCamera=Pf;exports.SphereCollider=Ja;exports.SphereIntersection=Tg;exports.SplineContainer=Nr;exports.SplineData=qn;exports.SplineWalker=Zi;exports.Sprite=Es;exports.SpriteData=Ea;exports.SpriteRenderer=fi;exports.SpriteSheet=Na;exports.StateMachineBehaviour=Bk;exports.StreamEndedEvent=qy;exports.StreamReceivedEvent=Xx;exports.SubEmitterSystem=bu;exports.SyncedCamera=Xy;exports.SyncedRoom=wn;exports.SyncedTransform=pn;exports.TapGestureTrigger=yy;exports.TeleportTarget=hf;exports.TestRunner=Qy;exports.TestSimulateUserData=Yy;exports.Text=jt;exports.TextAnchor=Xe;exports.TextBuilder=Cy;exports.TextExtension=uf;exports.TextureSheetAnimationModule=Ft;exports.TiltShiftEffect=ts;exports.Time=G0;exports.TimelineActivationTrack=qu;exports.TimelineAnimationTrack=Bc;exports.TimelineAudioTrack=ms;exports.TimelineBuilder=Lf;exports.TimelineControlTrack=Xu;exports.TimelineMarkerTrack=Hu;exports.TimelineTrackHandler=kr;exports.ToneMappingEffect=_o;exports.TrackType=me;exports.TrailModule=Ie;exports.TransformData=Ae;exports.TransformGizmo=$r;exports.TriggerBuilder=Dt;exports.TriggerModel=ho;exports.TypeStore=P;exports.UIRaycastUtils=zg;exports.UIRootComponent=fh;exports.USDDocument=dy;exports.USDObject=Ke;exports.USDWriter=gx;exports.USDZExporter=yx;exports.USDZExporter$1=Gn;exports.USDZText=_a;exports.USDZUIExtension=Ey;exports.UriSerializer=Bw;exports.UsageMarker=ah;exports.UserJoinedOrLeftRoomModel=nP;exports.VERSION=li;exports.VariantAction=fy;exports.VelocityOverLifetimeModule=Ue;exports.VerticalLayoutGroup=Py;exports.VerticalWrapMode=Fx;exports.VideoPlayer=st;exports.ViewDevice=_s;exports.Vignette=zr;exports.VisibilityAction=uh;exports.Voip=Ls;exports.Volume=pl;exports.VolumeParameter=z;exports.VolumeProfile=_f;exports.WaitForFrames=$1;exports.WaitForPromise=T0;exports.WaitForSeconds=vg;exports.Watch=ys;exports.WebARCameraBackground=Dh;exports.WebARSessionRoot=$i;exports.WebXR=df;exports.WebXRButtonFactory=uo;exports.WebXRImageTracking=Ih;exports.WebXRImageTrackingModel=Us;exports.WebXRPlaneTracking=zs;exports.WebXRTrackedImage=Wa;exports.XRControllerFollow=Fs;exports.XRControllerModel=Ss;exports.XRControllerMovement=Pi;exports.XRFlag=cn;exports.XRRig=If;exports.XRState=qt;exports.XRStateFlag=In;exports.YUP=$n;exports._$SxmJTJik=Vn;exports._$nJruVQEw=Qc;exports.__Ignore=wS;exports.__internalNotifyObjectDestroyed=ZP;exports.activeInHierarchyFieldName=jn;exports.addAttributeChangeCallback=Km;exports.addComponent=Wn;exports.addCustomExtensionPlugin=KM;exports.addNewComponent=lr;exports.addPatch=ku;exports.apply=Bu;exports.applyHMRChanges=Ek;exports.applyPrototypeExtensions=yw;exports.beginListenDestroy=m0;exports.beginListenInstantiate=b0;exports.binaryIdentifierCasts=wg;exports.build_scene_functions=$P;exports.builtinComponentKeyName=Xo;exports.calculateProgress01=s_;exports.clearMessages=QS;exports.compareAssociation=x0;exports.copyTexture=Wv;exports.createMotion=Dw;exports.debugNet=ti;exports.debugOwner=sa;exports.decompressGpuTexture=wx;exports.deepClone=Gc;exports.delay=vs;exports.delayForFrames=xu;exports.deserializeObject=eu;exports.destroy=xi;exports.destroyComponentInstance=Ow;exports.determineMimeTypeFromExtension=Jw;exports.disposeObjectResources=xe;exports.disposeStream=hn;exports.editorGuidKeyName=oc;exports.enableSpatialConsole=wa;exports.exportAsGLTF=AD;exports.findByGuid=Dg;exports.findObjectOfType=Ya;exports.findObjectsOfType=Ew;exports.findResourceUsers=Rg;exports.fitCamera=Nw;exports.fitObjectIntoVolume=Hv;exports.foreachComponent=gr;exports.foreachComponentEnumerator=Ig;exports.forward=pC;exports.generateQRCode=iw;exports.generateSeed=_0;exports.getBoundingBox=di;exports.getCameraController=jv;exports.getComponent=So;exports.getComponentInChildren=eh;exports.getComponentInParent=Tc;exports.getComponents=Xa;exports.getComponentsInChildren=Qa;exports.getComponentsInParent=Uu;exports.getFormattedDate=ux;exports.getIconElement=ht;exports.getIconTexture=hm;exports.getLoader=ws;exports.getOrAddComponent=Jc;exports.getParam=x;exports.getParentHierarchyPath=yC;exports.getPath=OS;exports.getPeerOptions=Y1;exports.getPeerjsInstance=I0;exports.getResourceUserCount=ek;exports.getSceneData=$0;exports.getTempColor=zv;exports.getTempQuaternion=si;exports.getTempVector=F;exports.getUrlParams=Wc;exports.getVisibleInCustomShadowRendering=Gv;exports.getWorldDirection=Nv;exports.getWorldEuler=sg;exports.getWorldPosition=J;exports.getWorldQuaternion=ge;exports.getWorldRotation=Cu;exports.getWorldScale=je;exports.hasPointerEventComponent=lu;exports.hideDebugConsole=Yv;exports.imageToCanvas=xx;exports.initAddressableSerializers=E0;exports.initBuiltinSerializers=Fw;exports.initEngine=ED;exports.initPhysics=mS;exports.initVolumeParameterSerializer=qw;exports.instantiate=po;exports.invokeLoadedImportPluginHooks=ox;exports.invokeXRSessionEnd=tw;exports.invokeXRSessionStart=ew;exports.isActiveInHierarchy=_w;exports.isActiveSelf=qa;exports.isAndroidDevice=DS;exports.isAnimationAction=Vv;exports.isComponent=Mu;exports.isDebugMode=SS;exports.isDesktop=ES;exports.isDestroyed=mr;exports.isDevEnvironment=T;exports.isDisposable=Tk;exports.isDisposed=KP;exports.isExporting=TD;exports.isGLTFModel=n0;exports.isHostedOnGlitch=Cv;exports.isHotReloadEnabled=Cm;exports.isHotReloading=Ok;exports.isIPad=RS;exports.isIconElement=nw;exports.isLocalNetwork=vi;exports.isMacOS=LS;exports.isMobileDevice=TS;exports.isMozillaXR=IS;exports.isQuest=FS;exports.isResourceTrackingEnabled=cw;exports.isSafari=BS;exports.isTrackModel=NO;exports.isUsingInstancing=Fu;exports.isiOS=jS;exports.isiPad=AS;exports.loadAsset=dD;exports.loadPMREM=Gg;exports.loadSync=n_;exports.logHierarchy=qd;exports.lookAtInverse=rC;exports.lookAtObject=Hc;exports.lookAtScreenPoint=aC;exports.makeId=PS;exports.makeIdFromRandomWords=Ov;exports.makeNameSafe=Ci;exports.markAsInstancedRendered=bw;exports.microphonePermissionsGranted=US;exports.nameof=xS;exports.nameofFactory=Pv;exports.needle=oP;exports.offBeforeXRSession=J0;exports.offXRSessionEnd=Z0;exports.offXRSessionStart=K0;exports.on=Rk;exports.onAfterRender=l1;exports.onBeforeRender=a1;exports.onBeforeXRSession=DP;exports.onClear=o1;exports.onDestroy=r1;exports.onInitialized=fg;exports.onStart=Tu;exports.onSyncDestroy=w1;exports.onSyncInstantiate=y0;exports.onUpdate=h0;exports.onXRSessionEnd=Og;exports.onXRSessionStart=Du;exports.parseSync=fS;exports.placeOnSurface=qv;exports.postprocessFBXMaterials=ag;exports.prefix=wO;exports.pushState=kv;exports.randomNumber=kS;exports.registerBinaryType=xg;exports.registerComponent=Lu;exports.registerComponentExtension=ey;exports.registerCustomEffectType=Ki;exports.registerExportExtensions=ty;exports.registerExtensions=fu;exports.registerHotReloadType=Tw;exports.registerLoader=l0;exports.registerPrefabProvider=v0;exports.registerPrototypeExtensions=Ag;exports.registerType=cg;exports.relativePathPrefix=Ev;exports.removeAttributeChangeCallback=Zm;exports.removeComponent=jg;exports.removeCustomImportExtensionType=ZM;exports.removePatch=JC;exports.resolveUrl=Xn;exports.sanitizeString=Mv;exports.saveImage=cS;exports.screenshot=GA;exports.screenshot2=i_;exports.sendDestroyed=mg;exports.serializable=p;exports.serializeObject=C0;exports.serializeable=Be;exports.setActive=cc;exports.setAllowBalloonMessages=Dv;exports.setAllowOverlayMessages=GS;exports.setAutoFitEnabled=Gd;exports.setCameraController=Xp;exports.setDestroyed=ww;exports.setDevEnvironment=eC;exports.setDisposable=dw;exports.setDontDestroy=oa;exports.setOrAddParamsToUrl=Wp;exports.setParam=CS;exports.setParamWithoutReload=vc;exports.setPeerOptions=K1;exports.setResourceTrackingEnabled=YP;exports.setState=Qm;exports.setVisibleInCustomShadowRendering=rg;exports.setWorldEuler=og;exports.setWorldPosition=At;exports.setWorldPositionXYZ=fr;exports.setWorldQuaternion=un;exports.setWorldQuaternionXYZW=ng;exports.setWorldRotation=$v;exports.setWorldRotationXYZ=qc;exports.setWorldScale=Ra;exports.showBalloonError=Xc;exports.showBalloonMessage=Ce;exports.showBalloonWarning=fe;exports.showDebugConsole=lg;exports.slerp=Fv;exports.syncDestroy=Yc;exports.syncField=Wg;exports.syncInstantiate=gg;exports.textureToCanvas=_C;exports.toSourceId=Tv;exports.tryCastBinary=A0;exports.tryDetermineMimetypeFromBinary=tx;exports.tryDetermineMimetypeFromURL=ex;exports.tryFindObject=wc;exports.tryGetGuid=D0;exports.unregisterHotReloadType=Rw;exports.unregisterPrefabProvider=C1;exports.unwatchWrite=Ym;exports.useForAutoFit=Bv;exports.validate=Fe;exports.watchWrite=Su;
1733
+ `),ei&&this._onCreateEffectsDebug(this._composer,o)}createPassForMergeableEffects(e,t,i,n){if(e.length>0){const o=new A.POSTPROCESSING.MODULE.EffectPass(i,...e);o.name=e.map(r=>r.name).join(", "),o.mainScene=n,o.enabled=!0,o.renderToScreen=!1,t.addPass(o),e.length=0}}handleDevicePixelRatio(){typeof this.context.devicePixelRatio=="number"&&this.context.requestSizeUpdate()}_menuEntry=null;_passIndices=null;_onCreateEffectsDebug(e,t){if(ei==="passes"){const i=new A.POSTPROCESSING.MODULE.DepthEffect({blendFunction:A.POSTPROCESSING.MODULE.BlendFunction.NORMAL,inverted:!0});i.name="Depth Effect";const n=new A.POSTPROCESSING.MODULE.EffectPass(t,i);if(n.name="Depth Effect Pass",n.enabled=!1,e.passes.push(n),this._passIndices!==null){const r=[e.passes[0]];this._passIndices.length>0&&r.push(...this._passIndices.filter(a=>a!==0).map(a=>e.passes[a]).filter(a=>a)),r.length>0&&console.log("[PostProcessing] Passes (selected) →",r),e.passes.length=0;for(const a of r)a.enabled=!0,a.renderToScreen=!1,e.addPass(a)}const o=this.context.menu;if(o&&this._passIndices===null){this._menuEntry&&this._menuEntry.remove();const r=document.createElement("select");r.multiple=!0;const a=document.createElement("option");a.innerText="Final Output",a.value="-1",r.appendChild(a);for(const l of e.passes){const h=document.createElement("option");h.innerText=l.name,h.value=`${e.passes.indexOf(l)}`,h.title=l.name,r.appendChild(h)}o.appendChild(r),this._menuEntry=r,r.addEventListener("change",()=>{const l=Array.from(r.selectedOptions).map(h=>parseInt(h.value));l.length===1&&l[0]===-1?this._passIndices=null:this._passIndices=l,this.applyEffects(this.context)})}}}}const LD=Object.freeze(Object.defineProperty({__proto__:null,PostProcessingHandler:Ga},Symbol.toStringTag,{value:"Module"}));class Lf{_name;_tracks=[];_currentTrack=null;_pendingSignals=[];_idProvider;constructor(e,t){this._name=e,this._idProvider=new nt(t??Date.now())}static create(e,t){return new Lf(e??"Timeline",t)}animationTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Animation,t??null),this}audioTrack(e,t,i){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Audio,t??null),this._currentTrack.volume=i,this}activationTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Activation,t??null),this}controlTrack(e){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Control,null),this}signalTrack(e,t){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Signal,t??null),this}markerTrack(e){return this.commitInlineTracks(),this._currentTrack=this.pushTrack(e,me.Marker,null),this}clip(e,t){if(!this._currentTrack)throw new Error("TimelineBuilder: .clip() must be called after a track method (e.g. .animationTrack())");this.commitInlineTracks();const i=this._currentTrack;switch(i.type){case me.Animation:{let n;if(e instanceof c.AnimationClip)n=e;else{const d=Array.isArray(e)?e:[e],u=i.outputs[0],f=u instanceof c.Object3D?u:u!=null&&"gameObject"in u?u.gameObject:void 0;n=Ac(d,f)}const o=t??{},r=o.duration??n.duration,a=o.start??i.cursor,l=a+r,h={start:a,end:l,duration:r,timeScale:o.speed??1,clipIn:o.clipIn??0,easeInDuration:o.easeIn??0,easeOutDuration:o.easeOut??0,preExtrapolationMode:o.preExtrapolation??Qe.None,postExtrapolationMode:o.postExtrapolation??Qe.None,reversed:o.reversed,asset:{clip:n,loop:o.loop??!1,duration:n.duration,removeStartOffset:o.removeStartOffset??!1}};i.clips.push(h),i.cursor=l;break}case me.Audio:{const n=e,o=t??{},r=o.duration,a=o.start??i.cursor,l=a+r,h={start:a,end:l,duration:r,timeScale:o.speed??1,clipIn:0,easeInDuration:o.easeIn??0,easeOutDuration:o.easeOut??0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{clip:n,loop:o.loop??!1,volume:o.volume??1}};i.clips.push(h),i.cursor=l;break}case me.Activation:{const n=e,o=n.start??i.cursor,r=o+n.duration,a={start:o,end:r,duration:n.duration,timeScale:1,clipIn:0,easeInDuration:n.easeIn??0,easeOutDuration:n.easeOut??0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{}};i.clips.push(a),i.cursor=r;break}case me.Control:{const n=e,o=t??{},r=o.start??i.cursor,a=o.duration,l=r+a,h={start:r,end:l,duration:a,timeScale:1,clipIn:0,easeInDuration:0,easeOutDuration:0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{sourceObject:n,controlActivation:o.controlActivation??!0,updateDirector:o.updateDirector??!0}};i.clips.push(h),i.cursor=l;break}default:throw new Error(`TimelineBuilder: .clip() is not supported on track type "${i.type}"`)}return this}marker(e,t,i){if(!this._currentTrack)throw new Error("TimelineBuilder: .marker() must be called after a track method");if(this._currentTrack.type!==me.Signal&&this._currentTrack.type!==me.Marker)throw new Error(`TimelineBuilder: .marker() is only supported on signal and marker tracks, not "${this._currentTrack.type}"`);const n={type:jc.Signal,time:e,retroActive:i?.retroActive??!1,emitOnce:i?.emitOnce??!1,asset:t};return this._currentTrack.markers.push(n),e>this._currentTrack.cursor&&(this._currentTrack.cursor=e),this}signal(e,t,i){if(!this._currentTrack)throw new Error("TimelineBuilder: .signal() must be called after a track method");if(this._currentTrack.type!==me.Signal&&this._currentTrack.type!==me.Marker)throw new Error(`TimelineBuilder: .signal() is only supported on signal and marker tracks, not "${this._currentTrack.type}"`);const n=this._idProvider.generateUUID(),o=this._tracks.indexOf(this._currentTrack),r={type:jc.Signal,time:e,retroActive:i?.retroActive??!1,emitOnce:i?.emitOnce??!1,asset:n};return this._currentTrack.markers.push(r),this._pendingSignals.push({trackIndex:o,guid:n,callback:t}),e>this._currentTrack.cursor&&(this._currentTrack.cursor=e),this}muted(e=!0){if(!this._currentTrack)throw new Error("TimelineBuilder: .muted() must be called after a track method");return this._currentTrack.muted=e,this}track(e,t,i,n){if(!this._currentTrack)throw new Error("TimelineBuilder: .track() must be called after .animationTrack()");if(this._currentTrack.type!==me.Animation)throw new Error("TimelineBuilder: .track() is only supported on animation tracks");return this._currentTrack.inlineTracks.push(Bg(e,t,i,n)),this}build(){this.commitInlineTracks();const e=this._tracks.map(t=>{const i={name:t.name,type:t.type,muted:t.muted,outputs:t.outputs};return t.clips.length>0&&(i.clips=t.clips),t.markers.length>0&&(i.markers=t.markers),t.volume!==void 0&&(i.volume=t.volume),t.trackOffset!==void 0&&(i.trackOffset=t.trackOffset),i});return{name:this._name,tracks:e}}install(e){const t=this.build();if(this._pendingSignals.length>0){const i=e.gameObject;let n=C.getComponent(i,_r);n||(n=C.addComponent(i,_r)),n.events||(n.events=[]);for(const o of this._pendingSignals){const r=new nh;r.guid=o.guid;const a=new Ka;a.signal=r,a.reaction=new Z([o.callback]),n.events.push(a);const l=t.tracks[o.trackIndex];l&&!l.outputs.includes(n)&&l.outputs.push(n)}}return e.playableAsset=t,t}pushTrack(e,t,i){const n={name:e,type:t,muted:!1,outputs:i?[i]:[],clips:[],markers:[],cursor:0,inlineTracks:[]};return this._tracks.push(n),n}commitInlineTracks(){if(!this._currentTrack||this._currentTrack.inlineTracks.length===0)return;const e=this._currentTrack,t=e.outputs[0],i=t instanceof c.Object3D?t:t!=null&&"gameObject"in t?t.gameObject:void 0,n=Ac(e.inlineTracks,i),o=e.cursor,r=n.duration,a={start:o,end:o+r,duration:r,timeScale:1,clipIn:0,easeInDuration:0,easeOutDuration:0,preExtrapolationMode:Qe.None,postExtrapolationMode:Qe.None,asset:{clip:n,loop:!1,duration:n.duration,removeStartOffset:!1}};e.clips.push(a),e.cursor=o+r,e.inlineTracks=[]}}class wS{}const jD=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:ue,ActionCollection:Px,ActionModel:ni,AlignmentConstraint:oh,Animation:It,AnimationBuilder:zu,AnimationCurve:_h,AnimationExtension:of,Animator:dt,AnimatorController:Bn,Antialiasing:vh,Attractor:ul,AudioExtension:Er,AudioListener:ps,AudioSource:Si,Avatar:go,AvatarMarker:Ye,AxesHelper:Za,BaseUIComponent:Hi,BasicIKConstraint:qg,BehaviorExtension:wy,BehaviorModel:Pt,BloomEffect:vf,BoxCollider:Zu,BoxGizmo:Dr,BoxHelperComponent:St,Button:js,CallInfo:Fn,Camera:ci,CameraTargetReachedEvent:Lc,Canvas:$a,CanvasGroup:yo,CapsuleCollider:xs,ChangeMaterialOnClick:py,ChangeTransformOnClick:Tr,CharacterController:Or,CharacterControllerInput:ks,ChromaticAberration:wh,ClickThrough:Rf,ColorAdjustments:To,ColorBySpeedModule:dl,ColorOverLifetimeModule:yf,ContactShadows:rh,CursorFollow:Vr,CustomBranding:Ar,Deletable:Kg,DeleteBox:co,DepthOfField:bn,DeviceFlag:Ju,DocumentExtension:vS,DragControls:er,DropListener:Ms,Duplicatable:oy,EffectWrapper:$c,EmissionModule:As,EmphasizeOnClick:il,EnvironmentScene:Yu,EventList:Z,EventListEvent:Fg,EventSystem:Qt,EventTrigger:nf,FieldWithDefault:rx,FixedJoint:Ly,Fog:al,GltfExport:hy,GltfExportBox:ly,Gradient:Lr,Graphic:mh,GraphicRaycaster:Wu,GridHelper:ll,GridLayoutGroup:Oy,GroundProjectedEnv:Yn,GroupActionModel:tr,HideOnStart:Ui,HingeJoint:yh,HorizontalLayoutGroup:ky,get HoverAnimation(){return exports.HoverAnimation},Image:_l,InheritVelocityModule:zy,InputField:Zy,InstanceHandle:dr,InstancingHandler:wr,Interactable:Yg,Keyframe:hi,LODGroup:pf,LODModel:cl,Light:Ot,LimitVelocityOverLifetimeModule:rt,LogStats:Qg,LookAt:Jy,LookAtConstraint:Pr,MainModule:Bt,MaskableGraphic:gh,MeshCollider:Co,MeshRenderer:ch,MinMaxCurve:q,MinMaxGradient:jr,NeedleMenu:Jn,NestedGltf:hl,Networking:Fy,NoiseModule:pe,ObjectRaycaster:Gi,OffsetConstraint:Ir,OpenURL:bl,OrbitControls:ce,Outline:rl,Padding:Rr,ParticleBurst:_u,ParticleSubEmitter:Ny,ParticleSystem:Nc,ParticleSystemRenderer:Yi,PhysicsExtension:xy,PixelationEffect:xh,PlayAnimationOnClick:Uc,PlayAudioOnClick:mo,PlayableDirector:za,PlayerColor:Va,PointerEventData:ih,PostProcessingHandler:Ga,PreliminaryAction:nl,PreliminaryTrigger:dh,RawImage:Mf,Rect:Ix,RectTransform:mn,ReflectionProbe:cs,RegisteredAnimationInfo:ao,RemoteSkybox:Ku,Renderer:Yt,RendererLightmap:iy,Rigidbody:We,RotationBySpeedModule:Qi,RotationOverLifetimeModule:_n,SceneSwitcher:Ge,ScreenCapture:Ro,ScreenSpaceAmbientOcclusion:Ds,ScreenSpaceAmbientOcclusionN8:vn,ScrollFollow:Bs,SeeThrough:Is,SetActiveOnClick:my,ShadowCatcher:Oh,ShapeModule:Uy,SharpeningEffect:Ch,SignalAsset:nh,SignalReceiver:_r,SignalReceiverEvent:Ka,SignalTrackHandler:Fc,Size:Dx,SizeBySpeedModule:mi,SizeOverLifetimeModule:Br,SkinnedMeshRenderer:ny,SmoothFollow:Sf,SpatialGrabRaycaster:yr,SpatialHtml:Rh,SpatialTrigger:Cf,SpatialTriggerReceiver:Hn,SpectatorCamera:Pf,SphereCollider:Ja,SplineContainer:Nr,SplineData:qn,SplineWalker:Zi,Sprite:Es,SpriteData:Ea,SpriteRenderer:fi,SpriteSheet:Na,SubEmitterSystem:bu,SyncedCamera:Xy,SyncedRoom:wn,SyncedTransform:pn,TapGestureTrigger:yy,TeleportTarget:hf,TestRunner:Qy,TestSimulateUserData:Yy,Text:jt,TextBuilder:Cy,TextExtension:uf,TextureSheetAnimationModule:Ft,TiltShiftEffect:ts,TimelineActivationTrack:qu,TimelineAnimationTrack:Bc,TimelineAudioTrack:ms,TimelineBuilder:Lf,TimelineControlTrack:Xu,TimelineMarkerTrack:Hu,ToneMappingEffect:_o,TrailModule:Ie,TransformData:Ae,TransformGizmo:$r,TriggerBuilder:Dt,TriggerModel:ho,UIRaycastUtils:zg,UIRootComponent:fh,USDZExporter:Gn,USDZText:_a,USDZUIExtension:Ey,UsageMarker:ah,VariantAction:fy,VelocityOverLifetimeModule:Ue,VerticalLayoutGroup:Py,VideoPlayer:st,get ViewBox(){return exports.ViewBox},Vignette:zr,VisibilityAction:uh,Voip:Ls,Volume:pl,VolumeParameter:z,VolumeProfile:_f,WebARCameraBackground:Dh,WebARSessionRoot:$i,WebXR:df,WebXRImageTracking:Ih,WebXRImageTrackingModel:Us,WebXRPlaneTracking:zs,WebXRTrackedImage:Wa,XRControllerFollow:Fs,XRControllerModel:Ss,XRControllerMovement:Pi,XRFlag:cn,XRRig:If,XRState:qt,__Ignore:wS},Symbol.toStringTag,{value:"Module"}));exports.SplineUtils=void 0;(s=>{function e(t,i=!1,n=.75){const o=new Nr,r=1-j.clamp(n,0,1);return t.forEach((a,l)=>{const h=new c.Vector3;l<t.length-1?h.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&h.subVectors(t[0],a).normalize().multiplyScalar(r);const d=new qn;d.position.copy(a),d.tangentIn.copy(h),d.tangentOut.copy(h),o.addKnot(d)}),o.closed=i,o}s.createFromPoints=e})(exports.SplineUtils||(exports.SplineUtils={}));class BD extends de.WorkerBase{constructor(){super(new Worker(new URL("/generateMeshBVH.worker-DiCnZlf3.js",typeof document>"u"?require("url").pathToFileURL(__filename).href:va&&va.tagName.toUpperCase()==="SCRIPT"&&va.src||new URL("needle-engine.bundle-DN5GLt_w.umd.cjs",document.baseURI).href),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,o)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=h=>{o(new Error(`[GenerateMeshBVHWorker] ${h.message||"Could not load worker."}`))},e.onmessage=h=>{const{data:d}=h;if(d.error)o(new Error(d.error)),e.onmessage=null;else if(d.serialized){const{serialized:u,position:f}=d,m=de.MeshBVH.deserialize(u,t,{setIndex:!1}),g=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=f,u.index)if(t.index)t.index.array=u.index;else{const b=new c.BufferAttribute(u.index,1,!1);t.setIndex(b)}g.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new c.Box3)),i.onProgress&&i.onProgress(d.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(d.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const FD=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:BD},Symbol.toStringTag,{value:"Module"}));exports.$componentName=Qd;exports.$physicsKey=i1;exports.ActionBuilder=ue;exports.ActionCollection=Px;exports.ActionModel=ni;exports.Addressables=k0;exports.AlignmentConstraint=oh;exports.AmbientMode=Ca;exports.Animation=It;exports.AnimationBuilder=zu;exports.AnimationCurve=_h;exports.AnimationExtension=of;exports.Animator=dt;exports.AnimatorConditionMode=ri;exports.AnimatorController=Bn;exports.AnimatorControllerBuilder=Nu;exports.AnimatorControllerParameterType=Jo;exports.AnimatorStateInfo=Xl;exports.Antialiasing=vh;exports.Application=fn;exports.AssetDatabase=aw;exports.AssetReference=Y;exports.Attractor=ul;exports.AudioClip=km;exports.AudioExtension=Er;exports.AudioListener=ps;exports.AudioSource=Si;exports.Avatar=go;exports.AvatarMarker=Ye;exports.Axes=ga;exports.AxesHelper=Za;exports.BUILD_TIME=xc;exports.BaseUIComponent=Hi;exports.BasicIKConstraint=qg;exports.BehaviorExtension=wy;exports.BehaviorModel=Pt;exports.BloomEffect=vf;exports.BoxCollider=Zu;exports.BoxGizmo=Dr;exports.BoxHelperComponent=St;exports.Button=js;exports.ButtonsFactory=Ni;exports.CallDirection=Qx;exports.CallInfo=Fn;exports.Camera=ci;exports.CameraTargetReachedEvent=Lc;exports.Canvas=$a;exports.CanvasGroup=yo;exports.CapsuleCollider=xs;exports.ChangeMaterialOnClick=py;exports.ChangeTransformOnClick=Tr;exports.CharacterController=Or;exports.CharacterControllerInput=ks;exports.ChromaticAberration=wh;exports.CircularBuffer=wi;exports.ClearFlags=hr;exports.ClickThrough=Rf;exports.ClipExtrapolation=Qe;exports.Collider=Mi;exports.Collision=o0;exports.CollisionDetectionMode=Vu;exports.ColorAdjustments=To;exports.ColorBySpeedModule=dl;exports.ColorOverLifetimeModule=yf;exports.Component=Ak;exports.Component$1=R;exports.ComponentLifecycleEvents=Pu;exports.Components=jD;exports.ConnectionEvents=j0;exports.ContactPoint=s0;exports.ContactShadows=rh;exports.Context=U;exports.ContextArgs=VP;exports.ContextEvent=le;exports.ContextRegistry=ae;exports.CursorFollow=Vr;exports.CustomBranding=Ar;exports.CustomShader=we;exports.DefaultReflectionMode=iu;exports.Deletable=Kg;exports.DeleteBox=co;exports.DepthOfField=bn;exports.DeviceFlag=Ju;exports.DirectorWrapMode=Gw;exports.DisposableStore=Ad;exports.DocumentExtension=vS;exports.DragControls=er;exports.DragMode=Zg;exports.DropListener=Ms;exports.Duplicatable=oy;exports.EffectWrapper=$c;exports.EmissionModule=As;exports.EmphasizeOnClick=il;exports.EngineLoadingView=Vc;exports.EnvironmentScene=Yu;exports.EventBus=am;exports.EventList=Z;exports.EventListEvent=Fg;exports.EventSystem=Qt;exports.EventTrigger=nf;exports.FieldWithDefault=rx;exports.FileReference=or;exports.FileReferenceSerializer=M0;exports.FileSpawnModel=OM;exports.File_Event=Zw;exports.FixedJoint=Ly;exports.Fog=al;exports.FontStyle=gu;exports.FrameEvent=ye;exports.GENERATOR=Aa;exports.GameObject=C;exports.Gizmos=B;exports.GltfExport=hy;exports.GltfExportBox=ly;exports.Gradient=Lr;exports.Graphic=mh;exports.GraphicRaycaster=Wu;exports.Graphics=fo;exports.GridHelper=ll;exports.GridLayoutGroup=Oy;exports.GroundProjectedEnv=Yn;exports.GroupActionModel=tr;exports.HideFlags=Ou;exports.HideOnStart=Ui;exports.HingeJoint=yh;exports.HorizontalLayoutGroup=ky;exports.HorizontalWrapMode=Ux;exports.HostData=x1;exports.Image=_l;exports.ImageReference=sr;exports.ImageReferenceSerializer=O0;exports.InheritVelocityModule=zy;exports.Input=R0;exports.InputEventQueue=oi;exports.InputEvents=ke;exports.InputField=Zy;exports.InstanceHandle=dr;exports.InstancingHandler=wr;exports.InstancingUtil=Wi;exports.InstantiateEvent=p0;exports.InstantiateIdProvider=nt;exports.InstantiateOptions=Qn;exports.Interactable=Yg;exports.JoinedRoomResponse=tP;exports.KeyEventArgs=H1;exports.Keyframe=hi;exports.LODGroup=pf;exports.LODModel=cl;exports.LeftRoomResponse=iP;exports.Light=Ot;exports.LightData=W0;exports.LimitVelocityOverLifetimeModule=rt;exports.LoadingElementOptions=wD;exports.LogStats=Qg;exports.LogType=bi;exports.LookAt=Jy;exports.LookAtConstraint=Pr;exports.MODULES=A;exports.MainModule=Bt;exports.MarkerType=jc;exports.MaskableGraphic=gh;exports.MaterialPropertyBlock=bs;exports.Mathf=j;exports.MeshCollider=Co;exports.MeshRenderer=ch;exports.MinMaxCurve=q;exports.MinMaxGradient=jr;exports.NEEDLE_ENGINE_FEATURE_FLAGS=hg;exports.NEKeyboardEvent=Gl;exports.NEPointerEvent=ls;exports.NeedleButtonElement=gS;exports.NeedleEngineWebComponent=o_;exports.NeedleMenu=Jn;exports.NeedlePatchesKey=xd;exports.NeedleXRController=Pg;exports.NeedleXRSession=H;exports.NeedleXRSync=Q0;exports.NeedleXRUtils=rw;exports.NestedGltf=hl;exports.NetworkConnection=Cc;exports.NetworkedStreamEvents=Nn;exports.NetworkedStreams=Ph;exports.Networking=Fy;exports.NewInstanceModel=g0;exports.NoiseModule=pe;exports.ObjectRaycaster=Gi;exports.ObjectUtils=wo;exports.OffsetConstraint=Ir;exports.OneEuroFilter=vd;exports.OneEuroFilterXYZ=tg;exports.OpenURL=bl;exports.OrbitControls=ce;exports.Outline=rl;exports.OwnershipEvent=B0;exports.OwnershipModel=F0;exports.PUBLIC_KEY=oo;exports.Padding=Rr;exports.ParticleBurst=_u;exports.ParticleSubEmitter=Ny;exports.ParticleSystem=Nc;exports.ParticleSystemBaseBehaviour=Eo;exports.ParticleSystemRenderer=Yi;exports.ParticleSystemShapeType=yu;exports.PeerHandle=gs;exports.PeerNetworking=L0;exports.Physics=Ua;exports.PhysicsExtension=xy;exports.PhysicsMaterialCombine=at;exports.PixelationEffect=xh;exports.PlayAnimationOnClick=Uc;exports.PlayAudioOnClick=mo;exports.PlayableDirector=za;exports.PlayerColor=Va;exports.PlayerState=ai;exports.PlayerStateEvent=Mx;exports.PlayerSync=by;exports.PlayerView=U0;exports.PlayerViewManager=z0;exports.PointerEventData=ih;exports.PointerType=Ru;exports.PostProcessing=X0;exports.PostProcessingEffect=Ze;exports.PostProcessingEffectOrder=it;exports.PostProcessingHandler=Ga;exports.Prefabs=Da;exports.PreliminaryAction=nl;exports.PreliminaryTrigger=dh;exports.PrimitiveType=Ha;exports.Progress=oe;exports.PromiseAllWithErrors=Jm;exports.PromiseErrorResult=Gp;exports.RGBAColor=ie;exports.RapierPhysics=Ta;exports.RawImage=Mf;exports.RaycastOptions=xo;exports.Rect=Ix;exports.RectTransform=mn;exports.ReflectionProbe=cs;exports.RegisteredAnimationInfo=ao;exports.RemoteSkybox=Ku;exports.RenderTexture=Un;exports.RenderTextureSerializer=jw;exports.Renderer=Yt;exports.RendererData=V0;exports.RendererLightmap=iy;exports.Rigidbody=We;exports.RigidbodyConstraints=Ve;exports.RoomEvents=K;exports.RotationBySpeedModule=Qi;exports.RotationOverLifetimeModule=_n;exports.SceneLightSettings=du;exports.SceneSwitcher=Ge;exports.ScreenCapture=Ro;exports.ScreenSpaceAmbientOcclusion=Ds;exports.ScreenSpaceAmbientOcclusionN8=vn;exports.ScrollFollow=Bs;exports.SeeThrough=Is;exports.SendQueue=ln;exports.SerializationContext=bg;exports.SetActiveOnClick=my;exports.ShadowCatcher=Oh;exports.ShapeModule=Uy;exports.ShapeOverlapResult=r0;exports.SharpeningEffect=Ch;exports.SignalAsset=nh;exports.SignalReceiver=_r;exports.SignalReceiverEvent=Ka;exports.SignalTrackHandler=Fc;exports.Size=Dx;exports.SizeBySpeedModule=mi;exports.SizeOverLifetimeModule=Br;exports.SkinnedMeshRenderer=ny;exports.SmoothFollow=Sf;exports.SpatialGrabRaycaster=yr;exports.SpatialHtml=Rh;exports.SpatialTrigger=Cf;exports.SpatialTriggerReceiver=Hn;exports.SpectatorCamera=Pf;exports.SphereCollider=Ja;exports.SphereIntersection=Tg;exports.SplineContainer=Nr;exports.SplineData=qn;exports.SplineWalker=Zi;exports.Sprite=Es;exports.SpriteData=Ea;exports.SpriteRenderer=fi;exports.SpriteSheet=Na;exports.StateMachineBehaviour=Bk;exports.StreamEndedEvent=qy;exports.StreamReceivedEvent=Xx;exports.SubEmitterSystem=bu;exports.SyncedCamera=Xy;exports.SyncedRoom=wn;exports.SyncedTransform=pn;exports.TapGestureTrigger=yy;exports.TeleportTarget=hf;exports.TestRunner=Qy;exports.TestSimulateUserData=Yy;exports.Text=jt;exports.TextAnchor=Xe;exports.TextBuilder=Cy;exports.TextExtension=uf;exports.TextureSheetAnimationModule=Ft;exports.TiltShiftEffect=ts;exports.Time=G0;exports.TimelineActivationTrack=qu;exports.TimelineAnimationTrack=Bc;exports.TimelineAudioTrack=ms;exports.TimelineBuilder=Lf;exports.TimelineControlTrack=Xu;exports.TimelineMarkerTrack=Hu;exports.TimelineTrackHandler=kr;exports.ToneMappingEffect=_o;exports.TrackType=me;exports.TrailModule=Ie;exports.TransformData=Ae;exports.TransformGizmo=$r;exports.TriggerBuilder=Dt;exports.TriggerModel=ho;exports.TypeStore=P;exports.UIRaycastUtils=zg;exports.UIRootComponent=fh;exports.USDDocument=dy;exports.USDObject=Ke;exports.USDWriter=gx;exports.USDZExporter=yx;exports.USDZExporter$1=Gn;exports.USDZText=_a;exports.USDZUIExtension=Ey;exports.UriSerializer=Bw;exports.UsageMarker=ah;exports.UserJoinedOrLeftRoomModel=nP;exports.VERSION=li;exports.VariantAction=fy;exports.VelocityOverLifetimeModule=Ue;exports.VerticalLayoutGroup=Py;exports.VerticalWrapMode=Fx;exports.VideoPlayer=st;exports.ViewDevice=_s;exports.Vignette=zr;exports.VisibilityAction=uh;exports.Voip=Ls;exports.Volume=pl;exports.VolumeParameter=z;exports.VolumeProfile=_f;exports.WaitForFrames=$1;exports.WaitForPromise=T0;exports.WaitForSeconds=vg;exports.Watch=ys;exports.WebARCameraBackground=Dh;exports.WebARSessionRoot=$i;exports.WebXR=df;exports.WebXRButtonFactory=uo;exports.WebXRImageTracking=Ih;exports.WebXRImageTrackingModel=Us;exports.WebXRPlaneTracking=zs;exports.WebXRTrackedImage=Wa;exports.XRControllerFollow=Fs;exports.XRControllerModel=Ss;exports.XRControllerMovement=Pi;exports.XRFlag=cn;exports.XRRig=If;exports.XRState=qt;exports.XRStateFlag=In;exports.__Ignore=wS;exports.__RsyLK=Vn;exports.__internalNotifyObjectDestroyed=ZP;exports.__tmUDtSjM=$n;exports.activeInHierarchyFieldName=jn;exports.addAttributeChangeCallback=Km;exports.addComponent=Wn;exports.addCustomExtensionPlugin=KM;exports.addNewComponent=lr;exports.addPatch=ku;exports.apply=Bu;exports.applyHMRChanges=Ek;exports.applyPrototypeExtensions=yw;exports.beginListenDestroy=m0;exports.beginListenInstantiate=b0;exports.binaryIdentifierCasts=wg;exports.build_scene_functions=$P;exports.builtinComponentKeyName=Xo;exports.calculateProgress01=s_;exports.clearMessages=QS;exports.compareAssociation=x0;exports.copyTexture=Wv;exports.createMotion=Dw;exports.debugNet=ti;exports.debugOwner=sa;exports.decompressGpuTexture=wx;exports.deepClone=Gc;exports.delay=vs;exports.delayForFrames=xu;exports.deserializeObject=eu;exports.destroy=xi;exports.destroyComponentInstance=Ow;exports.determineMimeTypeFromExtension=Jw;exports.disposeObjectResources=xe;exports.disposeStream=hn;exports.editorGuidKeyName=oc;exports.enableSpatialConsole=wa;exports.exportAsGLTF=AD;exports.findByGuid=Dg;exports.findObjectOfType=Ya;exports.findObjectsOfType=Ew;exports.findResourceUsers=Rg;exports.fitCamera=Nw;exports.fitObjectIntoVolume=Hv;exports.foreachComponent=gr;exports.foreachComponentEnumerator=Ig;exports.forward=pC;exports.generateQRCode=iw;exports.generateSeed=_0;exports.getBoundingBox=di;exports.getCameraController=jv;exports.getComponent=So;exports.getComponentInChildren=eh;exports.getComponentInParent=Tc;exports.getComponents=Xa;exports.getComponentsInChildren=Qa;exports.getComponentsInParent=Uu;exports.getFormattedDate=ux;exports.getIconElement=ht;exports.getIconTexture=hm;exports.getLoader=ws;exports.getOrAddComponent=Jc;exports.getParam=x;exports.getParentHierarchyPath=yC;exports.getPath=OS;exports.getPeerOptions=Y1;exports.getPeerjsInstance=I0;exports.getResourceUserCount=ek;exports.getSceneData=$0;exports.getTempColor=zv;exports.getTempQuaternion=si;exports.getTempVector=F;exports.getUrlParams=Wc;exports.getVisibleInCustomShadowRendering=Gv;exports.getWorldDirection=Nv;exports.getWorldEuler=sg;exports.getWorldPosition=J;exports.getWorldQuaternion=ge;exports.getWorldRotation=Cu;exports.getWorldScale=je;exports.hasPointerEventComponent=lu;exports.hideDebugConsole=Yv;exports.imageToCanvas=xx;exports.initAddressableSerializers=E0;exports.initBuiltinSerializers=Fw;exports.initEngine=ED;exports.initPhysics=mS;exports.initVolumeParameterSerializer=qw;exports.instantiate=po;exports.invokeLoadedImportPluginHooks=ox;exports.invokeXRSessionEnd=tw;exports.invokeXRSessionStart=ew;exports.isActiveInHierarchy=_w;exports.isActiveSelf=qa;exports.isAndroidDevice=DS;exports.isAnimationAction=Vv;exports.isComponent=Mu;exports.isDebugMode=SS;exports.isDesktop=ES;exports.isDestroyed=mr;exports.isDevEnvironment=T;exports.isDisposable=Tk;exports.isDisposed=KP;exports.isExporting=TD;exports.isGLTFModel=n0;exports.isHostedOnGlitch=Cv;exports.isHotReloadEnabled=Cm;exports.isHotReloading=Ok;exports.isIPad=RS;exports.isIconElement=nw;exports.isLocalNetwork=vi;exports.isMacOS=LS;exports.isMobileDevice=TS;exports.isMozillaXR=IS;exports.isQuest=FS;exports.isResourceTrackingEnabled=cw;exports.isSafari=BS;exports.isTrackModel=NO;exports.isUsingInstancing=Fu;exports.isiOS=jS;exports.isiPad=AS;exports.loadAsset=dD;exports.loadPMREM=Gg;exports.loadSync=n_;exports.logHierarchy=qd;exports.lookAtInverse=rC;exports.lookAtObject=Hc;exports.lookAtScreenPoint=aC;exports.makeId=PS;exports.makeIdFromRandomWords=Ov;exports.makeNameSafe=Ci;exports.markAsInstancedRendered=bw;exports.microphonePermissionsGranted=US;exports.nameof=xS;exports.nameofFactory=Pv;exports.needle=oP;exports.offBeforeXRSession=J0;exports.offXRSessionEnd=Z0;exports.offXRSessionStart=K0;exports.on=Rk;exports.onAfterRender=l1;exports.onBeforeRender=a1;exports.onBeforeXRSession=DP;exports.onClear=o1;exports.onDestroy=r1;exports.onInitialized=fg;exports.onStart=Tu;exports.onSyncDestroy=w1;exports.onSyncInstantiate=y0;exports.onUpdate=h0;exports.onXRSessionEnd=Og;exports.onXRSessionStart=Du;exports.parseSync=fS;exports.placeOnSurface=qv;exports.postprocessFBXMaterials=ag;exports.prefix=wO;exports.pushState=kv;exports.randomNumber=kS;exports.registerBinaryType=xg;exports.registerComponent=Lu;exports.registerComponentExtension=ey;exports.registerCustomEffectType=Ki;exports.registerExportExtensions=ty;exports.registerExtensions=fu;exports.registerHotReloadType=Tw;exports.registerLoader=l0;exports.registerPrefabProvider=v0;exports.registerPrototypeExtensions=Ag;exports.registerType=cg;exports.relativePathPrefix=Ev;exports.removeAttributeChangeCallback=Zm;exports.removeComponent=jg;exports.removeCustomImportExtensionType=ZM;exports.removePatch=JC;exports.resolveUrl=Xn;exports.sLAk=Qc;exports.sanitizeString=Mv;exports.saveImage=cS;exports.screenshot=GA;exports.screenshot2=i_;exports.sendDestroyed=mg;exports.serializable=p;exports.serializeObject=C0;exports.serializeable=Be;exports.setActive=cc;exports.setAllowBalloonMessages=Dv;exports.setAllowOverlayMessages=GS;exports.setAutoFitEnabled=Gd;exports.setCameraController=Xp;exports.setDestroyed=ww;exports.setDevEnvironment=eC;exports.setDisposable=dw;exports.setDontDestroy=oa;exports.setOrAddParamsToUrl=Wp;exports.setParam=CS;exports.setParamWithoutReload=vc;exports.setPeerOptions=K1;exports.setResourceTrackingEnabled=YP;exports.setState=Qm;exports.setVisibleInCustomShadowRendering=rg;exports.setWorldEuler=og;exports.setWorldPosition=At;exports.setWorldPositionXYZ=fr;exports.setWorldQuaternion=un;exports.setWorldQuaternionXYZW=ng;exports.setWorldRotation=$v;exports.setWorldRotationXYZ=qc;exports.setWorldScale=Ra;exports.showBalloonError=Xc;exports.showBalloonMessage=Ce;exports.showBalloonWarning=fe;exports.showDebugConsole=lg;exports.slerp=Fv;exports.syncDestroy=Yc;exports.syncField=Wg;exports.syncInstantiate=gg;exports.textureToCanvas=_C;exports.toSourceId=Tv;exports.tryCastBinary=A0;exports.tryDetermineMimetypeFromBinary=tx;exports.tryDetermineMimetypeFromURL=ex;exports.tryFindObject=wc;exports.tryGetGuid=D0;exports.unregisterHotReloadType=Rw;exports.unregisterPrefabProvider=C1;exports.unwatchWrite=Ym;exports.useForAutoFit=Bv;exports.validate=Fe;exports.watchWrite=Su;
@@ -2291,9 +2291,9 @@ Do('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUIL
2291
2291
  Do('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
2292
2292
  Do('globalThis["__NEEDLE_ENGINE_VERSION__"] = "5.1.0-alpha.5";');
2293
2293
  Do('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
2294
- Do('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 08 2026 11:31:15 GMT+0000 (Coordinated Universal Time)";');
2294
+ Do('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri May 08 2026 11:49:38 GMT+0000 (Coordinated Universal Time)";');
2295
2295
  Do('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
2296
- const Ri = "5.1.0-alpha.5", Fc = "undefined", ou = "Fri May 08 2026 11:31:15 GMT+0000 (Coordinated Universal Time)";
2296
+ const Ri = "5.1.0-alpha.5", Fc = "undefined", ou = "Fri May 08 2026 11:49:38 GMT+0000 (Coordinated Universal Time)";
2297
2297
  N0 && console.log(`Engine version: ${Ri} (generator: ${Fc})
2298
2298
  Project built at ${ou}`);
2299
2299
  const vr = NEEDLE_PUBLIC_KEY, Cs = "needle_isActiveInHierarchy", ga = "builtin_components", kd = "needle_editor_guid";
@@ -45527,7 +45527,7 @@ class Au {
45527
45527
  }
45528
45528
  // private async handleRuntimeLicense(loadingElement: HTMLElement) {
45529
45529
  // // First check if we have a commercial license
45530
- // let commercialLicense = _$SxmJTJik();
45530
+ // let commercialLicense = __RsyLK();
45531
45531
  // // if it's the case then we don't need to perform a runtime check
45532
45532
  // if (commercialLicense) return;
45533
45533
  // // If we don't have a commercial license, then we need to display our message
@@ -45545,10 +45545,10 @@ class Au {
45545
45545
  // nonCommercialContainer.style.opacity = "0";
45546
45546
  // loadingElement.appendChild(nonCommercialContainer);
45547
45547
  // // Use the runtime license check
45548
- // if (!isDevEnvironment() && $cMBCCK) {
45548
+ // if (!isDevEnvironment() && $pWRQ) {
45549
45549
  // if (debugLicense) console.log("Waiting for runtime license check");
45550
- // await $cMBCCK;
45551
- // commercialLicense = _$SxmJTJik();
45550
+ // await $pWRQ;
45551
+ // commercialLicense = __RsyLK();
45552
45552
  // }
45553
45553
  // if (commercialLicense) return;
45554
45554
  // nonCommercialContainer.style.transition = "opacity .5s ease-in-out";
@@ -47568,11 +47568,10 @@ export {
47568
47568
  h_ as XRRig,
47569
47569
  gi as XRState,
47570
47570
  Ss as XRStateFlag,
47571
- As as YUP,
47572
- Is as _$SxmJTJik,
47573
- Xu as _$nJruVQEw,
47574
47571
  B2 as __Ignore,
47572
+ Is as __RsyLK,
47575
47573
  U3 as __internalNotifyObjectDestroyed,
47574
+ As as __tmUDtSjM,
47576
47575
  Cs as activeInHierarchyFieldName,
47577
47576
  v0 as addAttributeChangeCallback,
47578
47577
  Ls as addComponent,
@@ -47748,6 +47747,7 @@ export {
47748
47747
  tj as removeCustomImportExtensionType,
47749
47748
  g3 as removePatch,
47750
47749
  $s as resolveUrl,
47750
+ Xu as sLAk,
47751
47751
  zC as sanitizeString,
47752
47752
  XD as saveImage,
47753
47753
  rj as screenshot,
@@ -117,17 +117,17 @@ import { XRHandSpace } from 'three';
117
117
 
118
118
  export declare const $componentName: unique symbol;
119
119
 
120
- /* Excluded from this release type: _$nJruVQEw */
121
-
122
120
  export declare const $physicsKey: unique symbol;
123
121
 
124
- /* Excluded from this release type: _$SxmJTJik */
125
-
126
122
  export declare class __Ignore {
127
123
  }
128
124
 
129
125
  export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
130
126
 
127
+ /* Excluded from this release type: __RsyLK */
128
+
129
+ /* Excluded from this release type: __tmUDtSjM */
130
+
131
131
  /** Data describing the accessible semantics for a 3D object or component. */
132
132
  declare type AccessibilityData = {
133
133
  /** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
@@ -19375,6 +19375,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
19375
19375
  markBoundsDirty(): void;
19376
19376
  }
19377
19377
 
19378
+ /* Excluded from this release type: sLAk */
19379
+
19378
19380
  /**
19379
19381
  * Slerp between two vectors
19380
19382
  */
@@ -24645,8 +24647,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
24645
24647
  All = 4294967295
24646
24648
  }
24647
24649
 
24648
- /* Excluded from this release type: YUP */
24649
-
24650
24650
  export { }
24651
24651
 
24652
24652