diff --git a/.gitattributes b/.gitattributes index 6ba3ac1..269f064 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,3 +13,6 @@ # Vite/Needle dist/ is static hosting: must be real binaries, not LFS pointers (breaks fetch/GLTF load). Needle/**/dist/** -filter -diff -merge + +# Runtime GLB fallbacks (copied for web): must be real files so fetch/GLTFLoader works without LFS checkout. +Needle/**/include/dishes/** -filter -diff -merge diff --git a/Needle/MenuScene/dist/assets/MenuScene.glb b/Needle/MenuScene/dist/assets/MenuScene.glb index f8315ac..1cf6a7f 100644 Binary files a/Needle/MenuScene/dist/assets/MenuScene.glb and b/Needle/MenuScene/dist/assets/MenuScene.glb differ diff --git a/Needle/MenuScene/dist/assets/index-C4yn7lK8.js b/Needle/MenuScene/dist/assets/index-C4yn7lK8.js deleted file mode 100644 index a9e0bc8..0000000 --- a/Needle/MenuScene/dist/assets/index-C4yn7lK8.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./register_types.JDIhnf6T.js","./needle-engine-webxr.DDCPc9_g.js","./materialx.CnHmG--Y.js","./rolldown-runtime.CYVBeYYp.js","./three@0.169.19.js","./needle-engine-ui.iRWmt52F.js","./gltf-progressive.BBJGcb3s.js","./three-examples@0.169.19.js","./three-mesh-ui.CgGzZ3ml.js","./needle-engine@5.0.3.js","./needle-engine.extras.D0CNgtSQ.js","./needle-engine-particles.B21Zru40.js","./three-quarks.DALdLWPD.js","./needle-engine.extras.D-PG1GOa.js","./postprocessing.Wy71DpiM.js","./three-mesh-bvh.B-oXEGo2.js","./needle-engine.Bq13_677.js"])))=>i.map(i=>d[i]); -import{d as e}from"./materialx.CnHmG--Y.js";import{_t as t,fn as n,wi as r}from"./needle-engine-ui.iRWmt52F.js";import"./needle-engine@5.0.3.js";import{x as i}from"./needle-engine-webxr.DDCPc9_g.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),globalThis[`needle:dependencies:ready`]=e(()=>import(`./register_types.JDIhnf6T.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url);var a=[];globalThis[`needle:codegen_files`]=a,a.push(`./assets/MenuScene.glb`),document.addEventListener(`DOMContentLoaded`,()=>{let e=document.querySelector(`needle-engine`);e&&e.getAttribute(`src`)===null&&(e.setAttribute(`hash`,`1776632064266`),e.setAttribute(`src`,JSON.stringify(a)))}),console.log(`Made with ♥ by 🌵 Needle - https://needle.tools — Version 5.0.3`),r(e=>{let t=e.scene.getComponentInChildren(i);t||(t=e.scene.addComponent(i),t.createARButton=!0,t.createVRButton=!0),t.autoPlace=!0,t.autoCenter=!0,t.arScale=1});function o(e){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e()}function s(){let e=document.querySelector(`needle-engine`),r=document.querySelector(`#asset-picker-prev`),i=document.querySelector(`#asset-picker-next`),a=document.querySelector(`#asset-picker-ar`),s=document.querySelector(`#asset-picker-label`),c=document.querySelector(`#asset-picker-index`);if(!e||!r||!i||!a||!s||!c)return;let l=null,u=!1,d=!1,f=!1,p=()=>{l&&l.getDishSlotCount()>0?(s.textContent=l.getPickerLabel(),c.textContent=``):l?(s.textContent=`Menu (assign dishes in Unity)`,c.textContent=``):(s.textContent=`Menu scene`,c.textContent=`—`);let e=l!==null&&l.getDishSlotCount()>1;r.disabled=!e,i.disabled=!e,a.disabled=!d||f||u},m=async()=>{try{let n=await e.getContext();l=t(MenuController,n)}catch{l=null}p()};n.isARSupported().then(e=>{d=e,p()});let h=e=>{!l||l.getDishSlotCount()<=1||(e<0?l.selectPreviousDish():l.selectNextDish(),p())},g=async()=>{if(!(!d||f||u)){f=!0,p();try{let t=await e.getContext();await n.start(`immersive-ar`,void 0,t)}catch(e){console.warn(`[assetPicker] Failed to start AR session:`,e)}finally{f=!1,p()}}};r.addEventListener(`click`,()=>h(-1)),i.addEventListener(`click`,()=>h(1)),a.addEventListener(`click`,()=>void g()),e.addEventListener(`enter-ar`,()=>{u=!0,p()}),e.addEventListener(`exit-ar`,()=>{u=!1,p()}),e.addEventListener(`enter-vr`,()=>{u=!0,p()}),e.addEventListener(`exit-vr`,()=>{u=!1,p()}),e.addEventListener(`loadfinished`,()=>void m()),o(()=>{requestAnimationFrame(()=>void m())})}s(),e(()=>import(`./needle-engine.Bq13_677.js`),__vite__mapDeps([16,10,2,3,4,1,5,6,7,8,11,12,13,14,9,15]),import.meta.url); \ No newline at end of file diff --git a/Needle/MenuScene/dist/assets/index-C4yn7lK8.js.gz b/Needle/MenuScene/dist/assets/index-C4yn7lK8.js.gz deleted file mode 100644 index 0571ed6..0000000 Binary files a/Needle/MenuScene/dist/assets/index-C4yn7lK8.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/index-Fs2VLbun.js b/Needle/MenuScene/dist/assets/index-Fs2VLbun.js new file mode 100644 index 0000000..447f6a9 --- /dev/null +++ b/Needle/MenuScene/dist/assets/index-Fs2VLbun.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./register_types.CeurxO3a.js","./needle-engine-webxr.BfNO-tft.js","./materialx.CnHmG--Y.js","./rolldown-runtime.CYVBeYYp.js","./three@0.169.19.js","./needle-engine-ui.i2hfjKja.js","./gltf-progressive.BBJGcb3s.js","./three-examples@0.169.19.js","./three-mesh-ui.CgGzZ3ml.js","./needle-engine@5.0.3.js","./needle-engine.extras.CWxm8YHB.js","./needle-engine-particles.Bz_Ei_ja.js","./three-quarks.DALdLWPD.js","./needle-engine.extras.1SuflpgE.js","./postprocessing.Wy71DpiM.js","./three-mesh-bvh.B-oXEGo2.js","./needle-engine.HinF1QFy.js"])))=>i.map(i=>d[i]); +import{d as e}from"./materialx.CnHmG--Y.js";import{_t as t,fn as n,wi as r}from"./needle-engine-ui.i2hfjKja.js";import{A as i}from"./three-examples@0.169.19.js";import"./needle-engine@5.0.3.js";import{x as a}from"./needle-engine-webxr.BfNO-tft.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),globalThis[`needle:dependencies:ready`]=e(()=>import(`./register_types.CeurxO3a.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url);var o=[];globalThis[`needle:codegen_files`]=o,o.push(`./assets/MenuScene.glb`),document.addEventListener(`DOMContentLoaded`,()=>{let e=document.querySelector(`needle-engine`);e&&e.getAttribute(`src`)===null&&(e.setAttribute(`hash`,`1776632327654`),e.setAttribute(`src`,JSON.stringify(o)))}),console.log(`Made with ♥ by 🌵 Needle - https://needle.tools — Version 5.0.3`);var s={"cc0_-_pizza_salami":`include/dishes/cc0_-_pizza_salami.glb`};function c(e){let t=0;return e.traverse(e=>{e.isMesh&&(t+=1)}),t}function l(e){let t=`./`.endsWith(`/`)?`./`:`.//`;return new URL(e,new URL(t,window.location.href)).href}async function u(e){let t=new i;for(let n of e.dishes){if(!n)continue;let e=s[n.name];if(!e||c(n)>0)continue;let r=l(e),i=await t.loadAsync(r);i.scene.name=`${n.name}_mesh`,n.add(i.scene)}}function d(){let e=document.querySelector(`needle-engine`);if(!e)return;let n=async()=>{try{let n=await e.getContext(),r=t(MenuController,n);r&&await u(r)}catch(e){console.warn(`[dishMeshFallback] Could not inject dish meshes:`,e)}};e.addEventListener(`loadfinished`,()=>void n())}d(),r(e=>{let t=e.scene.getComponentInChildren(a);t||(t=e.scene.addComponent(a),t.createARButton=!0,t.createVRButton=!0),t.autoPlace=!0,t.autoCenter=!0,t.arScale=1});function f(e){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0}):e()}function p(){let e=document.querySelector(`needle-engine`),r=document.querySelector(`#asset-picker-prev`),i=document.querySelector(`#asset-picker-next`),a=document.querySelector(`#asset-picker-ar`),o=document.querySelector(`#asset-picker-label`),s=document.querySelector(`#asset-picker-index`);if(!e||!r||!i||!a||!o||!s)return;let c=null,l=!1,u=!1,d=!1,p=()=>{c&&c.getDishSlotCount()>0?(o.textContent=c.getPickerLabel(),s.textContent=``):c?(o.textContent=`Menu (assign dishes in Unity)`,s.textContent=``):(o.textContent=`Menu scene`,s.textContent=`—`);let e=c!==null&&c.getDishSlotCount()>1;r.disabled=!e,i.disabled=!e,a.disabled=!u||d||l},m=async()=>{try{let n=await e.getContext();c=t(MenuController,n)}catch{c=null}p()};n.isARSupported().then(e=>{u=e,p()});let h=e=>{!c||c.getDishSlotCount()<=1||(e<0?c.selectPreviousDish():c.selectNextDish(),p())},g=async()=>{if(!(!u||d||l)){d=!0,p();try{let t=await e.getContext();await n.start(`immersive-ar`,void 0,t)}catch(e){console.warn(`[assetPicker] Failed to start AR session:`,e)}finally{d=!1,p()}}};r.addEventListener(`click`,()=>h(-1)),i.addEventListener(`click`,()=>h(1)),a.addEventListener(`click`,()=>void g()),e.addEventListener(`enter-ar`,()=>{l=!0,p()}),e.addEventListener(`exit-ar`,()=>{l=!1,p()}),e.addEventListener(`enter-vr`,()=>{l=!0,p()}),e.addEventListener(`exit-vr`,()=>{l=!1,p()}),e.addEventListener(`loadfinished`,()=>void m()),f(()=>{requestAnimationFrame(()=>void m())})}p(),e(()=>import(`./needle-engine.HinF1QFy.js`),__vite__mapDeps([16,10,2,3,4,1,5,6,7,8,11,12,13,14,9,15]),import.meta.url); \ No newline at end of file diff --git a/Needle/MenuScene/dist/assets/index-Fs2VLbun.js.gz b/Needle/MenuScene/dist/assets/index-Fs2VLbun.js.gz new file mode 100644 index 0000000..8477365 Binary files /dev/null and b/Needle/MenuScene/dist/assets/index-Fs2VLbun.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js.gz b/Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js.gz deleted file mode 100644 index 1566212..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js b/Needle/MenuScene/dist/assets/needle-engine-particles.Bz_Ei_ja.js similarity index 99% rename from Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js rename to Needle/MenuScene/dist/assets/needle-engine-particles.Bz_Ei_ja.js index 6d1a580..7282d73 100644 --- a/Needle/MenuScene/dist/assets/needle-engine-particles.B21Zru40.js +++ b/Needle/MenuScene/dist/assets/needle-engine-particles.Bz_Ei_ja.js @@ -1 +1 @@ -import{Ar as e,Bt as t,Qt as n,Xt as r,Zt as i,d as a,fn as o,kr as s,qt as c,tt as l,vn as u,wn as d,yr as f}from"./three@0.169.19.js";import{$a as p,Jr as m,Ka as h,Ua as g,Xi as _,Zn as v,_a as ee,ba as te,co as ne,ct as re,dn as y,ot as b,pa as x,ra as S,un as C,va as ie}from"./needle-engine-ui.iRWmt52F.js";import{n as ae}from"./gltf-progressive.BBJGcb3s.js";import{yt as oe}from"./needle-engine-webxr.DDCPc9_g.js";import{a as se,c as ce,i as le,n as ue,o as de,r as w,s as fe,t as pe}from"./three-quarks.DALdLWPD.js";var me=Math.sqrt(3),he=Math.sqrt(5);.5*(me-1),(3-me)/6;var ge=(he-1)/4,T=(5-he)/20,_e=e=>Math.floor(e)|0,ve=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function ye(e=Math.random){let t=be(e),n=new Float64Array(t).map(e=>ve[e%32*4]),r=new Float64Array(t).map(e=>ve[e%32*4+1]),i=new Float64Array(t).map(e=>ve[e%32*4+2]),a=new Float64Array(t).map(e=>ve[e%32*4+3]);return function(e,o,s,c){let l,u,d,f,p,m=(e+o+s+c)*ge,h=_e(e+m),g=_e(o+m),_=_e(s+m),v=_e(c+m),ee=(h+g+_+v)*T,te=h-ee,ne=g-ee,re=_-ee,y=v-ee,b=e-te,x=o-ne,S=s-re,C=c-y,ie=0,ae=0,oe=0,se=0;b>x?ie++:ae++,b>S?ie++:oe++,b>C?ie++:se++,x>S?ae++:oe++,x>C?ae++:se++,S>C?oe++:se++;let ce=+(ie>=3),le=+(ae>=3),ue=+(oe>=3),de=+(se>=3),w=+(ie>=2),fe=+(ae>=2),pe=+(oe>=2),me=+(se>=2),he=+(ie>=1),ve=+(ae>=1),ye=+(oe>=1),be=+(se>=1),E=b-ce+T,D=x-le+T,xe=S-ue+T,O=C-de+T,Se=b-w+2*T,k=x-fe+2*T,A=S-pe+2*T,j=C-me+2*T,M=b-he+3*T,N=x-ve+3*T,P=S-ye+3*T,F=C-be+3*T,I=b-1+4*T,L=x-1+4*T,Ce=S-1+4*T,R=C-1+4*T,we=h&255,z=g&255,Te=_&255,B=v&255,V=.6-b*b-x*x-S*S-C*C;if(V<0)l=0;else{let e=we+t[z+t[Te+t[B]]];V*=V,l=V*V*(n[e]*b+r[e]*x+i[e]*S+a[e]*C)}let H=.6-E*E-D*D-xe*xe-O*O;if(H<0)u=0;else{let e=we+ce+t[z+le+t[Te+ue+t[B+de]]];H*=H,u=H*H*(n[e]*E+r[e]*D+i[e]*xe+a[e]*O)}let U=.6-Se*Se-k*k-A*A-j*j;if(U<0)d=0;else{let e=we+w+t[z+fe+t[Te+pe+t[B+me]]];U*=U,d=U*U*(n[e]*Se+r[e]*k+i[e]*A+a[e]*j)}let Ee=.6-M*M-N*N-P*P-F*F;if(Ee<0)f=0;else{let e=we+he+t[z+ve+t[Te+ye+t[B+be]]];Ee*=Ee,f=Ee*Ee*(n[e]*M+r[e]*N+i[e]*P+a[e]*F)}let De=.6-I*I-L*L-Ce*Ce-R*R;if(De<0)p=0;else{let e=we+1+t[z+1+t[Te+1+t[B+1]]];De*=De,p=De*De*(n[e]*I+r[e]*L+i[e]*Ce+a[e]*R)}return 27*(l+u+d+f+p)}}function be(e){let t=new Uint8Array(512);for(let e=0;e<512/2;e++)t[e]=e;for(let n=0;n<512/2-1;n++){let r=n+~~(e()*(256-n)),i=t[n];t[n]=t[r],t[r]=i}for(let e=256;e<512;e++)t[e]=t[e-256];return t}var E=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=class{time=0;value=0;inTangent=1/0;inWeight;outTangent=1/0;outWeight;weightedMode;constructor(e=0,t=0){this.time=e,this.value=t}};E([_()],D.prototype,`time`,void 0),E([_()],D.prototype,`value`,void 0),E([_()],D.prototype,`inTangent`,void 0),E([_()],D.prototype,`inWeight`,void 0),E([_()],D.prototype,`outTangent`,void 0),E([_()],D.prototype,`outWeight`,void 0),E([_()],D.prototype,`weightedMode`,void 0);var xe=class e{static linearFromTo(t,n,r){let i=new e,a=new D;a.time=0,a.value=t;let o=new D;return o.time=r,o.value=n,i.keys.push(a,o),i}static constant(t){let n=new e,r=new D;return r.time=0,r.value=t,n.keys.push(r),n}keys=[];clone(){let t=new e;return t.keys=this.keys?.map(e=>{let t=new D;return t.time=e.time,t.value=e.value,t.inTangent=e.inTangent,t.inWeight=e.inWeight,t.outTangent=e.outTangent,t.outWeight=e.outWeight,t.weightedMode=e.weightedMode,t})||[],t}get duration(){return!this.keys||this.keys.length==0?0:this.keys[this.keys.length-1].time}evaluate(t){if(!this.keys||this.keys.length==0)return 0;if(this.keys.length===1||this.keys[0].time>=t)return this.keys[0].value;for(let n=0;n=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Se=ne(`debugparticles`),k;(function(e){e[e.Billboard=0]=`Billboard`,e[e.Stretch=1]=`Stretch`,e[e.HorizontalBillboard=2]=`HorizontalBillboard`,e[e.VerticalBillboard=3]=`VerticalBillboard`,e[e.Mesh=4]=`Mesh`})(k||={});var A=class{alphaKeys=[];colorKeys=[];get duration(){return 1}evaluate(e,t){let n,r=0,i=null,a=0;for(let t=0;tt&&(t=r.value)}return t}};O([_()],I.prototype,`mode`,void 0),O([_()],I.prototype,`constant`,void 0),O([_()],I.prototype,`constantMin`,void 0),O([_()],I.prototype,`constantMax`,void 0),O([_(xe)],I.prototype,`curve`,void 0),O([_(xe)],I.prototype,`curveMin`,void 0),O([_(xe)],I.prototype,`curveMax`,void 0),O([_()],I.prototype,`curveMultiplier`,void 0);var L=class e{static constant(t){let n=new e;return n.constant(t),n}static betweenTwoColors(t,n){let r=new e;return r.betweenTwoColors(t,n),r}constant(e){return this.mode=M.Color,this.color=e,this}betweenTwoColors(e,t){return this.mode=M.TwoColors,this.colorMin=e,this.colorMax=t,this}mode=M.Color;color;colorMin;colorMax;gradient;gradientMin;gradientMax;static _temp=new y(0,0,0,1);static _temp2=new y(0,0,0,1);evaluate(t,n){let r=n===void 0?Math.random():n;switch(this.mode){case M.Color:case`Color`:return this.color;case M.Gradient:case`Gradient`:return this.gradient.evaluate(t,e._temp),e._temp;case M.TwoColors:case`TwoColors`:return e._temp.lerpColors(this.colorMin,this.colorMax,r);case M.TwoGradients:case`TwoGradients`:return this.gradientMin.evaluate(t,e._temp),this.gradientMax.evaluate(t,e._temp2),e._temp.lerp(e._temp2,r);case M.RandomColor:case`RandomColor`:let n=Math.random();return this.gradientMin.evaluate(t,e._temp),this.gradientMax.evaluate(t,e._temp2),e._temp.lerp(e._temp2,n)}return e._temp.set(16777215),e._temp.alpha=1,e._temp}};O([_()],L.prototype,`mode`,void 0),O([_(y)],L.prototype,`color`,void 0),O([_(y)],L.prototype,`colorMin`,void 0),O([_(y)],L.prototype,`colorMax`,void 0),O([_(A)],L.prototype,`gradient`,void 0),O([_(A)],L.prototype,`gradientMin`,void 0),O([_(A)],L.prototype,`gradientMax`,void 0);var Ce;(function(e){e[e.Hierarchy=0]=`Hierarchy`,e[e.Local=1]=`Local`,e[e.Shape=2]=`Shape`})(Ce||={});var R=class{cullingMode;duration;emitterVelocityMode;flipRotation;gravityModifier;gravityModifierMultiplier;loop;maxParticles;playOnAwake;prewarm;ringBufferLoopRange;ringBufferMode;scalingMode;simulationSpace;simulationSpeed;startColor;startDelay;startDelayMultiplier;startLifetime;startLifetimeMultiplier;startRotation;startRotationMultiplier;startRotation3D;startRotationX;startRotationXMultiplier;startRotationY;startRotationYMultiplier;startRotationZ;startRotationZMultiplier;startSize;startSize3D;startSizeMultiplier;startSizeX;startSizeXMultiplier;startSizeY;startSizeYMultiplier;startSizeZ;startSizeZMultiplier;startSpeed;startSpeedMultiplier;stopAction;useUnscaledTime};O([_(I)],R.prototype,`gravityModifier`,void 0),O([_(L)],R.prototype,`startColor`,void 0),O([_(I)],R.prototype,`startDelay`,void 0),O([_(I)],R.prototype,`startLifetime`,void 0),O([_(I)],R.prototype,`startRotation`,void 0),O([_(I)],R.prototype,`startRotationX`,void 0),O([_(I)],R.prototype,`startRotationY`,void 0),O([_(I)],R.prototype,`startRotationZ`,void 0),O([_(I)],R.prototype,`startSize`,void 0),O([_(I)],R.prototype,`startSizeX`,void 0),O([_(I)],R.prototype,`startSizeY`,void 0),O([_(I)],R.prototype,`startSizeZ`,void 0),O([_(I)],R.prototype,`startSpeed`,void 0);var we=class{cycleCount;maxCount;minCount;probability;repeatInterval;time;count;_performed=0;reset(){this._performed=0}run(e){if(e<=this.time)return 0;let t=0;if((this.cycleCount===0||this._performed=this.time+this.repeatInterval*this._performed&&(this._performed+=1,Math.random()e.reset())}getBurst(){let e=0;if(this.burstCount>0)for(let t=0;t=this.system.time&&n.reset(),e+=Math.round(n.run(this.system.time))}return e}};O([_()],z.prototype,`enabled`,void 0),O([_()],z.prototype,`bursts`,void 0),O([_(I)],z.prototype,`rateOverTime`,void 0),O([_()],z.prototype,`rateOverTimeMultiplier`,void 0),O([_(I)],z.prototype,`rateOverDistance`,void 0),O([_()],z.prototype,`rateOverDistanceMultiplier`,void 0);var Te=class{enabled;color};O([_(L)],Te.prototype,`color`,void 0);var B=class{enabled;separateAxes;size;sizeMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;_time=0;_temp=new e;evaluate(e,t,n){if(t||=this._temp,!this.enabled)return t.x=t.y=t.z=1,t;if(this.separateAxes)t.x=this.x.evaluate(e,n)*this.xMultiplier,t.y=this.y.evaluate(e,n)*this.yMultiplier,t.z=this.z.evaluate(e,n)*this.zMultiplier;else{let r=this.size.evaluate(e,n)*this.sizeMultiplier;t.x=r}return t}};O([_(I)],B.prototype,`size`,void 0),O([_(I)],B.prototype,`x`,void 0),O([_(I)],B.prototype,`y`,void 0),O([_(I)],B.prototype,`z`,void 0);var V;(function(e){e[e.Vertex=0]=`Vertex`,e[e.Edge=1]=`Edge`,e[e.Triangle=2]=`Triangle`})(V||={});var H=class t{get type(){return P[this.shapeType]}initialize(e){this.onInitialize(e),e.position.x=this._vector.x,e.position.y=this._vector.y,e.position.z=this._vector.z}toJSON(){return this}clone(){return new t}shapeType=P.Box;enabled=!0;alignToDirection=!1;angle=0;arc=360;arcSpread;arcSpeedMultiplier;arcMode;boxThickness;position;rotation;_rotation=new l;scale;radius;radiusThickness;sphericalDirectionAmount;randomDirectionAmount;randomPositionAmount;meshShapeType;meshRenderer;_meshObj;_meshGeometry;setMesh(e){this.meshRenderer=e,e?(this._meshObj=e.sharedMeshes[Math.floor(Math.random()*e.sharedMeshes.length)],this._meshGeometry=this._meshObj.geometry):(this._meshObj=void 0,this._meshGeometry=void 0)}system;_space;_worldSpaceMatrix=new r;_worldSpaceMatrixInverse=new r;constructor(){Se&&console.log(this)}update(e,t){}onUpdate(e,t,n,r){this.system=e,this._space=n,n===N.World&&(this._worldSpaceMatrix.copy(r.matrixWorld),this._worldSpaceMatrix.elements[0]=1,this._worldSpaceMatrix.elements[5]=1,this._worldSpaceMatrix.elements[10]=1,this._worldSpaceMatrixInverse.copy(this._worldSpaceMatrix).invert())}applyRotation(e){let t=this.rotation.x!==0||this.rotation.y!==0||this.rotation.z!==0;return t&&(this._rotation.x=g.toRadians(this.rotation.x),this._rotation.y=g.toRadians(this.rotation.y),this._rotation.z=g.toRadians(this.rotation.z),this._rotation.order=`ZYX`,e.applyEuler(this._rotation)),t}_vector=new e(0,0,0);_temp=new e(0,0,0);_triangle=new f;onInitialize(e){this._vector.set(0,0,0),e.mesh=void 0,e.mesh_geometry=void 0;let t=this._temp.copy(this.position),n=this._space===N.World;n&&t.applyQuaternion(this.system.worldQuaternion);let r=this.radius;if(n&&(r*=this.system.worldScale.x),this.enabled){switch(this.shapeType){case P.Box:Se&&C.DrawWireBox(this.position,this.scale,14540253,1),this._vector.x=Math.random()*this.scale.x-this.scale.x/2,this._vector.y=Math.random()*this.scale.y-this.scale.y/2,this._vector.z=Math.random()*this.scale.z-this.scale.z/2,this._vector.add(t);break;case P.Cone:this.randomConePoint(this.position,this.angle,r,this.radiusThickness,this.arc,this.arcMode,this._vector);break;case P.Sphere:this.randomSpherePoint(this.position,r,this.radiusThickness,this.arc,this._vector);break;case P.Circle:this.randomCirclePoint(this.position,r,this.radiusThickness,this.arc,this._vector);break;case P.MeshRenderer:let n=this.meshRenderer;n?.destroyed==0&&this.setMesh(n);let i=e.mesh=this._meshObj,a=e.mesh_geometry=this._meshGeometry;if(i&&a)switch(this.meshShapeType){case V.Vertex:{let t=a.getAttribute(`position`),n=Math.floor(Math.random()*t.count);this._vector.fromBufferAttribute(t,n),this._vector.applyMatrix4(i.matrixWorld),e.mesh_normal=n}break;case V.Edge:break;case V.Triangle:{let t=a.index;if(t){let n=Math.random(),r=Math.random();n+r>1&&(n=1-n,r=1-r);let o=Math.floor(Math.random()*(t.count/3)),s=o*3,c=o*3+1,l=o*3+2;s=t.getX(s),c=t.getX(c),l=t.getX(l);let u=a.getAttribute(`position`);this._triangle.a.fromBufferAttribute(u,s),this._triangle.b.fromBufferAttribute(u,c),this._triangle.c.fromBufferAttribute(u,l),this._vector.set(0,0,0).addScaledVector(this._triangle.a,n).addScaledVector(this._triangle.b,r).addScaledVector(this._triangle.c,1-(n+r)),this._vector.applyMatrix4(i.matrixWorld),e.mesh_normal=o}}break}break;default:this._vector.set(0,0,0),h()&&!globalThis.__particlesystem_shapetype_unsupported&&(console.warn(`ParticleSystem ShapeType is not supported:`,P[this.shapeType]),globalThis.__particlesystem_shapetype_unsupported=!0);break}this.randomizePosition(this._vector,this.randomPositionAmount)}this.applyRotation(this._vector),n&&(this._vector.applyQuaternion(this.system.worldQuaternion),this._vector.add(this.system.worldPos)),Se&&C.DrawSphere(this._vector,.03,16711680,.5,!0)}_dir=new e;getDirection(e,t){if(!this.enabled)return this._dir.set(0,0,1),this._dir;switch(this.shapeType){case P.Box:this._dir.set(0,0,1);break;case P.Cone:this._dir.set(0,0,1);break;case P.Circle:case P.Sphere:let n=t.x,r=t.y,i=t.z;this._dir.set(n,r,i),this.system?.worldspace?this._dir.sub(this.system.worldPos):this._dir.sub(this.position);break;case P.MeshRenderer:let a=e.mesh,o=e.mesh_geometry;if(a&&o)switch(this.meshShapeType){case V.Vertex:{let t=o.getAttribute(`normal`),n=e.mesh_normal;this._dir.fromBufferAttribute(t,n)}break;case V.Edge:break;case V.Triangle:{let t=o.index;if(t){let n=e.mesh_normal,r=t.getX(n*3),i=t.getX(n*3+1),s=t.getX(n*3+2),c=o.getAttribute(`position`),l=x(),u=x(),d=x();l.fromBufferAttribute(c,r),u.fromBufferAttribute(c,i),d.fromBufferAttribute(c,s),l.sub(u),d.sub(u),l.cross(d),this._dir.copy(l).multiplyScalar(-1);let f=ie(a);this._dir.applyQuaternion(f)}}break}break;default:this._dir.set(0,0,1);break}return this._space===N.World&&this._dir.applyQuaternion(this.system.worldQuaternion),this.applyRotation(this._dir),this._dir.normalize(),this.spherizeDirection(this._dir,this.sphericalDirectionAmount),this.randomizeDirection(this._dir,this.randomDirectionAmount),Se&&(C.DrawSphere(t,.01,8925952,.5,!0),C.DrawDirection(t,this._dir,8925952,.5,!0)),this._dir}static _randomQuat=new d;static _tempVec=new e;randomizePosition(e,n){if(n<=0)return;let r=t._tempVec;r.set(Math.random()*2-1,Math.random()*2-1,Math.random()*2-1),r.x*=n*this.scale.x,r.y*=n*this.scale.y,r.z*=n*this.scale.z,e.add(r)}randomizeDirection(e,n){if(n===0)return;let r=t._randomQuat,i=t._tempVec;i.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).normalize(),r.setFromAxisAngle(i,n*Math.random()*Math.PI),e.applyQuaternion(r)}spherizeDirection(t,n){if(n===0)return;let r=Math.random()*Math.PI*2,i=Math.acos(1-Math.random()*2),a=new e(Math.sin(i)*Math.cos(r),Math.sin(i)*Math.sin(r),Math.cos(i));t.lerp(a,n)}randomSpherePoint(e,t,n,r,i){let a=Math.random(),o=Math.random(),s=2*Math.PI*a*(r/360),c=Math.acos(2*o-1),l=g.lerp(1,1-(1-Math.random())**Math.PI,n)*t,u=e.x+this.scale.x*(-l*Math.sin(c)*Math.cos(s)),d=e.y+this.scale.y*(l*Math.sin(c)*Math.sin(s)),f=e.z+this.scale.z*(l*Math.cos(c));i.x=u,i.y=d,i.z=f}randomCirclePoint(e,t,n,r,i){let a=Math.random(),o=2*Math.PI*a*(r/360),s=g.lerp(1,1-(1-Math.random())**Math.PI,n)*t,c=e.x+this.scale.x*s*Math.cos(o),l=e.y+this.scale.y*s*Math.sin(o),u=e.z;i.x=c,i.y=l,i.z=u}_loopTime=0;_loopDirection=1;randomConePoint(e,t,n,r,i,a,o){let s=0,c=0;switch(a){case F.Random:s=Math.random(),c=Math.random();break;case F.PingPong:this._loopTime>1&&(this._loopDirection=-1),this._loopTime<0&&(this._loopDirection=1);case F.Loop:s=.5,c=Math.random(),this._loopTime+=this.system.deltaTime*this._loopDirection;break}let l=2*Math.PI*s*(i/360);switch(a){case F.PingPong:case F.Loop:l+=Math.PI+.5,l+=this._loopTime*Math.PI*2,l%=g.toRadians(i);break}let u=Math.acos(2*c-1),d=g.lerp(1,1-(1-Math.random())**Math.PI,r)*n,f=e.x+-d*Math.sin(u)*Math.cos(l),p=e.y+d*Math.sin(u)*Math.sin(l),m=e.z;o.x=f*this.scale.x,o.y=p*this.scale.y,o.z=m*this.scale.z}};O([_()],H.prototype,`shapeType`,void 0),O([_()],H.prototype,`enabled`,void 0),O([_()],H.prototype,`alignToDirection`,void 0),O([_()],H.prototype,`angle`,void 0),O([_()],H.prototype,`arc`,void 0),O([_()],H.prototype,`arcSpread`,void 0),O([_()],H.prototype,`arcSpeedMultiplier`,void 0),O([_()],H.prototype,`arcMode`,void 0),O([_(e)],H.prototype,`boxThickness`,void 0),O([_(e)],H.prototype,`position`,void 0),O([_(e)],H.prototype,`rotation`,void 0),O([_(e)],H.prototype,`scale`,void 0),O([_()],H.prototype,`radius`,void 0),O([_()],H.prototype,`radiusThickness`,void 0),O([_()],H.prototype,`sphericalDirectionAmount`,void 0),O([_()],H.prototype,`randomDirectionAmount`,void 0),O([_()],H.prototype,`randomPositionAmount`,void 0),O([_()],H.prototype,`meshShapeType`,void 0),O([_(oe)],H.prototype,`meshRenderer`,void 0);var U=class{damping;enabled;frequency;octaveCount;octaveMultiplier;octaveScale;positionAmount;quality;remap;remapEnabled;remapMultiplier;remapX;remapXMultiplier;remapY;remapYMultiplier;remapZ;remapZMultiplier;scrollSpeedMultiplier;separateAxes;strengthMultiplier;strengthX;strengthXMultiplier;strengthY;strengthYMultiplier;strengthZ;strengthZMultiplier;_noise;_time=0;update(e){this._time+=e.time.deltaTime*this.scrollSpeedMultiplier}_temp=new e;apply(e,t,n,r,i,a){if(!this.enabled)return;this._noise||=ye(()=>0);let o=this._temp.set(t.x,t.y,t.z).multiplyScalar(this.frequency),s=this._noise(o.x,o.y,o.z,this._time),c=this._noise(o.x,o.y,o.z,this._time+1e3*this.frequency),l=this._noise(o.x,o.y,o.z,this._time+2e3*this.frequency);this._temp.set(s,c,l).normalize();let u=i/a,d=this.positionAmount.evaluate(u);this.separateAxes?(this._temp.x*=d*this.strengthXMultiplier,this._temp.y*=d*this.strengthYMultiplier,this._temp.z*=d*this.strengthZMultiplier):(this.strengthX&&(d*=this.strengthX.evaluate(u)*1.5),this._temp.multiplyScalar(d)),n.x+=this._temp.x,n.y+=this._temp.y,n.z+=this._temp.z}};O([_()],U.prototype,`damping`,void 0),O([_()],U.prototype,`enabled`,void 0),O([_()],U.prototype,`frequency`,void 0),O([_()],U.prototype,`octaveCount`,void 0),O([_()],U.prototype,`octaveMultiplier`,void 0),O([_()],U.prototype,`octaveScale`,void 0),O([_(I)],U.prototype,`positionAmount`,void 0),O([_()],U.prototype,`quality`,void 0),O([_(I)],U.prototype,`remap`,void 0),O([_()],U.prototype,`remapEnabled`,void 0),O([_()],U.prototype,`remapMultiplier`,void 0),O([_(I)],U.prototype,`remapX`,void 0),O([_()],U.prototype,`remapXMultiplier`,void 0),O([_(I)],U.prototype,`remapY`,void 0),O([_()],U.prototype,`remapYMultiplier`,void 0),O([_(I)],U.prototype,`remapZ`,void 0),O([_()],U.prototype,`remapZMultiplier`,void 0),O([_()],U.prototype,`scrollSpeedMultiplier`,void 0),O([_()],U.prototype,`separateAxes`,void 0),O([_()],U.prototype,`strengthMultiplier`,void 0),O([_(I)],U.prototype,`strengthX`,void 0),O([_()],U.prototype,`strengthXMultiplier`,void 0),O([_(I)],U.prototype,`strengthY`,void 0),O([_()],U.prototype,`strengthYMultiplier`,void 0),O([_(I)],U.prototype,`strengthZ`,void 0),O([_()],U.prototype,`strengthZMultiplier`,void 0);var Ee;(function(e){e[e.PerParticle=0]=`PerParticle`,e[e.Ribbon=1]=`Ribbon`})(Ee||={});var De;(function(e){e[e.Stretch=0]=`Stretch`,e[e.Tile=1]=`Tile`,e[e.DistributePerSegment=2]=`DistributePerSegment`,e[e.RepeatPerSegment=3]=`RepeatPerSegment`})(De||={});var W=class{enabled;attachRibbonToTransform=!1;colorOverLifetime;colorOverTrail;dieWithParticles=!0;inheritParticleColor=!0;lifetime;lifetimeMultiplier;minVertexDistance=.2;mode=Ee.PerParticle;ratio=1;ribbonCount=1;shadowBias=0;sizeAffectsLifetime=!1;sizeAffectsWidth=!1;splitSubEmitterRibbons=!1;textureMode=De.Stretch;widthOverTrail;widthOverTrailMultiplier;worldSpace=!1;getWidth(e,t,n,r){let i=this.widthOverTrail.evaluate(n,r);return e*=i,e}getColor(e,t,n){let r=this.colorOverTrail.evaluate(n),i=this.colorOverLifetime.evaluate(t);e.x*=r.r*i.r,e.y*=r.g*i.g,e.z*=r.b*i.b,`alpha`in r&&`alpha`in i&&(e.w*=r.alpha*i.alpha)}};O([_()],W.prototype,`enabled`,void 0),O([_()],W.prototype,`attachRibbonToTransform`,void 0),O([_(L)],W.prototype,`colorOverLifetime`,void 0),O([_(L)],W.prototype,`colorOverTrail`,void 0),O([_()],W.prototype,`dieWithParticles`,void 0),O([_()],W.prototype,`inheritParticleColor`,void 0),O([_(I)],W.prototype,`lifetime`,void 0),O([_()],W.prototype,`lifetimeMultiplier`,void 0),O([_()],W.prototype,`minVertexDistance`,void 0),O([_()],W.prototype,`mode`,void 0),O([_()],W.prototype,`ratio`,void 0),O([_()],W.prototype,`ribbonCount`,void 0),O([_()],W.prototype,`shadowBias`,void 0),O([_()],W.prototype,`sizeAffectsLifetime`,void 0),O([_()],W.prototype,`sizeAffectsWidth`,void 0),O([_()],W.prototype,`splitSubEmitterRibbons`,void 0),O([_()],W.prototype,`textureMode`,void 0),O([_(I)],W.prototype,`widthOverTrail`,void 0),O([_()],W.prototype,`widthOverTrailMultiplier`,void 0),O([_()],W.prototype,`worldSpace`,void 0);var G=class{enabled;space=N.Local;orbitalX;orbitalY;orbitalZ;orbitalXMultiplier;orbitalYMultiplier;orbitalZMultiplier;orbitalOffsetX;orbitalOffsetY;orbitalOffsetZ;speedModifier;speedModifierMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;_system;update(e){this._system=e}_temp=new e;_temp2=new e;_temp3=new e;_hasOrbital=!1;_index=0;_orbitalMatrix=new r;init(e){this._index==0&&(e.debug=!0),this._index+=1,e.orbitx=this.orbitalX.evaluate(Math.random()),e.orbity=this.orbitalY.evaluate(Math.random()),e.orbitz=this.orbitalZ.evaluate(Math.random()),this._hasOrbital=e.orbitx!=0||e.orbity!=0||e.orbitz!=0}apply(e,t,n,r,i,a,o){if(!this.enabled)return;let s=a/o,c=this.speedModifier.evaluate(s)*this.speedModifierMultiplier,l=this.x.evaluate(s),u=this.y.evaluate(s),d=this.z.evaluate(s);if(this._temp.set(-l,u,d),this._system&&this._system.main.simulationSpace===N.World&&this._temp.applyQuaternion(this._system.worldQuaternion),this._hasOrbital&&this._system?.worldPos){let e=this._temp2.set(n.x,n.y,n.z),t=this.orbitalXMultiplier,a=this.orbitalYMultiplier,o=this.orbitalZMultiplier,s=c*Math.PI*2*10,l=Math.cos(s*t),u=Math.sin(s*t),d=Math.cos(s*a),f=Math.sin(s*a),p=Math.cos(s*o),m=Math.sin(s*o),h=e.x*(d*p)+e.y*(d*m)+e.z*-f,g=e.x*(u*f*p-l*m)+e.y*(u*f*m+l*p)+e.z*(u*d),_=e.x*(l*f*p+u*m)+e.y*(l*f*m-u*p)+e.z*(l*d),v=this._temp3.set(e.x-h,e.y-g,e.z-_);v.normalize(),v.multiplyScalar(.2/i*Math.max(this.orbitalXMultiplier,this.orbitalYMultiplier,this.orbitalZMultiplier)),r.x+=v.x,r.y+=v.y,r.z+=v.z}r.x+=this._temp.x,r.y+=this._temp.y,r.z+=this._temp.z,r.x*=c,r.y*=c,r.z*=c}};O([_()],G.prototype,`enabled`,void 0),O([_()],G.prototype,`space`,void 0),O([_(I)],G.prototype,`orbitalX`,void 0),O([_(I)],G.prototype,`orbitalY`,void 0),O([_(I)],G.prototype,`orbitalZ`,void 0),O([_()],G.prototype,`orbitalXMultiplier`,void 0),O([_()],G.prototype,`orbitalYMultiplier`,void 0),O([_()],G.prototype,`orbitalZMultiplier`,void 0),O([_()],G.prototype,`orbitalOffsetX`,void 0),O([_()],G.prototype,`orbitalOffsetY`,void 0),O([_()],G.prototype,`orbitalOffsetZ`,void 0),O([_(I)],G.prototype,`speedModifier`,void 0),O([_()],G.prototype,`speedModifierMultiplier`,void 0),O([_(I)],G.prototype,`x`,void 0),O([_()],G.prototype,`xMultiplier`,void 0),O([_(I)],G.prototype,`y`,void 0),O([_()],G.prototype,`yMultiplier`,void 0),O([_(I)],G.prototype,`z`,void 0),O([_()],G.prototype,`zMultiplier`,void 0);var Oe;(function(e){e[e.Lifetime=0]=`Lifetime`,e[e.Speed=1]=`Speed`,e[e.FPS=2]=`FPS`})(Oe||={});var ke;(function(e){e[e.Grid=0]=`Grid`,e[e.Sprites=1]=`Sprites`})(ke||={});var Ae;(function(e){e[e.Custom=0]=`Custom`,e[e.Random=1]=`Random`,e[e.MeshIndex=2]=`MeshIndex`})(Ae||={});var je;(function(e){e[e.WholeSheet=0]=`WholeSheet`,e[e.SingleRow=1]=`SingleRow`})(je||={});var K=class{animation;enabled;cycleCount;frameOverTime;frameOverTimeMultiplier;numTilesX;numTilesY;startFrame;startFrameMultiplier;rowMode;rowIndex;spriteCount;timeMode;sampleOnceAtStart(){if(this.timeMode===Oe.Lifetime)switch(this.frameOverTime.mode){case j.Constant:case j.TwoConstants:case j.TwoCurves:case j.Curve:return!0}return!1}getStartIndex(){return this.sampleOnceAtStart()?Math.random()*(this.numTilesX*this.numTilesY):0}evaluate(e){if(!this.sampleOnceAtStart())return this.getIndex(e)}getIndex(e){let t=this.numTilesX*this.numTilesY;e*=this.cycleCount;let n=this.frameOverTime.evaluate(e%1);return n*=this.frameOverTimeMultiplier,n*=t,n%=t,n=Math.floor(n),n}};O([_()],K.prototype,`animation`,void 0),O([_()],K.prototype,`enabled`,void 0),O([_()],K.prototype,`cycleCount`,void 0),O([_(I)],K.prototype,`frameOverTime`,void 0),O([_()],K.prototype,`frameOverTimeMultiplier`,void 0),O([_()],K.prototype,`numTilesX`,void 0),O([_()],K.prototype,`numTilesY`,void 0),O([_(I)],K.prototype,`startFrame`,void 0),O([_()],K.prototype,`startFrameMultiplier`,void 0),O([_()],K.prototype,`rowMode`,void 0),O([_()],K.prototype,`rowIndex`,void 0),O([_()],K.prototype,`spriteCount`,void 0),O([_()],K.prototype,`timeMode`,void 0);var q=class{enabled;separateAxes;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t){return this.enabled?this.separateAxes?0:this.z.evaluate(e,t)*-1:0}};O([_()],q.prototype,`enabled`,void 0),O([_()],q.prototype,`separateAxes`,void 0),O([_(I)],q.prototype,`x`,void 0),O([_()],q.prototype,`xMultiplier`,void 0),O([_(I)],q.prototype,`y`,void 0),O([_()],q.prototype,`yMultiplier`,void 0),O([_(I)],q.prototype,`z`,void 0),O([_()],q.prototype,`zMultiplier`,void 0);var J=class{enabled;range;separateAxes;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t){if(!this.enabled)return 0;if(!this.separateAxes){let e=g.lerp(this.range.x,this.range.y,t);return this.z.evaluate(e)*-1}return 0}};O([_()],J.prototype,`enabled`,void 0),O([_()],J.prototype,`range`,void 0),O([_()],J.prototype,`separateAxes`,void 0),O([_(I)],J.prototype,`x`,void 0),O([_()],J.prototype,`xMultiplier`,void 0),O([_(I)],J.prototype,`y`,void 0),O([_()],J.prototype,`yMultiplier`,void 0),O([_(I)],J.prototype,`z`,void 0),O([_()],J.prototype,`zMultiplier`,void 0);var Y=class{enabled;dampen;drag;dragMultiplier;limit;limitMultiplier;separateAxes;limitX;limitXMultiplier;limitY;limitYMultiplier;limitZ;limitZMultiplier;multiplyDragByParticleSize=!1;multiplyDragByParticleVelocity=!1;space;_temp=new e;_temp2=new e;apply(e,t,n,r,i,a,o){if(this.enabled){let e=this.limit.evaluate(i)*this.limitMultiplier;if(t.length()>e){this._temp.copy(t).normalize().multiplyScalar(e);let r=this.dampen*.5;t.x=g.lerp(t.x,this._temp.x,r),t.y=g.lerp(t.y,this._temp.y,r),t.z=g.lerp(t.z,this._temp.z,r),n.x=g.lerp(n.x,this._temp.x,r),n.y=g.lerp(n.y,this._temp.y,r),n.z=g.lerp(n.z,this._temp.z,r)}}}};O([_()],Y.prototype,`enabled`,void 0),O([_()],Y.prototype,`dampen`,void 0),O([_(I)],Y.prototype,`drag`,void 0),O([_()],Y.prototype,`dragMultiplier`,void 0),O([_(I)],Y.prototype,`limit`,void 0),O([_()],Y.prototype,`limitMultiplier`,void 0),O([_()],Y.prototype,`separateAxes`,void 0),O([_(I)],Y.prototype,`limitX`,void 0),O([_()],Y.prototype,`limitXMultiplier`,void 0),O([_(I)],Y.prototype,`limitY`,void 0),O([_()],Y.prototype,`limitYMultiplier`,void 0),O([_(I)],Y.prototype,`limitZ`,void 0),O([_()],Y.prototype,`limitZMultiplier`,void 0),O([_()],Y.prototype,`multiplyDragByParticleSize`,void 0),O([_()],Y.prototype,`multiplyDragByParticleVelocity`,void 0),O([_()],Y.prototype,`space`,void 0);var Me;(function(e){e[e.Initial=0]=`Initial`,e[e.Current=1]=`Current`})(Me||={});var Ne=class t{enabled;curve;curveMultiplier;mode;clone(){let e=new t;return e.enabled=this.enabled,e.curve=this.curve?.clone(),e.curveMultiplier=this.curveMultiplier,e.mode=this.mode,e}system;get _lastWorldPosition(){return this.system._iv_lastWorldPosition||(this.system._iv_lastWorldPosition=new e),this.system._iv_lastWorldPosition}get _velocity(){return this.system._iv_velocity||(this.system._iv_velocity=new e),this.system._iv_velocity}_temp=new e;_firstUpdate=!0;awake(e){this.system=e,this.reset()}reset(){this._firstUpdate=!0}update(e){this.enabled&&this.system.worldspace!==!1&&(this._firstUpdate?(this._firstUpdate=!1,this._velocity.set(0,0,0),this._lastWorldPosition.copy(this.system.worldPos)):this._lastWorldPosition&&(this._velocity.copy(this.system.worldPos).sub(this._lastWorldPosition).multiplyScalar(1/this.system.deltaTime),this._lastWorldPosition.copy(this.system.worldPos)))}applyInitial(e){if(this.enabled&&this.system.worldspace!==!1&&this.mode===Me.Initial){let t=this.curve.evaluate(Math.random(),Math.random());this._temp.copy(this._velocity).multiplyScalar(t),e.x+=this._temp.x,e.y+=this._temp.y,e.z+=this._temp.z}}_frames=0;applyCurrent(e,t,n){if(this.enabled&&this.system&&this.system.worldspace!==!1&&this.mode===Me.Current){let r=this.curve.evaluate(t,n);this._temp.copy(this._velocity).multiplyScalar(r),e.x+=this._temp.x,e.y+=this._temp.y,e.z+=this._temp.z}}};O([_()],Ne.prototype,`enabled`,void 0),O([_(I)],Ne.prototype,`curve`,void 0),O([_()],Ne.prototype,`curveMultiplier`,void 0),O([_()],Ne.prototype,`mode`,void 0);var X=class{enabled;range;separateAxes;size;sizeMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t,n,r){let i=e.length(),a=g.remap(i,this.range.x,this.range.y,0,1),o=this.size.evaluate(a,n);return r.x*=o,r.y*=o,r.z*=o,r}};O([_()],X.prototype,`enabled`,void 0),O([_(s)],X.prototype,`range`,void 0),O([_()],X.prototype,`separateAxes`,void 0),O([_(I)],X.prototype,`size`,void 0),O([_()],X.prototype,`sizeMultiplier`,void 0),O([_(I)],X.prototype,`x`,void 0),O([_()],X.prototype,`xMultiplier`,void 0),O([_(I)],X.prototype,`y`,void 0),O([_()],X.prototype,`yMultiplier`,void 0),O([_(I)],X.prototype,`z`,void 0),O([_()],X.prototype,`zMultiplier`,void 0);var Pe=class{enabled;range;color;evaluate(e,t,n){let r=e.length(),i=g.remap(r,this.range.x,this.range.y,0,1),a=this.color.evaluate(i,t);n.x*=a.r,n.y*=a.g,n.z*=a.b,`alpha`in a&&(n.w*=a.alpha)}};O([_()],Pe.prototype,`enabled`,void 0),O([_(s)],Pe.prototype,`range`,void 0),O([_(L)],Pe.prototype,`color`,void 0),new e(1,1,1),new e(0,0,1);var Fe=class{system;particleSystem;subSystem;subParticleSystem;type=`NeedleParticleSubEmitter`;emitterType;emitterProbability;q_=new d;v_=new e;v2_=new e;_emitterMatrix=new de;_circularBuffer;constructor(e,t,n,r){this.system=e,this.particleSystem=t,this.subSystem=n,this.subParticleSystem=r,this.subParticleSystem&&this.subParticleSystem&&(this.subParticleSystem.onlyUsedByOther=!0),this._circularBuffer=new p(()=>new de,1e3)}clone(){throw Error(`Method not implemented.`)}initialize(e){e.emissionState={burstIndex:0,burstWaveIndex:0,time:0,waitEmiting:0},this._emitterMatrix.copy(this.subSystem.matrixWorld).invert().premultiply(this.system.matrixWorld),this._emitterMatrix.setPosition(0,0,0),this.emitterType===ze.Birth&&this.run(e)}update(e,t){this.run(e)}frameUpdate(e){}toJSON(){}reset(){}run(e){if(this.subSystem.currentParticles>=this.subSystem.main.maxParticles||!this.subParticleSystem||!e.emissionState||this.emitterProbability&&Math.random()>this.emitterProbability)return;let t=this.system.deltaTime;if(this.emitterType===ze.Death){let n=e.life;if(e[Qe]!==void 0&&(n=e[Qe]),!(e.age+t*1.2>=n))return;let r=this.subSystem.main.maxParticles-this.subSystem.currentParticles;e.emissionState.waitEmiting=r}let n=new de;n.set(1,0,0,e.position.x,0,1,0,e.position.y,0,0,1,e.position.z,0,0,0,1),this.particleSystem.worldSpace||n.multiplyMatrices(this._emitterMatrix,n),this.subParticleSystem.emit(t,e.emissionState,n)}},Z=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ie=ne(`debugparticles`),Le=ne(`noprogressive`),Re=ne(`debugprogressive`),ze;(function(e){e[e.Birth=0]=`Birth`,e[e.Collision=1]=`Collision`,e[e.Death=2]=`Death`,e[e.Trigger=3]=`Trigger`,e[e.Manual=4]=`Manual`})(ze||={});var Q=class extends b{renderMode;particleMaterial;trailMaterial;particleMesh;maxParticleSize;minParticleSize;velocityScale;cameraVelocityScale;lengthScale;start(){if(this.maxParticleSize!==.5&&this.minParticleSize!==0&&h()){let e=`ParticleSystem \"${this.name}\" has non-default min/max particle size. This may not render correctly. Please set min size to 0 and the max size to 0.5 and use the \"StartSize\" setting instead`;console.warn(e)}}get transparent(){return this.particleMaterial?.transparent??!1}getMaterial(e=!1){let r=e===!0&&this.trailMaterial?this.trailMaterial:this.particleMaterial;if(r){if(r.type===`MeshStandardMaterial`){Ie&&console.debug(`ParticleSystemRenderer.getMaterial: MeshStandardMaterial detected, converting to MeshBasicMaterial. See https://github.com/Alchemist0823/three.quarks/issues/101`),`map`in r&&r.map&&(r.map.colorSpace=t,r.map.premultiplyAlpha=!1);let i=new n;i.copy(r),e?this.trailMaterial=i:this.particleMaterial=i}r.map&&(r.map.colorSpace=t,r.map.premultiplyAlpha=!1),e&&r.side===0&&(r=r.clone(),r.side=1,e?this.trailMaterial=r:this.particleMaterial=r)}return r&&!Le&&r._didRequestTextureLOD===void 0&&(r._didRequestTextureLOD=0,Re&&console.log(`Load material LOD`,r.name),ae.assignTextureLOD(r,0)),r}getMesh(e){let t=null;if(!t&&(this.particleMesh instanceof i&&(t=this.particleMesh.geometry),t===null)){t=new u(1,1);let e=t.attributes.uv;for(let t=0;t=this.system.maxParticles)return 0;let e=this.system.emission.rateOverTime.evaluate(this.system.time/this.system.duration,Math.random());if(this.system.deltaTime>0){let t=this.system.emission.rateOverDistance.evaluate(this.system.time/this.system.duration,Math.random()),n=this._lastDistance/this.system.deltaTime*t;Number.isFinite(n)||(n=0),e+=n}let t=this.system.emission.getBurst();t>0&&(e+=t/this.system.deltaTime);let n=this.system.maxParticles-this.system.currentParticles;return g.clamp(e,0,n/this.system.deltaTime)}},We=class extends Ve{genValue(){return this.system.isPlaying,0}},Ge=class{system;get context(){return this.system.context}constructor(e){this.type=Object.getPrototypeOf(this).constructor.name||`ParticleSystemBaseBehaviour`,e&&(this.system=e)}type;initialize(e){}update(e,t){}frameUpdate(e){}toJSON(){throw Error(`Method not implemented.`)}clone(){throw Error(`Method not implemented.`)}reset(){}},Ke=class extends Ge{type=`NeedleTextureSheet`;update(e,t){let n=this.system.textureSheetAnimation;if(n.enabled){let t=e.age/e.life,r=n.evaluate(t);r!==void 0&&(e.uvTile=r)}}},qe=Symbol(`particleRotation`),Je=class extends Ge{type=`NeedleRotation`;initialize(e){e[qe]=Math.random()}update(e,t){if(e.rotation===void 0)return;let n=e.age/e.life;if(typeof e.rotation==`number`&&(this.system.rotationOverLifetime.enabled?e.rotation+=this.system.rotationOverLifetime.evaluate(n,e[qe])*t:this.system.renderer.renderMode===k.Billboard&&(e.rotation=Math.PI),this.system.rotationBySpeed.enabled)){let r=e.velocity.length();e.rotation+=this.system.rotationBySpeed.evaluate(n,r)*t}}},Ye=Symbol(`sizeLerpFactor`),Xe=new e,Ze=class extends Ge{type=`NeedleSize`;_minSize=0;_maxSize=1;initialize(e){e[Ye]=Math.random(),this._minSize=this.system.renderer.minParticleSize,this._maxSize=this.system.renderer.maxParticleSize}update(e,t){let n=e.age/e.life,r=1;this.system.sizeOverLifetime.enabled&&(r*=this.system.sizeOverLifetime.evaluate(n,void 0,e[Ye]).x);let i=1;this.system.renderer.renderMode!==k.Mesh&&(i=this.system.worldScale.x/this.system.cameraScale);let a=x(e.startSize).multiplyScalar(r*i);if(e.size.set(a.x,a.y,a.z),this.system.localspace){let t=gt(this.system,Xe);e.size.x*=t.x,e.size.y*=t.y,e.size.z*=t.z}}},Qe=Symbol(`particleLife`),$e=Symbol(`trailLifetime`),et=Symbol(`trailStartLength`),tt=Symbol(`trailWidthRandom`),nt=class extends Ge{type=`NeedleTrail`;initialize(e){e instanceof fe&&(e[Qe]=e.life,this.system.trails.enabled&&this.system.trails.dieWithParticles===!1&&(e[$e]=this.system.trails.lifetime.evaluate(Math.random(),Math.random()),e.life+=e[$e]),e[et]=e.length,e[tt]=Math.random())}update(e){if(this.system.trails?.enabled&&e instanceof fe){let t=e,n=e.age/e[Qe],r=e.previous.values(),i=e.previous.length;for(let a=0;ae[Qe]){e.velocity.set(0,0,0);let n=(e.age-e[Qe])/e[$e];t.length=g.lerp(e[et],0,n)}}}},rt=Symbol(`startVelocity`),it=Symbol(`gravityModifier`),at=Symbol(`gravitySpeed`),ot=Symbol(`velocity lerp factor`),st=new e;new d;var ct=class extends Ge{type=`NeedleVelocity`;_gravityDirection=new e;initialize(e){let t=this.system.main.simulationSpeed;e.startSpeed=this.system.main.startSpeed.evaluate(Math.random(),Math.random());let n=this.system.shape.getDirection(e,e.position);e.velocity.x=n.x*e.startSpeed,e.velocity.y=n.y*e.startSpeed,e.velocity.z=n.z*e.startSpeed,this.system.inheritVelocity?.enabled&&this.system.inheritVelocity.applyInitial(e.velocity),e[rt]?e[rt].copy(e.velocity):e[rt]=e.velocity.clone();let r=this.system.main.gravityModifier.evaluate(Math.random(),Math.random());e[it]=r*t,e[at]=r*t*.5,e[ot]=Math.random(),this.system.velocityOverLifetime?.init(e),this._gravityDirection.set(0,-1,0),this.system.main.simulationSpace===N.Local&&this._gravityDirection.applyQuaternion(this.system.worldQuaternionInverted).normalize()}update(e,t){let n=e[rt],r=e[it];if(r!==0){let i=r*e[at];st.copy(this._gravityDirection).multiplyScalar(i),e[at]+=t*.05,n.add(st)}e.velocity.copy(n);let i=e.age/e.life;this.system.inheritVelocity?.enabled&&this.system.inheritVelocity.applyCurrent(e.velocity,i,e[ot]);let a=this.system.noise;a.enabled&&a.apply(0,e.position,e.velocity,t,e.age,e.life);let o=this.system.sizeBySpeed;o?.enabled&&(e.size=o.evaluate(e.velocity,i,e[ot],e.size));let s=this.system.colorBySpeed;s?.enabled&&s.evaluate(e.velocity,e[ot],e.color);let c=this.system.velocityOverLifetime;c.enabled&&c.apply(e,0,e.position,e.velocity,t,e.age,e.life);let l=this.system.limitVelocityOverLifetime;if(l.enabled&&l.apply(e.position,n,e.velocity,e.size,i,t,1),this.system.worldspace){let t=this.system.worldScale;e.velocity.x*=t.x,e.velocity.y*=t.y,e.velocity.z*=t.z}}},lt=Symbol(`colorLerpFactor`),ut=new y(1,1,1,1),dt=new y(1,1,1,1),ft=class extends Ge{type=`NeedleColor`;initialize(e){}_init(e){let t=this.system.renderer.particleMaterial;dt.copy(this.system.main.startColor.evaluate(Math.random())),t?.color&&(ut.copy(t.color),dt.multiply(ut)),dt.convertLinearToSRGB(),e.startColor.set(dt.r,dt.g,dt.b,dt.alpha),e.color.copy(e.startColor),e[lt]=Math.random()}update(e,t){if(e.age===0&&this._init(e),this.system.colorOverLifetime.enabled){let t=e.age/e.life,n=this.system.colorOverLifetime.color.evaluate(t,e[lt]);e.color.set(n.r,n.g,n.b,`alpha`in n?n.alpha:1).multiply(e.startColor)}else e.color.copy(e.startColor)}},pt=class{system;emission;get anim(){return this.system.textureSheetAnimation}constructor(e){this.system=e,this.emission=new Ue(this.system)}get prewarm(){return!1}get material(){return this.system.renderer.getMaterial(this.system.trails.enabled)}get layers(){return this.system.gameObject.layers}update(){this.emission.update()}autoDestroy;get looping(){return this.system.main.loop}get duration(){return this.system.duration}get shape(){return this.system.shape}get startLife(){return new Be(this.system.main.startLifetime)}get startSpeed(){return new Be(this.system.main.startSpeed)}get startRotation(){return new Be(this.system.main.startRotation)}get startSize(){return new Be(this.system.main.startSize)}startLength;get startColor(){return new le(new ce(1,1,1,1))}get emissionOverTime(){return this.emission}get emissionOverDistance(){return new We(this.system)}emissionBursts;onlyUsedByOther;behaviors=[];get instancingGeometry(){return this.system.renderer.getMesh(this.system.renderer.renderMode).geometry}get renderMode(){if(this.system.trails.enabled===!0)return w.Trail;switch(this.system.renderer.renderMode){case k.Billboard:return w.BillBoard;case k.Stretch:return w.StretchedBillBoard;case k.HorizontalBillboard:return w.HorizontalBillBoard;case k.VerticalBillboard:return w.VerticalBillBoard;case k.Mesh:return w.Mesh}return w.BillBoard}rendererEmitterSettings={startLength:new se(220),followLocalOrigin:!1};get speedFactor(){let e=this.system.main.simulationSpeed;return this.system.renderer?.renderMode===k.Stretch&&(e*=this.system.renderer.velocityScale??1),e}flatWhiteTexture;clonedTexture={original:void 0,clone:void 0};get texture(){let e=this.material;if(e&&e.map){let n=e.map;if(this.clonedTexture.original!==n||!this.clonedTexture.clone){let e=n.clone();e.premultiplyAlpha=!1,e.colorSpace=t,this.clonedTexture.original=n,this.clonedTexture.clone=e}return this.clonedTexture.clone}return this.flatWhiteTexture||=v(new y(1,1,1,1),1),this.flatWhiteTexture}get startTileIndex(){return new He(this.system)}get uTileCount(){return this.anim.enabled?this.anim?.numTilesX:void 0}get vTileCount(){return this.anim.enabled?this.anim?.numTilesY:void 0}get renderOrder(){return 1}get blending(){return this.system.renderer.particleMaterial?.blending??1}get transparent(){return this.system.renderer.transparent}get worldSpace(){return this.system.main.simulationSpace===N.World}},mt=class{burstParticleIndex=0;burstParticleCount=0;isBursting=!1;travelDistance=0;previousWorldPos;burstIndex=0;burstWaveIndex=0;time=0;waitEmiting=0},$=class t extends b{play(e=!1){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.play(!1)},!0),this._isPlaying=!0,this._particleSystem&&(this._particleSystem.emissionState.time=0,this._particleSystem.emitEnded=!1),this.emission?.reset()}pause(e=!0){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.pause(!1)},!0),this._isPlaying=!1}stop(e=!0,n=!1){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.stop(!1,n)},!0),this._isPlaying=!1,this._time=0,n&&this.reset()}reset(){this._time=0,this._particleSystem&&(this._particleSystem.particleNum=0,this._particleSystem.emissionState.time=0,this._particleSystem.emitEnded=!1,this.emission?.reset())}_state;emit(e){if(this._particleSystem){this.onUpdate(),e=Math.min(e,this.maxParticles-this.currentParticles),this._state||=new mt,this._state.waitEmiting=e,this._state.time=0;let t=this._particleSystem.emitEnded;this._particleSystem.emitEnded=!1,this._particleSystem.emit(this.deltaTime,this._state,this._particleSystem.emitter.matrixWorld),this._particleSystem.emitEnded=t}}get playOnAwake(){return this.main.playOnAwake}set playOnAwake(e){this.main.playOnAwake=e}colorOverLifetime;main;emission;sizeOverLifetime;shape;noise;trails;velocityOverLifetime;limitVelocityOverLifetime;inheritVelocity;colorBySpeed;textureSheetAnimation;rotationOverLifetime;rotationBySpeed;sizeBySpeed;get renderer(){return this._renderer}get isPlaying(){return this._isPlaying}get currentParticles(){return this._particleSystem?.particleNum??0}get maxParticles(){return this.main.maxParticles}get time(){return this._time}get duration(){return this.main.duration}get deltaTime(){return this.context.time.deltaTime*this.main.simulationSpeed}get scale(){return this.gameObject.scale.x}get cameraScale(){return this._cameraScale}_cameraScale=1;get container(){return this._container}get worldspace(){return this.main.simulationSpace===N.World}get localspace(){return this.main.simulationSpace===N.Local}__worldQuaternion=new d;get worldQuaternion(){return this.__worldQuaternion}_worldQuaternionInverted=new d;get worldQuaternionInverted(){return this._worldQuaternionInverted}_worldScale=new e;get worldScale(){return this._worldScale}_worldPositionFrame=-1;_worldPos=new e;get worldPos(){return this._worldPositionFrame!==this.context.time.frame&&(this._worldPositionFrame=this.context.time.frame,ee(this.gameObject,this._worldPos)),this._worldPos}get matrixWorld(){return this._container.matrixWorld}get isSubsystem(){return this._isUsedAsSubsystem}addBehaviour(e){return this._particleSystem?(e instanceof Ge&&(e.system=this),Ie&&console.debug(`Add custom ParticleSystem Behaviour`,e),this._particleSystem.addBehavior(e),!0):!1}removeBehaviour(e){if(!this._particleSystem)return!1;let t=this._particleSystem.behaviors,n=t.indexOf(e);return n===-1?!0:((h()||Ie)&&console.debug(`Remove custom ParticleSystem Behaviour`,n,e),t.splice(n,1),!0)}removeAllBehaviours(){return this._particleSystem?(this._particleSystem.behaviors.length=0,!0):!1}get behaviours(){return this._particleSystem?this._particleSystem.behaviors:null}get particleSystem(){return this._particleSystem??null}_renderer;_batchSystem;_particleSystem;_interface;_container;_time=0;_isPlaying=!0;_isUsedAsSubsystem=!1;_didPreWarm=!1;set bursts(e){for(let t=0;t0&&console.log(`SubEmitters: `,e,this),this._subEmitterSystems=e}_subEmitterSystems;onAfterDeserialize(e){if(this._subEmitterSystems&&Array.isArray(this._subEmitterSystems))for(let e of this._subEmitterSystems)e._deserialize(this.context,this.gameObject)}awake(){if(this._worldPositionFrame=-1,this._renderer=this.gameObject.getComponent(Q),!this.main)throw Error(`Not Supported: ParticleSystem needs a serialized MainModule. Creating new particle systems at runtime is currently not supported.`);this._container=new o,this._container.matrixAutoUpdate=!1,this.context.scene.add(this._container),this._batchSystem=new pe,this._batchSystem.name=this.gameObject.name,this._container.add(this._batchSystem),this._interface=new pt(this),this._particleSystem=new ue(this._interface),this._particleSystem.addBehavior(new Ze(this)),this._particleSystem.addBehavior(new ft(this)),this._particleSystem.addBehavior(new Ke(this)),this._particleSystem.addBehavior(new Je(this)),this._particleSystem.addBehavior(new ct(this)),this._particleSystem.addBehavior(new nt(this)),this._batchSystem.addSystem(this._particleSystem);let e=this._particleSystem.emitter;this.context.scene.add(e),this.inheritVelocity.system&&this.inheritVelocity.system!==this&&(this.inheritVelocity=this.inheritVelocity.clone()),this.inheritVelocity.awake(this),Ie&&(console.log(this),this.gameObject.add(new a(1)))}start(){this.addSubParticleSystems(),this.updateLayers(),this.renderer.particleMesh instanceof i&&this._interface.renderMode==w.Mesh&&ae.assignMeshLOD(this.renderer.particleMesh,0).then(e=>{e&&this.particleSystem&&this._interface.renderMode==w.Mesh&&(this.particleSystem.instancingGeometry=e)})}onDestroy(){this._container?.removeFromParent(),this._batchSystem?.removeFromParent(),this._particleSystem?.emitter.removeFromParent(),this._particleSystem?.dispose()}onEnable(){this.main&&(this.inheritVelocity&&(this.inheritVelocity.system=this),this._batchSystem&&(this._batchSystem.visible=!0),this.playOnAwake&&this.play(),this._isPlaying=this.playOnAwake)}onDisable(){this._batchSystem&&(this._batchSystem.visible=!1)}onBeforeRender(){this.main&&(this._didPreWarm===!1&&this.main?.prewarm===!0&&(this._didPreWarm=!0,this.preWarm()),this.onUpdate(),this.onSimulate(this.deltaTime))}preWarm(){if(!this.emission?.enabled||this.emission.rateOverTime.getMax()<=0)return;let e=1/60,t=this.main.duration,n=this.main.startLifetime.getMax(),r=Math.min(Math.max(t,n)/Math.max(.01,this.main.simulationSpeed),1e3),i=Math.ceil(r/e),a=Date.now();Ie&&console.log(`Particles ${this.name} - Prewarm for ${i} frames (${r} sec). Duration: ${t}, Lifetime: ${n}`);for(let t=0;t=this.maxParticles);t++){let t=Date.now()-a;if(t>2e3){console.warn(`Particles ${this.name} - Prewarm took too long. Aborting: ${t}`);break}this.onUpdate(),this.onSimulate(e)}}_lastBatchesCount=-1;onSimulate(e){if(this._batchSystem){let t=this.context.time.frameCount%60==0;this._lastBatchesCount!==this._batchSystem.batches.length&&(this._lastBatchesCount=this._batchSystem.batches.length,t=!0),t&&this.updateLayers(),this._batchSystem.update(e)}this._time+=e,this._time>this.duration&&(this._time=0)}updateLayers(){if(this._batchSystem)for(let e=0;eMath.floor(e)|0,ve=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function ye(e=Math.random){let t=be(e),n=new Float64Array(t).map(e=>ve[e%32*4]),r=new Float64Array(t).map(e=>ve[e%32*4+1]),i=new Float64Array(t).map(e=>ve[e%32*4+2]),a=new Float64Array(t).map(e=>ve[e%32*4+3]);return function(e,o,s,c){let l,u,d,f,p,m=(e+o+s+c)*ge,h=_e(e+m),g=_e(o+m),_=_e(s+m),v=_e(c+m),ee=(h+g+_+v)*T,te=h-ee,ne=g-ee,re=_-ee,y=v-ee,b=e-te,x=o-ne,S=s-re,C=c-y,ie=0,ae=0,oe=0,se=0;b>x?ie++:ae++,b>S?ie++:oe++,b>C?ie++:se++,x>S?ae++:oe++,x>C?ae++:se++,S>C?oe++:se++;let ce=+(ie>=3),le=+(ae>=3),ue=+(oe>=3),de=+(se>=3),w=+(ie>=2),fe=+(ae>=2),pe=+(oe>=2),me=+(se>=2),he=+(ie>=1),ve=+(ae>=1),ye=+(oe>=1),be=+(se>=1),E=b-ce+T,D=x-le+T,xe=S-ue+T,O=C-de+T,Se=b-w+2*T,k=x-fe+2*T,A=S-pe+2*T,j=C-me+2*T,M=b-he+3*T,N=x-ve+3*T,P=S-ye+3*T,F=C-be+3*T,I=b-1+4*T,L=x-1+4*T,Ce=S-1+4*T,R=C-1+4*T,we=h&255,z=g&255,Te=_&255,B=v&255,V=.6-b*b-x*x-S*S-C*C;if(V<0)l=0;else{let e=we+t[z+t[Te+t[B]]];V*=V,l=V*V*(n[e]*b+r[e]*x+i[e]*S+a[e]*C)}let H=.6-E*E-D*D-xe*xe-O*O;if(H<0)u=0;else{let e=we+ce+t[z+le+t[Te+ue+t[B+de]]];H*=H,u=H*H*(n[e]*E+r[e]*D+i[e]*xe+a[e]*O)}let U=.6-Se*Se-k*k-A*A-j*j;if(U<0)d=0;else{let e=we+w+t[z+fe+t[Te+pe+t[B+me]]];U*=U,d=U*U*(n[e]*Se+r[e]*k+i[e]*A+a[e]*j)}let Ee=.6-M*M-N*N-P*P-F*F;if(Ee<0)f=0;else{let e=we+he+t[z+ve+t[Te+ye+t[B+be]]];Ee*=Ee,f=Ee*Ee*(n[e]*M+r[e]*N+i[e]*P+a[e]*F)}let De=.6-I*I-L*L-Ce*Ce-R*R;if(De<0)p=0;else{let e=we+1+t[z+1+t[Te+1+t[B+1]]];De*=De,p=De*De*(n[e]*I+r[e]*L+i[e]*Ce+a[e]*R)}return 27*(l+u+d+f+p)}}function be(e){let t=new Uint8Array(512);for(let e=0;e<512/2;e++)t[e]=e;for(let n=0;n<512/2-1;n++){let r=n+~~(e()*(256-n)),i=t[n];t[n]=t[r],t[r]=i}for(let e=256;e<512;e++)t[e]=t[e-256];return t}var E=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=class{time=0;value=0;inTangent=1/0;inWeight;outTangent=1/0;outWeight;weightedMode;constructor(e=0,t=0){this.time=e,this.value=t}};E([_()],D.prototype,`time`,void 0),E([_()],D.prototype,`value`,void 0),E([_()],D.prototype,`inTangent`,void 0),E([_()],D.prototype,`inWeight`,void 0),E([_()],D.prototype,`outTangent`,void 0),E([_()],D.prototype,`outWeight`,void 0),E([_()],D.prototype,`weightedMode`,void 0);var xe=class e{static linearFromTo(t,n,r){let i=new e,a=new D;a.time=0,a.value=t;let o=new D;return o.time=r,o.value=n,i.keys.push(a,o),i}static constant(t){let n=new e,r=new D;return r.time=0,r.value=t,n.keys.push(r),n}keys=[];clone(){let t=new e;return t.keys=this.keys?.map(e=>{let t=new D;return t.time=e.time,t.value=e.value,t.inTangent=e.inTangent,t.inWeight=e.inWeight,t.outTangent=e.outTangent,t.outWeight=e.outWeight,t.weightedMode=e.weightedMode,t})||[],t}get duration(){return!this.keys||this.keys.length==0?0:this.keys[this.keys.length-1].time}evaluate(t){if(!this.keys||this.keys.length==0)return 0;if(this.keys.length===1||this.keys[0].time>=t)return this.keys[0].value;for(let n=0;n=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Se=ne(`debugparticles`),k;(function(e){e[e.Billboard=0]=`Billboard`,e[e.Stretch=1]=`Stretch`,e[e.HorizontalBillboard=2]=`HorizontalBillboard`,e[e.VerticalBillboard=3]=`VerticalBillboard`,e[e.Mesh=4]=`Mesh`})(k||={});var A=class{alphaKeys=[];colorKeys=[];get duration(){return 1}evaluate(e,t){let n,r=0,i=null,a=0;for(let t=0;tt&&(t=r.value)}return t}};O([_()],I.prototype,`mode`,void 0),O([_()],I.prototype,`constant`,void 0),O([_()],I.prototype,`constantMin`,void 0),O([_()],I.prototype,`constantMax`,void 0),O([_(xe)],I.prototype,`curve`,void 0),O([_(xe)],I.prototype,`curveMin`,void 0),O([_(xe)],I.prototype,`curveMax`,void 0),O([_()],I.prototype,`curveMultiplier`,void 0);var L=class e{static constant(t){let n=new e;return n.constant(t),n}static betweenTwoColors(t,n){let r=new e;return r.betweenTwoColors(t,n),r}constant(e){return this.mode=M.Color,this.color=e,this}betweenTwoColors(e,t){return this.mode=M.TwoColors,this.colorMin=e,this.colorMax=t,this}mode=M.Color;color;colorMin;colorMax;gradient;gradientMin;gradientMax;static _temp=new y(0,0,0,1);static _temp2=new y(0,0,0,1);evaluate(t,n){let r=n===void 0?Math.random():n;switch(this.mode){case M.Color:case`Color`:return this.color;case M.Gradient:case`Gradient`:return this.gradient.evaluate(t,e._temp),e._temp;case M.TwoColors:case`TwoColors`:return e._temp.lerpColors(this.colorMin,this.colorMax,r);case M.TwoGradients:case`TwoGradients`:return this.gradientMin.evaluate(t,e._temp),this.gradientMax.evaluate(t,e._temp2),e._temp.lerp(e._temp2,r);case M.RandomColor:case`RandomColor`:let n=Math.random();return this.gradientMin.evaluate(t,e._temp),this.gradientMax.evaluate(t,e._temp2),e._temp.lerp(e._temp2,n)}return e._temp.set(16777215),e._temp.alpha=1,e._temp}};O([_()],L.prototype,`mode`,void 0),O([_(y)],L.prototype,`color`,void 0),O([_(y)],L.prototype,`colorMin`,void 0),O([_(y)],L.prototype,`colorMax`,void 0),O([_(A)],L.prototype,`gradient`,void 0),O([_(A)],L.prototype,`gradientMin`,void 0),O([_(A)],L.prototype,`gradientMax`,void 0);var Ce;(function(e){e[e.Hierarchy=0]=`Hierarchy`,e[e.Local=1]=`Local`,e[e.Shape=2]=`Shape`})(Ce||={});var R=class{cullingMode;duration;emitterVelocityMode;flipRotation;gravityModifier;gravityModifierMultiplier;loop;maxParticles;playOnAwake;prewarm;ringBufferLoopRange;ringBufferMode;scalingMode;simulationSpace;simulationSpeed;startColor;startDelay;startDelayMultiplier;startLifetime;startLifetimeMultiplier;startRotation;startRotationMultiplier;startRotation3D;startRotationX;startRotationXMultiplier;startRotationY;startRotationYMultiplier;startRotationZ;startRotationZMultiplier;startSize;startSize3D;startSizeMultiplier;startSizeX;startSizeXMultiplier;startSizeY;startSizeYMultiplier;startSizeZ;startSizeZMultiplier;startSpeed;startSpeedMultiplier;stopAction;useUnscaledTime};O([_(I)],R.prototype,`gravityModifier`,void 0),O([_(L)],R.prototype,`startColor`,void 0),O([_(I)],R.prototype,`startDelay`,void 0),O([_(I)],R.prototype,`startLifetime`,void 0),O([_(I)],R.prototype,`startRotation`,void 0),O([_(I)],R.prototype,`startRotationX`,void 0),O([_(I)],R.prototype,`startRotationY`,void 0),O([_(I)],R.prototype,`startRotationZ`,void 0),O([_(I)],R.prototype,`startSize`,void 0),O([_(I)],R.prototype,`startSizeX`,void 0),O([_(I)],R.prototype,`startSizeY`,void 0),O([_(I)],R.prototype,`startSizeZ`,void 0),O([_(I)],R.prototype,`startSpeed`,void 0);var we=class{cycleCount;maxCount;minCount;probability;repeatInterval;time;count;_performed=0;reset(){this._performed=0}run(e){if(e<=this.time)return 0;let t=0;if((this.cycleCount===0||this._performed=this.time+this.repeatInterval*this._performed&&(this._performed+=1,Math.random()e.reset())}getBurst(){let e=0;if(this.burstCount>0)for(let t=0;t=this.system.time&&n.reset(),e+=Math.round(n.run(this.system.time))}return e}};O([_()],z.prototype,`enabled`,void 0),O([_()],z.prototype,`bursts`,void 0),O([_(I)],z.prototype,`rateOverTime`,void 0),O([_()],z.prototype,`rateOverTimeMultiplier`,void 0),O([_(I)],z.prototype,`rateOverDistance`,void 0),O([_()],z.prototype,`rateOverDistanceMultiplier`,void 0);var Te=class{enabled;color};O([_(L)],Te.prototype,`color`,void 0);var B=class{enabled;separateAxes;size;sizeMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;_time=0;_temp=new e;evaluate(e,t,n){if(t||=this._temp,!this.enabled)return t.x=t.y=t.z=1,t;if(this.separateAxes)t.x=this.x.evaluate(e,n)*this.xMultiplier,t.y=this.y.evaluate(e,n)*this.yMultiplier,t.z=this.z.evaluate(e,n)*this.zMultiplier;else{let r=this.size.evaluate(e,n)*this.sizeMultiplier;t.x=r}return t}};O([_(I)],B.prototype,`size`,void 0),O([_(I)],B.prototype,`x`,void 0),O([_(I)],B.prototype,`y`,void 0),O([_(I)],B.prototype,`z`,void 0);var V;(function(e){e[e.Vertex=0]=`Vertex`,e[e.Edge=1]=`Edge`,e[e.Triangle=2]=`Triangle`})(V||={});var H=class t{get type(){return P[this.shapeType]}initialize(e){this.onInitialize(e),e.position.x=this._vector.x,e.position.y=this._vector.y,e.position.z=this._vector.z}toJSON(){return this}clone(){return new t}shapeType=P.Box;enabled=!0;alignToDirection=!1;angle=0;arc=360;arcSpread;arcSpeedMultiplier;arcMode;boxThickness;position;rotation;_rotation=new l;scale;radius;radiusThickness;sphericalDirectionAmount;randomDirectionAmount;randomPositionAmount;meshShapeType;meshRenderer;_meshObj;_meshGeometry;setMesh(e){this.meshRenderer=e,e?(this._meshObj=e.sharedMeshes[Math.floor(Math.random()*e.sharedMeshes.length)],this._meshGeometry=this._meshObj.geometry):(this._meshObj=void 0,this._meshGeometry=void 0)}system;_space;_worldSpaceMatrix=new r;_worldSpaceMatrixInverse=new r;constructor(){Se&&console.log(this)}update(e,t){}onUpdate(e,t,n,r){this.system=e,this._space=n,n===N.World&&(this._worldSpaceMatrix.copy(r.matrixWorld),this._worldSpaceMatrix.elements[0]=1,this._worldSpaceMatrix.elements[5]=1,this._worldSpaceMatrix.elements[10]=1,this._worldSpaceMatrixInverse.copy(this._worldSpaceMatrix).invert())}applyRotation(e){let t=this.rotation.x!==0||this.rotation.y!==0||this.rotation.z!==0;return t&&(this._rotation.x=g.toRadians(this.rotation.x),this._rotation.y=g.toRadians(this.rotation.y),this._rotation.z=g.toRadians(this.rotation.z),this._rotation.order=`ZYX`,e.applyEuler(this._rotation)),t}_vector=new e(0,0,0);_temp=new e(0,0,0);_triangle=new f;onInitialize(e){this._vector.set(0,0,0),e.mesh=void 0,e.mesh_geometry=void 0;let t=this._temp.copy(this.position),n=this._space===N.World;n&&t.applyQuaternion(this.system.worldQuaternion);let r=this.radius;if(n&&(r*=this.system.worldScale.x),this.enabled){switch(this.shapeType){case P.Box:Se&&C.DrawWireBox(this.position,this.scale,14540253,1),this._vector.x=Math.random()*this.scale.x-this.scale.x/2,this._vector.y=Math.random()*this.scale.y-this.scale.y/2,this._vector.z=Math.random()*this.scale.z-this.scale.z/2,this._vector.add(t);break;case P.Cone:this.randomConePoint(this.position,this.angle,r,this.radiusThickness,this.arc,this.arcMode,this._vector);break;case P.Sphere:this.randomSpherePoint(this.position,r,this.radiusThickness,this.arc,this._vector);break;case P.Circle:this.randomCirclePoint(this.position,r,this.radiusThickness,this.arc,this._vector);break;case P.MeshRenderer:let n=this.meshRenderer;n?.destroyed==0&&this.setMesh(n);let i=e.mesh=this._meshObj,a=e.mesh_geometry=this._meshGeometry;if(i&&a)switch(this.meshShapeType){case V.Vertex:{let t=a.getAttribute(`position`),n=Math.floor(Math.random()*t.count);this._vector.fromBufferAttribute(t,n),this._vector.applyMatrix4(i.matrixWorld),e.mesh_normal=n}break;case V.Edge:break;case V.Triangle:{let t=a.index;if(t){let n=Math.random(),r=Math.random();n+r>1&&(n=1-n,r=1-r);let o=Math.floor(Math.random()*(t.count/3)),s=o*3,c=o*3+1,l=o*3+2;s=t.getX(s),c=t.getX(c),l=t.getX(l);let u=a.getAttribute(`position`);this._triangle.a.fromBufferAttribute(u,s),this._triangle.b.fromBufferAttribute(u,c),this._triangle.c.fromBufferAttribute(u,l),this._vector.set(0,0,0).addScaledVector(this._triangle.a,n).addScaledVector(this._triangle.b,r).addScaledVector(this._triangle.c,1-(n+r)),this._vector.applyMatrix4(i.matrixWorld),e.mesh_normal=o}}break}break;default:this._vector.set(0,0,0),h()&&!globalThis.__particlesystem_shapetype_unsupported&&(console.warn(`ParticleSystem ShapeType is not supported:`,P[this.shapeType]),globalThis.__particlesystem_shapetype_unsupported=!0);break}this.randomizePosition(this._vector,this.randomPositionAmount)}this.applyRotation(this._vector),n&&(this._vector.applyQuaternion(this.system.worldQuaternion),this._vector.add(this.system.worldPos)),Se&&C.DrawSphere(this._vector,.03,16711680,.5,!0)}_dir=new e;getDirection(e,t){if(!this.enabled)return this._dir.set(0,0,1),this._dir;switch(this.shapeType){case P.Box:this._dir.set(0,0,1);break;case P.Cone:this._dir.set(0,0,1);break;case P.Circle:case P.Sphere:let n=t.x,r=t.y,i=t.z;this._dir.set(n,r,i),this.system?.worldspace?this._dir.sub(this.system.worldPos):this._dir.sub(this.position);break;case P.MeshRenderer:let a=e.mesh,o=e.mesh_geometry;if(a&&o)switch(this.meshShapeType){case V.Vertex:{let t=o.getAttribute(`normal`),n=e.mesh_normal;this._dir.fromBufferAttribute(t,n)}break;case V.Edge:break;case V.Triangle:{let t=o.index;if(t){let n=e.mesh_normal,r=t.getX(n*3),i=t.getX(n*3+1),s=t.getX(n*3+2),c=o.getAttribute(`position`),l=x(),u=x(),d=x();l.fromBufferAttribute(c,r),u.fromBufferAttribute(c,i),d.fromBufferAttribute(c,s),l.sub(u),d.sub(u),l.cross(d),this._dir.copy(l).multiplyScalar(-1);let f=ie(a);this._dir.applyQuaternion(f)}}break}break;default:this._dir.set(0,0,1);break}return this._space===N.World&&this._dir.applyQuaternion(this.system.worldQuaternion),this.applyRotation(this._dir),this._dir.normalize(),this.spherizeDirection(this._dir,this.sphericalDirectionAmount),this.randomizeDirection(this._dir,this.randomDirectionAmount),Se&&(C.DrawSphere(t,.01,8925952,.5,!0),C.DrawDirection(t,this._dir,8925952,.5,!0)),this._dir}static _randomQuat=new d;static _tempVec=new e;randomizePosition(e,n){if(n<=0)return;let r=t._tempVec;r.set(Math.random()*2-1,Math.random()*2-1,Math.random()*2-1),r.x*=n*this.scale.x,r.y*=n*this.scale.y,r.z*=n*this.scale.z,e.add(r)}randomizeDirection(e,n){if(n===0)return;let r=t._randomQuat,i=t._tempVec;i.set(Math.random()-.5,Math.random()-.5,Math.random()-.5).normalize(),r.setFromAxisAngle(i,n*Math.random()*Math.PI),e.applyQuaternion(r)}spherizeDirection(t,n){if(n===0)return;let r=Math.random()*Math.PI*2,i=Math.acos(1-Math.random()*2),a=new e(Math.sin(i)*Math.cos(r),Math.sin(i)*Math.sin(r),Math.cos(i));t.lerp(a,n)}randomSpherePoint(e,t,n,r,i){let a=Math.random(),o=Math.random(),s=2*Math.PI*a*(r/360),c=Math.acos(2*o-1),l=g.lerp(1,1-(1-Math.random())**Math.PI,n)*t,u=e.x+this.scale.x*(-l*Math.sin(c)*Math.cos(s)),d=e.y+this.scale.y*(l*Math.sin(c)*Math.sin(s)),f=e.z+this.scale.z*(l*Math.cos(c));i.x=u,i.y=d,i.z=f}randomCirclePoint(e,t,n,r,i){let a=Math.random(),o=2*Math.PI*a*(r/360),s=g.lerp(1,1-(1-Math.random())**Math.PI,n)*t,c=e.x+this.scale.x*s*Math.cos(o),l=e.y+this.scale.y*s*Math.sin(o),u=e.z;i.x=c,i.y=l,i.z=u}_loopTime=0;_loopDirection=1;randomConePoint(e,t,n,r,i,a,o){let s=0,c=0;switch(a){case F.Random:s=Math.random(),c=Math.random();break;case F.PingPong:this._loopTime>1&&(this._loopDirection=-1),this._loopTime<0&&(this._loopDirection=1);case F.Loop:s=.5,c=Math.random(),this._loopTime+=this.system.deltaTime*this._loopDirection;break}let l=2*Math.PI*s*(i/360);switch(a){case F.PingPong:case F.Loop:l+=Math.PI+.5,l+=this._loopTime*Math.PI*2,l%=g.toRadians(i);break}let u=Math.acos(2*c-1),d=g.lerp(1,1-(1-Math.random())**Math.PI,r)*n,f=e.x+-d*Math.sin(u)*Math.cos(l),p=e.y+d*Math.sin(u)*Math.sin(l),m=e.z;o.x=f*this.scale.x,o.y=p*this.scale.y,o.z=m*this.scale.z}};O([_()],H.prototype,`shapeType`,void 0),O([_()],H.prototype,`enabled`,void 0),O([_()],H.prototype,`alignToDirection`,void 0),O([_()],H.prototype,`angle`,void 0),O([_()],H.prototype,`arc`,void 0),O([_()],H.prototype,`arcSpread`,void 0),O([_()],H.prototype,`arcSpeedMultiplier`,void 0),O([_()],H.prototype,`arcMode`,void 0),O([_(e)],H.prototype,`boxThickness`,void 0),O([_(e)],H.prototype,`position`,void 0),O([_(e)],H.prototype,`rotation`,void 0),O([_(e)],H.prototype,`scale`,void 0),O([_()],H.prototype,`radius`,void 0),O([_()],H.prototype,`radiusThickness`,void 0),O([_()],H.prototype,`sphericalDirectionAmount`,void 0),O([_()],H.prototype,`randomDirectionAmount`,void 0),O([_()],H.prototype,`randomPositionAmount`,void 0),O([_()],H.prototype,`meshShapeType`,void 0),O([_(oe)],H.prototype,`meshRenderer`,void 0);var U=class{damping;enabled;frequency;octaveCount;octaveMultiplier;octaveScale;positionAmount;quality;remap;remapEnabled;remapMultiplier;remapX;remapXMultiplier;remapY;remapYMultiplier;remapZ;remapZMultiplier;scrollSpeedMultiplier;separateAxes;strengthMultiplier;strengthX;strengthXMultiplier;strengthY;strengthYMultiplier;strengthZ;strengthZMultiplier;_noise;_time=0;update(e){this._time+=e.time.deltaTime*this.scrollSpeedMultiplier}_temp=new e;apply(e,t,n,r,i,a){if(!this.enabled)return;this._noise||=ye(()=>0);let o=this._temp.set(t.x,t.y,t.z).multiplyScalar(this.frequency),s=this._noise(o.x,o.y,o.z,this._time),c=this._noise(o.x,o.y,o.z,this._time+1e3*this.frequency),l=this._noise(o.x,o.y,o.z,this._time+2e3*this.frequency);this._temp.set(s,c,l).normalize();let u=i/a,d=this.positionAmount.evaluate(u);this.separateAxes?(this._temp.x*=d*this.strengthXMultiplier,this._temp.y*=d*this.strengthYMultiplier,this._temp.z*=d*this.strengthZMultiplier):(this.strengthX&&(d*=this.strengthX.evaluate(u)*1.5),this._temp.multiplyScalar(d)),n.x+=this._temp.x,n.y+=this._temp.y,n.z+=this._temp.z}};O([_()],U.prototype,`damping`,void 0),O([_()],U.prototype,`enabled`,void 0),O([_()],U.prototype,`frequency`,void 0),O([_()],U.prototype,`octaveCount`,void 0),O([_()],U.prototype,`octaveMultiplier`,void 0),O([_()],U.prototype,`octaveScale`,void 0),O([_(I)],U.prototype,`positionAmount`,void 0),O([_()],U.prototype,`quality`,void 0),O([_(I)],U.prototype,`remap`,void 0),O([_()],U.prototype,`remapEnabled`,void 0),O([_()],U.prototype,`remapMultiplier`,void 0),O([_(I)],U.prototype,`remapX`,void 0),O([_()],U.prototype,`remapXMultiplier`,void 0),O([_(I)],U.prototype,`remapY`,void 0),O([_()],U.prototype,`remapYMultiplier`,void 0),O([_(I)],U.prototype,`remapZ`,void 0),O([_()],U.prototype,`remapZMultiplier`,void 0),O([_()],U.prototype,`scrollSpeedMultiplier`,void 0),O([_()],U.prototype,`separateAxes`,void 0),O([_()],U.prototype,`strengthMultiplier`,void 0),O([_(I)],U.prototype,`strengthX`,void 0),O([_()],U.prototype,`strengthXMultiplier`,void 0),O([_(I)],U.prototype,`strengthY`,void 0),O([_()],U.prototype,`strengthYMultiplier`,void 0),O([_(I)],U.prototype,`strengthZ`,void 0),O([_()],U.prototype,`strengthZMultiplier`,void 0);var Ee;(function(e){e[e.PerParticle=0]=`PerParticle`,e[e.Ribbon=1]=`Ribbon`})(Ee||={});var De;(function(e){e[e.Stretch=0]=`Stretch`,e[e.Tile=1]=`Tile`,e[e.DistributePerSegment=2]=`DistributePerSegment`,e[e.RepeatPerSegment=3]=`RepeatPerSegment`})(De||={});var W=class{enabled;attachRibbonToTransform=!1;colorOverLifetime;colorOverTrail;dieWithParticles=!0;inheritParticleColor=!0;lifetime;lifetimeMultiplier;minVertexDistance=.2;mode=Ee.PerParticle;ratio=1;ribbonCount=1;shadowBias=0;sizeAffectsLifetime=!1;sizeAffectsWidth=!1;splitSubEmitterRibbons=!1;textureMode=De.Stretch;widthOverTrail;widthOverTrailMultiplier;worldSpace=!1;getWidth(e,t,n,r){let i=this.widthOverTrail.evaluate(n,r);return e*=i,e}getColor(e,t,n){let r=this.colorOverTrail.evaluate(n),i=this.colorOverLifetime.evaluate(t);e.x*=r.r*i.r,e.y*=r.g*i.g,e.z*=r.b*i.b,`alpha`in r&&`alpha`in i&&(e.w*=r.alpha*i.alpha)}};O([_()],W.prototype,`enabled`,void 0),O([_()],W.prototype,`attachRibbonToTransform`,void 0),O([_(L)],W.prototype,`colorOverLifetime`,void 0),O([_(L)],W.prototype,`colorOverTrail`,void 0),O([_()],W.prototype,`dieWithParticles`,void 0),O([_()],W.prototype,`inheritParticleColor`,void 0),O([_(I)],W.prototype,`lifetime`,void 0),O([_()],W.prototype,`lifetimeMultiplier`,void 0),O([_()],W.prototype,`minVertexDistance`,void 0),O([_()],W.prototype,`mode`,void 0),O([_()],W.prototype,`ratio`,void 0),O([_()],W.prototype,`ribbonCount`,void 0),O([_()],W.prototype,`shadowBias`,void 0),O([_()],W.prototype,`sizeAffectsLifetime`,void 0),O([_()],W.prototype,`sizeAffectsWidth`,void 0),O([_()],W.prototype,`splitSubEmitterRibbons`,void 0),O([_()],W.prototype,`textureMode`,void 0),O([_(I)],W.prototype,`widthOverTrail`,void 0),O([_()],W.prototype,`widthOverTrailMultiplier`,void 0),O([_()],W.prototype,`worldSpace`,void 0);var G=class{enabled;space=N.Local;orbitalX;orbitalY;orbitalZ;orbitalXMultiplier;orbitalYMultiplier;orbitalZMultiplier;orbitalOffsetX;orbitalOffsetY;orbitalOffsetZ;speedModifier;speedModifierMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;_system;update(e){this._system=e}_temp=new e;_temp2=new e;_temp3=new e;_hasOrbital=!1;_index=0;_orbitalMatrix=new r;init(e){this._index==0&&(e.debug=!0),this._index+=1,e.orbitx=this.orbitalX.evaluate(Math.random()),e.orbity=this.orbitalY.evaluate(Math.random()),e.orbitz=this.orbitalZ.evaluate(Math.random()),this._hasOrbital=e.orbitx!=0||e.orbity!=0||e.orbitz!=0}apply(e,t,n,r,i,a,o){if(!this.enabled)return;let s=a/o,c=this.speedModifier.evaluate(s)*this.speedModifierMultiplier,l=this.x.evaluate(s),u=this.y.evaluate(s),d=this.z.evaluate(s);if(this._temp.set(-l,u,d),this._system&&this._system.main.simulationSpace===N.World&&this._temp.applyQuaternion(this._system.worldQuaternion),this._hasOrbital&&this._system?.worldPos){let e=this._temp2.set(n.x,n.y,n.z),t=this.orbitalXMultiplier,a=this.orbitalYMultiplier,o=this.orbitalZMultiplier,s=c*Math.PI*2*10,l=Math.cos(s*t),u=Math.sin(s*t),d=Math.cos(s*a),f=Math.sin(s*a),p=Math.cos(s*o),m=Math.sin(s*o),h=e.x*(d*p)+e.y*(d*m)+e.z*-f,g=e.x*(u*f*p-l*m)+e.y*(u*f*m+l*p)+e.z*(u*d),_=e.x*(l*f*p+u*m)+e.y*(l*f*m-u*p)+e.z*(l*d),v=this._temp3.set(e.x-h,e.y-g,e.z-_);v.normalize(),v.multiplyScalar(.2/i*Math.max(this.orbitalXMultiplier,this.orbitalYMultiplier,this.orbitalZMultiplier)),r.x+=v.x,r.y+=v.y,r.z+=v.z}r.x+=this._temp.x,r.y+=this._temp.y,r.z+=this._temp.z,r.x*=c,r.y*=c,r.z*=c}};O([_()],G.prototype,`enabled`,void 0),O([_()],G.prototype,`space`,void 0),O([_(I)],G.prototype,`orbitalX`,void 0),O([_(I)],G.prototype,`orbitalY`,void 0),O([_(I)],G.prototype,`orbitalZ`,void 0),O([_()],G.prototype,`orbitalXMultiplier`,void 0),O([_()],G.prototype,`orbitalYMultiplier`,void 0),O([_()],G.prototype,`orbitalZMultiplier`,void 0),O([_()],G.prototype,`orbitalOffsetX`,void 0),O([_()],G.prototype,`orbitalOffsetY`,void 0),O([_()],G.prototype,`orbitalOffsetZ`,void 0),O([_(I)],G.prototype,`speedModifier`,void 0),O([_()],G.prototype,`speedModifierMultiplier`,void 0),O([_(I)],G.prototype,`x`,void 0),O([_()],G.prototype,`xMultiplier`,void 0),O([_(I)],G.prototype,`y`,void 0),O([_()],G.prototype,`yMultiplier`,void 0),O([_(I)],G.prototype,`z`,void 0),O([_()],G.prototype,`zMultiplier`,void 0);var Oe;(function(e){e[e.Lifetime=0]=`Lifetime`,e[e.Speed=1]=`Speed`,e[e.FPS=2]=`FPS`})(Oe||={});var ke;(function(e){e[e.Grid=0]=`Grid`,e[e.Sprites=1]=`Sprites`})(ke||={});var Ae;(function(e){e[e.Custom=0]=`Custom`,e[e.Random=1]=`Random`,e[e.MeshIndex=2]=`MeshIndex`})(Ae||={});var je;(function(e){e[e.WholeSheet=0]=`WholeSheet`,e[e.SingleRow=1]=`SingleRow`})(je||={});var K=class{animation;enabled;cycleCount;frameOverTime;frameOverTimeMultiplier;numTilesX;numTilesY;startFrame;startFrameMultiplier;rowMode;rowIndex;spriteCount;timeMode;sampleOnceAtStart(){if(this.timeMode===Oe.Lifetime)switch(this.frameOverTime.mode){case j.Constant:case j.TwoConstants:case j.TwoCurves:case j.Curve:return!0}return!1}getStartIndex(){return this.sampleOnceAtStart()?Math.random()*(this.numTilesX*this.numTilesY):0}evaluate(e){if(!this.sampleOnceAtStart())return this.getIndex(e)}getIndex(e){let t=this.numTilesX*this.numTilesY;e*=this.cycleCount;let n=this.frameOverTime.evaluate(e%1);return n*=this.frameOverTimeMultiplier,n*=t,n%=t,n=Math.floor(n),n}};O([_()],K.prototype,`animation`,void 0),O([_()],K.prototype,`enabled`,void 0),O([_()],K.prototype,`cycleCount`,void 0),O([_(I)],K.prototype,`frameOverTime`,void 0),O([_()],K.prototype,`frameOverTimeMultiplier`,void 0),O([_()],K.prototype,`numTilesX`,void 0),O([_()],K.prototype,`numTilesY`,void 0),O([_(I)],K.prototype,`startFrame`,void 0),O([_()],K.prototype,`startFrameMultiplier`,void 0),O([_()],K.prototype,`rowMode`,void 0),O([_()],K.prototype,`rowIndex`,void 0),O([_()],K.prototype,`spriteCount`,void 0),O([_()],K.prototype,`timeMode`,void 0);var q=class{enabled;separateAxes;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t){return this.enabled?this.separateAxes?0:this.z.evaluate(e,t)*-1:0}};O([_()],q.prototype,`enabled`,void 0),O([_()],q.prototype,`separateAxes`,void 0),O([_(I)],q.prototype,`x`,void 0),O([_()],q.prototype,`xMultiplier`,void 0),O([_(I)],q.prototype,`y`,void 0),O([_()],q.prototype,`yMultiplier`,void 0),O([_(I)],q.prototype,`z`,void 0),O([_()],q.prototype,`zMultiplier`,void 0);var J=class{enabled;range;separateAxes;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t){if(!this.enabled)return 0;if(!this.separateAxes){let e=g.lerp(this.range.x,this.range.y,t);return this.z.evaluate(e)*-1}return 0}};O([_()],J.prototype,`enabled`,void 0),O([_()],J.prototype,`range`,void 0),O([_()],J.prototype,`separateAxes`,void 0),O([_(I)],J.prototype,`x`,void 0),O([_()],J.prototype,`xMultiplier`,void 0),O([_(I)],J.prototype,`y`,void 0),O([_()],J.prototype,`yMultiplier`,void 0),O([_(I)],J.prototype,`z`,void 0),O([_()],J.prototype,`zMultiplier`,void 0);var Y=class{enabled;dampen;drag;dragMultiplier;limit;limitMultiplier;separateAxes;limitX;limitXMultiplier;limitY;limitYMultiplier;limitZ;limitZMultiplier;multiplyDragByParticleSize=!1;multiplyDragByParticleVelocity=!1;space;_temp=new e;_temp2=new e;apply(e,t,n,r,i,a,o){if(this.enabled){let e=this.limit.evaluate(i)*this.limitMultiplier;if(t.length()>e){this._temp.copy(t).normalize().multiplyScalar(e);let r=this.dampen*.5;t.x=g.lerp(t.x,this._temp.x,r),t.y=g.lerp(t.y,this._temp.y,r),t.z=g.lerp(t.z,this._temp.z,r),n.x=g.lerp(n.x,this._temp.x,r),n.y=g.lerp(n.y,this._temp.y,r),n.z=g.lerp(n.z,this._temp.z,r)}}}};O([_()],Y.prototype,`enabled`,void 0),O([_()],Y.prototype,`dampen`,void 0),O([_(I)],Y.prototype,`drag`,void 0),O([_()],Y.prototype,`dragMultiplier`,void 0),O([_(I)],Y.prototype,`limit`,void 0),O([_()],Y.prototype,`limitMultiplier`,void 0),O([_()],Y.prototype,`separateAxes`,void 0),O([_(I)],Y.prototype,`limitX`,void 0),O([_()],Y.prototype,`limitXMultiplier`,void 0),O([_(I)],Y.prototype,`limitY`,void 0),O([_()],Y.prototype,`limitYMultiplier`,void 0),O([_(I)],Y.prototype,`limitZ`,void 0),O([_()],Y.prototype,`limitZMultiplier`,void 0),O([_()],Y.prototype,`multiplyDragByParticleSize`,void 0),O([_()],Y.prototype,`multiplyDragByParticleVelocity`,void 0),O([_()],Y.prototype,`space`,void 0);var Me;(function(e){e[e.Initial=0]=`Initial`,e[e.Current=1]=`Current`})(Me||={});var Ne=class t{enabled;curve;curveMultiplier;mode;clone(){let e=new t;return e.enabled=this.enabled,e.curve=this.curve?.clone(),e.curveMultiplier=this.curveMultiplier,e.mode=this.mode,e}system;get _lastWorldPosition(){return this.system._iv_lastWorldPosition||(this.system._iv_lastWorldPosition=new e),this.system._iv_lastWorldPosition}get _velocity(){return this.system._iv_velocity||(this.system._iv_velocity=new e),this.system._iv_velocity}_temp=new e;_firstUpdate=!0;awake(e){this.system=e,this.reset()}reset(){this._firstUpdate=!0}update(e){this.enabled&&this.system.worldspace!==!1&&(this._firstUpdate?(this._firstUpdate=!1,this._velocity.set(0,0,0),this._lastWorldPosition.copy(this.system.worldPos)):this._lastWorldPosition&&(this._velocity.copy(this.system.worldPos).sub(this._lastWorldPosition).multiplyScalar(1/this.system.deltaTime),this._lastWorldPosition.copy(this.system.worldPos)))}applyInitial(e){if(this.enabled&&this.system.worldspace!==!1&&this.mode===Me.Initial){let t=this.curve.evaluate(Math.random(),Math.random());this._temp.copy(this._velocity).multiplyScalar(t),e.x+=this._temp.x,e.y+=this._temp.y,e.z+=this._temp.z}}_frames=0;applyCurrent(e,t,n){if(this.enabled&&this.system&&this.system.worldspace!==!1&&this.mode===Me.Current){let r=this.curve.evaluate(t,n);this._temp.copy(this._velocity).multiplyScalar(r),e.x+=this._temp.x,e.y+=this._temp.y,e.z+=this._temp.z}}};O([_()],Ne.prototype,`enabled`,void 0),O([_(I)],Ne.prototype,`curve`,void 0),O([_()],Ne.prototype,`curveMultiplier`,void 0),O([_()],Ne.prototype,`mode`,void 0);var X=class{enabled;range;separateAxes;size;sizeMultiplier;x;xMultiplier;y;yMultiplier;z;zMultiplier;evaluate(e,t,n,r){let i=e.length(),a=g.remap(i,this.range.x,this.range.y,0,1),o=this.size.evaluate(a,n);return r.x*=o,r.y*=o,r.z*=o,r}};O([_()],X.prototype,`enabled`,void 0),O([_(s)],X.prototype,`range`,void 0),O([_()],X.prototype,`separateAxes`,void 0),O([_(I)],X.prototype,`size`,void 0),O([_()],X.prototype,`sizeMultiplier`,void 0),O([_(I)],X.prototype,`x`,void 0),O([_()],X.prototype,`xMultiplier`,void 0),O([_(I)],X.prototype,`y`,void 0),O([_()],X.prototype,`yMultiplier`,void 0),O([_(I)],X.prototype,`z`,void 0),O([_()],X.prototype,`zMultiplier`,void 0);var Pe=class{enabled;range;color;evaluate(e,t,n){let r=e.length(),i=g.remap(r,this.range.x,this.range.y,0,1),a=this.color.evaluate(i,t);n.x*=a.r,n.y*=a.g,n.z*=a.b,`alpha`in a&&(n.w*=a.alpha)}};O([_()],Pe.prototype,`enabled`,void 0),O([_(s)],Pe.prototype,`range`,void 0),O([_(L)],Pe.prototype,`color`,void 0),new e(1,1,1),new e(0,0,1);var Fe=class{system;particleSystem;subSystem;subParticleSystem;type=`NeedleParticleSubEmitter`;emitterType;emitterProbability;q_=new d;v_=new e;v2_=new e;_emitterMatrix=new de;_circularBuffer;constructor(e,t,n,r){this.system=e,this.particleSystem=t,this.subSystem=n,this.subParticleSystem=r,this.subParticleSystem&&this.subParticleSystem&&(this.subParticleSystem.onlyUsedByOther=!0),this._circularBuffer=new p(()=>new de,1e3)}clone(){throw Error(`Method not implemented.`)}initialize(e){e.emissionState={burstIndex:0,burstWaveIndex:0,time:0,waitEmiting:0},this._emitterMatrix.copy(this.subSystem.matrixWorld).invert().premultiply(this.system.matrixWorld),this._emitterMatrix.setPosition(0,0,0),this.emitterType===ze.Birth&&this.run(e)}update(e,t){this.run(e)}frameUpdate(e){}toJSON(){}reset(){}run(e){if(this.subSystem.currentParticles>=this.subSystem.main.maxParticles||!this.subParticleSystem||!e.emissionState||this.emitterProbability&&Math.random()>this.emitterProbability)return;let t=this.system.deltaTime;if(this.emitterType===ze.Death){let n=e.life;if(e[Qe]!==void 0&&(n=e[Qe]),!(e.age+t*1.2>=n))return;let r=this.subSystem.main.maxParticles-this.subSystem.currentParticles;e.emissionState.waitEmiting=r}let n=new de;n.set(1,0,0,e.position.x,0,1,0,e.position.y,0,0,1,e.position.z,0,0,0,1),this.particleSystem.worldSpace||n.multiplyMatrices(this._emitterMatrix,n),this.subParticleSystem.emit(t,e.emissionState,n)}},Z=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ie=ne(`debugparticles`),Le=ne(`noprogressive`),Re=ne(`debugprogressive`),ze;(function(e){e[e.Birth=0]=`Birth`,e[e.Collision=1]=`Collision`,e[e.Death=2]=`Death`,e[e.Trigger=3]=`Trigger`,e[e.Manual=4]=`Manual`})(ze||={});var Q=class extends b{renderMode;particleMaterial;trailMaterial;particleMesh;maxParticleSize;minParticleSize;velocityScale;cameraVelocityScale;lengthScale;start(){if(this.maxParticleSize!==.5&&this.minParticleSize!==0&&h()){let e=`ParticleSystem \"${this.name}\" has non-default min/max particle size. This may not render correctly. Please set min size to 0 and the max size to 0.5 and use the \"StartSize\" setting instead`;console.warn(e)}}get transparent(){return this.particleMaterial?.transparent??!1}getMaterial(e=!1){let r=e===!0&&this.trailMaterial?this.trailMaterial:this.particleMaterial;if(r){if(r.type===`MeshStandardMaterial`){Ie&&console.debug(`ParticleSystemRenderer.getMaterial: MeshStandardMaterial detected, converting to MeshBasicMaterial. See https://github.com/Alchemist0823/three.quarks/issues/101`),`map`in r&&r.map&&(r.map.colorSpace=t,r.map.premultiplyAlpha=!1);let i=new n;i.copy(r),e?this.trailMaterial=i:this.particleMaterial=i}r.map&&(r.map.colorSpace=t,r.map.premultiplyAlpha=!1),e&&r.side===0&&(r=r.clone(),r.side=1,e?this.trailMaterial=r:this.particleMaterial=r)}return r&&!Le&&r._didRequestTextureLOD===void 0&&(r._didRequestTextureLOD=0,Re&&console.log(`Load material LOD`,r.name),ae.assignTextureLOD(r,0)),r}getMesh(e){let t=null;if(!t&&(this.particleMesh instanceof i&&(t=this.particleMesh.geometry),t===null)){t=new u(1,1);let e=t.attributes.uv;for(let t=0;t=this.system.maxParticles)return 0;let e=this.system.emission.rateOverTime.evaluate(this.system.time/this.system.duration,Math.random());if(this.system.deltaTime>0){let t=this.system.emission.rateOverDistance.evaluate(this.system.time/this.system.duration,Math.random()),n=this._lastDistance/this.system.deltaTime*t;Number.isFinite(n)||(n=0),e+=n}let t=this.system.emission.getBurst();t>0&&(e+=t/this.system.deltaTime);let n=this.system.maxParticles-this.system.currentParticles;return g.clamp(e,0,n/this.system.deltaTime)}},We=class extends Ve{genValue(){return this.system.isPlaying,0}},Ge=class{system;get context(){return this.system.context}constructor(e){this.type=Object.getPrototypeOf(this).constructor.name||`ParticleSystemBaseBehaviour`,e&&(this.system=e)}type;initialize(e){}update(e,t){}frameUpdate(e){}toJSON(){throw Error(`Method not implemented.`)}clone(){throw Error(`Method not implemented.`)}reset(){}},Ke=class extends Ge{type=`NeedleTextureSheet`;update(e,t){let n=this.system.textureSheetAnimation;if(n.enabled){let t=e.age/e.life,r=n.evaluate(t);r!==void 0&&(e.uvTile=r)}}},qe=Symbol(`particleRotation`),Je=class extends Ge{type=`NeedleRotation`;initialize(e){e[qe]=Math.random()}update(e,t){if(e.rotation===void 0)return;let n=e.age/e.life;if(typeof e.rotation==`number`&&(this.system.rotationOverLifetime.enabled?e.rotation+=this.system.rotationOverLifetime.evaluate(n,e[qe])*t:this.system.renderer.renderMode===k.Billboard&&(e.rotation=Math.PI),this.system.rotationBySpeed.enabled)){let r=e.velocity.length();e.rotation+=this.system.rotationBySpeed.evaluate(n,r)*t}}},Ye=Symbol(`sizeLerpFactor`),Xe=new e,Ze=class extends Ge{type=`NeedleSize`;_minSize=0;_maxSize=1;initialize(e){e[Ye]=Math.random(),this._minSize=this.system.renderer.minParticleSize,this._maxSize=this.system.renderer.maxParticleSize}update(e,t){let n=e.age/e.life,r=1;this.system.sizeOverLifetime.enabled&&(r*=this.system.sizeOverLifetime.evaluate(n,void 0,e[Ye]).x);let i=1;this.system.renderer.renderMode!==k.Mesh&&(i=this.system.worldScale.x/this.system.cameraScale);let a=x(e.startSize).multiplyScalar(r*i);if(e.size.set(a.x,a.y,a.z),this.system.localspace){let t=gt(this.system,Xe);e.size.x*=t.x,e.size.y*=t.y,e.size.z*=t.z}}},Qe=Symbol(`particleLife`),$e=Symbol(`trailLifetime`),et=Symbol(`trailStartLength`),tt=Symbol(`trailWidthRandom`),nt=class extends Ge{type=`NeedleTrail`;initialize(e){e instanceof fe&&(e[Qe]=e.life,this.system.trails.enabled&&this.system.trails.dieWithParticles===!1&&(e[$e]=this.system.trails.lifetime.evaluate(Math.random(),Math.random()),e.life+=e[$e]),e[et]=e.length,e[tt]=Math.random())}update(e){if(this.system.trails?.enabled&&e instanceof fe){let t=e,n=e.age/e[Qe],r=e.previous.values(),i=e.previous.length;for(let a=0;ae[Qe]){e.velocity.set(0,0,0);let n=(e.age-e[Qe])/e[$e];t.length=g.lerp(e[et],0,n)}}}},rt=Symbol(`startVelocity`),it=Symbol(`gravityModifier`),at=Symbol(`gravitySpeed`),ot=Symbol(`velocity lerp factor`),st=new e;new d;var ct=class extends Ge{type=`NeedleVelocity`;_gravityDirection=new e;initialize(e){let t=this.system.main.simulationSpeed;e.startSpeed=this.system.main.startSpeed.evaluate(Math.random(),Math.random());let n=this.system.shape.getDirection(e,e.position);e.velocity.x=n.x*e.startSpeed,e.velocity.y=n.y*e.startSpeed,e.velocity.z=n.z*e.startSpeed,this.system.inheritVelocity?.enabled&&this.system.inheritVelocity.applyInitial(e.velocity),e[rt]?e[rt].copy(e.velocity):e[rt]=e.velocity.clone();let r=this.system.main.gravityModifier.evaluate(Math.random(),Math.random());e[it]=r*t,e[at]=r*t*.5,e[ot]=Math.random(),this.system.velocityOverLifetime?.init(e),this._gravityDirection.set(0,-1,0),this.system.main.simulationSpace===N.Local&&this._gravityDirection.applyQuaternion(this.system.worldQuaternionInverted).normalize()}update(e,t){let n=e[rt],r=e[it];if(r!==0){let i=r*e[at];st.copy(this._gravityDirection).multiplyScalar(i),e[at]+=t*.05,n.add(st)}e.velocity.copy(n);let i=e.age/e.life;this.system.inheritVelocity?.enabled&&this.system.inheritVelocity.applyCurrent(e.velocity,i,e[ot]);let a=this.system.noise;a.enabled&&a.apply(0,e.position,e.velocity,t,e.age,e.life);let o=this.system.sizeBySpeed;o?.enabled&&(e.size=o.evaluate(e.velocity,i,e[ot],e.size));let s=this.system.colorBySpeed;s?.enabled&&s.evaluate(e.velocity,e[ot],e.color);let c=this.system.velocityOverLifetime;c.enabled&&c.apply(e,0,e.position,e.velocity,t,e.age,e.life);let l=this.system.limitVelocityOverLifetime;if(l.enabled&&l.apply(e.position,n,e.velocity,e.size,i,t,1),this.system.worldspace){let t=this.system.worldScale;e.velocity.x*=t.x,e.velocity.y*=t.y,e.velocity.z*=t.z}}},lt=Symbol(`colorLerpFactor`),ut=new y(1,1,1,1),dt=new y(1,1,1,1),ft=class extends Ge{type=`NeedleColor`;initialize(e){}_init(e){let t=this.system.renderer.particleMaterial;dt.copy(this.system.main.startColor.evaluate(Math.random())),t?.color&&(ut.copy(t.color),dt.multiply(ut)),dt.convertLinearToSRGB(),e.startColor.set(dt.r,dt.g,dt.b,dt.alpha),e.color.copy(e.startColor),e[lt]=Math.random()}update(e,t){if(e.age===0&&this._init(e),this.system.colorOverLifetime.enabled){let t=e.age/e.life,n=this.system.colorOverLifetime.color.evaluate(t,e[lt]);e.color.set(n.r,n.g,n.b,`alpha`in n?n.alpha:1).multiply(e.startColor)}else e.color.copy(e.startColor)}},pt=class{system;emission;get anim(){return this.system.textureSheetAnimation}constructor(e){this.system=e,this.emission=new Ue(this.system)}get prewarm(){return!1}get material(){return this.system.renderer.getMaterial(this.system.trails.enabled)}get layers(){return this.system.gameObject.layers}update(){this.emission.update()}autoDestroy;get looping(){return this.system.main.loop}get duration(){return this.system.duration}get shape(){return this.system.shape}get startLife(){return new Be(this.system.main.startLifetime)}get startSpeed(){return new Be(this.system.main.startSpeed)}get startRotation(){return new Be(this.system.main.startRotation)}get startSize(){return new Be(this.system.main.startSize)}startLength;get startColor(){return new le(new ce(1,1,1,1))}get emissionOverTime(){return this.emission}get emissionOverDistance(){return new We(this.system)}emissionBursts;onlyUsedByOther;behaviors=[];get instancingGeometry(){return this.system.renderer.getMesh(this.system.renderer.renderMode).geometry}get renderMode(){if(this.system.trails.enabled===!0)return w.Trail;switch(this.system.renderer.renderMode){case k.Billboard:return w.BillBoard;case k.Stretch:return w.StretchedBillBoard;case k.HorizontalBillboard:return w.HorizontalBillBoard;case k.VerticalBillboard:return w.VerticalBillBoard;case k.Mesh:return w.Mesh}return w.BillBoard}rendererEmitterSettings={startLength:new se(220),followLocalOrigin:!1};get speedFactor(){let e=this.system.main.simulationSpeed;return this.system.renderer?.renderMode===k.Stretch&&(e*=this.system.renderer.velocityScale??1),e}flatWhiteTexture;clonedTexture={original:void 0,clone:void 0};get texture(){let e=this.material;if(e&&e.map){let n=e.map;if(this.clonedTexture.original!==n||!this.clonedTexture.clone){let e=n.clone();e.premultiplyAlpha=!1,e.colorSpace=t,this.clonedTexture.original=n,this.clonedTexture.clone=e}return this.clonedTexture.clone}return this.flatWhiteTexture||=v(new y(1,1,1,1),1),this.flatWhiteTexture}get startTileIndex(){return new He(this.system)}get uTileCount(){return this.anim.enabled?this.anim?.numTilesX:void 0}get vTileCount(){return this.anim.enabled?this.anim?.numTilesY:void 0}get renderOrder(){return 1}get blending(){return this.system.renderer.particleMaterial?.blending??1}get transparent(){return this.system.renderer.transparent}get worldSpace(){return this.system.main.simulationSpace===N.World}},mt=class{burstParticleIndex=0;burstParticleCount=0;isBursting=!1;travelDistance=0;previousWorldPos;burstIndex=0;burstWaveIndex=0;time=0;waitEmiting=0},$=class t extends b{play(e=!1){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.play(!1)},!0),this._isPlaying=!0,this._particleSystem&&(this._particleSystem.emissionState.time=0,this._particleSystem.emitEnded=!1),this.emission?.reset()}pause(e=!0){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.pause(!1)},!0),this._isPlaying=!1}stop(e=!0,n=!1){e&&re.foreachComponent(this.gameObject,e=>{e instanceof t&&e!==this&&e.stop(!1,n)},!0),this._isPlaying=!1,this._time=0,n&&this.reset()}reset(){this._time=0,this._particleSystem&&(this._particleSystem.particleNum=0,this._particleSystem.emissionState.time=0,this._particleSystem.emitEnded=!1,this.emission?.reset())}_state;emit(e){if(this._particleSystem){this.onUpdate(),e=Math.min(e,this.maxParticles-this.currentParticles),this._state||=new mt,this._state.waitEmiting=e,this._state.time=0;let t=this._particleSystem.emitEnded;this._particleSystem.emitEnded=!1,this._particleSystem.emit(this.deltaTime,this._state,this._particleSystem.emitter.matrixWorld),this._particleSystem.emitEnded=t}}get playOnAwake(){return this.main.playOnAwake}set playOnAwake(e){this.main.playOnAwake=e}colorOverLifetime;main;emission;sizeOverLifetime;shape;noise;trails;velocityOverLifetime;limitVelocityOverLifetime;inheritVelocity;colorBySpeed;textureSheetAnimation;rotationOverLifetime;rotationBySpeed;sizeBySpeed;get renderer(){return this._renderer}get isPlaying(){return this._isPlaying}get currentParticles(){return this._particleSystem?.particleNum??0}get maxParticles(){return this.main.maxParticles}get time(){return this._time}get duration(){return this.main.duration}get deltaTime(){return this.context.time.deltaTime*this.main.simulationSpeed}get scale(){return this.gameObject.scale.x}get cameraScale(){return this._cameraScale}_cameraScale=1;get container(){return this._container}get worldspace(){return this.main.simulationSpace===N.World}get localspace(){return this.main.simulationSpace===N.Local}__worldQuaternion=new d;get worldQuaternion(){return this.__worldQuaternion}_worldQuaternionInverted=new d;get worldQuaternionInverted(){return this._worldQuaternionInverted}_worldScale=new e;get worldScale(){return this._worldScale}_worldPositionFrame=-1;_worldPos=new e;get worldPos(){return this._worldPositionFrame!==this.context.time.frame&&(this._worldPositionFrame=this.context.time.frame,ee(this.gameObject,this._worldPos)),this._worldPos}get matrixWorld(){return this._container.matrixWorld}get isSubsystem(){return this._isUsedAsSubsystem}addBehaviour(e){return this._particleSystem?(e instanceof Ge&&(e.system=this),Ie&&console.debug(`Add custom ParticleSystem Behaviour`,e),this._particleSystem.addBehavior(e),!0):!1}removeBehaviour(e){if(!this._particleSystem)return!1;let t=this._particleSystem.behaviors,n=t.indexOf(e);return n===-1?!0:((h()||Ie)&&console.debug(`Remove custom ParticleSystem Behaviour`,n,e),t.splice(n,1),!0)}removeAllBehaviours(){return this._particleSystem?(this._particleSystem.behaviors.length=0,!0):!1}get behaviours(){return this._particleSystem?this._particleSystem.behaviors:null}get particleSystem(){return this._particleSystem??null}_renderer;_batchSystem;_particleSystem;_interface;_container;_time=0;_isPlaying=!0;_isUsedAsSubsystem=!1;_didPreWarm=!1;set bursts(e){for(let t=0;t0&&console.log(`SubEmitters: `,e,this),this._subEmitterSystems=e}_subEmitterSystems;onAfterDeserialize(e){if(this._subEmitterSystems&&Array.isArray(this._subEmitterSystems))for(let e of this._subEmitterSystems)e._deserialize(this.context,this.gameObject)}awake(){if(this._worldPositionFrame=-1,this._renderer=this.gameObject.getComponent(Q),!this.main)throw Error(`Not Supported: ParticleSystem needs a serialized MainModule. Creating new particle systems at runtime is currently not supported.`);this._container=new o,this._container.matrixAutoUpdate=!1,this.context.scene.add(this._container),this._batchSystem=new pe,this._batchSystem.name=this.gameObject.name,this._container.add(this._batchSystem),this._interface=new pt(this),this._particleSystem=new ue(this._interface),this._particleSystem.addBehavior(new Ze(this)),this._particleSystem.addBehavior(new ft(this)),this._particleSystem.addBehavior(new Ke(this)),this._particleSystem.addBehavior(new Je(this)),this._particleSystem.addBehavior(new ct(this)),this._particleSystem.addBehavior(new nt(this)),this._batchSystem.addSystem(this._particleSystem);let e=this._particleSystem.emitter;this.context.scene.add(e),this.inheritVelocity.system&&this.inheritVelocity.system!==this&&(this.inheritVelocity=this.inheritVelocity.clone()),this.inheritVelocity.awake(this),Ie&&(console.log(this),this.gameObject.add(new a(1)))}start(){this.addSubParticleSystems(),this.updateLayers(),this.renderer.particleMesh instanceof i&&this._interface.renderMode==w.Mesh&&ae.assignMeshLOD(this.renderer.particleMesh,0).then(e=>{e&&this.particleSystem&&this._interface.renderMode==w.Mesh&&(this.particleSystem.instancingGeometry=e)})}onDestroy(){this._container?.removeFromParent(),this._batchSystem?.removeFromParent(),this._particleSystem?.emitter.removeFromParent(),this._particleSystem?.dispose()}onEnable(){this.main&&(this.inheritVelocity&&(this.inheritVelocity.system=this),this._batchSystem&&(this._batchSystem.visible=!0),this.playOnAwake&&this.play(),this._isPlaying=this.playOnAwake)}onDisable(){this._batchSystem&&(this._batchSystem.visible=!1)}onBeforeRender(){this.main&&(this._didPreWarm===!1&&this.main?.prewarm===!0&&(this._didPreWarm=!0,this.preWarm()),this.onUpdate(),this.onSimulate(this.deltaTime))}preWarm(){if(!this.emission?.enabled||this.emission.rateOverTime.getMax()<=0)return;let e=1/60,t=this.main.duration,n=this.main.startLifetime.getMax(),r=Math.min(Math.max(t,n)/Math.max(.01,this.main.simulationSpeed),1e3),i=Math.ceil(r/e),a=Date.now();Ie&&console.log(`Particles ${this.name} - Prewarm for ${i} frames (${r} sec). Duration: ${t}, Lifetime: ${n}`);for(let t=0;t=this.maxParticles);t++){let t=Date.now()-a;if(t>2e3){console.warn(`Particles ${this.name} - Prewarm took too long. Aborting: ${t}`);break}this.onUpdate(),this.onSimulate(e)}}_lastBatchesCount=-1;onSimulate(e){if(this._batchSystem){let t=this.context.time.frameCount%60==0;this._lastBatchesCount!==this._batchSystem.batches.length&&(this._lastBatchesCount=this._batchSystem.batches.length,t=!0),t&&this.updateLayers(),this._batchSystem.update(e)}this._time+=e,this._time>this.duration&&(this._time=0)}updateLayers(){if(this._batchSystem)for(let e=0;ei.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./materialx.eMaybKAQ.js","./materialx.CnHmG--Y.js","./rolldown-runtime.CYVBeYYp.js","./three@0.169.19.js","./rapier3d.DBFmcAzL.js","./needle-engine.dep.DFJFZC0m.js","./postprocessing.Wy71DpiM.js","./N8AO.C2WXsanG.js","./postprocessing.ao.BRYreHJS.js","./three-examples.extras@0.169.19.js","./peerjs.UdR1_Ath.js","./needle-engine.BJP2NBoC.js","./needle-engine.dep.B3nA4wQ5.js","./three-mesh-bvh.B-oXEGo2.js","./GenerateMeshBVHWorker.DMD7ZOpN.js","./needle-engine@5.0.3.js","./needle-engine.extras.CWxm8YHB.js","./needle-engine-webxr.BfNO-tft.js","./gltf-progressive.BBJGcb3s.js","./three-examples@0.169.19.js","./needle-engine-particles.Bz_Ei_ja.js","./three-quarks.DALdLWPD.js","./needle-engine.extras.1SuflpgE.js"])))=>i.map(i=>d[i]); import{n as e,r as t,t as n}from"./rolldown-runtime.CYVBeYYp.js";import{d as r}from"./materialx.CnHmG--Y.js";import{$n as i,A as a,Ar as o,At as s,B as c,Bt as l,Cn as u,Fr as d,Ft as f,Gn as p,H as m,Ir as h,Jt as g,Kn as _,L as v,Nt as ee,On as y,Ot as b,Pr as te,Qn as ne,Qt as re,S as ie,St as ae,Wt as oe,X as se,Xt as ce,Yt as le,Z as ue,Zn as de,Zt as x,_ as fe,_n as pe,_r as me,a as he,ct as ge,d as _e,dt as ve,et as ye,fn as S,gn as C,gr as be,h as xe,i as Se,in as Ce,it as we,jr as Te,jt as Ee,k as De,kr as w,lr as Oe,mn as ke,mr as Ae,nr as je,o as Me,on as Ne,or as Pe,p as Fe,pr as Ie,qt as T,rr as Le,rt as Re,sr as ze,st as Be,tr as Ve,tt as He,ur as Ue,ut as We,v as Ge,vn as Ke,w as qe,wn as E,x as Je,xr as Ye,y as Xe,yn as Ze}from"./three@0.169.19.js";import{a as Qe,c as $e,i as et,n as tt,o as D,r as nt,s as rt,t as it}from"./three-mesh-ui.CgGzZ3ml.js";import{A as at,C as ot,E as st,M as ct,S as lt,T as ut,_ as dt,a as ft,h as pt,i as mt,v as ht,w as gt,y as _t}from"./three-examples@0.169.19.js";import{n as vt,o as yt,r as bt,t as xt}from"./gltf-progressive.BBJGcb3s.js";var St=window.location.search.includes(`debugcontext`),O;(function(e){e.ContextRegistered=`ContextRegistered`,e.ContextCreationStart=`ContextCreationStart`,e.ContextCreated=`ContextCreated`,e.ContextFirstFrameRendered=`ContextFirstFrameRendered`,e.ContextDestroying=`ContextDestroying`,e.ContextDestroyed=`ContextDestroyed`,e.MissingCamera=`MissingCamera`,e.ContextClearing=`ContextClearing`,e.ContextCleared=`ContextCleared`})(O||={});var k=class{static get Current(){return globalThis[`NeedleEngine.Context.Current`]}static set Current(e){globalThis[`NeedleEngine.Context.Current`]=e}static get All(){return this.Registered}static Registered=[];static register(e){this.Registered.indexOf(e)===-1&&(St&&console.warn(`Registering context`),this.Registered.push(e),this.dispatchCallback(O.ContextRegistered,e))}static unregister(e){let t=this.Registered.indexOf(e);t!==-1&&(St&&console.warn(`Unregistering context`),this.Registered.splice(t,1))}static _callbacks={};static registerCallback(e,t){this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t)}static unregisterCallback(e,t){if(!this._callbacks[e])return;let n=this._callbacks[e].indexOf(t);n!==-1&&this._callbacks[e].splice(n,1)}static dispatchCallback(e,t,n){if(!this._callbacks[e])return!0;let r={event:e,context:t};if(n)for(let e in n)r[e]=n[e];let i=[];return this._callbacks[e].forEach(e=>{let t=e(r);t instanceof Promise&&i.push(t)}),Promise.all(i)}static addContextCreatedCallback(e){this.registerCallback(O.ContextCreated,e)}static addContextDestroyedCallback(e){this.registerCallback(O.ContextDestroyed,e)}},Ct=new Map;function wt(e=globalThis.location?.hostname){if(Ct.has(e))return Ct.get(e);let t=/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|localhost/.test(e);return Ct.set(e,t),t===!0}function Tt(){return window.location.hostname.includes(`glitch.me`)}var Et=()=>e=>e;function Dt(e){return Et()(e)}function Ot(){return!!A(`debug`)}var kt=class{_factory;_cache=[];_maxSize;_index=0;constructor(e,t){this._factory=e,this._maxSize=t}get(){let e=this._index%this._maxSize;return this._index++,this._cache.length<=e&&(this._cache[e]=this._factory()),this._cache[e]}},At=!1,jt=[];typeof window<`u`&&setTimeout(()=>{if(At){let e={},t=new URL(window.location.href),n=new URL(t);n.searchParams.append(`console`,``);let r=n.toString().replace(/=$|=(?=&)/g,``);for(let n of jt){let r=new URL(t);r.searchParams.append(n,``),e[n]=r.toString().replace(/=$|=(?=&)/g,``)}console.log(`🌵 ?help: Debug Options for Needle Engine. Append any of these parameters to the URL to enable specific debug options. Example: ${r} will show an onscreen console window.`);let i=At===!0?``:` (containing "${At}")`;console.group(`Available URL parameters:`+i);for(let t of Object.keys(e).sort())typeof At==`string`&&!t.toLowerCase().includes(At.toLowerCase())||(console.groupCollapsed(t),console.log(`Reload with this flag enabled:`),console.log(e[t]),console.groupEnd());console.groupEnd()}},100);function Mt(){return new URLSearchParams(globalThis.location?.search)}function A(e){At&&!jt.includes(e)&&jt.push(e);let t=Mt();if(t.has(e)){let n=t.get(e);if(n){let e=Number(n);return isNaN(e)?n:e}else return!0}return!1}At=A(`help`);function Nt(e,t){let n=Mt();n.has(e)?n.set(e,t):n.append(e,t),document.location.search=n.toString()}function Pt(e,t,n=!0){let r=Mt();r.has(e)?t===null?r.delete(e):r.set(e,t):t!==null&&r.append(e,t),n?It(e,r):Lt(e,r)}function Ft(e,t,n){e.has(t)?e.set(t,n.toString()):e.append(t,n.toString())}function It(e,t,n){window.history.pushState(n,e,`?`+t.toString())}function Lt(e,t,n){window.history.replaceState(n,e,`?`+t.toString())}function Rt(e){for(var t=``,n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,r=n.length,i=0;i{setTimeout(t,e)})}function qt(e,t){if(e<=0)return Promise.resolve();if(t||=k.Current,!t)return Promise.reject(`No context`);let n=t.time.frameCount+e;return new Promise((e,r)=>{if(!t)return r(`No context`);let i=()=>{t.time.frameCount>=n&&(t.pre_update_callbacks.splice(t.pre_update_callbacks.indexOf(i),1),e())};t.pre_update_callbacks.push(i)})}var Jt=A(`debugresolveurl`),Yt=`rel:`;function Xt(e,t){return Zt(e,t)}function Zt(e,t){if(t===void 0)return Jt&&console.warn(`getPath: uri is undefined, returning uri`,t),t;if(t.startsWith(`./`))return t;if(t.startsWith(`http`))return Jt&&console.warn(`getPath: uri is absolute, returning uri`,t),t;if(e===void 0)return Jt&&console.warn(`getPath: source is undefined, returning uri`,t),t;t.startsWith(`rel:`)&&(t=t.substring(4));let n=e.lastIndexOf(`/`);if(n>=0){let r=e.substring(0,n+1);for(;r.endsWith(`/`)&&t.startsWith(`/`);)t=t.substring(1);let i=r+t;return Jt&&console.log(`source:`,e,`changed uri @@ -82,7 +82,7 @@ void main(){ }`})}reset(){this.uniforms.map.value=null,this.uniforms.flipY.value=!0,this.uniforms.writeDepth.value=!1,this.uniforms.depthTexture.value=null,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}},ai=class e{static planeGeometry=new Ke(2,2,1,1);static renderer=new h({antialias:!1,alpha:!0});static perspectiveCam=new C;static orthographicCam=new ke;static scene=new ne;static blitMaterial=new ii;static mesh=new x(e.planeGeometry,e.blitMaterial);static copyTexture(e,t){t||=this.blitMaterial,this.blitMaterial.reset();let n=t||this.blitMaterial;n.uniforms.map.value=e,n.needsUpdate=!0,n.uniformsNeedUpdate=!0;let r=n.vertexShader;n.vertexShader=ii.vertex;let i=this.mesh;i.material=n,i.frustumCulled=!1,this.scene.children.length=0,this.scene.add(i),this.renderer.setSize(e.image.width,e.image.height),this.renderer.clear(),this.renderer.render(this.scene,this.perspectiveCam);let a=new be(this.renderer.domElement);return a.name=`Copy`,a.needsUpdate=!0,n.vertexShader=r,a}static blit(e,t,n){let{renderer:r=this.renderer,blitMaterial:i=this.blitMaterial,flipY:o=!1,depthTexture:s=null,depthTest:c=!0,depthWrite:l=!0}=n||{};this.blitMaterial.reset(),i.uniforms.map&&(i.uniforms.map.value=e),i.uniforms.flipY&&(i.uniforms.flipY.value=o),s?(i.uniforms.writeDepth=new Ye(!0),i.uniforms.depthTexture.value=s):(i.uniforms.writeDepth=new Ye(!1),i.uniforms.depthTexture.value=null),i.needsUpdate=!0,i.uniformsNeedUpdate=!0;let u=this.mesh;u.material=i,u.frustumCulled=!1,this.scene.children.length=0,this.scene.add(u);let d=r.getRenderTarget(),f=r.getContext();c?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),r.state.buffers.depth.setMask(l),r.setClearColor(new a(0,0,0),0),r.setRenderTarget(t),r.clear(),r.render(this.scene,this.perspectiveCam),r.setRenderTarget(d),f.enable(f.DEPTH_TEST),r.state.buffers.depth.setMask(!0)}static textureToCanvas(e,t=!1){if(!e)return null;(t===!0||e.isCompressedTexture===!0)&&(e=oi(e));let n=e.image;if(ci(n)){let e=document.createElement(`canvas`);e.width=n.width,e.height=n.height;let t=e.getContext(`2d`);return t?(t.drawImage(n,0,0,n.width,n.height,0,0,e.width,e.height),e):(console.error(`Failed getting canvas 2d context`),null)}return null}};function oi(e){return ai.copyTexture(e)}function si(e,t=!1){return ai.textureToCanvas(e,t)}function ci(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas||typeof ImageBitmap<`u`&&e instanceof ImageBitmap}function li(e){let t=e.type;return t===`Mesh`||t===`SkinnedMesh`}function ui(e,t){t?e[`needle:rendercustomshadow`]=!0:e[`needle:rendercustomshadow`]=!1}function di(e){return!!(e&&(e[`needle:rendercustomshadow`]===!0||e[`needle:rendercustomshadow`]==null))}function fi(e,t=void 0,n=void 0,r=void 0){let i=r||new fe;i.makeEmpty();let a=[];function o(e){let r=!0;if(e.visible&&lr(e)!==!1&&!(e.type===`TransformControlsGizmo`||e.type===`TransformControlsPlane`)){if(e instanceof Ge&&(r=!1),e instanceof We&&(r=!1),e instanceof ct&&(r=!1),e.isGizmo===!0&&(r=!1),e.material instanceof je&&(r=!1),li(e)||(r=!1),n&&e.layers.test(n)===!1&&(r=!1),r&&(t&&Array.isArray(t)&&t?.includes(e)||typeof t==`function`&&t(e)===!0))return;if(e.isUI!==!0){if(r){let t=e.children;e.children=a;let n=e.position,r=e.scale;if(Number.isNaN(n.x)||Number.isNaN(n.y)||Number.isNaN(n.z)){console.warn(`Object \"${e.name}\" has NaN values in position or scale.... will ignore it`,n,r);return}e.geometry===null&&(e.geometry=void 0),i.expandByObject(e,!0),e.children=t}for(let t of e.children)o(t)}}}let s=!1;Array.isArray(e)||(e=[e]);for(let t of e)t&&(s=!0,t.updateMatrixWorld(),o(t));return s||console.warn(`No objects to fit camera to...`),i}function pi(e,t,n){let r=fi([e],n?.ignore),i=new o;r.getSize(i);let a=new o;r.getCenter(a);let s=new o;t.getSize(s);let c=new o;t.getCenter(c);let l=new o;l.set(s.x/i.x,s.y/i.y,s.z/i.z);let u=Math.min(l.x,l.y,l.z),d=n?.scale!==!1;if(d&&Br(e,zr(e).multiplyScalar(u)),n?.position!==!1){let n=new o;r.getCenter(n),n.y=r.min.y;let i=new o;t.getCenter(i),i.y=t.min.y;let a=i.clone().sub(n);d&&a.multiplyScalar(u),kr(e,Or(e).add(a))}return{boundsBefore:r,scale:l}}function mi(e,t){let n=fi([e]),r=new o;n.getCenter(r),r.y=n.min.y;let i=t.clone().sub(r);return kr(e,Or(e).add(i)),{offset:i,bounds:n}}function hi(e,t,n,r){if(Array.isArray(t)){let n=!0;for(let r=0;r{M()&&k.Current?.isInXR&&(_i(!0),wi(`error`,...e))});function _i(e){if(e){if(gi)return;gi=!0,xi()}else{if(!gi)return;gi=!1,Si()}}var vi={log:void 0,warn:void 0,error:void 0},yi=class{familyName=`needle-xr`;root=null;context=null;defaultFontSize=.06;constructor(){this.ensureFont()}onEnable(){this.context=k.Current||k.All[0],this.context.pre_render_callbacks.push(this.onBeforeRender)}onDisable(){this.context?.pre_render_callbacks.splice(this.context?.pre_render_callbacks.indexOf(this.onBeforeRender),1),this.root?.removeFromParent()}targetObject=new S;userForwardViewPoint=new o;oneEuroFilter=new ir(90,.8);_lastElementRemoveTime=0;onBeforeRender=()=>{let e=this.context?.mainCamera;if(this.context&&e instanceof C){let t=this.getRoot();Number.isNaN(t.position.x)&&t.position.set(0,0,0),Number.isNaN(t.quaternion.x)&&t.quaternion.set(0,0,0,1),this.context.scene.add(this.targetObject);let n=this.context.xr?.rigScale??1,r=3.5*n,i=e.worldForward;i.y=0,i.normalize().multiplyScalar(r),this.userForwardViewPoint.copy(e.worldPosition).sub(i),this.targetObject.position.distanceTo(this.userForwardViewPoint)>2*n&&(this.targetObject.position.copy(this.userForwardViewPoint),yr(this.targetObject,e,!0,!0),this.targetObject.rotateY(Math.PI)),this.oneEuroFilter.filter(this.targetObject.position,t.position,this.context.time.time);let a=this.context.time.deltaTime;if(t.quaternion.slerp(this.targetObject.quaternion,a*5),t.scale.setScalar(n),this.targetObject.removeFromParent(),this.context.scene.add(t),this.context.time.time-this._lastElementRemoveTime>.1){this._lastElementRemoveTime=this.context.time.time;let e=Date.now();for(let t=0;t2e4){n.removeFromParent(),this._textBuffer.push(n),this._activeTexts.splice(t,1);break}}}}};addLog(e,t){let n=this.getRoot(),r=this.getText(),i=16777215,a=0;switch(e){case`log`:i=16777215,a=0;break;case`warn`:i=16772761,a=4465152;break;case`error`:i=16755370,a=7798784;break}t.length>1e3&&(t=t.substring(0,1e3)+`...`),r.textContent=`[`+new Date().toISOString().split(`T`)[1].split(`.`)[0]+`] `+t,r.visible=!0,r._activatedTime=Date.now(),n.add(r),this._activeTexts.push(r),this.context&&this.context.scene.add(n),r.set({backgroundColor:i,color:a}),D.update()}ensureFont(){let e=D.FontLibrary.getFontFamily(this.familyName);e||(e=D.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`,()=>{D.update()}))}textOptions={fontSize:this.defaultFontSize,fontFamily:this.familyName,padding:.03,margin:.005,color:0,backgroundColor:16777215,backgroundOpacity:.4,borderRadius:.03,offset:.025};_textBuffer=[];_activeTexts=[];getText(){let e=this.getRoot();if(this._textBuffer.length>0){let e=this._textBuffer.pop();return e.visible=!0,setTimeout(()=>this.disableDepthTestRecursive(e),100),e}if(e.children.length>20&&this._activeTexts.length>0)return this._activeTexts.shift();let t=new D.Text(this.textOptions);return setTimeout(()=>this.disableDepthTestRecursive(t),500),setTimeout(()=>this.disableDepthTestRecursive(t),1500),t}disableDepthTestRecursive(e,t=0){for(let n=0;nn&&t[r]===`0`;)r--;return t.substring(0,r+1)}return e.toString()}else if(Array.isArray(e)){let n=`[`;for(let i=0;i=60&&(o+=` `,o+=i(t),n+=o,o=``)}return n+=o,n+=` -}`,n}return e}function i(e){let t=``;for(let n=0;ne.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}let t=this.mixers.indexOf(e);t!==-1&&this.mixers.splice(t,1)}},Pi=class{static testIfRootCanAnimate(e,t){let n=e.getRoot();return n&&(n.userData.static||n.matrixAutoUpdate===!1||n.matrixWorldAutoUpdate===!1)?((t===!0||t===void 0&&M())&&console.warn(`AnimationUtils: The root object (${n.name||n.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:n.userData.static,name:n.userData.name,tag:n.userData.tag,matrixAutoUpdate:n.matrixAutoUpdate,matrixWorldAutoUpdate:n.matrixWorldAutoUpdate}),!1):!0}static tryGetActionsFromMixer(e){return e._actions||null}static tryGetAnimationClipsFromObjectHierarchy(e,t){if(t||=[],e)e.animations&&t.push(...e.animations);else return t;if(e.children)for(let n of e.children)this.tryGetAnimationClipsFromObjectHierarchy(n,t);return t}static autoplayAnimations(e){if(!e||!e.animations)return console.debug(`No animations found in file`),null;let t=`scene`in e?e.scene:e,n=[];for(let i=0;i0)for(let e=0;e=0;e--){let t=r[e];t.prefix===n&&(t.prefix=null),t.postfix===n&&(t.postfix=null),!t.prefix&&!t.postfix&&r.splice(e,1)}}var $i=Symbol(`Needle:Patches:WrappedFunction`);function ea(e,t,n){if(e[$i])return e;let r=function(...r){aa(t,n,this,...r);let i=e.apply(this,r);return oa(t,n,this,i,...r),i};return r[$i]=!0,r}var ta=`Needle:Patches`;function na(){return globalThis[`Needle:Patches`]||(globalThis[ta]=new WeakMap),globalThis[ta]}function ra(e,t){let n=na().get(e);return n?n.get(t):null}function ia(e,t,n,r){let i=na().get(e);i||(i=new Map,na().set(e,i));let a=i.get(t);a||(a=[],i.set(t,a)),a.push({prefix:n,postfix:r})}function aa(e,t,n,...r){if(!n)return;let i=ra(e,t);if(i)for(let e of i)e.prefix?.call(n,...r)}function oa(e,t,n,r,...i){if(!n)return;let a=ra(e,t);if(a)for(let e of a)e.postfix?.call(n,r,...i)}function sa(e,t){if(window.SPECTOR){console.log(window.SPECTOR);let n=new URLSearchParams(window.location.search);if(n.has(`spector`)){let r=Number.parseInt(n.get(`spector`)||`0`)||0;console.log(`Scheduled Spector capture at frame #`+r);let i=new window.SPECTOR.Spector;i.spyCanvases=!0,a();return;function a(){if(r>e.time.frame)return window.requestAnimationFrame(()=>a());let n=i.captureCanvas(t);n&&n instanceof Promise?n.then(()=>i.displayUI()):i.displayUI()}}else M()&&console.debug(`Spector available: Add '?spector=' to the URL to enable it and capture a frame.`)}}function ca(e){let t=e;return!!(t.parser&&t.parser.json)}var la;(function(e){e[e.None=0]=`None`,e[e.DontExport=1]=`DontExport`})(la||={});var ua=Symbol(`component-name`);function da(e){return e&&e.isComponent}var fa=Symbol(`object`),pa=new kt(()=>new o,20),ma=class{_point;_normal;_tangentVelocity;distance;impulse;friction;get point(){return pa.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return pa.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return pa.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}constructor(e,t,n,r,i,a){this._point=e,this.distance=t,this._normal=n,this.impulse=r,this.friction=i,this._tangentVelocity=a}},ha=class{contacts;constructor(e,t,n){this.me=e,this._collider=t,this._gameObject=t.gameObject,this.contacts=n}me;_collider;get collider(){return this._collider}_gameObject;get gameObject(){return this._gameObject}get rigidBody(){return this.collider?.attachedRigidbody}},ga=class{object;collider;constructor(e,t){this.object=e,this.collider=t}},_a=class e{context;static _managers=new WeakMap;static get(e){return da(e)?this._managers.get(e.context):this._managers.get(e)}constructor(e){this.context=e,this.root.style.cssText=` +}`,n}return e}function i(e){let t=``;for(let n=0;ne.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}let t=this.mixers.indexOf(e);t!==-1&&this.mixers.splice(t,1)}},Pi=class{static testIfRootCanAnimate(e,t){let n=e.getRoot();return n&&(n.userData.static||n.matrixAutoUpdate===!1||n.matrixWorldAutoUpdate===!1)?((t===!0||t===void 0&&M())&&console.warn(`AnimationUtils: The root object (${n.name||n.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:n.userData.static,name:n.userData.name,tag:n.userData.tag,matrixAutoUpdate:n.matrixAutoUpdate,matrixWorldAutoUpdate:n.matrixWorldAutoUpdate}),!1):!0}static tryGetActionsFromMixer(e){return e._actions||null}static tryGetAnimationClipsFromObjectHierarchy(e,t){if(t||=[],e)e.animations&&t.push(...e.animations);else return t;if(e.children)for(let n of e.children)this.tryGetAnimationClipsFromObjectHierarchy(n,t);return t}static autoplayAnimations(e){if(!e||!e.animations)return console.debug(`No animations found in file`),null;let t=`scene`in e?e.scene:e,n=[];for(let i=0;i0)for(let e=0;e=0;e--){let t=r[e];t.prefix===n&&(t.prefix=null),t.postfix===n&&(t.postfix=null),!t.prefix&&!t.postfix&&r.splice(e,1)}}var $i=Symbol(`Needle:Patches:WrappedFunction`);function ea(e,t,n){if(e[$i])return e;let r=function(...r){aa(t,n,this,...r);let i=e.apply(this,r);return oa(t,n,this,i,...r),i};return r[$i]=!0,r}var ta=`Needle:Patches`;function na(){return globalThis[`Needle:Patches`]||(globalThis[ta]=new WeakMap),globalThis[ta]}function ra(e,t){let n=na().get(e);return n?n.get(t):null}function ia(e,t,n,r){let i=na().get(e);i||(i=new Map,na().set(e,i));let a=i.get(t);a||(a=[],i.set(t,a)),a.push({prefix:n,postfix:r})}function aa(e,t,n,...r){if(!n)return;let i=ra(e,t);if(i)for(let e of i)e.prefix?.call(n,...r)}function oa(e,t,n,r,...i){if(!n)return;let a=ra(e,t);if(a)for(let e of a)e.postfix?.call(n,r,...i)}function sa(e,t){if(window.SPECTOR){console.log(window.SPECTOR);let n=new URLSearchParams(window.location.search);if(n.has(`spector`)){let r=Number.parseInt(n.get(`spector`)||`0`)||0;console.log(`Scheduled Spector capture at frame #`+r);let i=new window.SPECTOR.Spector;i.spyCanvases=!0,a();return;function a(){if(r>e.time.frame)return window.requestAnimationFrame(()=>a());let n=i.captureCanvas(t);n&&n instanceof Promise?n.then(()=>i.displayUI()):i.displayUI()}}else M()&&console.debug(`Spector available: Add '?spector=' to the URL to enable it and capture a frame.`)}}function ca(e){let t=e;return!!(t.parser&&t.parser.json)}var la;(function(e){e[e.None=0]=`None`,e[e.DontExport=1]=`DontExport`})(la||={});var ua=Symbol(`component-name`);function da(e){return e&&e.isComponent}var fa=Symbol(`object`),pa=new kt(()=>new o,20),ma=class{_point;_normal;_tangentVelocity;distance;impulse;friction;get point(){return pa.get().set(this._point.x,this._point.y,this._point.z)}get normal(){return pa.get().set(this._normal.x,this._normal.y,this._normal.z)}get tangentVelocity(){return pa.get().set(this._tangentVelocity.x,this._tangentVelocity.y,this._tangentVelocity.z)}constructor(e,t,n,r,i,a){this._point=e,this.distance=t,this._normal=n,this.impulse=r,this.friction=i,this._tangentVelocity=a}},ha=class{contacts;constructor(e,t,n){this.me=e,this._collider=t,this._gameObject=t.gameObject,this.contacts=n}me;_collider;get collider(){return this._collider}_gameObject;get gameObject(){return this._gameObject}get rigidBody(){return this.collider?.attachedRigidbody}},ga=class{object;collider;constructor(e,t){this.object=e,this.collider=t}},_a=class e{context;static _managers=new WeakMap;static get(e){return da(e)?this._managers.get(e.context):this._managers.get(e)}constructor(e){this.context=e,this.root.style.cssText=` position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; diff --git a/Needle/MenuScene/dist/assets/needle-engine-ui.i2hfjKja.js.gz b/Needle/MenuScene/dist/assets/needle-engine-ui.i2hfjKja.js.gz new file mode 100644 index 0000000..4c51e20 Binary files /dev/null and b/Needle/MenuScene/dist/assets/needle-engine-ui.i2hfjKja.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine-ui.iRWmt52F.js.gz b/Needle/MenuScene/dist/assets/needle-engine-ui.iRWmt52F.js.gz deleted file mode 100644 index dad8383..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine-ui.iRWmt52F.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js b/Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js similarity index 99% rename from Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js rename to Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js index 6c7318c..da8bcbe 100644 --- a/Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js +++ b/Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./needle-engine.dep.BzZBR-mM.js","./needle-engine.D6xdy26G.js","./three@0.169.19.js","./rolldown-runtime.CYVBeYYp.js"])))=>i.map(i=>d[i]); -import{d as e}from"./materialx.CnHmG--Y.js";import{$t as t,A as n,Ar as r,At as i,Bt as a,Cn as o,Cr as s,Dt as c,Et as l,Fr as u,G as d,Gt as f,Ir as p,It as m,Jt as h,K as g,Kn as _,Mt as ee,On as te,Qn as ne,Qt as v,R as re,S as ie,Sn as ae,Vt as oe,Wn as y,Wt as se,Xn as ce,Xt as b,Yn as le,Zn as ue,Zt as x,_ as de,_n as fe,_r as pe,a as me,an as he,b as ge,d as _e,dt as ve,er as ye,fn as S,gn as be,gr as xe,gt as Se,ht as Ce,i as we,in as Te,jr as C,kr as Ee,l as De,lt as Oe,m as ke,mn as Ae,nt as je,pt as Me,qt as Ne,r as Pe,rn as Fe,sr as Ie,tn as Le,tr as Re,tt as ze,u as Be,ur as Ve,vn as He,wn as Ue,wr as We,x as Ge,xr as Ke}from"./three@0.169.19.js";import{$a as qe,$i as Je,$r as Ye,Aa as Xe,An as Ze,Ba as Qe,Bi as $e,Bn as et,Bo as tt,Br as w,C as nt,Co as rt,Cr as it,Ct as at,Di as ot,Ei as st,Er as ct,Fi as lt,Gi as ut,Gn as dt,Ho as ft,Ht as pt,Ia as mt,Jn as ht,Jt as gt,Ka as T,Kt as _t,L as vt,Lr as yt,Lt as bt,Ma as xt,Mr as St,N as Ct,Ni as wt,Nr as Tt,Nt as Et,Oa as Dt,P as Ot,Q as kt,Qi as At,Qn as jt,Qr as Mt,Qt as Nt,Rr as Pt,Sn as Ft,Sr as It,Tt as Lt,Ua as Rt,Uo as zt,Vt as Bt,Wn as Vt,Wo as Ht,X as Ut,Xi as E,Xn as Wt,Yn as Gt,Yt as Kt,Zi as qt,Zr as Jt,_a as Yt,_n as Xt,_t as Zt,an as Qt,ba as $t,c as en,co as D,cr as O,ct as k,dn as tn,ei as nn,eo as A,fi as rn,fn as j,gn as an,gr as on,hn as sn,j as cn,jo as ln,kn as un,kt as dn,la as fn,ln as pn,m as M,ma as mn,mi as hn,mr as gn,mt as _n,na as vn,ni as yn,nn as bn,o as xn,oo as Sn,ot as N,p as Cn,pa as wn,pn as Tn,q as En,qi as Dn,qt as On,ra as kn,s as An,so as jn,sr as Mn,ta as Nn,ti as Pn,to as Fn,tr as In,un as Ln,va as Rn,vi as zn,wi as Bn,wr as Vn,x as Hn,y as Un,yn as Wn,yt as Gn,z as Kn,zn as qn,zo as Jn}from"./needle-engine-ui.iRWmt52F.js";import{A as Yn,M as Xn,b as Zn,c as Qn,f as $n,l as er,m as tr,o as nr,p as rr,r as ir,s as ar,u as or,v as sr,x as cr,y as lr}from"./three-examples@0.169.19.js";import{a as ur,c as dr,i as fr,n as P,o as pr,r as mr,s as hr}from"./gltf-progressive.BBJGcb3s.js";var gr=D(`debugwebxr`),_r=class{static tryFindAvatarObjects(e,t,n){if(n.head&&n.leftHand&&n.rightHand)return;let r=e.name.toLocaleLowerCase();!n.head&&r.includes(`head`)&&(gr&&console.log(`FOUND AVATAR HEAD`,e.name),n.head=new w(``,t,e)),r.includes(`hand`)&&(!n.leftHand&&r.includes(`left`)&&(gr&&console.log(`FOUND AVATAR LEFT HAND`,e.name),n.leftHand=new w(``,t,e)),!n.rightHand&&r.includes(`right`)&&(gr&&console.log(`FOUND AVATAR RIGHT HAND`,e.name),n.rightHand=new w(``,t,e)));for(let r=0;r=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},yr=D(`debuganimation`),br=class{x;y},xr=class extends N{get isAnimationComponent(){return!0}addClip(e){this.animations||=[],this.animations.includes(e)||this.animations.push(e)}playAutomatically=!0;randomStartTime=!1;minMaxSpeed;minMaxOffsetNormalized;loop=!0;clampWhenFinished=!1;get time(){if(this.actions){for(let e of this.actions)if(e.isRunning())return e.time}return 0}set time(e){if(this.actions)for(let t of this.actions)t.time=e}get duration(){if(this.actions){for(let e of this.actions)if(e.isRunning())return e.getClip().duration}return 0}_tempAnimationClipBeforeGameObjectExisted=null;get clip(){return this.animations?.length?this.animations[0]:null}set clip(e){if(!this.__didAwake){yr&&console.warn(`Assign clip during serialization`,e),this._tempAnimationClipBeforeGameObjectExisted=e;return}e&&(this.gameObject.animations||(this.gameObject.animations=[]),!this.animations.includes(e)&&(this.animations.length>0?this.animations.splice(0,0,e):this.animations.push(e)))}set clips(e){this.animations=e}_tempAnimationsArray;set animations(e){e==null||!Array.isArray(e)||(this.gameObject?this.gameObject.animations=e:this._tempAnimationsArray=e)}get animations(){return this.gameObject?.animations||this._tempAnimationsArray||[]}mixer=void 0;get actions(){return this._actions}set actions(e){this._actions=e}_actions;_handles;awake(){this.mixer=void 0,yr&&console.log(`Animation Awake`,this.name,this),this._tempAnimationsArray&&=(this.animations=this._tempAnimationsArray,void 0),this._tempAnimationClipBeforeGameObjectExisted&&=(this.clip=this._tempAnimationClipBeforeGameObjectExisted,null),this.actions=[],this._handles=[]}onEnable(){if(this.playAutomatically&&this.animations?.length>0){let e=Math.floor(Math.random()*this.animations.length),t=this.animations[e];this.play(e,{exclusive:!0,fadeDuration:0,startTime:this.randomStartTime?Math.random()*t.duration:0,loop:this.loop,clampWhenFinished:this.clampWhenFinished})}}update(){this.mixer&&(this.mixer.update(this.context.time.deltaTime),this._handles.forEach(e=>e.update()))}onDisable(){this.mixer&&this.mixer.stopAllAction()}onDestroy(){this.context.animations.unregisterAnimationMixer(this.mixer)}getAction(e){return this.actions?.find(t=>t.getClip().name===e)||null}get isPlaying(){if(this.actions){for(let e=0;e=this.animations.length){yr&&console.log(`No animation at index`,e);return}e=this.animations[e]}else typeof e==`string`&&(e=this.animations.find(t=>t.name===e));if(!e){console.error(`Could not find clip`,e);return}let n=this.actions.find(t=>t.getClip()===e);if(!n){console.error(`Could not find action`,e);return}t?.fadeDuration?n.fadeOut(t.fadeDuration):n.stop()}pause(e,t=!1){if(e===void 0){for(let e of this.actions)e.paused=!t;return}else if(typeof e==`number`){if(e>=this.animations.length){yr&&console.log(`No animation at index`,e);return}e=this.animations[e]}else typeof e==`string`&&(e=this.animations.find(t=>t.name===e));if(!e){console.error(`Could not find clip`,e);return}let n=this.actions.find(t=>t.getClip()===e);if(!n){console.error(`Could not find action`,e);return}n.paused=!t}resume(){for(let e of this.actions)e.paused=!1}play(e=0,t){if(yr&&console.log(`PLAY`,e),this.ensureMixer(),!this.mixer){yr&&console.warn(`Missing mixer`,this);return}e===void 0&&(e=0);let n=e;if(typeof e==`number`){if(e>=this.animations.length){yr&&console.log(`No animation at index`,e);return}n=this.animations[e]}else typeof e==`string`&&(n=this.animations.find(t=>t.name===e));if(!n){console.error(`Could not find clip`,e);return}t||={};for(let e of this.actions)if(e.getClip()===n)return this.internalOnPlay(e,t);if(!n.tracks){console.warn(`Clip is no AnimationClip`,n);return}let r=this.mixer.clipAction(n);return this.actions.push(r),this.internalOnPlay(r,t)}internalOnPlay(e,t){var n=this.actions.find(t=>t===e);if(n===e&&n.isRunning()&&n.time=e.getClip().duration&&(e.time=0);t?.minMaxSpeed?e.timeScale=Rt.lerp(t.minMaxSpeed.x,t.minMaxSpeed.y,Math.random()):e.timeScale=t?.speed??1,t?.loop==null?e.loop=se:e.loop=t.loop?f:se,t?.clampWhenFinished&&(e.clampWhenFinished=!0),e.paused=!1,e.play(),window.requestAnimationFrame(()=>At.testIfRootCanAnimate(e)),yr&&console.log(`PLAY`,e.getClip().name,e);let r=new Sr(e,this.mixer,t,e=>{this._handles.splice(this._handles.indexOf(r),1)});return this._handles.push(r),r.waitForFinish()}tryFindHandle(e){for(let t of this._handles)if(t.action===e)return t}ensureMixer(){if(!this.mixer){let e=`animationMixer`;this.gameObject[e]&&(this.mixer=this.gameObject[e]),(!this.mixer||!this.mixer.clipAction)&&(this.mixer=new me(this.gameObject),this.gameObject[e]=this.mixer)}this.context.animations.registerAnimationMixer(this.mixer)}};vr([E()],xr.prototype,`playAutomatically`,void 0),vr([E()],xr.prototype,`randomStartTime`,void 0),vr([E(br)],xr.prototype,`minMaxSpeed`,void 0),vr([E(br)],xr.prototype,`minMaxOffsetNormalized`,void 0),vr([E()],xr.prototype,`loop`,void 0),vr([E()],xr.prototype,`clampWhenFinished`,void 0),vr([E(we)],xr.prototype,`clips`,null);var Sr=class{mixer;action;promise=null;_options;_resolveCallback=null;_resolvedOrRejectedCallback;constructor(e,t,n,r){this.action=e,this.mixer=t,this._resolvedOrRejectedCallback=r,this._options=n}waitForFinish(){return this.promise?this.promise:(this.promise=new Promise(e=>{this._resolveCallback=e}),this.mixer.addEventListener(`finished`,this.onFinished),this.promise)}update(){this._options&&this._options.endTime!==void 0&&this.action.time>this._options.endTime&&(this._options.loop===!0?this.action.time=this._options.startTime??0:(this.action.time=this._options.endTime,this.action.timeScale=0,this.onResolve()))}onResolve(){this.dispose(),this._resolvedOrRejectedCallback?.call(this,this),this._resolveCallback?.call(this,this.action)}onFinished=e=>{e.action===this.action&&this.onResolve()};dispose(){this.mixer.removeEventListener(`finished`,this.onFinished)}},Cr=class extends N{get listener(){return this._listener??=new De,this._listener}_listener=null;onEnable(){yt.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){yt.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}onInteraction=()=>{this.destroyed||this.listener!=null&&this.addListenerIfItExists()};addListenerIfItExists(){let e=this._listener;if(!e||e?.parent)return;let t=this.context.mainCameraComponent||k.getComponentInParent(this.gameObject,nt);t?.threeCamera?t.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){let e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}},wr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},F=D(`debugaudio`),Tr;(function(e){e[e.Logarithmic=0]=`Logarithmic`,e[e.Linear=1]=`Linear`,e[e.Custom=2]=`Custom`})(Tr||={});var I=class e extends N{static get userInteractionRegistered(){return yt.userInteractionRegistered}static registerWaitForAllowAudio(e){yt.registerWaitForInteraction(e)}clip=``;playOnAwake=!1;preload=!0;playInBackground=!0;get isPlaying(){return this.sound?.isPlaying??!1}get duration(){return this.sound?.buffer?.duration}get time01(){let e=this.duration;return e&&this.sound?this.sound?.context.currentTime/e:0}set time01(e){let t=this.duration;t&&this.sound&&(this.time=e*t)}get time(){return this.sound?.source?this.sound.source?.context.currentTime-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;let t=this.isPlaying;this.stop(),this.sound.offset=e,t&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}_spatialBlend=0;_minDistance=1;_maxDistance=100;get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(F&&console.log(this.name,`audio set volume`,e),this.sound.setVolume(e))}_volume=1;set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}rollOffMode=0;_loop=!1;sound=null;helper=null;wasPlaying=!1;audioLoader=null;shouldPlay=!1;_lastClipStartedLoading=null;_audioElement=null;get Sound(){if(!this.sound&&e.userInteractionRegistered){let e=this.gameObject.getComponent(Cr)??this.context.mainCamera.getComponent(Cr)??Zt(Cr,this.context,!1);!e&&this.context.mainCamera&&(e=this.context.mainCamera.addComponent(Cr)),e?.listener?(this.sound=new ae(e.listener),this.gameObject?.add(this.sound)):F&&console.warn(`No audio listener found in scene - can not play audio`)}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){return this.sound?.context}awake(){F&&console.log(`[AudioSource]`,this),this.audioLoader=new Be,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip==`string`&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),e.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():e.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener(`visibilitychange`,this.onVisibilityChanged),this.context.application.addEventListener(Pt.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener(`visibilitychange`,this.onVisibilityChanged),this.context.application.removeEventListener(Pt.MuteChanged,this.onApplicationMuteChanged),this.pause()}onVisibilityChanged=()=>{switch(document.visibilityState){case`hidden`:(this.playInBackground===!1||A.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case`visible`:F&&console.log(`visible`,this.enabled,this.playOnAwake,!this.isPlaying,e.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&e.userInteractionRegistered&&this.wasPlaying&&this.play();break}};onApplicationMuteChanged=()=>{this.context.application.muted?this.sound?.setVolume(0):this.sound?.setVolume(this.volume)};createAudio=t=>{if(this.destroyed){F&&console.warn(`AudioSource destroyed, not creating audio`,this.name);return}F&&console.log(`AudioBuffer finished loading`,t);let n=this.Sound;if(!n){F&&console.warn(`Failed getting sound?`,this.name);return}n.isPlaying&&n.stop(),t&&n.setBuffer(t),n.loop=this._loop,this.context.application.muted?n.setVolume(0):n.setVolume(this.volume),n.autoplay=this.shouldPlay&&e.userInteractionRegistered,this.applySpatialDistanceSettings(),n.isPlaying&&n.stop(),e.registerWaitForAllowAudio(this.__onAllowAudioCallback)};__onAllowAudioCallback=()=>{this.shouldPlay&&this.play()};applySpatialDistanceSettings(){let e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;let t=Rt.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(F&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,`Ref distance=`+t),e.setRefDistance(t),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case Tr.Logarithmic:e.setDistanceModel(`exponential`);break;case Tr.Linear:e.setDistanceModel(`linear`);break;case Tr.Custom:console.warn(`Custom rolloff for AudioSource is not supported: `+this.name);break}this.spatialBlend>0?F&&!this.helper&&(this.helper=new tr(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e==`string`)if(F&&console.log(e),e.endsWith(`.mp3`)||e.endsWith(`.wav`)){if(this.audioLoader||=new Be,this.shouldPlay=!0,this._lastClipStartedLoading===e){F&&console.log(`Is currently loading:`,this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,F&&console.log(`load audio`,e);let t=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),t&&this.createAudio(t)}else console.warn(`Unsupported audio clip type`,e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!=`string`&&!(e instanceof MediaStream)&&(T()&&console.warn(`Called play on AudioSource with unknown argument type:`,e+` +import{d as e}from"./materialx.CnHmG--Y.js";import{$t as t,A as n,Ar as r,At as i,Bt as a,Cn as o,Cr as s,Dt as c,Et as l,Fr as u,G as d,Gt as f,Ir as p,It as m,Jt as h,K as g,Kn as _,Mt as ee,On as te,Qn as ne,Qt as v,R as re,S as ie,Sn as ae,Vt as oe,Wn as y,Wt as se,Xn as ce,Xt as b,Yn as le,Zn as ue,Zt as x,_ as de,_n as fe,_r as pe,a as me,an as he,b as ge,d as _e,dt as ve,er as ye,fn as S,gn as be,gr as xe,gt as Se,ht as Ce,i as we,in as Te,jr as C,kr as Ee,l as De,lt as Oe,m as ke,mn as Ae,nt as je,pt as Me,qt as Ne,r as Pe,rn as Fe,sr as Ie,tn as Le,tr as Re,tt as ze,u as Be,ur as Ve,vn as He,wn as Ue,wr as We,x as Ge,xr as Ke}from"./three@0.169.19.js";import{$a as qe,$i as Je,$r as Ye,Aa as Xe,An as Ze,Ba as Qe,Bi as $e,Bn as et,Bo as tt,Br as w,C as nt,Co as rt,Cr as it,Ct as at,Di as ot,Ei as st,Er as ct,Fi as lt,Gi as ut,Gn as dt,Ho as ft,Ht as pt,Ia as mt,Jn as ht,Jt as gt,Ka as T,Kt as _t,L as vt,Lr as yt,Lt as bt,Ma as xt,Mr as St,N as Ct,Ni as wt,Nr as Tt,Nt as Et,Oa as Dt,P as Ot,Q as kt,Qi as At,Qn as jt,Qr as Mt,Qt as Nt,Rr as Pt,Sn as Ft,Sr as It,Tt as Lt,Ua as Rt,Uo as zt,Vt as Bt,Wn as Vt,Wo as Ht,X as Ut,Xi as E,Xn as Wt,Yn as Gt,Yt as Kt,Zi as qt,Zr as Jt,_a as Yt,_n as Xt,_t as Zt,an as Qt,ba as $t,c as en,co as D,cr as O,ct as k,dn as tn,ei as nn,eo as A,fi as rn,fn as j,gn as an,gr as on,hn as sn,j as cn,jo as ln,kn as un,kt as dn,la as fn,ln as pn,m as M,ma as mn,mi as hn,mr as gn,mt as _n,na as vn,ni as yn,nn as bn,o as xn,oo as Sn,ot as N,p as Cn,pa as wn,pn as Tn,q as En,qi as Dn,qt as On,ra as kn,s as An,so as jn,sr as Mn,ta as Nn,ti as Pn,to as Fn,tr as In,un as Ln,va as Rn,vi as zn,wi as Bn,wr as Vn,x as Hn,y as Un,yn as Wn,yt as Gn,z as Kn,zn as qn,zo as Jn}from"./needle-engine-ui.i2hfjKja.js";import{A as Yn,M as Xn,b as Zn,c as Qn,f as $n,l as er,m as tr,o as nr,p as rr,r as ir,s as ar,u as or,v as sr,x as cr,y as lr}from"./three-examples@0.169.19.js";import{a as ur,c as dr,i as fr,n as P,o as pr,r as mr,s as hr}from"./gltf-progressive.BBJGcb3s.js";var gr=D(`debugwebxr`),_r=class{static tryFindAvatarObjects(e,t,n){if(n.head&&n.leftHand&&n.rightHand)return;let r=e.name.toLocaleLowerCase();!n.head&&r.includes(`head`)&&(gr&&console.log(`FOUND AVATAR HEAD`,e.name),n.head=new w(``,t,e)),r.includes(`hand`)&&(!n.leftHand&&r.includes(`left`)&&(gr&&console.log(`FOUND AVATAR LEFT HAND`,e.name),n.leftHand=new w(``,t,e)),!n.rightHand&&r.includes(`right`)&&(gr&&console.log(`FOUND AVATAR RIGHT HAND`,e.name),n.rightHand=new w(``,t,e)));for(let r=0;r=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},yr=D(`debuganimation`),br=class{x;y},xr=class extends N{get isAnimationComponent(){return!0}addClip(e){this.animations||=[],this.animations.includes(e)||this.animations.push(e)}playAutomatically=!0;randomStartTime=!1;minMaxSpeed;minMaxOffsetNormalized;loop=!0;clampWhenFinished=!1;get time(){if(this.actions){for(let e of this.actions)if(e.isRunning())return e.time}return 0}set time(e){if(this.actions)for(let t of this.actions)t.time=e}get duration(){if(this.actions){for(let e of this.actions)if(e.isRunning())return e.getClip().duration}return 0}_tempAnimationClipBeforeGameObjectExisted=null;get clip(){return this.animations?.length?this.animations[0]:null}set clip(e){if(!this.__didAwake){yr&&console.warn(`Assign clip during serialization`,e),this._tempAnimationClipBeforeGameObjectExisted=e;return}e&&(this.gameObject.animations||(this.gameObject.animations=[]),!this.animations.includes(e)&&(this.animations.length>0?this.animations.splice(0,0,e):this.animations.push(e)))}set clips(e){this.animations=e}_tempAnimationsArray;set animations(e){e==null||!Array.isArray(e)||(this.gameObject?this.gameObject.animations=e:this._tempAnimationsArray=e)}get animations(){return this.gameObject?.animations||this._tempAnimationsArray||[]}mixer=void 0;get actions(){return this._actions}set actions(e){this._actions=e}_actions;_handles;awake(){this.mixer=void 0,yr&&console.log(`Animation Awake`,this.name,this),this._tempAnimationsArray&&=(this.animations=this._tempAnimationsArray,void 0),this._tempAnimationClipBeforeGameObjectExisted&&=(this.clip=this._tempAnimationClipBeforeGameObjectExisted,null),this.actions=[],this._handles=[]}onEnable(){if(this.playAutomatically&&this.animations?.length>0){let e=Math.floor(Math.random()*this.animations.length),t=this.animations[e];this.play(e,{exclusive:!0,fadeDuration:0,startTime:this.randomStartTime?Math.random()*t.duration:0,loop:this.loop,clampWhenFinished:this.clampWhenFinished})}}update(){this.mixer&&(this.mixer.update(this.context.time.deltaTime),this._handles.forEach(e=>e.update()))}onDisable(){this.mixer&&this.mixer.stopAllAction()}onDestroy(){this.context.animations.unregisterAnimationMixer(this.mixer)}getAction(e){return this.actions?.find(t=>t.getClip().name===e)||null}get isPlaying(){if(this.actions){for(let e=0;e=this.animations.length){yr&&console.log(`No animation at index`,e);return}e=this.animations[e]}else typeof e==`string`&&(e=this.animations.find(t=>t.name===e));if(!e){console.error(`Could not find clip`,e);return}let n=this.actions.find(t=>t.getClip()===e);if(!n){console.error(`Could not find action`,e);return}t?.fadeDuration?n.fadeOut(t.fadeDuration):n.stop()}pause(e,t=!1){if(e===void 0){for(let e of this.actions)e.paused=!t;return}else if(typeof e==`number`){if(e>=this.animations.length){yr&&console.log(`No animation at index`,e);return}e=this.animations[e]}else typeof e==`string`&&(e=this.animations.find(t=>t.name===e));if(!e){console.error(`Could not find clip`,e);return}let n=this.actions.find(t=>t.getClip()===e);if(!n){console.error(`Could not find action`,e);return}n.paused=!t}resume(){for(let e of this.actions)e.paused=!1}play(e=0,t){if(yr&&console.log(`PLAY`,e),this.ensureMixer(),!this.mixer){yr&&console.warn(`Missing mixer`,this);return}e===void 0&&(e=0);let n=e;if(typeof e==`number`){if(e>=this.animations.length){yr&&console.log(`No animation at index`,e);return}n=this.animations[e]}else typeof e==`string`&&(n=this.animations.find(t=>t.name===e));if(!n){console.error(`Could not find clip`,e);return}t||={};for(let e of this.actions)if(e.getClip()===n)return this.internalOnPlay(e,t);if(!n.tracks){console.warn(`Clip is no AnimationClip`,n);return}let r=this.mixer.clipAction(n);return this.actions.push(r),this.internalOnPlay(r,t)}internalOnPlay(e,t){var n=this.actions.find(t=>t===e);if(n===e&&n.isRunning()&&n.time=e.getClip().duration&&(e.time=0);t?.minMaxSpeed?e.timeScale=Rt.lerp(t.minMaxSpeed.x,t.minMaxSpeed.y,Math.random()):e.timeScale=t?.speed??1,t?.loop==null?e.loop=se:e.loop=t.loop?f:se,t?.clampWhenFinished&&(e.clampWhenFinished=!0),e.paused=!1,e.play(),window.requestAnimationFrame(()=>At.testIfRootCanAnimate(e)),yr&&console.log(`PLAY`,e.getClip().name,e);let r=new Sr(e,this.mixer,t,e=>{this._handles.splice(this._handles.indexOf(r),1)});return this._handles.push(r),r.waitForFinish()}tryFindHandle(e){for(let t of this._handles)if(t.action===e)return t}ensureMixer(){if(!this.mixer){let e=`animationMixer`;this.gameObject[e]&&(this.mixer=this.gameObject[e]),(!this.mixer||!this.mixer.clipAction)&&(this.mixer=new me(this.gameObject),this.gameObject[e]=this.mixer)}this.context.animations.registerAnimationMixer(this.mixer)}};vr([E()],xr.prototype,`playAutomatically`,void 0),vr([E()],xr.prototype,`randomStartTime`,void 0),vr([E(br)],xr.prototype,`minMaxSpeed`,void 0),vr([E(br)],xr.prototype,`minMaxOffsetNormalized`,void 0),vr([E()],xr.prototype,`loop`,void 0),vr([E()],xr.prototype,`clampWhenFinished`,void 0),vr([E(we)],xr.prototype,`clips`,null);var Sr=class{mixer;action;promise=null;_options;_resolveCallback=null;_resolvedOrRejectedCallback;constructor(e,t,n,r){this.action=e,this.mixer=t,this._resolvedOrRejectedCallback=r,this._options=n}waitForFinish(){return this.promise?this.promise:(this.promise=new Promise(e=>{this._resolveCallback=e}),this.mixer.addEventListener(`finished`,this.onFinished),this.promise)}update(){this._options&&this._options.endTime!==void 0&&this.action.time>this._options.endTime&&(this._options.loop===!0?this.action.time=this._options.startTime??0:(this.action.time=this._options.endTime,this.action.timeScale=0,this.onResolve()))}onResolve(){this.dispose(),this._resolvedOrRejectedCallback?.call(this,this),this._resolveCallback?.call(this,this.action)}onFinished=e=>{e.action===this.action&&this.onResolve()};dispose(){this.mixer.removeEventListener(`finished`,this.onFinished)}},Cr=class extends N{get listener(){return this._listener??=new De,this._listener}_listener=null;onEnable(){yt.registerWaitForInteraction(this.onInteraction),this.addListenerIfItExists()}onDisable(){yt.unregisterWaitForInteraction(this.onInteraction),this.removeListenerIfItExists()}onInteraction=()=>{this.destroyed||this.listener!=null&&this.addListenerIfItExists()};addListenerIfItExists(){let e=this._listener;if(!e||e?.parent)return;let t=this.context.mainCameraComponent||k.getComponentInParent(this.gameObject,nt);t?.threeCamera?t.threeCamera.add(e):this.gameObject.add(e),e.filter?(e.gain.connect(e.filter),e.filter.connect(e.context.destination)):e.gain.connect(e.context.destination)}removeListenerIfItExists(){let e=this._listener;e&&(e.removeFromParent(),e.filter&&e.filter.disconnect(),e.gain&&e.gain.disconnect())}},wr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},F=D(`debugaudio`),Tr;(function(e){e[e.Logarithmic=0]=`Logarithmic`,e[e.Linear=1]=`Linear`,e[e.Custom=2]=`Custom`})(Tr||={});var I=class e extends N{static get userInteractionRegistered(){return yt.userInteractionRegistered}static registerWaitForAllowAudio(e){yt.registerWaitForInteraction(e)}clip=``;playOnAwake=!1;preload=!0;playInBackground=!0;get isPlaying(){return this.sound?.isPlaying??!1}get duration(){return this.sound?.buffer?.duration}get time01(){let e=this.duration;return e&&this.sound?this.sound?.context.currentTime/e:0}set time01(e){let t=this.duration;t&&this.sound&&(this.time=e*t)}get time(){return this.sound?.source?this.sound.source?.context.currentTime-this._lastContextTime+this.sound.offset:0}set time(e){if(this.sound){if(e===this.sound.offset)return;let t=this.isPlaying;this.stop(),this.sound.offset=e,t&&this.play()}}get loop(){return this.sound&&(this._loop=this.sound.getLoop()),this._loop}set loop(e){this._loop=e,this.sound&&this.sound.setLoop(e)}get spatialBlend(){return this._spatialBlend}set spatialBlend(e){e!==this._spatialBlend&&(this._spatialBlend=e,this._needUpdateSpatialDistanceSettings=!0)}get minDistance(){return this._minDistance}set minDistance(e){this._minDistance!==e&&(this._minDistance=e,this._needUpdateSpatialDistanceSettings=!0)}get maxDistance(){return this._maxDistance}set maxDistance(e){this._maxDistance!==e&&(this._maxDistance=e,this._needUpdateSpatialDistanceSettings=!0)}_spatialBlend=0;_minDistance=1;_maxDistance=100;get volume(){return this._volume}set volume(e){this._volume=e,this.sound&&!this.context.application.muted&&(F&&console.log(this.name,`audio set volume`,e),this.sound.setVolume(e))}_volume=1;set pitch(e){this.sound&&this.sound.setPlaybackRate(e)}get pitch(){return this.sound?this.sound.getPlaybackRate():1}rollOffMode=0;_loop=!1;sound=null;helper=null;wasPlaying=!1;audioLoader=null;shouldPlay=!1;_lastClipStartedLoading=null;_audioElement=null;get Sound(){if(!this.sound&&e.userInteractionRegistered){let e=this.gameObject.getComponent(Cr)??this.context.mainCamera.getComponent(Cr)??Zt(Cr,this.context,!1);!e&&this.context.mainCamera&&(e=this.context.mainCamera.addComponent(Cr)),e?.listener?(this.sound=new ae(e.listener),this.gameObject?.add(this.sound)):F&&console.warn(`No audio listener found in scene - can not play audio`)}return this.sound}get ShouldPlay(){return this.shouldPlay}get audioContext(){return this.sound?.context}awake(){F&&console.log(`[AudioSource]`,this),this.audioLoader=new Be,this.playOnAwake&&(this.shouldPlay=!0),this.preload&&typeof this.clip==`string`&&this.audioLoader.load(this.clip,this.createAudio,()=>{},console.error)}onEnable(){this.sound&&this.gameObject.add(this.sound),e.userInteractionRegistered?this.playOnAwake&&this.context.application.isVisible&&this.play():e.registerWaitForAllowAudio(()=>{this.enabled&&!this.destroyed&&this.shouldPlay&&this.onNewClip(this.clip)}),globalThis.addEventListener(`visibilitychange`,this.onVisibilityChanged),this.context.application.addEventListener(Pt.MuteChanged,this.onApplicationMuteChanged)}onDisable(){globalThis.removeEventListener(`visibilitychange`,this.onVisibilityChanged),this.context.application.removeEventListener(Pt.MuteChanged,this.onApplicationMuteChanged),this.pause()}onVisibilityChanged=()=>{switch(document.visibilityState){case`hidden`:(this.playInBackground===!1||A.isMobileDevice())&&(this.wasPlaying=this.isPlaying,this.isPlaying&&this.pause());break;case`visible`:F&&console.log(`visible`,this.enabled,this.playOnAwake,!this.isPlaying,e.userInteractionRegistered,this.wasPlaying),this.enabled&&this.playOnAwake&&!this.isPlaying&&e.userInteractionRegistered&&this.wasPlaying&&this.play();break}};onApplicationMuteChanged=()=>{this.context.application.muted?this.sound?.setVolume(0):this.sound?.setVolume(this.volume)};createAudio=t=>{if(this.destroyed){F&&console.warn(`AudioSource destroyed, not creating audio`,this.name);return}F&&console.log(`AudioBuffer finished loading`,t);let n=this.Sound;if(!n){F&&console.warn(`Failed getting sound?`,this.name);return}n.isPlaying&&n.stop(),t&&n.setBuffer(t),n.loop=this._loop,this.context.application.muted?n.setVolume(0):n.setVolume(this.volume),n.autoplay=this.shouldPlay&&e.userInteractionRegistered,this.applySpatialDistanceSettings(),n.isPlaying&&n.stop(),e.registerWaitForAllowAudio(this.__onAllowAudioCallback)};__onAllowAudioCallback=()=>{this.shouldPlay&&this.play()};applySpatialDistanceSettings(){let e=this.sound;if(!e)return;this._needUpdateSpatialDistanceSettings=!1;let t=Rt.lerp(10*this._maxDistance/Math.max(1e-4,this.spatialBlend),this._minDistance,this.spatialBlend);switch(F&&console.log(this.name,this._minDistance,this._maxDistance,this.spatialBlend,`Ref distance=`+t),e.setRefDistance(t),e.setMaxDistance(Math.max(.01,this._maxDistance)),this.rollOffMode){case Tr.Logarithmic:e.setDistanceModel(`exponential`);break;case Tr.Linear:e.setDistanceModel(`linear`);break;case Tr.Custom:console.warn(`Custom rolloff for AudioSource is not supported: `+this.name);break}this.spatialBlend>0?F&&!this.helper&&(this.helper=new tr(e,e.getRefDistance()),e.add(this.helper)):this.helper&&this.helper.parent&&this.helper.removeFromParent()}async onNewClip(e){if(e&&(this.clip=e),typeof e==`string`)if(F&&console.log(e),e.endsWith(`.mp3`)||e.endsWith(`.wav`)){if(this.audioLoader||=new Be,this.shouldPlay=!0,this._lastClipStartedLoading===e){F&&console.log(`Is currently loading:`,this._lastClipStartedLoading,this);return}this._lastClipStartedLoading=e,F&&console.log(`load audio`,e);let t=await this.audioLoader.loadAsync(e).catch(console.error);if(this.destroyed)return;this._lastClipStartedLoading===e&&(this._lastClipStartedLoading=null),t&&this.createAudio(t)}else console.warn(`Unsupported audio clip type`,e);else this.shouldPlay=!0,this.createAudio()}play(e=void 0){!e&&this.clip&&(e=this.clip),e!==void 0&&typeof e!=`string`&&!(e instanceof MediaStream)&&(T()&&console.warn(`Called play on AudioSource with unknown argument type:`,e+` Using the assigned clip instead:`,this.clip),e=this.clip);let t=!this.sound||e&&e!==this.clip;if(typeof e==`string`&&!this.audioLoader&&(t=!0),(e instanceof MediaStream||typeof e==`string`)&&(this.clip=e),t){this.shouldPlay=!0,this.onNewClip(e);return}if(this.shouldPlay=!0,this._hasEnded=!1,F&&console.log(`play`,this.sound?.getVolume(),this.sound),this.sound&&!this.sound.isPlaying){let e=this.context.application.muted;e&&this.sound.setVolume(0),this.gameObject?.add(this.sound),this.clip instanceof MediaStream?(this.sound.setMediaStreamSource(this.clip),this._audioElement||(this._audioElement=document.createElement(`audio`),this._audioElement.style.display=`none`),this._audioElement.parentNode||this.context.domElement.shadowRoot?.append(this._audioElement),this._audioElement.srcObject=this.clip,this._audioElement.autoplay=!1):(this._audioElement&&this._audioElement.remove(),this.sound.play(e?.1:0))}}pause(){F&&console.log(`Pause`,this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.isPlaying&&this.sound.source&&(this._lastContextTime=this.sound?.context.currentTime,this.sound.pause()),this._audioElement?.remove()}stop(){F&&console.log(`Pause`,this),this._hasEnded=!0,this.shouldPlay=!1,this.sound&&this.sound.source&&(this._lastContextTime=this.sound?.context.currentTime,F&&console.log(this._lastContextTime),this.sound.stop()),this._audioElement?.remove()}_lastContextTime=0;_hasEnded=!0;_needUpdateSpatialDistanceSettings=!1;update(){this.helper&&(this.isPlaying&&this.helper.update(),this.helper.visible=this.isPlaying),this._needUpdateSpatialDistanceSettings&&this.applySpatialDistanceSettings(),this.sound&&!this.sound.isPlaying&&this.shouldPlay&&!this._hasEnded&&(this._hasEnded=!0,F&&console.log(`Audio clip ended`,this.clip),this.dispatchEvent(new CustomEvent(`ended`,{detail:this})))}};wr([E(URL)],I.prototype,`clip`,void 0),wr([E()],I.prototype,`playOnAwake`,void 0),wr([E()],I.prototype,`preload`,void 0),wr([E()],I.prototype,`playInBackground`,void 0),wr([E()],I.prototype,`loop`,null),wr([E()],I.prototype,`spatialBlend`,null),wr([E()],I.prototype,`minDistance`,null),wr([E()],I.prototype,`maxDistance`,null),wr([E()],I.prototype,`volume`,null),wr([E()],I.prototype,`pitch`,null),wr([E()],I.prototype,`rollOffMode`,void 0);var Er=D(`debugautosync`),Dr=Symbol(`syncerId`),Or=new class{_syncers={};getOrCreateSyncer(e){if(!e.guid)return null;if(this._syncers[e.guid])return this._syncers[e.guid];let t=new kr(e);return t[Dr]=e.guid,this._syncers[t[Dr]]=t,t}removeSyncer(e){delete this._syncers[e[Dr]]}},kr=class{comp;constructor(e){this.comp=e}hasChanges=!1;changedProperties={};get networkingKey(){return this.comp.guid}_isReceiving=!1;_isInit=!1;init(e){if(this._isInit)return;this._isInit=!0,this.comp=e,this.comp.context.post_render_callbacks.push(this.onHandleSending),this.comp.context.connection.beginListen(this.networkingKey,this.onHandleReceiving);let t=this.comp.context.connection.tryGetState(this.comp.guid);t&&this.onHandleReceiving(t)}destroy(){this._isInit&&=(this.comp.context.post_render_callbacks.splice(this.comp.context.post_render_callbacks.indexOf(this.onHandleSending),1),this.comp.context.connection.stopListen(this.networkingKey,this.onHandleReceiving),this.comp=null,!1)}notifyChanged(e,t){this._isReceiving||(Er&&console.log(`Property changed: `+e,t),this.hasChanges=!0,this.changedProperties[e]=t)}onHandleSending=()=>{if(!this.hasChanges)return;this.hasChanges=!1;let e=this.comp.context.connection;if(!e||!e.isConnected||!e.isInRoom){for(let e in this.changedProperties)delete this.changedProperties[e];return}for(let t in this.changedProperties){let n=this.changedProperties[t];Er&&console.log(`SEND`,this.comp.guid,this.networkingKey),e.send(this.networkingKey,{guid:this.comp.guid,property:t,data:n},hn.Queued),delete this.changedProperties[t]}};onHandleReceiving=e=>{if(Er&&console.log(`SYNCFIELD RECEIVE`,this.comp.name,this.comp.guid,e),this._isInit&&this.comp&&e.guid===this.comp.guid)try{this._isReceiving=!0,this.comp[e.property]=e.data}catch(e){console.error(e)}finally{this._isReceiving=!1}}};function Ar(e,t){let n=t!==e;return!n&&e&&t&&(Array.isArray(e)&&Array.isArray(t)||typeof e==`object`&&typeof t==`object`)&&(n=!0),n}var jr=Symbol(`AutoSyncHandler`);function Mr(e){if(e[jr])return e[jr];let t=Or.getOrCreateSyncer(e);return t?.init(e),e[jr]=t,t}function Nr(e){let t=e[jr];t&&(Or.removeSyncer(t),t.destroy(),delete e[jr])}var Pr=function(e=null){return function(t,n){let r=``;r=typeof n==`string`?n:n.name;let i=null,a;typeof e==`string`?a=t[e]:typeof e==`function`&&(a=e),a==null&&(T()||Er)&&e!=null&&console.warn(`syncField: no callback function found for property "`+r+`"`,`"`+e+`"`);let o=t,s=o.__internalAwake;if(typeof s!=`function`){(Er||T())&&console.error(`@syncField can currently only used on Needle Engine Components, custom object of type "`+t?.constructor?.name+`" is not supported`,t);return}Er&&console.log(r);let c=Symbol(r);o.__internalAwake=function(){if(this[c]===void 0){if(this[c]=this[r],i=Or.getOrCreateSyncer(this),Object.getOwnPropertyDescriptor(this,r)?.set===void 0){let e=!1;Object.defineProperty(this,r,{set:function(t){let n=this[c];if(this[c]=t,e){(T()||Er)&&console.warn(`Recursive call detected`,r);return}e=!0;try{let e=Ar(t,n);Er&&console.log(`SyncField assignment`,r,`changed?`,e,t,a),e&&a?.call(this,t,n)!==!1&&Mr(this)?.notifyChanged(r,t)}finally{e=!1}},get:function(){return this[c]},configurable:!0,enumerable:!0})}i?.init(this),s.call(this)}};let l=o.__internalDestroy;o.__internalDestroy=function(){Nr(this),l.call(this)}}},Fr=new Map;function Ir(e,t){if(Fr.has(e))return Fr.get(e);let n=Lr(new URL(e,window.location.href),t);return Fr.set(e,n),n.finally(()=>{Fr.delete(e)}),n}async function Lr(e,t){if(!e)return Promise.resolve(null);let n=e.pathname,r=e.toString().toLowerCase().includes(`pmrem`)||e.searchParams.get(`pmrem`)!=null,i=n.endsWith(`.exr`),a=n.endsWith(`.hdr`),o=n.endsWith(`.ktx2`),s;if(i)s=new lr;else if(a)s=new sr;else if(o){let{ktx2Loader:e}=pr(t);s=e}else s=new pe;let c=e.toString();return await s.loadAsync(c).then(e=>{if(e){let t=n.lastIndexOf(`/`);e.name=n.substring(t>=0?t+1:0),r?e.mapping=306:e.mapping=304,s instanceof pe&&(e.colorSpace=ue)}return e}).catch(t=>(console.warn(`Failed to load texture from url:`,e),null))}var Rr=D(`debugavatar`),zr=class e extends N{static getAvatar(t){return t>=0&&t{this.target&&e&&e.guid===this.avatar?.guid&&Xe(this.target,e.position)})}update(){if((!this.context.connection.isConnected||this._model?.hasOwnership)&&(Br.LastChangeTime!==this._lastPoiChangedTime&&(this._lastPoiChangedTime=Br.LastChangeTime,this._lookDuration=0),this.selectTarget(),this._currentTargetObject&&this.context.time.frameCount%10==0&&this.target)){let e=Yt(this._currentTargetObject);Xe(this.target,e),this.context.connection.isConnected&&this.avatar&&(this.context.connection.send(Vr.TargetChanged,this._targetModel),this._targetModel.guid=this.avatar.guid,this._targetModel.position.copy(e))}}selectTarget(){if(this.context.time.time-this._lastUpdateTime>this._lookDuration){this._lastUpdateTime=this.context.time.time,this._lookDuration=Math.random()*.5+.2;let e=Br.Pois;if(e.length>0){let t=e[Math.floor(Math.random()*e.length)];if(t&&t.obj){if(t.avatar&&t.avatar===this.avatar)return;this._currentTargetObject=t.obj}}}}},L=D(`debugnetworkingstreams`),R;(function(e){e.Connected=`peer-user-connected`,e.StreamReceived=`receive-stream`,e.StreamEnded=`call-ended`,e.Disconnected=`peer-user-disconnected`,e.UserJoined=`user-joined`})(R||={});var Wr=class{type=R.StreamEnded;userId;direction;constructor(e,t){this.userId=e,this.direction=t}},Gr=class{type=R.StreamReceived;userId;stream;target;constructor(e,t,n){this.userId=e,this.stream=t,this.target=n}},Kr=class{guid;peerId;dontSave=!0;constructor(e,t){this.guid=e.id,this.peerId=t}},qr;(function(e){e.Incoming=`incoming`,e.Outgoing=`outgoing`})(qr||={});var Jr=class extends je{peerId;userId;direction;call;get stream(){return this._stream}_stream=null;_isDisposed=!1;close(){this._isDisposed||(this._isDisposed=!0,this.call.close(),Qr(this._stream))}get isOpen(){return this.call.peerConnection?.connectionState===`connected`}get isOpening(){return this.call.peerConnection?.connectionState===`connecting`}get isClosed(){return!this.isOpen||this._isDisposed}constructor(e,t,n,r=null){super(),this.peerId=t.peer,this.userId=e,this.call=t,this.direction=n,this._stream=r,t.on(`stream`,t=>{if(L&&console.log(`Receive stream`,` Audio:`,t.getAudioTracks(),` Video:`,t.getVideoTracks()),this._stream=t,n===qr.Incoming){let n=new Gr(e,t,this);this.dispatchEvent(n)}}),t.on(`close`,()=>{this.dispatchEvent(new Wr(e,n))})}};function Yr(e){return e=e.replace(`a=fmtp:111 minptime=10;useinbandfec=1`,`a=fmtp:111 ptime=5;useinbandfec=1;stereo=1;maxplaybackrate=48000;maxaveragebitrat=128000;sprop-stereo=1`),e}var Xr=class e extends je{static instances=new Map;static getOrCreate(t,n){if(e.instances.has(n))return e.instances.get(n);let r=new e(t,n);return e.instances.set(n,r),r}getMyPeerId(){if(this.context.connection.connectionId)return this.getPeerIdFromUserId(this.context.connection.connectionId)}getPeerIdFromUserId(e){return this.id+`-`+e}getUserIdFromPeerId(e){return e.substring(this.id.length+1)}makeCall(e,t){if(!t?.id){L?console.warn(`Can not make a call: mediastream has no id or is undefined`):console.debug(`Can not make a call: mediastream has no id or is undefined`);return}let n={metadata:{userId:this.context.connection.connectionId,streamId:t.id},sdpTransform:e=>Yr(e)},r=this._peer?.call(e,t,n);if(r){let n=this.registerCall(r,qr.Outgoing,t);return L&&console.warn(`📞 CALL ${e}`,` diff --git a/Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js.gz b/Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js.gz new file mode 100644 index 0000000..2ca7a75 Binary files /dev/null and b/Needle/MenuScene/dist/assets/needle-engine-webxr.BfNO-tft.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js.gz b/Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js.gz deleted file mode 100644 index 9dd6c04..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine-webxr.DDCPc9_g.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js.gz b/Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js.gz deleted file mode 100644 index 8129522..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js b/Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js similarity index 97% rename from Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js rename to Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js index e40687e..6cf132b 100644 --- a/Needle/MenuScene/dist/assets/needle-engine.Bq13_677.js +++ b/Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js @@ -1 +1 @@ -import{$ as ee,$a as te,$i as ne,$n as re,$t as ie,A as ae,Aa as e,Ai as t,An as n,Ao as r,Ar as i,At as a,B as o,Ba as s,Bn as c,Bo as l,Br as u,Bt as d,C as f,Ca as p,Ci as m,Co as h,Ct as g,D as _,Da as v,Di as y,Do as b,Dr as x,E as S,Ea as C,Eo as w,Er as T,Et as E,Fa as D,Fi as O,Fn as k,Fo as A,Fr as j,Ft as M,G as N,Ga as P,Gi as F,Gn as I,Gt as L,H as R,Ha as z,Hi as B,Ho as V,Hr as H,Ht as U,Ia as W,Ii as G,In as K,Io as q,Ir as J,It as oe,J as se,Ja as ce,Ji as le,Jt as ue,K as de,Ka as fe,Ki as pe,Kn as me,Kr as he,L as ge,La as _e,Li as ve,Ln as ye,Lo as be,Lr as xe,Lt as Se,M as Ce,Ma as we,Mi as Te,Mn as Ee,Mo as De,Mr as Oe,Mt as ke,N as Ae,Na as je,Ni as Me,Nn as Ne,No as Pe,Nr as Fe,Nt as Ie,O as Le,Oa as Re,Oi as ze,Oo as Be,Or as Ve,Ot as He,P as Ue,Pa as We,Pi as Ge,Po as Ke,Pr as qe,Pt as Je,Q as Ye,Qa as Xe,Qi as Ze,Qr as Qe,Qt as $e,R as et,Ra as tt,Ri as nt,Rn as rt,Ro as it,Rt as at,S as ot,Sa as st,Si as ct,So as lt,St as ut,T as dt,Ta as ft,Ti as pt,To as mt,Tr as ht,Tt as gt,U as _t,Ua as vt,Ui as yt,Un as bt,Uo as xt,Ur as St,V as Ct,Va as wt,Vi as Tt,Vo as Et,Vr as Dt,Vt as Ot,Wa as kt,Wi as At,Wn as jt,Wo as Y,Wr as Mt,Wt as Nt,X as Pt,Xi as Ft,Xr as It,Xt as Lt,Y as Rt,Ya as X,Yi as zt,Yr as Bt,Z as Vt,Za as Ht,Zi as Ut,Zt as Wt,_ as Gt,_a as Kt,_i as qt,_n as Jt,_o as Yt,_r as Xt,_t as Zt,a as Qt,aa as $t,ai as en,ao as tn,ar as nn,b as rn,ba as an,bi as on,bn as sn,bo as cn,br as ln,bt as un,ca as dn,ci as fn,cn as pn,co as mn,cr as hn,ct as gn,d as _n,da as vn,di as yn,dn as bn,do as xn,dr as Sn,dt as Cn,ea as wn,en as Tn,eo as En,er as Dn,et as On,f as kn,fa as An,fi as jn,fn as Mn,fo as Nn,fr as Pn,ft as Fn,g as In,ga as Ln,gi as Rn,go as zn,gr as Bn,gt as Vn,h as Hn,ha as Un,hi as Wn,hn as Gn,ho as Kn,hr as qn,ht as Jn,i as Yn,ia as Xn,ii as Zn,in as Qn,io as $n,ir as er,it as tr,j as nr,ja as rr,ji as ir,jn as ar,jo as or,jr as sr,jt as cr,k as lr,ka as ur,ki as dr,kn as fr,ko as pr,kr as mr,kt as hr,l as gr,la as _r,li as vr,lo as yr,lr as br,lt as xr,ma as Sr,mi as Cr,mn as wr,mo as Tr,mr as Er,mt as Dr,n as Or,na as kr,nn as Ar,no as jr,nr as Mr,nt as Nr,o as Pr,oa as Fr,oi as Ir,on as Lr,oo as Rr,or as zr,ot as Z,p as Br,pa as Vr,pi as Hr,po as Ur,pr as Wr,pt as Gr,q as Kr,qa as qr,qi as Jr,qn as Yr,r as Xr,ra as Zr,ri as Qr,rn as $r,ro as ei,rr as ti,rt as ni,s as ri,sa as ii,si as ai,sn as oi,so as si,sr as ci,t as li,ta as ui,tn as di,to as fi,tr as pi,tt as mi,u as hi,ua as gi,ui as _i,un as vi,uo as yi,ur as bi,ut as xi,v as Si,va as Ci,vi as wi,vn as Ti,vo as Ei,vr as Di,vt as Oi,w as ki,wa as Ai,wi as ji,wo as Mi,wt as Ni,x as Pi,xa as Fi,xi as Ii,xn as Li,xo as Ri,xt as zi,y as Bi,ya as Vi,yi as Hi,yn as Ui,yo as Wi,yr as Gi,yt as Ki,z as qi,za as Ji,zi as Yi,zn as Xi,zo as Zi,zr as Qi,zt as $i}from"./needle-engine-ui.iRWmt52F.js";import{C as ea,E as ta,S as na,T as ra,_ as ia,a as aa,b as oa,c as sa,d as ca,f as la,g as ua,h as Q,i as da,l as fa,m as pa,n as ma,o as ha,p as ga,r as _a,s as va,u as ya,v as ba,w as xa,x as Sa,y as Ca}from"./needle-engine@5.0.3.js";import{n as wa}from"./gltf-progressive.BBJGcb3s.js";import{$ as Ta,A as Ea,At as Da,B as Oa,Bt as ka,C as Aa,Ct as ja,Dt as Ma,Et as Na,F as Pa,G as Fa,Gt as Ia,H as La,Ht as Ra,I as za,It as Ba,J as Va,Jt as Ha,K as Ua,Kt as Wa,L as Ga,Lt as Ka,M as qa,Mt as Ja,N as Ya,Ot as Xa,P as Za,Pt as Qa,Q as $a,Qt as eo,R as to,Rt as no,S as ro,St as io,Tt as ao,U as oo,Ut as so,V as co,Vt as lo,W as uo,Wt as fo,X as po,Xt as mo,Y as ho,Yt as go,Z as _o,Zt as vo,_ as yo,a as bo,an as xo,at as So,b as Co,bt as wo,c as To,cn as Eo,ct as Do,d as Oo,dn as ko,dt as Ao,en as jo,et as Mo,f as No,fn as Po,ft as Fo,g as Io,gt as Lo,h as Ro,hn as zo,ht as Bo,i as Vo,in as Ho,it as Uo,j as Wo,jt as Go,k as Ko,kt as qo,l as Jo,ln as Yo,lt as Xo,m as Zo,mn as Qo,mt as $o,n as es,nn as ts,nt as ns,o as rs,on as is,ot as as,p as os,pn as ss,pt as cs,q as ls,qt as us,r as ds,rn as fs,rt as ps,s as ms,sn as hs,t as gs,tn as _s,tt as vs,u as ys,un as bs,ut as xs,v as Ss,vt as Cs,w as ws,wt as Ts,x as Es,xt as Ds,y as Os,yt as ks,z as As}from"./needle-engine-webxr.DDCPc9_g.js";import{$ as js,A as Ms,At as Ns,B as Ps,C as Fs,Ct as Is,D as Ls,Dt as Rs,E as zs,Et as Bs,F as Vs,G as Hs,I as Us,J as Ws,K as Gs,L as Ks,M as qs,Mt as Js,N as Ys,Nt as Xs,O as Zs,Ot as Qs,P as $s,R as ec,S as tc,St as nc,T as rc,Tt as ic,X as ac,Y as oc,Z as sc,_ as cc,a as lc,at as uc,b as dc,bt as fc,c as pc,ct as mc,d as hc,dt as gc,et as _c,f as vc,ft as yc,g as bc,gt as xc,h as Sc,ht as Cc,i as wc,it as Tc,j as Ec,jt as Dc,k as Oc,kt as kc,l as Ac,lt as jc,m as Mc,mt as Nc,n as Pc,nt as Fc,o as Ic,ot as Lc,p as Rc,pt as zc,q as Bc,r as Vc,rt as Hc,s as Uc,st as Wc,tt as Gc,u as Kc,ut as qc,v as Jc,vt as Yc,w as Xc,wt as Zc,x as Qc,xt as $c,y as el,z as tl}from"./needle-engine.extras.D0CNgtSQ.js";import{C as nl,D as rl,E as il,S as al,T as ol,_ as sl,a as cl,b as ll,c as ul,d as dl,f as fl,g as pl,h as ml,i as hl,l as gl,m as _l,n as vl,o as yl,p as bl,r as xl,s as Sl,t as Cl,u as wl,v as Tl,w as El,x as Dl,y as Ol}from"./needle-engine-particles.B21Zru40.js";import{_ as kl,a as Al,b as jl,c as Ml,d as Nl,f as Pl,g as Fl,h as Il,i as Ll,l as Rl,m as zl,n as Bl,o as Vl,p as Hl,r as Ul,s as Wl,t as $,u as Gl,v as Kl,y as ql}from"./needle-engine.extras.D-PG1GOa.js";export{dr as $componentName,t as $physicsKey,vs as ActionBuilder,Ks as ActionCollection,ns as ActionModel,Qi as Addressables,Cc as AlignmentConstraint,jt as AmbientMode,Qo as Animation,il as AnimationCurve,$a as AnimationExtension,nc as AnimationTrackHandler,Ze as AnimationUtils,Ye as Animator,On as AnimatorConditionMode,ee as AnimatorController,mi as AnimatorControllerParameterType,Nr as AnimatorStateInfo,Il as Antialiasing,xe as Application,Lt as AssetDatabase,u as AssetReference,zs as Attractor,_o as AudioExtension,ss as AudioListener,Po as AudioSource,Is as AudioTrackHandler,Ko as Avatar,Wa as AvatarBlink_Simple,Ia as AvatarEyeLook_Rotation,aa as AvatarLoader,Yo as AvatarMarker,ha as AvatarModel,hs as Avatar_Brain_LookAt,vo as Avatar_MouthShapes,mo as Avatar_MustacheShake,Eo as Avatar_POI,o as Axes,Nc as AxesHelper,B as BUILD_TIME,Pi as BaseUIComponent,zc as BasicIKConstraint,Co as BehaviorExtension,ps as BehaviorModel,Z as Behaviour,Z as Component,Wn as BlobStorage,zl as BloomEffect,ka as BoxCollider,No as BoxGizmo,yc as BoxHelperComponent,Xr as Button,fr as ButtonsFactory,jo as CallDirection,Rt as CallInfo,f as Camera,dt as CameraTargetReachedEvent,ri as Canvas,Pr as CanvasGroup,lo as CapsuleCollider,Oa as ChangeMaterialOnClick,co as ChangeTransformOnClick,qc as CharacterController,gc as CharacterControllerInput,Hl as ChromaticAberration,te as CircularBuffer,ki as ClearFlags,Ic as ClickThrough,Qs as ClipExtrapolation,Ra as Collider,ir as Collision,Ct as CollisionDetectionMode,Nl as ColorAdjustments,yl as ColorBySpeedModule,Sl as ColorOverLifetimeModule,zt as ComponentLifecycleEvents,Mr as ConnectionEvents,Te as ContactPoint,no as ContactShadows,Jt as Context,Ti as ContextArgs,xt as ContextEvent,Y as ContextRegistry,Y as NeedleEngine,Zc as ControlTrackHandler,lc as CursorFollow,os as CustomBranding,Go as CustomShader,I as DefaultReflectionMode,uc as Deletable,Lc as DeleteBox,Gl as DepthOfField,Tc as DeviceFlag,En as DeviceUtilities,da as DocumentExtension,Fc as DragControls,Hc as DragMode,Bc as DropListener,Gs as Duplicatable,Rl as EffectWrapper,ul as EmissionModule,La as EmphasizeOnClick,ca as EngineLoadingView,fc as EnvironmentScene,Pt as EventList,Vt as EventListEvent,_ as EventSystem,Hs as EventTrigger,Cs as FieldWithDefault,Dt as FileReference,H as FileReferenceSerializer,js as FileSpawnModel,_c as File_Event,Ys as FixedJoint,Us as Fog,Ui as FrameEvent,yt as GENERATOR,gn as GameObject,vi as Gizmos,tl as GltfExport,Ps as GltfExportBox,gl as Gradient,Hn as Graphic,lr as GraphicRaycaster,$t as Graphics,Vs as GridHelper,gr as GridLayoutGroup,Kr as GroundProjectedEnv,Uo as GroupActionModel,Me as HideFlags,oo as HideOnStart,$s as HingeJoint,hi as HorizontalLayoutGroup,Qr as HostData,wc as HoverAnimation,Yn as Image,St as ImageReference,Mt as ImageReferenceSerializer,wl as InheritVelocityModule,ht as Input,T as InputEventQueue,x as InputEvents,Or as InputField,ja as InstanceHandle,Ts as InstancingHandler,ue as InstancingUtil,Zn as InstantiateEvent,en as InstantiateIdProvider,He as InstantiateOptions,Wc as Interactable,ms as InternalScreenshotUtils,ti as JoinedRoomResponse,Ve as KeyEventArgs,rl as Keyframe,Ms as LODGroup,Ec as LODModel,er as LeftRoomResponse,qs as Light,me as LightData,dl as LimitVelocityOverLifetimeModule,la as LoadingElementOptions,jc as LogStats,ce as LogType,pc as LookAt,N as LookAtConstraint,fl as MainModule,ic as MarkerTrackHandler,kc as MarkerType,In as MaskableGraphic,Ka as MaterialPropertyBlock,Ja as MaterialX,vt as Mathf,so as MeshCollider,ks as MeshRenderer,bl as MinMaxCurve,_l as MinMaxGradient,Tt as NEEDLE_ENGINE_FEATURE_FLAGS,Bn as NEEDLE_ENGINE_MODULES,wa as NEEDLE_progressive,mr as NEKeyboardEvent,i as NEPointerEvent,pa as NeedleButtonElement,sc as NeedleEngineModelLoader,ya as NeedleEngineWebComponent,Ea as NeedleMenu,ve as NeedlePatchesKey,Ao as NeedleUSDZExporter,Gn as NeedleXRController,Mn as NeedleXRSession,wr as NeedleXRSync,zo as NeedleXRUtils,Oc as NestedGltf,nn as NetworkConnection,_s as NetworkedStreamEvents,ts as NetworkedStreams,Zs as Networking,Ir as NewInstanceModel,ml as NoiseModule,ae as ObjectRaycaster,Oe as ObjectUtils,Ls as OffsetConstraint,kt as OneEuroFilter,P as OneEuroFilterXYZ,Uc as OpenURL,S as OrbitControls,Gt as Outline,zr as OwnershipEvent,ci as OwnershipModel,At as PUBLIC_KEY,_n as Padding,pl as ParticleBurst,cl as ParticleSubEmitter,Cl as ParticleSystem,vl as ParticleSystemBaseBehaviour,xl as ParticleSystemRenderer,sl as ParticleSystemShapeType,fs as PeerHandle,Pn as PeerNetworking,Lr as Physics,Os as PhysicsExtension,R as PhysicsMaterialCombine,Ml as PixelationEffect,uo as PlayAnimationOnClick,Fa as PlayAudioOnClick,$c as PlayableDirector,rc as PlayerColor,Wo as PlayerState,qa as PlayerStateEvent,Ya as PlayerSync,re as PlayerView,Dn as PlayerViewManager,Ce as PointerEventData,sr as PointerType,Kl as PostProcessingEffect,jl as PostProcessingEffectOrder,Bl as PostProcessingHandler,$ as PostProcessingManager,$ as Volume,Ua as PreliminaryAction,ls as PreliminaryTrigger,Gc as PreviewHelper,Fe as PrimitiveType,Bo as Progress,fi as PromiseAllWithErrors,jr as PromiseErrorResult,bn as RGBAColor,fa as RapierPhysics,Qt as RawImage,oi as RaycastOptions,Si as Rect,Bi as RectTransform,Ba as ReflectionProbe,Ta as RegisteredAnimationInfo,xc as RemoteSkybox,se as RenderTexture,ba as RenderTextureSerializer,wo as Renderer,Yr as RendererData,io as RendererLightmap,ge as Rigidbody,_t as RigidbodyConstraints,hn as RoomEvents,Tl as RotationBySpeedModule,Ol as RotationOverLifetimeModule,Qa as SceneLightSettings,Yc as SceneSwitcher,Fs as ScreenCapture,Wl as ScreenSpaceAmbientOcclusion,Vl as ScreenSpaceAmbientOcclusionN8,Vc as ScrollFollow,tc as SeeThrough,Cr as SendQueue,he as SerializationContext,Va as SetActiveOnClick,Qc as ShadowCatcher,ll as ShapeModule,Ge as ShapeOverlapResult,Al as SharpeningEffect,Dc as SignalAsset,Js as SignalReceiver,Xs as SignalReceiverEvent,Bs as SignalTrackHandler,rn as Size,Dl as SizeBySpeedModule,al as SizeOverLifetimeModule,Ds as SkinnedMeshRenderer,dc as SmoothFollow,nr as SpatialGrabRaycaster,li as SpatialHtml,Jc as SpatialTrigger,el as SpatialTriggerReceiver,cc as SpectatorCamera,fo as SphereCollider,pn as SphereIntersection,Sc as SplineContainer,bc as SplineData,ma as SplineUtils,Mc as SplineWalker,Pa as Sprite,za as SpriteData,Ga as SpriteRenderer,to as SpriteSheet,ni as StateMachineBehaviour,Ho as StreamEndedEvent,xo as StreamReceivedEvent,hl as SubEmitterSystem,Rc as SyncedCamera,vc as SyncedRoom,Ue as SyncedTransform,ho as TapGestureTrigger,Aa as TeleportTarget,Kc as TestRunner,hc as TestSimulateUserData,Br as Text,Io as TextBuilder,yo as TextExtension,nl as TextureSheetAnimationModule,Ll as TiltShiftEffect,bt as Time,Pl as ToneMappingEffect,Rs as TrackHandler,Ns as TrackType,El as TrailModule,Mo as TransformData,Ac as TransformGizmo,So as TriggerBuilder,as as TriggerModel,ne as TypeStore,Le as UIRaycastUtils,ot as UIRootComponent,Do as USDDocument,Xo as USDObject,xs as USDWriter,Zo as USDZExporter,Ss as USDZText,Ro as USDZUIExtension,Ca as UriSerializer,mc as UsageMarker,br as UserJoinedOrLeftRoomModel,F as VERSION,ec as VariantAction,ol as VelocityOverLifetimeModule,kn as VerticalLayoutGroup,Xc as VideoPlayer,Pc as ViewBox,pi as ViewDevice,Ul as Vignette,po as VisibilityAction,eo as Voip,ql as VolumeParameter,Fl as VolumeProfile,qe as WaitForFrames,j as WaitForPromise,J as WaitForSeconds,ei as Watch,rs as WebARCameraBackground,Za as WebARSessionRoot,Es as WebXR,As as WebXRButtonFactory,ds as WebXRImageTracking,Vo as WebXRImageTrackingModel,es as WebXRPlaneTracking,bo as WebXRTrackedImage,Oo as XRControllerFollow,ws as XRControllerModel,ro as XRControllerMovement,us as XRFlag,gs as XRRig,Ha as XRState,go as XRStateFlag,_a as __Ignore,Wt as __internalNotifyObjectDestroyed,pe as activeInHierarchyFieldName,$n as addAttributeChangeCallback,Dr as addComponent,ao as addCustomExtensionPlugin,Jn as addNewComponent,nt as addPatch,U as apply,xr as applyHMRChanges,Nt as applyPrototypeExtensions,ai as beginListenDestroy,fn as beginListenInstantiate,Xt as binaryIdentifierCasts,sn as build_scene_functions,Jr as builtinComponentKeyName,ga as calculateProgress01,X as clearBalloonMessages,X as clearOverlayMessages,oa as colorSerializer,Qe as compareAssociation,Sa as componentSerializer,Fr as copyTexture,tr as createMotion,bi as debugNet,Sn as debugOwner,Fo as decompressGpuTexture,tn as deepClone,Rr as delay,si as delayForFrames,Bt as deserializeObject,hr as destroy,Vn as destroyComponentInstance,Ws as determineMimeTypeFromExtension,$e as disposeObjectResources,is as disposeStream,le as editorGuidKeyName,Xn as enableSpatialConsole,na as euler,ea as eventListSerializer,va as exportAsGLTF,a as findByGuid,Zt as findObjectOfType,Oi as findObjectsOfType,ie as findResourceUsers,de as fitCamera,ii as fitObjectIntoVolume,cr as foreachComponent,ke as foreachComponentEnumerator,dn as forward,Ne as generateQRCode,vr as generateSeed,_r as getBoundingBox,Ji as getCameraController,Ki as getComponent,un as getComponentInChildren,zi as getComponentInParent,ut as getComponents,g as getComponentsInChildren,Ni as getComponentsInParent,Lo as getFormattedDate,n as getIconElement,ar as getIconTexture,y as getLoader,gt as getOrAddComponent,mn as getParam,gi as getParentHierarchyPath,yr as getPath,Wr as getPeerOptions,Er as getPeerjsInstance,Tn as getResourceUserCount,vn as getTempColor,An as getTempQuaternion,Vr as getTempVector,yi as getUrlParams,Sr as getVisibleInCustomShadowRendering,Un as getWorldDirection,Ln as getWorldEuler,Kt as getWorldPosition,Ci as getWorldQuaternion,Vi as getWorldRotation,an as getWorldScale,Rn as hasCommercialLicense,qt as hasIndieLicense,Ae as hasPointerEventComponent,wi as hasProLicense,ra as hideDebugConsole,cs as imageToCanvas,Ie as instantiate,Na as invokeLoadedImportPluginHooks,k as invokeXRSessionEnd,K as invokeXRSessionStart,Je as isActiveInHierarchy,M as isActiveSelf,xn as isAndroidDevice,Fi as isAnimationAction,O as isComponent,Nn as isDebugMode,Ur as isDesktop,oe as isDestroyed,fe as isDevEnvironment,di as isDisposed,sa as isExporting,G as isGLTFModel,Et as isHostedOnGlitch,xi as isHotReloadEnabled,Cn as isHotReloading,Tr as isIPad,Ee as isIconElement,V as isLocalNetwork,Kn as isMacOS,zn as isMobileDevice,Yt as isMozillaXR,Ei as isQuest,Ar as isResourceTrackingEnabled,Wi as isSafari,Se as isUsingInstancing,cn as isiOS,Ri as isiPad,Q as loadAsset,bs as loadPMREM,ua as loadSync,st as logHierarchy,p as lookAtInverse,Ai as lookAtObject,ft as lookAtScreenPoint,lt as makeId,h as makeIdFromRandomWords,$o as makeNameSafeForUSD,at as markAsInstancedRendered,Mi as microphonePermissionsGranted,mt as nameof,w as nameofFactory,xa as objectSerializer,ye as offXRSessionEnd,rt as offXRSessionStart,Hi as onAfterRender,on as onBeforeRender,Ii as onClear,ct as onDestroy,m as onInitialized,ji as onStart,pt as onUpdate,Xi as onXRSessionEnd,c as onXRSessionStart,ia as parseSync,C as placeOnSurface,v as postprocessFBXMaterials,et as prefix,b as pushState,Be as randomNumber,Di as registerBinaryType,Li as registerComponent,Ma as registerComponentExtension,kl as registerCustomEffectType,Xa as registerExportExtensions,qo as registerExtensions,Fn as registerHotReloadType,ze as registerLoader,_i as registerPrefabProvider,L as registerPrototypeExtensions,wn as registerType,pr as relativePathPrefix,r as removeAttributeChangeCallback,E as removeComponent,Da as removeCustomImportExtensionType,Yi as removePatch,or as resolveUrl,De as sanitizeString,To as saveImage,Jo as screenshot,ys as screenshot2,yn as sendDestroyed,Ft as serializable,It as serializeObject,Ut as serializeable,$i as setActive,Ht as setAllowBalloonMessages,Xe as setAllowOverlayMessages,s as setAutoFitEnabled,wt as setCameraController,d as setDestroyed,qr as setDevEnvironment,$r as setDisposable,Ot as setDontDestroy,Pe as setOrAddParamsToUrl,Ke as setParam,A as setParamWithoutReload,qn as setPeerOptions,Qn as setResourceTrackingEnabled,q as setState,Re as setVisibleInCustomShadowRendering,ur as setWorldEuler,e as setWorldPosition,rr as setWorldPositionXYZ,we as setWorldQuaternion,je as setWorldQuaternionXYZW,We as setWorldRotation,D as setWorldRotationXYZ,W as setWorldScale,ui as showBalloonError,kr as showBalloonMessage,Zr as showBalloonWarning,ta as showDebugConsole,_e as slerp,jn as syncDestroy,ko as syncField,Hr as syncInstantiate,tt as textureToCanvas,be as toSourceId,Gi as tryCastBinary,oc as tryDetermineMimetypeFromBinary,ac as tryDetermineMimetypeFromURL,it as tryFindObject,ln as tryGetGuid,Gr as unregisterHotReloadType,Zi as unwatchWrite,z as useForAutoFit,qi as validate,l as watchWrite}; \ No newline at end of file +import{$ as ee,$a as te,$i as ne,$n as re,$t as ie,A as ae,Aa as e,Ai as t,An as n,Ao as r,Ar as i,At as a,B as o,Ba as s,Bn as c,Bo as l,Br as u,Bt as d,C as f,Ca as p,Ci as m,Co as h,Ct as g,D as _,Da as v,Di as y,Do as b,Dr as x,E as S,Ea as C,Eo as w,Er as T,Et as E,Fa as D,Fi as O,Fn as k,Fo as A,Fr as j,Ft as M,G as N,Ga as P,Gi as F,Gn as I,Gt as L,H as R,Ha as z,Hi as B,Ho as V,Hr as H,Ht as U,Ia as W,Ii as G,In as K,Io as q,Ir as J,It as oe,J as se,Ja as ce,Ji as le,Jt as ue,K as de,Ka as fe,Ki as pe,Kn as me,Kr as he,L as ge,La as _e,Li as ve,Ln as ye,Lo as be,Lr as xe,Lt as Se,M as Ce,Ma as we,Mi as Te,Mn as Ee,Mo as De,Mr as Oe,Mt as ke,N as Ae,Na as je,Ni as Me,Nn as Ne,No as Pe,Nr as Fe,Nt as Ie,O as Le,Oa as Re,Oi as ze,Oo as Be,Or as Ve,Ot as He,P as Ue,Pa as We,Pi as Ge,Po as Ke,Pr as qe,Pt as Je,Q as Ye,Qa as Xe,Qi as Ze,Qr as Qe,Qt as $e,R as et,Ra as tt,Ri as nt,Rn as rt,Ro as it,Rt as at,S as ot,Sa as st,Si as ct,So as lt,St as ut,T as dt,Ta as ft,Ti as pt,To as mt,Tr as ht,Tt as gt,U as _t,Ua as vt,Ui as yt,Un as bt,Uo as xt,Ur as St,V as Ct,Va as wt,Vi as Tt,Vo as Et,Vr as Dt,Vt as Ot,Wa as kt,Wi as At,Wn as jt,Wo as Y,Wr as Mt,Wt as Nt,X as Pt,Xi as Ft,Xr as It,Xt as Lt,Y as Rt,Ya as X,Yi as zt,Yr as Bt,Z as Vt,Za as Ht,Zi as Ut,Zt as Wt,_ as Gt,_a as Kt,_i as qt,_n as Jt,_o as Yt,_r as Xt,_t as Zt,a as Qt,aa as $t,ai as en,ao as tn,ar as nn,b as rn,ba as an,bi as on,bn as sn,bo as cn,br as ln,bt as un,ca as dn,ci as fn,cn as pn,co as mn,cr as hn,ct as gn,d as _n,da as vn,di as yn,dn as bn,do as xn,dr as Sn,dt as Cn,ea as wn,en as Tn,eo as En,er as Dn,et as On,f as kn,fa as An,fi as jn,fn as Mn,fo as Nn,fr as Pn,ft as Fn,g as In,ga as Ln,gi as Rn,go as zn,gr as Bn,gt as Vn,h as Hn,ha as Un,hi as Wn,hn as Gn,ho as Kn,hr as qn,ht as Jn,i as Yn,ia as Xn,ii as Zn,in as Qn,io as $n,ir as er,it as tr,j as nr,ja as rr,ji as ir,jn as ar,jo as or,jr as sr,jt as cr,k as lr,ka as ur,ki as dr,kn as fr,ko as pr,kr as mr,kt as hr,l as gr,la as _r,li as vr,lo as yr,lr as br,lt as xr,ma as Sr,mi as Cr,mn as wr,mo as Tr,mr as Er,mt as Dr,n as Or,na as kr,nn as Ar,no as jr,nr as Mr,nt as Nr,o as Pr,oa as Fr,oi as Ir,on as Lr,oo as Rr,or as zr,ot as Z,p as Br,pa as Vr,pi as Hr,po as Ur,pr as Wr,pt as Gr,q as Kr,qa as qr,qi as Jr,qn as Yr,r as Xr,ra as Zr,ri as Qr,rn as $r,ro as ei,rr as ti,rt as ni,s as ri,sa as ii,si as ai,sn as oi,so as si,sr as ci,t as li,ta as ui,tn as di,to as fi,tr as pi,tt as mi,u as hi,ua as gi,ui as _i,un as vi,uo as yi,ur as bi,ut as xi,v as Si,va as Ci,vi as wi,vn as Ti,vo as Ei,vr as Di,vt as Oi,w as ki,wa as Ai,wi as ji,wo as Mi,wt as Ni,x as Pi,xa as Fi,xi as Ii,xn as Li,xo as Ri,xt as zi,y as Bi,ya as Vi,yi as Hi,yn as Ui,yo as Wi,yr as Gi,yt as Ki,z as qi,za as Ji,zi as Yi,zn as Xi,zo as Zi,zr as Qi,zt as $i}from"./needle-engine-ui.i2hfjKja.js";import{C as ea,E as ta,S as na,T as ra,_ as ia,a as aa,b as oa,c as sa,d as ca,f as la,g as ua,h as Q,i as da,l as fa,m as pa,n as ma,o as ha,p as ga,r as _a,s as va,u as ya,v as ba,w as xa,x as Sa,y as Ca}from"./needle-engine@5.0.3.js";import{n as wa}from"./gltf-progressive.BBJGcb3s.js";import{$ as Ta,A as Ea,At as Da,B as Oa,Bt as ka,C as Aa,Ct as ja,Dt as Ma,Et as Na,F as Pa,G as Fa,Gt as Ia,H as La,Ht as Ra,I as za,It as Ba,J as Va,Jt as Ha,K as Ua,Kt as Wa,L as Ga,Lt as Ka,M as qa,Mt as Ja,N as Ya,Ot as Xa,P as Za,Pt as Qa,Q as $a,Qt as eo,R as to,Rt as no,S as ro,St as io,Tt as ao,U as oo,Ut as so,V as co,Vt as lo,W as uo,Wt as fo,X as po,Xt as mo,Y as ho,Yt as go,Z as _o,Zt as vo,_ as yo,a as bo,an as xo,at as So,b as Co,bt as wo,c as To,cn as Eo,ct as Do,d as Oo,dn as ko,dt as Ao,en as jo,et as Mo,f as No,fn as Po,ft as Fo,g as Io,gt as Lo,h as Ro,hn as zo,ht as Bo,i as Vo,in as Ho,it as Uo,j as Wo,jt as Go,k as Ko,kt as qo,l as Jo,ln as Yo,lt as Xo,m as Zo,mn as Qo,mt as $o,n as es,nn as ts,nt as ns,o as rs,on as is,ot as as,p as os,pn as ss,pt as cs,q as ls,qt as us,r as ds,rn as fs,rt as ps,s as ms,sn as hs,t as gs,tn as _s,tt as vs,u as ys,un as bs,ut as xs,v as Ss,vt as Cs,w as ws,wt as Ts,x as Es,xt as Ds,y as Os,yt as ks,z as As}from"./needle-engine-webxr.BfNO-tft.js";import{$ as js,A as Ms,At as Ns,B as Ps,C as Fs,Ct as Is,D as Ls,Dt as Rs,E as zs,Et as Bs,F as Vs,G as Hs,I as Us,J as Ws,K as Gs,L as Ks,M as qs,Mt as Js,N as Ys,Nt as Xs,O as Zs,Ot as Qs,P as $s,R as ec,S as tc,St as nc,T as rc,Tt as ic,X as ac,Y as oc,Z as sc,_ as cc,a as lc,at as uc,b as dc,bt as fc,c as pc,ct as mc,d as hc,dt as gc,et as _c,f as vc,ft as yc,g as bc,gt as xc,h as Sc,ht as Cc,i as wc,it as Tc,j as Ec,jt as Dc,k as Oc,kt as kc,l as Ac,lt as jc,m as Mc,mt as Nc,n as Pc,nt as Fc,o as Ic,ot as Lc,p as Rc,pt as zc,q as Bc,r as Vc,rt as Hc,s as Uc,st as Wc,tt as Gc,u as Kc,ut as qc,v as Jc,vt as Yc,w as Xc,wt as Zc,x as Qc,xt as $c,y as el,z as tl}from"./needle-engine.extras.CWxm8YHB.js";import{C as nl,D as rl,E as il,S as al,T as ol,_ as sl,a as cl,b as ll,c as ul,d as dl,f as fl,g as pl,h as ml,i as hl,l as gl,m as _l,n as vl,o as yl,p as bl,r as xl,s as Sl,t as Cl,u as wl,v as Tl,w as El,x as Dl,y as Ol}from"./needle-engine-particles.Bz_Ei_ja.js";import{_ as kl,a as Al,b as jl,c as Ml,d as Nl,f as Pl,g as Fl,h as Il,i as Ll,l as Rl,m as zl,n as Bl,o as Vl,p as Hl,r as Ul,s as Wl,t as $,u as Gl,v as Kl,y as ql}from"./needle-engine.extras.1SuflpgE.js";export{dr as $componentName,t as $physicsKey,vs as ActionBuilder,Ks as ActionCollection,ns as ActionModel,Qi as Addressables,Cc as AlignmentConstraint,jt as AmbientMode,Qo as Animation,il as AnimationCurve,$a as AnimationExtension,nc as AnimationTrackHandler,Ze as AnimationUtils,Ye as Animator,On as AnimatorConditionMode,ee as AnimatorController,mi as AnimatorControllerParameterType,Nr as AnimatorStateInfo,Il as Antialiasing,xe as Application,Lt as AssetDatabase,u as AssetReference,zs as Attractor,_o as AudioExtension,ss as AudioListener,Po as AudioSource,Is as AudioTrackHandler,Ko as Avatar,Wa as AvatarBlink_Simple,Ia as AvatarEyeLook_Rotation,aa as AvatarLoader,Yo as AvatarMarker,ha as AvatarModel,hs as Avatar_Brain_LookAt,vo as Avatar_MouthShapes,mo as Avatar_MustacheShake,Eo as Avatar_POI,o as Axes,Nc as AxesHelper,B as BUILD_TIME,Pi as BaseUIComponent,zc as BasicIKConstraint,Co as BehaviorExtension,ps as BehaviorModel,Z as Behaviour,Z as Component,Wn as BlobStorage,zl as BloomEffect,ka as BoxCollider,No as BoxGizmo,yc as BoxHelperComponent,Xr as Button,fr as ButtonsFactory,jo as CallDirection,Rt as CallInfo,f as Camera,dt as CameraTargetReachedEvent,ri as Canvas,Pr as CanvasGroup,lo as CapsuleCollider,Oa as ChangeMaterialOnClick,co as ChangeTransformOnClick,qc as CharacterController,gc as CharacterControllerInput,Hl as ChromaticAberration,te as CircularBuffer,ki as ClearFlags,Ic as ClickThrough,Qs as ClipExtrapolation,Ra as Collider,ir as Collision,Ct as CollisionDetectionMode,Nl as ColorAdjustments,yl as ColorBySpeedModule,Sl as ColorOverLifetimeModule,zt as ComponentLifecycleEvents,Mr as ConnectionEvents,Te as ContactPoint,no as ContactShadows,Jt as Context,Ti as ContextArgs,xt as ContextEvent,Y as ContextRegistry,Y as NeedleEngine,Zc as ControlTrackHandler,lc as CursorFollow,os as CustomBranding,Go as CustomShader,I as DefaultReflectionMode,uc as Deletable,Lc as DeleteBox,Gl as DepthOfField,Tc as DeviceFlag,En as DeviceUtilities,da as DocumentExtension,Fc as DragControls,Hc as DragMode,Bc as DropListener,Gs as Duplicatable,Rl as EffectWrapper,ul as EmissionModule,La as EmphasizeOnClick,ca as EngineLoadingView,fc as EnvironmentScene,Pt as EventList,Vt as EventListEvent,_ as EventSystem,Hs as EventTrigger,Cs as FieldWithDefault,Dt as FileReference,H as FileReferenceSerializer,js as FileSpawnModel,_c as File_Event,Ys as FixedJoint,Us as Fog,Ui as FrameEvent,yt as GENERATOR,gn as GameObject,vi as Gizmos,tl as GltfExport,Ps as GltfExportBox,gl as Gradient,Hn as Graphic,lr as GraphicRaycaster,$t as Graphics,Vs as GridHelper,gr as GridLayoutGroup,Kr as GroundProjectedEnv,Uo as GroupActionModel,Me as HideFlags,oo as HideOnStart,$s as HingeJoint,hi as HorizontalLayoutGroup,Qr as HostData,wc as HoverAnimation,Yn as Image,St as ImageReference,Mt as ImageReferenceSerializer,wl as InheritVelocityModule,ht as Input,T as InputEventQueue,x as InputEvents,Or as InputField,ja as InstanceHandle,Ts as InstancingHandler,ue as InstancingUtil,Zn as InstantiateEvent,en as InstantiateIdProvider,He as InstantiateOptions,Wc as Interactable,ms as InternalScreenshotUtils,ti as JoinedRoomResponse,Ve as KeyEventArgs,rl as Keyframe,Ms as LODGroup,Ec as LODModel,er as LeftRoomResponse,qs as Light,me as LightData,dl as LimitVelocityOverLifetimeModule,la as LoadingElementOptions,jc as LogStats,ce as LogType,pc as LookAt,N as LookAtConstraint,fl as MainModule,ic as MarkerTrackHandler,kc as MarkerType,In as MaskableGraphic,Ka as MaterialPropertyBlock,Ja as MaterialX,vt as Mathf,so as MeshCollider,ks as MeshRenderer,bl as MinMaxCurve,_l as MinMaxGradient,Tt as NEEDLE_ENGINE_FEATURE_FLAGS,Bn as NEEDLE_ENGINE_MODULES,wa as NEEDLE_progressive,mr as NEKeyboardEvent,i as NEPointerEvent,pa as NeedleButtonElement,sc as NeedleEngineModelLoader,ya as NeedleEngineWebComponent,Ea as NeedleMenu,ve as NeedlePatchesKey,Ao as NeedleUSDZExporter,Gn as NeedleXRController,Mn as NeedleXRSession,wr as NeedleXRSync,zo as NeedleXRUtils,Oc as NestedGltf,nn as NetworkConnection,_s as NetworkedStreamEvents,ts as NetworkedStreams,Zs as Networking,Ir as NewInstanceModel,ml as NoiseModule,ae as ObjectRaycaster,Oe as ObjectUtils,Ls as OffsetConstraint,kt as OneEuroFilter,P as OneEuroFilterXYZ,Uc as OpenURL,S as OrbitControls,Gt as Outline,zr as OwnershipEvent,ci as OwnershipModel,At as PUBLIC_KEY,_n as Padding,pl as ParticleBurst,cl as ParticleSubEmitter,Cl as ParticleSystem,vl as ParticleSystemBaseBehaviour,xl as ParticleSystemRenderer,sl as ParticleSystemShapeType,fs as PeerHandle,Pn as PeerNetworking,Lr as Physics,Os as PhysicsExtension,R as PhysicsMaterialCombine,Ml as PixelationEffect,uo as PlayAnimationOnClick,Fa as PlayAudioOnClick,$c as PlayableDirector,rc as PlayerColor,Wo as PlayerState,qa as PlayerStateEvent,Ya as PlayerSync,re as PlayerView,Dn as PlayerViewManager,Ce as PointerEventData,sr as PointerType,Kl as PostProcessingEffect,jl as PostProcessingEffectOrder,Bl as PostProcessingHandler,$ as PostProcessingManager,$ as Volume,Ua as PreliminaryAction,ls as PreliminaryTrigger,Gc as PreviewHelper,Fe as PrimitiveType,Bo as Progress,fi as PromiseAllWithErrors,jr as PromiseErrorResult,bn as RGBAColor,fa as RapierPhysics,Qt as RawImage,oi as RaycastOptions,Si as Rect,Bi as RectTransform,Ba as ReflectionProbe,Ta as RegisteredAnimationInfo,xc as RemoteSkybox,se as RenderTexture,ba as RenderTextureSerializer,wo as Renderer,Yr as RendererData,io as RendererLightmap,ge as Rigidbody,_t as RigidbodyConstraints,hn as RoomEvents,Tl as RotationBySpeedModule,Ol as RotationOverLifetimeModule,Qa as SceneLightSettings,Yc as SceneSwitcher,Fs as ScreenCapture,Wl as ScreenSpaceAmbientOcclusion,Vl as ScreenSpaceAmbientOcclusionN8,Vc as ScrollFollow,tc as SeeThrough,Cr as SendQueue,he as SerializationContext,Va as SetActiveOnClick,Qc as ShadowCatcher,ll as ShapeModule,Ge as ShapeOverlapResult,Al as SharpeningEffect,Dc as SignalAsset,Js as SignalReceiver,Xs as SignalReceiverEvent,Bs as SignalTrackHandler,rn as Size,Dl as SizeBySpeedModule,al as SizeOverLifetimeModule,Ds as SkinnedMeshRenderer,dc as SmoothFollow,nr as SpatialGrabRaycaster,li as SpatialHtml,Jc as SpatialTrigger,el as SpatialTriggerReceiver,cc as SpectatorCamera,fo as SphereCollider,pn as SphereIntersection,Sc as SplineContainer,bc as SplineData,ma as SplineUtils,Mc as SplineWalker,Pa as Sprite,za as SpriteData,Ga as SpriteRenderer,to as SpriteSheet,ni as StateMachineBehaviour,Ho as StreamEndedEvent,xo as StreamReceivedEvent,hl as SubEmitterSystem,Rc as SyncedCamera,vc as SyncedRoom,Ue as SyncedTransform,ho as TapGestureTrigger,Aa as TeleportTarget,Kc as TestRunner,hc as TestSimulateUserData,Br as Text,Io as TextBuilder,yo as TextExtension,nl as TextureSheetAnimationModule,Ll as TiltShiftEffect,bt as Time,Pl as ToneMappingEffect,Rs as TrackHandler,Ns as TrackType,El as TrailModule,Mo as TransformData,Ac as TransformGizmo,So as TriggerBuilder,as as TriggerModel,ne as TypeStore,Le as UIRaycastUtils,ot as UIRootComponent,Do as USDDocument,Xo as USDObject,xs as USDWriter,Zo as USDZExporter,Ss as USDZText,Ro as USDZUIExtension,Ca as UriSerializer,mc as UsageMarker,br as UserJoinedOrLeftRoomModel,F as VERSION,ec as VariantAction,ol as VelocityOverLifetimeModule,kn as VerticalLayoutGroup,Xc as VideoPlayer,Pc as ViewBox,pi as ViewDevice,Ul as Vignette,po as VisibilityAction,eo as Voip,ql as VolumeParameter,Fl as VolumeProfile,qe as WaitForFrames,j as WaitForPromise,J as WaitForSeconds,ei as Watch,rs as WebARCameraBackground,Za as WebARSessionRoot,Es as WebXR,As as WebXRButtonFactory,ds as WebXRImageTracking,Vo as WebXRImageTrackingModel,es as WebXRPlaneTracking,bo as WebXRTrackedImage,Oo as XRControllerFollow,ws as XRControllerModel,ro as XRControllerMovement,us as XRFlag,gs as XRRig,Ha as XRState,go as XRStateFlag,_a as __Ignore,Wt as __internalNotifyObjectDestroyed,pe as activeInHierarchyFieldName,$n as addAttributeChangeCallback,Dr as addComponent,ao as addCustomExtensionPlugin,Jn as addNewComponent,nt as addPatch,U as apply,xr as applyHMRChanges,Nt as applyPrototypeExtensions,ai as beginListenDestroy,fn as beginListenInstantiate,Xt as binaryIdentifierCasts,sn as build_scene_functions,Jr as builtinComponentKeyName,ga as calculateProgress01,X as clearBalloonMessages,X as clearOverlayMessages,oa as colorSerializer,Qe as compareAssociation,Sa as componentSerializer,Fr as copyTexture,tr as createMotion,bi as debugNet,Sn as debugOwner,Fo as decompressGpuTexture,tn as deepClone,Rr as delay,si as delayForFrames,Bt as deserializeObject,hr as destroy,Vn as destroyComponentInstance,Ws as determineMimeTypeFromExtension,$e as disposeObjectResources,is as disposeStream,le as editorGuidKeyName,Xn as enableSpatialConsole,na as euler,ea as eventListSerializer,va as exportAsGLTF,a as findByGuid,Zt as findObjectOfType,Oi as findObjectsOfType,ie as findResourceUsers,de as fitCamera,ii as fitObjectIntoVolume,cr as foreachComponent,ke as foreachComponentEnumerator,dn as forward,Ne as generateQRCode,vr as generateSeed,_r as getBoundingBox,Ji as getCameraController,Ki as getComponent,un as getComponentInChildren,zi as getComponentInParent,ut as getComponents,g as getComponentsInChildren,Ni as getComponentsInParent,Lo as getFormattedDate,n as getIconElement,ar as getIconTexture,y as getLoader,gt as getOrAddComponent,mn as getParam,gi as getParentHierarchyPath,yr as getPath,Wr as getPeerOptions,Er as getPeerjsInstance,Tn as getResourceUserCount,vn as getTempColor,An as getTempQuaternion,Vr as getTempVector,yi as getUrlParams,Sr as getVisibleInCustomShadowRendering,Un as getWorldDirection,Ln as getWorldEuler,Kt as getWorldPosition,Ci as getWorldQuaternion,Vi as getWorldRotation,an as getWorldScale,Rn as hasCommercialLicense,qt as hasIndieLicense,Ae as hasPointerEventComponent,wi as hasProLicense,ra as hideDebugConsole,cs as imageToCanvas,Ie as instantiate,Na as invokeLoadedImportPluginHooks,k as invokeXRSessionEnd,K as invokeXRSessionStart,Je as isActiveInHierarchy,M as isActiveSelf,xn as isAndroidDevice,Fi as isAnimationAction,O as isComponent,Nn as isDebugMode,Ur as isDesktop,oe as isDestroyed,fe as isDevEnvironment,di as isDisposed,sa as isExporting,G as isGLTFModel,Et as isHostedOnGlitch,xi as isHotReloadEnabled,Cn as isHotReloading,Tr as isIPad,Ee as isIconElement,V as isLocalNetwork,Kn as isMacOS,zn as isMobileDevice,Yt as isMozillaXR,Ei as isQuest,Ar as isResourceTrackingEnabled,Wi as isSafari,Se as isUsingInstancing,cn as isiOS,Ri as isiPad,Q as loadAsset,bs as loadPMREM,ua as loadSync,st as logHierarchy,p as lookAtInverse,Ai as lookAtObject,ft as lookAtScreenPoint,lt as makeId,h as makeIdFromRandomWords,$o as makeNameSafeForUSD,at as markAsInstancedRendered,Mi as microphonePermissionsGranted,mt as nameof,w as nameofFactory,xa as objectSerializer,ye as offXRSessionEnd,rt as offXRSessionStart,Hi as onAfterRender,on as onBeforeRender,Ii as onClear,ct as onDestroy,m as onInitialized,ji as onStart,pt as onUpdate,Xi as onXRSessionEnd,c as onXRSessionStart,ia as parseSync,C as placeOnSurface,v as postprocessFBXMaterials,et as prefix,b as pushState,Be as randomNumber,Di as registerBinaryType,Li as registerComponent,Ma as registerComponentExtension,kl as registerCustomEffectType,Xa as registerExportExtensions,qo as registerExtensions,Fn as registerHotReloadType,ze as registerLoader,_i as registerPrefabProvider,L as registerPrototypeExtensions,wn as registerType,pr as relativePathPrefix,r as removeAttributeChangeCallback,E as removeComponent,Da as removeCustomImportExtensionType,Yi as removePatch,or as resolveUrl,De as sanitizeString,To as saveImage,Jo as screenshot,ys as screenshot2,yn as sendDestroyed,Ft as serializable,It as serializeObject,Ut as serializeable,$i as setActive,Ht as setAllowBalloonMessages,Xe as setAllowOverlayMessages,s as setAutoFitEnabled,wt as setCameraController,d as setDestroyed,qr as setDevEnvironment,$r as setDisposable,Ot as setDontDestroy,Pe as setOrAddParamsToUrl,Ke as setParam,A as setParamWithoutReload,qn as setPeerOptions,Qn as setResourceTrackingEnabled,q as setState,Re as setVisibleInCustomShadowRendering,ur as setWorldEuler,e as setWorldPosition,rr as setWorldPositionXYZ,we as setWorldQuaternion,je as setWorldQuaternionXYZW,We as setWorldRotation,D as setWorldRotationXYZ,W as setWorldScale,ui as showBalloonError,kr as showBalloonMessage,Zr as showBalloonWarning,ta as showDebugConsole,_e as slerp,jn as syncDestroy,ko as syncField,Hr as syncInstantiate,tt as textureToCanvas,be as toSourceId,Gi as tryCastBinary,oc as tryDetermineMimetypeFromBinary,ac as tryDetermineMimetypeFromURL,it as tryFindObject,ln as tryGetGuid,Gr as unregisterHotReloadType,Zi as unwatchWrite,z as useForAutoFit,qi as validate,l as watchWrite}; \ No newline at end of file diff --git a/Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js.gz b/Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js.gz new file mode 100644 index 0000000..c7e0bef Binary files /dev/null and b/Needle/MenuScene/dist/assets/needle-engine.HinF1QFy.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js b/Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js similarity index 99% rename from Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js rename to Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js index 669749d..f0b2527 100644 --- a/Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js +++ b/Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js @@ -1,4 +1,4 @@ -import{A as e,Fr as t,Jt as n,X as r,cr as i,ft as a,gn as o,kr as s,xr as c}from"./three@0.169.19.js";import{Ka as l,Mt as u,Ua as d,Vn as f,Xi as p,Zi as m,aa as ee,co as h,eo as te,gr as g,mt as ne,na as re,ot as ie,qr as ae,ra as oe,z as _}from"./needle-engine-ui.iRWmt52F.js";import{B as se}from"./postprocessing.Wy71DpiM.js";var v=h(`debugpost`),y=null;function ce(e){y=e}function le(e){let t=e.gameObject;for(;t;){for(let e of u(t))if(e.isPostProcessingManager===!0)return e;t=t.parent}return null}function ue(e){let t=le(e);if(!t)if(y){v&&console.warn(`Adding postprocessing manager to the scene.`);let n=e.scene;t=ne(n,y)}else l()&&console.warn(`No post processing manager found`);return t}var b={AT_START:-1e4,NormalPass:0,DepthDownsamplingPass:10,SSAO:20,SMAA:30,TiltShift:40,DepthOfField:50,ChromaticAberration:60,Bloom:70,Vignette:80,Pixelation:90,ToneMapping:100,HueSaturation:110,BrightnessContrast:120,Sharpening:130,AT_END:1e4},x=null;function de(e){if(v===`verbose`&&console.debug(`Before ordering effects`,[...e]),!x){x=new Map,x.set(g.POSTPROCESSING.MODULE.NormalPass,b.NormalPass),x.set(g.POSTPROCESSING.MODULE.DepthDownsamplingPass,b.DepthDownsamplingPass),x.set(g.POSTPROCESSING.MODULE.SMAAEffect,b.SMAA),x.set(g.POSTPROCESSING.MODULE.SSAOEffect,b.SSAO);let e=g.POSTPROCESSING_AO.MAYBEMODULE;e&&(x.set(e.N8AOPostPass,b.SSAO),x.set(e.N8AOPass,b.SSAO)),x.set(g.POSTPROCESSING.MODULE.TiltShiftEffect,b.TiltShift),x.set(g.POSTPROCESSING.MODULE.DepthOfFieldEffect,b.DepthOfField),x.set(g.POSTPROCESSING.MODULE.ChromaticAberrationEffect,b.ChromaticAberration),x.set(g.POSTPROCESSING.MODULE.BloomEffect,b.Bloom),x.set(g.POSTPROCESSING.MODULE.SelectiveBloomEffect,b.Bloom),x.set(g.POSTPROCESSING.MODULE.VignetteEffect,b.Vignette),x.set(g.POSTPROCESSING.MODULE.PixelationEffect,b.Pixelation),x.set(g.POSTPROCESSING.MODULE.ToneMappingEffect,b.ToneMapping),x.set(g.POSTPROCESSING.MODULE.HueSaturationEffect,b.HueSaturation),x.set(g.POSTPROCESSING.MODULE.BrightnessContrastEffect,b.BrightnessContrast)}e.sort((e,t)=>{let n=typeof e.priority==`number`?e.priority:x.get(e.effect.constructor)??-1/0,r=typeof t.priority==`number`?t.priority:x.get(t.effect.constructor)??-1/0;return n===-1/0?(v&&console.warn(`Unknown effect found: `,e.constructor.name,e),1):r===-1/0?(v&&console.warn(`Unknown effect found: `,t.constructor.name,t),-1):n-r}),v===`verbose`&&console.debug(`After ordering effects`,[...e])}var fe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},pe=h(`debugpost`),S=class{isVolumeParameter=!0;constructor(e){e!==void 0&&this.initialize(e)}_isInitialized=!1;get isInitialized(){return this._isInitialized}initialize(e){e!==void 0&&(this._value=e,this._defaultValue=e,this._valueRaw=e,this._isInitialized=!0)}get overrideState(){return this._active}set overrideState(e){if(this._active===e)return;this._active=e;let t=e?this._valueRaw:this._defaultValue;this.processValue(t,!0)}_active=!0;get value(){return this._valueRaw}set value(e){this.isInitialized||this.initialize(e),this.processValue(e,!1)}_value;_valueRaw;set defaultValue(e){this._defaultValue=e}_defaultValue=void 0;__init(){this.processValue(this._valueRaw,!0)}valueProcessor;onValueChanged;processValue(e,t){if(e==null||!t&&this.testIfValueChanged(e)===!1)return;let n=this._value;pe&&typeof n==`number`&&typeof e==`number`&&(n?.toFixed(4),e?.toFixed(4)),!this._active&&this._defaultValue!==void 0?(this._value=this._defaultValue,e=this._defaultValue,this._valueRaw=e):(this._valueRaw=e,this._active&&this.valueProcessor&&(e=this.valueProcessor(e)),this._value=e),this.onValueChanged&&this.onValueChanged(e,n,this)}testIfValueChanged(e){return this._valueRaw!==e}};fe([p()],S.prototype,`overrideState`,null),fe([p()],S.prototype,`value`,null),new class extends ae{constructor(){super([S])}onSerialize(e,t){}onDeserialize(e,t){let n=t.target,r=t.path,i;if(n&&r&&(i=n[r]),(typeof i!=`object`||typeof i==`object`&&i.isVolumeParameter!==!0)&&(i=new S),typeof e==`object`&&`value`in e){let t=e.value;i.initialize(t),i.overrideState=e.overrideState}else i.value=e;return i}};var me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},C=h(`debugpost`),w=class extends ie{get isPostProcessingEffect(){return!0}order=void 0;constructor(e=void 0){if(super(),e)for(let t of Object.keys(e)){let n=e[t],r=this[t];r instanceof S?r.initialize(n):r!==void 0&&(this[t]=n)}}active=!0;_manager=null;onEnable(){super.onEnable(),C&&console.warn(`Enable`,this.constructor.name+(this.__internalDidAwakeAndStart?``:` (awake)`)),this.__internalDidAwakeAndStart&&(this.active=!0),this.onEffectEnabled()}onDisable(){super.onDisable(),C&&console.warn(`Disable`,this.constructor.name),this._manager?.removeEffect(this),this.active=!1}onEffectEnabled(e){e&&e.isPostProcessingManager===!0?this._manager=e:this._manager||=ue(this),this._manager.addEffect(this),this._manager.dirty=!0}init(){}_result;_postprocessingContext=null;get postprocessingContext(){return this._postprocessingContext}apply(e){return this._postprocessingContext=e,this._result||=(this.initParameters(),this.onCreateEffect?.call(this)),this._result&&this.initParameters(),this._result}unapply(){}dispose(){C&&console.warn(`DISPOSE`,this),this._result&&(Array.isArray(this._result)?this._result.forEach(e=>e.dispose()):this._result.dispose()),this._result=void 0}initParameters(){let e=Object.keys(this);for(let t of e){let e=this[t];e instanceof S&&e.__init()}}onEditorModification(e){let t=e.propertyName;if(this[t]instanceof S){let n=e.value;return this[t].value=n,!0}}};me([p()],w.prototype,`active`,void 0);var he=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ge=h(`debugpost`),_e={};function T(e,t){_e[e]=t}function ve(e){return e.__type in _e?_e[e.__type]:(ge&&e.__type&&console.warn(`Unknown postprocessing type`,e.__type,e),w)}var ye=class{components=[];__init(e){this.components?.forEach(t=>{t.gameObject===void 0&&e.gameObject.addComponent(t),t.init()})}addEffect(e){this.components.push(e)}removeEffect(e){let t=this.components.indexOf(e);t>=0&&this.components.splice(t,1)}};he([m([e=>ve(e),w])],ye.prototype,`components`,void 0);var be=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xe=h(`debugpost`),Se;(function(e){e[e.LOW=0]=`LOW`,e[e.MEDIUM=1]=`MEDIUM`,e[e.HIGH=2]=`HIGH`,e[e.ULTRA=3]=`ULTRA`})(Se||={});var Ce=class extends w{get typeName(){return`Antialiasing`}preset=new S(2);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.SMAAEffect({preset:this.preset?.value??g.POSTPROCESSING.MODULE.SMAAPreset.HIGH,edgeDetectionMode:g.POSTPROCESSING.MODULE.EdgeDetectionMode.LUMA});return this.preset.onValueChanged=t=>{xe&&console.log(`Antialiasing preset changed to`,t),e.applyPreset(t)},e}};be([p(S)],Ce.prototype,`preset`,void 0),T(`Antialiasing`,Ce);var we=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},E=class e extends w{static useSelectiveBloom=!1;get typeName(){return`Bloom`}threshold=new S(.9);intensity=new S(1);scatter=new S(.7);selectiveBloom;init(){this.threshold.valueProcessor=e=>e,this.intensity.valueProcessor=e=>e,this.scatter.valueProcessor=e=>e}onCreateEffect(){let t;if(this.selectiveBloom??=e.useSelectiveBloom,this.selectiveBloom){let e=t=new g.POSTPROCESSING.MODULE.SelectiveBloomEffect(this.context.scene,this.context.mainCamera,{blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});e.inverted=!0}else t=new g.POSTPROCESSING.MODULE.BloomEffect({blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});return this.intensity.onValueChanged=e=>{t.intensity=e},this.threshold.onValueChanged=e=>{t.luminanceMaterial.threshold=e**2.2},this.scatter.onValueChanged=e=>{t.luminancePass.enabled=!0,t.luminanceMaterial.smoothing=e,t.mipmapBlurPass&&(t.mipmapBlurPass.radius=n.lerp(.1,.9,e))},t}};we([p(S)],E.prototype,`threshold`,void 0),we([p(S)],E.prototype,`intensity`,void 0),we([p(S)],E.prototype,`scatter`,void 0),T(`Bloom`,E);var Te=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=class extends w{get typeName(){return`ChromaticAberration`}intensity=new S(0);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.ChromaticAberrationEffect;return e.offset=new s(0,0),e.radialModulation=!0,e.modulationOffset=.15,this.intensity.valueProcessor=e=>e*.02,this.intensity.onValueChanged=t=>{e.offset.x=-t,e.offset.y=t},e}};Te([p(S)],D.prototype,`intensity`,void 0),T(`ChromaticAberration`,D);var O;(function(e){e[e.None=0]=`None`,e[e.Neutral=1]=`Neutral`,e[e.ACES=2]=`ACES`,e[e.AgX=3]=`AgX`,e[e.KhronosNeutral=4]=`KhronosNeutral`})(O||={});var Ee=new Map;function k(e){switch(e){case O.None:return 1;case O.Neutral:return 2;case O.ACES:return 4;case O.AgX:return 6;case O.KhronosNeutral:return 7;default:return Ee.has(e)||(Ee.set(e,!0),console.warn(`[Postprocessing] Unknown tone mapping mode`,e)),7}}function De(e){switch(e){case 1:return O.None;case 4:return O.ACES;case 6:return O.AgX;case 7:return O.Neutral;case 2:return O.Neutral;default:return O.None}}function A(e){switch(e){case 1:return g.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR;case 4:return g.POSTPROCESSING.MODULE.ToneMappingMode.ACES_FILMIC;case 6:return g.POSTPROCESSING.MODULE.ToneMappingMode.AGX;case 7:return g.POSTPROCESSING.MODULE.ToneMappingMode.NEUTRAL;case 2:return g.POSTPROCESSING.MODULE.ToneMappingMode.REINHARD;default:return g.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR}}var Oe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},j=h(`debugpost`),M=class extends w{get typeName(){return`ToneMapping`}mode=new S(void 0);exposure=new S(1);setMode(e){let t=O[e];return t===void 0?(console.error(`[PostProcessing] Invalid ToneMapping mode`,e),this):(this.mode.value=t,this)}get isToneMapping(){return!0}onEffectEnabled(){let e=le(this);e&&super.onEffectEnabled(e)}_tonemappingEffect=null;onCreateEffect(){if(this.mode.isInitialized==0){let e=De(this.context.renderer.toneMapping);j&&console.log(`[PostProcessing] Initializing ToneMapping mode to renderer.toneMapping`,this.context.renderer.toneMapping+` → `+e),this.mode.initialize(e)}this._tonemappingEffect?.dispose();let e=k(this.mode.value),t=this._tonemappingEffect=new g.POSTPROCESSING.MODULE.ToneMappingEffect({mode:A(e)});return this.mode.onValueChanged=n=>{typeof n==`string`?(n=f(n),t.mode=A(n)):t.mode=A(k(n)),t.name=`ToneMapping (`+O[n]+`)`,j&&console.log(`[PostProcessing] ToneMapping mode changed to`,O[n],e,t.mode)},j&&console.log(`[PostProcessing] Use ToneMapping`,O[this.mode.value],e,t.mode,`renderer.tonemapping: `+this.context.renderer.toneMapping),t}onBeforeRender(){if(this._tonemappingEffect&&this.postprocessingContext?.handler.getEffectIsActive(this._tonemappingEffect)&&(this.mode.overrideState&&(this.context.renderer.toneMapping=k(this.mode.value)),this.exposure.overrideState&&this.exposure.value!==void 0)){let e=Math.max(0,this.exposure.value);this.context.renderer.toneMappingExposure=e}}};Oe([p(S)],M.prototype,`mode`,void 0),Oe([p(S)],M.prototype,`exposure`,void 0),T(`Tonemapping`,M);var N=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},P=class extends w{get typeName(){return`ColorAdjustments`}remap=!0;postExposure=new S(1);contrast=new S(0);hueShift=new S(0);saturation=new S(0);init(){this.postExposure.valueProcessor=e=>(this.remap&&(e=2**e),e),this.contrast.valueProcessor=e=>{if(!this.remap)return e;let t=1;return e>0?t=200:e<0&&(t=100),e/t},this.contrast.defaultValue=0,this.hueShift.valueProcessor=e=>this.remap?Math.PI*e/180:e,this.hueShift.defaultValue=0,this.saturation.valueProcessor=e=>this.remap?e<0?e/100:e/(100*Math.PI):e,this.saturation.defaultValue=0}onCreateEffect(){let e=[],t=this.postprocessingContext?.components.find(e=>e instanceof M);t||(t=new M,this.postprocessingContext?.components.push(t)),this.postExposure.onValueChanged=e=>{this.postExposure.overrideState&&t?t.exposure.value=e:console.warn(`[PostProcessing] PostExposure is set to override but no ToneMappingEffect found in the postprocessing stack. Please add a ToneMappingEffect to your postprocessing stack to use PostExposure.`)};let n=new g.POSTPROCESSING.MODULE.BrightnessContrastEffect;this.contrast.onValueChanged=e=>n.contrast=e;let r=new g.POSTPROCESSING.MODULE.HueSaturationEffect;return this.hueShift.onValueChanged=e=>r.hue=e,this.saturation.onValueChanged=e=>r.saturation=e,e.push(n),e.push(r),e}};N([p(S)],P.prototype,`postExposure`,void 0),N([p(S)],P.prototype,`contrast`,void 0),N([p(S)],P.prototype,`hueShift`,void 0),N([p(S)],P.prototype,`saturation`,void 0),T(`ColorAdjustments`,P);var F=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ke;(function(e){e[e.Off=0]=`Off`,e[e.Gaussian=1]=`Gaussian`,e[e.Bokeh=2]=`Bokeh`})(ke||={});var Ae=h(`debugpost`),I=class extends w{get typeName(){return`DepthOfField`}mode;focusDistance=new S(1);focalLength=new S(.2);aperture=new S(20);gaussianMaxRadius=new S;resolutionScale=new S(1/window.devicePixelRatio);bokehScale=new S;init(){this.focalLength.valueProcessor=e=>{let t=e/300;return d.lerp(2,.01,t)},this.aperture.valueProcessor=e=>{let t=1-e/32;return d.lerp(1,20,t)}}onCreateEffect(){if(this.mode===ke.Off){Ae&&console.warn(`DepthOfField: Mode is set to Off`);return}let e=new g.POSTPROCESSING.MODULE.DepthOfFieldEffect(this.context.mainCamera,{worldFocusRange:.2,focalLength:1,bokehScale:20,resolutionScale:this.resolutionScale.value});return this.focusDistance.onValueChanged=t=>{e.cocMaterial.worldFocusDistance=t},this.focalLength.onValueChanged=t=>e.cocMaterial.worldFocusRange=t,this.aperture.onValueChanged=t=>e.bokehScale=t,this.resolutionScale&&(this.resolutionScale.onValueChanged=t=>e.resolution.scale=t),[e]}unapply(){}};F([p()],I.prototype,`mode`,void 0),F([p(S)],I.prototype,`focusDistance`,void 0),F([p(S)],I.prototype,`focalLength`,void 0),F([p(S)],I.prototype,`aperture`,void 0),F([p(S)],I.prototype,`gaussianMaxRadius`,void 0),F([p(S)],I.prototype,`resolutionScale`,void 0),F([p(S)],I.prototype,`bokehScale`,void 0),T(`DepthOfField`,I);var je=class extends w{effect;constructor(e){super(),this.effect=e}get typeName(){return this.effect.constructor.name}onCreateEffect(){return this.effect}},Me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},L=class extends w{get typeName(){return`PixelationEffect`}granularity=new S(10);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.PixelationEffect;return this.granularity.onValueChanged=t=>{e.granularity=t},e}};Me([p(S)],L.prototype,`granularity`,void 0),T(`PixelationEffect`,L);var R=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},z=class extends w{get typeName(){return`ScreenSpaceAmbientOcclusion`}intensity=new S(2);falloff=new S(1);samples=new S(9);color=new S(new e(0,0,0));luminanceInfluence=new S(.7);onBeforeRender(){if(this._ssao&&this.context.mainCamera instanceof o){let e=this.context.mainCamera.far-this.context.mainCamera.near;this._ssao.ssaoMaterial.worldDistanceFalloff=e*.01,this._ssao.ssaoMaterial.worldDistanceThreshold=this.context.mainCamera.far}}_ssao;onCreateEffect(){let t=this.context.mainCamera,n=new g.POSTPROCESSING.MODULE.NormalPass(this.context.scene,t),r=new g.POSTPROCESSING.MODULE.DepthDownsamplingPass({normalBuffer:n.texture,resolutionScale:.5}),i=this._ssao=new g.POSTPROCESSING.MODULE.SSAOEffect(t,n.texture,{normalDepthBuffer:r.texture,worldDistanceThreshold:1,worldDistanceFalloff:1,worldProximityThreshold:.1,worldProximityFalloff:2,intensity:1,blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.MULTIPLY,luminanceInfluence:.5});this.intensity.onValueChanged=e=>{i.intensity=e},this.falloff.onValueChanged=e=>{i.ssaoMaterial.radius=e*.1},this.samples.onValueChanged=e=>{i.ssaoMaterial.samples=e},this.color.onValueChanged=t=>{i.color||=new e,i.color.copy(t)},this.luminanceInfluence.onValueChanged=e=>{i.luminanceInfluence=e};let a=[];return a.push(n),a.push(r),a.push(i),a}};R([p(S)],z.prototype,`intensity`,void 0),R([p(S)],z.prototype,`falloff`,void 0),R([p(S)],z.prototype,`samples`,void 0),R([p(S)],z.prototype,`color`,void 0),R([p(S)],z.prototype,`luminanceInfluence`,void 0),T(`ScreenSpaceAmbientOcclusion`,z);var B=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ne=h(`debugN8AO`),V;(function(e){e[e.Performance=0]=`Performance`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.Ultra=4]=`Ultra`})(V||={});var H=class extends w{get typeName(){return`ScreenSpaceAmbientOcclusionN8`}get pass(){return this._ssao}gammaCorrection=!0;aoRadius=new S(1);falloff=new S(1);intensity=new S(1);color=new S(new e(0,0,0));screenspaceRadius=!1;quality=V.Medium;_ssao;onValidate(){this._ssao&&(this._ssao.setQualityMode(V[this.quality]),this._ssao.configuration.gammaCorrection=this.gammaCorrection,this._ssao.configuration.screenSpaceRadius=this.screenspaceRadius)}onCreateEffect(){let n=this.context.mainCamera,r=this.context.domWidth,i=this.context.domHeight,a=this._ssao=new g.POSTPROCESSING_AO.MODULE.N8AOPostPass(this.context.scene,n,r,i);a.name=`SSAO_N8`;let o=V[this.quality];if(a.setQualityMode(o),a.configuration.transparencyAware=!1,a.configuration.halfRes=window.devicePixelRatio>1,a.effectCompositerQuad?.material){let e=a.effectCompositerQuad.material;e.fragmentShader=e.fragmentShader.replace(`if (depth == 1.0) { +import{A as e,Fr as t,Jt as n,X as r,cr as i,ft as a,gn as o,kr as s,xr as c}from"./three@0.169.19.js";import{Ka as l,Mt as u,Ua as d,Vn as f,Xi as p,Zi as m,aa as ee,co as h,eo as te,gr as g,mt as ne,na as re,ot as ie,qr as ae,ra as oe,z as _}from"./needle-engine-ui.i2hfjKja.js";import{B as se}from"./postprocessing.Wy71DpiM.js";var v=h(`debugpost`),y=null;function ce(e){y=e}function le(e){let t=e.gameObject;for(;t;){for(let e of u(t))if(e.isPostProcessingManager===!0)return e;t=t.parent}return null}function ue(e){let t=le(e);if(!t)if(y){v&&console.warn(`Adding postprocessing manager to the scene.`);let n=e.scene;t=ne(n,y)}else l()&&console.warn(`No post processing manager found`);return t}var b={AT_START:-1e4,NormalPass:0,DepthDownsamplingPass:10,SSAO:20,SMAA:30,TiltShift:40,DepthOfField:50,ChromaticAberration:60,Bloom:70,Vignette:80,Pixelation:90,ToneMapping:100,HueSaturation:110,BrightnessContrast:120,Sharpening:130,AT_END:1e4},x=null;function de(e){if(v===`verbose`&&console.debug(`Before ordering effects`,[...e]),!x){x=new Map,x.set(g.POSTPROCESSING.MODULE.NormalPass,b.NormalPass),x.set(g.POSTPROCESSING.MODULE.DepthDownsamplingPass,b.DepthDownsamplingPass),x.set(g.POSTPROCESSING.MODULE.SMAAEffect,b.SMAA),x.set(g.POSTPROCESSING.MODULE.SSAOEffect,b.SSAO);let e=g.POSTPROCESSING_AO.MAYBEMODULE;e&&(x.set(e.N8AOPostPass,b.SSAO),x.set(e.N8AOPass,b.SSAO)),x.set(g.POSTPROCESSING.MODULE.TiltShiftEffect,b.TiltShift),x.set(g.POSTPROCESSING.MODULE.DepthOfFieldEffect,b.DepthOfField),x.set(g.POSTPROCESSING.MODULE.ChromaticAberrationEffect,b.ChromaticAberration),x.set(g.POSTPROCESSING.MODULE.BloomEffect,b.Bloom),x.set(g.POSTPROCESSING.MODULE.SelectiveBloomEffect,b.Bloom),x.set(g.POSTPROCESSING.MODULE.VignetteEffect,b.Vignette),x.set(g.POSTPROCESSING.MODULE.PixelationEffect,b.Pixelation),x.set(g.POSTPROCESSING.MODULE.ToneMappingEffect,b.ToneMapping),x.set(g.POSTPROCESSING.MODULE.HueSaturationEffect,b.HueSaturation),x.set(g.POSTPROCESSING.MODULE.BrightnessContrastEffect,b.BrightnessContrast)}e.sort((e,t)=>{let n=typeof e.priority==`number`?e.priority:x.get(e.effect.constructor)??-1/0,r=typeof t.priority==`number`?t.priority:x.get(t.effect.constructor)??-1/0;return n===-1/0?(v&&console.warn(`Unknown effect found: `,e.constructor.name,e),1):r===-1/0?(v&&console.warn(`Unknown effect found: `,t.constructor.name,t),-1):n-r}),v===`verbose`&&console.debug(`After ordering effects`,[...e])}var fe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},pe=h(`debugpost`),S=class{isVolumeParameter=!0;constructor(e){e!==void 0&&this.initialize(e)}_isInitialized=!1;get isInitialized(){return this._isInitialized}initialize(e){e!==void 0&&(this._value=e,this._defaultValue=e,this._valueRaw=e,this._isInitialized=!0)}get overrideState(){return this._active}set overrideState(e){if(this._active===e)return;this._active=e;let t=e?this._valueRaw:this._defaultValue;this.processValue(t,!0)}_active=!0;get value(){return this._valueRaw}set value(e){this.isInitialized||this.initialize(e),this.processValue(e,!1)}_value;_valueRaw;set defaultValue(e){this._defaultValue=e}_defaultValue=void 0;__init(){this.processValue(this._valueRaw,!0)}valueProcessor;onValueChanged;processValue(e,t){if(e==null||!t&&this.testIfValueChanged(e)===!1)return;let n=this._value;pe&&typeof n==`number`&&typeof e==`number`&&(n?.toFixed(4),e?.toFixed(4)),!this._active&&this._defaultValue!==void 0?(this._value=this._defaultValue,e=this._defaultValue,this._valueRaw=e):(this._valueRaw=e,this._active&&this.valueProcessor&&(e=this.valueProcessor(e)),this._value=e),this.onValueChanged&&this.onValueChanged(e,n,this)}testIfValueChanged(e){return this._valueRaw!==e}};fe([p()],S.prototype,`overrideState`,null),fe([p()],S.prototype,`value`,null),new class extends ae{constructor(){super([S])}onSerialize(e,t){}onDeserialize(e,t){let n=t.target,r=t.path,i;if(n&&r&&(i=n[r]),(typeof i!=`object`||typeof i==`object`&&i.isVolumeParameter!==!0)&&(i=new S),typeof e==`object`&&`value`in e){let t=e.value;i.initialize(t),i.overrideState=e.overrideState}else i.value=e;return i}};var me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},C=h(`debugpost`),w=class extends ie{get isPostProcessingEffect(){return!0}order=void 0;constructor(e=void 0){if(super(),e)for(let t of Object.keys(e)){let n=e[t],r=this[t];r instanceof S?r.initialize(n):r!==void 0&&(this[t]=n)}}active=!0;_manager=null;onEnable(){super.onEnable(),C&&console.warn(`Enable`,this.constructor.name+(this.__internalDidAwakeAndStart?``:` (awake)`)),this.__internalDidAwakeAndStart&&(this.active=!0),this.onEffectEnabled()}onDisable(){super.onDisable(),C&&console.warn(`Disable`,this.constructor.name),this._manager?.removeEffect(this),this.active=!1}onEffectEnabled(e){e&&e.isPostProcessingManager===!0?this._manager=e:this._manager||=ue(this),this._manager.addEffect(this),this._manager.dirty=!0}init(){}_result;_postprocessingContext=null;get postprocessingContext(){return this._postprocessingContext}apply(e){return this._postprocessingContext=e,this._result||=(this.initParameters(),this.onCreateEffect?.call(this)),this._result&&this.initParameters(),this._result}unapply(){}dispose(){C&&console.warn(`DISPOSE`,this),this._result&&(Array.isArray(this._result)?this._result.forEach(e=>e.dispose()):this._result.dispose()),this._result=void 0}initParameters(){let e=Object.keys(this);for(let t of e){let e=this[t];e instanceof S&&e.__init()}}onEditorModification(e){let t=e.propertyName;if(this[t]instanceof S){let n=e.value;return this[t].value=n,!0}}};me([p()],w.prototype,`active`,void 0);var he=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ge=h(`debugpost`),_e={};function T(e,t){_e[e]=t}function ve(e){return e.__type in _e?_e[e.__type]:(ge&&e.__type&&console.warn(`Unknown postprocessing type`,e.__type,e),w)}var ye=class{components=[];__init(e){this.components?.forEach(t=>{t.gameObject===void 0&&e.gameObject.addComponent(t),t.init()})}addEffect(e){this.components.push(e)}removeEffect(e){let t=this.components.indexOf(e);t>=0&&this.components.splice(t,1)}};he([m([e=>ve(e),w])],ye.prototype,`components`,void 0);var be=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xe=h(`debugpost`),Se;(function(e){e[e.LOW=0]=`LOW`,e[e.MEDIUM=1]=`MEDIUM`,e[e.HIGH=2]=`HIGH`,e[e.ULTRA=3]=`ULTRA`})(Se||={});var Ce=class extends w{get typeName(){return`Antialiasing`}preset=new S(2);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.SMAAEffect({preset:this.preset?.value??g.POSTPROCESSING.MODULE.SMAAPreset.HIGH,edgeDetectionMode:g.POSTPROCESSING.MODULE.EdgeDetectionMode.LUMA});return this.preset.onValueChanged=t=>{xe&&console.log(`Antialiasing preset changed to`,t),e.applyPreset(t)},e}};be([p(S)],Ce.prototype,`preset`,void 0),T(`Antialiasing`,Ce);var we=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},E=class e extends w{static useSelectiveBloom=!1;get typeName(){return`Bloom`}threshold=new S(.9);intensity=new S(1);scatter=new S(.7);selectiveBloom;init(){this.threshold.valueProcessor=e=>e,this.intensity.valueProcessor=e=>e,this.scatter.valueProcessor=e=>e}onCreateEffect(){let t;if(this.selectiveBloom??=e.useSelectiveBloom,this.selectiveBloom){let e=t=new g.POSTPROCESSING.MODULE.SelectiveBloomEffect(this.context.scene,this.context.mainCamera,{blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});e.inverted=!0}else t=new g.POSTPROCESSING.MODULE.BloomEffect({blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.ADD,mipmapBlur:!0,luminanceThreshold:this.threshold.value,luminanceSmoothing:this.scatter.value,radius:.85,intensity:this.intensity.value});return this.intensity.onValueChanged=e=>{t.intensity=e},this.threshold.onValueChanged=e=>{t.luminanceMaterial.threshold=e**2.2},this.scatter.onValueChanged=e=>{t.luminancePass.enabled=!0,t.luminanceMaterial.smoothing=e,t.mipmapBlurPass&&(t.mipmapBlurPass.radius=n.lerp(.1,.9,e))},t}};we([p(S)],E.prototype,`threshold`,void 0),we([p(S)],E.prototype,`intensity`,void 0),we([p(S)],E.prototype,`scatter`,void 0),T(`Bloom`,E);var Te=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},D=class extends w{get typeName(){return`ChromaticAberration`}intensity=new S(0);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.ChromaticAberrationEffect;return e.offset=new s(0,0),e.radialModulation=!0,e.modulationOffset=.15,this.intensity.valueProcessor=e=>e*.02,this.intensity.onValueChanged=t=>{e.offset.x=-t,e.offset.y=t},e}};Te([p(S)],D.prototype,`intensity`,void 0),T(`ChromaticAberration`,D);var O;(function(e){e[e.None=0]=`None`,e[e.Neutral=1]=`Neutral`,e[e.ACES=2]=`ACES`,e[e.AgX=3]=`AgX`,e[e.KhronosNeutral=4]=`KhronosNeutral`})(O||={});var Ee=new Map;function k(e){switch(e){case O.None:return 1;case O.Neutral:return 2;case O.ACES:return 4;case O.AgX:return 6;case O.KhronosNeutral:return 7;default:return Ee.has(e)||(Ee.set(e,!0),console.warn(`[Postprocessing] Unknown tone mapping mode`,e)),7}}function De(e){switch(e){case 1:return O.None;case 4:return O.ACES;case 6:return O.AgX;case 7:return O.Neutral;case 2:return O.Neutral;default:return O.None}}function A(e){switch(e){case 1:return g.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR;case 4:return g.POSTPROCESSING.MODULE.ToneMappingMode.ACES_FILMIC;case 6:return g.POSTPROCESSING.MODULE.ToneMappingMode.AGX;case 7:return g.POSTPROCESSING.MODULE.ToneMappingMode.NEUTRAL;case 2:return g.POSTPROCESSING.MODULE.ToneMappingMode.REINHARD;default:return g.POSTPROCESSING.MODULE.ToneMappingMode.LINEAR}}var Oe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},j=h(`debugpost`),M=class extends w{get typeName(){return`ToneMapping`}mode=new S(void 0);exposure=new S(1);setMode(e){let t=O[e];return t===void 0?(console.error(`[PostProcessing] Invalid ToneMapping mode`,e),this):(this.mode.value=t,this)}get isToneMapping(){return!0}onEffectEnabled(){let e=le(this);e&&super.onEffectEnabled(e)}_tonemappingEffect=null;onCreateEffect(){if(this.mode.isInitialized==0){let e=De(this.context.renderer.toneMapping);j&&console.log(`[PostProcessing] Initializing ToneMapping mode to renderer.toneMapping`,this.context.renderer.toneMapping+` → `+e),this.mode.initialize(e)}this._tonemappingEffect?.dispose();let e=k(this.mode.value),t=this._tonemappingEffect=new g.POSTPROCESSING.MODULE.ToneMappingEffect({mode:A(e)});return this.mode.onValueChanged=n=>{typeof n==`string`?(n=f(n),t.mode=A(n)):t.mode=A(k(n)),t.name=`ToneMapping (`+O[n]+`)`,j&&console.log(`[PostProcessing] ToneMapping mode changed to`,O[n],e,t.mode)},j&&console.log(`[PostProcessing] Use ToneMapping`,O[this.mode.value],e,t.mode,`renderer.tonemapping: `+this.context.renderer.toneMapping),t}onBeforeRender(){if(this._tonemappingEffect&&this.postprocessingContext?.handler.getEffectIsActive(this._tonemappingEffect)&&(this.mode.overrideState&&(this.context.renderer.toneMapping=k(this.mode.value)),this.exposure.overrideState&&this.exposure.value!==void 0)){let e=Math.max(0,this.exposure.value);this.context.renderer.toneMappingExposure=e}}};Oe([p(S)],M.prototype,`mode`,void 0),Oe([p(S)],M.prototype,`exposure`,void 0),T(`Tonemapping`,M);var N=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},P=class extends w{get typeName(){return`ColorAdjustments`}remap=!0;postExposure=new S(1);contrast=new S(0);hueShift=new S(0);saturation=new S(0);init(){this.postExposure.valueProcessor=e=>(this.remap&&(e=2**e),e),this.contrast.valueProcessor=e=>{if(!this.remap)return e;let t=1;return e>0?t=200:e<0&&(t=100),e/t},this.contrast.defaultValue=0,this.hueShift.valueProcessor=e=>this.remap?Math.PI*e/180:e,this.hueShift.defaultValue=0,this.saturation.valueProcessor=e=>this.remap?e<0?e/100:e/(100*Math.PI):e,this.saturation.defaultValue=0}onCreateEffect(){let e=[],t=this.postprocessingContext?.components.find(e=>e instanceof M);t||(t=new M,this.postprocessingContext?.components.push(t)),this.postExposure.onValueChanged=e=>{this.postExposure.overrideState&&t?t.exposure.value=e:console.warn(`[PostProcessing] PostExposure is set to override but no ToneMappingEffect found in the postprocessing stack. Please add a ToneMappingEffect to your postprocessing stack to use PostExposure.`)};let n=new g.POSTPROCESSING.MODULE.BrightnessContrastEffect;this.contrast.onValueChanged=e=>n.contrast=e;let r=new g.POSTPROCESSING.MODULE.HueSaturationEffect;return this.hueShift.onValueChanged=e=>r.hue=e,this.saturation.onValueChanged=e=>r.saturation=e,e.push(n),e.push(r),e}};N([p(S)],P.prototype,`postExposure`,void 0),N([p(S)],P.prototype,`contrast`,void 0),N([p(S)],P.prototype,`hueShift`,void 0),N([p(S)],P.prototype,`saturation`,void 0),T(`ColorAdjustments`,P);var F=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ke;(function(e){e[e.Off=0]=`Off`,e[e.Gaussian=1]=`Gaussian`,e[e.Bokeh=2]=`Bokeh`})(ke||={});var Ae=h(`debugpost`),I=class extends w{get typeName(){return`DepthOfField`}mode;focusDistance=new S(1);focalLength=new S(.2);aperture=new S(20);gaussianMaxRadius=new S;resolutionScale=new S(1/window.devicePixelRatio);bokehScale=new S;init(){this.focalLength.valueProcessor=e=>{let t=e/300;return d.lerp(2,.01,t)},this.aperture.valueProcessor=e=>{let t=1-e/32;return d.lerp(1,20,t)}}onCreateEffect(){if(this.mode===ke.Off){Ae&&console.warn(`DepthOfField: Mode is set to Off`);return}let e=new g.POSTPROCESSING.MODULE.DepthOfFieldEffect(this.context.mainCamera,{worldFocusRange:.2,focalLength:1,bokehScale:20,resolutionScale:this.resolutionScale.value});return this.focusDistance.onValueChanged=t=>{e.cocMaterial.worldFocusDistance=t},this.focalLength.onValueChanged=t=>e.cocMaterial.worldFocusRange=t,this.aperture.onValueChanged=t=>e.bokehScale=t,this.resolutionScale&&(this.resolutionScale.onValueChanged=t=>e.resolution.scale=t),[e]}unapply(){}};F([p()],I.prototype,`mode`,void 0),F([p(S)],I.prototype,`focusDistance`,void 0),F([p(S)],I.prototype,`focalLength`,void 0),F([p(S)],I.prototype,`aperture`,void 0),F([p(S)],I.prototype,`gaussianMaxRadius`,void 0),F([p(S)],I.prototype,`resolutionScale`,void 0),F([p(S)],I.prototype,`bokehScale`,void 0),T(`DepthOfField`,I);var je=class extends w{effect;constructor(e){super(),this.effect=e}get typeName(){return this.effect.constructor.name}onCreateEffect(){return this.effect}},Me=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},L=class extends w{get typeName(){return`PixelationEffect`}granularity=new S(10);onCreateEffect(){let e=new g.POSTPROCESSING.MODULE.PixelationEffect;return this.granularity.onValueChanged=t=>{e.granularity=t},e}};Me([p(S)],L.prototype,`granularity`,void 0),T(`PixelationEffect`,L);var R=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},z=class extends w{get typeName(){return`ScreenSpaceAmbientOcclusion`}intensity=new S(2);falloff=new S(1);samples=new S(9);color=new S(new e(0,0,0));luminanceInfluence=new S(.7);onBeforeRender(){if(this._ssao&&this.context.mainCamera instanceof o){let e=this.context.mainCamera.far-this.context.mainCamera.near;this._ssao.ssaoMaterial.worldDistanceFalloff=e*.01,this._ssao.ssaoMaterial.worldDistanceThreshold=this.context.mainCamera.far}}_ssao;onCreateEffect(){let t=this.context.mainCamera,n=new g.POSTPROCESSING.MODULE.NormalPass(this.context.scene,t),r=new g.POSTPROCESSING.MODULE.DepthDownsamplingPass({normalBuffer:n.texture,resolutionScale:.5}),i=this._ssao=new g.POSTPROCESSING.MODULE.SSAOEffect(t,n.texture,{normalDepthBuffer:r.texture,worldDistanceThreshold:1,worldDistanceFalloff:1,worldProximityThreshold:.1,worldProximityFalloff:2,intensity:1,blendFunction:g.POSTPROCESSING.MODULE.BlendFunction.MULTIPLY,luminanceInfluence:.5});this.intensity.onValueChanged=e=>{i.intensity=e},this.falloff.onValueChanged=e=>{i.ssaoMaterial.radius=e*.1},this.samples.onValueChanged=e=>{i.ssaoMaterial.samples=e},this.color.onValueChanged=t=>{i.color||=new e,i.color.copy(t)},this.luminanceInfluence.onValueChanged=e=>{i.luminanceInfluence=e};let a=[];return a.push(n),a.push(r),a.push(i),a}};R([p(S)],z.prototype,`intensity`,void 0),R([p(S)],z.prototype,`falloff`,void 0),R([p(S)],z.prototype,`samples`,void 0),R([p(S)],z.prototype,`color`,void 0),R([p(S)],z.prototype,`luminanceInfluence`,void 0),T(`ScreenSpaceAmbientOcclusion`,z);var B=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ne=h(`debugN8AO`),V;(function(e){e[e.Performance=0]=`Performance`,e[e.Low=1]=`Low`,e[e.Medium=2]=`Medium`,e[e.High=3]=`High`,e[e.Ultra=4]=`Ultra`})(V||={});var H=class extends w{get typeName(){return`ScreenSpaceAmbientOcclusionN8`}get pass(){return this._ssao}gammaCorrection=!0;aoRadius=new S(1);falloff=new S(1);intensity=new S(1);color=new S(new e(0,0,0));screenspaceRadius=!1;quality=V.Medium;_ssao;onValidate(){this._ssao&&(this._ssao.setQualityMode(V[this.quality]),this._ssao.configuration.gammaCorrection=this.gammaCorrection,this._ssao.configuration.screenSpaceRadius=this.screenspaceRadius)}onCreateEffect(){let n=this.context.mainCamera,r=this.context.domWidth,i=this.context.domHeight,a=this._ssao=new g.POSTPROCESSING_AO.MODULE.N8AOPostPass(this.context.scene,n,r,i);a.name=`SSAO_N8`;let o=V[this.quality];if(a.setQualityMode(o),a.configuration.transparencyAware=!1,a.configuration.halfRes=window.devicePixelRatio>1,a.effectCompositerQuad?.material){let e=a.effectCompositerQuad.material;e.fragmentShader=e.fragmentShader.replace(`if (depth == 1.0) { texel = vec4(0.0, 0.0, 0.0, 1.0);`,`if (depth == 1.0) { gl_FragColor = sceneTexel; return;`),e.needsUpdate=!0}let s=new t(r,i);return a.configuration.beautyRenderTarget=s,a.configuration.autoRenderBeauty=!1,a.configuration.gammaCorrection=this.gammaCorrection,a.configuration.screenSpaceRadius=this.screenspaceRadius,Ne&&(a.enableDebugMode(),console.log(a),setInterval(()=>{console.log(`SSAO`,a.lastTime)},1e3),setInterval(()=>{console.log(`SSAO`,a.enabled,{ssao:a,autoRenderBeauty:a.configuration.autoRenderBeauty})},4e3)),this.intensity.onValueChanged=e=>{a.configuration.intensity=e},this.falloff.onValueChanged=e=>{a.configuration.distanceFalloff=e},this.aoRadius.onValueChanged=e=>{a.configuration.aoRadius=e},this.color.onValueChanged=t=>{a.color||=new e,a.configuration.color.copy(t)},a}};B([_(),p()],H.prototype,`gammaCorrection`,void 0),B([p(S)],H.prototype,`aoRadius`,void 0),B([p(S)],H.prototype,`falloff`,void 0),B([p(S)],H.prototype,`intensity`,void 0),B([p(S)],H.prototype,`color`,void 0),B([_(),p()],H.prototype,`screenspaceRadius`,void 0),B([_(),p()],H.prototype,`quality`,void 0),T(`ScreenSpaceAmbientOcclusionN8`,H);var Pe=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},U=class extends w{get typeName(){return`Sharpening`}order=b.Sharpening;_effect;onCreateEffect(){return this._effect??=new(Fe()),this.effect}get effect(){return this._effect}set amount(e){this._amount=e,this._effect&&(this._effect.uniforms.get(`amount`).value=e)}get amount(){return this._effect?this._effect.uniforms.get(`amount`).value:this._amount}_amount=1;set radius(e){this._radius=e,this._effect&&(this._effect.uniforms.get(`radius`).value=e)}get radius(){return this._effect?this._effect.uniforms.get(`radius`).value:this._radius}_radius=1};Pe([p()],U.prototype,`amount`,null),Pe([p()],U.prototype,`radius`,null);function Fe(){class e extends g.POSTPROCESSING.MODULE.Effect{constructor(){super(`Sharpening`,` diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js.gz b/Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js.gz new file mode 100644 index 0000000..f3771d0 Binary files /dev/null and b/Needle/MenuScene/dist/assets/needle-engine.extras.1SuflpgE.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js b/Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js similarity index 99% rename from Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js rename to Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js index 6a937da..8326361 100644 --- a/Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js +++ b/Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./needle-engine.CE4b2dOg.js","./needle-engine@5.0.3.js","./rolldown-runtime.CYVBeYYp.js","./needle-engine-webxr.DDCPc9_g.js","./materialx.CnHmG--Y.js","./three@0.169.19.js","./needle-engine-ui.iRWmt52F.js","./gltf-progressive.BBJGcb3s.js","./three-examples@0.169.19.js","./three-mesh-ui.CgGzZ3ml.js","./needle-engine-particles.B21Zru40.js","./three-quarks.DALdLWPD.js","./needle-engine.extras.D-PG1GOa.js","./postprocessing.Wy71DpiM.js","./three-mesh-bvh.B-oXEGo2.js"])))=>i.map(i=>d[i]); -import{d as e}from"./materialx.CnHmG--Y.js";import{A as t,Ar as n,At as r,D as i,Gn as a,Jt as o,Kn as s,Mr as c,Nr as l,Nt as u,P as d,Q as f,Qn as p,Qt as m,R as ee,S as h,T as g,Tn as te,Xt as _,Z as ne,Zn as re,Zt as v,_ as ie,_n as ae,a as oe,d as se,fn as y,fr as ce,gn as le,gr as ue,i as de,in as fe,jr as pe,jt as me,kr as b,kt as he,nr as ge,s as _e,st as ve,tr as ye,tt as be,u as xe,ur as Se,ut as Ce,vn as we,wn as x,x as Te,y as Ee,yn as De}from"./three@0.169.19.js";import{$i as S,A as C,Aa as Oe,An as ke,Ao as Ae,B as je,Br as Me,C as Ne,D as Pe,Di as Fe,Dr as Ie,E as Le,Ea as Re,F as ze,Fa as Be,Fo as Ve,G as He,Ho as Ue,I as We,Io as Ge,Ir as Ke,Jt as qe,Ka as w,Kr as T,L as E,Lo as Je,Ma as Ye,Mo as Xe,Mr as Ze,Ni as Qe,No as $e,Nr as et,Nt as tt,Ot as nt,P as rt,Q as it,Qi as at,S as ot,T as D,Ua as O,Uo as st,W as ct,Wo as lt,X as k,Xi as A,Z as ut,Zi as j,Zn as dt,_ as ft,_a as M,a as pt,ai as mt,ao as ht,at as gt,ba as _t,co as N,cr as P,ct as F,dn as vt,ea as I,eo as yt,f as bt,fi as xt,fn as St,g as Ct,h as wt,hi as Tt,i as Et,io as Dt,j as Ot,ja as kt,jo as At,k as jt,kt as L,l as Mt,la as Nt,ln as Pt,n as Ft,na as It,ni as Lt,o as Rt,oo as zt,ot as R,p as Bt,pa as z,q as Vt,r as B,ra as Ht,s as Ut,sa as Wt,sn as Gt,t as Kt,tr as qt,u as Jt,un as V,uo as Yt,va as Xt,vr as Zt,wa as Qt,wi as $t,x as en,xr as tn,y as nn,ya as rn,yn as an}from"./needle-engine-ui.iRWmt52F.js";import{d as on,g as sn}from"./three-examples@0.169.19.js";import{$t as cn,A as ln,B as un,Bt as dn,C as fn,Ft as pn,G as mn,Gt as hn,H as gn,It as _n,J as vn,K as yn,Kt as bn,L as xn,Lt as Sn,N as Cn,Ot as wn,P as Tn,Qt as En,Rt as Dn,S as On,U as kn,Ut as An,V as jn,Vt as Mn,W as Nn,Wt as Pn,X as Fn,Xt as In,Y as Ln,Yt as Rn,Zt as zn,at as Bn,bt as Vn,cn as Hn,d as Un,dn as Wn,f as Gn,fn as Kn,j as qn,k as Jn,ln as Yn,lt as Xn,m as Zn,mn as Qn,n as $n,nn as er,o as tr,on as nr,pn as rr,q as ir,qt as ar,r as or,rt as sr,sn as cr,st as lr,t as ur,tn as dr,tt as fr,un as pr,w as mr,x as hr,xt as gr,yt as _r}from"./needle-engine-webxr.DDCPc9_g.js";import{r as vr,t as yr}from"./needle-engine-particles.B21Zru40.js";import{a as br,c as xr,d as Sr,f as Cr,h as wr,i as Tr,l as Er,m as Dr,o as Or,p as kr,r as Ar,s as jr,t as Mr,u as Nr}from"./needle-engine.extras.D-PG1GOa.js";var Pr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Fr=N(`debugsignals`),Ir=class{guid};Pr([A()],Ir.prototype,`guid`,void 0);var Lr=class{signal;reaction};Pr([A(Ir)],Lr.prototype,`signal`,void 0),Pr([A(k)],Lr.prototype,`reaction`,void 0);var Rr=class e extends R{static receivers={};static invoke(t){if(e.receivers[t]){let n=e.receivers[t];if(!n)return;for(let e of n)e.invoke(t)}}events;awake(){Fr&&console.log(`SignalReceiver awake`,this)}onEnable(){if(this.events)for(let t of this.events)e.receivers[t.signal.guid]||(e.receivers[t.signal.guid]=[]),e.receivers[t.signal.guid].push(this)}onDisable(){if(this.events){for(let t of this.events)if(e.receivers[t.signal.guid]){let n=e.receivers[t.signal.guid].indexOf(this);n>=0&&e.receivers[t.signal.guid].splice(n,1)}}}invoke(e){if(!this.events||!Array.isArray(this.events))return;let t=typeof e==`object`?e.guid:e;for(let e of this.events)if(e.signal.guid===t)try{if(!e.reaction){console.warn(`Missing reaction for signal`,e,this);continue}else if(!e.reaction.invoke){console.warn(`Missing invoke - possibly a serialization error`,e,this);continue}e.reaction.invoke()}catch(e){console.error(e)}}};Pr([A(Lr)],Rr.prototype,`events`,void 0);var zr;(function(e){e.Activation=`ActivationTrack`,e.Animation=`AnimationTrack`,e.Audio=`AudioTrack`,e.Control=`ControlTrack`,e.Marker=`MarkerTrack`,e.Signal=`SignalTrack`})(zr||={});var Br;(function(e){e[e.None=0]=`None`,e[e.Hold=1]=`Hold`,e[e.Loop=2]=`Loop`,e[e.PingPong=3]=`PingPong`,e[e.Continue=4]=`Continue`})(Br||={});var Vr;(function(e){e.Signal=`SignalEmitter`})(Vr||={});var Hr=N(`debugtimeline`),Ur=class{director;track;get muted(){return this.track.muted}set muted(e){e!==this.track.muted&&(this.track.muted=e,this.onMuteChanged?.call(this))}*forEachClip(e=!1){if(this.track?.clips)if(e)for(let e=this.track.clips.length-1;e>=0;e--)yield this.track.clips[e];else for(let e of this.track.clips)yield e}getClipTime(e,t){return t.clipIn+(e-t.start)*t.timeScale}getClipTimeNormalized(e,t){return(e-t.start)/t.duration}evaluateWeight(e,t,n,r=!0){if(t<0||t>=n.length)return 0;let i=n[t];if(r||e>=i.start&&e<=i.end){let t=1;if(i.easeInDuration>0){let n=Math.min((e-i.start)/i.easeInDuration,1);t*=n}if(i.easeOutDuration>0){let n=Math.min((i.end-e)/i.easeOutDuration,1);t*=n}return t}return 0}},Wr=class{clip;rootPositionOffset;rootQuaternionOffset;get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}rootStartPosition;rootEndPosition;rootStartQuaternion;rootEndQuaternion;constructor(e){let t=e.getClip();this.clip=t;let r=e.getRoot(),i=r.name+`.position`,a=r.name+`.quaternion`;Hr&&console.log(t.name,t.tracks,i);for(let e of t.tracks)if(!(e.times.length<=0)){if(e.name.endsWith(i))this.rootStartPosition=new n().fromArray(e.values,0),this.rootEndPosition=new n().fromArray(e.values,e.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),Hr&&console.log(this.rootPositionOffset);else if(e.name.endsWith(a)&&(this.rootStartQuaternion=new x().fromArray(e.values,0),this.rootEndQuaternion=new x().fromArray(e.values,e.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),Hr)){let e=new be().setFromQuaternion(this.rootQuaternionOffset);console.log(`ROT`,e)}}}},Gr=class extends Ur{models=[];trackOffset;target;mixer;clips=[];actions=[];weight=1;_actionOffsets=[];_didBind=!1;_animator=null;onDisable(){this.mixer?.stopAllAction()}onDestroy(){this.director.context.animations.unregisterAnimationMixer(this.mixer)}onStateChanged(){this._animator&>(this._animator.gameObject,this,this.director.enabled&&this.director.weight>0)}createHooks(e,t){if(t.tracks?.length<=0){console.warn(`No tracks in AnimationClip`,t);return}let n=!1,r=!1,i=t.tracks.find(e=>e.name.includes(`.position`)||e.name.includes(`.quaternion`))?.name.split(`.`);if(i){let a=i[i.length-2],o=a+`.position`,s=a+`.quaternion`;for(let i of t.tracks)!n&&i.name.endsWith(o)?(n=!0,this.createPositionInterpolant(t,e,i)):!r&&i.name.endsWith(s)&&(r=!0,this.createRotationInterpolant(t,e,i))}if(!n||!r){let i=this.mixer?.getRoot(),a=t.tracks[0],o=a.name.lastIndexOf(`.`),s=a.name.substring(0,o),l=s.substring(s.lastIndexOf(`.`)+1),u=i.getObjectByName(l);if(u){if(!n){let n=s+`.position`;Hr&&console.warn(`Create position track`,l,u);let r=new c(n,[0,t.duration],[0,0,0,0,0,0]);t.tracks.push(r),this.createPositionInterpolant(t,e,r)}else if(!r){let n=t.tracks[0].name.substring(0,o)+`.quaternion`;Hr&&console.warn(`Create quaternion track`,l,u);let r=new te(n,[0,t.duration],[0,0,0,1,0,0,0,1]);t.tracks.push(r),this.createRotationInterpolant(t,e,r)}}}}bind(){if(!this._didBind){this._didBind=!0,Hr&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn(`No mixer was assigned to animation track`);for(let e of this.actions){let t=new Wr(e);this._actionOffsets.push(t)}this.target&&(this._animator=F.getComponent(this.target,it)??null,this._animator&>(this._animator.gameObject,this,!0));for(let e of this.models){let t=e.asset,r=t.position,i=t.rotation;r&&r.x!==void 0&&(r.isVector3||(t.position=new n(r.x,r.y,r.z)),i.isQuaternion||(t.rotation=new x(i.x,i.y,i.z,i.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){let e=this.trackOffset.position;e&&(e.isVector3||(this.trackOffset.position=new n(e.x,e.y,e.z)));let t=this.trackOffset.rotation;t&&(t.isQuaternion||(this.trackOffset.rotation=new x(t.x,t.y,t.z,t.w)))}}_useclipOffsets=!0;_totalOffsetPosition=new n;_totalOffsetRotation=new x;_totalOffsetPosition2=new n;_totalOffsetRotation2=new x;_summedPos=new n;_tempPos=new n;_summedRot=new x;_tempRot=new x;_clipRotQuat=new x;evaluate(e){if(this.track.muted||!this.mixer)return;this.bind(),this._totalOffsetPosition.set(0,0,0),this._totalOffsetRotation.set(0,0,0,1),this._totalOffsetPosition2.set(0,0,0),this._totalOffsetRotation2.set(0,0,0,1);let t=0,n=0,r=!1,i=!1,a=0;for(let o=0;o=s.start&&e<=s.end,d=s.preExtrapolationMode,f=s.postExtrapolationMode,p=oe)&&(m=!0,r=!0):o==0&&!m&&!i&&s.start>e&&d!==Br.None&&(!p||p.startte;)h-=te}else if(!u&&r)switch(f){case Br.Hold:h=this.getClipTime(s.end,s);break;case Br.Loop:h%=te;break;case Br.PingPong:let e=Math.floor(h/te)%2!=0;h%=te,e&&(h=te-h);break}s.reversed===!0?c.time=c.getClip().duration-h:c.time=h,c.timeScale=0;let _=Math.max(0,i);if(c.weight=_,a+=_,c.clampWhenFinished=!1,c.isRunning()||c.play(),this._useclipOffsets){let e=t==0?this._totalOffsetPosition:this._totalOffsetPosition2,r=t==0?this._totalOffsetRotation:this._totalOffsetRotation2;t<1&&(n=1-i),t+=1;let a=this._summedPos.set(0,0,0),s=this._tempPos.set(0,0,0),c=this._summedRot.identity(),u=this._tempRot.identity(),d=l.rotation;d&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(d,i));let f=this._actionOffsets[o];if(f.hasOffsets)for(let e=0;e{let e=r(),t=e.evaluate.bind(e);return e.evaluate=e=>{let n=t(e);if(i.set(n[0],n[1],n[2],n[3]),i.premultiply(this._totalOffsetRotation),a&&i.premultiply(a),this.director.animationCallbackReceivers)for(let t of this.director.animationCallbackReceivers)t?.onTimelineRotation?.call(t,this.director,this.target,e,i);return n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=i.w,n},e}}createPositionInterpolant(e,t,r){let i=r.createInterpolant.bind(r),a=new n;this.ensureTrackOffsets();let o=this.trackOffset?.rotation,s=this.trackOffset?.position,c;r.createInterpolant=()=>{let n=i(),r=n.evaluate.bind(n);return n.evaluate=n=>{let i=r(n);if(a.set(i[0],i[1],i[2]),t.removeStartOffset&&(c===void 0?(c=null,c=this._actionOffsets.find(t=>t.clip===e)?.rootStartPosition?.clone()):c?.isVector3&&a.sub(c)),a.applyQuaternion(this._totalOffsetRotation),a.add(this._totalOffsetPosition),o&&a.applyQuaternion(o),s&&(a.x-=s.x,a.y+=s.y,a.z+=s.z),this.director.animationCallbackReceivers)for(let e of this.director.animationCallbackReceivers)e?.onTimelinePosition?.call(e,this.director,this.target,n,a);return i[0]=a.x,i[1]=a.y,i[2]=a.z,i},n}}},Kr=N(`mutetimeline`),qr=class e extends Ur{models=[];listener;audio=[];audioContextTimeOffset=[];lastTime=0;audioSource;_audioLoader=null;getAudioFilePath(e){let t=this.director.sourceId;return At(t,e)}onAllowAudioChanged(e){for(let t=0;t=a.start&&e<=a.end&&e.3?o.offset=a.clipIn+(e-a.start)*a.timeScale:o.offset=0,Hr&&console.log(`Timeline Audio (`+this.track.name+`) play with offset `+o.offset+` - `+a.asset.clip),o.play(r),a._didTriggerPlay=!0);else{let t=a.clipIn+(e-a.start)*a.timeScale,n=o.context.currentTime-o._startedAt+o.offset;Math.abs(t-n)>.3&&(o.offset=t,o.stop(),o.play(r))}let i=s.volume;if(this.track.volume!==void 0&&(i*=this.track.volume),t&&(i=0),a.easeInDuration>0){let t=Math.min((e-a.start)/a.easeInDuration,1);i*=t}if(a.easeOutDuration>0){let t=Math.min((a.end-e)/a.easeOutDuration,1);i*=t}o.setVolume(i*this.director.weight)}else a._didTriggerPlay=!1,this.director.isPlaying&&o.isPlaying&&o.stop()}this.lastTime=e}loadAudio(e,t=0,n=0){let r=null,i=e-n,a=e+t;for(let e of this.models)if(this.isInTimeRange(e,i,a)){let t=this.audio[this.models.indexOf(e)],n=this.handleAudioLoading(e,t);n!==null&&(r===null&&(r=[]),r.push(n))}return r===null?null:Promise.all(r)}isInTimeRange(e,t,n){return t<=e.start&&n>=e.end||t>=e.start&&t<=e.end||n>=e.start&&n<=e.end}static _audioBuffers=new Map;static dispose(){e._audioBuffers.clear()}handleAudioLoading(t,n){this._audioLoader||=new xe;let r=this.getAudioFilePath(t.asset.clip);if(e._audioBuffers.get(r)){let t=e._audioBuffers.get(r);return t.then(e=>{e&&n.setBuffer(e)}),t}Hr&&console.warn(`LOAD audio track`,r,this.director.sourceId);let i=new Promise((e,t)=>{this._audioLoader.load(r,t=>{n.setBuffer(t),e(t)},void 0,t=>{console.error(`Error loading audio`,t),e(null)})});return e._audioBuffers.set(r,i),i}},Jr=class extends Ur{models=[];needsSorting=!0;*foreachMarker(e=null){this.needsSorting&&this.sort();for(let t of this.models)t&&t.type===e&&(yield t)}onEnable(){this.needsSorting=!0}evaluate(e){this.needsSorting&&this.sort()}sort(){this.needsSorting=!1,this.models.sort((e,t)=>e.time-t.time)}},Yr=class extends Ur{models=[];didTrigger=[];receivers=[];evaluate(e){if(this.track.muted)return;let t=this.director.context.time.deltaTime*1.5;for(let n=0;n=1e-5&&e=0;e--){let t=this.models[e].asset;if(!t.sourceObject||typeof t.sourceObject!=`object`){console.log(`no source object, removing model`,e,t),this.models.splice(e,1);continue}else{let e=this.director.constructor,n=F.getComponent(t.sourceObject,e);this.timelines.push(n),n&&t.updateDirector&&(n.playOnAwake=!1)}}}_previousActiveModel=null;evaluate(e){this._previousActiveModel=null;for(let t=0;t=n.start&&e<=n.end){this._previousActiveModel=n;let i=this.getClipTime(e,n);if(r.controlActivation){let e=r.sourceObject;e.visible=!0}if(r.updateDirector){let e=this.timelines[t];e&&(e.isPlaying&&e.pause(),e.time=i,e.evaluate())}}else{let e=this._previousActiveModel?.asset;if(r.controlActivation){let t=r.sourceObject;e?.sourceObject!==t&&(t.visible=!1)}}}}},Zr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qr=N(`debugtimeline`),$r;(function(e){e[e.Hold=0]=`Hold`,e[e.Loop=1]=`Loop`,e[e.None=2]=`None`})($r||={});var ei;(function(e){e[e.None=0]=`None`,e[e.Hold=1]=`Hold`,e[e.Loop=2]=`Loop`,e[e.PingPong=3]=`PingPong`,e[e.Continue=4]=`Continue`})(ei||={});var ti=class e extends R{static createTrackFunctions={};static registerCreateTrack(e,t){this.createTrackFunctions[e]=t}playableAsset;playOnAwake;extrapolationMode=$r.Loop;get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get time(){return this._time}set time(e){typeof e==`number`&&!Number.isNaN(e)?this._time=e:(Qr||Ue())&&console.error(`INVALID TIMELINE.TIME VALUE`,e,this.name)}get duration(){return this._duration}set duration(e){this._duration=e}get weight(){return this._weight}set weight(e){this._weight=e}get speed(){return this._speed}set speed(e){this._speed=e}waitForAudio=!0;_visibilityChangeEvt;_clonedPlayableAsset=!1;_speed=1;awake(){Qr&&console.log(`[Timeline] Awake '${this.name}'`,this),this.rebuildGraph(),!this.isValid()&&(Qr||w())&&(Qr?console.warn(`PlayableDirector is not valid`,`Asset?`,this.playableAsset,`Tracks:`,this.playableAsset?.tracks,`IsArray?`,Array.isArray(this.playableAsset?.tracks),this):this.playableAsset?.tracks?.length?console.warn(`PlayableDirector is not valid`):console.warn(`PlayableDirector has no tracks`))}onEnable(){Qr&&console.log(`[Timeline] OnEnable`,this.name,this.playOnAwake);for(let e of this._audioTracks)e.onEnable?.();for(let e of this._customTracks)e.onEnable?.();for(let e of this._animationTracks)e.onEnable?.();this.playOnAwake&&this.play(),this._visibilityChangeEvt||=()=>{switch(document.visibilityState){case`hidden`:this.setAudioTracksAllowPlaying(!1);break;case`visible`:this.setAudioTracksAllowPlaying(!0);break}},window.addEventListener(`visibilitychange`,this._visibilityChangeEvt)}onDisable(){Qr&&console.log(`[Timeline] OnDisable`,this.name),this.stop();for(let e of this._audioTracks)e.onDisable?.();for(let e of this._customTracks)e.onDisable?.();for(let e of this._animationTracks)e.onDisable?.();this._visibilityChangeEvt&&window.removeEventListener(`visibilitychange`,this._visibilityChangeEvt)}onDestroy(){for(let e of this._allTracks)for(let t of e)t.onDestroy?.()}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;let e=this._isPaused==1;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,e&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){let e=[];for(let t of this._audioTracks){let n=t.loadAudio(this._time,1,0);n&&e.push(n)}if(e.length>0&&(await Promise.all(e),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Kn.userInteractionRegistered&&this.waitForAudio;)await zt(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),an.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(let e of this._audioTracks)e.stop();let e=this._isPaused==1,t=this._isPlaying;this._isPlaying&&(this._time=0,this._isPlaying=!1,this._isPaused=!1,this.internalEvaluate(),e&&this.invokePauseChangedMethodsOnTracks()),this._isPlaying=!1,this._isPaused=!1,e&&!t&&this.invokePauseChangedMethodsOnTracks(),t&&this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine&&this.stopCoroutine(this._internalUpdateRoutine),this._internalUpdateRoutine=null,this._isStopping=!1}evaluate(){this.internalEvaluate(!0)}isValid(){return this.playableAsset&&this.playableAsset.tracks&&Array.isArray(this.playableAsset.tracks)}*forEachTrack(){for(let e of this._allTracks)for(let t of e)yield t}get animationTracks(){return this._animationTracks}get audioTracks(){return this._audioTracks}get signalTracks(){return this._signalTracks}get markerTracks(){return this._markerTracks}*foreachMarker(e=null){for(let t of this._markerTracks)for(let n of t.foreachMarker(e))yield n}_guidsMap;resolveGuids(e){this._guidsMap=e}_isPlaying=!1;_internalUpdateRoutine;_isPaused=!1;_isStopping=!1;_time=0;_duration=0;_weight=1;_animationTracks=[];_audioTracks=[];_signalTracks=[];_markerTracks=[];_controlTracks=[];_customTracks=[];_tracksArray=[];get _allTracks(){return this._tracksArray.length=0,this._tracksArray.push(this._animationTracks),this._tracksArray.push(this._audioTracks),this._tracksArray.push(this._signalTracks),this._tracksArray.push(this._markerTracks),this._tracksArray.push(this._controlTracks),this._tracksArray.push(this._customTracks),this._tracksArray}invokePauseChangedMethodsOnTracks(){for(let e of this.forEachTrack())e.onPauseChanged?.call(e)}invokeStateChangedMethodsOnTracks(){for(let e of this.forEachTrack())e.onStateChanged?.call(e,this._isPlaying)}*internalUpdate(){for(;this._isPlaying&&this.activeAndEnabled;)!this._isPaused&&this._isPlaying&&(this._time+=this.context.time.deltaTime*this.speed,this.internalEvaluate()),yield}internalEvaluate(e=!1){if(!this.isValid())return;let t=this._time;switch(this.extrapolationMode){case $r.Hold:this._speed>0?t=Math.min(t,this._duration):this._speed<0&&(t=Math.max(t,0)),this._time=t;break;case $r.Loop:t%=this._duration,this._time=t;break;case $r.None:if(t>this._duration){this.stop();return}break}let n=this._time;for(let t of this.playableAsset.tracks)if(!t.muted)switch(t.type){case zr.Activation:if(!e&&!this._isPlaying)continue;for(let e=0;e=0;r--){let i=n.outputs[r];if(typeof i==`string`){this._guidsMap&&this._guidsMap[i]&&(i=this._guidsMap[i]);let e=F.findByGuid(i,t);typeof e!=`object`||!e?(n.outputs.splice(r,1),console.warn(`Failed to resolve binding`,i,n.name,n.type)):(Qr&&console.log(`Resolved binding`,i,`to`,e),n.outputs[r]=e)}else if(i===null){if(n.outputs.splice(r,1),e.createTrackFunctions[n.type])continue;n.type!==zr.Audio&&n.type!==zr.Control&&n.type!==zr.Marker&&n.type!==zr.Signal&&console.warn(`Missing binding`,i,n.name,n.type,this.name,this.playableAsset.name)}}if(n.type===zr.Control&&n.clips)for(let e=0;ethis._duration&&(this._duration=t.end);if(e.markers)for(let t of e.markers)t.time>this._duration&&(this._duration=t.time+.001)}}}setupAndCreateTrackHandlers(){if(this._animationTracks.length=0,this._audioTracks.length=0,this._signalTracks.length=0,!this.playableAsset)return;let t=F.findObjectOfType(rr,this.context);for(let n of this.playableAsset.tracks){let r=n.type,i=e.createTrackFunctions[r];if(i!=null){let e=i(this,n);if(typeof e.evaluate==`function`){e.director=this,e.track=n,this._customTracks.push(e);continue}}if(n.type===zr.Animation){if(!n.clips||n.clips.length<=0){Qr&&console.warn(`Animation track has no clips`,n);continue}for(let e=n.outputs.length-1;e>=0;e--){let t=n.outputs[e];if(t instanceof y){let e=F.getOrAddComponent(t,it);e&&(t=e)}let r=t?.gameObject?.animations;if(r){let e=new Gr;e.trackOffset=n.trackOffset,e.director=this,e.track=n;for(let i=0;ie.name===s)),Qr&&console.log(o,s,`→`,c),!c){console.warn(`Could not find animationClip for model`,a,n.name,this.name,this.playableAsset?.name,r,t);continue}t instanceof it&&t.runtimeAnimatorController&&(t.__internalDidAwakeAndStart||t.initializeRuntimeAnimatorController(),t.runtimeAnimatorController.mixer||t.runtimeAnimatorController.bind(t),e.mixer=t.runtimeAnimatorController.mixer),e.mixer||(e.mixer=new oe(t.gameObject),this.context.animations.registerAnimationMixer(e.mixer)),e.clips.push(c),e.mixer.uncacheAction(c),e.createHooks(a.asset,c);let l=e.mixer.clipAction(c);e.actions.push(l),e.models.push(a)}this._animationTracks.push(e)}}}else if(n.type===zr.Audio){if(!n.clips||n.clips.length<=0)continue;let e=new qr;e.director=this,e.track=n,e.audioSource=n.outputs.find(e=>e instanceof Kn),this._audioTracks.push(e),t||=this.context.mainCameraComponent?.gameObject.addComponent(rr),e.listener=t.listener;for(let t=0;t0){let t=F.getComponent(this.gameObject,Rr);t&&(e.receivers.push(t),this._signalTracks.push(e))}t!==null&&t.models.length>0&&this._markerTracks.push(t)}}else if(n.type===zr.Signal){let e=new Yr;if(e.director=this,e.track=n,n.markers)for(let t of n.markers)e.models.push(t),e.didTrigger.push(!1);for(let t of n.outputs)e.receivers.push(t);this._signalTracks.push(e)}else if(n.type===zr.Control){let e=new Xr;if(e.director=this,e.track=n,n.clips)for(let t of n.clips)e.models.push(t);e.resolveSourceObjects(this.context),this._controlTracks.push(e)}}}setAudioTracksAllowPlaying(e){for(let t of this._audioTracks)t.onAllowAudioChanged(e)}animationCallbackReceivers=[];registerAnimationCallback(e){this.animationCallbackReceivers.push(e)}unregisterAnimationCallback(e){let t=this.animationCallbackReceivers.indexOf(e);t!==-1&&this.animationCallbackReceivers.splice(t,1)}};Zr([A()],ti.prototype,`playOnAwake`,void 0),Zr([A()],ti.prototype,`extrapolationMode`,void 0);var ni={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},ri={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]},ii=class extends p{constructor(e){super(),this.position.y=-3.5;let t=new Ee;t.deleteAttribute(`uv`);let n=new fe({metalness:0,side:1}),r=new fe({metalness:0}),i=e==`legacy`?ni:ri,a=new De(16777215,i.topLight.intensity,28,2);a.position.set(...i.topLight.position),this.add(a);let o=new v(t,n);o.position.set(...i.room.position),o.scale.set(...i.room.scale),this.add(o);for(let e of i.boxes){let n=new v(t,r);n.position.set(...e.position),n.rotation.set(0,e.rotation,0),n.scale.set(...e.scale),this.add(n)}for(let e of i.lights){let n=new v(t,this.createAreaLightMaterial(e.intensity));n.position.set(...e.position),n.scale.set(...e.scale),this.add(n)}}createAreaLightMaterial(e){let t=new m;return t.color.setScalar(e),t}};async function ai(t){let{NeedleEngineWebComponent:n}=await e(async()=>{let{NeedleEngineWebComponent:e}=await import(`./needle-engine.CE4b2dOg.js`);return{NeedleEngineWebComponent:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url);n.observedAttributes.includes(t)||n.observedAttributes.push(t)}var H=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},U=N(`debugsceneswitcher`),oi=N(`sceneswitcher:clearscene`),si=`scene`;function ci(){ai(si)}var li=Promise.resolve(!1),W=class extends R{autoLoadFirstScene=!0;scenes=[];loadingScene;queryParameterName=`scene`;useSceneName=!0;clamp=!0;useHistory=!0;useKeyboard=!0;useSwipe=!0;useSceneLighting=!0;useSceneBackground=!0;preloadNext=1;preloadPrevious=1;preloadConcurrent=2;createMenuButtons=!1;get currentIndex(){return this._currentIndex}get currentLoadingProgress(){return this._currentLoadingProgress}get currentlyLoadingScene(){return this._currentlyLoadingScene}get currentlyLoadedScene(){return this._currentScene}sceneLoadingStart=new k;sceneLoadingProgress=new k;sceneLoaded=new k;_currentIndex=-1;_currentScene=void 0;_currentSceneAsset=void 0;_engineElementOverserver=void 0;_preloadScheduler;_menuButtons;__lastSwitchScene;__lastSwitchScenePromise;awake(){this._currentScene=void 0,this._lastLoadingScene=void 0,this.__lastSwitchScenePromise=void 0,this.scenes===void 0&&(this.scenes=[]);for(let e of this.scenes)e&&!e.hasUrl&&e.asset instanceof y?F.remove(e.asset):e instanceof y&&F.remove(e);U&&console.log(`SceneSwitcher`,this)}async onEnable(){if(globalThis.addEventListener(`popstate`,this.onPopState),this.context.input.addEventListener(Ie.KeyDown,this.onInputKeyDown),this.context.input.addEventListener(Ie.PointerMove,this.onInputPointerMove),this.context.input.addEventListener(Ie.PointerUp,this.onInputPointerUp),this._engineElementOverserver||=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===si){let e=this.context.domElement.getAttribute(si);e!==null&&this.trySelectSceneFromValue(e)}}),this._engineElementOverserver.observe(this.context.domElement,{attributes:!0}),this._preloadScheduler||=new di(this),this._preloadScheduler.maxLoadAhead=this.preloadNext,this._preloadScheduler.maxLoadBehind=this.preloadPrevious,this._preloadScheduler.maxConcurrent=this.preloadConcurrent,this._preloadScheduler.begin(2e3),this.autoLoadFirstScene&&this._currentIndex===-1&&!await this.tryLoadFromQueryParam()){let e=this.context.domElement.getAttribute(si);try{(e===null||!await this.trySelectSceneFromValue(e))&&this._currentIndex===-1&&this.select(0)}finally{}}this.createMenuButtons&&(this._menuButtons??=[],this._menuButtons.push(this.context.menu.appendChild({label:`Previous`,icon:`arrow_back_ios`,onClick:()=>this.selectPrev(),priority:-1005,class:`row2`})),this._menuButtons.push(this.context.menu.appendChild({label:`Next`,icon:`arrow_forward_ios`,iconSide:`right`,onClick:()=>this.selectNext(),priority:-1e3,class:`row2`})))}onDisable(){if(globalThis.removeEventListener(`popstate`,this.onPopState),this.context.input.removeEventListener(Ie.KeyDown,this.onInputKeyDown),this.context.input.removeEventListener(Ie.PointerMove,this.onInputPointerMove),this.context.input.removeEventListener(Ie.PointerUp,this.onInputPointerUp),this._preloadScheduler?.stop(),this._menuButtons){for(let e of this._menuButtons)e.remove();this._menuButtons=void 0}}onPopState=async e=>{if(!this.useHistory)return;let t=this.useHistory;try{this.useHistory=!1;let t=!1;if(this.queryParameterName&&(t=await this.tryLoadFromQueryParam()),!t){let t=e?.state;if(t&&t.startsWith(this.guid)){let e=t.substr(this.guid.length+2);U&&console.log(`PopState`,e),await this.trySelectSceneFromValue(e)}}}finally{this.useHistory=t}};normalizedSwipeThresholdX=.1;_didSwipe=!1;onInputPointerMove=e=>{if(this.useSwipe&&!this._didSwipe&&e.button===0&&e.pointerType===`touch`&&this.context.input.getPointerPressedCount()===1){let t=this.context.input.getPointerPositionDelta(e.button);if(t){let e=t.x/this.context.domWidth;e>=this.normalizedSwipeThresholdX?(this._didSwipe=!0,this.selectPrev()):e<=-this.normalizedSwipeThresholdX&&(this._didSwipe=!0,this.selectNext())}}};onInputPointerUp=e=>{e.button===0&&(this._didSwipe=!1)};onInputKeyDown=e=>{if(!this.useKeyboard||!this.scenes)return;let t=e.key.toLowerCase();if(!t)return;let n=parseInt(t)-1;if(n>=0){this.trySelectSceneFromValue(n);return}switch(t){case`arrowright`:case`d`:this.selectNext();break;case`arrowleft`:case`a`:this.selectPrev();break}};addScene(e){if(typeof e==`string`){let t=this.context.addressables.findAssetReference(e);return t||(t=new Me(e),this.context.addressables.registerAssetReference(t)),this.scenes.push(t),t}return this.scenes.push(e),e}selectNext(){return this.select(this._currentIndex+1)}selectPrev(){return this.select(this._currentIndex-1)}select(e){if(U&&console.log(`[SceneSwitcher] select`,e),typeof e==`object`&&console.warn(`[SceneSwitcher] Switching to "`+e+`" might not work. Please either use an index or a AssetReference (not a scene reference)`),typeof e==`string`){let t=this.scenes?.find(t=>t.url===e);if(!t){let t=Me.getOrCreate(this.sourceId??``,e,this.context);return this.switchScene(t)}if(t)e=this.scenes?.indexOf(t);else return li}if(!this.scenes?.length)return li;if(e<0){if(this.clamp)return li;e=this.scenes.length-1}else if(e>=this.scenes.length){if(this.clamp)return li;e=0}let t=this.scenes[e];return this.switchScene(t)}unload(){return this.__lastSwitchScene=void 0,this.__lastSwitchScenePromise=void 0,this.__unloadCurrentScene()}async reload(){if(this.__lastSwitchScene){let e=this.__lastSwitchScene;return this.__lastSwitchScene=void 0,this.switchScene(e)}return!1}async switchScene(e){if(!(e instanceof Me)){let t=typeof e;if(t===`string`||t===`number`)return this.select(e);if(e&&e instanceof y){let t=this.scenes?.indexOf(e);e=new Me(e.name,void 0,e),t>=0&&(this.scenes[t]=e)}else return console.warn(`[SceneSwitcher] Can't switch to scene of type ${t}`),!1}return e.url===this.sourceId?(console.warn(`[SceneSwitcher] Can't load own scene - prevent recursive loading`,this.sourceId),!1):this.__lastSwitchScene===e&&this.__lastSwitchScenePromise?this.__lastSwitchScenePromise:(this.__lastSwitchScene=e,this.__lastSwitchScenePromise=this.__internalSwitchScene(e),await this.__lastSwitchScenePromise)}async __unloadCurrentScene(){let e=this._currentScene;if(this._currentScene=void 0,e){U&&console.log(`[SceneSwitcher] UNLOAD`,e.url,`HasURL?: `+e.hasUrl);let t=this.tryGetSceneEventListener(e.asset);if(t?.sceneClosing){let e=t.sceneClosing();e instanceof Promise&&await e}e.hasUrl?(e.unload(),this._currentSceneAsset&&L(this._currentSceneAsset,!0,!1)):F.remove(this._currentSceneAsset)}}_currentlyLoadingScene;async __internalSwitchScene(e){await this.__unloadCurrentScene();let t=this._currentIndex=this.scenes?.indexOf(e)??-1;try{U&&console.debug(`${Date.now()} [SceneSwitcher] Loading scene start: ${e.url} (index: ${t})`),this._currentlyLoadingScene=e,this._currentLoadingProgress=new ProgressEvent(`progress`,{loaded:0,total:1});let n=new CustomEvent(`loadscene-start`,{detail:{scene:e,switcher:this,index:t}});this.dispatchEvent(n),this.sceneLoadingStart?.invoke(n.detail),await this.onStartLoading(),await e.loadAssetAsync((t,n)=>{if(U){let t=n.loaded/n.total,r=`[`+`=`.repeat(Math.floor(t*20))+`-`.repeat(20-Math.floor(t*20))+`]`;console.debug(`${Date.now()} [SceneSwitcher] Loading scene progress: ${(t*100).toFixed(1)} % ${r}`,e.url)}this._currentLoadingProgress=n,this.dispatchEvent(n),this.sceneLoadingProgress?.invoke(n)}).catch(console.error),await this.onEndLoading();let r=new CustomEvent(`loadscene-finished`,{detail:{scene:e,switcher:this,index:t}});if(this.dispatchEvent(r),this._currentLoadingProgress=void 0,this._currentlyLoadingScene=void 0,r.defaultPrevented)return U&&console.warn(`[SceneSwitcher] Adding loaded scene prevented:`,e,r),!1;if(!e.asset)return U&&console.warn(`[SceneSwitcher] Failed loading scene:`,e),!1;if(this._currentIndex===t){if(U&&console.log(`[SceneSwitcher] ADD`,e.url),this._currentScene=e,oi){let e=this.context.mainCameraComponent?.gameObject||this.context.mainCamera;e?.removeFromParent();let t=this.gameObject.removeFromParent();L(this.context.scene,!0,!0),this.context.scene=new p,this.context.scene.add(t),e&&this.context.scene.add(e)}if(e.asset.parent?this._currentSceneAsset=tt(e.asset,{parent:this.gameObject}):(this._currentSceneAsset=e.asset,F.add(e.asset,this.gameObject)),this.useSceneLighting&&this.context.sceneLighting.enable(e),this.useSceneBackground){let t=this.context.lightmaps.tryGetSkybox(e.url);t?(t.mapping!==306&&(t.mapping=303),this.context.scene.background=t):U&&console.warn(`[SceneSwitcher] Can't find skybox for scene `+e.url)}if(this.useHistory&&t>=0){let n=t.toString();if(this.useSceneName&&(e instanceof y?n=e.name:e.url&&(n=ui(e.url))),this.queryParameterName?.length)Ve(this.queryParameterName,n,this.useHistory);else{let e=history.state,n=this.guid+`::`+t;e!==n&&history.pushState(n,`unused`,location.href)}}let n=this.tryGetSceneEventListener(e.asset);if(n?.sceneOpened){let e=n.sceneOpened(this);e instanceof Promise&&await e}U&&console.debug(`${Date.now()} [SceneSwitcher] Loading scene finished: ${e.url} (index: ${t})`);let r=new CustomEvent(`scene-opened`,{detail:{scene:e,switcher:this,index:t}});return this.dispatchEvent(r),this.sceneLoaded?.invoke(this),!0}}catch(e){console.error(e)}return!1}preload(e){if(e>=0&&e=0&&t=0&&ee!=null),await this._loadingScenePromise,this._isCurrentlyLoading&&this.loadingScene?.asset)){U&&console.log(`Add loading scene`,this.loadingScene.url,this.loadingScene.asset);let e=this.loadingScene.asset;F.add(e,this.gameObject);let t=this.tryGetSceneEventListener(e);if(t?.sceneOpened){let e=t.sceneOpened(this);e instanceof Promise&&await e}}if(this._isCurrentlyLoading){let e=this.tryGetSceneEventListener(this.gameObject);if(e&&e.sceneOpened){let t=e.sceneOpened(this);t instanceof Promise&&await t}}}async onEndLoading(){if(this._isCurrentlyLoading=!1,this.loadingScene?.asset){U&&console.log(`Remove loading scene`,this.loadingScene.url);let e=this.loadingScene.asset,t=this.tryGetSceneEventListener(e);if(typeof t?.sceneClosing==`function`){let e=t.sceneClosing();e instanceof Promise&&await e}F.remove(e)}if(!this._isCurrentlyLoading){let e=this.tryGetSceneEventListener(this.gameObject);if(e&&e.sceneClosing){let t=e.sceneClosing();t instanceof Promise&&await t}}}tryGetSceneEventListener(e,t=0){if(!e)return null;let n=F.foreachComponent(e,e=>{let t=e;if(t.sceneClosing||t.sceneOpened)return t});if(t===0&&!n&&e.children.length)for(let n of e.children){let e=this.tryGetSceneEventListener(n,t+1);if(e)return e}return n||null}};H([A()],W.prototype,`autoLoadFirstScene`,void 0),H([A(Me)],W.prototype,`scenes`,void 0),H([A(Me)],W.prototype,`loadingScene`,void 0),H([A()],W.prototype,`queryParameterName`,void 0),H([A()],W.prototype,`useSceneName`,void 0),H([A()],W.prototype,`clamp`,void 0),H([A()],W.prototype,`useHistory`,void 0),H([A()],W.prototype,`useKeyboard`,void 0),H([A()],W.prototype,`useSwipe`,void 0),H([A()],W.prototype,`useSceneLighting`,void 0),H([A()],W.prototype,`useSceneBackground`,void 0),H([A()],W.prototype,`preloadNext`,void 0),H([A()],W.prototype,`preloadPrevious`,void 0),H([A()],W.prototype,`preloadConcurrent`,void 0),H([A()],W.prototype,`createMenuButtons`,void 0),H([A(k)],W.prototype,`sceneLoadingStart`,void 0),H([A(k)],W.prototype,`sceneLoadingProgress`,void 0),H([A(k)],W.prototype,`sceneLoaded`,void 0);function ui(e){let t=e.split(`/`).pop()?.split(`.`).shift();return t?.length?t:e}var di=class{maxLoadAhead;maxLoadBehind;maxConcurrent;_isRunning=!1;_switcher;_loadTasks=[];_maxConcurrentLoads=1;constructor(e,t=1,n=1,r=2){this._switcher=e,this.maxLoadAhead=t,this.maxLoadBehind=n,this.maxConcurrent=r}begin(e){if(this._isRunning)return;U&&console.log(`[SceneSwitcher] Preload scheduled`,{delay:e}),this._isRunning=!0;let t=-10,n,r,i=this._switcher.scenes,a=Date.now()+e,o=setInterval(()=>{if(this.allLoaded()&&(U&&console.log(`[SceneSwitcher] All scenes (pre-)loaded`),this.stop()),!this._isRunning){clearInterval(o);return}if(Date.now()s)return;let c=e?t+n:t-n;if(!(c<0)&&!(c<0||c>=i.length)&&!this._loadTasks.some(e=>e.index===c)){let n=i[c];U&&console.log(`[SceneSwitcher] Schedule preload scene`,{roomIndex:c,searchForward:e,lastRoom:t,currentIndex:this._switcher.currentIndex,tasks:this._loadTasks.length},n?.url),new fi(c,n,this._loadTasks)}},200)}stop(){this._isRunning=!1}canLoadNewScene(){return this._loadTasks.length=0&&this.tasks.splice(e,1)}},pi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},G=N(`debugskybox`);function mi(){ai(`background-image`),ai(`environment-image`)}var hi={studio:{url:`https://cdn.needle.tools/static/skybox/modelviewer-Neutral.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.pmrem4x4.ktx2?pmrem`},"blurred-skybox":{url:`https://cdn.needle.tools/static/skybox/blurred-skybox.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/blurred-skybox-small.pmrem4x4.ktx2?pmrem`},"quicklook-ar":{url:`https://cdn.needle.tools/static/skybox/QuickLook-ARMode.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.pmrem4x4.ktx2?pmrem`},quicklook:{url:`https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.pmrem4x4.ktx2?pmrem`}};function gi(e,t,n,r,i){if(t===`transparent`||t?.startsWith(`rgb`)||t?.startsWith(`#`))return console.warn(`Needle Engine: Invalid ${i} value (${t}). Did you mean to set background-color instead?`),null;let a=new vi;a.sourceId=Je(t),a.allowDrop=!1,a.allowNetworking=!1,a.background=n,a.environment=r,F.addComponent(e.scene,a);let o=t=>{if(G&&console.log(i,`CHANGED TO`,t),t){if(typeof t!=`string`){console.warn(`Invalid attribute value for `+i);return}a.setSkybox(t)}else if(a.sourceId&&(r&&(e.sceneLighting.internalEnableReflection(a.sourceId)||(e.scene.environment=null)),n)){let t=e.lightmaps.tryGetSkybox(a.sourceId);e.scene.background=t}};return Dt(e.domElement,i,o),a.addEventListener(`destroy`,()=>{G&&console.log(`Destroyed attribute remote skybox`,i),Ae(e.domElement,i,o)}),a.setSkybox(t)}var _i=[];lt.registerCallback(st.ContextCreationStart,e=>{let t=e.context,n=t.domElement.getAttribute(`background-image`),r=t.domElement.getAttribute(`environment-image`);if(n){G&&console.log(`Creating RemoteSkybox to load background `+n);let e=gi(t,n,!0,!1,`background-image`);e&&_i.push(e)}if(r){G&&console.log(`Creating RemoteSkybox to load environment `+r);let e=gi(t,r,!1,!0,`environment-image`);e&&_i.push(e)}}),lt.registerCallback(st.ContextCreationStart,()=>Promise.all(_i).finally(()=>{_i.length=0}));var vi=class extends R{url=`studio`;allowDrop=!0;background=!0;environment=!0;allowNetworking=!0;_prevUrl;_prevLoadedEnvironment;_prevEnvironment=null;_prevBackground=null;onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,Ne.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),this.context.mainCameraComponent?.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):G&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(e,t){if(!this.activeAndEnabled||(e=yi(e,this.environment,this.background),!e))return!1;if(t??=e,this.isValidTextureType(t)||console.warn(`Potentially invalid skybox URL: "`+t+`" on `+(this.name||this.gameObject?.name||`context`)),G&&console.log(`Set RemoteSkybox url: `+e),this._prevUrl===e&&this._prevLoadedEnvironment)return this.apply(),!0;this._prevLoadedEnvironment?.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=e;let n=await pr(e,this.context.renderer);return n?!this.enabled||this.destroyed?(G&&console.warn(`RemoteSkybox: Component is disabled or destroyed`),!1):this._prevUrl===e?(this.url=e,this._prevLoadedEnvironment=n,this.apply(),!0):(G&&console.warn(`RemoteSkybox: URL changed while loading texture, aborting setSkybox`),!1):(G&&console.warn(`RemoteSkybox: Failed to load texture from url`,e),!1)}apply(){let e=this._prevLoadedEnvironment;if(e&&(e instanceof ee||e instanceof d||e.mapping==306||(e.mapping=304,e.needsUpdate=!0),!this.destroyed)){if(!this.context){console.warn(`RemoteSkybox: Context is not available - can not apply skybox.`);return}this.context.scene.background!==e&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==e&&(this._prevEnvironment=this.context.scene.environment),G&&console.log(`Set RemoteSkybox (`+(this.environment&&this.background?`environment and background`:this.environment?`environment`:this.background?`background`:`none`)+`)`,this.url,!Ne.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=e),this.background&&!Ne.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=e),this.context.mainCameraComponent?.backgroundBlurriness!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness)}}validProtocols=[`file:`,`blob:`,`data:`];validTextureTypes=[`.ktx2`,`.hdr`,`.exr`,`.jpg`,`.jpeg`,`.png`];isRemoteTexture(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}isValidTextureType(e){for(let t of this.validTextureTypes)if(e.includes(t))return!0;for(let t of this.validProtocols)if(e.startsWith(t))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener(`dragover`,this.onDragOverEvent),this.context.domElement.addEventListener(`drop`,this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener(`dragover`,this.onDragOverEvent),this.context.domElement.removeEventListener(`drop`,this.onDrop)}onDragOverEvent=e=>{if(this.allowDrop&&e.dataTransfer)for(let t of e.dataTransfer.types)(t===`text/uri-list`||t===`Files`)&&e.preventDefault()};onDrop=e=>{if(this.allowDrop&&e.dataTransfer){for(let t of e.dataTransfer.types)if(G&&console.log(t),t===`text/uri-list`){let n=e.dataTransfer.getData(t);G&&console.log(t,n);let r=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?.+)\.png/).exec(n)?.groups?.name;if(r||=new RegExp(/polyhaven\.com\/a\/(?.+)/).exec(n)?.groups?.name,G&&console.log(r),r){let t=`https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/`+r+`_1k.exr`;console.log(`[Remote Skybox] Setting skybox from url: ${t}`),e.preventDefault(),this.setSkybox(t);break}else if(this.isValidTextureType(n)){console.log(`[Remote Skybox] Setting skybox from url: `+n),e.preventDefault(),this.setSkybox(n);break}else{console.warn(`[RemoteSkybox] Unknown url ${n}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(`, `)}.`);let t=new CustomEvent(`dropped-unknown-url`,{detail:{sender:this,event:e,url:n,apply:t=>{e.preventDefault(),this.setSkybox(t)}}});this.dispatchEvent(t)}}else if(t==`Files`){let n=e.dataTransfer.files.item(0);if(G&&console.log(t,n),!n)continue;if(!this.isValidTextureType(n.name)){console.warn(`[RemoteSkybox]: File \"${n.name}\" is not supported. Supported files are ${this.validTextureTypes.join(`, `)}`);return}e.preventDefault(),this.setSkybox(n.name);break}}}};pi([Wn(vi.prototype.urlChangedSyncField),A(URL)],vi.prototype,`url`,void 0),pi([A()],vi.prototype,`allowDrop`,void 0),pi([A()],vi.prototype,`background`,void 0),pi([A()],vi.prototype,`environment`,void 0),pi([A()],vi.prototype,`allowNetworking`,void 0);function yi(e,t,n){if(e==null)return null;let r=t&&!n,i=hi[e.toLowerCase()];return i?r?i.url_low:i.url:(typeof e==`string`&&e?.length&&(w()||G)&&(e.includes(`/`)||e.includes(`.`)||console.warn(`RemoteSkybox: Unknown magic skybox name "${e}". Valid names are: ${Object.keys(hi).map(e=>`"${e}"`).join(`, `)}`)),e)}var bi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xi=class extends R{from;to;width=0;centered=!0;_centerPos;awake(){this._centerPos=new n}update(){if(!this.from||!this.to)return;let e=M(this.from).clone(),t=M(this.to).clone(),n=e.distanceTo(t);this._centerPos.copy(e),this._centerPos.add(t),this._centerPos.multiplyScalar(.5),Oe(this.gameObject,this.centered?this._centerPos:e),this.gameObject.lookAt(M(this.to).clone()),this.gameObject.scale.set(this.width,this.width,n)}};bi([A(F)],xi.prototype,`from`,void 0),bi([A(F)],xi.prototype,`to`,void 0);var Si=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ci=class extends R{length=1;depthTest=!0;isGizmo=!1;_axes=null;onEnable(){if(this.isGizmo&&!Lt)return;this._axes||=new se(this.length),this._axes.layers.disableAll(),this._axes.layers.set(this.layer),this.gameObject.add(this._axes);let e=this._axes.material;e&&e.depthTest!==void 0&&(e.depthTest=this.depthTest)}onDisable(){this._axes&&this.gameObject.remove(this._axes)}};Si([A()],Ci.prototype,`length`,void 0),Si([A()],Ci.prototype,`depthTest`,void 0),Si([A()],Ci.prototype,`isGizmo`,void 0);var wi=class extends R{from;to;hint;desiredDistance=1;onEnable(){}update(){if(!this.from||!this.to||!this.hint)return;let e=M(this.to).clone(),t=M(this.from).clone(),r=e.distanceTo(t),i=e.clone();i.sub(t);let a=t.clone();a.add(e),a.multiplyScalar(.5);let o=M(this.hint).clone();o.sub(a);let s=new n;s.crossVectors(o,i),s.crossVectors(i,s),s.normalize();let c=r*.5,l=Math.max(this.desiredDistance,c),u=Math.sqrt(l*l-c*c),d=s.clone();d.multiplyScalar(u),d.add(a),Oe(this.gameObject,d);let f=a.clone();f.sub(s),this.gameObject.lookAt(f)}},Ti=N(`gizmos`),Ei=N(`debugboxhelper`),Di=class e extends R{box=null;static testBox=new ie;_lastMatrixUpdateFrame=-1;static _position=new n;static _size=new n(.01,.01,.01);static _emptyObjectSize=new n(.01,.01,.01);isInBox(t){if(!t)return;if(this.box||=new ie,Nt([t],void 0,void 0,e.testBox),e.testBox.isEmpty()){let n=M(t,e._position);e.testBox.setFromCenterAndSize(n,e._emptyObjectSize)}this.updateBox();let n=this.box?.intersectsBox(e.testBox);return n&&Ei&&V.DrawWireBox3(e.testBox,16711680,5),n}intersects(e){return e?this.updateBox(!1).intersectsBox(e):!1}updateBox(t=!1){if(this.box||=new ie,t||this.context.time.frameCount!=this._lastMatrixUpdateFrame){let t=this._lastMatrixUpdateFrame<0;this._lastMatrixUpdateFrame=this.context.time.frameCount;let n=t,r=M(this.gameObject,e._position,n),i=_t(this.gameObject,e._size);this.box.setFromCenterAndSize(r,i)}return this.box}_helper=null;_color=null;awake(){this._helper=null,this._color=null,this.box=null}showHelper(e=null,t=!1){if(!(!Ti&&!t)){if(this._helper){e&&this._color?.set(e),this.gameObject.add(this._helper);return}this._helper=Pt(e),this.gameObject.add(this._helper)}}},Oi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ki=N(`debugcharactercontroller`),Ai=class extends R{center=new n(0,0,0);radius=.5;height=2;_rigidbody=null;get rigidbody(){return this._rigidbody?this._rigidbody:(this._rigidbody=this.gameObject.getComponent(E),this._rigidbody||=this.gameObject.addComponent(E),this.rigidbody)}_activeGroundCollisions;awake(){this._activeGroundCollisions=new Set}onEnable(){let e=this.rigidbody,t=this.gameObject.getComponent(Mn);t||=this.gameObject.addComponent(Mn),t.center.copy(this.center),t.radius=this.radius,t.height=this.height;let r=new n(0,0,1),i=new n(1,0,0),a=new n(0,1,0),o=this.gameObject.getWorldDirection(new n);o.y=0;let s=i.dot(o)<0?-1:1,c=r.angleTo(o)*s;this.gameObject.setRotationFromAxisAngle(a,c),e.lockRotationX=!0,e.lockRotationY=!0,e.lockRotationZ=!0}move(e){this.gameObject.position.add(e)}onCollisionEnter(e){(e.contacts.length==0||e.contacts.some(e=>e.normal.y>.2))&&(this._activeGroundCollisions.add(e),ki&&console.log(`Collision(${this._activeGroundCollisions.size}): ${e.contacts.map(e=>e.normal.y.toFixed(2)).join(`, `)} - ${this.isGrounded}`))}onCollisionExit(e){this._activeGroundCollisions.delete(e),ki&&console.log(`Collision(${this._activeGroundCollisions.size}) - ${this.isGrounded}`)}get isGrounded(){return this._activeGroundCollisions.size>0}_contactVelocity=new n;get contactVelocity(){this._contactVelocity.set(0,0,0);for(let e of this._activeGroundCollisions){let t=this.context.physics.engine?.getLinearVelocity(e.collider);t&&(this._contactVelocity.x+=t.x,this._contactVelocity.y+=t.y,this._contactVelocity.z+=t.z)}return this._contactVelocity}};Oi([A(n)],Ai.prototype,`center`,void 0),Oi([A()],Ai.prototype,`radius`,void 0),Oi([A()],Ai.prototype,`height`,void 0);var ji=class extends R{controller;movementSpeed=2;rotationSpeed=2;jumpForce=1;doubleJumpForce=2;animator;lookForward=!0;awake(){this._currentRotation=new x}update(){let e=this.context.input;e.isKeyPressed(`KeyW`)?this.moveInput.y+=1:e.isKeyPressed(`KeyS`)&&--this.moveInput.y,e.isKeyPressed(`KeyD`)?this.lookInput.x+=1:e.isKeyPressed(`KeyA`)&&--this.lookInput.x,this.jumpInput||=e.isKeyDown(`Space`)}move(e){this.moveInput.add(e)}look(e){this.lookInput.add(e)}jump(){this.jumpInput=!0}lookInput=new b(0,0);moveInput=new b(0,0);jumpInput=!1;onBeforeRender(){this.handleInput(this.moveInput,this.lookInput,this.jumpInput),this.lookInput.set(0,0),this.moveInput.set(0,0),this.jumpInput=!1}_currentSpeed=new n(0,0,0);_currentAngularSpeed=new n(0,0,0);_temp=new n(0,0,0);_jumpCount=0;_currentRotation;handleInput(e,t,r){if(this.controller?.isGrounded&&(this._jumpCount=0,this.doubleJumpForce>0&&this.animator?.setBool(`doubleJump`,!1)),this._currentSpeed.z+=e.y*this.movementSpeed*this.context.time.deltaTime,this.animator?.setBool(`running`,e.length()>.01),this.animator?.setBool(`jumping`,this.controller?.isGrounded===!0&&r),this._temp.copy(this._currentSpeed),this._temp.applyQuaternion(this.gameObject.quaternion),this.controller?this.controller.move(this._temp):this.gameObject.position.add(this._temp),this._currentAngularSpeed.y+=O.toRadians(-t.x*this.rotationSpeed)*this.context.time.deltaTime,this.lookForward&&Math.abs(this._currentAngularSpeed.y)<.01){let e=this.context.mainCameraComponent.forward;e.y=0,e.normalize(),this._currentRotation.setFromUnitVectors(new n(0,0,1),e),this.gameObject.quaternion.slerp(this._currentRotation,this.context.time.deltaTime*10)}if(this.gameObject.rotateY(this._currentAngularSpeed.y),this._currentSpeed.multiplyScalar(1-this.context.time.deltaTime*10),this._currentAngularSpeed.y*=1-this.context.time.deltaTime*10,this.controller&&r&&this.jumpForce>0){let e=this.controller?.isGrounded;if(this.doubleJumpForce>0&&!this.controller?.isGrounded&&this._jumpCount===1&&(e=!0,this.animator?.setBool(`doubleJump`,!0)),e){this._jumpCount+=1;let e=this.controller.rigidbody,t=this._jumpCount===2?this.doubleJumpForce:this.jumpForce;e.applyImpulse(new n(0,1,0).multiplyScalar(t))}}if(this.controller){let e=this.controller?.rigidbody.getVelocity().y;if(e<-1){this._raycastOptions.ray||(this._raycastOptions.ray=new a),this._raycastOptions.ray.origin.copy(M(this.gameObject)),this._raycastOptions.ray.direction.set(0,-1,0);let t=this.layer;this.gameObject.layers.disableAll(),this.gameObject.layers.set(2);let n=this.context.physics.raycast(this._raycastOptions);this.gameObject.layers.set(t),(n.length&&n[0].distance>2||e<-10)&&this.animator?.setBool(`falling`,!0)}else this.animator?.setBool(`falling`,!1)}}_raycastOptions=new Gt};Oi([A(Ai)],ji.prototype,`controller`,void 0),Oi([A()],ji.prototype,`movementSpeed`,void 0),Oi([A()],ji.prototype,`rotationSpeed`,void 0),Oi([A()],ji.prototype,`jumpForce`,void 0),Oi([A()],ji.prototype,`doubleJumpForce`,void 0),Oi([A(it)],ji.prototype,`animator`,void 0);var Mi=N(`logstats`),Ni=class extends R{onEnable(){console.log(this),Mi&&this.startCoroutine(this.run(),an.OnAfterRender)}*run(){for(;this.enabled;){let e=this.context.renderer.info;console.log(e.memory,e.render,e.programs),yield}}},Pi=class extends R{isUsed=!0;usedBy=null},Fi=class extends R{},Ii=N(`debugdeletable`),Li=class e extends Di{static _instances=[];onEnable(){e._instances.push(this)}onDisable(){let t=e._instances.indexOf(this);t>=0&&e._instances.splice(t,1)}},Ri=class extends R{update(){for(let e of Li._instances){let t=this.gameObject;if(e.isInBox(t)===!0){let t=F.getComponentInParent(this.gameObject,Pi);if(t)Ii&&console.warn(`DeleteBox: Not deleting object with usage marker`,this.guid,t);else{if(Ii)try{if(e.box){let t=e.box,n=Di.testBox;V.DrawWireBox3(t,16711680,5),V.DrawWireBox3(n,255,5),console.log(`DeleteBox: Destroying`,this.gameObject,{deleteBoxArea:t,deletedObjectArea:n})}else console.log(`DeleteBox: Destroying`,this.gameObject)}catch{}xt(this.gameObject,this.context.connection)}}}}},zi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Bi;(function(e){e[e.Never=0]=`Never`,e[e.Desktop=1]=`Desktop`,e[e.Mobile=2]=`Mobile`})(Bi||={});var Vi=class extends R{visibleOn;onEnable(){this.apply()}apply(){this.test()||F.setActive(this.gameObject,!1)}test(){return this.visibleOn<0?!0:yt.isMobileDevice()?(this.visibleOn&Bi.Mobile)!==0:(this.visibleOn&Bi.Desktop)!==0}};zi([A()],Vi.prototype,`visibleOn`,void 0);var Hi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ui=N(`debugdrag`),Wi=[],K;(function(e){e[e.XZPlane=0]=`XZPlane`,e[e.Attached=1]=`Attached`,e[e.HitNormal=2]=`HitNormal`,e[e.DynamicViewAngle=3]=`DynamicViewAngle`,e[e.SnapToSurfaces=4]=`SnapToSurfaces`,e[e.None=5]=`None`})(K||={});var Gi=class e extends R{static get HasAnySelected(){return this._active>0}static _active=0;static get CurrentlySelected(){Wi.length=0;for(let e of this._instances)e._isDragging&&Wi.push(e);return Wi}static _instances=[];dragMode=K.DynamicViewAngle;snapGridResolution=0;keepRotation=!0;xrDragMode=K.Attached;xrKeepRotation=!1;xrDistanceDragFactor=1;showGizmo=!1;get draggedObject(){return this._targetObject}setTargetObject(e){this._targetObject=e;for(let t of this._dragHandlers.values())t.setTargetObject(e);let t=`_rigidbody-was-kinematic`;this._rigidbody?.[t]===!1&&(this._rigidbody.isKinematic=!1,this._rigidbody[t]=void 0),this._rigidbody=null,e&&(this._rigidbody=F.getComponentInChildren(e,E),this._rigidbody?.isKinematic===!1&&(this._rigidbody.isKinematic=!0,this._rigidbody[t]=!1))}_rigidbody=null;_targetObject=null;_dragHelper=null;static lastHovered;_draggingRigidbodies=[];_potentialDragStartEvt=null;_dragHandlers=new Map;_totalMovement=new n;_marker=null;_isDragging=!1;_didDrag=!1;awake(){this._potentialDragStartEvt=null,this._dragHandlers=new Map,this._totalMovement=new n,this._marker=null,this._isDragging=!1,this._didDrag=!1,this._dragHelper=null,this._draggingRigidbodies=[]}start(){this.gameObject.getComponentInParent(C)||this.gameObject.addComponent(C)}onEnable(){e._instances.push(this),this.context.accessibility.updateElement(this,{role:`button`,label:`Drag `+(this.gameObject.name||`object`),hidden:!1})}onDisable(){this.context.accessibility.updateElement(this,{hidden:!0}),e._instances=e._instances.filter(e=>e!==this)}onDestroy(){this.context.accessibility.removeElement(this)}allowEdit(e=null){return this.context.connection.allowEditing}onPointerEnter(t){if(!this.allowEdit(this.gameObject)||t.mode!==`screen`||(t.event.mode===`tracked-pointer`||t.event.mode===`transient-pointer`?this.xrDragMode:this.dragMode)===K.None)return;let n=F.getComponentInParent(t.object,e);!n||n!==this||(e.lastHovered=t.object,this.context.domElement.style.cursor=`pointer`,this.context.accessibility.hover(this,`Draggable ${t.object?.name}`))}onPointerMove(e){(this._isDragging||this._potentialDragStartEvt!==null)&&e.use()}onPointerExit(t){this.allowEdit(this.gameObject)&&t.mode===`screen`&&e.lastHovered===t.object&&(this.context.domElement.style.cursor=`auto`)}onPointerDown(t){if(this.allowEdit(this.gameObject)&&!t.used&&(t.mode===`tracked-pointer`||t.mode===`transient-pointer`?this.xrDragMode:this.dragMode)!==K.None&&(e.lastHovered=t.object,t.button===0)){this._dragHandlers.size===0&&(this._didDrag=!1,this._totalMovement.set(0,0,0),this._potentialDragStartEvt=t),this._targetObject||this.setTargetObject(this.gameObject),e._active+=1;let n=new qi(this,this._targetObject);if(this._dragHandlers.set(t.event.space,n),n.onDragStart(t),this._dragHandlers.size===2){let e=this._dragHandlers.values(),n=e.next().value,r=e.next().value;if(n instanceof qi&&r instanceof qi){let e=new Ki(this,this._targetObject,n,r);this._dragHandlers.set(this.gameObject,e),e.onDragStart(t)}else console.error(`Attempting to construct a MultiTouchDragHandler with invalid DragPointerHandlers. This is likely a bug.`,{a:n,b:r})}t.use(),this.context.accessibility.updateElement(this,{role:`button`,label:`Dragging `+(this.gameObject.name||`object`),hidden:!1,busy:!0}),this.context.accessibility.focus(this)}}onPointerUp(t){if(Ui&&V.DrawLabel(t.point??this.gameObject.worldPosition,`POINTERUP:`+t.pointerId+`, `+t.button,.03,3),!this.allowEdit(this.gameObject)||t.button!==0)return;this._potentialDragStartEvt=null;let n=this._dragHandlers.get(t.event.space),r=this._dragHandlers.get(this.gameObject);r&&(r.handlerA===n||r.handlerB===n)&&(this._dragHandlers.delete(this.gameObject),r.onDragEnd(t)),n&&(e._active>0&&--e._active,this.setTargetObject(null),n.onDragEnd&&n.onDragEnd(t),this._dragHandlers.delete(t.event.space),this._dragHandlers.size===0&&this.onLastDragEnd(t),t.use()),this.context.accessibility.unfocus(this),this.context.accessibility.updateElement(this,{busy:!1})}update(){for(let e of this._dragHandlers.values())e.collectMovementInfo&&e.collectMovementInfo(),e.getTotalMovement&&this._totalMovement.add(e.getTotalMovement());if(this._potentialDragStartEvt){if(!this._didDrag)if(this._totalMovement.length()>3e-4)this._didDrag=!0;else return;let e=this._potentialDragStartEvt;this._potentialDragStartEvt=null,this.onFirstDragStart(e)}for(let e of this._dragHandlers.values())e.onDragUpdate&&e.onDragUpdate(this._dragHandlers.size);this._dragHelper&&this._dragHelper.hasSelected&&this.onAnyDragUpdate()}onFirstDragStart(t){if(!t||!t.object)return;let n=F.getComponentInParent(t.object,e);if(!n||n!==this&&n._isDragging)return;let r=this._targetObject||this.gameObject;if(!r)return;this._isDragging=!0;let i=F.getComponentInChildren(r,rt);Ui&&console.log(`DRAG START`,i,r),i&&(i.fastMode=!0,i?.requestOwnership()),this._marker=F.addComponent(r,Pi),this._draggingRigidbodies.length=0;let a=F.getComponentsInChildren(r,E);a&&this._draggingRigidbodies.push(...a),r.matrixAutoUpdate===!1&&!globalThis[`DragControls:MatrixWarningShown`]&&(globalThis[`DragControls:MatrixWarningShown`]=!0,console.warn(`Dragging an object with matrixAutoUpdate=false can lead to unexpected behavior. Consider enabling matrixAutoUpdate or updating the matrix manually during dragging.`))}onAnyDragUpdate(){if(!this._dragHelper)return;this._dragHelper.showGizmo=this.showGizmo,this._dragHelper.onUpdate(this.context);for(let e of this._draggingRigidbodies)e.wakeUp(),e.resetVelocities(),e.resetForcesAndTorques();let e=this._targetObject||this.gameObject;qe.markDirty(e)}onLastDragEnd(e){if(!this||!this._isDragging)return;this._isDragging=!1;for(let e of this._draggingRigidbodies)e.setVelocity(e.smoothedVelocity.multiplyScalar(this.context.time.deltaTime));if(this._draggingRigidbodies.length=0,this._targetObject=null,e?.object){let t=F.getComponentInChildren(e.object,rt);t&&(t.fastMode=!1)}if(this._marker&&this._marker.destroy(),!this._dragHelper)return;let t=this._dragHelper.selected;Ui&&console.log(`DRAG END`,t,t?.visible),this._dragHelper.setSelected(null,this.context)}};Hi([A()],Gi.prototype,`dragMode`,void 0),Hi([A()],Gi.prototype,`snapGridResolution`,void 0),Hi([A()],Gi.prototype,`keepRotation`,void 0),Hi([A()],Gi.prototype,`xrDragMode`,void 0),Hi([A()],Gi.prototype,`xrKeepRotation`,void 0),Hi([A()],Gi.prototype,`xrDistanceDragFactor`,void 0),Hi([A()],Gi.prototype,`showGizmo`,void 0);var Ki=class{handlerA;handlerB;context;settings;gameObject;_handlerAAttachmentPoint=new n;_handlerBAttachmentPoint=new n;_followObject;_manipulatorObject;_deviceMode;_followObjectStartWorldQuaternion=new x;constructor(e,t,n,r){this.context=e.context,this.settings=e,this.gameObject=t,this.handlerA=n,this.handlerB=r,this._followObject=new y,this._manipulatorObject=new y,this.context.scene.add(this._manipulatorObject);let i=St.active?.rig?.gameObject;if(!this.handlerA||!this.handlerB||!this.handlerA.hitPointInLocalSpace||!this.handlerB.hitPointInLocalSpace){console.error(`Invalid: MultiTouchDragHandler needs two valid DragPointerHandlers with hitPointInLocalSpace set.`);return}if(this._tempVec1.copy(this.handlerA.hitPointInLocalSpace),this._tempVec2.copy(this.handlerB.hitPointInLocalSpace),this.gameObject.localToWorld(this._tempVec1),this.gameObject.localToWorld(this._tempVec2),i&&(i.worldToLocal(this._tempVec1),i.worldToLocal(this._tempVec2)),this._initialDistance=this._tempVec1.distanceTo(this._tempVec2),this._initialDistance<.02?(Ui&&console.log(`Finding alternative drag attachment points since initial distance is too low: `+this._initialDistance.toFixed(2)),this.handlerA.followObject.parent.getWorldPosition(this._tempVec1),this.handlerB.followObject.parent.getWorldPosition(this._tempVec2),this._handlerAAttachmentPoint.copy(this._tempVec1),this._handlerBAttachmentPoint.copy(this._tempVec2),this.gameObject.worldToLocal(this._handlerAAttachmentPoint),this.gameObject.worldToLocal(this._handlerBAttachmentPoint),this._initialDistance=this._tempVec1.distanceTo(this._tempVec2),this._initialDistance<.001&&(console.warn(`Not supported right now – controller drag points for multitouch are too close!`),this._initialDistance=1)):(this._handlerAAttachmentPoint.copy(this.handlerA.hitPointInLocalSpace),this._handlerBAttachmentPoint.copy(this.handlerB.hitPointInLocalSpace)),this._tempVec3.lerpVectors(this._tempVec1,this._tempVec2,.5),this._initialScale.copy(t.scale),Ui){this._followObject.add(new se(2)),this._manipulatorObject.add(new se(5));let e=e=>`${e.x.toFixed(2)}, ${e.y.toFixed(2)}, ${e.z.toFixed(2)}`;V.DrawLine(this._tempVec1,this._tempVec2,65535,0,!1),V.DrawLabel(this._tempVec3,`A:B `+this._initialDistance.toFixed(2)+` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./needle-engine.CE4b2dOg.js","./needle-engine@5.0.3.js","./rolldown-runtime.CYVBeYYp.js","./needle-engine-webxr.BfNO-tft.js","./materialx.CnHmG--Y.js","./three@0.169.19.js","./needle-engine-ui.i2hfjKja.js","./gltf-progressive.BBJGcb3s.js","./three-examples@0.169.19.js","./three-mesh-ui.CgGzZ3ml.js","./needle-engine-particles.Bz_Ei_ja.js","./three-quarks.DALdLWPD.js","./needle-engine.extras.1SuflpgE.js","./postprocessing.Wy71DpiM.js","./three-mesh-bvh.B-oXEGo2.js"])))=>i.map(i=>d[i]); +import{d as e}from"./materialx.CnHmG--Y.js";import{A as t,Ar as n,At as r,D as i,Gn as a,Jt as o,Kn as s,Mr as c,Nr as l,Nt as u,P as d,Q as f,Qn as p,Qt as m,R as ee,S as h,T as g,Tn as te,Xt as _,Z as ne,Zn as re,Zt as v,_ as ie,_n as ae,a as oe,d as se,fn as y,fr as ce,gn as le,gr as ue,i as de,in as fe,jr as pe,jt as me,kr as b,kt as he,nr as ge,s as _e,st as ve,tr as ye,tt as be,u as xe,ur as Se,ut as Ce,vn as we,wn as x,x as Te,y as Ee,yn as De}from"./three@0.169.19.js";import{$i as S,A as C,Aa as Oe,An as ke,Ao as Ae,B as je,Br as Me,C as Ne,D as Pe,Di as Fe,Dr as Ie,E as Le,Ea as Re,F as ze,Fa as Be,Fo as Ve,G as He,Ho as Ue,I as We,Io as Ge,Ir as Ke,Jt as qe,Ka as w,Kr as T,L as E,Lo as Je,Ma as Ye,Mo as Xe,Mr as Ze,Ni as Qe,No as $e,Nr as et,Nt as tt,Ot as nt,P as rt,Q as it,Qi as at,S as ot,T as D,Ua as O,Uo as st,W as ct,Wo as lt,X as k,Xi as A,Z as ut,Zi as j,Zn as dt,_ as ft,_a as M,a as pt,ai as mt,ao as ht,at as gt,ba as _t,co as N,cr as P,ct as F,dn as vt,ea as I,eo as yt,f as bt,fi as xt,fn as St,g as Ct,h as wt,hi as Tt,i as Et,io as Dt,j as Ot,ja as kt,jo as At,k as jt,kt as L,l as Mt,la as Nt,ln as Pt,n as Ft,na as It,ni as Lt,o as Rt,oo as zt,ot as R,p as Bt,pa as z,q as Vt,r as B,ra as Ht,s as Ut,sa as Wt,sn as Gt,t as Kt,tr as qt,u as Jt,un as V,uo as Yt,va as Xt,vr as Zt,wa as Qt,wi as $t,x as en,xr as tn,y as nn,ya as rn,yn as an}from"./needle-engine-ui.i2hfjKja.js";import{d as on,g as sn}from"./three-examples@0.169.19.js";import{$t as cn,A as ln,B as un,Bt as dn,C as fn,Ft as pn,G as mn,Gt as hn,H as gn,It as _n,J as vn,K as yn,Kt as bn,L as xn,Lt as Sn,N as Cn,Ot as wn,P as Tn,Qt as En,Rt as Dn,S as On,U as kn,Ut as An,V as jn,Vt as Mn,W as Nn,Wt as Pn,X as Fn,Xt as In,Y as Ln,Yt as Rn,Zt as zn,at as Bn,bt as Vn,cn as Hn,d as Un,dn as Wn,f as Gn,fn as Kn,j as qn,k as Jn,ln as Yn,lt as Xn,m as Zn,mn as Qn,n as $n,nn as er,o as tr,on as nr,pn as rr,q as ir,qt as ar,r as or,rt as sr,sn as cr,st as lr,t as ur,tn as dr,tt as fr,un as pr,w as mr,x as hr,xt as gr,yt as _r}from"./needle-engine-webxr.BfNO-tft.js";import{r as vr,t as yr}from"./needle-engine-particles.Bz_Ei_ja.js";import{a as br,c as xr,d as Sr,f as Cr,h as wr,i as Tr,l as Er,m as Dr,o as Or,p as kr,r as Ar,s as jr,t as Mr,u as Nr}from"./needle-engine.extras.1SuflpgE.js";var Pr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Fr=N(`debugsignals`),Ir=class{guid};Pr([A()],Ir.prototype,`guid`,void 0);var Lr=class{signal;reaction};Pr([A(Ir)],Lr.prototype,`signal`,void 0),Pr([A(k)],Lr.prototype,`reaction`,void 0);var Rr=class e extends R{static receivers={};static invoke(t){if(e.receivers[t]){let n=e.receivers[t];if(!n)return;for(let e of n)e.invoke(t)}}events;awake(){Fr&&console.log(`SignalReceiver awake`,this)}onEnable(){if(this.events)for(let t of this.events)e.receivers[t.signal.guid]||(e.receivers[t.signal.guid]=[]),e.receivers[t.signal.guid].push(this)}onDisable(){if(this.events){for(let t of this.events)if(e.receivers[t.signal.guid]){let n=e.receivers[t.signal.guid].indexOf(this);n>=0&&e.receivers[t.signal.guid].splice(n,1)}}}invoke(e){if(!this.events||!Array.isArray(this.events))return;let t=typeof e==`object`?e.guid:e;for(let e of this.events)if(e.signal.guid===t)try{if(!e.reaction){console.warn(`Missing reaction for signal`,e,this);continue}else if(!e.reaction.invoke){console.warn(`Missing invoke - possibly a serialization error`,e,this);continue}e.reaction.invoke()}catch(e){console.error(e)}}};Pr([A(Lr)],Rr.prototype,`events`,void 0);var zr;(function(e){e.Activation=`ActivationTrack`,e.Animation=`AnimationTrack`,e.Audio=`AudioTrack`,e.Control=`ControlTrack`,e.Marker=`MarkerTrack`,e.Signal=`SignalTrack`})(zr||={});var Br;(function(e){e[e.None=0]=`None`,e[e.Hold=1]=`Hold`,e[e.Loop=2]=`Loop`,e[e.PingPong=3]=`PingPong`,e[e.Continue=4]=`Continue`})(Br||={});var Vr;(function(e){e.Signal=`SignalEmitter`})(Vr||={});var Hr=N(`debugtimeline`),Ur=class{director;track;get muted(){return this.track.muted}set muted(e){e!==this.track.muted&&(this.track.muted=e,this.onMuteChanged?.call(this))}*forEachClip(e=!1){if(this.track?.clips)if(e)for(let e=this.track.clips.length-1;e>=0;e--)yield this.track.clips[e];else for(let e of this.track.clips)yield e}getClipTime(e,t){return t.clipIn+(e-t.start)*t.timeScale}getClipTimeNormalized(e,t){return(e-t.start)/t.duration}evaluateWeight(e,t,n,r=!0){if(t<0||t>=n.length)return 0;let i=n[t];if(r||e>=i.start&&e<=i.end){let t=1;if(i.easeInDuration>0){let n=Math.min((e-i.start)/i.easeInDuration,1);t*=n}if(i.easeOutDuration>0){let n=Math.min((i.end-e)/i.easeOutDuration,1);t*=n}return t}return 0}},Wr=class{clip;rootPositionOffset;rootQuaternionOffset;get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}rootStartPosition;rootEndPosition;rootStartQuaternion;rootEndQuaternion;constructor(e){let t=e.getClip();this.clip=t;let r=e.getRoot(),i=r.name+`.position`,a=r.name+`.quaternion`;Hr&&console.log(t.name,t.tracks,i);for(let e of t.tracks)if(!(e.times.length<=0)){if(e.name.endsWith(i))this.rootStartPosition=new n().fromArray(e.values,0),this.rootEndPosition=new n().fromArray(e.values,e.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),Hr&&console.log(this.rootPositionOffset);else if(e.name.endsWith(a)&&(this.rootStartQuaternion=new x().fromArray(e.values,0),this.rootEndQuaternion=new x().fromArray(e.values,e.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),Hr)){let e=new be().setFromQuaternion(this.rootQuaternionOffset);console.log(`ROT`,e)}}}},Gr=class extends Ur{models=[];trackOffset;target;mixer;clips=[];actions=[];weight=1;_actionOffsets=[];_didBind=!1;_animator=null;onDisable(){this.mixer?.stopAllAction()}onDestroy(){this.director.context.animations.unregisterAnimationMixer(this.mixer)}onStateChanged(){this._animator&>(this._animator.gameObject,this,this.director.enabled&&this.director.weight>0)}createHooks(e,t){if(t.tracks?.length<=0){console.warn(`No tracks in AnimationClip`,t);return}let n=!1,r=!1,i=t.tracks.find(e=>e.name.includes(`.position`)||e.name.includes(`.quaternion`))?.name.split(`.`);if(i){let a=i[i.length-2],o=a+`.position`,s=a+`.quaternion`;for(let i of t.tracks)!n&&i.name.endsWith(o)?(n=!0,this.createPositionInterpolant(t,e,i)):!r&&i.name.endsWith(s)&&(r=!0,this.createRotationInterpolant(t,e,i))}if(!n||!r){let i=this.mixer?.getRoot(),a=t.tracks[0],o=a.name.lastIndexOf(`.`),s=a.name.substring(0,o),l=s.substring(s.lastIndexOf(`.`)+1),u=i.getObjectByName(l);if(u){if(!n){let n=s+`.position`;Hr&&console.warn(`Create position track`,l,u);let r=new c(n,[0,t.duration],[0,0,0,0,0,0]);t.tracks.push(r),this.createPositionInterpolant(t,e,r)}else if(!r){let n=t.tracks[0].name.substring(0,o)+`.quaternion`;Hr&&console.warn(`Create quaternion track`,l,u);let r=new te(n,[0,t.duration],[0,0,0,1,0,0,0,1]);t.tracks.push(r),this.createRotationInterpolant(t,e,r)}}}}bind(){if(!this._didBind){this._didBind=!0,Hr&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn(`No mixer was assigned to animation track`);for(let e of this.actions){let t=new Wr(e);this._actionOffsets.push(t)}this.target&&(this._animator=F.getComponent(this.target,it)??null,this._animator&>(this._animator.gameObject,this,!0));for(let e of this.models){let t=e.asset,r=t.position,i=t.rotation;r&&r.x!==void 0&&(r.isVector3||(t.position=new n(r.x,r.y,r.z)),i.isQuaternion||(t.rotation=new x(i.x,i.y,i.z,i.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){let e=this.trackOffset.position;e&&(e.isVector3||(this.trackOffset.position=new n(e.x,e.y,e.z)));let t=this.trackOffset.rotation;t&&(t.isQuaternion||(this.trackOffset.rotation=new x(t.x,t.y,t.z,t.w)))}}_useclipOffsets=!0;_totalOffsetPosition=new n;_totalOffsetRotation=new x;_totalOffsetPosition2=new n;_totalOffsetRotation2=new x;_summedPos=new n;_tempPos=new n;_summedRot=new x;_tempRot=new x;_clipRotQuat=new x;evaluate(e){if(this.track.muted||!this.mixer)return;this.bind(),this._totalOffsetPosition.set(0,0,0),this._totalOffsetRotation.set(0,0,0,1),this._totalOffsetPosition2.set(0,0,0),this._totalOffsetRotation2.set(0,0,0,1);let t=0,n=0,r=!1,i=!1,a=0;for(let o=0;o=s.start&&e<=s.end,d=s.preExtrapolationMode,f=s.postExtrapolationMode,p=oe)&&(m=!0,r=!0):o==0&&!m&&!i&&s.start>e&&d!==Br.None&&(!p||p.startte;)h-=te}else if(!u&&r)switch(f){case Br.Hold:h=this.getClipTime(s.end,s);break;case Br.Loop:h%=te;break;case Br.PingPong:let e=Math.floor(h/te)%2!=0;h%=te,e&&(h=te-h);break}s.reversed===!0?c.time=c.getClip().duration-h:c.time=h,c.timeScale=0;let _=Math.max(0,i);if(c.weight=_,a+=_,c.clampWhenFinished=!1,c.isRunning()||c.play(),this._useclipOffsets){let e=t==0?this._totalOffsetPosition:this._totalOffsetPosition2,r=t==0?this._totalOffsetRotation:this._totalOffsetRotation2;t<1&&(n=1-i),t+=1;let a=this._summedPos.set(0,0,0),s=this._tempPos.set(0,0,0),c=this._summedRot.identity(),u=this._tempRot.identity(),d=l.rotation;d&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(d,i));let f=this._actionOffsets[o];if(f.hasOffsets)for(let e=0;e{let e=r(),t=e.evaluate.bind(e);return e.evaluate=e=>{let n=t(e);if(i.set(n[0],n[1],n[2],n[3]),i.premultiply(this._totalOffsetRotation),a&&i.premultiply(a),this.director.animationCallbackReceivers)for(let t of this.director.animationCallbackReceivers)t?.onTimelineRotation?.call(t,this.director,this.target,e,i);return n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=i.w,n},e}}createPositionInterpolant(e,t,r){let i=r.createInterpolant.bind(r),a=new n;this.ensureTrackOffsets();let o=this.trackOffset?.rotation,s=this.trackOffset?.position,c;r.createInterpolant=()=>{let n=i(),r=n.evaluate.bind(n);return n.evaluate=n=>{let i=r(n);if(a.set(i[0],i[1],i[2]),t.removeStartOffset&&(c===void 0?(c=null,c=this._actionOffsets.find(t=>t.clip===e)?.rootStartPosition?.clone()):c?.isVector3&&a.sub(c)),a.applyQuaternion(this._totalOffsetRotation),a.add(this._totalOffsetPosition),o&&a.applyQuaternion(o),s&&(a.x-=s.x,a.y+=s.y,a.z+=s.z),this.director.animationCallbackReceivers)for(let e of this.director.animationCallbackReceivers)e?.onTimelinePosition?.call(e,this.director,this.target,n,a);return i[0]=a.x,i[1]=a.y,i[2]=a.z,i},n}}},Kr=N(`mutetimeline`),qr=class e extends Ur{models=[];listener;audio=[];audioContextTimeOffset=[];lastTime=0;audioSource;_audioLoader=null;getAudioFilePath(e){let t=this.director.sourceId;return At(t,e)}onAllowAudioChanged(e){for(let t=0;t=a.start&&e<=a.end&&e.3?o.offset=a.clipIn+(e-a.start)*a.timeScale:o.offset=0,Hr&&console.log(`Timeline Audio (`+this.track.name+`) play with offset `+o.offset+` - `+a.asset.clip),o.play(r),a._didTriggerPlay=!0);else{let t=a.clipIn+(e-a.start)*a.timeScale,n=o.context.currentTime-o._startedAt+o.offset;Math.abs(t-n)>.3&&(o.offset=t,o.stop(),o.play(r))}let i=s.volume;if(this.track.volume!==void 0&&(i*=this.track.volume),t&&(i=0),a.easeInDuration>0){let t=Math.min((e-a.start)/a.easeInDuration,1);i*=t}if(a.easeOutDuration>0){let t=Math.min((a.end-e)/a.easeOutDuration,1);i*=t}o.setVolume(i*this.director.weight)}else a._didTriggerPlay=!1,this.director.isPlaying&&o.isPlaying&&o.stop()}this.lastTime=e}loadAudio(e,t=0,n=0){let r=null,i=e-n,a=e+t;for(let e of this.models)if(this.isInTimeRange(e,i,a)){let t=this.audio[this.models.indexOf(e)],n=this.handleAudioLoading(e,t);n!==null&&(r===null&&(r=[]),r.push(n))}return r===null?null:Promise.all(r)}isInTimeRange(e,t,n){return t<=e.start&&n>=e.end||t>=e.start&&t<=e.end||n>=e.start&&n<=e.end}static _audioBuffers=new Map;static dispose(){e._audioBuffers.clear()}handleAudioLoading(t,n){this._audioLoader||=new xe;let r=this.getAudioFilePath(t.asset.clip);if(e._audioBuffers.get(r)){let t=e._audioBuffers.get(r);return t.then(e=>{e&&n.setBuffer(e)}),t}Hr&&console.warn(`LOAD audio track`,r,this.director.sourceId);let i=new Promise((e,t)=>{this._audioLoader.load(r,t=>{n.setBuffer(t),e(t)},void 0,t=>{console.error(`Error loading audio`,t),e(null)})});return e._audioBuffers.set(r,i),i}},Jr=class extends Ur{models=[];needsSorting=!0;*foreachMarker(e=null){this.needsSorting&&this.sort();for(let t of this.models)t&&t.type===e&&(yield t)}onEnable(){this.needsSorting=!0}evaluate(e){this.needsSorting&&this.sort()}sort(){this.needsSorting=!1,this.models.sort((e,t)=>e.time-t.time)}},Yr=class extends Ur{models=[];didTrigger=[];receivers=[];evaluate(e){if(this.track.muted)return;let t=this.director.context.time.deltaTime*1.5;for(let n=0;n=1e-5&&e=0;e--){let t=this.models[e].asset;if(!t.sourceObject||typeof t.sourceObject!=`object`){console.log(`no source object, removing model`,e,t),this.models.splice(e,1);continue}else{let e=this.director.constructor,n=F.getComponent(t.sourceObject,e);this.timelines.push(n),n&&t.updateDirector&&(n.playOnAwake=!1)}}}_previousActiveModel=null;evaluate(e){this._previousActiveModel=null;for(let t=0;t=n.start&&e<=n.end){this._previousActiveModel=n;let i=this.getClipTime(e,n);if(r.controlActivation){let e=r.sourceObject;e.visible=!0}if(r.updateDirector){let e=this.timelines[t];e&&(e.isPlaying&&e.pause(),e.time=i,e.evaluate())}}else{let e=this._previousActiveModel?.asset;if(r.controlActivation){let t=r.sourceObject;e?.sourceObject!==t&&(t.visible=!1)}}}}},Zr=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qr=N(`debugtimeline`),$r;(function(e){e[e.Hold=0]=`Hold`,e[e.Loop=1]=`Loop`,e[e.None=2]=`None`})($r||={});var ei;(function(e){e[e.None=0]=`None`,e[e.Hold=1]=`Hold`,e[e.Loop=2]=`Loop`,e[e.PingPong=3]=`PingPong`,e[e.Continue=4]=`Continue`})(ei||={});var ti=class e extends R{static createTrackFunctions={};static registerCreateTrack(e,t){this.createTrackFunctions[e]=t}playableAsset;playOnAwake;extrapolationMode=$r.Loop;get isPlaying(){return this._isPlaying}get isPaused(){return this._isPaused}get time(){return this._time}set time(e){typeof e==`number`&&!Number.isNaN(e)?this._time=e:(Qr||Ue())&&console.error(`INVALID TIMELINE.TIME VALUE`,e,this.name)}get duration(){return this._duration}set duration(e){this._duration=e}get weight(){return this._weight}set weight(e){this._weight=e}get speed(){return this._speed}set speed(e){this._speed=e}waitForAudio=!0;_visibilityChangeEvt;_clonedPlayableAsset=!1;_speed=1;awake(){Qr&&console.log(`[Timeline] Awake '${this.name}'`,this),this.rebuildGraph(),!this.isValid()&&(Qr||w())&&(Qr?console.warn(`PlayableDirector is not valid`,`Asset?`,this.playableAsset,`Tracks:`,this.playableAsset?.tracks,`IsArray?`,Array.isArray(this.playableAsset?.tracks),this):this.playableAsset?.tracks?.length?console.warn(`PlayableDirector is not valid`):console.warn(`PlayableDirector has no tracks`))}onEnable(){Qr&&console.log(`[Timeline] OnEnable`,this.name,this.playOnAwake);for(let e of this._audioTracks)e.onEnable?.();for(let e of this._customTracks)e.onEnable?.();for(let e of this._animationTracks)e.onEnable?.();this.playOnAwake&&this.play(),this._visibilityChangeEvt||=()=>{switch(document.visibilityState){case`hidden`:this.setAudioTracksAllowPlaying(!1);break;case`visible`:this.setAudioTracksAllowPlaying(!0);break}},window.addEventListener(`visibilitychange`,this._visibilityChangeEvt)}onDisable(){Qr&&console.log(`[Timeline] OnDisable`,this.name),this.stop();for(let e of this._audioTracks)e.onDisable?.();for(let e of this._customTracks)e.onDisable?.();for(let e of this._animationTracks)e.onDisable?.();this._visibilityChangeEvt&&window.removeEventListener(`visibilitychange`,this._visibilityChangeEvt)}onDestroy(){for(let e of this._allTracks)for(let t of e)t.onDestroy?.()}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;let e=this._isPaused==1;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,e&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){let e=[];for(let t of this._audioTracks){let n=t.loadAudio(this._time,1,0);n&&e.push(n)}if(e.length>0&&(await Promise.all(e),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Kn.userInteractionRegistered&&this.waitForAudio;)await zt(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),an.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(let e of this._audioTracks)e.stop();let e=this._isPaused==1,t=this._isPlaying;this._isPlaying&&(this._time=0,this._isPlaying=!1,this._isPaused=!1,this.internalEvaluate(),e&&this.invokePauseChangedMethodsOnTracks()),this._isPlaying=!1,this._isPaused=!1,e&&!t&&this.invokePauseChangedMethodsOnTracks(),t&&this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine&&this.stopCoroutine(this._internalUpdateRoutine),this._internalUpdateRoutine=null,this._isStopping=!1}evaluate(){this.internalEvaluate(!0)}isValid(){return this.playableAsset&&this.playableAsset.tracks&&Array.isArray(this.playableAsset.tracks)}*forEachTrack(){for(let e of this._allTracks)for(let t of e)yield t}get animationTracks(){return this._animationTracks}get audioTracks(){return this._audioTracks}get signalTracks(){return this._signalTracks}get markerTracks(){return this._markerTracks}*foreachMarker(e=null){for(let t of this._markerTracks)for(let n of t.foreachMarker(e))yield n}_guidsMap;resolveGuids(e){this._guidsMap=e}_isPlaying=!1;_internalUpdateRoutine;_isPaused=!1;_isStopping=!1;_time=0;_duration=0;_weight=1;_animationTracks=[];_audioTracks=[];_signalTracks=[];_markerTracks=[];_controlTracks=[];_customTracks=[];_tracksArray=[];get _allTracks(){return this._tracksArray.length=0,this._tracksArray.push(this._animationTracks),this._tracksArray.push(this._audioTracks),this._tracksArray.push(this._signalTracks),this._tracksArray.push(this._markerTracks),this._tracksArray.push(this._controlTracks),this._tracksArray.push(this._customTracks),this._tracksArray}invokePauseChangedMethodsOnTracks(){for(let e of this.forEachTrack())e.onPauseChanged?.call(e)}invokeStateChangedMethodsOnTracks(){for(let e of this.forEachTrack())e.onStateChanged?.call(e,this._isPlaying)}*internalUpdate(){for(;this._isPlaying&&this.activeAndEnabled;)!this._isPaused&&this._isPlaying&&(this._time+=this.context.time.deltaTime*this.speed,this.internalEvaluate()),yield}internalEvaluate(e=!1){if(!this.isValid())return;let t=this._time;switch(this.extrapolationMode){case $r.Hold:this._speed>0?t=Math.min(t,this._duration):this._speed<0&&(t=Math.max(t,0)),this._time=t;break;case $r.Loop:t%=this._duration,this._time=t;break;case $r.None:if(t>this._duration){this.stop();return}break}let n=this._time;for(let t of this.playableAsset.tracks)if(!t.muted)switch(t.type){case zr.Activation:if(!e&&!this._isPlaying)continue;for(let e=0;e=0;r--){let i=n.outputs[r];if(typeof i==`string`){this._guidsMap&&this._guidsMap[i]&&(i=this._guidsMap[i]);let e=F.findByGuid(i,t);typeof e!=`object`||!e?(n.outputs.splice(r,1),console.warn(`Failed to resolve binding`,i,n.name,n.type)):(Qr&&console.log(`Resolved binding`,i,`to`,e),n.outputs[r]=e)}else if(i===null){if(n.outputs.splice(r,1),e.createTrackFunctions[n.type])continue;n.type!==zr.Audio&&n.type!==zr.Control&&n.type!==zr.Marker&&n.type!==zr.Signal&&console.warn(`Missing binding`,i,n.name,n.type,this.name,this.playableAsset.name)}}if(n.type===zr.Control&&n.clips)for(let e=0;ethis._duration&&(this._duration=t.end);if(e.markers)for(let t of e.markers)t.time>this._duration&&(this._duration=t.time+.001)}}}setupAndCreateTrackHandlers(){if(this._animationTracks.length=0,this._audioTracks.length=0,this._signalTracks.length=0,!this.playableAsset)return;let t=F.findObjectOfType(rr,this.context);for(let n of this.playableAsset.tracks){let r=n.type,i=e.createTrackFunctions[r];if(i!=null){let e=i(this,n);if(typeof e.evaluate==`function`){e.director=this,e.track=n,this._customTracks.push(e);continue}}if(n.type===zr.Animation){if(!n.clips||n.clips.length<=0){Qr&&console.warn(`Animation track has no clips`,n);continue}for(let e=n.outputs.length-1;e>=0;e--){let t=n.outputs[e];if(t instanceof y){let e=F.getOrAddComponent(t,it);e&&(t=e)}let r=t?.gameObject?.animations;if(r){let e=new Gr;e.trackOffset=n.trackOffset,e.director=this,e.track=n;for(let i=0;ie.name===s)),Qr&&console.log(o,s,`→`,c),!c){console.warn(`Could not find animationClip for model`,a,n.name,this.name,this.playableAsset?.name,r,t);continue}t instanceof it&&t.runtimeAnimatorController&&(t.__internalDidAwakeAndStart||t.initializeRuntimeAnimatorController(),t.runtimeAnimatorController.mixer||t.runtimeAnimatorController.bind(t),e.mixer=t.runtimeAnimatorController.mixer),e.mixer||(e.mixer=new oe(t.gameObject),this.context.animations.registerAnimationMixer(e.mixer)),e.clips.push(c),e.mixer.uncacheAction(c),e.createHooks(a.asset,c);let l=e.mixer.clipAction(c);e.actions.push(l),e.models.push(a)}this._animationTracks.push(e)}}}else if(n.type===zr.Audio){if(!n.clips||n.clips.length<=0)continue;let e=new qr;e.director=this,e.track=n,e.audioSource=n.outputs.find(e=>e instanceof Kn),this._audioTracks.push(e),t||=this.context.mainCameraComponent?.gameObject.addComponent(rr),e.listener=t.listener;for(let t=0;t0){let t=F.getComponent(this.gameObject,Rr);t&&(e.receivers.push(t),this._signalTracks.push(e))}t!==null&&t.models.length>0&&this._markerTracks.push(t)}}else if(n.type===zr.Signal){let e=new Yr;if(e.director=this,e.track=n,n.markers)for(let t of n.markers)e.models.push(t),e.didTrigger.push(!1);for(let t of n.outputs)e.receivers.push(t);this._signalTracks.push(e)}else if(n.type===zr.Control){let e=new Xr;if(e.director=this,e.track=n,n.clips)for(let t of n.clips)e.models.push(t);e.resolveSourceObjects(this.context),this._controlTracks.push(e)}}}setAudioTracksAllowPlaying(e){for(let t of this._audioTracks)t.onAllowAudioChanged(e)}animationCallbackReceivers=[];registerAnimationCallback(e){this.animationCallbackReceivers.push(e)}unregisterAnimationCallback(e){let t=this.animationCallbackReceivers.indexOf(e);t!==-1&&this.animationCallbackReceivers.splice(t,1)}};Zr([A()],ti.prototype,`playOnAwake`,void 0),Zr([A()],ti.prototype,`extrapolationMode`,void 0);var ni={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},ri={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]},ii=class extends p{constructor(e){super(),this.position.y=-3.5;let t=new Ee;t.deleteAttribute(`uv`);let n=new fe({metalness:0,side:1}),r=new fe({metalness:0}),i=e==`legacy`?ni:ri,a=new De(16777215,i.topLight.intensity,28,2);a.position.set(...i.topLight.position),this.add(a);let o=new v(t,n);o.position.set(...i.room.position),o.scale.set(...i.room.scale),this.add(o);for(let e of i.boxes){let n=new v(t,r);n.position.set(...e.position),n.rotation.set(0,e.rotation,0),n.scale.set(...e.scale),this.add(n)}for(let e of i.lights){let n=new v(t,this.createAreaLightMaterial(e.intensity));n.position.set(...e.position),n.scale.set(...e.scale),this.add(n)}}createAreaLightMaterial(e){let t=new m;return t.color.setScalar(e),t}};async function ai(t){let{NeedleEngineWebComponent:n}=await e(async()=>{let{NeedleEngineWebComponent:e}=await import(`./needle-engine.CE4b2dOg.js`);return{NeedleEngineWebComponent:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url);n.observedAttributes.includes(t)||n.observedAttributes.push(t)}var H=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},U=N(`debugsceneswitcher`),oi=N(`sceneswitcher:clearscene`),si=`scene`;function ci(){ai(si)}var li=Promise.resolve(!1),W=class extends R{autoLoadFirstScene=!0;scenes=[];loadingScene;queryParameterName=`scene`;useSceneName=!0;clamp=!0;useHistory=!0;useKeyboard=!0;useSwipe=!0;useSceneLighting=!0;useSceneBackground=!0;preloadNext=1;preloadPrevious=1;preloadConcurrent=2;createMenuButtons=!1;get currentIndex(){return this._currentIndex}get currentLoadingProgress(){return this._currentLoadingProgress}get currentlyLoadingScene(){return this._currentlyLoadingScene}get currentlyLoadedScene(){return this._currentScene}sceneLoadingStart=new k;sceneLoadingProgress=new k;sceneLoaded=new k;_currentIndex=-1;_currentScene=void 0;_currentSceneAsset=void 0;_engineElementOverserver=void 0;_preloadScheduler;_menuButtons;__lastSwitchScene;__lastSwitchScenePromise;awake(){this._currentScene=void 0,this._lastLoadingScene=void 0,this.__lastSwitchScenePromise=void 0,this.scenes===void 0&&(this.scenes=[]);for(let e of this.scenes)e&&!e.hasUrl&&e.asset instanceof y?F.remove(e.asset):e instanceof y&&F.remove(e);U&&console.log(`SceneSwitcher`,this)}async onEnable(){if(globalThis.addEventListener(`popstate`,this.onPopState),this.context.input.addEventListener(Ie.KeyDown,this.onInputKeyDown),this.context.input.addEventListener(Ie.PointerMove,this.onInputPointerMove),this.context.input.addEventListener(Ie.PointerUp,this.onInputPointerUp),this._engineElementOverserver||=new MutationObserver(e=>{for(let t of e)if(t.type===`attributes`&&t.attributeName===si){let e=this.context.domElement.getAttribute(si);e!==null&&this.trySelectSceneFromValue(e)}}),this._engineElementOverserver.observe(this.context.domElement,{attributes:!0}),this._preloadScheduler||=new di(this),this._preloadScheduler.maxLoadAhead=this.preloadNext,this._preloadScheduler.maxLoadBehind=this.preloadPrevious,this._preloadScheduler.maxConcurrent=this.preloadConcurrent,this._preloadScheduler.begin(2e3),this.autoLoadFirstScene&&this._currentIndex===-1&&!await this.tryLoadFromQueryParam()){let e=this.context.domElement.getAttribute(si);try{(e===null||!await this.trySelectSceneFromValue(e))&&this._currentIndex===-1&&this.select(0)}finally{}}this.createMenuButtons&&(this._menuButtons??=[],this._menuButtons.push(this.context.menu.appendChild({label:`Previous`,icon:`arrow_back_ios`,onClick:()=>this.selectPrev(),priority:-1005,class:`row2`})),this._menuButtons.push(this.context.menu.appendChild({label:`Next`,icon:`arrow_forward_ios`,iconSide:`right`,onClick:()=>this.selectNext(),priority:-1e3,class:`row2`})))}onDisable(){if(globalThis.removeEventListener(`popstate`,this.onPopState),this.context.input.removeEventListener(Ie.KeyDown,this.onInputKeyDown),this.context.input.removeEventListener(Ie.PointerMove,this.onInputPointerMove),this.context.input.removeEventListener(Ie.PointerUp,this.onInputPointerUp),this._preloadScheduler?.stop(),this._menuButtons){for(let e of this._menuButtons)e.remove();this._menuButtons=void 0}}onPopState=async e=>{if(!this.useHistory)return;let t=this.useHistory;try{this.useHistory=!1;let t=!1;if(this.queryParameterName&&(t=await this.tryLoadFromQueryParam()),!t){let t=e?.state;if(t&&t.startsWith(this.guid)){let e=t.substr(this.guid.length+2);U&&console.log(`PopState`,e),await this.trySelectSceneFromValue(e)}}}finally{this.useHistory=t}};normalizedSwipeThresholdX=.1;_didSwipe=!1;onInputPointerMove=e=>{if(this.useSwipe&&!this._didSwipe&&e.button===0&&e.pointerType===`touch`&&this.context.input.getPointerPressedCount()===1){let t=this.context.input.getPointerPositionDelta(e.button);if(t){let e=t.x/this.context.domWidth;e>=this.normalizedSwipeThresholdX?(this._didSwipe=!0,this.selectPrev()):e<=-this.normalizedSwipeThresholdX&&(this._didSwipe=!0,this.selectNext())}}};onInputPointerUp=e=>{e.button===0&&(this._didSwipe=!1)};onInputKeyDown=e=>{if(!this.useKeyboard||!this.scenes)return;let t=e.key.toLowerCase();if(!t)return;let n=parseInt(t)-1;if(n>=0){this.trySelectSceneFromValue(n);return}switch(t){case`arrowright`:case`d`:this.selectNext();break;case`arrowleft`:case`a`:this.selectPrev();break}};addScene(e){if(typeof e==`string`){let t=this.context.addressables.findAssetReference(e);return t||(t=new Me(e),this.context.addressables.registerAssetReference(t)),this.scenes.push(t),t}return this.scenes.push(e),e}selectNext(){return this.select(this._currentIndex+1)}selectPrev(){return this.select(this._currentIndex-1)}select(e){if(U&&console.log(`[SceneSwitcher] select`,e),typeof e==`object`&&console.warn(`[SceneSwitcher] Switching to "`+e+`" might not work. Please either use an index or a AssetReference (not a scene reference)`),typeof e==`string`){let t=this.scenes?.find(t=>t.url===e);if(!t){let t=Me.getOrCreate(this.sourceId??``,e,this.context);return this.switchScene(t)}if(t)e=this.scenes?.indexOf(t);else return li}if(!this.scenes?.length)return li;if(e<0){if(this.clamp)return li;e=this.scenes.length-1}else if(e>=this.scenes.length){if(this.clamp)return li;e=0}let t=this.scenes[e];return this.switchScene(t)}unload(){return this.__lastSwitchScene=void 0,this.__lastSwitchScenePromise=void 0,this.__unloadCurrentScene()}async reload(){if(this.__lastSwitchScene){let e=this.__lastSwitchScene;return this.__lastSwitchScene=void 0,this.switchScene(e)}return!1}async switchScene(e){if(!(e instanceof Me)){let t=typeof e;if(t===`string`||t===`number`)return this.select(e);if(e&&e instanceof y){let t=this.scenes?.indexOf(e);e=new Me(e.name,void 0,e),t>=0&&(this.scenes[t]=e)}else return console.warn(`[SceneSwitcher] Can't switch to scene of type ${t}`),!1}return e.url===this.sourceId?(console.warn(`[SceneSwitcher] Can't load own scene - prevent recursive loading`,this.sourceId),!1):this.__lastSwitchScene===e&&this.__lastSwitchScenePromise?this.__lastSwitchScenePromise:(this.__lastSwitchScene=e,this.__lastSwitchScenePromise=this.__internalSwitchScene(e),await this.__lastSwitchScenePromise)}async __unloadCurrentScene(){let e=this._currentScene;if(this._currentScene=void 0,e){U&&console.log(`[SceneSwitcher] UNLOAD`,e.url,`HasURL?: `+e.hasUrl);let t=this.tryGetSceneEventListener(e.asset);if(t?.sceneClosing){let e=t.sceneClosing();e instanceof Promise&&await e}e.hasUrl?(e.unload(),this._currentSceneAsset&&L(this._currentSceneAsset,!0,!1)):F.remove(this._currentSceneAsset)}}_currentlyLoadingScene;async __internalSwitchScene(e){await this.__unloadCurrentScene();let t=this._currentIndex=this.scenes?.indexOf(e)??-1;try{U&&console.debug(`${Date.now()} [SceneSwitcher] Loading scene start: ${e.url} (index: ${t})`),this._currentlyLoadingScene=e,this._currentLoadingProgress=new ProgressEvent(`progress`,{loaded:0,total:1});let n=new CustomEvent(`loadscene-start`,{detail:{scene:e,switcher:this,index:t}});this.dispatchEvent(n),this.sceneLoadingStart?.invoke(n.detail),await this.onStartLoading(),await e.loadAssetAsync((t,n)=>{if(U){let t=n.loaded/n.total,r=`[`+`=`.repeat(Math.floor(t*20))+`-`.repeat(20-Math.floor(t*20))+`]`;console.debug(`${Date.now()} [SceneSwitcher] Loading scene progress: ${(t*100).toFixed(1)} % ${r}`,e.url)}this._currentLoadingProgress=n,this.dispatchEvent(n),this.sceneLoadingProgress?.invoke(n)}).catch(console.error),await this.onEndLoading();let r=new CustomEvent(`loadscene-finished`,{detail:{scene:e,switcher:this,index:t}});if(this.dispatchEvent(r),this._currentLoadingProgress=void 0,this._currentlyLoadingScene=void 0,r.defaultPrevented)return U&&console.warn(`[SceneSwitcher] Adding loaded scene prevented:`,e,r),!1;if(!e.asset)return U&&console.warn(`[SceneSwitcher] Failed loading scene:`,e),!1;if(this._currentIndex===t){if(U&&console.log(`[SceneSwitcher] ADD`,e.url),this._currentScene=e,oi){let e=this.context.mainCameraComponent?.gameObject||this.context.mainCamera;e?.removeFromParent();let t=this.gameObject.removeFromParent();L(this.context.scene,!0,!0),this.context.scene=new p,this.context.scene.add(t),e&&this.context.scene.add(e)}if(e.asset.parent?this._currentSceneAsset=tt(e.asset,{parent:this.gameObject}):(this._currentSceneAsset=e.asset,F.add(e.asset,this.gameObject)),this.useSceneLighting&&this.context.sceneLighting.enable(e),this.useSceneBackground){let t=this.context.lightmaps.tryGetSkybox(e.url);t?(t.mapping!==306&&(t.mapping=303),this.context.scene.background=t):U&&console.warn(`[SceneSwitcher] Can't find skybox for scene `+e.url)}if(this.useHistory&&t>=0){let n=t.toString();if(this.useSceneName&&(e instanceof y?n=e.name:e.url&&(n=ui(e.url))),this.queryParameterName?.length)Ve(this.queryParameterName,n,this.useHistory);else{let e=history.state,n=this.guid+`::`+t;e!==n&&history.pushState(n,`unused`,location.href)}}let n=this.tryGetSceneEventListener(e.asset);if(n?.sceneOpened){let e=n.sceneOpened(this);e instanceof Promise&&await e}U&&console.debug(`${Date.now()} [SceneSwitcher] Loading scene finished: ${e.url} (index: ${t})`);let r=new CustomEvent(`scene-opened`,{detail:{scene:e,switcher:this,index:t}});return this.dispatchEvent(r),this.sceneLoaded?.invoke(this),!0}}catch(e){console.error(e)}return!1}preload(e){if(e>=0&&e=0&&t=0&&ee!=null),await this._loadingScenePromise,this._isCurrentlyLoading&&this.loadingScene?.asset)){U&&console.log(`Add loading scene`,this.loadingScene.url,this.loadingScene.asset);let e=this.loadingScene.asset;F.add(e,this.gameObject);let t=this.tryGetSceneEventListener(e);if(t?.sceneOpened){let e=t.sceneOpened(this);e instanceof Promise&&await e}}if(this._isCurrentlyLoading){let e=this.tryGetSceneEventListener(this.gameObject);if(e&&e.sceneOpened){let t=e.sceneOpened(this);t instanceof Promise&&await t}}}async onEndLoading(){if(this._isCurrentlyLoading=!1,this.loadingScene?.asset){U&&console.log(`Remove loading scene`,this.loadingScene.url);let e=this.loadingScene.asset,t=this.tryGetSceneEventListener(e);if(typeof t?.sceneClosing==`function`){let e=t.sceneClosing();e instanceof Promise&&await e}F.remove(e)}if(!this._isCurrentlyLoading){let e=this.tryGetSceneEventListener(this.gameObject);if(e&&e.sceneClosing){let t=e.sceneClosing();t instanceof Promise&&await t}}}tryGetSceneEventListener(e,t=0){if(!e)return null;let n=F.foreachComponent(e,e=>{let t=e;if(t.sceneClosing||t.sceneOpened)return t});if(t===0&&!n&&e.children.length)for(let n of e.children){let e=this.tryGetSceneEventListener(n,t+1);if(e)return e}return n||null}};H([A()],W.prototype,`autoLoadFirstScene`,void 0),H([A(Me)],W.prototype,`scenes`,void 0),H([A(Me)],W.prototype,`loadingScene`,void 0),H([A()],W.prototype,`queryParameterName`,void 0),H([A()],W.prototype,`useSceneName`,void 0),H([A()],W.prototype,`clamp`,void 0),H([A()],W.prototype,`useHistory`,void 0),H([A()],W.prototype,`useKeyboard`,void 0),H([A()],W.prototype,`useSwipe`,void 0),H([A()],W.prototype,`useSceneLighting`,void 0),H([A()],W.prototype,`useSceneBackground`,void 0),H([A()],W.prototype,`preloadNext`,void 0),H([A()],W.prototype,`preloadPrevious`,void 0),H([A()],W.prototype,`preloadConcurrent`,void 0),H([A()],W.prototype,`createMenuButtons`,void 0),H([A(k)],W.prototype,`sceneLoadingStart`,void 0),H([A(k)],W.prototype,`sceneLoadingProgress`,void 0),H([A(k)],W.prototype,`sceneLoaded`,void 0);function ui(e){let t=e.split(`/`).pop()?.split(`.`).shift();return t?.length?t:e}var di=class{maxLoadAhead;maxLoadBehind;maxConcurrent;_isRunning=!1;_switcher;_loadTasks=[];_maxConcurrentLoads=1;constructor(e,t=1,n=1,r=2){this._switcher=e,this.maxLoadAhead=t,this.maxLoadBehind=n,this.maxConcurrent=r}begin(e){if(this._isRunning)return;U&&console.log(`[SceneSwitcher] Preload scheduled`,{delay:e}),this._isRunning=!0;let t=-10,n,r,i=this._switcher.scenes,a=Date.now()+e,o=setInterval(()=>{if(this.allLoaded()&&(U&&console.log(`[SceneSwitcher] All scenes (pre-)loaded`),this.stop()),!this._isRunning){clearInterval(o);return}if(Date.now()s)return;let c=e?t+n:t-n;if(!(c<0)&&!(c<0||c>=i.length)&&!this._loadTasks.some(e=>e.index===c)){let n=i[c];U&&console.log(`[SceneSwitcher] Schedule preload scene`,{roomIndex:c,searchForward:e,lastRoom:t,currentIndex:this._switcher.currentIndex,tasks:this._loadTasks.length},n?.url),new fi(c,n,this._loadTasks)}},200)}stop(){this._isRunning=!1}canLoadNewScene(){return this._loadTasks.length=0&&this.tasks.splice(e,1)}},pi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},G=N(`debugskybox`);function mi(){ai(`background-image`),ai(`environment-image`)}var hi={studio:{url:`https://cdn.needle.tools/static/skybox/modelviewer-Neutral.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.pmrem4x4.ktx2?pmrem`},"blurred-skybox":{url:`https://cdn.needle.tools/static/skybox/blurred-skybox.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/blurred-skybox-small.pmrem4x4.ktx2?pmrem`},"quicklook-ar":{url:`https://cdn.needle.tools/static/skybox/QuickLook-ARMode.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.pmrem4x4.ktx2?pmrem`},quicklook:{url:`https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.pmrem4x4.ktx2?pmrem`,url_low:`https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.pmrem4x4.ktx2?pmrem`}};function gi(e,t,n,r,i){if(t===`transparent`||t?.startsWith(`rgb`)||t?.startsWith(`#`))return console.warn(`Needle Engine: Invalid ${i} value (${t}). Did you mean to set background-color instead?`),null;let a=new vi;a.sourceId=Je(t),a.allowDrop=!1,a.allowNetworking=!1,a.background=n,a.environment=r,F.addComponent(e.scene,a);let o=t=>{if(G&&console.log(i,`CHANGED TO`,t),t){if(typeof t!=`string`){console.warn(`Invalid attribute value for `+i);return}a.setSkybox(t)}else if(a.sourceId&&(r&&(e.sceneLighting.internalEnableReflection(a.sourceId)||(e.scene.environment=null)),n)){let t=e.lightmaps.tryGetSkybox(a.sourceId);e.scene.background=t}};return Dt(e.domElement,i,o),a.addEventListener(`destroy`,()=>{G&&console.log(`Destroyed attribute remote skybox`,i),Ae(e.domElement,i,o)}),a.setSkybox(t)}var _i=[];lt.registerCallback(st.ContextCreationStart,e=>{let t=e.context,n=t.domElement.getAttribute(`background-image`),r=t.domElement.getAttribute(`environment-image`);if(n){G&&console.log(`Creating RemoteSkybox to load background `+n);let e=gi(t,n,!0,!1,`background-image`);e&&_i.push(e)}if(r){G&&console.log(`Creating RemoteSkybox to load environment `+r);let e=gi(t,r,!1,!0,`environment-image`);e&&_i.push(e)}}),lt.registerCallback(st.ContextCreationStart,()=>Promise.all(_i).finally(()=>{_i.length=0}));var vi=class extends R{url=`studio`;allowDrop=!0;background=!0;environment=!0;allowNetworking=!0;_prevUrl;_prevLoadedEnvironment;_prevEnvironment=null;_prevBackground=null;onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,Ne.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),this.context.mainCameraComponent?.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):G&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(e,t){if(!this.activeAndEnabled||(e=yi(e,this.environment,this.background),!e))return!1;if(t??=e,this.isValidTextureType(t)||console.warn(`Potentially invalid skybox URL: "`+t+`" on `+(this.name||this.gameObject?.name||`context`)),G&&console.log(`Set RemoteSkybox url: `+e),this._prevUrl===e&&this._prevLoadedEnvironment)return this.apply(),!0;this._prevLoadedEnvironment?.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=e;let n=await pr(e,this.context.renderer);return n?!this.enabled||this.destroyed?(G&&console.warn(`RemoteSkybox: Component is disabled or destroyed`),!1):this._prevUrl===e?(this.url=e,this._prevLoadedEnvironment=n,this.apply(),!0):(G&&console.warn(`RemoteSkybox: URL changed while loading texture, aborting setSkybox`),!1):(G&&console.warn(`RemoteSkybox: Failed to load texture from url`,e),!1)}apply(){let e=this._prevLoadedEnvironment;if(e&&(e instanceof ee||e instanceof d||e.mapping==306||(e.mapping=304,e.needsUpdate=!0),!this.destroyed)){if(!this.context){console.warn(`RemoteSkybox: Context is not available - can not apply skybox.`);return}this.context.scene.background!==e&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==e&&(this._prevEnvironment=this.context.scene.environment),G&&console.log(`Set RemoteSkybox (`+(this.environment&&this.background?`environment and background`:this.environment?`environment`:this.background?`background`:`none`)+`)`,this.url,!Ne.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=e),this.background&&!Ne.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=e),this.context.mainCameraComponent?.backgroundBlurriness!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness)}}validProtocols=[`file:`,`blob:`,`data:`];validTextureTypes=[`.ktx2`,`.hdr`,`.exr`,`.jpg`,`.jpeg`,`.png`];isRemoteTexture(e){return e.startsWith(`http://`)||e.startsWith(`https://`)}isValidTextureType(e){for(let t of this.validTextureTypes)if(e.includes(t))return!0;for(let t of this.validProtocols)if(e.startsWith(t))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener(`dragover`,this.onDragOverEvent),this.context.domElement.addEventListener(`drop`,this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener(`dragover`,this.onDragOverEvent),this.context.domElement.removeEventListener(`drop`,this.onDrop)}onDragOverEvent=e=>{if(this.allowDrop&&e.dataTransfer)for(let t of e.dataTransfer.types)(t===`text/uri-list`||t===`Files`)&&e.preventDefault()};onDrop=e=>{if(this.allowDrop&&e.dataTransfer){for(let t of e.dataTransfer.types)if(G&&console.log(t),t===`text/uri-list`){let n=e.dataTransfer.getData(t);G&&console.log(t,n);let r=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?.+)\.png/).exec(n)?.groups?.name;if(r||=new RegExp(/polyhaven\.com\/a\/(?.+)/).exec(n)?.groups?.name,G&&console.log(r),r){let t=`https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/`+r+`_1k.exr`;console.log(`[Remote Skybox] Setting skybox from url: ${t}`),e.preventDefault(),this.setSkybox(t);break}else if(this.isValidTextureType(n)){console.log(`[Remote Skybox] Setting skybox from url: `+n),e.preventDefault(),this.setSkybox(n);break}else{console.warn(`[RemoteSkybox] Unknown url ${n}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(`, `)}.`);let t=new CustomEvent(`dropped-unknown-url`,{detail:{sender:this,event:e,url:n,apply:t=>{e.preventDefault(),this.setSkybox(t)}}});this.dispatchEvent(t)}}else if(t==`Files`){let n=e.dataTransfer.files.item(0);if(G&&console.log(t,n),!n)continue;if(!this.isValidTextureType(n.name)){console.warn(`[RemoteSkybox]: File \"${n.name}\" is not supported. Supported files are ${this.validTextureTypes.join(`, `)}`);return}e.preventDefault(),this.setSkybox(n.name);break}}}};pi([Wn(vi.prototype.urlChangedSyncField),A(URL)],vi.prototype,`url`,void 0),pi([A()],vi.prototype,`allowDrop`,void 0),pi([A()],vi.prototype,`background`,void 0),pi([A()],vi.prototype,`environment`,void 0),pi([A()],vi.prototype,`allowNetworking`,void 0);function yi(e,t,n){if(e==null)return null;let r=t&&!n,i=hi[e.toLowerCase()];return i?r?i.url_low:i.url:(typeof e==`string`&&e?.length&&(w()||G)&&(e.includes(`/`)||e.includes(`.`)||console.warn(`RemoteSkybox: Unknown magic skybox name "${e}". Valid names are: ${Object.keys(hi).map(e=>`"${e}"`).join(`, `)}`)),e)}var bi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xi=class extends R{from;to;width=0;centered=!0;_centerPos;awake(){this._centerPos=new n}update(){if(!this.from||!this.to)return;let e=M(this.from).clone(),t=M(this.to).clone(),n=e.distanceTo(t);this._centerPos.copy(e),this._centerPos.add(t),this._centerPos.multiplyScalar(.5),Oe(this.gameObject,this.centered?this._centerPos:e),this.gameObject.lookAt(M(this.to).clone()),this.gameObject.scale.set(this.width,this.width,n)}};bi([A(F)],xi.prototype,`from`,void 0),bi([A(F)],xi.prototype,`to`,void 0);var Si=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ci=class extends R{length=1;depthTest=!0;isGizmo=!1;_axes=null;onEnable(){if(this.isGizmo&&!Lt)return;this._axes||=new se(this.length),this._axes.layers.disableAll(),this._axes.layers.set(this.layer),this.gameObject.add(this._axes);let e=this._axes.material;e&&e.depthTest!==void 0&&(e.depthTest=this.depthTest)}onDisable(){this._axes&&this.gameObject.remove(this._axes)}};Si([A()],Ci.prototype,`length`,void 0),Si([A()],Ci.prototype,`depthTest`,void 0),Si([A()],Ci.prototype,`isGizmo`,void 0);var wi=class extends R{from;to;hint;desiredDistance=1;onEnable(){}update(){if(!this.from||!this.to||!this.hint)return;let e=M(this.to).clone(),t=M(this.from).clone(),r=e.distanceTo(t),i=e.clone();i.sub(t);let a=t.clone();a.add(e),a.multiplyScalar(.5);let o=M(this.hint).clone();o.sub(a);let s=new n;s.crossVectors(o,i),s.crossVectors(i,s),s.normalize();let c=r*.5,l=Math.max(this.desiredDistance,c),u=Math.sqrt(l*l-c*c),d=s.clone();d.multiplyScalar(u),d.add(a),Oe(this.gameObject,d);let f=a.clone();f.sub(s),this.gameObject.lookAt(f)}},Ti=N(`gizmos`),Ei=N(`debugboxhelper`),Di=class e extends R{box=null;static testBox=new ie;_lastMatrixUpdateFrame=-1;static _position=new n;static _size=new n(.01,.01,.01);static _emptyObjectSize=new n(.01,.01,.01);isInBox(t){if(!t)return;if(this.box||=new ie,Nt([t],void 0,void 0,e.testBox),e.testBox.isEmpty()){let n=M(t,e._position);e.testBox.setFromCenterAndSize(n,e._emptyObjectSize)}this.updateBox();let n=this.box?.intersectsBox(e.testBox);return n&&Ei&&V.DrawWireBox3(e.testBox,16711680,5),n}intersects(e){return e?this.updateBox(!1).intersectsBox(e):!1}updateBox(t=!1){if(this.box||=new ie,t||this.context.time.frameCount!=this._lastMatrixUpdateFrame){let t=this._lastMatrixUpdateFrame<0;this._lastMatrixUpdateFrame=this.context.time.frameCount;let n=t,r=M(this.gameObject,e._position,n),i=_t(this.gameObject,e._size);this.box.setFromCenterAndSize(r,i)}return this.box}_helper=null;_color=null;awake(){this._helper=null,this._color=null,this.box=null}showHelper(e=null,t=!1){if(!(!Ti&&!t)){if(this._helper){e&&this._color?.set(e),this.gameObject.add(this._helper);return}this._helper=Pt(e),this.gameObject.add(this._helper)}}},Oi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ki=N(`debugcharactercontroller`),Ai=class extends R{center=new n(0,0,0);radius=.5;height=2;_rigidbody=null;get rigidbody(){return this._rigidbody?this._rigidbody:(this._rigidbody=this.gameObject.getComponent(E),this._rigidbody||=this.gameObject.addComponent(E),this.rigidbody)}_activeGroundCollisions;awake(){this._activeGroundCollisions=new Set}onEnable(){let e=this.rigidbody,t=this.gameObject.getComponent(Mn);t||=this.gameObject.addComponent(Mn),t.center.copy(this.center),t.radius=this.radius,t.height=this.height;let r=new n(0,0,1),i=new n(1,0,0),a=new n(0,1,0),o=this.gameObject.getWorldDirection(new n);o.y=0;let s=i.dot(o)<0?-1:1,c=r.angleTo(o)*s;this.gameObject.setRotationFromAxisAngle(a,c),e.lockRotationX=!0,e.lockRotationY=!0,e.lockRotationZ=!0}move(e){this.gameObject.position.add(e)}onCollisionEnter(e){(e.contacts.length==0||e.contacts.some(e=>e.normal.y>.2))&&(this._activeGroundCollisions.add(e),ki&&console.log(`Collision(${this._activeGroundCollisions.size}): ${e.contacts.map(e=>e.normal.y.toFixed(2)).join(`, `)} - ${this.isGrounded}`))}onCollisionExit(e){this._activeGroundCollisions.delete(e),ki&&console.log(`Collision(${this._activeGroundCollisions.size}) - ${this.isGrounded}`)}get isGrounded(){return this._activeGroundCollisions.size>0}_contactVelocity=new n;get contactVelocity(){this._contactVelocity.set(0,0,0);for(let e of this._activeGroundCollisions){let t=this.context.physics.engine?.getLinearVelocity(e.collider);t&&(this._contactVelocity.x+=t.x,this._contactVelocity.y+=t.y,this._contactVelocity.z+=t.z)}return this._contactVelocity}};Oi([A(n)],Ai.prototype,`center`,void 0),Oi([A()],Ai.prototype,`radius`,void 0),Oi([A()],Ai.prototype,`height`,void 0);var ji=class extends R{controller;movementSpeed=2;rotationSpeed=2;jumpForce=1;doubleJumpForce=2;animator;lookForward=!0;awake(){this._currentRotation=new x}update(){let e=this.context.input;e.isKeyPressed(`KeyW`)?this.moveInput.y+=1:e.isKeyPressed(`KeyS`)&&--this.moveInput.y,e.isKeyPressed(`KeyD`)?this.lookInput.x+=1:e.isKeyPressed(`KeyA`)&&--this.lookInput.x,this.jumpInput||=e.isKeyDown(`Space`)}move(e){this.moveInput.add(e)}look(e){this.lookInput.add(e)}jump(){this.jumpInput=!0}lookInput=new b(0,0);moveInput=new b(0,0);jumpInput=!1;onBeforeRender(){this.handleInput(this.moveInput,this.lookInput,this.jumpInput),this.lookInput.set(0,0),this.moveInput.set(0,0),this.jumpInput=!1}_currentSpeed=new n(0,0,0);_currentAngularSpeed=new n(0,0,0);_temp=new n(0,0,0);_jumpCount=0;_currentRotation;handleInput(e,t,r){if(this.controller?.isGrounded&&(this._jumpCount=0,this.doubleJumpForce>0&&this.animator?.setBool(`doubleJump`,!1)),this._currentSpeed.z+=e.y*this.movementSpeed*this.context.time.deltaTime,this.animator?.setBool(`running`,e.length()>.01),this.animator?.setBool(`jumping`,this.controller?.isGrounded===!0&&r),this._temp.copy(this._currentSpeed),this._temp.applyQuaternion(this.gameObject.quaternion),this.controller?this.controller.move(this._temp):this.gameObject.position.add(this._temp),this._currentAngularSpeed.y+=O.toRadians(-t.x*this.rotationSpeed)*this.context.time.deltaTime,this.lookForward&&Math.abs(this._currentAngularSpeed.y)<.01){let e=this.context.mainCameraComponent.forward;e.y=0,e.normalize(),this._currentRotation.setFromUnitVectors(new n(0,0,1),e),this.gameObject.quaternion.slerp(this._currentRotation,this.context.time.deltaTime*10)}if(this.gameObject.rotateY(this._currentAngularSpeed.y),this._currentSpeed.multiplyScalar(1-this.context.time.deltaTime*10),this._currentAngularSpeed.y*=1-this.context.time.deltaTime*10,this.controller&&r&&this.jumpForce>0){let e=this.controller?.isGrounded;if(this.doubleJumpForce>0&&!this.controller?.isGrounded&&this._jumpCount===1&&(e=!0,this.animator?.setBool(`doubleJump`,!0)),e){this._jumpCount+=1;let e=this.controller.rigidbody,t=this._jumpCount===2?this.doubleJumpForce:this.jumpForce;e.applyImpulse(new n(0,1,0).multiplyScalar(t))}}if(this.controller){let e=this.controller?.rigidbody.getVelocity().y;if(e<-1){this._raycastOptions.ray||(this._raycastOptions.ray=new a),this._raycastOptions.ray.origin.copy(M(this.gameObject)),this._raycastOptions.ray.direction.set(0,-1,0);let t=this.layer;this.gameObject.layers.disableAll(),this.gameObject.layers.set(2);let n=this.context.physics.raycast(this._raycastOptions);this.gameObject.layers.set(t),(n.length&&n[0].distance>2||e<-10)&&this.animator?.setBool(`falling`,!0)}else this.animator?.setBool(`falling`,!1)}}_raycastOptions=new Gt};Oi([A(Ai)],ji.prototype,`controller`,void 0),Oi([A()],ji.prototype,`movementSpeed`,void 0),Oi([A()],ji.prototype,`rotationSpeed`,void 0),Oi([A()],ji.prototype,`jumpForce`,void 0),Oi([A()],ji.prototype,`doubleJumpForce`,void 0),Oi([A(it)],ji.prototype,`animator`,void 0);var Mi=N(`logstats`),Ni=class extends R{onEnable(){console.log(this),Mi&&this.startCoroutine(this.run(),an.OnAfterRender)}*run(){for(;this.enabled;){let e=this.context.renderer.info;console.log(e.memory,e.render,e.programs),yield}}},Pi=class extends R{isUsed=!0;usedBy=null},Fi=class extends R{},Ii=N(`debugdeletable`),Li=class e extends Di{static _instances=[];onEnable(){e._instances.push(this)}onDisable(){let t=e._instances.indexOf(this);t>=0&&e._instances.splice(t,1)}},Ri=class extends R{update(){for(let e of Li._instances){let t=this.gameObject;if(e.isInBox(t)===!0){let t=F.getComponentInParent(this.gameObject,Pi);if(t)Ii&&console.warn(`DeleteBox: Not deleting object with usage marker`,this.guid,t);else{if(Ii)try{if(e.box){let t=e.box,n=Di.testBox;V.DrawWireBox3(t,16711680,5),V.DrawWireBox3(n,255,5),console.log(`DeleteBox: Destroying`,this.gameObject,{deleteBoxArea:t,deletedObjectArea:n})}else console.log(`DeleteBox: Destroying`,this.gameObject)}catch{}xt(this.gameObject,this.context.connection)}}}}},zi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Bi;(function(e){e[e.Never=0]=`Never`,e[e.Desktop=1]=`Desktop`,e[e.Mobile=2]=`Mobile`})(Bi||={});var Vi=class extends R{visibleOn;onEnable(){this.apply()}apply(){this.test()||F.setActive(this.gameObject,!1)}test(){return this.visibleOn<0?!0:yt.isMobileDevice()?(this.visibleOn&Bi.Mobile)!==0:(this.visibleOn&Bi.Desktop)!==0}};zi([A()],Vi.prototype,`visibleOn`,void 0);var Hi=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ui=N(`debugdrag`),Wi=[],K;(function(e){e[e.XZPlane=0]=`XZPlane`,e[e.Attached=1]=`Attached`,e[e.HitNormal=2]=`HitNormal`,e[e.DynamicViewAngle=3]=`DynamicViewAngle`,e[e.SnapToSurfaces=4]=`SnapToSurfaces`,e[e.None=5]=`None`})(K||={});var Gi=class e extends R{static get HasAnySelected(){return this._active>0}static _active=0;static get CurrentlySelected(){Wi.length=0;for(let e of this._instances)e._isDragging&&Wi.push(e);return Wi}static _instances=[];dragMode=K.DynamicViewAngle;snapGridResolution=0;keepRotation=!0;xrDragMode=K.Attached;xrKeepRotation=!1;xrDistanceDragFactor=1;showGizmo=!1;get draggedObject(){return this._targetObject}setTargetObject(e){this._targetObject=e;for(let t of this._dragHandlers.values())t.setTargetObject(e);let t=`_rigidbody-was-kinematic`;this._rigidbody?.[t]===!1&&(this._rigidbody.isKinematic=!1,this._rigidbody[t]=void 0),this._rigidbody=null,e&&(this._rigidbody=F.getComponentInChildren(e,E),this._rigidbody?.isKinematic===!1&&(this._rigidbody.isKinematic=!0,this._rigidbody[t]=!1))}_rigidbody=null;_targetObject=null;_dragHelper=null;static lastHovered;_draggingRigidbodies=[];_potentialDragStartEvt=null;_dragHandlers=new Map;_totalMovement=new n;_marker=null;_isDragging=!1;_didDrag=!1;awake(){this._potentialDragStartEvt=null,this._dragHandlers=new Map,this._totalMovement=new n,this._marker=null,this._isDragging=!1,this._didDrag=!1,this._dragHelper=null,this._draggingRigidbodies=[]}start(){this.gameObject.getComponentInParent(C)||this.gameObject.addComponent(C)}onEnable(){e._instances.push(this),this.context.accessibility.updateElement(this,{role:`button`,label:`Drag `+(this.gameObject.name||`object`),hidden:!1})}onDisable(){this.context.accessibility.updateElement(this,{hidden:!0}),e._instances=e._instances.filter(e=>e!==this)}onDestroy(){this.context.accessibility.removeElement(this)}allowEdit(e=null){return this.context.connection.allowEditing}onPointerEnter(t){if(!this.allowEdit(this.gameObject)||t.mode!==`screen`||(t.event.mode===`tracked-pointer`||t.event.mode===`transient-pointer`?this.xrDragMode:this.dragMode)===K.None)return;let n=F.getComponentInParent(t.object,e);!n||n!==this||(e.lastHovered=t.object,this.context.domElement.style.cursor=`pointer`,this.context.accessibility.hover(this,`Draggable ${t.object?.name}`))}onPointerMove(e){(this._isDragging||this._potentialDragStartEvt!==null)&&e.use()}onPointerExit(t){this.allowEdit(this.gameObject)&&t.mode===`screen`&&e.lastHovered===t.object&&(this.context.domElement.style.cursor=`auto`)}onPointerDown(t){if(this.allowEdit(this.gameObject)&&!t.used&&(t.mode===`tracked-pointer`||t.mode===`transient-pointer`?this.xrDragMode:this.dragMode)!==K.None&&(e.lastHovered=t.object,t.button===0)){this._dragHandlers.size===0&&(this._didDrag=!1,this._totalMovement.set(0,0,0),this._potentialDragStartEvt=t),this._targetObject||this.setTargetObject(this.gameObject),e._active+=1;let n=new qi(this,this._targetObject);if(this._dragHandlers.set(t.event.space,n),n.onDragStart(t),this._dragHandlers.size===2){let e=this._dragHandlers.values(),n=e.next().value,r=e.next().value;if(n instanceof qi&&r instanceof qi){let e=new Ki(this,this._targetObject,n,r);this._dragHandlers.set(this.gameObject,e),e.onDragStart(t)}else console.error(`Attempting to construct a MultiTouchDragHandler with invalid DragPointerHandlers. This is likely a bug.`,{a:n,b:r})}t.use(),this.context.accessibility.updateElement(this,{role:`button`,label:`Dragging `+(this.gameObject.name||`object`),hidden:!1,busy:!0}),this.context.accessibility.focus(this)}}onPointerUp(t){if(Ui&&V.DrawLabel(t.point??this.gameObject.worldPosition,`POINTERUP:`+t.pointerId+`, `+t.button,.03,3),!this.allowEdit(this.gameObject)||t.button!==0)return;this._potentialDragStartEvt=null;let n=this._dragHandlers.get(t.event.space),r=this._dragHandlers.get(this.gameObject);r&&(r.handlerA===n||r.handlerB===n)&&(this._dragHandlers.delete(this.gameObject),r.onDragEnd(t)),n&&(e._active>0&&--e._active,this.setTargetObject(null),n.onDragEnd&&n.onDragEnd(t),this._dragHandlers.delete(t.event.space),this._dragHandlers.size===0&&this.onLastDragEnd(t),t.use()),this.context.accessibility.unfocus(this),this.context.accessibility.updateElement(this,{busy:!1})}update(){for(let e of this._dragHandlers.values())e.collectMovementInfo&&e.collectMovementInfo(),e.getTotalMovement&&this._totalMovement.add(e.getTotalMovement());if(this._potentialDragStartEvt){if(!this._didDrag)if(this._totalMovement.length()>3e-4)this._didDrag=!0;else return;let e=this._potentialDragStartEvt;this._potentialDragStartEvt=null,this.onFirstDragStart(e)}for(let e of this._dragHandlers.values())e.onDragUpdate&&e.onDragUpdate(this._dragHandlers.size);this._dragHelper&&this._dragHelper.hasSelected&&this.onAnyDragUpdate()}onFirstDragStart(t){if(!t||!t.object)return;let n=F.getComponentInParent(t.object,e);if(!n||n!==this&&n._isDragging)return;let r=this._targetObject||this.gameObject;if(!r)return;this._isDragging=!0;let i=F.getComponentInChildren(r,rt);Ui&&console.log(`DRAG START`,i,r),i&&(i.fastMode=!0,i?.requestOwnership()),this._marker=F.addComponent(r,Pi),this._draggingRigidbodies.length=0;let a=F.getComponentsInChildren(r,E);a&&this._draggingRigidbodies.push(...a),r.matrixAutoUpdate===!1&&!globalThis[`DragControls:MatrixWarningShown`]&&(globalThis[`DragControls:MatrixWarningShown`]=!0,console.warn(`Dragging an object with matrixAutoUpdate=false can lead to unexpected behavior. Consider enabling matrixAutoUpdate or updating the matrix manually during dragging.`))}onAnyDragUpdate(){if(!this._dragHelper)return;this._dragHelper.showGizmo=this.showGizmo,this._dragHelper.onUpdate(this.context);for(let e of this._draggingRigidbodies)e.wakeUp(),e.resetVelocities(),e.resetForcesAndTorques();let e=this._targetObject||this.gameObject;qe.markDirty(e)}onLastDragEnd(e){if(!this||!this._isDragging)return;this._isDragging=!1;for(let e of this._draggingRigidbodies)e.setVelocity(e.smoothedVelocity.multiplyScalar(this.context.time.deltaTime));if(this._draggingRigidbodies.length=0,this._targetObject=null,e?.object){let t=F.getComponentInChildren(e.object,rt);t&&(t.fastMode=!1)}if(this._marker&&this._marker.destroy(),!this._dragHelper)return;let t=this._dragHelper.selected;Ui&&console.log(`DRAG END`,t,t?.visible),this._dragHelper.setSelected(null,this.context)}};Hi([A()],Gi.prototype,`dragMode`,void 0),Hi([A()],Gi.prototype,`snapGridResolution`,void 0),Hi([A()],Gi.prototype,`keepRotation`,void 0),Hi([A()],Gi.prototype,`xrDragMode`,void 0),Hi([A()],Gi.prototype,`xrKeepRotation`,void 0),Hi([A()],Gi.prototype,`xrDistanceDragFactor`,void 0),Hi([A()],Gi.prototype,`showGizmo`,void 0);var Ki=class{handlerA;handlerB;context;settings;gameObject;_handlerAAttachmentPoint=new n;_handlerBAttachmentPoint=new n;_followObject;_manipulatorObject;_deviceMode;_followObjectStartWorldQuaternion=new x;constructor(e,t,n,r){this.context=e.context,this.settings=e,this.gameObject=t,this.handlerA=n,this.handlerB=r,this._followObject=new y,this._manipulatorObject=new y,this.context.scene.add(this._manipulatorObject);let i=St.active?.rig?.gameObject;if(!this.handlerA||!this.handlerB||!this.handlerA.hitPointInLocalSpace||!this.handlerB.hitPointInLocalSpace){console.error(`Invalid: MultiTouchDragHandler needs two valid DragPointerHandlers with hitPointInLocalSpace set.`);return}if(this._tempVec1.copy(this.handlerA.hitPointInLocalSpace),this._tempVec2.copy(this.handlerB.hitPointInLocalSpace),this.gameObject.localToWorld(this._tempVec1),this.gameObject.localToWorld(this._tempVec2),i&&(i.worldToLocal(this._tempVec1),i.worldToLocal(this._tempVec2)),this._initialDistance=this._tempVec1.distanceTo(this._tempVec2),this._initialDistance<.02?(Ui&&console.log(`Finding alternative drag attachment points since initial distance is too low: `+this._initialDistance.toFixed(2)),this.handlerA.followObject.parent.getWorldPosition(this._tempVec1),this.handlerB.followObject.parent.getWorldPosition(this._tempVec2),this._handlerAAttachmentPoint.copy(this._tempVec1),this._handlerBAttachmentPoint.copy(this._tempVec2),this.gameObject.worldToLocal(this._handlerAAttachmentPoint),this.gameObject.worldToLocal(this._handlerBAttachmentPoint),this._initialDistance=this._tempVec1.distanceTo(this._tempVec2),this._initialDistance<.001&&(console.warn(`Not supported right now – controller drag points for multitouch are too close!`),this._initialDistance=1)):(this._handlerAAttachmentPoint.copy(this.handlerA.hitPointInLocalSpace),this._handlerBAttachmentPoint.copy(this.handlerB.hitPointInLocalSpace)),this._tempVec3.lerpVectors(this._tempVec1,this._tempVec2,.5),this._initialScale.copy(t.scale),Ui){this._followObject.add(new se(2)),this._manipulatorObject.add(new se(5));let e=e=>`${e.x.toFixed(2)}, ${e.y.toFixed(2)}, ${e.z.toFixed(2)}`;V.DrawLine(this._tempVec1,this._tempVec2,65535,0,!1),V.DrawLabel(this._tempVec3,`A:B `+this._initialDistance.toFixed(2)+` `+e(this._tempVec1)+` `+e(this._tempVec2),.03,5)}}onDragStart(e){this.gameObject.add(this._followObject),this._followObject.matrixAutoUpdate=!1,this._followObject.matrix.identity(),this._deviceMode=e.mode,this._followObjectStartWorldQuaternion.copy(this._followObject.worldQuaternion),this.alignManipulator(),this._manipulatorObject.attach(this._followObject),this._manipulatorPosOffset.copy(this._followObject.position),this._manipulatorRotOffset.copy(this._followObject.quaternion),this._manipulatorScaleOffset.copy(this._followObject.scale)}onDragEnd(e){if(!this.handlerA||!this.handlerB){console.error(`onDragEnd called on MultiTouchDragHandler without valid handlers. This is likely a bug.`);return}this.handlerA.recenter(),this.handlerB.recenter(),this._manipulatorObject.removeFromParent(),this._followObject.removeFromParent(),this._manipulatorObject.destroy(),this._followObject.destroy()}_manipulatorPosOffset=new n;_manipulatorRotOffset=new x;_manipulatorScaleOffset=new n;_tempVec1=new n;_tempVec2=new n;_tempVec3=new n;tempLookMatrix=new _;_initialScale=new n;_initialDistance=0;alignManipulator(){if(!this.handlerA||!this.handlerB){console.error(`alignManipulator called on MultiTouchDragHandler without valid handlers. This is likely a bug.`,this);return}if(!this.handlerA.followObject||!this.handlerB.followObject){console.error(`alignManipulator called on MultiTouchDragHandler without valid follow objects. This is likely a bug.`,this.handlerA,this.handlerB);return}this._tempVec1.copy(this._handlerAAttachmentPoint),this._tempVec2.copy(this._handlerBAttachmentPoint),this.handlerA.followObject.localToWorld(this._tempVec1),this.handlerB.followObject.localToWorld(this._tempVec2),this._tempVec3.lerpVectors(this._tempVec1,this._tempVec2,.5),this._manipulatorObject.position.copy(this._tempVec3);let e=this.context.mainCamera;this.tempLookMatrix.lookAt(this._tempVec3,this._tempVec2,e.worldUp),this._manipulatorObject.quaternion.setFromRotationMatrix(this.tempLookMatrix);let t=this._tempVec1.distanceTo(this._tempVec2);this._manipulatorObject.scale.copy(this._initialScale).multiplyScalar(t/this._initialDistance),this._manipulatorObject.updateMatrix(),this._manipulatorObject.updateMatrixWorld(!0),Ui&&(V.DrawLabel(this._tempVec3.clone().add(new n(0,.2,0)),`A:B `+t.toFixed(2),.03),V.DrawLine(this._tempVec1,this._tempVec2,65280,0,!1))}onDragUpdate(){this.alignManipulator(),this._followObject.position.copy(this._manipulatorPosOffset),this._followObject.quaternion.copy(this._manipulatorRotOffset),this._followObject.scale.copy(this._manipulatorScaleOffset);let e=this.gameObject,t=this._followObject;if(!e){console.error(`MultiTouchDragHandler has no dragged object. This is likely a bug.`);return}t.updateMatrix(),t.updateMatrixWorld(!0);let n=this._deviceMode===`tracked-pointer`||this._deviceMode===`transient-pointer`?this.settings.xrKeepRotation:this.settings.keepRotation;if(this.settings.snapGridResolution>0){let e=this._followObject.worldPosition,t=this.settings.snapGridResolution;e.x=Math.round(e.x/t)*t,e.y=Math.round(e.y/t)*t,e.z=Math.round(e.z/t)*t,this._followObject.worldPosition=e,this._followObject.updateMatrix()}n&&(this._followObject.worldQuaternion=this._followObjectStartWorldQuaternion,this._followObject.updateMatrix());let r=O.clamp01(this.context.time.deltaTime*30*1),i=e.worldPosition;i.lerp(t.worldPosition,r),e.worldPosition=i;let a=e.worldQuaternion;a.slerp(t.worldQuaternion,r),e.worldQuaternion=a;let o=e.worldScale;o.lerp(t.worldScale,r),e.worldScale=o,e.matrixAutoUpdate===!1&&e.updateMatrix()}setTargetObject(e){this.gameObject=e}},qi=class{getTotalMovement(){return this._totalMovement}get followObject(){return this._followObject}get hitPointInLocalSpace(){return this._hitPointInLocalSpace}context;gameObject;settings;_lastRig=void 0;_followObject;_totalMovement=new n;_totalMovementAlongRayDirection=0;_grabStartDistance=0;_deviceMode;_followObjectStartPosition=new n;_followObjectStartQuaternion=new x;_followObjectStartWorldQuaternion=new x;_lastDragPosRigSpace;_tempVec=new n;_tempMat=new _;_hitPointInLocalSpace=new n;_hitNormalInLocalSpace=new n;_bottomCenter=new n;_backCenter=new n;_backBottomCenter=new n;_bounds=new ie;_dragPlane=new ae(new n(0,1,0));_draggedOverObject=null;_draggedOverObjectLastSetUp=null;_draggedOverObjectLastNormal=new n;_draggedOverObjectDuration=0;setTargetObject(e){this.gameObject=e}constructor(e,t){this.settings=e,this.context=e.context,this.gameObject=t,this._followObject=new y}recenter(){if(!this._followObject.parent){console.warn(`Error: space follow object doesn't have parent but recenter() is called. This is likely a bug`);return}if(!this.gameObject){console.warn(`Error: space follow object doesn't have a gameObject`);return}let e=this._followObject.parent;this.gameObject.add(this._followObject),this._followObject.matrixAutoUpdate=!1,this._followObject.position.set(0,0,0),this._followObject.quaternion.set(0,0,0,1),this._followObject.scale.set(1,1,1),this._followObject.updateMatrix(),this._followObject.updateMatrixWorld(!0),e.attach(this._followObject),this._followObjectStartPosition.copy(this._followObject.position),this._followObjectStartQuaternion.copy(this._followObject.quaternion),this._followObjectStartWorldQuaternion.copy(this._followObject.worldQuaternion),this._followObject.updateMatrix(),this._followObject.updateMatrixWorld(!0);let t=this._hitPointInLocalSpace.clone();this.gameObject.localToWorld(t),this._grabStartDistance=t.distanceTo(e.worldPosition);let r=(St.active?.rig?.gameObject)?.worldScale.x||1;this._grabStartDistance/=r,this._totalMovementAlongRayDirection=0,this._lastDragPosRigSpace=void 0,Ui&&(V.DrawLine(t,e.worldPosition,65280,.5,!1),V.DrawLabel(e.worldPosition.add(new n(0,.1,0)),this._grabStartDistance.toFixed(2),.03,.5))}onDragStart(e){if(!this.gameObject){console.warn(`Error: space follow object doesn't have a gameObject`);return}if(e.event.space.add(this._followObject),this._lastDragPosRigSpace=void 0,e.point&&e.normal)this._hitPointInLocalSpace.copy(e.point),this.gameObject.worldToLocal(this._hitPointInLocalSpace),this._hitNormalInLocalSpace.copy(e.normal);else if(e){let t=e.event.space,n=t.worldPosition;this.gameObject.worldToLocal(n),this._hitPointInLocalSpace.copy(n);let r=t.worldUp;this._tempMat.copy(this.gameObject.matrixWorld).invert(),r.transformDirection(this._tempMat),this._hitNormalInLocalSpace.copy(r)}this.recenter(),this._totalMovement.set(0,0,0),this._deviceMode=e.mode;let t=this._followObject.parent.worldForward,r=this._deviceMode===`tracked-pointer`||this._deviceMode===`transient-pointer`?this.settings.xrDragMode:this.settings.dragMode,i=this._hitPointInLocalSpace.clone();switch(this.gameObject.localToWorld(i),r){case K.XZPlane:let e=new n(0,1,0);this.gameObject.parent&&e.transformDirection(this.gameObject.parent.matrixWorld.clone().invert()),this._dragPlane.setFromNormalAndCoplanarPoint(e,i);break;case K.HitNormal:let r=this._hitNormalInLocalSpace.clone();r.transformDirection(this.gameObject.matrixWorld),this._dragPlane.setFromNormalAndCoplanarPoint(r,i);break;case K.Attached:this._dragPlane.setFromNormalAndCoplanarPoint(t,i);break;case K.DynamicViewAngle:this.setPlaneViewAligned(i,!0);break;case K.SnapToSurfaces:this.setPlaneViewAligned(i,!1);break;case K.None:break}let a=this.gameObject.parent,o=this.gameObject.position.clone(),s=this.gameObject.quaternion.clone(),c=this.gameObject.scale.clone(),l=this.gameObject.matrixWorld.clone();a&&a.remove(this.gameObject),this.gameObject.position.set(0,0,0),this.gameObject.quaternion.set(0,0,0,1),this.gameObject.scale.set(1,1,1);let u=Nt([this.gameObject]);u.expandByPoint(this.gameObject.worldPosition);let d=new n;u.getCenter(d);let f=new n;u.getSize(f),this._bottomCenter.copy(d.clone().add(new n(0,-f.y/2,0))),this._backCenter.copy(d.clone().add(new n(0,0,f.z/2))),this._backBottomCenter.copy(d.clone().add(new n(0,-f.y/2,f.z/2))),this._bounds.copy(u),a&&a.add(this.gameObject),this.gameObject.position.copy(o),this.gameObject.quaternion.copy(s),this.gameObject.scale.copy(c),this.gameObject.matrixWorld.copy(l),this._draggedOverObject=null,this._draggedOverObjectLastSetUp=null,this._draggedOverObjectLastNormal.set(0,1,0),this._draggedOverObjectDuration=0}collectMovementInfo(){if(!this._followObject.parent)return;let e=this._followObject.parent;this._followObject.updateMatrix();let t=e.worldPosition,n=St.active?.rig?.gameObject;n&&n.worldToLocal(t),(this._lastDragPosRigSpace===void 0||n!=this._lastRig)&&(this._lastDragPosRigSpace=t.clone(),this._lastRig=n),this._tempVec.copy(t).sub(this._lastDragPosRigSpace);let r=e.worldForward;if(n&&(this._tempMat.copy(n.matrixWorld).invert(),r.transformDirection(this._tempMat)),this._totalMovementAlongRayDirection+=r.dot(this._tempVec),this._tempVec.x=Math.abs(this._tempVec.x),this._tempVec.y=Math.abs(this._tempVec.y),this._tempVec.z=Math.abs(this._tempVec.z),this._totalMovement.add(this._tempVec),this._lastDragPosRigSpace.copy(t),Ui){let e=t;n&&(e=e.clone(),e.transformDirection(n.matrixWorld)),V.DrawRay(e,r,255)}}onDragUpdate(e){if(e>1)return;let t=this.gameObject;if(!t||!this._followObject){console.warn(`Warning: DragPointerHandler doesn't have a dragged object. This is likely a bug.`);return}let r=this._followObject.parent;if(!r){console.warn(`Warning: DragPointerHandler doesn't have a drag source. This is likely a bug.`);return}this._followObject.updateMatrix();let i=r.worldPosition,o=r.worldForward,s=this._deviceMode===`tracked-pointer`||this._deviceMode===`transient-pointer`,c=s?this.settings.xrKeepRotation:this.settings.keepRotation,l=s?this.settings.xrDragMode:this.settings.dragMode;if(l===K.None)return;c&&(this._followObject.worldQuaternion=this._followObjectStartWorldQuaternion),this._followObject.updateMatrix(),this._followObject.updateMatrixWorld(!0);let u=1,d=2;if(s&&this._grabStartDistance>.5){let e=1+this._totalMovementAlongRayDirection*(2*this.settings.xrDistanceDragFactor);u=Math.max(0,e),u=u*u*u}else this._grabStartDistance<=.5&&(d=3);this._followObject.position.copy(this._followObjectStartPosition),c||this._followObject.quaternion.copy(this._followObjectStartQuaternion),this._followObject.position.multiplyScalar(u),this._followObject.updateMatrix();let f=this._hasLastSurfaceHitPoint;this._hasLastSurfaceHitPoint=!1;let p=new a(i,o);if(l==K.SnapToSurfaces){let e=this.context.physics.raycastFromRay(p,{testObject:e=>e!==this.followObject&&e!==r&&e!==t});if(e.length>0){let t=e[0];if(this._draggedOverObject===t.object?this._draggedOverObjectDuration+=this.context.time.deltaTime:(this._draggedOverObject=t.object,this._draggedOverObjectDuration=0),t.face){this._hasLastSurfaceHitPoint=!0,this._lastSurfaceHitPoint.copy(t.point);let e=this._draggedOverObjectDuration>=.15,n=this._totalMovement.length()>=.001,r=z(t.normal||t.face.normal).applyQuaternion(t.object.worldQuaternion);if((e||n)&&(this._draggedOverObjectLastSetUp!==this._draggedOverObject||this._draggedOverObjectLastNormal.dot(r)<.999999||this.context.time.frame%60==0)){this._draggedOverObjectLastSetUp=this._draggedOverObject,this._draggedOverObjectLastNormal.copy(t.face.normal);let e=z(),n=z();this._bounds.getCenter(e),this._bounds.getSize(n),e.sub(n.multiplyScalar(.5).multiply(r)),this._hitPointInLocalSpace.copy(e),this._hitNormalInLocalSpace.copy(t.face.normal),this._bounds.getCenter(e),this._bounds.getSize(n),e.add(n.multiplyScalar(.5).multiply(t.face.normal));let i=z(this._hitPointInLocalSpace).add(e);this._followObject.localToWorld(i);let a=t.point;this._dragPlane.setFromNormalAndCoplanarPoint(r,a)}else if(!(e||n))return}}else f&&this.gameObject&&this.setPlaneViewAligned(this.gameObject.worldPosition,!1)}if(l!==K.Attached&&p.intersectPlane(this._dragPlane,this._tempVec)){this._followObject.worldPosition=this._tempVec,this._followObject.updateMatrix(),this._followObject.updateMatrixWorld(!0);let e=z(this._hitPointInLocalSpace);this._followObject.localToWorld(e),Ui&&V.DrawLine(e,this._tempVec,65535,0,!1),this._followObject.worldPosition=this._tempVec.multiplyScalar(2).sub(e),this._followObject.updateMatrix(),this._followObject.updateMatrix()}if(this.settings.snapGridResolution>0){let e=this._followObject.worldPosition,t=this.settings.snapGridResolution;e.x=Math.round(e.x/t)*t,e.y=Math.round(e.y/t)*t,e.z=Math.round(e.z/t)*t,this._followObject.worldPosition=e,this._followObject.updateMatrix()}c&&(this._followObject.worldQuaternion=this._followObjectStartWorldQuaternion,this._followObject.updateMatrix());let m=O.clamp01(this.context.time.deltaTime*10*d),ee=O.clamp01(this.context.time.deltaTime*10*.5*d),h=t.worldPosition;h.lerp(this._followObject.worldPosition,m),t.worldPosition=h;let g=t.worldQuaternion;if(g.slerp(this._followObject.worldQuaternion,ee),t.worldQuaternion=g,t.matrixAutoUpdate===!1&&t.updateMatrix(),Ui){let e=this._hitPointInLocalSpace.clone();t.localToWorld(e),V.DrawSphere(e,.02,16711680);let r=this._hitNormalInLocalSpace.clone();r.applyQuaternion(g),V.DrawRay(e,r,16711680),V.DrawLabel(h.add(new n(0,.25,0)),`Distance: ${this._totalMovement.length().toFixed(2)}\n Along Ray: ${this._totalMovementAlongRayDirection.toFixed(2)}\n diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js.gz b/Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js.gz new file mode 100644 index 0000000..fec8a95 Binary files /dev/null and b/Needle/MenuScene/dist/assets/needle-engine.extras.CWxm8YHB.js.gz differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js.gz b/Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js.gz deleted file mode 100644 index b2f146a..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine.extras.D-PG1GOa.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js.gz b/Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js.gz deleted file mode 100644 index c71f483..0000000 Binary files a/Needle/MenuScene/dist/assets/needle-engine.extras.D0CNgtSQ.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js b/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js index 0fea565..a424ece 100644 --- a/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js +++ b/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js @@ -1,4 +1,4 @@ -import{n as e}from"./rolldown-runtime.CYVBeYYp.js";import{A as t,Ar as n,Bt as r,F as i,Fr as a,Ft as o,Nt as s,On as c,Rr as l,S as u,St as ee,Xt as te,Zt as ne,_ as re,c as ie,fn as d,gn as f,gr as ae,hn as oe,in as se,tt as ce,wn as le,x as p}from"./three@0.169.19.js";import{$ as ue,$a as de,$i as fe,A as pe,Br as me,C as he,Ci as ge,Cn as _e,D as ve,Da as ye,Di as be,Dn as xe,Dt as Se,E as Ce,En as we,G as Te,Gi as Ee,Gr as De,Gt as Oe,H as m,Hn as ke,Ho as Ae,Ii as je,J as Me,Ja as Ne,Ji as Pe,Jr as Fe,Ka as h,Kr as Ie,L as Le,La as Re,Lr as ze,M as Be,Mi as Ve,Na as He,O as Ue,Oi as We,On as Ge,Ot as Ke,P as qe,Pi as Je,Pn as Ye,Q as Xe,Qi as Ze,Ro as Qe,S as $e,Si as et,T as tt,Ti as nt,Tn as rt,Tt as it,Ua as g,Uo as at,Ut as ot,V as st,Vn as ct,Wi as lt,Wo as ut,X as _,Xa as dt,Xr as ft,Y as pt,Yr as mt,Z as ht,_ as gt,_a as v,_n as _t,a as vt,ai as yt,b as bt,ba as y,bi as xt,co as b,ct as x,d as St,dn as S,eo as C,f as Ct,fn as wt,g as Tt,gi as Et,gr as w,h as Dt,ht as Ot,i as kt,j as At,ja as jt,ji as Mt,jo as Nt,jt as Pt,k as Ft,kn as It,l as Lt,n as Rt,na as zt,o as Bt,ot as Vt,p as Ht,q as Ut,qr as T,r as Wt,ra as E,s as Gt,st as Kt,t as qt,ti as D,u as Jt,un as O,v as Yt,va as k,vi as Xt,w as Zt,wi as Qt,wn as $t,x as en,xi as tn,y as nn,yi as rn,za as an}from"./needle-engine-ui.iRWmt52F.js";import{A,d as on,j as sn,n as cn,t as ln}from"./three-examples@0.169.19.js";import{$ as un,A as dn,B as fn,Bt as pn,C as mn,Ct as hn,D as gn,Dt as _n,E as vn,Et as yn,F as bn,G as xn,Gt as Sn,H as Cn,I as wn,It as Tn,J as En,Jt as Dn,K as On,Kt as kn,L as An,Nt as jn,O as Mn,Ot as Nn,P as Pn,Q as Fn,Qt as In,R as Ln,Rt as Rn,S as zn,St as Bn,T as Vn,U as Hn,Ut as Un,V as Wn,Vt as Gn,W as Kn,Wt as qn,X as Jn,Xt as Yn,Y as Xn,Z as Zn,Zt as Qn,_ as $n,_t as er,a as tr,at as nr,b as rr,bt as ir,cn as ar,d as or,et as sr,f as cr,fn as lr,g as ur,h as dr,i as fr,it as pr,k as mr,kt as hr,ln as gr,m as _r,mn as vr,n as yr,nt as br,o as xr,ot as Sr,p as Cr,pn as wr,q as Tr,qt as Er,r as Dr,rt as Or,sn as kr,t as Ar,tt as jr,v as Mr,vt as Nr,w as Pr,wt as Fr,x as Ir,xt as Lr,y as Rr,yt as zr,z as Br,zt as Vr}from"./needle-engine-webxr.DDCPc9_g.js";import{A as Hr,B as Ur,C as Wr,Ct as Gr,D as Kr,E as qr,Et as Jr,F as Yr,G as Xr,H as Zr,I as Qr,K as $r,L as ei,M as ti,Mt as ni,N as ri,Nt as ii,O as ai,P as oi,Q as si,R as ci,S as li,St as ui,T as di,Tt as fi,U as pi,V as mi,W as hi,X as gi,_ as _i,_t as vi,a as yi,at as bi,b as xi,bt as Si,c as Ci,ct as wi,d as Ti,dt as Ei,f as Di,ft as Oi,g as ki,gt as Ai,h as ji,ht as Mi,i as Ni,it as Pi,j as Fi,jt as Ii,k as Li,l as Ri,lt as zi,m as Bi,mt as Vi,n as Hi,nt as Ui,o as Wi,ot as Gi,p as Ki,pt as qi,q as Ji,r as Yi,s as Xi,st as Zi,t as Qi,u as $i,ut as ea,v as ta,vt as na,w as ra,wt as ia,x as aa,xt as oa,y as sa,yt as ca,z as la}from"./needle-engine.extras.D0CNgtSQ.js";import{C as ua,D as da,E as fa,S as pa,T as ma,a as ha,b as ga,c as _a,d as va,f as ya,g as ba,h as xa,i as Sa,l as Ca,m as wa,o as Ta,p as Ea,r as Da,s as Oa,t as ka,u as Aa,v as ja,w as Ma,x as Na,y as Pa}from"./needle-engine-particles.B21Zru40.js";import{a as Fa,c as Ia,d as La,f as Ra,g as za,h as Ba,i as Va,l as Ha,m as Ua,n as Wa,o as Ga,p as Ka,r as qa,s as Ja,t as Ya,u as Xa,y as Za}from"./needle-engine.extras.D-PG1GOa.js";import{a as Qa,t as $a}from"./three-mesh-bvh.B-oXEGo2.js";var j=void 0,M=null,N=null,P=!1,eo=null,to=`terminal`;b(`console`)&&ro();var no=Symbol(`consoleParent`);function ro(){if(j){j.showSwitch();return}uo()}function io(){j&&(j.hide(),j.hideSwitch())}function ao(){eo||=setInterval(so,500)}var oo=0;function so(){let e=dt(),t=e!==oo;oo=e,t&&co()}function co(){ro(),N&&(N.setAttribute(`error`,`true`),N.innerText=`🤬`)}function lo(){N&&(N.removeAttribute(`error`),N.innerText=to)}function uo(e=!1){if(j!==void 0||P)return;P=!0;let t=document.createElement(`script`);t.onload=()=>{if(!globalThis.VConsole){console.warn(`🌵 Debug console failed to load.`),P=!1,j=null;return}P=!1,ao(),j=new VConsole({pluginOrder:[`default`,`needle-console`]});let t=globalThis[`needle:codegen_files`];if(t&&t.length>0&&j.addPlugin(fo()),j.addPlugin(bo()),j.addPlugin(xo()),M=No(),M&&(M[no]=M.parentElement,M.style.position=`absolute`,M.style.zIndex=(2**53-1).toString()),j.setSwitchPosition(20,30),N=Mo(),N){N.innerText=to,N.addEventListener(`click`,lo);let t=document.createElement(`style`);t.innerHTML=` +import{n as e}from"./rolldown-runtime.CYVBeYYp.js";import{A as t,Ar as n,Bt as r,F as i,Fr as a,Ft as o,Nt as s,On as c,Rr as l,S as u,St as ee,Xt as te,Zt as ne,_ as re,c as ie,fn as d,gn as f,gr as ae,hn as oe,in as se,tt as ce,wn as le,x as p}from"./three@0.169.19.js";import{$ as ue,$a as de,$i as fe,A as pe,Br as me,C as he,Ci as ge,Cn as _e,D as ve,Da as ye,Di as be,Dn as xe,Dt as Se,E as Ce,En as we,G as Te,Gi as Ee,Gr as De,Gt as Oe,H as m,Hn as ke,Ho as Ae,Ii as je,J as Me,Ja as Ne,Ji as Pe,Jr as Fe,Ka as h,Kr as Ie,L as Le,La as Re,Lr as ze,M as Be,Mi as Ve,Na as He,O as Ue,Oi as We,On as Ge,Ot as Ke,P as qe,Pi as Je,Pn as Ye,Q as Xe,Qi as Ze,Ro as Qe,S as $e,Si as et,T as tt,Ti as nt,Tn as rt,Tt as it,Ua as g,Uo as at,Ut as ot,V as st,Vn as ct,Wi as lt,Wo as ut,X as _,Xa as dt,Xr as ft,Y as pt,Yr as mt,Z as ht,_ as gt,_a as v,_n as _t,a as vt,ai as yt,b as bt,ba as y,bi as xt,co as b,ct as x,d as St,dn as S,eo as C,f as Ct,fn as wt,g as Tt,gi as Et,gr as w,h as Dt,ht as Ot,i as kt,j as At,ja as jt,ji as Mt,jo as Nt,jt as Pt,k as Ft,kn as It,l as Lt,n as Rt,na as zt,o as Bt,ot as Vt,p as Ht,q as Ut,qr as T,r as Wt,ra as E,s as Gt,st as Kt,t as qt,ti as D,u as Jt,un as O,v as Yt,va as k,vi as Xt,w as Zt,wi as Qt,wn as $t,x as en,xi as tn,y as nn,yi as rn,za as an}from"./needle-engine-ui.i2hfjKja.js";import{A,d as on,j as sn,n as cn,t as ln}from"./three-examples@0.169.19.js";import{$ as un,A as dn,B as fn,Bt as pn,C as mn,Ct as hn,D as gn,Dt as _n,E as vn,Et as yn,F as bn,G as xn,Gt as Sn,H as Cn,I as wn,It as Tn,J as En,Jt as Dn,K as On,Kt as kn,L as An,Nt as jn,O as Mn,Ot as Nn,P as Pn,Q as Fn,Qt as In,R as Ln,Rt as Rn,S as zn,St as Bn,T as Vn,U as Hn,Ut as Un,V as Wn,Vt as Gn,W as Kn,Wt as qn,X as Jn,Xt as Yn,Y as Xn,Z as Zn,Zt as Qn,_ as $n,_t as er,a as tr,at as nr,b as rr,bt as ir,cn as ar,d as or,et as sr,f as cr,fn as lr,g as ur,h as dr,i as fr,it as pr,k as mr,kt as hr,ln as gr,m as _r,mn as vr,n as yr,nt as br,o as xr,ot as Sr,p as Cr,pn as wr,q as Tr,qt as Er,r as Dr,rt as Or,sn as kr,t as Ar,tt as jr,v as Mr,vt as Nr,w as Pr,wt as Fr,x as Ir,xt as Lr,y as Rr,yt as zr,z as Br,zt as Vr}from"./needle-engine-webxr.BfNO-tft.js";import{A as Hr,B as Ur,C as Wr,Ct as Gr,D as Kr,E as qr,Et as Jr,F as Yr,G as Xr,H as Zr,I as Qr,K as $r,L as ei,M as ti,Mt as ni,N as ri,Nt as ii,O as ai,P as oi,Q as si,R as ci,S as li,St as ui,T as di,Tt as fi,U as pi,V as mi,W as hi,X as gi,_ as _i,_t as vi,a as yi,at as bi,b as xi,bt as Si,c as Ci,ct as wi,d as Ti,dt as Ei,f as Di,ft as Oi,g as ki,gt as Ai,h as ji,ht as Mi,i as Ni,it as Pi,j as Fi,jt as Ii,k as Li,l as Ri,lt as zi,m as Bi,mt as Vi,n as Hi,nt as Ui,o as Wi,ot as Gi,p as Ki,pt as qi,q as Ji,r as Yi,s as Xi,st as Zi,t as Qi,u as $i,ut as ea,v as ta,vt as na,w as ra,wt as ia,x as aa,xt as oa,y as sa,yt as ca,z as la}from"./needle-engine.extras.CWxm8YHB.js";import{C as ua,D as da,E as fa,S as pa,T as ma,a as ha,b as ga,c as _a,d as va,f as ya,g as ba,h as xa,i as Sa,l as Ca,m as wa,o as Ta,p as Ea,r as Da,s as Oa,t as ka,u as Aa,v as ja,w as Ma,x as Na,y as Pa}from"./needle-engine-particles.Bz_Ei_ja.js";import{a as Fa,c as Ia,d as La,f as Ra,g as za,h as Ba,i as Va,l as Ha,m as Ua,n as Wa,o as Ga,p as Ka,r as qa,s as Ja,t as Ya,u as Xa,y as Za}from"./needle-engine.extras.1SuflpgE.js";import{a as Qa,t as $a}from"./three-mesh-bvh.B-oXEGo2.js";var j=void 0,M=null,N=null,P=!1,eo=null,to=`terminal`;b(`console`)&&ro();var no=Symbol(`consoleParent`);function ro(){if(j){j.showSwitch();return}uo()}function io(){j&&(j.hide(),j.hideSwitch())}function ao(){eo||=setInterval(so,500)}var oo=0;function so(){let e=dt(),t=e!==oo;oo=e,t&&co()}function co(){ro(),N&&(N.setAttribute(`error`,`true`),N.innerText=`🤬`)}function lo(){N&&(N.removeAttribute(`error`),N.innerText=to)}function uo(e=!1){if(j!==void 0||P)return;P=!0;let t=document.createElement(`script`);t.onload=()=>{if(!globalThis.VConsole){console.warn(`🌵 Debug console failed to load.`),P=!1,j=null;return}P=!1,ao(),j=new VConsole({pluginOrder:[`default`,`needle-console`]});let t=globalThis[`needle:codegen_files`];if(t&&t.length>0&&j.addPlugin(fo()),j.addPlugin(bo()),j.addPlugin(xo()),M=No(),M&&(M[no]=M.parentElement,M.style.position=`absolute`,M.style.zIndex=(2**53-1).toString()),j.setSwitchPosition(20,30),N=Mo(),N){N.innerText=to,N.addEventListener(`click`,lo);let t=document.createElement(`style`);t.innerHTML=` #__vconsole .vc-switch { border: 1px solid rgba(255, 255, 255, .1); border-radius: 50%; diff --git a/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js.gz b/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js.gz index e13f340..16873fb 100644 Binary files a/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js.gz and b/Needle/MenuScene/dist/assets/needle-engine@5.0.3.js.gz differ diff --git a/Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js b/Needle/MenuScene/dist/assets/register_types.CeurxO3a.js similarity index 97% rename from Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js rename to Needle/MenuScene/dist/assets/register_types.CeurxO3a.js index 805d210..0c2aa63 100644 --- a/Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js +++ b/Needle/MenuScene/dist/assets/register_types.CeurxO3a.js @@ -1,4 +1,4 @@ -import{Ar as e,Kn as t,_n as n,fn as r,kr as i}from"./three@0.169.19.js";import{$i as a,Xi as o,ct as s,eo as c,ot as l}from"./needle-engine-ui.iRWmt52F.js";import"./needle-engine@5.0.3.js";import{m as u}from"./needle-engine-webxr.DDCPc9_g.js";import{m as d,t as f}from"./needle-engine.extras.D-PG1GOa.js";var p=class extends l{raycaster=new t;touchPos=new i;plane=new n(new e(0,1,0),0);initialPinchDistance=0;initialScale=new e;isScaling=!1;onEnable(){let e=this.context.renderer.domElement;e.addEventListener(`touchstart`,this.onTouchStart),e.addEventListener(`touchmove`,this.onTouchMove),e.addEventListener(`touchend`,this.onTouchEnd)}onDisable(){let e=this.context.renderer.domElement;e.removeEventListener(`touchstart`,this.onTouchStart),e.removeEventListener(`touchmove`,this.onTouchMove),e.removeEventListener(`touchend`,this.onTouchEnd)}onTouchStart=e=>{if(e.touches.length===2){this.isScaling=!0;let t=e.touches[0],n=e.touches[1];this.initialPinchDistance=Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),this.initialScale.copy(this.gameObject.scale)}};onTouchMove=t=>{if(t.preventDefault(),this.isScaling&&t.touches.length===2){let e=t.touches[0],n=t.touches[1],r=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY)/this.initialPinchDistance,i=this.initialScale.clone().multiplyScalar(r);this.gameObject.scale.copy(i)}else if(t.touches.length===1&&!this.isScaling){let n=t.touches[0],r=this.context.renderer.domElement.getBoundingClientRect();this.touchPos.set((n.clientX-r.left)/r.width*2-1,-((n.clientY-r.top)/r.height)*2+1),this.raycaster.setFromCamera(this.touchPos,this.context.mainCamera);let i=new e;this.raycaster.ray.intersectPlane(this.plane,i)&&this.gameObject.position.copy(i)}};onTouchEnd=e=>{e.touches.length<2&&(this.isScaling=!1)}};function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var h=new WeakMap,g=class extends l{isMobile=!1;isDesktop=!1;isXR=!1;dishName=``;dishes=[];webXROrigin;dishBobAmplitude=.05;dishBobSpeed=2.5;usdzExporter;arSessionBobPaused=!1;selectedDishIndex=0;onEnable(){if(this.dishName=new URLSearchParams(window.location.search).get(`dishName`)??``,this.webXROrigin&&(this.usdzExporter=this.webXROrigin.getComponent(u)??void 0),this.dishName){let e=!1;this.dishes.forEach((t,n)=>{t&&t.name===this.dishName&&(this.selectedDishIndex=n,e=!0)}),this.dishes.forEach(t=>{if(!t)return;let n=e&&t.name===this.dishName;n||this.restoreDishBaseY(t),s.setActive(t,n)}),e||this.ensureOnlySelectedDishVisible()}else this.ensureOnlySelectedDishVisible();this.updateUSDZExporterTarget(),this.checkForDeviceType().then(()=>{this.isMobile?console.log(`[MenuController] isMobile`):this.isDesktop?this.setupDesktopControls():this.isXR}),this.setupMobileControls(),this.disableDoubleTapZoom()}onEnterXR(e){e.xr.mode===`immersive-ar`&&(this.arSessionBobPaused=!0,this.snapActiveDishToBaseY())}onLeaveXR(e){this.arSessionBobPaused=!1}update(){if(this.arSessionBobPaused||this.dishBobAmplitude<=0||this.getValidDishIndices().length===0)return;let e=this.dishes[this.selectedDishIndex];if(!e)return;let t=h.get(e);t===void 0&&(t=e.position.y,h.set(e,t));let n=this.context.time.time;e.position.y=t+Math.sin(n*this.dishBobSpeed)*this.dishBobAmplitude}async checkForDeviceType(){await this.isXRDevice()?this.isXR=!0:(console.log(`DeviceUtilities.isMobileDevice()`,c.isMobileDevice()),this.isMobile=c.isMobileDevice(),this.isMobile||(this.isDesktop=c.isDesktop()))}async isXRDevice(){if(navigator.xr)try{return await navigator.xr.isSessionSupported(`immersive-vr`)}catch{return console.log(`XR check error!`),!1}return!1}setupMobileControls(){typeof document<`u`&&document.querySelector(`#asset-picker`)||this.createMenuMobileControls()}setupDesktopControls(){}createMenuMobileControls(){let e=document.createElement(`div`);e.id=`menuControlsZone`,e.style.cssText=` +import{Ar as e,Kn as t,_n as n,fn as r,kr as i}from"./three@0.169.19.js";import{$i as a,Xi as o,ct as s,eo as c,ot as l}from"./needle-engine-ui.i2hfjKja.js";import"./needle-engine@5.0.3.js";import{m as u}from"./needle-engine-webxr.BfNO-tft.js";import{m as d,t as f}from"./needle-engine.extras.1SuflpgE.js";var p=class extends l{raycaster=new t;touchPos=new i;plane=new n(new e(0,1,0),0);initialPinchDistance=0;initialScale=new e;isScaling=!1;onEnable(){let e=this.context.renderer.domElement;e.addEventListener(`touchstart`,this.onTouchStart),e.addEventListener(`touchmove`,this.onTouchMove),e.addEventListener(`touchend`,this.onTouchEnd)}onDisable(){let e=this.context.renderer.domElement;e.removeEventListener(`touchstart`,this.onTouchStart),e.removeEventListener(`touchmove`,this.onTouchMove),e.removeEventListener(`touchend`,this.onTouchEnd)}onTouchStart=e=>{if(e.touches.length===2){this.isScaling=!0;let t=e.touches[0],n=e.touches[1];this.initialPinchDistance=Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),this.initialScale.copy(this.gameObject.scale)}};onTouchMove=t=>{if(t.preventDefault(),this.isScaling&&t.touches.length===2){let e=t.touches[0],n=t.touches[1],r=Math.hypot(n.clientX-e.clientX,n.clientY-e.clientY)/this.initialPinchDistance,i=this.initialScale.clone().multiplyScalar(r);this.gameObject.scale.copy(i)}else if(t.touches.length===1&&!this.isScaling){let n=t.touches[0],r=this.context.renderer.domElement.getBoundingClientRect();this.touchPos.set((n.clientX-r.left)/r.width*2-1,-((n.clientY-r.top)/r.height)*2+1),this.raycaster.setFromCamera(this.touchPos,this.context.mainCamera);let i=new e;this.raycaster.ray.intersectPlane(this.plane,i)&&this.gameObject.position.copy(i)}};onTouchEnd=e=>{e.touches.length<2&&(this.isScaling=!1)}};function m(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var h=new WeakMap,g=class extends l{isMobile=!1;isDesktop=!1;isXR=!1;dishName=``;dishes=[];webXROrigin;dishBobAmplitude=.05;dishBobSpeed=2.5;usdzExporter;arSessionBobPaused=!1;selectedDishIndex=0;onEnable(){if(this.dishName=new URLSearchParams(window.location.search).get(`dishName`)??``,this.webXROrigin&&(this.usdzExporter=this.webXROrigin.getComponent(u)??void 0),this.dishName){let e=!1;this.dishes.forEach((t,n)=>{t&&t.name===this.dishName&&(this.selectedDishIndex=n,e=!0)}),this.dishes.forEach(t=>{if(!t)return;let n=e&&t.name===this.dishName;n||this.restoreDishBaseY(t),s.setActive(t,n)}),e||this.ensureOnlySelectedDishVisible()}else this.ensureOnlySelectedDishVisible();this.updateUSDZExporterTarget(),this.checkForDeviceType().then(()=>{this.isMobile?console.log(`[MenuController] isMobile`):this.isDesktop?this.setupDesktopControls():this.isXR}),this.setupMobileControls(),this.disableDoubleTapZoom()}onEnterXR(e){e.xr.mode===`immersive-ar`&&(this.arSessionBobPaused=!0,this.snapActiveDishToBaseY())}onLeaveXR(e){this.arSessionBobPaused=!1}update(){if(this.arSessionBobPaused||this.dishBobAmplitude<=0||this.getValidDishIndices().length===0)return;let e=this.dishes[this.selectedDishIndex];if(!e)return;let t=h.get(e);t===void 0&&(t=e.position.y,h.set(e,t));let n=this.context.time.time;e.position.y=t+Math.sin(n*this.dishBobSpeed)*this.dishBobAmplitude}async checkForDeviceType(){await this.isXRDevice()?this.isXR=!0:(console.log(`DeviceUtilities.isMobileDevice()`,c.isMobileDevice()),this.isMobile=c.isMobileDevice(),this.isMobile||(this.isDesktop=c.isDesktop()))}async isXRDevice(){if(navigator.xr)try{return await navigator.xr.isSessionSupported(`immersive-vr`)}catch{return console.log(`XR check error!`),!1}return!1}setupMobileControls(){typeof document<`u`&&document.querySelector(`#asset-picker`)||this.createMenuMobileControls()}setupDesktopControls(){}createMenuMobileControls(){let e=document.createElement(`div`);e.id=`menuControlsZone`,e.style.cssText=` position: absolute; display: flex; justify-content: space-between; diff --git a/Needle/MenuScene/dist/assets/register_types.CeurxO3a.js.gz b/Needle/MenuScene/dist/assets/register_types.CeurxO3a.js.gz new file mode 100644 index 0000000..75f1080 Binary files /dev/null and b/Needle/MenuScene/dist/assets/register_types.CeurxO3a.js.gz differ diff --git a/Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js.gz b/Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js.gz deleted file mode 100644 index 2822fba..0000000 Binary files a/Needle/MenuScene/dist/assets/register_types.JDIhnf6T.js.gz and /dev/null differ diff --git a/Needle/MenuScene/dist/include/dishes/cc0_-_pizza_salami.glb b/Needle/MenuScene/dist/include/dishes/cc0_-_pizza_salami.glb new file mode 100644 index 0000000..7233aba Binary files /dev/null and b/Needle/MenuScene/dist/include/dishes/cc0_-_pizza_salami.glb differ diff --git a/Needle/MenuScene/dist/index.html b/Needle/MenuScene/dist/index.html index 38ec5e8..7c47e6c 100644 --- a/Needle/MenuScene/dist/index.html +++ b/Needle/MenuScene/dist/index.html @@ -22,7 +22,7 @@ - + @@ -37,20 +37,20 @@ - + - - + + - + - - + + diff --git a/Needle/MenuScene/dist/index.html.gz b/Needle/MenuScene/dist/index.html.gz index 95ee293..61d5f64 100644 Binary files a/Needle/MenuScene/dist/index.html.gz and b/Needle/MenuScene/dist/index.html.gz differ diff --git a/Needle/MenuScene/dist/needle-app.js b/Needle/MenuScene/dist/needle-app.js index 84daf6f..286e55b 100644 --- a/Needle/MenuScene/dist/needle-app.js +++ b/Needle/MenuScene/dist/needle-app.js @@ -53,7 +53,7 @@ if (!customElements.get(componentName)) { while(this.basePath.endsWith('/')) { this.basePath = this.basePath.slice(0, -1); } - script.src = this.getAttribute('script-src') || `${this.basePath}/assets/index-C4yn7lK8.js`; + script.src = this.getAttribute('script-src') || `${this.basePath}/assets/index-Fs2VLbun.js`; this.shadowRoot.appendChild(script); this.needleEngine = document.createElement('needle-engine'); diff --git a/Needle/MenuScene/dist/needle.buildinfo.json b/Needle/MenuScene/dist/needle.buildinfo.json index 9e83a0c..a93d2e9 100644 --- a/Needle/MenuScene/dist/needle.buildinfo.json +++ b/Needle/MenuScene/dist/needle.buildinfo.json @@ -1 +1 @@ -{"time":"2026-04-19T20:57:09.345Z","totalsize":14818557,"files":[{"path":"assets/favicon.DtN_Fmav.ico","hash":"8d99ceeacb8facc2b07ea2ce437fc23f6d7ce42492e9abbb7bb98d82749abc96","size":15086},{"path":"assets/generateMeshBVH.worker-BRfdalWV.js","hash":"26dbdd8c06867454f8cf046d7963692ba10f4b6eebd5cbde83227908dbb2a886","size":390545},{"path":"assets/generateMeshBVH.worker-BRfdalWV.js.gz","hash":"7eae0d7a22c7346403d73cf42a22b1f8d7008922462bcb217a00f66c2a2fb97a","size":96965},{"path":"assets/GenerateMeshBVHWorker.DMD7ZOpN.js","hash":"c39f757743906680af5dc17743a0082c4385e230ab5006b427953bdec6f4f76a","size":80},{"path":"assets/gltf-progressive.BBJGcb3s.js","hash":"069fa050ccdccf55776c11cf63bafff2ec45e7720da48695187772034a17b0ce","size":40226},{"path":"assets/gltf-progressive.BBJGcb3s.js.gz","hash":"a4adb3cb3cf3124f78482d0595afa825555b0f0b45905969ae866f34dae36d3c","size":13752},{"path":"assets/gltf-progressive.worker-DbINgLUC.js","hash":"d95d7d669ac99e74ab7945b52f825793c8977a9b6045aa7f202b867a6295abd4","size":533027},{"path":"assets/gltf-progressive.worker-DbINgLUC.js.gz","hash":"9ce0dcfd79441e40258af9801a62c13ed8bb454de617b28a81951b22c5bc3f1c","size":140931},{"path":"assets/index-C4yn7lK8.js","hash":"2bf704f7e417b189d1654226435d8e6c99f8796049f72cc3e8294085d624c5ae","size":3887},{"path":"assets/index-C4yn7lK8.js.gz","hash":"75bdb268cf0b94a7b6b3317da5b631aa409118c95b8119fc685e4132a5713bb8","size":1730},{"path":"assets/index.2XwOwFJz.css","hash":"25faeee214aadb9a8bfcaf563f5297c14dbebe5bb03ac0f5c2e95c4bb8801cb9","size":1317},{"path":"assets/index.2XwOwFJz.css.gz","hash":"628d1722e3b1dbeb9a4b29bb1ab09ba911c26a2ad0d32860b92c3cd450334109","size":656},{"path":"assets/JsMaterialXCore.B97gKRq_.wasm","hash":"6b0d149adcb290fac326c754c878a5d8389b2fe7e6c5dbaf22129b2e83673762","size":1410873},{"path":"assets/JsMaterialXCore.DGnKx6GJ.js","hash":"3458954c3137edcdf72a873eb4a92fc8fd947676a10c7dab1d2ef8e501ce5c07","size":65},{"path":"assets/JsMaterialXGenShader.data.DOxudtll.txt","hash":"9eaf101c24d568abe8b21a35cec29df32a9d8ee18986787abcada3ac95ffacc5","size":1512300},{"path":"assets/JsMaterialXGenShader.data.vJnq-SJK.js","hash":"8469e42ae946745a483b829903a8ebe26775c6084a19f85928633c5bbe5cca59","size":65},{"path":"assets/JsMaterialXGenShader.DFP9U7Gu.js","hash":"b3026b30cb3dc86f025d4a21b8befe5b9cbbd2b3d471ecc18c0dd7ed591ce0bb","size":65},{"path":"assets/JsMaterialXGenShader.P2pWAaz9.wasm","hash":"09adab7b142ea4dc768ac40b7947a5eac5c7556a50dbf60281db9c11d555a98e","size":2564784},{"path":"assets/materialx.CnHmG--Y.js","hash":"46e0e6b37df7b132f6340e2bd84211f916c24933868671ba4b5d3a507f8d878c","size":140597},{"path":"assets/materialx.CnHmG--Y.js.gz","hash":"2a3d121d401ee013951712a5ad6a4d7d023201b4ea28625d9d07791999a8a80e","size":42394},{"path":"assets/materialx.eMaybKAQ.js","hash":"d25f196b1725a13ce1bc579a42fe162335314670daf1e24c973b45b7eda95140","size":233},{"path":"assets/materialx.eMaybKAQ.js.gz","hash":"a2c260cb703b423b85ba96b38f3c00a9b1021882ec5feb13338ca1fa3db8db3e","size":168},{"path":"assets/MenuScene.glb","hash":"cb91417c35df614fdaa758e8e3ca3737c7f38687536ec472b0f9f2897094f0f5","size":84700},{"path":"assets/N8AO.C2WXsanG.js","hash":"c53e27ed55ec7273d644739fde121bb6afd4027a9e7f56aa71e16899fb5287c5","size":121},{"path":"assets/N8AO.C2WXsanG.js.gz","hash":"53f936a93e15460b4c340dabe2b8dbd080c6fcf4822c97562763d6e2daf82d16","size":119},{"path":"assets/needle-engine-particles.B21Zru40.js","hash":"2be8cfe8dde64743a4fd57a138f06a077b62d0e6c06de75f466141307d9a9fc2","size":57273},{"path":"assets/needle-engine-particles.B21Zru40.js.gz","hash":"194ef677468ab7bc79f727178d6257a55f94409ac2818670e886d605b69b31b3","size":15291},{"path":"assets/needle-engine-ui.iRWmt52F.js","hash":"ca93135661e7b1c3168d119027ff06dc35228c19aaaf69691f5664ba4fde18dc","size":549800},{"path":"assets/needle-engine-ui.iRWmt52F.js.gz","hash":"4e59056b180b8c296ed0227f8681db15c8af67ba869a8dcf69cb427d0590ee14","size":156628},{"path":"assets/needle-engine-webxr.DDCPc9_g.js","hash":"2f34667c9f5055d155a341871ffaea6d577967b655eb3ee983bc8496572dc6f1","size":339590},{"path":"assets/needle-engine-webxr.DDCPc9_g.js.gz","hash":"9bbf1305b529fa6ab71778f971029a53a5bdbdb15661421a9d10d60c80a4cab2","size":95875},{"path":"assets/needle-engine.BJP2NBoC.js","hash":"baa3d6660ade76a55ba22625b3d4ce682507fa967afb4b15a7122c840b77ea7d","size":8806},{"path":"assets/needle-engine.BJP2NBoC.js.gz","hash":"042d5bd562bfc7e4d89e76b88e15dd365ee678fc4f22ab846cc6be909a35aeeb","size":2125},{"path":"assets/needle-engine.Bq13_677.js","hash":"74512ce10c84658c99a420130a60eb76c6b02f0e86fa5711d5105ee9ec126740","size":17976},{"path":"assets/needle-engine.Bq13_677.js.gz","hash":"2064670cc72139db9d2c169b4559ccfb52267be526ae0c096868faa4734aae14","size":7318},{"path":"assets/needle-engine.CE4b2dOg.js","hash":"926d66907210eb8304c8ebb022b07804b2528a1cb0fcb3a693dafb920cf9af4b","size":83},{"path":"assets/needle-engine.D6xdy26G.js","hash":"493a70cfc7882efd95a49064109d497fa52da8cb21ebead82269844699410225","size":8399},{"path":"assets/needle-engine.D6xdy26G.js.gz","hash":"ae0ffbee3b9df88dfbdadc6c9b7ef7e3a526dd2a9fd1dca7d3e189004eb1feb3","size":2824},{"path":"assets/needle-engine.dep.B3nA4wQ5.js","hash":"903cb1e6d479f412d33f3c6f420da30914ebdc32f2fa5af317ef1b6a83c19d46","size":157},{"path":"assets/needle-engine.dep.B3nA4wQ5.js.gz","hash":"f3ef06e5c09c66b910c15a96d56be694dfc1043699234de32880009cc425418d","size":146},{"path":"assets/needle-engine.dep.BzZBR-mM.js","hash":"446200bd2574e013d8968923320e1092907cfb8f4890ae1a2007ad3a2efb4ec5","size":91},{"path":"assets/needle-engine.dep.DFJFZC0m.js","hash":"fb9b21b29e7bdd4af6e14c3716d27ffc9642107224b17a3cc1cf383c57355f80","size":3621},{"path":"assets/needle-engine.dep.DFJFZC0m.js.gz","hash":"a52e033c1ec67b0da0e40f27167b672650f08af40a738a27ba51a4b8f226276d","size":1473},{"path":"assets/needle-engine.extras.D-PG1GOa.js","hash":"f547b251b514450f2abfe4744056b22d0f82af1effe5b82213f4829145f1bba2","size":45379},{"path":"assets/needle-engine.extras.D-PG1GOa.js.gz","hash":"2967cc7da43625d0c857942b29d3dd42dc6ae668a493ee9365ab386184e3d149","size":11720},{"path":"assets/needle-engine.extras.D0CNgtSQ.js","hash":"908f283b549858683a76799bd239471daeefedbc0ff940f7d889a77c748852ec","size":287996},{"path":"assets/needle-engine.extras.D0CNgtSQ.js.gz","hash":"5063121aac4db8bd78db2b962895f7b5bfe85317af90d2f85c83c04b2f222113","size":77869},{"path":"assets/needle-engine@5.0.3.js","hash":"9a7e5e4e1e5762e8015131c9f89cde614608c4351576fac74caa5c94892bc0a4","size":102370},{"path":"assets/needle-engine@5.0.3.js.gz","hash":"ca681cc8870f4437466cc9b59cf0a9343647f858c198a9e401003c7451926ee2","size":32232},{"path":"assets/peerjs.UdR1_Ath.js","hash":"4d1141e782b5074ff0bc6471d1496892bf4cc3d37bff6b26dbb543ff3215f511","size":139970},{"path":"assets/peerjs.UdR1_Ath.js.gz","hash":"d655e3293942f858436231a5f1c98cacebc4f12b462bbbf7091d91fca6b1804f","size":35531},{"path":"assets/postprocessing.ao.BRYreHJS.js","hash":"9a752a5cdb636bec813221103a7070018fee1303940ad177475bc4f01eb0f3a3","size":162950},{"path":"assets/postprocessing.ao.BRYreHJS.js.gz","hash":"13b3f7db36f6c50bb3de7dffee4ac60670f9267ac4acf052f75b699752dee620","size":77949},{"path":"assets/postprocessing.Wy71DpiM.js","hash":"a13d1598fd4cc60a06e264fef9ed207185963a01b21473cc30dfdcd11307b2b1","size":318819},{"path":"assets/postprocessing.Wy71DpiM.js.gz","hash":"205160a2233b8646a9c1ec6c6f17a414067d811299e3f13f5332a6ce5b66ac61","size":111140},{"path":"assets/rapier3d.DBFmcAzL.js","hash":"dee0e85e47299f58b6af45b9e0d3ec8e87365a2bcfbfe521c7ca7731f721c031","size":2236518},{"path":"assets/rapier3d.DBFmcAzL.js.gz","hash":"756ae1c26b91e37df8728ee0e438208e9138a328daaac20c91d9c9ec0be6a9d1","size":829360},{"path":"assets/register_types.JDIhnf6T.js","hash":"e970ad2a8f2bfa8d5f861120044663c46e5874d341badfdfb3caabe04ecff05f","size":8447},{"path":"assets/register_types.JDIhnf6T.js.gz","hash":"54c3240ca7014dedb2337a84bad4191fec6faa9f234c35d9a324cacf20f1fbf8","size":2818},{"path":"assets/rolldown-runtime.CYVBeYYp.js","hash":"c62a259caf983f4ea8940cae8d9abe35924f21613de275b1102b5f9e6243c126","size":685},{"path":"assets/rolldown-runtime.CYVBeYYp.js.gz","hash":"52bb3183225ba42d42738dbbe972d6bd0b05d307269e38b8c3ca2a672979ba57","size":417},{"path":"assets/three-examples.extras@0.169.19.js","hash":"5dc9c34c94bc4ed886e7a06561292a396deacdb33c8c69e92b3ee84d4f88f3e5","size":467},{"path":"assets/three-examples.extras@0.169.19.js.gz","hash":"7ea7b34cc92c9f75c1aa5ef464e818eacaafeb4b9bea3f6e8fb485e487a0b342","size":312},{"path":"assets/three-examples@0.169.19.js","hash":"b0161353f6b95d0ba8b7eae4ccc3a5238dbcdf1eb4627a3faa743aa400496f66","size":341977},{"path":"assets/three-examples@0.169.19.js.gz","hash":"7b60c10406058b2ae13a58244f290e21db2d795302986078082c06cffbbc1520","size":107289},{"path":"assets/three-mesh-bvh.B-oXEGo2.js","hash":"9dff9b6b9018b998059a57cde938ad273062e25a06232f019bbc5a6b0ef4b7c7","size":54824},{"path":"assets/three-mesh-bvh.B-oXEGo2.js.gz","hash":"4c10233f3f98214c2604e628406d76cd9419b3629e42f2b4c356f5b15b15e093","size":17657},{"path":"assets/three-mesh-ui.CgGzZ3ml.js","hash":"1e33cd1d93ac2c9e4cea4d6b35094401cce041850d374f105513a44283b5884d","size":113137},{"path":"assets/three-mesh-ui.CgGzZ3ml.js.gz","hash":"6f016243f03011b37c43bcb2b307876075338430f185ea3c82ecfc67bdcc9e70","size":26682},{"path":"assets/three-quarks.DALdLWPD.js","hash":"4be7a10535ad22e8333ffa70d687606c5778dd03fddc7298c4f665911bc9c452","size":148379},{"path":"assets/three-quarks.DALdLWPD.js.gz","hash":"17ba7fe25a94d37f6d7d6d56c8c6cb2c748b4d6c297e67e72a4cbad96316268c","size":34112},{"path":"assets/three@0.169.19.js","hash":"e867c49a8afe22f7d79b960e57640ac4427d50a587a878b0e560cbb5a42d00ef","size":965775},{"path":"assets/three@0.169.19.js.gz","hash":"3ece83a0fb0555973130bc83e5eeecc11c4409975e0aec455441b37f920490de","size":249564},{"path":"include/poster.webp","hash":"608b670c871aad17558eaa01423b9ca036d2636592efe3a63a85aa2af755f68b","size":130},{"path":"index.html","hash":"68ac33fb168224e745e14d567910dc278be2ce124af46eecbcf504808b32319f","size":7594},{"path":"index.html.gz","hash":"85feaa63f8c143d564bf7a8a5b373d451d455972ccc89dd704a6ce7b797b8f68","size":2821},{"path":"needle-app.js","hash":"b745e8385955a9a400b5c05e0d546e436490bc1a6e87ff23718ae0ba270430c1","size":3505}]} \ No newline at end of file +{"time":"2026-04-19T21:06:05.842Z","totalsize":18967983,"files":[{"path":"assets/favicon.DtN_Fmav.ico","hash":"8d99ceeacb8facc2b07ea2ce437fc23f6d7ce42492e9abbb7bb98d82749abc96","size":15086},{"path":"assets/generateMeshBVH.worker-BRfdalWV.js","hash":"26dbdd8c06867454f8cf046d7963692ba10f4b6eebd5cbde83227908dbb2a886","size":390545},{"path":"assets/generateMeshBVH.worker-BRfdalWV.js.gz","hash":"7eae0d7a22c7346403d73cf42a22b1f8d7008922462bcb217a00f66c2a2fb97a","size":96965},{"path":"assets/GenerateMeshBVHWorker.DMD7ZOpN.js","hash":"c39f757743906680af5dc17743a0082c4385e230ab5006b427953bdec6f4f76a","size":80},{"path":"assets/gltf-progressive.BBJGcb3s.js","hash":"069fa050ccdccf55776c11cf63bafff2ec45e7720da48695187772034a17b0ce","size":40226},{"path":"assets/gltf-progressive.BBJGcb3s.js.gz","hash":"a4adb3cb3cf3124f78482d0595afa825555b0f0b45905969ae866f34dae36d3c","size":13752},{"path":"assets/gltf-progressive.worker-DbINgLUC.js","hash":"d95d7d669ac99e74ab7945b52f825793c8977a9b6045aa7f202b867a6295abd4","size":533027},{"path":"assets/gltf-progressive.worker-DbINgLUC.js.gz","hash":"9ce0dcfd79441e40258af9801a62c13ed8bb454de617b28a81951b22c5bc3f1c","size":140931},{"path":"assets/index-Fs2VLbun.js","hash":"a225925d092f21eefb9a2a5b1d19bc233b26b47fca87fdf5bc031bd913bfe3f0","size":4649},{"path":"assets/index-Fs2VLbun.js.gz","hash":"1b9208800ddd3756cc1eb35b1efdc6c3ccd31eec09c25523de71a7fa67631148","size":2013},{"path":"assets/index.2XwOwFJz.css","hash":"25faeee214aadb9a8bfcaf563f5297c14dbebe5bb03ac0f5c2e95c4bb8801cb9","size":1317},{"path":"assets/index.2XwOwFJz.css.gz","hash":"628d1722e3b1dbeb9a4b29bb1ab09ba911c26a2ad0d32860b92c3cd450334109","size":656},{"path":"assets/JsMaterialXCore.B97gKRq_.wasm","hash":"6b0d149adcb290fac326c754c878a5d8389b2fe7e6c5dbaf22129b2e83673762","size":1410873},{"path":"assets/JsMaterialXCore.DGnKx6GJ.js","hash":"3458954c3137edcdf72a873eb4a92fc8fd947676a10c7dab1d2ef8e501ce5c07","size":65},{"path":"assets/JsMaterialXGenShader.data.DOxudtll.txt","hash":"9eaf101c24d568abe8b21a35cec29df32a9d8ee18986787abcada3ac95ffacc5","size":1512300},{"path":"assets/JsMaterialXGenShader.data.vJnq-SJK.js","hash":"8469e42ae946745a483b829903a8ebe26775c6084a19f85928633c5bbe5cca59","size":65},{"path":"assets/JsMaterialXGenShader.DFP9U7Gu.js","hash":"b3026b30cb3dc86f025d4a21b8befe5b9cbbd2b3d471ecc18c0dd7ed591ce0bb","size":65},{"path":"assets/JsMaterialXGenShader.P2pWAaz9.wasm","hash":"09adab7b142ea4dc768ac40b7947a5eac5c7556a50dbf60281db9c11d555a98e","size":2564784},{"path":"assets/materialx.CnHmG--Y.js","hash":"46e0e6b37df7b132f6340e2bd84211f916c24933868671ba4b5d3a507f8d878c","size":140597},{"path":"assets/materialx.CnHmG--Y.js.gz","hash":"2a3d121d401ee013951712a5ad6a4d7d023201b4ea28625d9d07791999a8a80e","size":42394},{"path":"assets/materialx.eMaybKAQ.js","hash":"d25f196b1725a13ce1bc579a42fe162335314670daf1e24c973b45b7eda95140","size":233},{"path":"assets/materialx.eMaybKAQ.js.gz","hash":"a2c260cb703b423b85ba96b38f3c00a9b1021882ec5feb13338ca1fa3db8db3e","size":168},{"path":"assets/MenuScene.glb","hash":"398e4492468d81819caa23b3ec6c0edc501f4af232564b516868297b9a28c7c5","size":84700},{"path":"assets/N8AO.C2WXsanG.js","hash":"c53e27ed55ec7273d644739fde121bb6afd4027a9e7f56aa71e16899fb5287c5","size":121},{"path":"assets/N8AO.C2WXsanG.js.gz","hash":"53f936a93e15460b4c340dabe2b8dbd080c6fcf4822c97562763d6e2daf82d16","size":119},{"path":"assets/needle-engine-particles.Bz_Ei_ja.js","hash":"d920a045e8762263c651edf1607cc2b1e39d45447b942a3d5004f6803b5beb67","size":57273},{"path":"assets/needle-engine-particles.Bz_Ei_ja.js.gz","hash":"97d39fb515b06451867145be70341c75954dc96cf0a0a2354d44438711067856","size":15291},{"path":"assets/needle-engine-ui.i2hfjKja.js","hash":"04fe00aa73bcbe510ff2adfd681801e7a07ccc4d2f557bd9bfbafd8df991e97d","size":549800},{"path":"assets/needle-engine-ui.i2hfjKja.js.gz","hash":"fd7f5c9c305aeccb303ceda75819e292bd32987f8e82485fdf9024007590baef","size":156627},{"path":"assets/needle-engine-webxr.BfNO-tft.js","hash":"30553d8156833b7dd00fda60862c7eb413248cbcdfd80f0753c2add05a5742ef","size":339590},{"path":"assets/needle-engine-webxr.BfNO-tft.js.gz","hash":"b72b2bb25a870afd2db20203a8580fc24c982d3cfb6d3b1c6e9c0bf098d365a6","size":95875},{"path":"assets/needle-engine.BJP2NBoC.js","hash":"baa3d6660ade76a55ba22625b3d4ce682507fa967afb4b15a7122c840b77ea7d","size":8806},{"path":"assets/needle-engine.BJP2NBoC.js.gz","hash":"042d5bd562bfc7e4d89e76b88e15dd365ee678fc4f22ab846cc6be909a35aeeb","size":2125},{"path":"assets/needle-engine.CE4b2dOg.js","hash":"926d66907210eb8304c8ebb022b07804b2528a1cb0fcb3a693dafb920cf9af4b","size":83},{"path":"assets/needle-engine.D6xdy26G.js","hash":"493a70cfc7882efd95a49064109d497fa52da8cb21ebead82269844699410225","size":8399},{"path":"assets/needle-engine.D6xdy26G.js.gz","hash":"ae0ffbee3b9df88dfbdadc6c9b7ef7e3a526dd2a9fd1dca7d3e189004eb1feb3","size":2824},{"path":"assets/needle-engine.dep.B3nA4wQ5.js","hash":"903cb1e6d479f412d33f3c6f420da30914ebdc32f2fa5af317ef1b6a83c19d46","size":157},{"path":"assets/needle-engine.dep.B3nA4wQ5.js.gz","hash":"f3ef06e5c09c66b910c15a96d56be694dfc1043699234de32880009cc425418d","size":146},{"path":"assets/needle-engine.dep.BzZBR-mM.js","hash":"446200bd2574e013d8968923320e1092907cfb8f4890ae1a2007ad3a2efb4ec5","size":91},{"path":"assets/needle-engine.dep.DFJFZC0m.js","hash":"fb9b21b29e7bdd4af6e14c3716d27ffc9642107224b17a3cc1cf383c57355f80","size":3621},{"path":"assets/needle-engine.dep.DFJFZC0m.js.gz","hash":"a52e033c1ec67b0da0e40f27167b672650f08af40a738a27ba51a4b8f226276d","size":1473},{"path":"assets/needle-engine.extras.1SuflpgE.js","hash":"7271e0991cf6493993fb0070dbb9045a497ebef3cae0e8f1a78808617c961c81","size":45379},{"path":"assets/needle-engine.extras.1SuflpgE.js.gz","hash":"9b2ef1500d7558d12ea196ceccb2fbe3e19f8c17966cd749af43513073b5b5e9","size":11720},{"path":"assets/needle-engine.extras.CWxm8YHB.js","hash":"da9d69b03bad04afd8fa8eccd6e4c9926503f8dff1752c5e5c089b3148ed211d","size":287996},{"path":"assets/needle-engine.extras.CWxm8YHB.js.gz","hash":"923852dfbcb583f4a64e67e9fb264ae6f67b9f2fa072e34272230db2bd749a52","size":77869},{"path":"assets/needle-engine.HinF1QFy.js","hash":"369c600d107ce78cbd041fc7ea213b1dd1ab8be26f8571bfe6e67fd33bb74520","size":17976},{"path":"assets/needle-engine.HinF1QFy.js.gz","hash":"c8f239b644f70332ef2119ae265ca5facbc77cd9633de0dd8ae03b864b800736","size":7310},{"path":"assets/needle-engine@5.0.3.js","hash":"1605827aa120ab7240d300461e710070ff380ef5df529acd87099f1dc2415c2b","size":102370},{"path":"assets/needle-engine@5.0.3.js.gz","hash":"3181812108856f09c7069124c76c61b666a78df63afade9136e3092632381d8c","size":32230},{"path":"assets/peerjs.UdR1_Ath.js","hash":"4d1141e782b5074ff0bc6471d1496892bf4cc3d37bff6b26dbb543ff3215f511","size":139970},{"path":"assets/peerjs.UdR1_Ath.js.gz","hash":"d655e3293942f858436231a5f1c98cacebc4f12b462bbbf7091d91fca6b1804f","size":35531},{"path":"assets/postprocessing.ao.BRYreHJS.js","hash":"9a752a5cdb636bec813221103a7070018fee1303940ad177475bc4f01eb0f3a3","size":162950},{"path":"assets/postprocessing.ao.BRYreHJS.js.gz","hash":"13b3f7db36f6c50bb3de7dffee4ac60670f9267ac4acf052f75b699752dee620","size":77949},{"path":"assets/postprocessing.Wy71DpiM.js","hash":"a13d1598fd4cc60a06e264fef9ed207185963a01b21473cc30dfdcd11307b2b1","size":318819},{"path":"assets/postprocessing.Wy71DpiM.js.gz","hash":"205160a2233b8646a9c1ec6c6f17a414067d811299e3f13f5332a6ce5b66ac61","size":111140},{"path":"assets/rapier3d.DBFmcAzL.js","hash":"dee0e85e47299f58b6af45b9e0d3ec8e87365a2bcfbfe521c7ca7731f721c031","size":2236518},{"path":"assets/rapier3d.DBFmcAzL.js.gz","hash":"756ae1c26b91e37df8728ee0e438208e9138a328daaac20c91d9c9ec0be6a9d1","size":829360},{"path":"assets/register_types.CeurxO3a.js","hash":"64a939db006ccaddd1623599aff3e68c42d168efcd45378d028487c39cbf1736","size":8447},{"path":"assets/register_types.CeurxO3a.js.gz","hash":"2b97d01ec421c9fc10a37c8456f622329d94e51f627b86eb6090a431d51c1478","size":2815},{"path":"assets/rolldown-runtime.CYVBeYYp.js","hash":"c62a259caf983f4ea8940cae8d9abe35924f21613de275b1102b5f9e6243c126","size":685},{"path":"assets/rolldown-runtime.CYVBeYYp.js.gz","hash":"52bb3183225ba42d42738dbbe972d6bd0b05d307269e38b8c3ca2a672979ba57","size":417},{"path":"assets/three-examples.extras@0.169.19.js","hash":"5dc9c34c94bc4ed886e7a06561292a396deacdb33c8c69e92b3ee84d4f88f3e5","size":467},{"path":"assets/three-examples.extras@0.169.19.js.gz","hash":"7ea7b34cc92c9f75c1aa5ef464e818eacaafeb4b9bea3f6e8fb485e487a0b342","size":312},{"path":"assets/three-examples@0.169.19.js","hash":"b0161353f6b95d0ba8b7eae4ccc3a5238dbcdf1eb4627a3faa743aa400496f66","size":341977},{"path":"assets/three-examples@0.169.19.js.gz","hash":"7b60c10406058b2ae13a58244f290e21db2d795302986078082c06cffbbc1520","size":107289},{"path":"assets/three-mesh-bvh.B-oXEGo2.js","hash":"9dff9b6b9018b998059a57cde938ad273062e25a06232f019bbc5a6b0ef4b7c7","size":54824},{"path":"assets/three-mesh-bvh.B-oXEGo2.js.gz","hash":"4c10233f3f98214c2604e628406d76cd9419b3629e42f2b4c356f5b15b15e093","size":17657},{"path":"assets/three-mesh-ui.CgGzZ3ml.js","hash":"1e33cd1d93ac2c9e4cea4d6b35094401cce041850d374f105513a44283b5884d","size":113137},{"path":"assets/three-mesh-ui.CgGzZ3ml.js.gz","hash":"6f016243f03011b37c43bcb2b307876075338430f185ea3c82ecfc67bdcc9e70","size":26682},{"path":"assets/three-quarks.DALdLWPD.js","hash":"4be7a10535ad22e8333ffa70d687606c5778dd03fddc7298c4f665911bc9c452","size":148379},{"path":"assets/three-quarks.DALdLWPD.js.gz","hash":"17ba7fe25a94d37f6d7d6d56c8c6cb2c748b4d6c297e67e72a4cbad96316268c","size":34112},{"path":"assets/three@0.169.19.js","hash":"e867c49a8afe22f7d79b960e57640ac4427d50a587a878b0e560cbb5a42d00ef","size":965775},{"path":"assets/three@0.169.19.js.gz","hash":"3ece83a0fb0555973130bc83e5eeecc11c4409975e0aec455441b37f920490de","size":249564},{"path":"include/dishes/cc0_-_pizza_salami.glb","hash":"4210647f4c2ccf10106892dada9946dda3e8ba9fdb99a37a66e8ac96f01d19f8","size":4148396},{"path":"include/poster.webp","hash":"608b670c871aad17558eaa01423b9ca036d2636592efe3a63a85aa2af755f68b","size":130},{"path":"index.html","hash":"1ac9043f03e95c0633bf239f4df0564c716a1ba4b6316c571b04afc5194cef1a","size":7594},{"path":"index.html.gz","hash":"60adfffe322dfb0fa050300fabdbd9a85438c2ed49e37b41efffdf7fd8bdff13","size":2820},{"path":"needle-app.js","hash":"2fb0f5790cf0749e7c046852b7b7d7893e6f02ea7234d8c088090750bca50ede","size":3505}]} \ No newline at end of file diff --git a/Needle/MenuScene/include/dishes/cc0_-_pizza_salami.glb b/Needle/MenuScene/include/dishes/cc0_-_pizza_salami.glb new file mode 100644 index 0000000..7233aba Binary files /dev/null and b/Needle/MenuScene/include/dishes/cc0_-_pizza_salami.glb differ diff --git a/Needle/MenuScene/src/dishMeshFallback.ts b/Needle/MenuScene/src/dishMeshFallback.ts new file mode 100644 index 0000000..8a1fbfd --- /dev/null +++ b/Needle/MenuScene/src/dishMeshFallback.ts @@ -0,0 +1,61 @@ +import { findObjectOfType } from "@needle-tools/engine"; +import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; +import { Object3D } from "three"; +import type { MenuController } from "./scripts/MenuController.js"; + +/** + * When Unity/Needle exports a dish root without glTF mesh data (e.g. GLB was a Git LFS pointer + * at import time), inject geometry from a bundled standalone GLB matching the object name. + */ +const DISH_GLBS: Record = { + "cc0_-_pizza_salami": "include/dishes/cc0_-_pizza_salami.glb", +}; + +function countRenderableMeshes(root: Object3D): number { + let n = 0; + root.traverse((o) => { + const m = o as Object3D & { isMesh?: boolean }; + if (m.isMesh) n += 1; + }); + return n; +} + +function resolveIncludeUrl(relative: string): string { + const base = import.meta.env.BASE_URL ?? "./"; + const normalized = base.endsWith("/") ? base : `${base}/`; + return new URL(relative, new URL(normalized, window.location.href)).href; +} + +async function ensureDishMeshes(menu: MenuController): Promise { + const loader = new GLTFLoader(); + for (const dish of menu.dishes) { + if (!dish) continue; + const rel = DISH_GLBS[dish.name]; + if (!rel) continue; + if (countRenderableMeshes(dish) > 0) continue; + + const url = resolveIncludeUrl(rel); + const gltf = await loader.loadAsync(url); + gltf.scene.name = `${dish.name}_mesh`; + dish.add(gltf.scene); + } +} + +function initDishMeshFallback(): void { + const needle = document.querySelector("needle-engine"); + if (!needle) return; + + const run = async (): Promise => { + try { + const ctx = await needle.getContext(); + const menu = findObjectOfType(MenuController, ctx); + if (menu) await ensureDishMeshes(menu); + } catch (err) { + console.warn("[dishMeshFallback] Could not inject dish meshes:", err); + } + }; + + needle.addEventListener("loadfinished", () => void run()); +} + +initDishMeshFallback(); diff --git a/Needle/MenuScene/src/main.ts b/Needle/MenuScene/src/main.ts index 30960c7..322d8be 100644 --- a/Needle/MenuScene/src/main.ts +++ b/Needle/MenuScene/src/main.ts @@ -1,3 +1,4 @@ import("@needle-tools/engine") /* async import of needle engine */; +import "./dishMeshFallback"; import "./enableXR"; import "./assetPicker"; \ No newline at end of file