@needle-tools/engine 4.10.0-beta.5 → 4.10.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{needle-engine.bundle-DcvMQ1Nq.js → needle-engine.bundle-B4omM_bc.js} +13 -12
- package/dist/{needle-engine.bundle-BGVvfSfQ.min.js → needle-engine.bundle-Cp615Jh0.min.js} +5 -5
- package/dist/{needle-engine.bundle-DzVytSSo.umd.cjs → needle-engine.bundle-DktO3ijZ.umd.cjs} +5 -5
- package/dist/needle-engine.js +331 -332
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/codegen/register_types.js +1 -1
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/engine_license.js +1 -1
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -1
- package/lib/engine-components/codegen/components.js +1 -1
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/timeline/TimelineTracks.js +2 -4
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/codegen/register_types.ts +1 -1
- package/src/engine/engine_license.ts +1 -1
- package/src/engine-components/codegen/components.ts +1 -1
- package/src/engine-components/timeline/TimelineTracks.ts +2 -4
|
@@ -141,7 +141,7 @@ void main(){
|
|
|
141
141
|
#__vconsole .vc-mask {
|
|
142
142
|
overflow: hidden;
|
|
143
143
|
}
|
|
144
|
-
`,gr?.prepend(i),o===!0&&Lb()<=0&&r_(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,Hi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function RO(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const r=location.protocol+"//"+location.host+location.pathname+"/"+n,a=encodeURIComponent(r);o.fullUrl="https://viewer.needle.tools?inspect&file="+a;var l='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(l)}),o.on("show",function(){const t=e();t&&t.src!==o.fullUrl&&(t.src=o.fullUrl)}),o.on("hide",function(){const t=e();t&&(t.src="")}),o.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window \u2197",onClick:function(n){window.open(o.fullUrl,"_blank"),Hi?.hide()}}),i.push({name:"Reload",onClick:function(n){const s=e();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=e();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),t(i)}),o}function TO(){return document.querySelector("#__vconsole .vc-switch")||null}function EO(){return document.querySelector("#__vconsole")||null}const l_=x("debugdefines");ms('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),ms('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),ms('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),ms('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),ms('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.10.0-beta.
|
|
144
|
+
`,gr?.prepend(i),o===!0&&Lb()<=0&&r_(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),nc=!1,Hi=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function RO(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const r=location.protocol+"//"+location.host+location.pathname+"/"+n,a=encodeURIComponent(r);o.fullUrl="https://viewer.needle.tools?inspect&file="+a;var l='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(l)}),o.on("show",function(){const t=e();t&&t.src!==o.fullUrl&&(t.src=o.fullUrl)}),o.on("hide",function(){const t=e();t&&(t.src="")}),o.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window \u2197",onClick:function(n){window.open(o.fullUrl,"_blank"),Hi?.hide()}}),i.push({name:"Reload",onClick:function(n){const s=e();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=e();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),t(i)}),o}function TO(){return document.querySelector("#__vconsole .vc-switch")||null}function EO(){return document.querySelector("#__vconsole")||null}const l_=x("debugdefines");ms('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),ms('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),ms('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),ms('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),ms('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.10.0-beta.7";'),ms('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),ms('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Thu Sep 25 2025 12:21:09 GMT+0000 (Coordinated Universal Time)";'),ms('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const yn="4.10.0-beta.7",Ad="undefined",tg="Thu Sep 25 2025 12:21:09 GMT+0000 (Coordinated Universal Time)";l_&&console.log(`Engine version: ${yn} (generator: ${Ad})
|
|
145
145
|
Project built at ${tg}`);const Ma=NEEDLE_PUBLIC_KEY,So="needle_isActiveInHierarchy",fr="builtin_components",oc="needle_editor_guid";function ms(o){try{(0,eval)(o)}catch(e){l_&&console.error(e)}}let c_,h_=null;function bn(){return c_}function ig(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}h_!==o&&(h_=o,c_=new o)}const Si=Symbol("shadowDomOwner"),AO=x("debugpatch");function Id(o,e,t,i){const n=AO===e;if(!t&&!i)return;const s=e+"___needle";LO(o,e,t,i);const r=Object.getOwnPropertyDescriptor(o,e),a=o[e];n&&console.log("Patch",o.constructor.name,e,r,a),r?(n&&console.log("Apply patch with existing descriptor",o.constructor.name,e,r),typeof r.value=="function"&&(o[e]=u_(r.value,o,e))):(n&&console.log("Create patch with new property",o.constructor.name,e,r),Object.defineProperty(o,e,{set:function(l){if(typeof l=="function")this[s]=u_(l,o,e);else{const c=this[s];p_(o,e,this,c,l),this[s]=l,m_(o,e,this,c,l)}},get:function(){const l=this[s];return typeof l=="function"&&l[s]?l[s]:l}}))}function IO(o,e,t){const i=og(o,e);if(i)for(let n=i.length-1;n>=0;n--){const s=i[n];s.prefix===t&&(s.prefix=null),s.postfix===t&&(s.postfix=null),!s.prefix&&!s.postfix&&i.splice(n,1)}}const d_=Symbol("Needle:Patches:WrappedFunction");function u_(o,e,t){if(o[d_])return o;const i=function(...n){p_(e,t,this,...n);const s=o.apply(this,n);return m_(e,t,this,s,...n),s};return i[d_]=!0,i}const Ld="Needle:Patches";function ng(){return globalThis[Ld]||(globalThis[Ld]=new WeakMap),globalThis[Ld]}function og(o,e){const t=ng().get(o);return t?t.get(e):null}function LO(o,e,t,i){let n=ng().get(o);n||(n=new Map,ng().set(o,n));let s=n.get(e);s||(s=[],n.set(e,s)),s.push({prefix:t,postfix:i})}function p_(o,e,t,...i){if(!t)return;const n=og(o,e);if(n)for(const s of n)s.prefix?.call(t,...i)}function m_(o,e,t,i,...n){if(!t)return;const s=og(o,e);if(s)for(const r of s)r.postfix?.call(t,i,...n)}const Ra=[];function jd(o){Ra.indexOf(o)===-1&&Ra.push(o)}function jO(o){const e=Ra.indexOf(o);e!==-1&&Ra.splice(e,1)}const Ta=[];function sg(o){Ta.indexOf(o)===-1&&Ta.push(o)}function DO(o){const e=Ta.indexOf(o);e!==-1&&Ta.splice(e,1)}function g_(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:o}));for(let e=0;e<Ra.length;e++)Ra[e](o)}function f_(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:o}));for(let e=0;e<Ta.length;e++)Ta[e](o)}const ot=x("debuginput");var Dd=(o=>(o.Mouse="mouse",o.Touch="touch",o.Controller="controller",o.Hand="hand",o))(Dd||{}),Ee=(o=>(o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerMove="pointermove",o.KeyDown="keydown",o.KeyUp="keyup",o.KeyPressed="keypress",o))(Ee||{});class Co extends PointerEvent{clientZ;deviceIndex;origin;source;mode;get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new ls(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}_ray;space;isClick=!1;isDoubleClick=!1;get used(){return this._used}_used=!1;use(){this._used=!0}get pointerId(){return this._pointerid}_pointerid;get pointerType(){return this._pointerType}_pointerType;get type(){return this._type}_type;metadata={};intersections=new Array;constructor(e,t,i){super(e,i),this.clientZ=i.clientZ,this._pointerid=i.pointerId,this._pointerType=i.pointerType,this._type=e,this.deviceIndex=i.deviceIndex,this.origin=i.origin,this.source=t,this.mode=i.mode,this._ray=i.ray,this.space=i.device}_immediatePropagationStopped=!1;get immediatePropagationStopped(){return this._immediatePropagationStopped}_propagationStopped=!1;get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),this.source?.stopImmediatePropagation()}stopPropagation(){this._propagationStopped=!0,super.stopPropagation(),this.source?.stopPropagation(),ot&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class sc extends KeyboardEvent{source;constructor(e,t,i){super(e,i),this.source=t}stopImmediatePropagation(){super.stopImmediatePropagation(),this.source?.stopImmediatePropagation()}}class BO{key;keyType;source;constructor(e){this.key=e.key,this.keyType=e.type,this.source=e}}var ii=(o=>(o[o.Early=-100]="Early",o[o.Default=0]="Default",o[o.Late=100]="Late",o))(ii||{});class y_{_eventListeners={};addEventListener(e,t,i){if(this._eventListeners[e]||(this._eventListeners[e]=[]),!t||typeof t!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}i?i={...i}:i={};let n=0;i?.queue!=null&&(n=i.queue);const s=this._eventListeners[e],r=s.find(a=>a.priority===n);r?r.listeners.push({callback:t,options:i}):(s.push({priority:n,listeners:[{callback:t,options:i}]}),s.sort((a,l)=>a.priority-l.priority))}removeEventListener(e,t,i){if(!this._eventListeners[e]||!t)return;const n=this._eventListeners[e];if(i?.queue!=null){const s=n.find(a=>a.priority===i.queue);if(!s)return;const r=s.listeners.findIndex(a=>a.callback===t);r>=0&&s.listeners.splice(r,1)}else for(const s of n){const r=s.listeners.findIndex(a=>a.callback===t);r>=0&&s.listeners.splice(r,1)}}dispatchEvent(e){let t=!1;if(e instanceof sc){const i=this._eventListeners[e.type];if(i)for(const n of i)for(let s=0;s<n.listeners.length;s++){const r=n.listeners[s];if(r.options?.signal?.aborted){n.listeners.splice(s,1),s--;continue}r.options.once&&(n.listeners.splice(s,1),s--),r.callback(e)}}if(e instanceof Co){const i=this._eventListeners[e.type];if(i)for(const n of i){if(t)break;for(let s=0;s<n.listeners.length;s++){const r=n.listeners[s];if(r.options?.signal?.aborted){n.listeners.splice(s,1),s--;continue}if(e.immediatePropagationStopped){t=!0,ot&&console.log("immediatePropagationStopped",e.type);break}else e.propagationStopped&&(t=!0,ot&&console.log("propagationStopped",e.type));r.options.once&&(n.listeners.splice(s,1),s--),r.callback(e)}}}}_doubleClickTimeThreshold=.2;_longPressTimeThreshold=1;get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(e=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[e]||null}_setCursorTypes=[];setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(e){this._setCursorTypes.push(e),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(e){for(let t=this._setCursorTypes.length-1;t>=0;t--)if(this._setCursorTypes[t]===e){this._setCursorTypes.splice(t,1),this.updateCursor();break}}updateCursor(){this._setCursorTypes?.length==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(e){for(const t of this._pointerEventsPressed)if(t.pointerId===e&&t.used)return!0;return!1}getPointerPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&e++;return e}getPointerPosition(e){return e>=this._pointerPositions.length?null:this._pointerPositions[e]}getPointerPositionLastFrame(e){return e>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[e]}getPointerPositionDelta(e){return e>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[e]}getPointerPositionRC(e){return e>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[e]}getPointerDown(e){return e>=this._pointerDown.length?!1:this._pointerDown[e]}getPointerUp(e){return e>=this._pointerUp.length?!1:this._pointerUp[e]}getPointerPressed(e){return e>=this._pointerPressed.length?!1:this._pointerPressed[e]}getPointerClicked(e){return e>=this._pointerClick.length?!1:this._pointerClick[e]}getPointerDoubleClicked(e){return e>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[e]}getPointerDownTime(e){return e>=this._pointerDownTime.length?-1:this._pointerDownTime[e]}getPointerUpTime(e){return e>=this._pointerUpTime.length?-1:this._pointerUpTime[e]}getPointerLongPress(e){return e>=this._pointerDownTime.length?!1:this.getPointerPressed(e)&&this.context.time.time-this._pointerDownTime[e]>this._longPressTimeThreshold}getIsMouse(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="mouse"}getIsTouch(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="touch"}getTouchesPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&this.getIsTouch(t)&&e++;return e}getMouseWheelChanged(e=0){return e>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[e]}getMouseWheelDeltaY(e=0){return e>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[e]}getPointerEvent(e){if(!(e>=this._pointerEvent.length))return this._pointerEvent[e]??void 0}*foreachPointerId(e){for(let t=0;t<this._pointerTypes.length;t++)if(this._pointerIsActive(t)){if(e!==void 0){const i=this._pointerTypes[t];if(Array.isArray(e)){let n=!1;for(const s of e)if(i===s){n=!0;break}if(!n)continue}else if(e!==i)continue}yield t}}*foreachTouchId(){for(let e=0;e<this._pointerTypes.length;e++)this._pointerTypes[e]==="touch"&&this._pointerIsActive[e]&&(yield e)}_pointerIsActive(e){return e<0?!1:this._pointerPressed[e]||this._pointerDown[e]||this._pointerUp[e]}context;_pointerDown=[!1];_pointerUp=[!1];_pointerClick=[!1];_pointerDoubleClick=[!1];_pointerPressed=[!1];_pointerPositions=[new J];_pointerPositionsLastFrame=[new J];_pointerPositionsDelta=[new J];_pointerPositionsRC=[new J];_pointerPositionDown=[new b];_pointerDownTime=[];_pointerUpTime=[];_pointerUpTimestamp=[];_pointerIds=[];_pointerTypes=[""];_mouseWheelChanged=[!1];_mouseWheelDeltaY=[0];_pointerEvent=[];_pointerEventsPressed=[];_pointerSpace=[];_pressedStack=new Map;onDownButton(e,t){let i=this._pressedStack.get(e);i||(i=[],this._pressedStack.set(e,i)),i.push(t)}onReleaseButton(e,t){const i=this._pressedStack.get(e);if(!i)return;const n=i.indexOf(t);n>=0&&i.splice(n,1)}getFirstPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[0]}getLatestPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[t.length-1]}getKeyDown(e){if(e!==void 0)return this.isKeyDown(e);for(const t in this.keysPressed){const i=this.keysPressed[t];if(i.startFrame===this.context.time.frameCount)return i.key}return null}getKeyPressed(e){if(e!==void 0)return this.isKeyPressed(e);for(const t in this.keysPressed){const i=this.keysPressed[t];if(i.pressed)return i.key}return null}getKeyUp(e){if(e!==void 0)return this.isKeyUp(e);for(const t in this.keysPressed){const i=this.keysPressed[t];return i.pressed===!1&&i.frame===this.context.time.frameCount}return null}isKeyDown(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyDown(n))return!0;return!1}const i=this.keysPressed[e];return i?i.startFrame===this.context.time.frameCount&&i.pressed:!1}isKeyUp(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyUp(n))return!0;return!1}const i=this.keysPressed[e];return i?i.frame===this.context.time.frameCount&&i.pressed===!1:!1}isKeyPressed(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyPressed(n))return!0;return!1}const i=this.keysPressed[e];return i&&i.pressed||!1}getCodeForCommonKeyName(e){if(e.length===1){if(e>="0"&&e<="9")return["Digit"+e];if(e>="a"&&e<="z")return["Key"+e.toUpperCase()];if(e==" ")return["Space"]}switch(e){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(e){switch(e.type){case"pointerdown":ot&&Te("Create Pointer down"),this.onDownButton(e.deviceIndex,e.button),this.onDown(e);break;case"pointermove":ot&&Te("Create Pointer move"),this.onMove(e);break;case"pointerup":ot&&Te("Create Pointer up"),this.onUp(e),this.onReleaseButton(e.deviceIndex,e.button);break}}convertScreenspaceToRaycastSpace(e){return e.x=(e.x-this.context.domX)/this.context.domWidth*2-1,e.y=-((e.y-this.context.domY)/this.context.domHeight)*2+1,e}constructor(e){this.context=e,this.context.post_render_callbacks.push(this.onEndOfFrame)}_htmlEventSource;bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){for(const e in this._eventListeners)this._eventListeners[e].length=0;window.removeEventListener("contextmenu",this.onContextMenu),this._htmlEventSource?.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),this._htmlEventSource?.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const e=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);e>=0&&this.context.post_render_callbacks.splice(e,1),this.unbindEvents()}onLostFocus=()=>{for(const e in this.keysPressed)this.keysPressed[e].pressed=!1};_receivedPointerMoveEventsThisFrame=new Array;onEndOfFrame=()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let e=0;e<this._pointerUp.length;e++)this._pointerUp[e]=!1;for(let e=0;e<this._pointerDown.length;e++)this._pointerDown[e]=!1;for(let e=0;e<this._pointerClick.length;e++)this._pointerClick[e]=!1;for(let e=0;e<this._pointerDoubleClick.length;e++)this._pointerDoubleClick[e]=!1;for(const e of this._pointerPositionsDelta)e.set(0,0);for(let e=0;e<this._mouseWheelChanged.length;e++)this._mouseWheelChanged[e]=!1;for(let e=0;e<this._mouseWheelDeltaY.length;e++)this._mouseWheelDeltaY[e]=0};canReceiveInput(e){return e.target===this.context.renderer?.domElement||e.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&e.target===document.body&&G.isMozillaXR()?!0:(ot&&console.warn("CanReceiveInput:False for",e.target),!1)}onContextMenu=e=>{this.canReceiveInput(e)!==!1&&e instanceof PointerEvent&&e.pointerType};keysPressed={};onKeyDown=e=>{if(ot&&console.log(`key down ${e.code}, ${this.context.application.hasFocus}`,e),!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(t&&t.pressed)return;this.keysPressed[e.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:e.key,code:e.code};const i=new sc("keydown",e,e);this.onDispatchEvent(i)};onKeyPressed=e=>{if(!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(!t)return;t.pressed=!0,t.frame=this.context.time.frameCount+1;const i=new sc("keypress",e,e);this.onDispatchEvent(i)};onKeyUp=e=>{if(!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(!t)return;t.pressed=!1,t.frame=this.context.time.frameCount+1;const i=new sc("keyup",e,e);this.onDispatchEvent(i)};onWheelWindow=e=>{document.pointerLockElement&&this.onMouseWheel(e)};onMouseWheel=e=>{if(this.canReceiveInput(e)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const t=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=t+e.deltaY};onPointerDown=e=>{if(this.context.isInAR||this.canReceiveInput(e)===!1)return;e.target instanceof HTMLElement&&e.target.setPointerCapture(e.pointerId);const t=this.getPointerId(e);ot&&Te(`pointer down #${t}, identifier:${e.pointerId}`);const i=this.getAndUpdateSpatialObjectForScreenPosition(t,e.clientX,e.clientY),n=new Co("pointerdown",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:t,button:e.button,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:i,pressure:e.pressure});this.onDown(n)};onPointerMove=e=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(e.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(e.pointerId);let t=e.button;e.pointerType==="mouse"&&(t=this.getFirstPressedButtonForPointer(0)??0);const i=this.getPointerId(e,t);t===-1&&(t=i);const n=this.getAndUpdateSpatialObjectForScreenPosition(i,e.clientX,e.clientY),s=new Co("pointermove",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:i,button:t,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:n,pressure:e.pressure});this.onMove(s)};onPointerCancel=e=>{this.context.isInAR||(ot&&console.log("Pointer cancel",e),this.onPointerUp(e))};onPointerUp=e=>{if(this.context.isInAR)return;e.target instanceof HTMLElement&&e.target.releasePointerCapture(e.pointerId);const t=this.getPointerId(e),i=new Co("pointerup",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:t,button:e.button,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:this.getAndUpdateSpatialObjectForScreenPosition(t,e.clientX,e.clientY),pressure:e.pressure});this.onUp(i),this._pointerIds[t]=-1,ot&&console.log("ID="+t,"PointerId="+e.pointerId,"ALL:",[...this._pointerIds])};getPointerId(e,t){return e.pointerType==="mouse"?0+(t??e.button):this.getPointerIndex(e.pointerId)}getButtonName(e){const t=e.button;if(e.pointerType==="mouse")switch(t){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}onTouchStart=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),r=new Co("pointerdown",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onDown(r)}};onTouchMove=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),r=new Co("pointermove",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onMove(r)}};onTouchEnd=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=new Co("pointerup",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),pressure:i.force});this.onUp(s),this._pointerIds[n]=-1}};tempNearPlaneVector=new b;tempFarPlaneVector=new b;tempLookMatrix=new ee;getAndUpdateSpatialObjectForScreenPosition(e,t,i){let n=this._pointerSpace[e];n||(n=new k,this._pointerSpace[e]=n),this._pointerSpace[e]=n;const s=this.context.mainCamera;if(s){const r=this.tempNearPlaneVector.set(t,i,-1);this.convertScreenspaceToRaycastSpace(r);const a=this.tempFarPlaneVector.set(r.x,r.y,1);r.unproject(s),a.unproject(s);const l=s.worldUp||z(0,1,0).applyQuaternion(be(s));this.tempLookMatrix.lookAt(a,r,l),n.position.set(r.x,r.y,r.z),n.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return n}isInRect(e){if(this.context.isInXR)return!0;const t=this.context.domElement.getBoundingClientRect(),i=e.clientX,n=e.clientY,s=i>=t.x&&i<=t.right&&n>=t.y&&n<=t.bottom;return ot&&!s&&console.log("Not in rect",t,i,n),s}onDown(e){const t=e.pointerId;if(this.getPointerPressed(t)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${t}`,ot?e:""),ot&&console.log(e.pointerType,"DOWN",t),!!this.isInRect(e)){for(this.setPointerState(t,this._pointerPressed,!0),this.setPointerState(t,this._pointerDown,!0),this.setPointerStateT(t,this._pointerEvent,e.source);t>=this._pointerTypes.length;)this._pointerTypes.push(e.pointerType);for(this._pointerTypes[t]=e.pointerType;t>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new b);for(this._pointerPositionDown[t].set(e.clientX,e.clientY,e.clientZ??0);t>=this._pointerPositions.length;)this._pointerPositions.push(new J);this._pointerPositions[t].set(e.clientX,e.clientY),t>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[t]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(e),this._pointerEventsPressed.push(e),this.onDispatchEvent(e)}}onMove(e){const t=e.pointerId,i=this.getPointerPressed(t);i===!1&&!this.isInRect(e)||e.pointerType==="touch"&&!i||(this.updatePointerPosition(e),this.setPointerStateT(t,this._pointerEvent,e.source),this.onDispatchEvent(e))}onUp(e){const t=e.pointerId;if(!this.getPointerPressed(t)){ot&&console.log(e.pointerType,"UP",t,"was not down");return}ot&&console.log(e.pointerType,"UP",t),this.setPointerState(t,this._pointerPressed,!1),this.setPointerStateT(t,this._pointerEvent,e.source),this.setPointerState(t,this._pointerUp,!0),this.updatePointerPosition(e);for(let a=this._pointerEventsPressed.length-1;a>=0;a--)if(this._pointerEventsPressed[a].pointerId===t){this._pointerEventsPressed.splice(a,1);break}if(!this._pointerPositionDown[t]){ot&&ge("Received pointer up event without matching down event for button: "+t),console.warn("Received pointer up event without matching down event for button: "+t);return}const i=this._pointerUpTime[t],n=this._pointerDownTime[t],s=this.context.time.realtimeSinceStartup,r=s-n;if(t>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[t]=s,r<1){let a=e.clientX-this._pointerPositionDown[t].x,l=e.clientY-this._pointerPositionDown[t].y,c=0;if(e.isSpatial&&e.clientZ!=null&&(c=e.clientZ-this._pointerPositionDown[t].z,a*=200,l*=200,c*=200),Math.abs(a)<5&&Math.abs(l)<5&&Math.abs(c)<5){this.setPointerState(t,this._pointerClick,!0),e.isClick=!0;const h=s-i;ot&&console.log("CLICK",t,a,l,c,h),h<this._doubleClickTimeThreshold&&h>0&&(this.setPointerState(t,this._pointerDoubleClick,!0),e.isDoubleClick=!0)}}this.onDispatchEvent(e)}updatePointerPosition(e){const t=e.pointerId;for(;t>=this._pointerPositions.length;)this._pointerPositions.push(new J);for(;t>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new J);for(;t>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new J);const i=this._pointerPositionsLastFrame[t];i.copy(this._pointerPositions[t]);const n=this._pointerPositionsDelta[t];let s=e.clientX-i.x,r=e.clientY-i.y;if(e.source instanceof MouseEvent||e.source instanceof TouchEvent){const h=e.source;s===0&&h.movementX!==0&&(s=h.movementX||0),r===0&&h.movementY!==0&&(r=h.movementY||0)}n.x+=s,n.y+=r,this._pointerPositions[t].x=e.clientX,this._pointerPositions[t].y=e.clientY;const a=e.clientX,l=e.clientY;for(;t>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new J);const c=this._pointerPositionsRC[t];c.set(a,l),this.convertScreenspaceToRaycastSpace(c)}getPointerIndex(e){let t=-1;for(let i=0;i<this._pointerIds.length;i++){if(this._pointerIds[i]===e)return i;t===-1&&this._pointerIds[i]===-1&&(t=i)}return t!==-1?(this._pointerIds[t]=e,t):(ot&&console.log("PUSH pointerId:",e),this._pointerIds.push(e),this._pointerIds.length-1)}setPointerState(e,t,i){t[e]=i}setPointerStateT(e,t,i){return t[e]=i,i}onDispatchEvent(e){const t=N.Current;try{N.Current=this.context,this.dispatchEvent(e)}finally{N.Current=t}}}const Ea=new ee().makeRotationY(Math.PI),Gi=new U().setFromAxisAngle(new b(0,1,0),Math.PI),FO=x("debugwebxr");class zO{priority=-1e5;gameObject;isXRRig(){return!0}get isActive(){return this.gameObject.visible}constructor(){if(this.gameObject=new k,this.gameObject.name="Implicit XR Rig",FO){const e=vg(16733661);e.position.y+=.5,this.gameObject.add(e)}}}const Po=x("debugwebxr"),Bd=x("debugcustomgesture"),UO="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",NO="generic-trigger",VO=new U().setFromEuler(new nt(yo.degToRad(0),yo.degToRad(-90),yo.degToRad(-90))),WO=new b(.04,-.04,0);class rg{xr;get context(){return this.xr.context}inputSource;index=0;emitEvents=!0;get connected(){return this._connected}_connected=!0;get isTracking(){return this._isTracking}_isTracking=!1;get gamepad(){return this.__gamepad??=this.inputSource.gamepad}__gamepad;get isHand(){return this.hand!=null}get hand(){return this.__hand??=this.inputSource.hand}__hand;get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??=this.inputSource.handedness}__side=void 0;get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}_hitTestSource=void 0;_hasSelectEvent=!1;get hasSelectEvent(){return this._hasSelectEvent}_isMxInk=!1;_isMetaQuestTouchController=!1;getHitTest(){return this.xr.getHitTest(this)}_handJointPoses=new Map;getHandJointPose(e,t){if(t=t||this.xr.frame,!this.hand||!t?.getJointPose||!this.xr.referenceSpace)return null;let i=this._handJointPoses?.get(e);return i||(i=t.getJointPose(e,this.xr.referenceSpace),i&&this._handJointPoses.set(e,i),i)}_gripMatrix=new ee;_gripPosition=new b;_gripQuaternion=new U;_linearVelocity=new b;_rayPositionRaw=new b;_rayRotationRaw=new U;_rayMatrix=new ee;_rayPosition=new b;_rayQuaternion=new U;get gripPosition(){return z(this._gripPosition)}get gripQuaternion(){return ti(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return z(this._linearVelocity).applyQuaternion(Gi)}get rayPosition(){return z(this._rayPosition)}get rayQuaternion(){return ti(this._rayQuaternion)}get gripWorldPosition(){return z(this._gripWorldPosition)}_gripWorldPosition=new b;get gripWorldQuaternion(){return ti(this._gripWorldQuaternion)}_gripWorldQuaternion=new U;get rayWorldPosition(){return z(this._rayWorldPosition)}_rayWorldPosition=new b;updateRayWorldPosition(){const e=this.xr.context.mainCamera?.parent;this._rayWorldPosition.copy(this._rayPositionRaw),e&&this._rayWorldPosition.applyMatrix4(e.matrixWorld)}get rayWorldQuaternion(){return ti(this._rayWorldQuaternion)}_rayWorldQuaternion=new U;get pinchPosition(){return z(this._pinchPosition)}_pinchPosition=new b;updateRayWorldQuaternion(){const e=this.xr.context.mainCamera?.parent,t=e?be(e):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Gi),t&&this._rayWorldQuaternion.premultiply(t)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(z(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}_ray;_hand_wristDotUp=void 0;get handWristDotUp(){if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const e=this.handObject?.joints.wrist;if(e){const t=z(0,1,0).applyQuaternion(e.quaternion),i=z(0,1,0).dot(t);return this._hand_wristDotUp=i}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){return this.isHandUpsideDown&&this.getGesture("pinch")?.isDown}get object(){return this._object}_object;_gripSpaceObject;_raySpaceObject;model=null;_debugAxesHelper=new _i(.15);_debugGripAxesHelper=new _i(.07);_debugRayAxesHelper=new _i(.07);async getModelUrl(){return this.getMotionController?.then(e=>e?.assetUrl||null)}constructor(e,t,i){this.xr=e,this.inputSource=t,this.index=i,this._object=new k,this._object.name=`NeedleXRController_${i}`,Po&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new k,this._raySpaceObject=new k,this._gripSpaceObject.name=`NeedleXRController_${i}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${i}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new ls,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}_hitTestSourcePromise=null;_requestHitTestSource(){return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay})?.then(e=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=e:(e.cancel(),null)))??null:null}onPointerHits=e=>{};onUpdate(e){this.onUpdateFrame(e),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){F.DrawSphere(this.rayWorldPosition,.003),F.DrawDirection(this.rayWorldPosition,z(0,0,10).applyQuaternion(this.rayWorldQuaternion));const e=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),t=this.inputSource.profiles.join(`
|
|
146
146
|
`);let i=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
|
|
147
147
|
C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(i+=`
|
|
@@ -876,7 +876,7 @@ Target Framerate: `+this.targetFrameRate)),this._dispatchReadyAfterFrame&&(this.
|
|
|
876
876
|
padding-left: 25px;
|
|
877
877
|
border-radius: .5em;
|
|
878
878
|
border: 2px solid rgba(160,160,160,.3);
|
|
879
|
-
`,i=`Needle Engine \u2014 No license active, commercial use is not allowed. Visit https://needle.tools/pricing for more information and licensing options! v${yn}`;N.Current?.xr?console.log(i):console.log("%c "+i,t)}async function RM(o){if(!window.crossOriginIsolated){if(Hn==="pro"){const e=o?.domElement?.getAttribute("no-telemetry");if(e===""||e==="true"||e==="1"){Pi&&console.debug("Telemetry is disabled");return}Pi&&console.debug("Telemetry attribute: "+e)}try{const e="https://needle-engine-analytics-v2-r26roub2hq-lz.a.run.app";if(e){const t=window.location.href.split("?")[0];let i="api/v2/new/request";e.endsWith("/")||(i="/"+i);const n=Hn,s=`${e}${i}`;Pi&&console.debug("Sending beacon");const r={license:n,url:t,hostname:window.location.hostname,pathname:window.location.pathname,version:yn,generator:Ad,build_time:tg,public_key:Ma},a=navigator.sendBeacon?.(s,JSON.stringify(r));Pi&&console.debug("Sent beacon: "+a)}}catch(e){Pi&&console.log("Failed to send non-commercial usage message to analytics backend",e)}}}function cx(o,e){return Oo(o,de.ContextCreated,e),()=>gs(o,de.ContextCreated)}function TM(o,e){return Oo(o,de.ContextClearing,e),()=>gs(o,de.ContextClearing)}function EM(o,e){return Oo(o,de.ContextDestroying,e),()=>gs(o,de.ContextDestroying)}function bu(o,e){return Oo(o,xe.Start,e),()=>gs(o,xe.Start)}function hx(o,e){return Oo(o,xe.Update,e),()=>gs(o,xe.Update)}function AM(o,e){return Oo(o,xe.OnBeforeRender,e),()=>gs(o,xe.OnBeforeRender)}function IM(o,e){return Oo(o,xe.OnAfterRender,e),()=>gs(o,xe.OnAfterRender)}const LM=x("debugdecoders");let lf=null;function dx(){if(!lf){const o=xm(null);lf={dracoLoader:o.dracoLoader,ktx2Loader:o.ktx2Loader,meshoptDecoder:o.meshoptDecoder}}return lf}function ux(o){o!==void 0&&typeof o=="string"&&EC(o)}function px(o){if(o!==void 0&&typeof o=="string"&&o!=="js"){const e=dx();LM&&console.log("Setting draco decoder type to",o),e.dracoLoader.setDecoderConfig({type:o})}}function mx(o){o!==void 0&&typeof o=="string"&&TC(o)}function cf(o,e){const t=dx();return e.renderer?t.ktx2Loader.detectSupport(e.renderer):console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"),MC(o),o.dracoLoader||o.setDRACOLoader(t.dracoLoader),o.ktx2Loader||o.setKTX2Loader(t.ktx2Loader),o.meshoptDecoder||o.setMeshoptDecoder(t.meshoptDecoder),RC(o,{progressive:!0}),o}const Ye=function(o){return u(o)},u=function(o){if(o===void 0&&(o=null),!Array.isArray(o))o=gx(o);else for(let e=0;e<o.length;e++){const t=o[e];o[e]=gx(t)}return function(e,t){if(!e){const n=typeof t=="string"?t:t.name;console.warn(`@serializable without a target at '${n}'.`);return}typeof t!="string"&&(t=t.name),Object.getOwnPropertyDescriptor(e,"$serializedTypes")||(e.$serializedTypes={});const i=e.$serializedTypes=e.$serializedTypes||{};i[t]=o}};function gx(o){switch(o?.prototype?.constructor?.name){case"Number":case"String":case"Boolean":return null}return o}const xs=x("debughotreload");let Oc=!1;const kc=new Map;function jM(){return Oc}function hf(){return globalThis.NEEDLE_HOT_RELOAD_ENABLED===!0}function fx(o){if(Oc){xs&&console.warn("[Needle Engine] Hot reloading is in progress, not registering instance",o);return}xs&&console.log("[Needle Engine] Registering hot reload instance",o);const e=o.constructor.name;kc.has(e)?kc.get(e)?.push(o):kc.set(e,[o])}function yx(o){if(Oc){xs&&console.warn("[Needle Engine] Hot reloading is in progress, not unregistering instance",o);return}xs&&console.log("[Needle Engine] Unregistering hot reload instance",o);const e=o.constructor.name,t=kc.get(e);if(!t)return;const i=t.indexOf(o);i!==-1&&t.splice(i,1)}let bx=!1;function DM(){if(xs||bx)return;bx=!0;const o=console.error;console.error=(...e)=>{if(e.length){const t=e[0];if(typeof t=="string"&&t.includes("[hmr] Failed to reload ")){console.log("[Needle Engine] Hot reloading failed"),window.location.reload();return}}o.apply(console,e)}}function BM(o){xs&&console.log("[HMR] Apply changes",o,Object.keys(o)),DM();for(const e of Object.keys(o))try{Oc=!0;const t=C.get(e);if(!t){xs&&console.log("[HMR] Type not found: "+e);continue}const i=o[e],n=kc.get(i.name);let s="[Needle Engine] Updating type: "+e;const r=n?.length??-1;r>0?s+=" x"+r:s+=" (No instances registered)",console.log(s);const a=Object.getOwnPropertyNames(t.prototype),l=Object.getOwnPropertyDescriptors(i.prototype);for(const c in l)l[c].writable&&(t.prototype[c]=o[e].prototype[c]);for(const c of a)l[c]||delete t.prototype[c];if(n){const c=new i,h=Object.getOwnPropertyDescriptors(c);for(const d of n){const p=d,m=p.isComponent===!0,f=m?p.activeAndEnabled:!0,g=m?p.context:void 0;try{if(m&&g&&ko(p,g),m&&f&&(p.enabled=!1),d.onBeforeHotReloadFields&&d.onBeforeHotReloadFields()===!1)continue;for(const y in h)if(h[y].writable){if(d[y]===void 0)d[y]=c[y];else if(typeof d[y]=="function"&&!d[y].prototype){const _=d[y],v=_.name,P="bound ";if(v===P)continue;const M=_.name.substring(P.length),O=i.prototype[M];O&&(d[y]=O.bind(d))}}d.onAfterHotReloadFields&&d.onAfterHotReloadFields()}finally{m&&g&&Og(p,g),m&&f&&(p.enabled=!0)}}}}catch(t){if(xs)console.error(t);else return!1}finally{Oc=!1,hr(wi.Log,"Script changes applied (HMR)")}return!0}class w extends k{guid;static isDestroyed(e){return Or(e)}static setActive(e,t,i=!0){e&&(xc(e,t),Qd(e),t&&i&&ev(N.Current,e))}static isActiveSelf(e){return Na(e)}static isActiveInHierarchy(e){return Av(e)}static markAsInstancedRendered(e,t){Iv(e,t)}static isUsingInstancing(e){return ou(e)}static foreachComponent(e,t,i=!0){return kr(e,t,i)}static instantiateSynced(e,t){return e?Ig(e,t):null}static instantiate(e,t=null){return"isAssetReference"in e,Wa(e,t)}static destroySynced(e,t,i=!0){if(!e)return;const n=e;t=t??N.Current,gc(n,t.connection,i)}static destroy(e,t=!0){return Ci(e,t)}static add(e,t,i){if(!(!e||!t)){if(e===t){console.warn("Can not add object to self",e);return}i||(i=N.Current),t.add(e),xc(e,!0),Qd(e),i?w.foreachComponent(e,n=>{Og(n,i),!n.__internalDidAwakeAndStart&&i.new_script_start.includes(n)===!1&&i.new_script_start.push(n)},!0):console.warn("Missing context")}}static remove(e){e&&(e.parent?.remove(e),xc(e,!1),Qd(e),w.foreachComponent(e,t=>{_k(t)},!0))}static invokeOnChildren(e,t,...i){this.invoke(e,t,!0,i)}static invoke(e,t,i=!1,...n){e&&this.foreachComponent(e,s=>{const r=s[t];r&&typeof r=="function"&&r?.call(s,...n)},i)}static addNewComponent(e,t,i,n=!0){return wn(e,t,i,{callAwake:n})}static addComponent(e,t,i,n){return wn(e,t,i,n)}static moveComponent(e,t){return wn(e,t)}static removeComponent(e){return Wg(e.gameObject,e),e}static getOrAddComponent(e,t){return yc(e,t)}static getComponent(e,t){return e===null?null:Cr(e,t)}static getComponents(e,t,i=null){return e===null?i??[]:bc(e,t,i)}static findByGuid(e,t){return $g(e,t)}static findObjectOfType(e,t,i=!0){return Ua(e,t??N.Current,i)}static findObjectsOfType(e,t){const i=[];return Ev(e,i,t),i}static getComponentInChildren(e,t){return _c(e,t)}static getComponentsInChildren(e,t,i=null){return za(e,t,i??void 0)}static getComponentInParent(e,t){return vc(e,t)}static getComponentsInParent(e,t,i=null){return tu(e,t,i)}static getAllComponents(e){const t=e.userData?.components;return t?[...t]:[]}static*iterateComponents(e){const t=e?.userData?.components;if(t&&Array.isArray(t))for(let i=0;i<t.length;i++)yield t[i]}}class R{get isComponent(){return!0}__context;get context(){return this.__context??N.Current}set context(e){this.__context=e}get scene(){return this.context.scene}get layer(){return this.gameObject?.userData?.layer}get name(){return this.gameObject?.name?this.gameObject.name:this.gameObject?.userData.name}__name;set name(e){this.gameObject?(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.name=e,this.__name=e):this.__name=e}get tag(){return this.gameObject?.userData.tag}set tag(e){this.gameObject&&(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.tag=e)}get static(){return this.gameObject?.userData.static}set static(e){this.gameObject&&(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.static=e)}get activeAndEnabled(){return!(this.destroyed||this.__isEnabled===!1||!this.__isActiveInHierarchy)}get __isActive(){return this.gameObject.visible}get __isActiveInHierarchy(){if(!this.gameObject)return!1;const e=this.gameObject[So];return e===void 0?!0:e}set __isActiveInHierarchy(e){this.gameObject&&(this.gameObject[So]=e)}gameObject;guid="invalid";sourceId;awake(){}onEnable(){}onDisable(){}onDestroy(){this.__destroyed=!0}startCoroutine(e,t=xe.Update){return this.context.registerCoroutineUpdate(this,e,t)}stopCoroutine(e,t=xe.Update){this.context.unregisterCoroutineUpdate(e,t)}get destroyed(){return this.__destroyed}destroy(){this.__destroyed||this.__internalDestroy()}__didAwake=!1;__didStart=!1;__didEnable=!1;__isEnabled=void 0;__destroyed=!1;get __internalDidAwakeAndStart(){return this.__didAwake&&this.__didStart}constructor(e){this.__didAwake=!1,this.__didStart=!1,this.__didEnable=!1,this.__isEnabled=void 0,this.__destroyed=!1,this._internalInit(e),hf()&&fx(this)}__internalNewInstanceCreated(e){return this.__didAwake=!1,this.__didStart=!1,this.__didEnable=!1,this.__isEnabled=void 0,this.__destroyed=!1,this._internalInit(e),this}_internalInit(e){if(typeof e=="object")for(const t of Object.keys(e)){const i=e[t];typeof i!="function"&&(this[t]=i)}}__internalAwake(){this.__didAwake||(this.__didAwake=!0,this.awake())}__internalStart(){this.__didStart||(this.__didStart=!0,this.start&&this.start())}__internalEnable(e){return this.__destroyed?(A()&&console.warn("[Needle Engine Dev] Trying to enable destroyed component"),!1):this.__didAwake?this.__didEnable?(e!==!0&&(this.__isEnabled=!0),!1):(this.__didEnable=!0,this.__isEnabled=!0,this.onEnable(),!0):!1}__internalDisable(e){if(this.__didAwake){if(!this.__didEnable){e!==!0&&(this.__isEnabled=!1);return}this.__didEnable=!1,this.__isEnabled=!1,this.onDisable()}}__internalDestroy(){this.__destroyed||(this.__destroyed=!0,this.__didAwake&&(this.onDestroy?.call(this),this.dispatchEvent(new CustomEvent("destroyed",{detail:this}))),Mv(this),hf()&&yx(this))}get enabled(){return typeof this.__isEnabled=="boolean"?this.__isEnabled:!0}set enabled(e){if(this.__destroyed){A()&&console.warn(`[Needle Engine Dev] Trying to ${e?"enable":"disable"} destroyed component`);return}if(typeof e=="number"&&(e>=.5?e=!0:e=!1),!this.__didAwake){this.__isEnabled=e;return}e?this.__internalEnable():this.__internalDisable()}get worldPosition(){return K(this.gameObject)}set worldPosition(e){mt(this.gameObject,e)}setWorldPosition(e,t,i){dr(this.gameObject,e,t,i)}get worldQuaternion(){return be(this.gameObject)}set worldQuaternion(e){fn(this.gameObject,e)}setWorldQuaternion(e,t,i,n){qm(this.gameObject,e,t,i,n)}get worldEuler(){return Xm(this.gameObject)}set worldEuler(e){Qm(this.gameObject,e)}get worldRotation(){return this.gameObject.worldRotation}set worldRotation(e){this.setWorldRotation(e.x,e.y,e.z,!0)}setWorldRotation(e,t,i,n=!0){Jl(this.gameObject,e,t,i,n)}static _forward=new b;get forward(){return R._forward.set(0,0,-1).applyQuaternion(this.worldQuaternion)}static _right=new b;get right(){return R._right.set(1,0,0).applyQuaternion(this.worldQuaternion)}static _up=new b;get up(){return R._up.set(0,1,0).applyQuaternion(this.worldQuaternion)}_eventListeners=new Map;addEventListener(e,t){this._eventListeners[e]=this._eventListeners[e]||[],this._eventListeners[e].push(t)}removeEventListener(e,t){if(!this._eventListeners[e])return;const i=this._eventListeners[e].indexOf(t);i>=0&&this._eventListeners[e].splice(i,1)}dispatchEvent(e){if(!e||!this._eventListeners[e.type])return!1;const t=this._eventListeners[e.type];for(let i=0;i<t.length;i++)t[i](e);return!1}}const FM=Object.freeze(Object.defineProperty({__proto__:null,Behaviour:R,Component:R,GameObject:w},Symbol.toStringTag,{value:"Module"}));var zM=Object.defineProperty,_x=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&zM(e,t,n),n};class Mc extends R{from;to;width=0;centered=!0;_centerPos;awake(){this._centerPos=new b}update(){if(!this.from||!this.to)return;const e=K(this.from).clone(),t=K(this.to).clone(),i=e.distanceTo(t);this._centerPos.copy(e),this._centerPos.add(t),this._centerPos.multiplyScalar(.5),mt(this.gameObject,this.centered?this._centerPos:e),this.gameObject.lookAt(K(this.to).clone()),this.gameObject.scale.set(this.width,this.width,i)}}_x([u(w)],Mc.prototype,"from"),_x([u(w)],Mc.prototype,"to");var UM=Object.defineProperty,NM=Object.getOwnPropertyDescriptor,Tr=(o,e,t,i)=>{for(var n=i>1?void 0:i?NM(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&UM(e,t,n),n};const ws=x("debuganimation");let vx=class{x;y};class Lt extends R{get isAnimationComponent(){return!0}addClip(e){this.animations||(this.animations=[]),this.animations.includes(e)||this.animations.push(e)}playAutomatically=!0;randomStartTime=!0;minMaxSpeed;minMaxOffsetNormalized;loop=!0;clampWhenFinished=!1;get time(){if(this.actions){for(const e of this.actions)if(e.isRunning())return e.time}return 0}set time(e){if(this.actions)for(const t of this.actions)t.time=e}get duration(){if(this.actions){for(const 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){ws&&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,ws&&console.log("Animation Awake",this.name,this),this._tempAnimationsArray&&(this.animations=this._tempAnimationsArray,this._tempAnimationsArray=void 0),this._tempAnimationClipBeforeGameObjectExisted&&(this.clip=this._tempAnimationClipBeforeGameObjectExisted,this._tempAnimationClipBeforeGameObjectExisted=null),this.actions=[],this._handles=[]}onEnable(){if(this.playAutomatically&&this.animations?.length>0){const 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.actions.length;e++)if(this.actions[e].isRunning())return!0}return!1}stopAll(e){if(this.actions)for(const t of this.actions)e?.fadeDuration?t.fadeOut(e.fadeDuration):t.stop()}stop(e,t){if(e===void 0){this.stopAll();return}else if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}e=this.animations[e]}else typeof e=="string"&&(e=this.animations.find(n=>n.name===e));if(!e){console.error("Could not find clip",e);return}const i=this.actions.find(n=>n.getClip()===e);if(!i){console.error("Could not find action",e);return}t?.fadeDuration?i.fadeOut(t.fadeDuration):i.stop()}pause(e,t=!1){if(e===void 0){for(const n of this.actions)n.paused=!t;return}else if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}e=this.animations[e]}else typeof e=="string"&&(e=this.animations.find(n=>n.name===e));if(!e){console.error("Could not find clip",e);return}const i=this.actions.find(n=>n.getClip()===e);if(!i){console.error("Could not find action",e);return}i.paused=!t}resume(){for(const e of this.actions)e.paused=!1}play(e=0,t){if(ws&&console.log("PLAY",e),this.ensureMixer(),!this.mixer){ws&&console.warn("Missing mixer",this);return}e===void 0&&(e=0);let i=e;if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}i=this.animations[e]}else typeof e=="string"&&(i=this.animations.find(s=>s.name===e));if(!i){console.error("Could not find clip",e);return}t||(t={});for(const s of this.actions)if(s.getClip()===i)return this.internalOnPlay(s,t);if(!i.tracks){console.warn("Clip is no AnimationClip",i);return}const n=this.mixer.clipAction(i);return this.actions.push(n),this.internalOnPlay(n,t)}internalOnPlay(e,t){var i=this.actions.find(s=>s===e);if(i===e&&i.isRunning()&&i.time<i.getClip().duration){const s=this.tryFindHandle(e);if(i.paused&&(i.paused=!1),s)return s.waitForFinish()}if(t.loop===void 0&&(t.loop=this.loop),t.clampWhenFinished===void 0&&(t.clampWhenFinished=this.clampWhenFinished),t.minMaxOffsetNormalized===void 0&&this.randomStartTime&&(t.minMaxOffsetNormalized=this.minMaxOffsetNormalized),t.minMaxSpeed===void 0&&(t.minMaxSpeed=this.minMaxSpeed),t?.exclusive??!0)for(const s of this.actions)s!=i&&(t.fadeDuration?s.fadeOut(t.fadeDuration):s.stop());if(t?.fadeDuration&&e.fadeIn(t.fadeDuration),e.enabled=!0,t?.startTime!=null)e.time=t.startTime;else if(t?.minMaxOffsetNormalized&&t.minMaxOffsetNormalized.x!=0&&t.minMaxOffsetNormalized.y!=0){const s=e.getClip();e.time=j.lerp(t.minMaxOffsetNormalized.x,t.minMaxOffsetNormalized.y,Math.random())*s.duration}else e.time>=e.getClip().duration&&(e.time=0);t?.minMaxSpeed?e.timeScale=j.lerp(t.minMaxSpeed.x,t.minMaxSpeed.y,Math.random()):e.timeScale=t?.speed??1,t?.loop!=null?e.loop=t.loop?MS:pm:e.loop=pm,t?.clampWhenFinished&&(e.clampWhenFinished=!0),e.paused=!1,e.play(),ws&&console.log("PLAY",e.getClip().name,e);const n=new VM(e,this.mixer,t,s=>{this._handles.splice(this._handles.indexOf(n),1)});return this._handles.push(n),n.waitForFinish()}tryFindHandle(e){for(const t of this._handles)if(t.action===e)return t}ensureMixer(){if(!this.mixer){const e="animationMixer";this.gameObject[e]&&(this.mixer=this.gameObject[e]),(!this.mixer||!this.mixer.clipAction)&&(this.mixer=new mm(this.gameObject),this.gameObject[e]=this.mixer)}this.context.animations.registerAnimationMixer(this.mixer)}}Tr([u()],Lt.prototype,"playAutomatically",2),Tr([u()],Lt.prototype,"randomStartTime",2),Tr([u(vx)],Lt.prototype,"minMaxSpeed",2),Tr([u(vx)],Lt.prototype,"minMaxOffsetNormalized",2),Tr([u()],Lt.prototype,"loop",2),Tr([u()],Lt.prototype,"clampWhenFinished",2),Tr([u(Wi)],Lt.prototype,"clips",1);class VM{mixer;action;promise=null;_options;_resolveCallback=null;_resolvedOrRejectedCallback;constructor(e,t,i,n){this.action=e,this.mixer=t,this._resolvedOrRejectedCallback=n,this._options=i}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)}}const _u=Symbol("objectIsAnimatedData");function xx(o,e,t){if(!o)return;if(o[_u]===void 0){if(!t)return;o[_u]=new Set}const i=o[_u];t?i.add(e):i.has(e)&&i.delete(e)}function WM(o){if(!o)return!1;const e=o[_u];return e!==void 0&&e.size>0}class $M{_context;get context(){return this._context??N.Current}get isStateMachineBehaviour(){return!0}}class Rc{name;nameHash;normalizedTime;length;speed;action;hasTransitions;constructor(e,t,i,n){this.name=e.name,this.nameHash=e.hash,this.normalizedTime=t,this.length=i,this.speed=n,this.action=e.motion.action||null,this.hasTransitions=e.transitions?.length>0||!1}}function wx(o,e){return{name:"Empty",isLooping:!1,guid:e?.generateUUID()??yo.generateUUID(),index:-1,clip:new Wi(o,0,[])}}var Ss=(o=>(o[o.If=1]="If",o[o.IfNot=2]="IfNot",o[o.Greater=3]="Greater",o[o.Less=4]="Less",o[o.Equals=6]="Equals",o[o.NotEqual=7]="NotEqual",o))(Ss||{}),df=(o=>(o[o.Float=1]="Float",o[o.Int=3]="Int",o[o.Bool=4]="Bool",o[o.Trigger=9]="Trigger",o))(df||{});const st=x("debuganimatorcontroller"),vu=x("debugrootmotion");class hn{static createFromClips(e,t={looping:!1,autoTransition:!0,transitionDuration:0}){const i=[];for(let s=0;s<e.length;s++){const r=e[s],a=[];if(t.autoTransition!==!1){const c=t.transitionDuration??0,h=c/r.duration;let d=s;(t.autoTransition===void 0||t.autoTransition===!0)&&(d=(s+1)%e.length),a.push({exitTime:1-h,offset:0,duration:c,hasExitTime:!0,destinationState:d,conditions:[]})}const l={name:r.name,hash:s,motion:{name:r.name,clip:r,isLooping:t?.looping??!1},transitions:a,behaviours:[]};i.push(l)}const n={name:"AnimatorController",guid:new At(Date.now()).generateUUID(),parameters:[],layers:[{name:"Base Layer",stateMachine:{defaultState:0,states:i}}]};return new hn(n)}play(e,t=-1,i=Number.NEGATIVE_INFINITY,n=0){if(t<0)t=0;else if(t>=this.model.layers.length){console.warn("invalid layer");return}const s=this.model.layers[t].stateMachine;for(const r of s.states)if(r.name===e||r.hash===e){st&&console.log("transition to ",r),this.transitionTo(r,n,i);return}console.warn("Could not find "+e+" to play")}reset(){this.setStartTransition()}setBool(e,t){const i=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(n=>n[i]===e).forEach(n=>n.value=t)}getBool(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??!1}setFloat(e,t){const i=typeof e=="string"?"name":"hash",n=this.model?.parameters?.filter(s=>s[i]===e);return n.forEach(s=>s.value=t),n?.length>0}getFloat(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??0}setInteger(e,t){const i=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(n=>n[i]===e).forEach(n=>n.value=t)}getInteger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??0}setTrigger(e){st&&console.log("SET TRIGGER",e);const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(i=>i[t]===e).forEach(i=>i.value=!0)}resetTrigger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(i=>i[t]===e).forEach(i=>i.value=!1)}getTrigger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??!1}isInTransition(){return this._activeStates.length>1}setSpeed(e){this._speed=e}_speed=1;FindState(e){return this.findState(e)}findState(e){if(!e)return null;if(Array.isArray(this.model.layers)){for(const t of this.model.layers)for(const i of t.stateMachine.states)if(i.name===e||i.hash==e)return i}return null}getCurrentStateInfo(){if(!this._activeState)return null;const e=this._activeState.motion.action;if(!e)return null;const t=this._activeState.motion.clip.duration,i=t<=0?0:Math.abs(e.time/t);return new Rc(this._activeState,i,t,this._speed)}get currentAction(){return this._activeState&&this._activeState.motion.action||null}normalizedStartOffset=0;animator;model;get context(){return this.animator?.context}get mixer(){return this._mixer}dispose(){if(this._mixer.stopAllAction(),this.animator){this._mixer.uncacheRoot(this.animator.gameObject);for(const e of this._activeStates)e.motion.clip&&this.mixer.uncacheAction(e.motion.clip,this.animator.gameObject)}this.context?.animations.unregisterAnimationMixer(this._mixer)}bind(e){e?this.animator!==e&&(this._mixer&&(this._mixer.stopAllAction(),this.context?.animations.unregisterAnimationMixer(this._mixer)),this.animator=e,this._mixer=new mm(this.animator.gameObject),this.context?.animations.registerAnimationMixer(this._mixer),this.createActions(this.animator)):console.error("AnimatorController.bind: animator is null")}clone(){if(typeof this.model=="string")return console.warn("AnimatorController has not been resolved, can not create model from string",this.model),null;st&&console.warn("AnimatorController clone()",this.model);const e=Ql(this.model,(t,i,n)=>n==null?!0:!(n.type==="Object3D"||n.isObject3D===!0||Kb(n)||n.tracks!==void 0||n instanceof hn));return console.assert(e!==this.model),new hn(e)}update(e){if(!this.animator)return;this.evaluateTransitions(),this.updateActiveStates(e);const t=this.animator.context.time.deltaTime;this.animator.applyRootMotion&&this.rootMotionHandler?.onBeforeUpdate(e),this._mixer.update(t),this.animator.applyRootMotion&&this.rootMotionHandler?.onAfterUpdate(e)}_mixer;_activeState;get activeState(){return this._activeState}constructor(e){this.model=e,st&&console.log(this)}_activeStates=[];updateActiveStates(e){for(let t=0;t<this._activeStates.length;t++){const i=this._activeStates[t],n=i.motion;if(!n.action)this._activeStates.splice(t,1),t--;else{const s=n.action;s.weight=e,s.getEffectiveWeight()<=0&&!s.isRunning()&&(st&&console.debug("REMOVE",i.name,s.getEffectiveWeight(),s.isRunning(),s.isScheduled()),this._activeStates.splice(t,1),t--)}}}setStartTransition(){this.model.layers.length>1&&(st||A())&&console.warn("Multiple layers are not supported yet "+this.animator?.name);for(const e of this.model.layers){const t=e.stateMachine;t.defaultState===void 0&&(st&&console.warn("AnimatorController default state is undefined, will assign state 0 as default",e),t.defaultState=0);const i=t.states[t.defaultState];this.transitionTo(i,0,this.normalizedStartOffset);break}}evaluateTransitions(){let e=!1;if(!this._activeState){if(this.setStartTransition(),!this._activeState)return;e=!0}const t=this._activeState,i=t.motion.action;for(const s of t.transitions){if(!s.hasExitTime&&s.conditions.length<=0)continue;let r=!0;for(const a of s.conditions)if(!this.evaluateCondition(a)){r=!1;break}if(r)if(i){const a=t.motion.clip.duration,l=a<=0?1:Math.abs(i.time/a);let c=s.exitTime;i.timeScale<0&&(c=1-c);let h=!1;if(s.hasExitTime?i.timeScale>0?h=l>=s.exitTime:i.timeScale<0&&(h=1-l>=s.exitTime):h=!0,h){for(const d of s.conditions){const p=this.model.parameters.find(m=>m.name===d.parameter);p?.type===df.Trigger&&p.value&&(p.value=!1)}if(i.clampWhenFinished=!0,st){const d=this.getState(s.destinationState,0);console.log(`Transition to ${s.destinationState} / ${d?.name}`,s,`
|
|
879
|
+
`,i=`Needle Engine \u2014 No license active, commercial use is not allowed. Visit https://needle.tools/pricing for more information and licensing options! v${yn}`;N.Current?.xr?console.log(i):console.log("%c "+i,t)}async function RM(o){if(window.crossOriginIsolated)return;const e=Hn;if(e==="pro"||e==="enterprise"){const t=o?.domElement?.getAttribute("no-telemetry");if(t===""||t==="true"||t==="1"){Pi&&console.debug("Telemetry is disabled");return}Pi&&console.debug("Telemetry attribute: "+t)}try{const t="https://needle-engine-analytics-v2-r26roub2hq-lz.a.run.app";if(t){const i=window.location.href.split("?")[0];let n="api/v2/new/request";t.endsWith("/")||(n="/"+n);const s=Hn,r=`${t}${n}`;Pi&&console.debug("Sending beacon");const a={license:s,url:i,hostname:window.location.hostname,pathname:window.location.pathname,version:yn,generator:Ad,build_time:tg,public_key:Ma},l=navigator.sendBeacon?.(r,JSON.stringify(a));Pi&&console.debug("Sent beacon: "+l)}}catch(t){Pi&&console.log("Failed to send non-commercial usage message to analytics backend",t)}}function cx(o,e){return Oo(o,de.ContextCreated,e),()=>gs(o,de.ContextCreated)}function TM(o,e){return Oo(o,de.ContextClearing,e),()=>gs(o,de.ContextClearing)}function EM(o,e){return Oo(o,de.ContextDestroying,e),()=>gs(o,de.ContextDestroying)}function bu(o,e){return Oo(o,xe.Start,e),()=>gs(o,xe.Start)}function hx(o,e){return Oo(o,xe.Update,e),()=>gs(o,xe.Update)}function AM(o,e){return Oo(o,xe.OnBeforeRender,e),()=>gs(o,xe.OnBeforeRender)}function IM(o,e){return Oo(o,xe.OnAfterRender,e),()=>gs(o,xe.OnAfterRender)}const LM=x("debugdecoders");let lf=null;function dx(){if(!lf){const o=xm(null);lf={dracoLoader:o.dracoLoader,ktx2Loader:o.ktx2Loader,meshoptDecoder:o.meshoptDecoder}}return lf}function ux(o){o!==void 0&&typeof o=="string"&&EC(o)}function px(o){if(o!==void 0&&typeof o=="string"&&o!=="js"){const e=dx();LM&&console.log("Setting draco decoder type to",o),e.dracoLoader.setDecoderConfig({type:o})}}function mx(o){o!==void 0&&typeof o=="string"&&TC(o)}function cf(o,e){const t=dx();return e.renderer?t.ktx2Loader.detectSupport(e.renderer):console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures will probably fail"),MC(o),o.dracoLoader||o.setDRACOLoader(t.dracoLoader),o.ktx2Loader||o.setKTX2Loader(t.ktx2Loader),o.meshoptDecoder||o.setMeshoptDecoder(t.meshoptDecoder),RC(o,{progressive:!0}),o}const Ye=function(o){return u(o)},u=function(o){if(o===void 0&&(o=null),!Array.isArray(o))o=gx(o);else for(let e=0;e<o.length;e++){const t=o[e];o[e]=gx(t)}return function(e,t){if(!e){const n=typeof t=="string"?t:t.name;console.warn(`@serializable without a target at '${n}'.`);return}typeof t!="string"&&(t=t.name),Object.getOwnPropertyDescriptor(e,"$serializedTypes")||(e.$serializedTypes={});const i=e.$serializedTypes=e.$serializedTypes||{};i[t]=o}};function gx(o){switch(o?.prototype?.constructor?.name){case"Number":case"String":case"Boolean":return null}return o}const xs=x("debughotreload");let Oc=!1;const kc=new Map;function jM(){return Oc}function hf(){return globalThis.NEEDLE_HOT_RELOAD_ENABLED===!0}function fx(o){if(Oc){xs&&console.warn("[Needle Engine] Hot reloading is in progress, not registering instance",o);return}xs&&console.log("[Needle Engine] Registering hot reload instance",o);const e=o.constructor.name;kc.has(e)?kc.get(e)?.push(o):kc.set(e,[o])}function yx(o){if(Oc){xs&&console.warn("[Needle Engine] Hot reloading is in progress, not unregistering instance",o);return}xs&&console.log("[Needle Engine] Unregistering hot reload instance",o);const e=o.constructor.name,t=kc.get(e);if(!t)return;const i=t.indexOf(o);i!==-1&&t.splice(i,1)}let bx=!1;function DM(){if(xs||bx)return;bx=!0;const o=console.error;console.error=(...e)=>{if(e.length){const t=e[0];if(typeof t=="string"&&t.includes("[hmr] Failed to reload ")){console.log("[Needle Engine] Hot reloading failed"),window.location.reload();return}}o.apply(console,e)}}function BM(o){xs&&console.log("[HMR] Apply changes",o,Object.keys(o)),DM();for(const e of Object.keys(o))try{Oc=!0;const t=C.get(e);if(!t){xs&&console.log("[HMR] Type not found: "+e);continue}const i=o[e],n=kc.get(i.name);let s="[Needle Engine] Updating type: "+e;const r=n?.length??-1;r>0?s+=" x"+r:s+=" (No instances registered)",console.log(s);const a=Object.getOwnPropertyNames(t.prototype),l=Object.getOwnPropertyDescriptors(i.prototype);for(const c in l)l[c].writable&&(t.prototype[c]=o[e].prototype[c]);for(const c of a)l[c]||delete t.prototype[c];if(n){const c=new i,h=Object.getOwnPropertyDescriptors(c);for(const d of n){const p=d,m=p.isComponent===!0,f=m?p.activeAndEnabled:!0,g=m?p.context:void 0;try{if(m&&g&&ko(p,g),m&&f&&(p.enabled=!1),d.onBeforeHotReloadFields&&d.onBeforeHotReloadFields()===!1)continue;for(const y in h)if(h[y].writable){if(d[y]===void 0)d[y]=c[y];else if(typeof d[y]=="function"&&!d[y].prototype){const _=d[y],v=_.name,P="bound ";if(v===P)continue;const M=_.name.substring(P.length),O=i.prototype[M];O&&(d[y]=O.bind(d))}}d.onAfterHotReloadFields&&d.onAfterHotReloadFields()}finally{m&&g&&Og(p,g),m&&f&&(p.enabled=!0)}}}}catch(t){if(xs)console.error(t);else return!1}finally{Oc=!1,hr(wi.Log,"Script changes applied (HMR)")}return!0}class w extends k{guid;static isDestroyed(e){return Or(e)}static setActive(e,t,i=!0){e&&(xc(e,t),Qd(e),t&&i&&ev(N.Current,e))}static isActiveSelf(e){return Na(e)}static isActiveInHierarchy(e){return Av(e)}static markAsInstancedRendered(e,t){Iv(e,t)}static isUsingInstancing(e){return ou(e)}static foreachComponent(e,t,i=!0){return kr(e,t,i)}static instantiateSynced(e,t){return e?Ig(e,t):null}static instantiate(e,t=null){return"isAssetReference"in e,Wa(e,t)}static destroySynced(e,t,i=!0){if(!e)return;const n=e;t=t??N.Current,gc(n,t.connection,i)}static destroy(e,t=!0){return Ci(e,t)}static add(e,t,i){if(!(!e||!t)){if(e===t){console.warn("Can not add object to self",e);return}i||(i=N.Current),t.add(e),xc(e,!0),Qd(e),i?w.foreachComponent(e,n=>{Og(n,i),!n.__internalDidAwakeAndStart&&i.new_script_start.includes(n)===!1&&i.new_script_start.push(n)},!0):console.warn("Missing context")}}static remove(e){e&&(e.parent?.remove(e),xc(e,!1),Qd(e),w.foreachComponent(e,t=>{_k(t)},!0))}static invokeOnChildren(e,t,...i){this.invoke(e,t,!0,i)}static invoke(e,t,i=!1,...n){e&&this.foreachComponent(e,s=>{const r=s[t];r&&typeof r=="function"&&r?.call(s,...n)},i)}static addNewComponent(e,t,i,n=!0){return wn(e,t,i,{callAwake:n})}static addComponent(e,t,i,n){return wn(e,t,i,n)}static moveComponent(e,t){return wn(e,t)}static removeComponent(e){return Wg(e.gameObject,e),e}static getOrAddComponent(e,t){return yc(e,t)}static getComponent(e,t){return e===null?null:Cr(e,t)}static getComponents(e,t,i=null){return e===null?i??[]:bc(e,t,i)}static findByGuid(e,t){return $g(e,t)}static findObjectOfType(e,t,i=!0){return Ua(e,t??N.Current,i)}static findObjectsOfType(e,t){const i=[];return Ev(e,i,t),i}static getComponentInChildren(e,t){return _c(e,t)}static getComponentsInChildren(e,t,i=null){return za(e,t,i??void 0)}static getComponentInParent(e,t){return vc(e,t)}static getComponentsInParent(e,t,i=null){return tu(e,t,i)}static getAllComponents(e){const t=e.userData?.components;return t?[...t]:[]}static*iterateComponents(e){const t=e?.userData?.components;if(t&&Array.isArray(t))for(let i=0;i<t.length;i++)yield t[i]}}class R{get isComponent(){return!0}__context;get context(){return this.__context??N.Current}set context(e){this.__context=e}get scene(){return this.context.scene}get layer(){return this.gameObject?.userData?.layer}get name(){return this.gameObject?.name?this.gameObject.name:this.gameObject?.userData.name}__name;set name(e){this.gameObject?(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.name=e,this.__name=e):this.__name=e}get tag(){return this.gameObject?.userData.tag}set tag(e){this.gameObject&&(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.tag=e)}get static(){return this.gameObject?.userData.static}set static(e){this.gameObject&&(this.gameObject.userData||(this.gameObject.userData={}),this.gameObject.userData.static=e)}get activeAndEnabled(){return!(this.destroyed||this.__isEnabled===!1||!this.__isActiveInHierarchy)}get __isActive(){return this.gameObject.visible}get __isActiveInHierarchy(){if(!this.gameObject)return!1;const e=this.gameObject[So];return e===void 0?!0:e}set __isActiveInHierarchy(e){this.gameObject&&(this.gameObject[So]=e)}gameObject;guid="invalid";sourceId;awake(){}onEnable(){}onDisable(){}onDestroy(){this.__destroyed=!0}startCoroutine(e,t=xe.Update){return this.context.registerCoroutineUpdate(this,e,t)}stopCoroutine(e,t=xe.Update){this.context.unregisterCoroutineUpdate(e,t)}get destroyed(){return this.__destroyed}destroy(){this.__destroyed||this.__internalDestroy()}__didAwake=!1;__didStart=!1;__didEnable=!1;__isEnabled=void 0;__destroyed=!1;get __internalDidAwakeAndStart(){return this.__didAwake&&this.__didStart}constructor(e){this.__didAwake=!1,this.__didStart=!1,this.__didEnable=!1,this.__isEnabled=void 0,this.__destroyed=!1,this._internalInit(e),hf()&&fx(this)}__internalNewInstanceCreated(e){return this.__didAwake=!1,this.__didStart=!1,this.__didEnable=!1,this.__isEnabled=void 0,this.__destroyed=!1,this._internalInit(e),this}_internalInit(e){if(typeof e=="object")for(const t of Object.keys(e)){const i=e[t];typeof i!="function"&&(this[t]=i)}}__internalAwake(){this.__didAwake||(this.__didAwake=!0,this.awake())}__internalStart(){this.__didStart||(this.__didStart=!0,this.start&&this.start())}__internalEnable(e){return this.__destroyed?(A()&&console.warn("[Needle Engine Dev] Trying to enable destroyed component"),!1):this.__didAwake?this.__didEnable?(e!==!0&&(this.__isEnabled=!0),!1):(this.__didEnable=!0,this.__isEnabled=!0,this.onEnable(),!0):!1}__internalDisable(e){if(this.__didAwake){if(!this.__didEnable){e!==!0&&(this.__isEnabled=!1);return}this.__didEnable=!1,this.__isEnabled=!1,this.onDisable()}}__internalDestroy(){this.__destroyed||(this.__destroyed=!0,this.__didAwake&&(this.onDestroy?.call(this),this.dispatchEvent(new CustomEvent("destroyed",{detail:this}))),Mv(this),hf()&&yx(this))}get enabled(){return typeof this.__isEnabled=="boolean"?this.__isEnabled:!0}set enabled(e){if(this.__destroyed){A()&&console.warn(`[Needle Engine Dev] Trying to ${e?"enable":"disable"} destroyed component`);return}if(typeof e=="number"&&(e>=.5?e=!0:e=!1),!this.__didAwake){this.__isEnabled=e;return}e?this.__internalEnable():this.__internalDisable()}get worldPosition(){return K(this.gameObject)}set worldPosition(e){mt(this.gameObject,e)}setWorldPosition(e,t,i){dr(this.gameObject,e,t,i)}get worldQuaternion(){return be(this.gameObject)}set worldQuaternion(e){fn(this.gameObject,e)}setWorldQuaternion(e,t,i,n){qm(this.gameObject,e,t,i,n)}get worldEuler(){return Xm(this.gameObject)}set worldEuler(e){Qm(this.gameObject,e)}get worldRotation(){return this.gameObject.worldRotation}set worldRotation(e){this.setWorldRotation(e.x,e.y,e.z,!0)}setWorldRotation(e,t,i,n=!0){Jl(this.gameObject,e,t,i,n)}static _forward=new b;get forward(){return R._forward.set(0,0,-1).applyQuaternion(this.worldQuaternion)}static _right=new b;get right(){return R._right.set(1,0,0).applyQuaternion(this.worldQuaternion)}static _up=new b;get up(){return R._up.set(0,1,0).applyQuaternion(this.worldQuaternion)}_eventListeners=new Map;addEventListener(e,t){this._eventListeners[e]=this._eventListeners[e]||[],this._eventListeners[e].push(t)}removeEventListener(e,t){if(!this._eventListeners[e])return;const i=this._eventListeners[e].indexOf(t);i>=0&&this._eventListeners[e].splice(i,1)}dispatchEvent(e){if(!e||!this._eventListeners[e.type])return!1;const t=this._eventListeners[e.type];for(let i=0;i<t.length;i++)t[i](e);return!1}}const FM=Object.freeze(Object.defineProperty({__proto__:null,Behaviour:R,Component:R,GameObject:w},Symbol.toStringTag,{value:"Module"}));var zM=Object.defineProperty,_x=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&zM(e,t,n),n};class Mc extends R{from;to;width=0;centered=!0;_centerPos;awake(){this._centerPos=new b}update(){if(!this.from||!this.to)return;const e=K(this.from).clone(),t=K(this.to).clone(),i=e.distanceTo(t);this._centerPos.copy(e),this._centerPos.add(t),this._centerPos.multiplyScalar(.5),mt(this.gameObject,this.centered?this._centerPos:e),this.gameObject.lookAt(K(this.to).clone()),this.gameObject.scale.set(this.width,this.width,i)}}_x([u(w)],Mc.prototype,"from"),_x([u(w)],Mc.prototype,"to");var UM=Object.defineProperty,NM=Object.getOwnPropertyDescriptor,Tr=(o,e,t,i)=>{for(var n=i>1?void 0:i?NM(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&UM(e,t,n),n};const ws=x("debuganimation");let vx=class{x;y};class Lt extends R{get isAnimationComponent(){return!0}addClip(e){this.animations||(this.animations=[]),this.animations.includes(e)||this.animations.push(e)}playAutomatically=!0;randomStartTime=!0;minMaxSpeed;minMaxOffsetNormalized;loop=!0;clampWhenFinished=!1;get time(){if(this.actions){for(const e of this.actions)if(e.isRunning())return e.time}return 0}set time(e){if(this.actions)for(const t of this.actions)t.time=e}get duration(){if(this.actions){for(const 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){ws&&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,ws&&console.log("Animation Awake",this.name,this),this._tempAnimationsArray&&(this.animations=this._tempAnimationsArray,this._tempAnimationsArray=void 0),this._tempAnimationClipBeforeGameObjectExisted&&(this.clip=this._tempAnimationClipBeforeGameObjectExisted,this._tempAnimationClipBeforeGameObjectExisted=null),this.actions=[],this._handles=[]}onEnable(){if(this.playAutomatically&&this.animations?.length>0){const 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.actions.length;e++)if(this.actions[e].isRunning())return!0}return!1}stopAll(e){if(this.actions)for(const t of this.actions)e?.fadeDuration?t.fadeOut(e.fadeDuration):t.stop()}stop(e,t){if(e===void 0){this.stopAll();return}else if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}e=this.animations[e]}else typeof e=="string"&&(e=this.animations.find(n=>n.name===e));if(!e){console.error("Could not find clip",e);return}const i=this.actions.find(n=>n.getClip()===e);if(!i){console.error("Could not find action",e);return}t?.fadeDuration?i.fadeOut(t.fadeDuration):i.stop()}pause(e,t=!1){if(e===void 0){for(const n of this.actions)n.paused=!t;return}else if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}e=this.animations[e]}else typeof e=="string"&&(e=this.animations.find(n=>n.name===e));if(!e){console.error("Could not find clip",e);return}const i=this.actions.find(n=>n.getClip()===e);if(!i){console.error("Could not find action",e);return}i.paused=!t}resume(){for(const e of this.actions)e.paused=!1}play(e=0,t){if(ws&&console.log("PLAY",e),this.ensureMixer(),!this.mixer){ws&&console.warn("Missing mixer",this);return}e===void 0&&(e=0);let i=e;if(typeof e=="number"){if(e>=this.animations.length){ws&&console.log("No animation at index",e);return}i=this.animations[e]}else typeof e=="string"&&(i=this.animations.find(s=>s.name===e));if(!i){console.error("Could not find clip",e);return}t||(t={});for(const s of this.actions)if(s.getClip()===i)return this.internalOnPlay(s,t);if(!i.tracks){console.warn("Clip is no AnimationClip",i);return}const n=this.mixer.clipAction(i);return this.actions.push(n),this.internalOnPlay(n,t)}internalOnPlay(e,t){var i=this.actions.find(s=>s===e);if(i===e&&i.isRunning()&&i.time<i.getClip().duration){const s=this.tryFindHandle(e);if(i.paused&&(i.paused=!1),s)return s.waitForFinish()}if(t.loop===void 0&&(t.loop=this.loop),t.clampWhenFinished===void 0&&(t.clampWhenFinished=this.clampWhenFinished),t.minMaxOffsetNormalized===void 0&&this.randomStartTime&&(t.minMaxOffsetNormalized=this.minMaxOffsetNormalized),t.minMaxSpeed===void 0&&(t.minMaxSpeed=this.minMaxSpeed),t?.exclusive??!0)for(const s of this.actions)s!=i&&(t.fadeDuration?s.fadeOut(t.fadeDuration):s.stop());if(t?.fadeDuration&&e.fadeIn(t.fadeDuration),e.enabled=!0,t?.startTime!=null)e.time=t.startTime;else if(t?.minMaxOffsetNormalized&&t.minMaxOffsetNormalized.x!=0&&t.minMaxOffsetNormalized.y!=0){const s=e.getClip();e.time=j.lerp(t.minMaxOffsetNormalized.x,t.minMaxOffsetNormalized.y,Math.random())*s.duration}else e.time>=e.getClip().duration&&(e.time=0);t?.minMaxSpeed?e.timeScale=j.lerp(t.minMaxSpeed.x,t.minMaxSpeed.y,Math.random()):e.timeScale=t?.speed??1,t?.loop!=null?e.loop=t.loop?MS:pm:e.loop=pm,t?.clampWhenFinished&&(e.clampWhenFinished=!0),e.paused=!1,e.play(),ws&&console.log("PLAY",e.getClip().name,e);const n=new VM(e,this.mixer,t,s=>{this._handles.splice(this._handles.indexOf(n),1)});return this._handles.push(n),n.waitForFinish()}tryFindHandle(e){for(const t of this._handles)if(t.action===e)return t}ensureMixer(){if(!this.mixer){const e="animationMixer";this.gameObject[e]&&(this.mixer=this.gameObject[e]),(!this.mixer||!this.mixer.clipAction)&&(this.mixer=new mm(this.gameObject),this.gameObject[e]=this.mixer)}this.context.animations.registerAnimationMixer(this.mixer)}}Tr([u()],Lt.prototype,"playAutomatically",2),Tr([u()],Lt.prototype,"randomStartTime",2),Tr([u(vx)],Lt.prototype,"minMaxSpeed",2),Tr([u(vx)],Lt.prototype,"minMaxOffsetNormalized",2),Tr([u()],Lt.prototype,"loop",2),Tr([u()],Lt.prototype,"clampWhenFinished",2),Tr([u(Wi)],Lt.prototype,"clips",1);class VM{mixer;action;promise=null;_options;_resolveCallback=null;_resolvedOrRejectedCallback;constructor(e,t,i,n){this.action=e,this.mixer=t,this._resolvedOrRejectedCallback=n,this._options=i}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)}}const _u=Symbol("objectIsAnimatedData");function xx(o,e,t){if(!o)return;if(o[_u]===void 0){if(!t)return;o[_u]=new Set}const i=o[_u];t?i.add(e):i.has(e)&&i.delete(e)}function WM(o){if(!o)return!1;const e=o[_u];return e!==void 0&&e.size>0}class $M{_context;get context(){return this._context??N.Current}get isStateMachineBehaviour(){return!0}}class Rc{name;nameHash;normalizedTime;length;speed;action;hasTransitions;constructor(e,t,i,n){this.name=e.name,this.nameHash=e.hash,this.normalizedTime=t,this.length=i,this.speed=n,this.action=e.motion.action||null,this.hasTransitions=e.transitions?.length>0||!1}}function wx(o,e){return{name:"Empty",isLooping:!1,guid:e?.generateUUID()??yo.generateUUID(),index:-1,clip:new Wi(o,0,[])}}var Ss=(o=>(o[o.If=1]="If",o[o.IfNot=2]="IfNot",o[o.Greater=3]="Greater",o[o.Less=4]="Less",o[o.Equals=6]="Equals",o[o.NotEqual=7]="NotEqual",o))(Ss||{}),df=(o=>(o[o.Float=1]="Float",o[o.Int=3]="Int",o[o.Bool=4]="Bool",o[o.Trigger=9]="Trigger",o))(df||{});const st=x("debuganimatorcontroller"),vu=x("debugrootmotion");class hn{static createFromClips(e,t={looping:!1,autoTransition:!0,transitionDuration:0}){const i=[];for(let s=0;s<e.length;s++){const r=e[s],a=[];if(t.autoTransition!==!1){const c=t.transitionDuration??0,h=c/r.duration;let d=s;(t.autoTransition===void 0||t.autoTransition===!0)&&(d=(s+1)%e.length),a.push({exitTime:1-h,offset:0,duration:c,hasExitTime:!0,destinationState:d,conditions:[]})}const l={name:r.name,hash:s,motion:{name:r.name,clip:r,isLooping:t?.looping??!1},transitions:a,behaviours:[]};i.push(l)}const n={name:"AnimatorController",guid:new At(Date.now()).generateUUID(),parameters:[],layers:[{name:"Base Layer",stateMachine:{defaultState:0,states:i}}]};return new hn(n)}play(e,t=-1,i=Number.NEGATIVE_INFINITY,n=0){if(t<0)t=0;else if(t>=this.model.layers.length){console.warn("invalid layer");return}const s=this.model.layers[t].stateMachine;for(const r of s.states)if(r.name===e||r.hash===e){st&&console.log("transition to ",r),this.transitionTo(r,n,i);return}console.warn("Could not find "+e+" to play")}reset(){this.setStartTransition()}setBool(e,t){const i=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(n=>n[i]===e).forEach(n=>n.value=t)}getBool(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??!1}setFloat(e,t){const i=typeof e=="string"?"name":"hash",n=this.model?.parameters?.filter(s=>s[i]===e);return n.forEach(s=>s.value=t),n?.length>0}getFloat(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??0}setInteger(e,t){const i=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(n=>n[i]===e).forEach(n=>n.value=t)}getInteger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??0}setTrigger(e){st&&console.log("SET TRIGGER",e);const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(i=>i[t]===e).forEach(i=>i.value=!0)}resetTrigger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.filter(i=>i[t]===e).forEach(i=>i.value=!1)}getTrigger(e){const t=typeof e=="string"?"name":"hash";return this.model?.parameters?.find(i=>i[t]===e)?.value??!1}isInTransition(){return this._activeStates.length>1}setSpeed(e){this._speed=e}_speed=1;FindState(e){return this.findState(e)}findState(e){if(!e)return null;if(Array.isArray(this.model.layers)){for(const t of this.model.layers)for(const i of t.stateMachine.states)if(i.name===e||i.hash==e)return i}return null}getCurrentStateInfo(){if(!this._activeState)return null;const e=this._activeState.motion.action;if(!e)return null;const t=this._activeState.motion.clip.duration,i=t<=0?0:Math.abs(e.time/t);return new Rc(this._activeState,i,t,this._speed)}get currentAction(){return this._activeState&&this._activeState.motion.action||null}normalizedStartOffset=0;animator;model;get context(){return this.animator?.context}get mixer(){return this._mixer}dispose(){if(this._mixer.stopAllAction(),this.animator){this._mixer.uncacheRoot(this.animator.gameObject);for(const e of this._activeStates)e.motion.clip&&this.mixer.uncacheAction(e.motion.clip,this.animator.gameObject)}this.context?.animations.unregisterAnimationMixer(this._mixer)}bind(e){e?this.animator!==e&&(this._mixer&&(this._mixer.stopAllAction(),this.context?.animations.unregisterAnimationMixer(this._mixer)),this.animator=e,this._mixer=new mm(this.animator.gameObject),this.context?.animations.registerAnimationMixer(this._mixer),this.createActions(this.animator)):console.error("AnimatorController.bind: animator is null")}clone(){if(typeof this.model=="string")return console.warn("AnimatorController has not been resolved, can not create model from string",this.model),null;st&&console.warn("AnimatorController clone()",this.model);const e=Ql(this.model,(t,i,n)=>n==null?!0:!(n.type==="Object3D"||n.isObject3D===!0||Kb(n)||n.tracks!==void 0||n instanceof hn));return console.assert(e!==this.model),new hn(e)}update(e){if(!this.animator)return;this.evaluateTransitions(),this.updateActiveStates(e);const t=this.animator.context.time.deltaTime;this.animator.applyRootMotion&&this.rootMotionHandler?.onBeforeUpdate(e),this._mixer.update(t),this.animator.applyRootMotion&&this.rootMotionHandler?.onAfterUpdate(e)}_mixer;_activeState;get activeState(){return this._activeState}constructor(e){this.model=e,st&&console.log(this)}_activeStates=[];updateActiveStates(e){for(let t=0;t<this._activeStates.length;t++){const i=this._activeStates[t],n=i.motion;if(!n.action)this._activeStates.splice(t,1),t--;else{const s=n.action;s.weight=e,s.getEffectiveWeight()<=0&&!s.isRunning()&&(st&&console.debug("REMOVE",i.name,s.getEffectiveWeight(),s.isRunning(),s.isScheduled()),this._activeStates.splice(t,1),t--)}}}setStartTransition(){this.model.layers.length>1&&(st||A())&&console.warn("Multiple layers are not supported yet "+this.animator?.name);for(const e of this.model.layers){const t=e.stateMachine;t.defaultState===void 0&&(st&&console.warn("AnimatorController default state is undefined, will assign state 0 as default",e),t.defaultState=0);const i=t.states[t.defaultState];this.transitionTo(i,0,this.normalizedStartOffset);break}}evaluateTransitions(){let e=!1;if(!this._activeState){if(this.setStartTransition(),!this._activeState)return;e=!0}const t=this._activeState,i=t.motion.action;for(const s of t.transitions){if(!s.hasExitTime&&s.conditions.length<=0)continue;let r=!0;for(const a of s.conditions)if(!this.evaluateCondition(a)){r=!1;break}if(r)if(i){const a=t.motion.clip.duration,l=a<=0?1:Math.abs(i.time/a);let c=s.exitTime;i.timeScale<0&&(c=1-c);let h=!1;if(s.hasExitTime?i.timeScale>0?h=l>=s.exitTime:i.timeScale<0&&(h=1-l>=s.exitTime):h=!0,h){for(const d of s.conditions){const p=this.model.parameters.find(m=>m.name===d.parameter);p?.type===df.Trigger&&p.value&&(p.value=!1)}if(i.clampWhenFinished=!0,st){const d=this.getState(s.destinationState,0);console.log(`Transition to ${s.destinationState} / ${d?.name}`,s,`
|
|
880
880
|
Timescale: `+i.timeScale,`
|
|
881
881
|
Normalized time: `+l.toFixed(3),`
|
|
882
882
|
Exit Time: `+c,s.hasExitTime)}this.transitionTo(s.destinationState,s.duration,s.offset);return}}else{this.transitionTo(s.destinationState,s.duration,s.offset);return}}i&&this.setTimescale(i,t);let n=!1;if(t.motion.isLooping&&i&&(i.time>=i.getClip().duration?(n=!0,i.reset(),i.time=0,i.play()):i.time<=0&&i.timeScale<0&&(n=!0,i.reset(),i.time=i.getClip().duration,i.play())),!n&&t&&!e&&i&&this.animator&&t.behaviours){const s=i?.getClip().duration,r=i.time/s,a=new Rc(this._activeState,r,s,this._speed);for(const l of t.behaviours)l.instance&&l.instance.onStateUpdate?.call(l.instance,this.animator,a,0)}}setTimescale(e,t){let i=t.speed??1;t.speedParameter&&(i*=this.getFloat(t.speedParameter)),i!==void 0&&(e.timeScale=i*this._speed)}getState(e,t){return typeof e=="number"&&(e==-1&&(e=this.model.layers[t].stateMachine.defaultState,e===void 0&&(st&&console.warn("AnimatorController default state is undefined: ",this.model,"Layer: "+t),e=0)),e=this.model.layers[t].stateMachine.states[e]),e}_heldActions=[];releaseHeldActions(e){for(const t of this._heldActions)t.fadeOut(e);this._heldActions.length=0}transitionTo(e,t,i){if(!this.animator)return;const n=0;if(e=this.getState(e,n),!e?.motion||!e.motion.clip||!(e.motion.clip instanceof Wi))return;const s=this._activeState===e;if(s){const h=e.motion;if(!h.action_loopback&&h.clip){const d=this.rootMotionHandler?this.animator.gameObject.matrix.clone():null;this._mixer.uncacheAction(h.clip,this.animator.gameObject),d&&d.decompose(this.animator.gameObject.position,this.animator.gameObject.quaternion,this.animator.gameObject.scale),h.action_loopback=this.createAction(h.clip)}}if(this._activeState?.behaviours&&this._activeState.motion.action){const h=this._activeState?.motion.clip.duration,d=this._activeState.motion.action.time/h,p=new Rc(this._activeState,d,h,this._speed);for(const m of this._activeState.behaviours)m.instance?.onStateExit?.call(m.instance,this.animator,p,n)}const r=this._activeState?.motion.action;s&&(e.motion.action=e.motion.action_loopback,e.motion.action_loopback=r);const a=this._activeState;this._activeState=e;const l=e.motion?.action,c=e.motion.clip;if(c?.duration<=0&&c.tracks.length<=0?r&&this._heldActions.push(r):r&&(r.fadeOut(t),this.releaseHeldActions(t)),l){if(i=Math.max(0,Math.min(1,i)),e.cycleOffsetParameter){let d=this.getFloat(e.cycleOffsetParameter);typeof d=="number"?(d<0&&(d+=1),i+=d,i%=1):st&&console.warn("AnimatorController cycle offset parameter is not a number",e.cycleOffsetParameter)}else typeof e.cycleOffset=="number"&&(i+=e.cycleOffset,i%=1);l.isRunning()&&l.stop(),l.reset(),l.enabled=!0,this.setTimescale(l,e);const h=e.motion.clip.duration;if(l.time=s?0:i*h,l.timeScale<0&&(l.time=h-l.time),l.clampWhenFinished=!0,l.setLoop(pm,0),t>0?l.fadeIn(t):l.weight=1,l.play(),this.rootMotionHandler&&this.rootMotionHandler.onStart(l),this._activeStates.includes(e)||this._activeStates.push(e),this._activeState.behaviours){const d=new Rc(e,i,h,this._speed);for(const p of this._activeState.behaviours)p.instance?.onStateEnter?.call(p.instance,this.animator,d,n)}}else st&&(e.__warned_no_motion||(e.__warned_no_motion=!0,console.warn("No action",e.motion,this)));st&&console.log("TRANSITION FROM "+a?.name+" TO "+e.name,t,r,l,l?.getEffectiveTimeScale(),l?.getEffectiveWeight(),l?.isRunning(),l?.isScheduled(),l?.paused)}createAction(e){if(this._mixer.existingAction(e)&&this._mixer.uncacheAction(e,this.animator?.gameObject),this.animator?.applyRootMotion){this.rootMotionHandler||(this.rootMotionHandler=new HM(this));const t=this.animator.gameObject;return this.rootMotionHandler.createClip(this._mixer,t,e)}else return this._mixer.clipAction(e)}evaluateCondition(e){const t=this.model.parameters.find(i=>i.name===e.parameter);if(!t)return!1;switch(e.mode){case Ss.If:return t.value===!0;case Ss.IfNot:return t.value===!1;case Ss.Greater:return t.value>e.threshold;case Ss.Less:return t.value<e.threshold;case Ss.Equals:return t.value===e.threshold;case Ss.NotEqual:return t.value!==e.threshold}return!1}createActions(e){st&&console.log("AnimatorController createActions",this.model);for(const t of this.model.layers){const i=t.stateMachine;for(let n=0;n<i.states.length;n++){const s=i.states[n];s.transitions||(s.transitions=[]);for(const r of s.transitions)r.conditions||(r.conditions=[]);if(s.motion||(st&&console.warn("No motion",s),s.motion=wx(s.name)),this.animator&&s.motion.clips){const r=s.motion.clips?.find(a=>a.node.name===this.animator?.gameObject?.name);r?s.motion.clip=r.clip:(st||A())&&console.warn('Could not find clip for animator "'+this.animator?.gameObject?.name+'"',s.motion.clips.map(a=>a.node.name))}if(!s.motion.clip){st&&console.warn("No clip assigned to state",s);const r=new Wi(void 0,void 0,[]);s.motion.clip=r}if(s.motion?.clip){const r=s.motion.clip;if(r instanceof Wi){const a=this.createAction(r);s.motion.action=a}else(st||A())&&console.warn("No valid animationclip assigned",s)}if(s.behaviours&&Array.isArray(s.behaviours))for(const r of s.behaviours){if(!r?.typeName)continue;const a=C.get(r.typeName);if(a){const l=new a;l.isStateMachineBehaviour&&(l._context=this.context??void 0,Fa(l,r.properties),r.instance=l),st&&console.log("Created animator controller behaviour",s.name,r.typeName,r.properties,l)}else(st||A())&&console.warn("Could not find AnimatorBehaviour type: "+r.typeName)}}}}*enumerateActions(){if(this.model.layers)for(const e of this.model.layers){const t=e.stateMachine;for(let i=0;i<t.states.length;i++){const n=t.states[i];n?.motion&&(n.motion.action&&(yield n.motion.action),n.motion.action_loopback&&(yield n.motion.action_loopback))}}}rootMotionHandler}class Sx{track;createdInterpolant;originalEvaluate;customEvaluate;constructor(e,t){this.track=e;const i=e,n=i.createInterpolant.bind(e);i.createInterpolant=()=>(i.createInterpolant=n,this.createdInterpolant=n(),this.originalEvaluate=this.createdInterpolant.evaluate.bind(this.createdInterpolant),this.customEvaluate=s=>{if(!this.originalEvaluate)return;const r=this.originalEvaluate(s);return t(s,r)},this.createdInterpolant.evaluate=this.customEvaluate,this.createdInterpolant)}dispose(){this.createdInterpolant&&this.originalEvaluate&&(this.createdInterpolant.evaluate=this.originalEvaluate),this.track=void 0,this.createdInterpolant=null,this.originalEvaluate=void 0,this.customEvaluate=void 0}}class dt{static lastObjPosition={};static lastObjRotation={};static firstKeyframeRotation={};static spaceRotation={};static effectiveSpaceRotation={};static clipOffsetRotation={};set action(e){this._action=e}get action(){return this._action}get cacheId(){return this.root.uuid}_action;root;clip;positionWrapper=null;rotationWrapper=null;context;positionChange=new b;rotationChange=new U;constructor(e,t,i,n,s){if(this.context=e,this.root=t,this.clip=i,dt.firstKeyframeRotation[this.cacheId]||(dt.firstKeyframeRotation[this.cacheId]=new U),s){const r=s.values;dt.firstKeyframeRotation[this.cacheId].set(r[0],r[1],r[2],r[3])}dt.spaceRotation[this.cacheId]||(dt.spaceRotation[this.cacheId]=new U),dt.effectiveSpaceRotation[this.cacheId]||(dt.effectiveSpaceRotation[this.cacheId]=new U),dt.clipOffsetRotation[this.cacheId]=new U,s&&dt.clipOffsetRotation[this.cacheId].set(s.values[0],s.values[1],s.values[2],s.values[3]).invert(),this.handlePosition(i,n),this.handleRotation(i,s)}onStart(e){if(e.getClip()!==this.clip)return;dt.lastObjRotation[this.cacheId]||(dt.lastObjRotation[this.cacheId]=this.root.quaternion.clone());const t=dt.lastObjRotation[this.cacheId];if(dt.spaceRotation[this.cacheId].copy(t),vu){const i=new nt().setFromQuaternion(t);console.log("START",this.clip.name,j.toDegrees(i.y),this.root.position.z)}}getClipRotationOffset(){return dt.clipOffsetRotation[this.cacheId]}_prevTime=0;handlePosition(e,t){if(t){const i=this.root;vu&&i.add(new _i),dt.lastObjPosition[this.cacheId]||(dt.lastObjPosition[this.cacheId]=this.root.position.clone());const n=new b,s=new b;this.positionWrapper=new Sx(t,(r,a)=>{const l=this.action.getEffectiveWeight();return vu&&i.position.length()>8&&i.position.set(0,i.position.y,0),r>this._prevTime&&(n.set(a[0],a[1],a[2]),n.sub(s),n.multiplyScalar(l),n.applyQuaternion(this.getClipRotationOffset()),n.applyQuaternion(i.quaternion),this.positionChange.copy(n)),s.fromArray(a),this._prevTime=r,a[0]=0,a[1]=0,a[2]=0,a})}}static identityQuaternion=new U;handleRotation(e,t){if(t){if(vu){const r=t.values,a=new nt().setFromQuaternion(new U(r[0],r[1],r[2],r[3]));console.log(e.name,t.name,"FIRST ROTATION IN TRACK",j.toDegrees(a.y));const l=t.values.length-4,c=new U().set(r[l],r[l+1],r[l+2],r[l+3]),h=new nt().setFromQuaternion(c);console.log(e.name,t.name,"LAST ROTATION IN TRACK",j.toDegrees(h.y))}let i=0;const n=new U,s=new U;this.rotationWrapper=new Sx(t,(r,a)=>(r>i&&(s.set(a[0],a[1],a[2],a[3]),n.invert(),s.multiply(n),this.rotationChange.copy(s)),n.fromArray(a),i=r,a[0]=0,a[1]=0,a[2]=0,a[3]=1,a))}}onBeforeUpdate(e){this.positionChange.set(0,0,0),this.rotationChange.set(0,0,0,1)}onAfterUpdate(e){return!this.action||(e*=this.action.getEffectiveWeight(),e<=0)?!1:(this.positionChange.multiplyScalar(e),this.rotationChange.slerp(dt.identityQuaternion,1-e),!0)}}class HM{controller;handler=[];root;basePosition=new b;baseQuaternion=new U;baseRotation=new nt;constructor(e){this.controller=e}createClip(e,t,i){this.root=t,t&&"name"in t&&t.name;const n=this.findRootTrack(i,".position"),s=this.findRootTrack(i,".quaternion"),r=new dt(this.controller.context,t,i,n,s);this.handler.push(r);const a=e.clipAction(i);return r.action=a,a}onStart(e){for(const t of this.handler)t.onStart(e)}onBeforeUpdate(e){this.basePosition.copy(this.root.position),this.baseQuaternion.copy(this.root.quaternion);for(const t of this.handler)t.onBeforeUpdate(e)}summedPosition=new b;summedRotation=new U;onAfterUpdate(e){if(!(e<=0)){this.root.position.copy(this.basePosition),this.root.quaternion.copy(this.baseQuaternion),this.summedPosition.set(0,0,0),this.summedRotation.set(0,0,0,1);for(const t of this.handler)t.onAfterUpdate(e)&&(this.summedPosition.add(t.positionChange),this.summedRotation.multiply(t.rotationChange));this.root.position.add(this.summedPosition),this.root.quaternion.multiply(this.summedRotation)}}findRootTrack(e,t){const i=e.tracks;if(!i)return null;for(const n of i)if(n.name.endsWith(t))return n;return null}}class GM extends Yi{onSerialize(e,t){}onDeserialize(e,t){if(t.type===hn&&e?.__type==="AnimatorController")return new hn(e)}}new GM(hn);var qM=Object.defineProperty,XM=Object.getOwnPropertyDescriptor,xu=(o,e,t,i)=>{for(var n=i>1?void 0:i?XM(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&qM(e,t,n),n};const Zi=x("debuganimator");class ft extends R{get isAnimationComponent(){return!0}applyRootMotion=!1;hasRootMotion=!1;keepAnimatorControllerStateOnDisable=!1;set runtimeAnimatorController(e){this._animatorController&&this._animatorController.model===e||(e?e instanceof hn?(e.animator&&e.animator!==this&&(console.warn("AnimatorController can not be bound to multiple animators",e.model?.name),e.model||console.error("AnimatorController has no model"),e=new hn(e.model)),this._animatorController=e,this._animatorController.bind(this)):(Zi&&console.log("Assign animator controller",e,this),this._animatorController=new hn(e),this.__didAwake&&this._animatorController.bind(this)):this._animatorController=null)}get runtimeAnimatorController(){return this._animatorController}getCurrentStateInfo(){return this.runtimeAnimatorController?.getCurrentStateInfo()}get currentAction(){return this.runtimeAnimatorController?.currentAction||null}get parametersAreDirty(){return this._parametersAreDirty}_parametersAreDirty=!1;get isDirty(){return this._isDirty}_isDirty=!1;Play(e,t=-1,i=Number.NEGATIVE_INFINITY,n=0){this.play(e,t,i,n)}play(e,t=-1,i=Number.NEGATIVE_INFINITY,n=0){this.runtimeAnimatorController?.play(e,t,i,n),this._isDirty=!0}Reset(){this.reset()}reset(){this._animatorController?.reset(),this._isDirty=!0}SetBool(e,t){this.setBool(e,t)}setBool(e,t){Zi&&console.log("setBool",e,t),this.runtimeAnimatorController?.getBool(e)!==t&&(this._parametersAreDirty=!0),this.runtimeAnimatorController?.setBool(e,t)}GetBool(e){return this.getBool(e)}getBool(e){const t=this.runtimeAnimatorController?.getBool(e)??!1;return Zi&&console.log("getBool",e,t),t}toggleBool(e){this.setBool(e,!this.getBool(e))}SetFloat(e,t){this.setFloat(e,t)}setFloat(e,t){this.runtimeAnimatorController?.getFloat(e)!==t&&(this._parametersAreDirty=!0),Zi&&console.log("setFloat",e,t),this.runtimeAnimatorController?.setFloat(e,t)}GetFloat(e){return this.getFloat(e)}getFloat(e){const t=this.runtimeAnimatorController?.getFloat(e)??-1;return Zi&&console.log("getFloat",e,t),t}SetInteger(e,t){this.setInteger(e,t)}setInteger(e,t){this.runtimeAnimatorController?.getInteger(e)!==t&&(this._parametersAreDirty=!0),Zi&&console.log("setInteger",e,t),this.runtimeAnimatorController?.setInteger(e,t)}GetInteger(e){return this.getInteger(e)}getInteger(e){const t=this.runtimeAnimatorController?.getInteger(e)??-1;return Zi&&console.log("getInteger",e,t),t}SetTrigger(e){this.setTrigger(e)}setTrigger(e){this._parametersAreDirty=!0,Zi&&console.log("setTrigger",e),this.runtimeAnimatorController?.setTrigger(e)}ResetTrigger(e){this.resetTrigger(e)}resetTrigger(e){this._parametersAreDirty=!0,Zi&&console.log("resetTrigger",e),this.runtimeAnimatorController?.resetTrigger(e)}GetTrigger(e){this.getTrigger(e)}getTrigger(e){const t=this.runtimeAnimatorController?.getTrigger(e);return Zi&&console.log("getTrigger",e,t),t}IsInTransition(){return this.isInTransition()}isInTransition(){return this.runtimeAnimatorController?.isInTransition()??!1}SetSpeed(e){return this.setSpeed(e)}setSpeed(e){e!==this._speed&&(Zi&&console.log("setSpeed",e),this._speed=e,this._animatorController?.animator==this&&this._animatorController.setSpeed(e))}set minMaxSpeed(e){this._speed=j.lerp(e.x,e.y,Math.random()),this._animatorController?.animator==this&&this._animatorController.setSpeed(this._speed)}set minMaxOffsetNormalized(e){this._normalizedStartOffset=j.lerp(e.x,e.y,Math.random()),this.runtimeAnimatorController?.animator==this&&(this.runtimeAnimatorController.normalizedStartOffset=this._normalizedStartOffset)}_speed=1;_normalizedStartOffset=0;_animatorController=null;awake(){Zi&&console.log("ANIMATOR",this.name,this),this.gameObject&&this.initializeRuntimeAnimatorController()}_initializeWithRuntimeAnimatorController;initializeRuntimeAnimatorController(e=!1){const t=e||this.runtimeAnimatorController!==this._initializeWithRuntimeAnimatorController;if(this.runtimeAnimatorController&&t){const i=this.runtimeAnimatorController.clone();this._initializeWithRuntimeAnimatorController=i,i?(console.assert(this.runtimeAnimatorController!==i),this.runtimeAnimatorController=i,console.assert(this.runtimeAnimatorController===i),this.runtimeAnimatorController.bind(this),this.runtimeAnimatorController.setSpeed(this._speed),this.runtimeAnimatorController.normalizedStartOffset=this._normalizedStartOffset):console.warn("Could not clone animator controller",this.runtimeAnimatorController)}}onDisable(){this.keepAnimatorControllerStateOnDisable||this._animatorController?.reset()}onBeforeRender(){this._isDirty=!1,this._parametersAreDirty=!1,!WM(this.gameObject)&&this._animatorController&&this._animatorController.update(1)}}xu([u()],ft.prototype,"applyRootMotion",2),xu([u()],ft.prototype,"hasRootMotion",2),xu([u()],ft.prototype,"keepAnimatorControllerStateOnDisable",2),xu([u()],ft.prototype,"runtimeAnimatorController",1);const Cx=Symbol("previous-visibility");class fo extends zn{render(e,t,i){if("addPass"in i)this._unsupported_effectcomposer_warning||(console.warn("RenderTexture.render() does not yet support EffectComposer"),this._unsupported_effectcomposer_warning=!0);else if(i instanceof rr){this.onBeforeRender();const n=i.getRenderTarget(),s=i.xr.enabled;i.xr.enabled=!1,i.setRenderTarget(this),i.clear(!0,!0,!0),i.render(e,t),i.setRenderTarget(n),i.xr.enabled=s,this.onAfterRender()}}static _userSet=new Set;onBeforeRender(){fo._userSet.clear();const e=Sg(this.texture,!0,null,fo._userSet);for(const t of e)t instanceof H&&(t[Cx]=t.visible,t.visible=!1)}onAfterRender(){for(const e of fo._userSet)e instanceof H&&(e.visible=e[Cx]);fo._userSet.clear()}}var QM=Object.defineProperty,YM=Object.getOwnPropertyDescriptor,Tc=(o,e,t,i)=>{for(var n=i>1?void 0:i?YM(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&QM(e,t,n),n};const wu=x("debuggroundprojection");class qn extends R{applyOnAwake=!1;autoFit=!0;set radius(e){this._radius=e,this._projection&&this.updateProjection()}get radius(){return this._radius}_radius=50;set height(e){this._height=e,this._projection&&this.updateProjection()}get height(){return this._height}_height=3;set arBlending(e){this._arblending=e,this._needsTextureUpdate=!0}get arBlending(){return this._arblending}_arblending=0;_lastBackground;_lastRadius;_lastHeight;_projection;_watcher;awake(){this.applyOnAwake&&this.updateAndCreate()}onEnable(){this.context.time.frameCount>0&&this.applyOnAwake&&this.updateAndCreate(),this._watcher||(this._watcher=new is(this.context.scene,"background"),this._watcher.subscribeWrite(e=>{wu&&console.log("Background changed",this.context.scene.background),this._needsTextureUpdate=!0}))}onDisable(){this._watcher?.revoke(),this._projection?.removeFromParent()}onEnterXR(){this.activeAndEnabled&&(this._needsTextureUpdate=!0,this.updateProjection())}async onLeaveXR(){this.activeAndEnabled&&(await Yl(1),this.updateProjection())}onBeforeRender(){this._projection&&this.scene.backgroundRotation&&this._projection.rotation.copy(this.scene.backgroundRotation),this.context.scene.backgroundBlurriness!==void 0&&this._lastBlurriness!=this.context.scene.backgroundBlurriness&&this.context.scene.backgroundBlurriness>.001?this.updateProjection():this._needsTextureUpdate&&this.context.scene.background instanceof Re&&this.updateBlurriness(this.context.scene.background,this.context.scene.backgroundBlurriness)}updateAndCreate(){this.updateProjection(),this._watcher?.apply()}_needsTextureUpdate=!1;updateProjection(){if(!this.context.scene.background){this._projection?.removeFromParent();return}const e=this.context.scene.background;if(!(e instanceof Re)){this._projection?.removeFromParent();return}if((this.context.xr?.isPassThrough||this.context.xr?.isAR)&&this.arBlending===0){this._projection?.removeFromParent();return}if(!this.gameObject||this.destroyed)return;let t=!0;const i=0,n=e!==this._lastBackground||this._height!==this._lastHeight||this._radius!==this._lastRadius;if(!this._projection||n){wu&&console.log("Create/Update Ground Projection",e.name),this._projection?.removeFromParent();try{this._projection=new Ca(e,this._height,this._radius,64)}catch(s){console.error("Error creating three GroundProjection",s);return}this._projection.position.y=this._height-i,this._projection.name="GroundProjection",Ym(this._projection,!1)}else t=!1;if(this._projection.parent||this.gameObject.add(this._projection),this.autoFit&&t){this._projection.updateWorldMatrix(!0,!0);const s=$t(this.context.scene.children,[this._projection]),r=s.min.y;if(r<1/0){const a=z();a.x=s.min.x+(s.max.x-s.min.x)*.5;const l=He(this.gameObject).x;a.y=r+this._height*l-i,a.z=s.min.z+(s.max.z-s.min.z)*.5,mt(this._projection,a)}wu&&F.DrawWireBox3(s,65280,5)}this.context.scene.backgroundBlurriness>.001&&this._needsTextureUpdate&&this.updateBlurriness(e,this.context.scene.backgroundBlurriness),this._lastBackground=e,this._lastHeight=this._height,this._lastRadius=this._radius,this._needsTextureUpdate=!1}_blurrynessShader=null;_lastBlurriness=-1;updateBlurriness(e,t){if(this._projection){if(!e)return}else return;this._needsTextureUpdate=!1,wu&&console.log("Update Blurriness",t),this._blurrynessShader??=new Fn({name:"GroundProjectionBlurriness",uniforms:{map:{value:e},blurriness:{value:t},blending:{value:0},alphaFactor:{value:1}},vertexShader:ZM,fragmentShader:KM}),this._blurrynessShader.depthWrite=!1,this._blurrynessShader.uniforms.map.value=e,this._blurrynessShader.uniforms.blurriness.value=t,this._lastBlurriness=t,e.needsUpdate=!0;const i=this._projection.material.transparent;this._projection.material.transparent=(this.context.xr?.isAR===!0&&this.arBlending>1e-6)??!1,this._projection.material.transparent?this._blurrynessShader.uniforms.blending.value=this.arBlending:this._blurrynessShader.uniforms.blending.value=0,this.context.isInPassThrough?this._blurrynessShader.uniforms.alphaFactor.value=.95:this._blurrynessShader.uniforms.alphaFactor.value=1,i!==this._projection.material.transparent&&(this._projection.material.needsUpdate=!0),this._projection.material.map=ir.copyTexture(e,this._blurrynessShader),this._projection.material.depthTest=!0,this._projection.material.depthWrite=!1}}Tc([u()],qn.prototype,"applyOnAwake",2),Tc([u()],qn.prototype,"autoFit",2),Tc([u()],qn.prototype,"radius",1),Tc([u()],qn.prototype,"height",1),Tc([u()],qn.prototype,"arBlending",1);const ZM=`
|
|
@@ -1414,7 +1414,7 @@ To allow joining a room without a query parameter you can set "requireRoomParame
|
|
|
1414
1414
|
Please choose one of the following options to fix this:
|
|
1415
1415
|
A) Set a room name in the SyncedRoom component
|
|
1416
1416
|
B) Set a room name in the URL parameter "?`+this.urlParameterName+`=my_room"
|
|
1417
|
-
C) Set "joinRandomRoom" to true`),!1):(g0&&console.log("Join "+this.roomName),this._userWantsToBeInARoom=!0,this.context.connection.joinRoom(this.roomName),!0))}_lastPingTime=0;_lastRoomTime=-1;_userWantsToBeInARoom=!1;update(){this.context.connection.isConnected&&(this.context.time.time-this._lastPingTime>3&&(this._lastPingTime=this.context.time.time,this.context.connection.sendPing()),this.context.connection.isInRoom&&(this._lastRoomTime=this.context.time.time)),this._lastRoomTime>0&&this.context.time.time-this._lastRoomTime>.3&&(this._lastRoomTime=-1,this.autoRejoin?this._userWantsToBeInARoom&&(console.log("Disconnected from networking backend - attempt reconnecting now"),this.tryJoinRoom()):A()&&console.warn("You are not connected to a room anymore (possibly because the tab was inactive for too long and the server kicked you?)"))}getViewOnlyUrl(){if(this.context.connection.isConnected&&this.context.connection.currentRoomViewId){const e=window.location.search,t=new URLSearchParams(e);return t.has(this.urlParameterName)&&t.delete(this.urlParameterName),t.set(m0,this.context.connection.currentRoomViewId),window.location.origin+window.location.pathname+"?"+t.toString()}return null}setRandomRoomUrlParameter(){const e=ql(),t=this.generateRoomName();x(this.urlParameterName)?e.set(this.urlParameterName,t):e.append(this.urlParameterName,t),Em(t,e)}generateRoomName(){let e="";for(let t=0;t<6;t++)e+=Math.floor(Math.random()*10).toFixed(0);return e}_roomButton;_roomButtonIconJoin;_roomButtonIconLeave;createRoomButton(){if(this._roomButton)return this._roomButton;const e=document.createElement("button");return this._roomButton=e,e.classList.add("create-room-button"),e.setAttribute("priority","90"),e.onclick=()=>{if(this.context.connection.isInRoom)this.urlParameterName&&Xl(this.urlParameterName,null),this.context.connection.leaveRoom(),this._userWantsToBeInARoom=!1;else{if(this.urlParameterName){const t=x(this.urlParameterName);(!t||t===!0)&&(this._lastJoinedRoom?Xl(this.urlParameterName,this._lastJoinedRoom):this.setRandomRoomUrlParameter())}this.tryJoinRoom()}},this._roomButtonIconJoin=Ct("group"),this._roomButtonIconLeave=Ct("group_off"),this.updateRoomButtonState(),this.context.connection.beginListen(te.JoinedRoom,this.updateRoomButtonState),this.context.connection.beginListen(te.LeftRoom,this.updateRoomButtonState),e}updateRoomButtonState=()=>{this._roomButton&&(this.context.connection.isInRoom?(this._roomButton.title="Leave the networked room",this._roomButton.textContent="Leave Room",this._roomButtonIconJoin?.remove(),this._roomButton.prepend(this._roomButtonIconLeave)):(this._roomButton.title="Create or join a networked room",this._roomButton.textContent="Join Room",this._roomButtonIconLeave?.remove(),this._roomButton.prepend(this._roomButtonIconJoin)))};destroyRoomButton(){this.context.connection.stopListen(te.JoinedRoom,this.updateRoomButtonState),this.context.connection.stopListen(te.LeftRoom,this.updateRoomButtonState)}_viewOnlyButton;onEnableViewOnlyButton(){this.context.connection.isConnected?this.onCreateViewOnlyButton():(this.context.connection.stopListen(te.JoinedRoom,this.onCreateViewOnlyButton),this.context.connection.beginListen(te.JoinedRoom,this.onCreateViewOnlyButton))}onDisableViewOnlyButton(){this.context.connection.stopListen(te.JoinedRoom,this.onCreateViewOnlyButton),this._viewOnlyButton?.remove()}onCreateViewOnlyButton=()=>{if(!this._viewOnlyButton){const e=document.createElement("button");this._viewOnlyButton=e,e.classList.add("view-only-button"),e.setAttribute("priority","90"),e.onclick=()=>{const t=this.getViewOnlyUrl();t?.length?navigator.canShare({url:t})?navigator.share({url:t})?.catch(i=>{console.warn(i)}):(navigator.clipboard.writeText(t),Te("View only URL copied to clipboard")):ge("Could not create view only URL")},e.title="Copy the view only URL: A page accessed by the view only URL can not be modified by visiting users.",e.textContent="Share View URL",e.prepend(Ct("visibility"))}this.context.menu.appendChild(this._viewOnlyButton)}}Qs([u()],In.prototype,"roomName",2),Qs([u()],In.prototype,"urlParameterName",2),Qs([u()],In.prototype,"joinRandomRoom",2),Qs([u()],In.prototype,"requireRoomParameter",2),Qs([u()],In.prototype,"autoRejoin",2),Qs([u()],In.prototype,"createJoinButton",2),Qs([u()],In.prototype,"createViewOnlyButton",2),Qs([u()],In.prototype,"roomPrefix",1);function B2(){const o=x("testwindowcount")||0;o&&o>0&&F2(o)}function F2(o){if(x("testwindow"))return null;const e=new URL(window.location.href);Tm(e.searchParams,LR,1),Tm(e.searchParams,"testwindow",1);const t=e.toString(),i=[];window.onbeforeunload=()=>{for(const l of i)l.close()};const n=.05,s=128;let r=0,a=0;for(let l=0;l<o;l++){r*s+s*.01>=window.innerWidth&&(a+=1,r=0);const c=r*(s*(1+n))+window.screenLeft,h=a*(s*(1+n))+window.screenTop+90+60*a;r+=1;const d=window.open(t,"test window "+l,`popup=yes width=${s} height=${s} top=${h} left=${c}`);if(!d){console.warn("Failed to open window");continue}i.push(d),d.onload=()=>{d.onbeforeunload=()=>{for(let p=0;p<i.length;p++){const m=i[p];m!==d&&m.close()}i.length=0}}}return i}class f0 extends R{awake(){B2()}}class y0 extends R{transformsPerFrame=10;interval=0;useFlatbuffers=!0;awake(){if(this.useFlatbuffers)this.context.connection.beginListenBinary(Ec,e=>{});else{this.models=[];for(let e=0;e<this.transformsPerFrame;e++)this.models.push(new z2(this.context.connection.connectionId+"_simulatedTransform_"+e,this))}}builder=null;models=null;update(){if(this.context.connection.isConnected){if(this.useFlatbuffers){if(!this.context.connection.connectionId||this.context.time.frameCount%this.interval!==0)return;this.builder===null&&(this.builder=new Cm(1024));const e=this.builder;for(let t=0;t<this.transformsPerFrame;t++){e.clear();const i=kx(this.context.connection.connectionId,this);this.context.connection.sendBinary(i)}}else if(this.models)for(let e=0;e<this.models.length;e++){const t=this.models[e];t.dontSave=!0,t.update(this,null),this.context.connection.send("TestSimulateUserData-"+e,t)}}}}class z2{guid;fast=!1;position;rotation;velocity=void 0;dontSave;isValid(){return this.fast!==void 0||this.position!==void 0||this.rotation!==void 0||this.velocity!==void 0}constructor(e,t){this.guid=e,this.position={x:0,y:0,z:0},this.rotation={x:0,y:0,z:0,w:0},this.update(t,null)}static temp=new b;update(e,t){const i=e.worldPosition;this.position.x=i.x,this.position.y=i.y,this.position.z=i.z;const n=e.worldQuaternion;if(this.rotation.x=n.x,this.rotation.y=n.y,this.rotation.z=n.z,this.rotation.w=n.w,this.fast=!1,t){const s=t.getVelocity();this.velocity===void 0&&(this.velocity={x:0,y:0,z:0}),this.velocity.x=s.x,this.velocity.y=s.y,this.velocity.z=s.z}}}var U2=Object.defineProperty,Bp=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&U2(e,t,n),n};const N2=x("debugsignals");class Fp{guid}Bp([u()],Fp.prototype,"guid");class Th{signal;reaction}Bp([u(Fp)],Th.prototype,"signal"),Bp([u(he)],Th.prototype,"reaction");const S1=class ts extends R{static receivers={};static invoke(e){if(ts.receivers[e]){const t=ts.receivers[e];if(!t)return;for(const i of t)i.invoke(e)}}events;awake(){N2&&console.log("SignalReceiver awake",this)}onEnable(){if(this.events)for(const e of this.events)ts.receivers[e.signal.guid]||(ts.receivers[e.signal.guid]=[]),ts.receivers[e.signal.guid].push(this)}onDisable(){if(this.events){for(const e of this.events)if(ts.receivers[e.signal.guid]){const t=ts.receivers[e.signal.guid].indexOf(this);t>=0&&ts.receivers[e.signal.guid].splice(t,1)}}}invoke(e){if(!this.events||!Array.isArray(this.events))return;const t=typeof e=="object"?e.guid:e;for(const i of this.events)if(i.signal.guid===t)try{if(i.reaction){if(!i.reaction.invoke){console.warn("Missing invoke - possibly a serialization error",i,this);continue}}else{console.warn("Missing reaction for signal",i,this);continue}i.reaction.invoke()}catch(n){console.error(n)}}};Bp([u(Th)],S1.prototype,"events");let Eh=S1;var Bi=(o=>(o.Activation="ActivationTrack",o.Animation="AnimationTrack",o.Audio="AudioTrack",o.Control="ControlTrack",o.Marker="MarkerTrack",o.Signal="SignalTrack",o))(Bi||{}),co=(o=>(o[o.None=0]="None",o[o.Hold=1]="Hold",o[o.Loop=2]="Loop",o[o.PingPong=3]="PingPong",o[o.Continue=4]="Continue",o))(co||{}),b0=(o=>(o.Signal="SignalEmitter",o))(b0||{});const ho=x("debugtimeline");class kl{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 t=this.track.clips.length-1;t>=0;t--)yield this.track.clips[t];else for(const t of this.track.clips)yield t}getClipTime(e,t){return t.clipIn+(e-t.start)*t.timeScale}getClipTimeNormalized(e,t){return(e-t.start)/t.duration}evaluateWeight(e,t,i,n=!0){if(t<0||t>=i.length)return 0;const s=i[t];if(n||e>=s.start&&e<=s.end){let r=1;if(s.easeInDuration>0){const a=Math.min((e-s.start)/s.easeInDuration,1);r*=a}if(s.easeOutDuration>0){const a=Math.min((s.end-e)/s.easeOutDuration,1);r*=a}return r}return 0}}class V2{clip;rootPositionOffset;rootQuaternionOffset;get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}rootStartPosition;rootEndPosition;rootStartQuaternion;rootEndQuaternion;constructor(e){const t=e.getClip();this.clip=t;const i=e.getRoot(),n=i.name+".position",s=i.name+".quaternion";ho&&console.log(t.name,t.tracks,n);for(const r of t.tracks)if(!(r.times.length<=0)){if(r.name.endsWith(n))this.rootStartPosition=new b().fromArray(r.values,0),this.rootEndPosition=new b().fromArray(r.values,r.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),ho&&console.log(this.rootPositionOffset);else if(r.name.endsWith(s)&&(this.rootStartQuaternion=new U().fromArray(r.values,0),this.rootEndQuaternion=new U().fromArray(r.values,r.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),ho)){const a=new nt().setFromQuaternion(this.rootQuaternionOffset);console.log("ROT",a)}}}}class Ah extends kl{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&&xx(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 i=!1,n=!1;const s=t.tracks.find(r=>r.name.includes(".position")||r.name.includes(".quaternion"))?.name.split(".");if(s){const r=s[s.length-2],a=r+".position",l=r+".quaternion";for(const c of t.tracks)!i&&c.name.endsWith(a)?(i=!0,this.createPositionInterpolant(t,e,c)):!n&&c.name.endsWith(l)&&(n=!0,this.createRotationInterpolant(t,e,c))}if(!i||!n){const r=this.mixer?.getRoot(),a=t.tracks[0],l=a.name.lastIndexOf("."),c=a.name.substring(0,l),h=c.substring(c.lastIndexOf(".")+1),d=r.getObjectByName(h);if(d)if(i){if(!n){const p=t.tracks[0].name.substring(0,l)+".quaternion";ho&&console.warn("Create quaternion track",h,d);const m=d.quaternion,f=new SC(p,[0,t.duration],[m.x,m.y,m.z,m.w,m.x,m.y,m.z,m.w]);t.tracks.push(f),this.createRotationInterpolant(t,e,f)}}else{const p=c+".position";ho&&console.warn("Create position track",h,d);const m=d.position,f=new wC(p,[0,t.duration],[m.x,m.y,m.z,m.x,m.y,m.z]);t.tracks.push(f),this.createPositionInterpolant(t,e,f)}}}bind(){if(!this._didBind){this._didBind=!0,ho&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn("No mixer was assigned to animation track");for(const e of this.actions){const t=new V2(e);this._actionOffsets.push(t)}this.target&&(this._animator=w.getComponent(this.target,ft)??null,this._animator&&xx(this._animator.gameObject,this,!0));for(const e of this.models){const t=e.asset,i=t.position,n=t.rotation;i&&i.x!==void 0&&(i.isVector3||(t.position=new b(i.x,i.y,i.z)),n.isQuaternion||(t.rotation=new U(n.x,n.y,n.z,n.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){const e=this.trackOffset.position;e&&(e.isVector3||(this.trackOffset.position=new b(e.x,e.y,e.z)));const t=this.trackOffset.rotation;t&&(t.isQuaternion||(this.trackOffset.rotation=new U(t.x,t.y,t.z,t.w)))}}_useclipOffsets=!0;_totalOffsetPosition=new b;_totalOffsetRotation=new U;_totalOffsetPosition2=new b;_totalOffsetRotation2=new U;_summedPos=new b;_tempPos=new b;_summedRot=new U;_tempRot=new U;_clipRotQuat=new U;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,i=0,n=!1,s=!1,r=0;for(let a=0;a<this.clips.length;a++){const l=this.models[a],c=this.actions[a],h=l.asset;c.weight=0;const d=e>=l.start&&e<=l.end,p=l.preExtrapolationMode,m=l.postExtrapolationMode,f=a<this.clips.length-1?this.models[a+1]:null;let g=d,y=!1;if(!g&&!n&&l.end<e&&m!==co.None?(!f||f.start>e)&&(g=!0,n=!0):a==0&&!g&&!s&&l.start>e&&p!==co.None&&(!f||f.start<e)&&(g=!0,y=!0,s=!0),g){let _=this.weight;_*=this.evaluateWeight(e,a,this.models,g),_*=this.director.weight;let v=d;if(y)switch(p){case co.Hold:break;case co.Loop:e+=l.start,v=!0;break;default:e+=l.start,v=!0;break}let P=this.getClipTime(e,l),M=0;const O=h.duration;if(y&&p===co.Hold&&(P=0),v){if(h.loop)for(M+=Math.floor(P/(O+1e-6));P>O;)P-=O}else if(!d&&n)switch(m){case co.Hold:P=this.getClipTime(l.end,l);break;case co.Loop:P%=O;break;case co.PingPong:const L=Math.floor(P/O)%2!==0;P%=O,L&&(P=O-P);break}l.reversed===!0?c.time=c.getClip().duration-P:c.time=P,c.timeScale=0;const E=Math.max(0,_);if(c.weight=E,r+=E,c.clampWhenFinished=!1,c.isRunning()||c.play(),this._useclipOffsets){const L=t==0?this._totalOffsetPosition:this._totalOffsetPosition2,$=t==0?this._totalOffsetRotation:this._totalOffsetRotation2;t<1&&(i=1-_),t+=1;const D=this._summedPos.set(0,0,0),q=this._tempPos.set(0,0,0),Z=this._summedRot.identity(),I=this._tempRot.identity(),W=h.rotation;W&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(W,_));const V=this._actionOffsets[a];if(V.hasOffsets)for(let se=0;se<M;se++)V.rootPositionOffset?q.copy(V.rootPositionOffset):q.set(0,0,0),q.applyQuaternion(Z),this._clipRotQuat&&q.applyQuaternion(this._clipRotQuat),V.rootQuaternionOffset&&(I.copy(V.rootQuaternionOffset),Z.multiply(I)),D.add(q);this._clipRotQuat&&$.multiply(this._clipRotQuat),$.multiply(Z),h.position&&D.add(h.position),L.add(D)}}}if(this._useclipOffsets&&(this._totalOffsetPosition.lerp(this._totalOffsetPosition2,i),this._totalOffsetRotation.slerp(this._totalOffsetRotation2,i)),this.__mixerError===void 0&&(ho||A())&&this._animator?.runtimeAnimatorController?.mixer&&this.mixer!==this._animator?.runtimeAnimatorController?.mixer&&(this.__mixerError=!0,console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!",this)),this._animator?.runtimeAnimatorController){const a=Math.max(0,1-r);this._animator?.runtimeAnimatorController?.update(a)}else this.mixer.update(e)}createRotationInterpolant(e,t,i){const n=i.createInterpolant.bind(i),s=new U;this.ensureTrackOffsets();const r=this.trackOffset?.rotation;i.createInterpolant=()=>{const a=n(),l=a.evaluate.bind(a);return a.evaluate=c=>{const h=l(c);if(s.set(h[0],h[1],h[2],h[3]),s.premultiply(this._totalOffsetRotation),r&&s.premultiply(r),this.director.animationCallbackReceivers)for(const d of this.director.animationCallbackReceivers)d?.onTimelineRotation?.call(d,this.director,this.target,c,s);return h[0]=s.x,h[1]=s.y,h[2]=s.z,h[3]=s.w,h},a}}createPositionInterpolant(e,t,i){const n=i.createInterpolant.bind(i),s=new b;this.ensureTrackOffsets();const r=this.trackOffset?.rotation,a=this.trackOffset?.position;let l;i.createInterpolant=()=>{const c=n(),h=c.evaluate.bind(c);return c.evaluate=d=>{const p=h(d);if(s.set(p[0],p[1],p[2]),t.removeStartOffset&&(l===void 0?(l=null,l=this._actionOffsets.find(m=>m.clip===e)?.rootStartPosition?.clone()):l?.isVector3&&s.sub(l)),s.applyQuaternion(this._totalOffsetRotation),s.add(this._totalOffsetPosition),r&&s.applyQuaternion(r),a&&(s.x-=a.x,s.y+=a.y,s.z+=a.z),this.director.animationCallbackReceivers)for(const m of this.director.animationCallbackReceivers)m?.onTimelinePosition?.call(m,this.director,this.target,d,s);return p[0]=s.x,p[1]=s.y,p[2]=s.z,p},c}}}const W2=x("mutetimeline");class ss extends kl{models=[];listener;audio=[];audioContextTimeOffset=[];lastTime=0;audioSource;_audioLoader=null;getAudioFilePath(e){const t=this.director.sourceId;return us(t,e)}onAllowAudioChanged(e){for(let t=0;t<this.models.length;t++){const i=this.models[t];this.audio[t].setVolume(e?i.asset.volume:0)}}addModel(e){const t=new CC(this.listener);this.audio.push(t);const i=e;i._didTriggerPlay=!1,this.models.push(i)}onDisable(){for(const e of this.audio)e.isPlaying&&e.stop();for(const e of this.models)e._didTriggerPlay=!1}onDestroy(){for(const e of this.audio)e.source&&e?.disconnect();this.audio.length=0}onMuteChanged(){if(this.muted)for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}}stop(){for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}for(const e of this.models)e._didTriggerPlay=!1}_playableDirectorResumed=!1;onPauseChanged(){for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}this._playableDirectorResumed=this.director.isPlaying}evaluate(e){if(W2||this.track.muted||this.director.speed<0)return;const t=this.director.context.application.muted,i=this._playableDirectorResumed;this._playableDirectorResumed=!1;const n=t?.1:0;for(let s=0;s<this.models.length;s++){const r=this.models[s],a=this.audio[s],l=r.asset;if((!a||!a.buffer)&&this.isInTimeRange(r,e-1,e+1)&&this.handleAudioLoading(r,a),Mi.userInteractionRegistered!==!1&&!(a===null||!a.buffer))if(a.playbackRate=this.director.context.time.timeScale*this.director.speed,a.loop=l.loop,e>=r.start&&e<=r.end&&e<this.director.duration){if(!a.isPlaying||!this.director.isPlaying)(i||!r._didTriggerPlay&&this.lastTime<e)&&(r.duration*r.timeScale>.3?a.offset=r.clipIn+(e-r.start)*r.timeScale:a.offset=0,ho&&console.log("Timeline Audio ("+this.track.name+") play with offset "+a.offset+" - "+r.asset.clip),a.play(n),r._didTriggerPlay=!0);else{const h=r.clipIn+(e-r.start)*r.timeScale,d=a.context.currentTime-a._startedAt+a.offset;Math.abs(h-d)>.3&&(a.offset=h,a.stop(),a.play(n))}let c=l.volume;if(this.track.volume!==void 0&&(c*=this.track.volume),t&&(c=0),r.easeInDuration>0){const h=Math.min((e-r.start)/r.easeInDuration,1);c*=h}if(r.easeOutDuration>0){const h=Math.min((r.end-e)/r.easeOutDuration,1);c*=h}a.setVolume(c*this.director.weight)}else r._didTriggerPlay=!1,this.director.isPlaying&&a.isPlaying&&a.stop()}this.lastTime=e}loadAudio(e,t=0,i=0){let n=null;const s=e-i,r=e+t;for(const a of this.models)if(this.isInTimeRange(a,s,r)){const l=this.audio[this.models.indexOf(a)],c=this.handleAudioLoading(a,l);c!==null&&(n===null&&(n=[]),n.push(c))}return n!==null?Promise.all(n):null}isInTimeRange(e,t,i){return t<=e.start&&i>=e.end||t>=e.start&&t<=e.end||i>=e.start&&i<=e.end}static _audioBuffers=new Map;static dispose(){ss._audioBuffers.clear()}handleAudioLoading(e,t){this._audioLoader||(this._audioLoader=new gm);const i=this.getAudioFilePath(e.asset.clip);if(ss._audioBuffers.get(i)){const s=ss._audioBuffers.get(i);return s.then(r=>{r&&t.setBuffer(r)}),s}ho&&console.warn("LOAD audio track",i,this.director.sourceId);const n=new Promise((s,r)=>{this._audioLoader.load(i,a=>{t.setBuffer(a),s(a)},void 0,a=>{console.error("Error loading audio",a),s(null)})});return ss._audioBuffers.set(i,n),n}}class zp extends kl{models=[];needsSorting=!0;*foreachMarker(e=null){this.needsSorting&&this.sort();for(const 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)}}class Ih extends kl{models=[];didTrigger=[];receivers=[];evaluate(e){if(this.track.muted)return;const t=this.director.context.time.deltaTime*1.5;for(let i=0;i<this.models.length;i++){const n=this.models[i],s=this.didTrigger[i],r=n.time-e;let a=!1;if(n.retroActive)a=r<=1e-6;else{const l=Math.abs(r);(l===0||l>=1e-5&&l<t)&&(a=!0)}if(a){if(!s)if(ho&&console.log("Trigger signal",e,n.time,n),this.didTrigger[i]=!0,this.receivers?.length<=0)Eh.invoke(n.asset);else for(const l of this.receivers)l&&l.invoke(n.asset)}else n.emitOnce||(this.didTrigger[i]=!1)}}}class Up extends kl{models=[];timelines=[];resolveSourceObjects(e){for(let t=this.models.length-1;t>=0;t--){const i=this.models[t].asset;if(!i.sourceObject||typeof i.sourceObject!="object"){console.log("no source object, removing model",t,i),this.models.splice(t,1);continue}else{const n=w.getComponent(i.sourceObject,ra);this.timelines.push(n),n&&i.updateDirector&&(n.playOnAwake=!1)}}}_previousActiveModel=null;evaluate(e){this._previousActiveModel=null;for(let t=0;t<this.models.length;t++){const i=this.models[t],n=i.asset;if(e>=i.start&&e<=i.end){this._previousActiveModel=i;const s=this.getClipTime(e,i);if(n.controlActivation){const r=n.sourceObject;r.visible=!0}if(n.updateDirector){const r=this.timelines[t];r&&(r.isPlaying&&r.pause(),r.time=s,r.evaluate())}}else{const s=this._previousActiveModel?.asset;if(n.controlActivation){const r=n.sourceObject;s?.sourceObject!==r&&(r.visible=!1)}}}}}var $2=Object.defineProperty,C1=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&$2(e,t,n),n};const qo=x("debugtimeline"),_0=class $0 extends R{static createTrackFunctions={};static registerCreateTrack(e,t){this.createTrackFunctions[e]=t}playableAsset;playOnAwake;extrapolationMode=1;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:(qo||$i())&&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(){qo&&console.log(this,this.playableAsset),this.rebuildGraph(),!this.isValid()&&(qo||A())&&(qo?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(){for(const e of this._audioTracks)e.onEnable?.();for(const e of this._customTracks)e.onEnable?.();for(const e of this._animationTracks)e.onEnable?.();this.playOnAwake&&this.play(),this._visibilityChangeEvt||(this._visibilityChangeEvt=()=>{switch(document.visibilityState){case"hidden":this.setAudioTracksAllowPlaying(!1);break;case"visible":this.setAudioTracksAllowPlaying(!0);break}}),window.addEventListener("visibilitychange",this._visibilityChangeEvt)}onDisable(){this.stop();for(const e of this._audioTracks)e.onDisable?.();for(const e of this._customTracks)e.onDisable?.();for(const e of this._animationTracks)e.onDisable?.();this._visibilityChangeEvt&&window.removeEventListener("visibilitychange",this._visibilityChangeEvt)}onDestroy(){for(const e of this._allTracks)for(const t of e)t.onDestroy?.()}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;const e=this._isPaused==!0;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,e&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){const t=[];for(const i of this._audioTracks){const n=i.loadAudio(this._time,1,0);n&&t.push(n)}if(t.length>0&&(await Promise.all(t),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Mi.userInteractionRegistered&&this.waitForAudio;)await Un(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),xe.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(const i of this._audioTracks)i.stop();const e=this._isPaused==!0,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(const e of this._allTracks)for(const 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(const t of this._markerTracks)for(const i of t.foreachMarker(e))yield i}_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=[];_allTracks=[this._animationTracks,this._audioTracks,this._signalTracks,this._markerTracks,this._controlTracks,this._customTracks];invokePauseChangedMethodsOnTracks(){for(const e of this.forEachTrack())e.onPauseChanged?.call(e)}invokeStateChangedMethodsOnTracks(){for(const 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 0:this._speed>0?t=Math.min(t,this._duration):this._speed<0&&(t=Math.max(t,0)),this._time=t;break;case 1:t%=this._duration,this._time=t;break;case 2:if(t>this._duration){this.stop();return}break}const i=this._time;for(const n of this.playableAsset.tracks)if(!n.muted)switch(n.type){case Bi.Activation:if(!e&&!this._isPlaying)continue;for(let s=0;s<n.outputs.length;s++){const r=n.outputs[s];if(typeof r=="object"){let a=!1;if(n.clips)for(const c of n.clips)c.start<=i&&i<=c.end&&(a=!0);const l=r;l.visible!==void 0&&l.visible!==a&&(l.visible=a,qo&&console.warn(this.name,"set ActivationTrack-"+s,l.name,a,i))}}break}for(const n of this._allTracks)for(const s of n)this._isStopping&&s instanceof Ah||s.evaluate(i)}resolveBindings(){if(this._clonedPlayableAsset||(this._clonedPlayableAsset=!0,this.playableAsset=Ql(this.playableAsset)),!this.playableAsset||!this.playableAsset.tracks)return;const e=this.findRoot(this.gameObject);for(const t of this.playableAsset.tracks){for(let i=t.outputs.length-1;i>=0;i--){let n=t.outputs[i];if(typeof n=="string"){this._guidsMap&&this._guidsMap[n]&&(n=this._guidsMap[n]);const s=w.findByGuid(n,e);s===null||typeof s!="object"?(t.outputs.splice(i,1),console.warn("Failed to resolve binding",n,t.name,t.type)):(qo&&console.log("Resolved binding",n,"to",s),t.outputs[i]=s)}else if(n===null){if(t.outputs.splice(i,1),$0.createTrackFunctions[t.type])continue;t.type!==Bi.Audio&&t.type!==Bi.Control&&t.type!==Bi.Marker&&t.type!==Bi.Signal&&console.warn("Missing binding",n,t.name,t.type,this.name,this.playableAsset.name)}}if(t.type===Bi.Control&&t.clips)for(let i=0;i<t.clips.length;i++){const n=t.clips[i];let s=n.asset.sourceObject;if(typeof s=="string"){this._guidsMap&&this._guidsMap[s]&&(s=this._guidsMap[s]);const r=w.findByGuid(s,e);r===null||typeof r!="object"?console.warn("Failed to resolve sourceObject binding",s,t.name,n):(qo&&console.log("Resolved binding",s,"to",r),n.asset.sourceObject=r)}}}}findRoot(e){return e.parent?this.findRoot(e.parent):e}updateTimelineDuration(){if(this._duration=0,!(!this.playableAsset||!this.playableAsset.tracks)){for(const e of this.playableAsset.tracks)if(e.muted!==!0){if(e.clips)for(const t of e.clips)t.end>this._duration&&(this._duration=t.end);if(e.markers)for(const 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 e=w.findObjectOfType(Eo,this.context);for(const t of this.playableAsset.tracks){const i=t.type,n=$0.createTrackFunctions[i];if(n!=null){const s=n(this,t);if(typeof s.evaluate=="function"){s.director=this,s.track=t,this._customTracks.push(s);continue}}if(t.type===Bi.Animation){if(!t.clips||t.clips.length<=0){qo&&console.warn("Animation track has no clips",t);continue}for(let s=t.outputs.length-1;s>=0;s--){let r=t.outputs[s];if(r instanceof k){const l=w.getOrAddComponent(r,ft);l&&(r=l)}const a=r?.gameObject?.animations;if(a){const l=new Ah;l.trackOffset=t.trackOffset,l.director=this,l.track=t;for(let c=0;c<t.clips.length;c++){const h=t.clips[c],d=h.asset;if(!d){console.error(`Timeline ${this.name}: clip #${c} on track "${t.name}" has no animation data`);continue}const p=d.clip;let m=p;if((typeof m=="string"||typeof m=="number")&&(m=a.find(g=>g.name===p)),qo&&console.log(d,p,"\u2192",m),!m){console.warn("Could not find animationClip for model",h,t.name,this.name,this.playableAsset?.name,a,r);continue}r instanceof ft&&r.runtimeAnimatorController&&(r.__internalDidAwakeAndStart||r.initializeRuntimeAnimatorController(),r.runtimeAnimatorController.mixer||r.runtimeAnimatorController.bind(r),l.mixer=r.runtimeAnimatorController.mixer),l.mixer||(l.mixer=new mm(r.gameObject),this.context.animations.registerAnimationMixer(l.mixer)),l.clips.push(m),l.mixer.uncacheAction(m),l.createHooks(h.asset,m);const f=l.mixer.clipAction(m);l.actions.push(f),l.models.push(h)}this._animationTracks.push(l)}}}else if(t.type===Bi.Audio){if(!t.clips||t.clips.length<=0)continue;const s=new ss;s.director=this,s.track=t,s.audioSource=t.outputs.find(r=>r instanceof Mi),this._audioTracks.push(s),e||(e=this.context.mainCameraComponent?.gameObject.addComponent(Eo)),s.listener=e.listener;for(let r=0;r<t.clips.length;r++){const a=t.clips[r];s.addModel(a)}}else if(t.type===Bi.Marker){if(t.markers){const s=new Ih;s.director=this,s.track=t;const r=new zp;r.director=this,r.track=t;for(const a of t.markers)switch(a.type){case b0.Signal:s.models.push(a),s.didTrigger.push(!1);break;default:r.models.push(a);break}if(s!==null&&s.models.length>0){const a=w.getComponent(this.gameObject,Eh);a&&(s.receivers.push(a),this._signalTracks.push(s))}r!==null&&r.models.length>0&&this._markerTracks.push(r)}}else if(t.type===Bi.Signal){const s=new Ih;if(s.director=this,s.track=t,t.markers)for(const r of t.markers)s.models.push(r),s.didTrigger.push(!1);for(const r of t.outputs)s.receivers.push(r);this._signalTracks.push(s)}else if(t.type===Bi.Control){const s=new Up;if(s.director=this,s.track=t,t.clips)for(const r of t.clips)s.models.push(r);s.resolveSourceObjects(this.context),this._controlTracks.push(s)}}}setAudioTracksAllowPlaying(e){for(const t of this._audioTracks)t.onAllowAudioChanged(e)}animationCallbackReceivers=[];registerAnimationCallback(e){this.animationCallbackReceivers.push(e)}unregisterAnimationCallback(e){const t=this.animationCallbackReceivers.indexOf(e);t!==-1&&this.animationCallbackReceivers.splice(t,1)}};C1([u()],_0.prototype,"playOnAwake"),C1([u()],_0.prototype,"extrapolationMode");let ra=_0;var H2=Object.defineProperty,Np=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&H2(e,t,n),n};class aa extends R{isGizmo=!1;translationSnap=1;rotationSnapAngle=15;scaleSnap=.25;get control(){return this._control}_control;orbit;onEnable(){if(!(this.isGizmo&&!fc)&&this.context.mainCamera&&(this._control||(this._control=new GC(this.context.mainCamera,this.context.renderer.domElement),this._control.enabled=!0,this._control.getRaycaster().layers.set(2),this._control.size=1,("_root"in this._control?this._control._root:this._control).traverse(e=>{const t=e;if(t.layers.set(2),t){const i=t.material;i&&(i.opacity=.3)}}),this.orbit=w.getComponentInParent(this.context.mainCamera,fe)??void 0),this._control)){const e=this._control.getHelper();this.context.scene.add(e),this._control.attach(this.gameObject),this._control?.addEventListener("dragging-changed",this.onControlChangedEvent),window.addEventListener("keydown",this.windowKeyDownListener),window.addEventListener("keyup",this.windowKeyUpListener)}}onDisable(){this._control?.getHelper()?.removeFromParent(),this._control?.removeEventListener("dragging-changed",this.onControlChangedEvent),window.removeEventListener("keydown",this.windowKeyDownListener),window.removeEventListener("keyup",this.windowKeyUpListener)}enableSnapping(){this._control&&(this._control.setTranslationSnap(this.translationSnap),this._control.setRotationSnap(yo.degToRad(this.rotationSnapAngle)),this._control.setScaleSnap(this.scaleSnap))}disableSnapping(){this._control&&(this._control.setTranslationSnap(null),this._control.setRotationSnap(null),this._control.setScaleSnap(null))}onControlChangedEvent=e=>{const t=this.orbit;if(t&&(t.enabled=!e.value),e.value){const i=this.gameObject.getComponentInParent(Cn);i&&(i.fastMode=!0,i.requestOwnership())}else{const i=this.gameObject.getComponentInParent(Cn);i&&(i.fastMode=!1)}};windowKeyDownListener=e=>{if(this.enabled&&this._control)switch(e.keyCode){case 81:this._control.setSpace(this._control.space==="local"?"world":"local");break;case 16:this.enableSnapping();break;case 87:this._control.setMode("translate");break;case 69:this._control.setMode("rotate");break;case 82:this._control.setMode("scale");break;case 187:case 107:this._control.setSize(this._control.size+.1);break;case 189:case 109:this._control.setSize(Math.max(this._control.size-.1,.1));break;case 88:this._control.showX=!this._control.showX;break;case 89:this._control.showY=!this._control.showY;break;case 90:this._control.showZ=!this._control.showZ;break;case 32:this._control.enabled=!this._control.enabled;break}};windowKeyUpListener=e=>{if(this.enabled)switch(e.keyCode){case 16:this.disableSnapping();break}}}Np([u()],aa.prototype,"isGizmo"),Np([u()],aa.prototype,"translationSnap"),Np([u()],aa.prototype,"rotationSnapAngle"),Np([u()],aa.prototype,"scaleSnap");var G2=Object.defineProperty,q2=Object.getOwnPropertyDescriptor,Vp=(o,e,t,i)=>{for(var n=i>1?void 0:i?q2(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&G2(e,t,n),n};class v0{texture=null;rect}Vp([u(Re)],v0.prototype,"texture",2);let Ml=class extends oh{set image(o){this.sprite||(this.sprite=new v0),this.sprite.texture=o,this.onAfterCreated()}get image(){return this.sprite?this.sprite.texture:null}get sprite(){return this._sprite}set sprite(o){this._sprite!==o&&(this._sprite=o,this.onAfterCreated())}_sprite;pixelsPerUnitMultiplier=1;isBuiltinSprite(){const o=this.sprite;switch(o?.texture?.name){case"InputFieldBackground":case"UISprite":case"Background":case"Knob":return!0}return!o?.texture?.name?.length&&o?.texture?.image?.width===32&&o?.texture?.image?.height===32}onBeforeCreate(o){super.onBeforeCreate(o),this.isBuiltinSprite()&&(o.borderRadius=5/this.pixelsPerUnitMultiplier,this.sprite?.texture?.name==="Knob"&&(o.borderRadius=999))}onAfterCreated(){this.__didAwake&&(super.onAfterCreated(),!this.isBuiltinSprite()&&this.setTexture(this.sprite?.texture))}};Vp([u(v0)],Ml.prototype,"sprite",1),Vp([u()],Ml.prototype,"pixelsPerUnitMultiplier",2);class Wp extends oh{get mainTexture(){return this._mainTexture}set mainTexture(e){this._mainTexture!==e&&(this._mainTexture=e,this.onAfterCreated())}_mainTexture;onAfterCreated(){this.__didAwake&&(super.onAfterCreated(),this.setTexture(this.mainTexture))}}Vp([u(Re)],Wp.prototype,"mainTexture",1);var X2=Object.defineProperty,Q2=Object.getOwnPropertyDescriptor,Fi=(o,e,t,i)=>{for(var n=i>1?void 0:i?Q2(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&X2(e,t,n),n};const la=x("debugbutton");class Ys{colorMultiplier;disabledColor;fadeDuration;highlightedColor;normalColor;pressedColor;selectedColor}Fi([u()],Ys.prototype,"colorMultiplier",2),Fi([u(oe)],Ys.prototype,"disabledColor",2),Fi([u()],Ys.prototype,"fadeDuration",2),Fi([u(oe)],Ys.prototype,"highlightedColor",2),Fi([u(oe)],Ys.prototype,"normalColor",2),Fi([u(oe)],Ys.prototype,"pressedColor",2),Fi([u(oe)],Ys.prototype,"selectedColor",2);class Y2{disabledTrigger;highlightedTrigger;normalTrigger;pressedTrigger;selectedTrigger}class Xo extends R{click(){this.onClick?.invoke()}onClick=new he;_isHovered=0;onPointerEnter(e){const t=e.event.pointerType==="mouse"&&e.button===0;t&&(this._isHovered+=1),la&&console.warn("Button Enter",t,this._isHovered,this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.highlightedTrigger):this.transition===1&&this.colors&&this._image?.setState("hovered"),t&&this.context.input.setCursor("pointer"))}onPointerExit(){this._isHovered-=1,this._isHovered<0&&(this._isHovered=0),la&&console.log("Button Exit",this._isHovered,this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this._isHovered>0||(this._isHovered=0,this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.normalTrigger):this.transition===1&&this.colors&&this._image?.setState("normal"),this.context.input.unsetCursor("pointer")))}onPointerDown(e){la&&console.log("Button Down",this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.pressedTrigger):this.transition===1&&this.colors&&this._image?.setState("pressed"))}onPointerUp(e){la&&console.warn("Button Up",this.animationTriggers?.highlightedTrigger,this.animator,this._isHovered),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this._isHovered?this.animationTriggers.highlightedTrigger:this.animationTriggers.normalTrigger):this.transition===1&&this.colors&&this._image?.setState(this._isHovered?"hovered":"normal"))}onPointerClick(e){if(this.interactable&&!(e.button!==0&&e.event.pointerType===Dd.Mouse)&&(la&&(console.warn("Button Click",this.onClick),Te("CLICKED button "+this.name+" at "+this.context.time.frameCount)),this.onClick&&this.onClick.listenerCount>0&&(this.onClick.invoke(),e.use(),la))){const t=this.gameObject.worldPosition;t.add(this.gameObject.worldUp.multiplyScalar(1+Math.random()*.5)),F.DrawLabel(t,"CLICK:"+Date.now(),.1,1+Math.random()*.5)}}colors;transition;animationTriggers;animator;set interactable(e){this._interactable=e,this._image&&(this._image.setInteractable(e),e?this._image.setState("normal"):this._image.setState("disabled"))}get interactable(){return this._interactable}_interactable=!0;set_interactable(e){this.interactable=e}awake(){super.awake(),la&&console.log(this),this._isInit=!1,this.init()}start(){this._image?.setInteractable(this.interactable),this.gameObject.getComponentInParent(qa)||this.gameObject.addComponent(Mu)}onEnable(){super.onEnable()}onDestroy(){this._isHovered&&this.context.input.unsetCursor("pointer")}_requestedAnimatorTrigger;*setAnimatorTriggerAtEndOfFrame(e){this._requestedAnimatorTrigger=e,yield,yield,this._requestedAnimatorTrigger==e&&this.animator?.setTrigger(e)}_isInit=!1;_image;init(){this._isInit||(this._isInit=!0,this._image=w.getComponent(this.gameObject,Ml),this._image&&(this.stateSetup(this._image),this.interactable?this._image.setState("normal"):this._image.setState("disabled")))}stateSetup(e){e.setInteractable(this.interactable);const t=this.getFinalColor(e.color,this.colors?.normalColor),i={state:"normal",attributes:{backgroundColor:t,backgroundOpacity:t.alpha}};e.setupState(i);const n=this.getFinalColor(e.color,this.colors?.highlightedColor),s={state:"hovered",attributes:{backgroundColor:n,backgroundOpacity:n.alpha}};e.setupState(s);const r=this.getFinalColor(e.color,this.colors?.pressedColor),a={state:"pressed",attributes:{backgroundColor:r,backgroundOpacity:r.alpha}};e.setupState(a);const l=this.getFinalColor(e.color,this.colors?.selectedColor),c={state:"selected",attributes:{backgroundColor:l,backgroundOpacity:l.alpha}};e.setupState(c);const h=this.getFinalColor(e.color,this.colors?.disabledColor),d={state:"disabled",attributes:{backgroundColor:h,backgroundOpacity:h.alpha}};e.setupState(d)}getFinalColor(e,t){return t?e.clone().multiply(t).convertLinearToSRGB():e.clone().convertLinearToSRGB()}}Fi([u(he)],Xo.prototype,"onClick",2),Fi([u(Ys)],Xo.prototype,"colors",2),Fi([u()],Xo.prototype,"transition",2),Fi([u(Y2)],Xo.prototype,"animationTriggers",2),Fi([u(ft)],Xo.prototype,"animator",2),Fi([u()],Xo.prototype,"interactable",1);var Z2=Object.defineProperty,$p=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&Z2(e,t,n),n};const Zs=x("debuginputfield"),Lh=class X extends R{get text(){return this.textComponent?.text??""}set text(e){this.textComponent&&(this.textComponent.text=e,this.placeholder&&(e.length>0?this.placeholder.gameObject.visible=!1:this.placeholder.gameObject.visible=!0))}get isFocused(){return X.active===this}textComponent;placeholder;onValueChanged;onEndEdit;static active=null;static activeTime=-1;static htmlField=null;static htmlFieldFocused=!1;inputEventFn;_iosEventFn;start(){Zs&&console.log(this.name,this)}onEnable(){X.htmlField||(X.htmlField=document.createElement("input"),X.htmlField.style.width="0px",X.htmlField.style.height="0px",X.htmlField.style.padding="0px",X.htmlField.style.border="none",X.htmlField.style.overflow="hidden",X.htmlField.style.caretColor="transparent",X.htmlField.style.outline="none",X.htmlField.classList.add("ar"),X.htmlField.onfocus=()=>X.htmlFieldFocused=!0,X.htmlField.onblur=()=>X.htmlFieldFocused=!1,document.body.append(X.htmlField)),this.inputEventFn||(this.inputEventFn=this.onInput.bind(this)),X.htmlField.addEventListener("keyup",this.inputEventFn),this.placeholder&&this.textComponent?.text.length&&w.setActive(this.placeholder.gameObject,!1),G.isiOS()&&(this._iosEventFn=this.processInputOniOS.bind(this),window.addEventListener("click",this._iosEventFn))}onDisable(){X.htmlField?.removeEventListener("keyup",this.inputEventFn),this.onDeselected(),this._iosEventFn&&window.removeEventListener("click",this._iosEventFn)}clear(){X.active===this&&X.htmlField?(X.htmlField.value="",this.setTextFromInputField()):(this.textComponent&&(this.textComponent.text=""),this.placeholder&&w.setActive(this.placeholder.gameObject,!0))}select(){this.onSelected()}deselect(){this.onDeselected()}onPointerEnter(e){e.event.pointerType==="mouse"&&e.button===0&&this.context.input.setCursor("text")}onPointerExit(e){this.context.input.unsetCursor("text")}onPointerClick(e){Zs&&console.log("CLICK",e,X.active),X.activeTime=this.context.time.time,X.active!==this&&this.startCoroutine(this.activeLoop(),xe.LateUpdate),this.selectInputField()}*activeLoop(){for(this.onSelected();X.active===this&&!(this.context.input.getPointerClicked(0)&&this.context.time.time-X.activeTime>.2);)this.setTextFromInputField(),yield;this.onDeselected()}onSelected(){if(X.active!==this&&(Zs&&console.log("Select",this.name,this,X.htmlField,this.context.isInXR,this.context.arOverlayElement,this.textComponent?.text,X.htmlField?.value),X.active?.onDeselected(),X.active=this,this.placeholder&&w.setActive(this.placeholder.gameObject,!1),X.htmlField)){if(X.htmlField.value=this.textComponent?.text||"",Zs&&console.log("set input field value",X.htmlField.value),this.context.isInXR){const e=this.context.arOverlayElement;e&&e.append(X.htmlField)}this.selectInputField()}}onDeselected(){X.active===this&&(X.active=null,Zs&&console.log("Deselect",this.name,this),X.htmlField&&(X.htmlField.blur(),document.body.append(X.htmlField)),this.placeholder&&(!this.textComponent||this.textComponent.text.length<=0)&&w.setActive(this.placeholder.gameObject,!0),X.htmlField&&this.onEndEdit?.invoke(X.htmlField.value))}update(){X.active===this&&this.textComponent?.markDirty()}onInput(e){if(X.active===this){if(Zs&&console.log(e.code,e,X.htmlField?.value,this.textComponent?.text),e.code==="Escape"||e.code==="Enter"){this.onDeselected();return}X.htmlField&&(this.textComponent&&(this.setTextFromInputField(),this.placeholder&&w.setActive(this.placeholder.gameObject,this.textComponent.text.length<=0)),this.selectInputField())}}setTextFromInputField(){if(this.textComponent&&X.htmlField){const e=this.textComponent.text,t=X.htmlField.value,i=this.textComponent.text!==X.htmlField.value;this.textComponent.text=X.htmlField.value,i&&(Zs&&console.log("[InputField] value changed:",t,e),this.onValueChanged?.invoke(t,e))}}selectInputField(){X.htmlField&&(Zs&&console.log("Focus Inputfield",X.htmlFieldFocused),X.htmlField.setSelectionRange(X.htmlField.value.length,X.htmlField.value.length),G.isiOS()?X.htmlField.focus({preventScroll:!0}):setTimeout(()=>X.htmlField?.focus(),1))}processInputOniOS(){const e=this.context.physics.raycast();if(!e.length)return;const t=e[0].object,i=gf(t);(i?.gameObject===this.gameObject||i?.gameObject.parent===this.gameObject)&&this.selectInputField()}};$p([u(Bt)],Lh.prototype,"textComponent"),$p([u(Bt)],Lh.prototype,"placeholder"),$p([u(he)],Lh.prototype,"onValueChanged"),$p([u(he)],Lh.prototype,"onEndEdit");let x0=Lh;var K2=Object.defineProperty,P1=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&K2(e,t,n),n};class jh extends R{id=null;keepAspect=!1;_object=null;onEnable(){if(this._object){this.gameObject.add(this._object);return}if(!this.id||!this.context.mainCamera)return;const e=document.getElementById(this.id);if(!e){console.warn('Could not find element with id "'+this.id+'"');return}e.style.display="block",e.style.visibility="hidden";const t=new qC;t.listenToPointerEvents(this.context.renderer,this.context.mainCamera),this.gameObject.add(t);const i=new XC(e);t.add(i),i.visible=!1;const n=i.material;n.transparent=!0,setTimeout(()=>{i.visible=!0;const s=Rd(this.gameObject).clone();Jl(this.gameObject,0,0,0),this.gameObject.updateMatrixWorld();const r=new bi;r.setFromObject(t),this.setWorldRotation(s.x,s.y,s.z);const a=r.max.x-r.min.x,l=r.max.y-r.min.y;if(this.keepAspect){const h=a/l;a>l?i.scale.set(1/a,1/l/h,1):i.scale.set(1/a*h,1/l,1)}else i.scale.set(1/a,1/l,1);const c=this.gameObject.scale;i.scale.multiply(c)},1)}onDisable(){this._object?.removeFromParent()}}P1([u()],jh.prototype,"id"),P1([u()],jh.prototype,"keepAspect");/* @license
|
|
1417
|
+
C) Set "joinRandomRoom" to true`),!1):(g0&&console.log("Join "+this.roomName),this._userWantsToBeInARoom=!0,this.context.connection.joinRoom(this.roomName),!0))}_lastPingTime=0;_lastRoomTime=-1;_userWantsToBeInARoom=!1;update(){this.context.connection.isConnected&&(this.context.time.time-this._lastPingTime>3&&(this._lastPingTime=this.context.time.time,this.context.connection.sendPing()),this.context.connection.isInRoom&&(this._lastRoomTime=this.context.time.time)),this._lastRoomTime>0&&this.context.time.time-this._lastRoomTime>.3&&(this._lastRoomTime=-1,this.autoRejoin?this._userWantsToBeInARoom&&(console.log("Disconnected from networking backend - attempt reconnecting now"),this.tryJoinRoom()):A()&&console.warn("You are not connected to a room anymore (possibly because the tab was inactive for too long and the server kicked you?)"))}getViewOnlyUrl(){if(this.context.connection.isConnected&&this.context.connection.currentRoomViewId){const e=window.location.search,t=new URLSearchParams(e);return t.has(this.urlParameterName)&&t.delete(this.urlParameterName),t.set(m0,this.context.connection.currentRoomViewId),window.location.origin+window.location.pathname+"?"+t.toString()}return null}setRandomRoomUrlParameter(){const e=ql(),t=this.generateRoomName();x(this.urlParameterName)?e.set(this.urlParameterName,t):e.append(this.urlParameterName,t),Em(t,e)}generateRoomName(){let e="";for(let t=0;t<6;t++)e+=Math.floor(Math.random()*10).toFixed(0);return e}_roomButton;_roomButtonIconJoin;_roomButtonIconLeave;createRoomButton(){if(this._roomButton)return this._roomButton;const e=document.createElement("button");return this._roomButton=e,e.classList.add("create-room-button"),e.setAttribute("priority","90"),e.onclick=()=>{if(this.context.connection.isInRoom)this.urlParameterName&&Xl(this.urlParameterName,null),this.context.connection.leaveRoom(),this._userWantsToBeInARoom=!1;else{if(this.urlParameterName){const t=x(this.urlParameterName);(!t||t===!0)&&(this._lastJoinedRoom?Xl(this.urlParameterName,this._lastJoinedRoom):this.setRandomRoomUrlParameter())}this.tryJoinRoom()}},this._roomButtonIconJoin=Ct("group"),this._roomButtonIconLeave=Ct("group_off"),this.updateRoomButtonState(),this.context.connection.beginListen(te.JoinedRoom,this.updateRoomButtonState),this.context.connection.beginListen(te.LeftRoom,this.updateRoomButtonState),e}updateRoomButtonState=()=>{this._roomButton&&(this.context.connection.isInRoom?(this._roomButton.title="Leave the networked room",this._roomButton.textContent="Leave Room",this._roomButtonIconJoin?.remove(),this._roomButton.prepend(this._roomButtonIconLeave)):(this._roomButton.title="Create or join a networked room",this._roomButton.textContent="Join Room",this._roomButtonIconLeave?.remove(),this._roomButton.prepend(this._roomButtonIconJoin)))};destroyRoomButton(){this.context.connection.stopListen(te.JoinedRoom,this.updateRoomButtonState),this.context.connection.stopListen(te.LeftRoom,this.updateRoomButtonState)}_viewOnlyButton;onEnableViewOnlyButton(){this.context.connection.isConnected?this.onCreateViewOnlyButton():(this.context.connection.stopListen(te.JoinedRoom,this.onCreateViewOnlyButton),this.context.connection.beginListen(te.JoinedRoom,this.onCreateViewOnlyButton))}onDisableViewOnlyButton(){this.context.connection.stopListen(te.JoinedRoom,this.onCreateViewOnlyButton),this._viewOnlyButton?.remove()}onCreateViewOnlyButton=()=>{if(!this._viewOnlyButton){const e=document.createElement("button");this._viewOnlyButton=e,e.classList.add("view-only-button"),e.setAttribute("priority","90"),e.onclick=()=>{const t=this.getViewOnlyUrl();t?.length?navigator.canShare({url:t})?navigator.share({url:t})?.catch(i=>{console.warn(i)}):(navigator.clipboard.writeText(t),Te("View only URL copied to clipboard")):ge("Could not create view only URL")},e.title="Copy the view only URL: A page accessed by the view only URL can not be modified by visiting users.",e.textContent="Share View URL",e.prepend(Ct("visibility"))}this.context.menu.appendChild(this._viewOnlyButton)}}Qs([u()],In.prototype,"roomName",2),Qs([u()],In.prototype,"urlParameterName",2),Qs([u()],In.prototype,"joinRandomRoom",2),Qs([u()],In.prototype,"requireRoomParameter",2),Qs([u()],In.prototype,"autoRejoin",2),Qs([u()],In.prototype,"createJoinButton",2),Qs([u()],In.prototype,"createViewOnlyButton",2),Qs([u()],In.prototype,"roomPrefix",1);function B2(){const o=x("testwindowcount")||0;o&&o>0&&F2(o)}function F2(o){if(x("testwindow"))return null;const e=new URL(window.location.href);Tm(e.searchParams,LR,1),Tm(e.searchParams,"testwindow",1);const t=e.toString(),i=[];window.onbeforeunload=()=>{for(const l of i)l.close()};const n=.05,s=128;let r=0,a=0;for(let l=0;l<o;l++){r*s+s*.01>=window.innerWidth&&(a+=1,r=0);const c=r*(s*(1+n))+window.screenLeft,h=a*(s*(1+n))+window.screenTop+90+60*a;r+=1;const d=window.open(t,"test window "+l,`popup=yes width=${s} height=${s} top=${h} left=${c}`);if(!d){console.warn("Failed to open window");continue}i.push(d),d.onload=()=>{d.onbeforeunload=()=>{for(let p=0;p<i.length;p++){const m=i[p];m!==d&&m.close()}i.length=0}}}return i}class f0 extends R{awake(){B2()}}class y0 extends R{transformsPerFrame=10;interval=0;useFlatbuffers=!0;awake(){if(this.useFlatbuffers)this.context.connection.beginListenBinary(Ec,e=>{});else{this.models=[];for(let e=0;e<this.transformsPerFrame;e++)this.models.push(new z2(this.context.connection.connectionId+"_simulatedTransform_"+e,this))}}builder=null;models=null;update(){if(this.context.connection.isConnected){if(this.useFlatbuffers){if(!this.context.connection.connectionId||this.context.time.frameCount%this.interval!==0)return;this.builder===null&&(this.builder=new Cm(1024));const e=this.builder;for(let t=0;t<this.transformsPerFrame;t++){e.clear();const i=kx(this.context.connection.connectionId,this);this.context.connection.sendBinary(i)}}else if(this.models)for(let e=0;e<this.models.length;e++){const t=this.models[e];t.dontSave=!0,t.update(this,null),this.context.connection.send("TestSimulateUserData-"+e,t)}}}}class z2{guid;fast=!1;position;rotation;velocity=void 0;dontSave;isValid(){return this.fast!==void 0||this.position!==void 0||this.rotation!==void 0||this.velocity!==void 0}constructor(e,t){this.guid=e,this.position={x:0,y:0,z:0},this.rotation={x:0,y:0,z:0,w:0},this.update(t,null)}static temp=new b;update(e,t){const i=e.worldPosition;this.position.x=i.x,this.position.y=i.y,this.position.z=i.z;const n=e.worldQuaternion;if(this.rotation.x=n.x,this.rotation.y=n.y,this.rotation.z=n.z,this.rotation.w=n.w,this.fast=!1,t){const s=t.getVelocity();this.velocity===void 0&&(this.velocity={x:0,y:0,z:0}),this.velocity.x=s.x,this.velocity.y=s.y,this.velocity.z=s.z}}}var U2=Object.defineProperty,Bp=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&U2(e,t,n),n};const N2=x("debugsignals");class Fp{guid}Bp([u()],Fp.prototype,"guid");class Th{signal;reaction}Bp([u(Fp)],Th.prototype,"signal"),Bp([u(he)],Th.prototype,"reaction");const S1=class ts extends R{static receivers={};static invoke(e){if(ts.receivers[e]){const t=ts.receivers[e];if(!t)return;for(const i of t)i.invoke(e)}}events;awake(){N2&&console.log("SignalReceiver awake",this)}onEnable(){if(this.events)for(const e of this.events)ts.receivers[e.signal.guid]||(ts.receivers[e.signal.guid]=[]),ts.receivers[e.signal.guid].push(this)}onDisable(){if(this.events){for(const e of this.events)if(ts.receivers[e.signal.guid]){const t=ts.receivers[e.signal.guid].indexOf(this);t>=0&&ts.receivers[e.signal.guid].splice(t,1)}}}invoke(e){if(!this.events||!Array.isArray(this.events))return;const t=typeof e=="object"?e.guid:e;for(const i of this.events)if(i.signal.guid===t)try{if(i.reaction){if(!i.reaction.invoke){console.warn("Missing invoke - possibly a serialization error",i,this);continue}}else{console.warn("Missing reaction for signal",i,this);continue}i.reaction.invoke()}catch(n){console.error(n)}}};Bp([u(Th)],S1.prototype,"events");let Eh=S1;var Bi=(o=>(o.Activation="ActivationTrack",o.Animation="AnimationTrack",o.Audio="AudioTrack",o.Control="ControlTrack",o.Marker="MarkerTrack",o.Signal="SignalTrack",o))(Bi||{}),co=(o=>(o[o.None=0]="None",o[o.Hold=1]="Hold",o[o.Loop=2]="Loop",o[o.PingPong=3]="PingPong",o[o.Continue=4]="Continue",o))(co||{}),b0=(o=>(o.Signal="SignalEmitter",o))(b0||{});const ho=x("debugtimeline");class kl{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 t=this.track.clips.length-1;t>=0;t--)yield this.track.clips[t];else for(const t of this.track.clips)yield t}getClipTime(e,t){return t.clipIn+(e-t.start)*t.timeScale}getClipTimeNormalized(e,t){return(e-t.start)/t.duration}evaluateWeight(e,t,i,n=!0){if(t<0||t>=i.length)return 0;const s=i[t];if(n||e>=s.start&&e<=s.end){let r=1;if(s.easeInDuration>0){const a=Math.min((e-s.start)/s.easeInDuration,1);r*=a}if(s.easeOutDuration>0){const a=Math.min((s.end-e)/s.easeOutDuration,1);r*=a}return r}return 0}}class V2{clip;rootPositionOffset;rootQuaternionOffset;get hasOffsets(){return this.rootPositionOffset!==void 0||this.rootQuaternionOffset!==void 0}rootStartPosition;rootEndPosition;rootStartQuaternion;rootEndQuaternion;constructor(e){const t=e.getClip();this.clip=t;const i=e.getRoot(),n=i.name+".position",s=i.name+".quaternion";ho&&console.log(t.name,t.tracks,n);for(const r of t.tracks)if(!(r.times.length<=0)){if(r.name.endsWith(n))this.rootStartPosition=new b().fromArray(r.values,0),this.rootEndPosition=new b().fromArray(r.values,r.values.length-3),this.rootPositionOffset=this.rootEndPosition.clone().sub(this.rootStartPosition),ho&&console.log(this.rootPositionOffset);else if(r.name.endsWith(s)&&(this.rootStartQuaternion=new U().fromArray(r.values,0),this.rootEndQuaternion=new U().fromArray(r.values,r.values.length-4),this.rootQuaternionOffset=this.rootEndQuaternion.clone().multiply(this.rootStartQuaternion),ho)){const a=new nt().setFromQuaternion(this.rootQuaternionOffset);console.log("ROT",a)}}}}class Ah extends kl{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&&xx(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 i=!1,n=!1;const s=t.tracks.find(r=>r.name.includes(".position")||r.name.includes(".quaternion"))?.name.split(".");if(s){const r=s[s.length-2],a=r+".position",l=r+".quaternion";for(const c of t.tracks)!i&&c.name.endsWith(a)?(i=!0,this.createPositionInterpolant(t,e,c)):!n&&c.name.endsWith(l)&&(n=!0,this.createRotationInterpolant(t,e,c))}if(!i||!n){const r=this.mixer?.getRoot(),a=t.tracks[0],l=a.name.lastIndexOf("."),c=a.name.substring(0,l),h=c.substring(c.lastIndexOf(".")+1),d=r.getObjectByName(h);if(d)if(i){if(!n){const p=t.tracks[0].name.substring(0,l)+".quaternion";ho&&console.warn("Create quaternion track",h,d);const m=new SC(p,[0,t.duration],[0,0,0,1,0,0,0,1]);t.tracks.push(m),this.createRotationInterpolant(t,e,m)}}else{const p=c+".position";ho&&console.warn("Create position track",h,d);const m=new wC(p,[0,t.duration],[0,0,0,0,0,0]);t.tracks.push(m),this.createPositionInterpolant(t,e,m)}}}bind(){if(!this._didBind){this._didBind=!0,ho&&console.log(this.models),this.mixer?this.target=this.mixer.getRoot():console.warn("No mixer was assigned to animation track");for(const e of this.actions){const t=new V2(e);this._actionOffsets.push(t)}this.target&&(this._animator=w.getComponent(this.target,ft)??null,this._animator&&xx(this._animator.gameObject,this,!0));for(const e of this.models){const t=e.asset,i=t.position,n=t.rotation;i&&i.x!==void 0&&(i.isVector3||(t.position=new b(i.x,i.y,i.z)),n.isQuaternion||(t.rotation=new U(n.x,n.y,n.z,n.w)))}this.ensureTrackOffsets()}}ensureTrackOffsets(){if(this.trackOffset){const e=this.trackOffset.position;e&&(e.isVector3||(this.trackOffset.position=new b(e.x,e.y,e.z)));const t=this.trackOffset.rotation;t&&(t.isQuaternion||(this.trackOffset.rotation=new U(t.x,t.y,t.z,t.w)))}}_useclipOffsets=!0;_totalOffsetPosition=new b;_totalOffsetRotation=new U;_totalOffsetPosition2=new b;_totalOffsetRotation2=new U;_summedPos=new b;_tempPos=new b;_summedRot=new U;_tempRot=new U;_clipRotQuat=new U;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,i=0,n=!1,s=!1,r=0;for(let a=0;a<this.clips.length;a++){const l=this.models[a],c=this.actions[a],h=l.asset;c.weight=0;const d=e>=l.start&&e<=l.end,p=l.preExtrapolationMode,m=l.postExtrapolationMode,f=a<this.clips.length-1?this.models[a+1]:null;let g=d,y=!1;if(!g&&!n&&l.end<e&&m!==co.None?(!f||f.start>e)&&(g=!0,n=!0):a==0&&!g&&!s&&l.start>e&&p!==co.None&&(!f||f.start<e)&&(g=!0,y=!0,s=!0),g){let _=this.weight;_*=this.evaluateWeight(e,a,this.models,g),_*=this.director.weight;let v=d;if(y)switch(p){case co.Hold:break;case co.Loop:e+=l.start,v=!0;break;default:e+=l.start,v=!0;break}let P=this.getClipTime(e,l),M=0;const O=h.duration;if(y&&p===co.Hold&&(P=0),v){if(h.loop)for(M+=Math.floor(P/(O+1e-6));P>O;)P-=O}else if(!d&&n)switch(m){case co.Hold:P=this.getClipTime(l.end,l);break;case co.Loop:P%=O;break;case co.PingPong:const L=Math.floor(P/O)%2!==0;P%=O,L&&(P=O-P);break}l.reversed===!0?c.time=c.getClip().duration-P:c.time=P,c.timeScale=0;const E=Math.max(0,_);if(c.weight=E,r+=E,c.clampWhenFinished=!1,c.isRunning()||c.play(),this._useclipOffsets){const L=t==0?this._totalOffsetPosition:this._totalOffsetPosition2,$=t==0?this._totalOffsetRotation:this._totalOffsetRotation2;t<1&&(i=1-_),t+=1;const D=this._summedPos.set(0,0,0),q=this._tempPos.set(0,0,0),Z=this._summedRot.identity(),I=this._tempRot.identity(),W=h.rotation;W&&(this._clipRotQuat.identity(),this._clipRotQuat.slerp(W,_));const V=this._actionOffsets[a];if(V.hasOffsets)for(let se=0;se<M;se++)V.rootPositionOffset?q.copy(V.rootPositionOffset):q.set(0,0,0),q.applyQuaternion(Z),this._clipRotQuat&&q.applyQuaternion(this._clipRotQuat),V.rootQuaternionOffset&&(I.copy(V.rootQuaternionOffset),Z.multiply(I)),D.add(q);this._clipRotQuat&&$.multiply(this._clipRotQuat),$.multiply(Z),h.position&&D.add(h.position),L.add(D)}}}if(this._useclipOffsets&&(this._totalOffsetPosition.lerp(this._totalOffsetPosition2,i),this._totalOffsetRotation.slerp(this._totalOffsetRotation2,i)),this.__mixerError===void 0&&(ho||A())&&this._animator?.runtimeAnimatorController?.mixer&&this.mixer!==this._animator?.runtimeAnimatorController?.mixer&&(this.__mixerError=!0,console.error("AnimationTrack mixer is not shared with the animator controller - this might result in the timeline to not animate properly. Please report a bug to the Needle Engine team!",this)),this._animator?.runtimeAnimatorController){const a=Math.max(0,1-r);this._animator?.runtimeAnimatorController?.update(a)}else this.mixer.update(e)}createRotationInterpolant(e,t,i){const n=i.createInterpolant.bind(i),s=new U;this.ensureTrackOffsets();const r=this.trackOffset?.rotation;i.createInterpolant=()=>{const a=n(),l=a.evaluate.bind(a);return a.evaluate=c=>{const h=l(c);if(s.set(h[0],h[1],h[2],h[3]),s.premultiply(this._totalOffsetRotation),r&&s.premultiply(r),this.director.animationCallbackReceivers)for(const d of this.director.animationCallbackReceivers)d?.onTimelineRotation?.call(d,this.director,this.target,c,s);return h[0]=s.x,h[1]=s.y,h[2]=s.z,h[3]=s.w,h},a}}createPositionInterpolant(e,t,i){const n=i.createInterpolant.bind(i),s=new b;this.ensureTrackOffsets();const r=this.trackOffset?.rotation,a=this.trackOffset?.position;let l;i.createInterpolant=()=>{const c=n(),h=c.evaluate.bind(c);return c.evaluate=d=>{const p=h(d);if(s.set(p[0],p[1],p[2]),t.removeStartOffset&&(l===void 0?(l=null,l=this._actionOffsets.find(m=>m.clip===e)?.rootStartPosition?.clone()):l?.isVector3&&s.sub(l)),s.applyQuaternion(this._totalOffsetRotation),s.add(this._totalOffsetPosition),r&&s.applyQuaternion(r),a&&(s.x-=a.x,s.y+=a.y,s.z+=a.z),this.director.animationCallbackReceivers)for(const m of this.director.animationCallbackReceivers)m?.onTimelinePosition?.call(m,this.director,this.target,d,s);return p[0]=s.x,p[1]=s.y,p[2]=s.z,p},c}}}const W2=x("mutetimeline");class ss extends kl{models=[];listener;audio=[];audioContextTimeOffset=[];lastTime=0;audioSource;_audioLoader=null;getAudioFilePath(e){const t=this.director.sourceId;return us(t,e)}onAllowAudioChanged(e){for(let t=0;t<this.models.length;t++){const i=this.models[t];this.audio[t].setVolume(e?i.asset.volume:0)}}addModel(e){const t=new CC(this.listener);this.audio.push(t);const i=e;i._didTriggerPlay=!1,this.models.push(i)}onDisable(){for(const e of this.audio)e.isPlaying&&e.stop();for(const e of this.models)e._didTriggerPlay=!1}onDestroy(){for(const e of this.audio)e.source&&e?.disconnect();this.audio.length=0}onMuteChanged(){if(this.muted)for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}}stop(){for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}for(const e of this.models)e._didTriggerPlay=!1}_playableDirectorResumed=!1;onPauseChanged(){for(let e=0;e<this.audio.length;e++){const t=this.audio[e];t?.isPlaying&&t.stop()}this._playableDirectorResumed=this.director.isPlaying}evaluate(e){if(W2||this.track.muted||this.director.speed<0)return;const t=this.director.context.application.muted,i=this._playableDirectorResumed;this._playableDirectorResumed=!1;const n=t?.1:0;for(let s=0;s<this.models.length;s++){const r=this.models[s],a=this.audio[s],l=r.asset;if((!a||!a.buffer)&&this.isInTimeRange(r,e-1,e+1)&&this.handleAudioLoading(r,a),Mi.userInteractionRegistered!==!1&&!(a===null||!a.buffer))if(a.playbackRate=this.director.context.time.timeScale*this.director.speed,a.loop=l.loop,e>=r.start&&e<=r.end&&e<this.director.duration){if(!a.isPlaying||!this.director.isPlaying)(i||!r._didTriggerPlay&&this.lastTime<e)&&(r.duration*r.timeScale>.3?a.offset=r.clipIn+(e-r.start)*r.timeScale:a.offset=0,ho&&console.log("Timeline Audio ("+this.track.name+") play with offset "+a.offset+" - "+r.asset.clip),a.play(n),r._didTriggerPlay=!0);else{const h=r.clipIn+(e-r.start)*r.timeScale,d=a.context.currentTime-a._startedAt+a.offset;Math.abs(h-d)>.3&&(a.offset=h,a.stop(),a.play(n))}let c=l.volume;if(this.track.volume!==void 0&&(c*=this.track.volume),t&&(c=0),r.easeInDuration>0){const h=Math.min((e-r.start)/r.easeInDuration,1);c*=h}if(r.easeOutDuration>0){const h=Math.min((r.end-e)/r.easeOutDuration,1);c*=h}a.setVolume(c*this.director.weight)}else r._didTriggerPlay=!1,this.director.isPlaying&&a.isPlaying&&a.stop()}this.lastTime=e}loadAudio(e,t=0,i=0){let n=null;const s=e-i,r=e+t;for(const a of this.models)if(this.isInTimeRange(a,s,r)){const l=this.audio[this.models.indexOf(a)],c=this.handleAudioLoading(a,l);c!==null&&(n===null&&(n=[]),n.push(c))}return n!==null?Promise.all(n):null}isInTimeRange(e,t,i){return t<=e.start&&i>=e.end||t>=e.start&&t<=e.end||i>=e.start&&i<=e.end}static _audioBuffers=new Map;static dispose(){ss._audioBuffers.clear()}handleAudioLoading(e,t){this._audioLoader||(this._audioLoader=new gm);const i=this.getAudioFilePath(e.asset.clip);if(ss._audioBuffers.get(i)){const s=ss._audioBuffers.get(i);return s.then(r=>{r&&t.setBuffer(r)}),s}ho&&console.warn("LOAD audio track",i,this.director.sourceId);const n=new Promise((s,r)=>{this._audioLoader.load(i,a=>{t.setBuffer(a),s(a)},void 0,a=>{console.error("Error loading audio",a),s(null)})});return ss._audioBuffers.set(i,n),n}}class zp extends kl{models=[];needsSorting=!0;*foreachMarker(e=null){this.needsSorting&&this.sort();for(const 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)}}class Ih extends kl{models=[];didTrigger=[];receivers=[];evaluate(e){if(this.track.muted)return;const t=this.director.context.time.deltaTime*1.5;for(let i=0;i<this.models.length;i++){const n=this.models[i],s=this.didTrigger[i],r=n.time-e;let a=!1;if(n.retroActive)a=r<=1e-6;else{const l=Math.abs(r);(l===0||l>=1e-5&&l<t)&&(a=!0)}if(a){if(!s)if(ho&&console.log("Trigger signal",e,n.time,n),this.didTrigger[i]=!0,this.receivers?.length<=0)Eh.invoke(n.asset);else for(const l of this.receivers)l&&l.invoke(n.asset)}else n.emitOnce||(this.didTrigger[i]=!1)}}}class Up extends kl{models=[];timelines=[];resolveSourceObjects(e){for(let t=this.models.length-1;t>=0;t--){const i=this.models[t].asset;if(!i.sourceObject||typeof i.sourceObject!="object"){console.log("no source object, removing model",t,i),this.models.splice(t,1);continue}else{const n=w.getComponent(i.sourceObject,ra);this.timelines.push(n),n&&i.updateDirector&&(n.playOnAwake=!1)}}}_previousActiveModel=null;evaluate(e){this._previousActiveModel=null;for(let t=0;t<this.models.length;t++){const i=this.models[t],n=i.asset;if(e>=i.start&&e<=i.end){this._previousActiveModel=i;const s=this.getClipTime(e,i);if(n.controlActivation){const r=n.sourceObject;r.visible=!0}if(n.updateDirector){const r=this.timelines[t];r&&(r.isPlaying&&r.pause(),r.time=s,r.evaluate())}}else{const s=this._previousActiveModel?.asset;if(n.controlActivation){const r=n.sourceObject;s?.sourceObject!==r&&(r.visible=!1)}}}}}var $2=Object.defineProperty,C1=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&$2(e,t,n),n};const qo=x("debugtimeline"),_0=class $0 extends R{static createTrackFunctions={};static registerCreateTrack(e,t){this.createTrackFunctions[e]=t}playableAsset;playOnAwake;extrapolationMode=1;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:(qo||$i())&&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(){qo&&console.log(this,this.playableAsset),this.rebuildGraph(),!this.isValid()&&(qo||A())&&(qo?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(){for(const e of this._audioTracks)e.onEnable?.();for(const e of this._customTracks)e.onEnable?.();for(const e of this._animationTracks)e.onEnable?.();this.playOnAwake&&this.play(),this._visibilityChangeEvt||(this._visibilityChangeEvt=()=>{switch(document.visibilityState){case"hidden":this.setAudioTracksAllowPlaying(!1);break;case"visible":this.setAudioTracksAllowPlaying(!0);break}}),window.addEventListener("visibilitychange",this._visibilityChangeEvt)}onDisable(){this.stop();for(const e of this._audioTracks)e.onDisable?.();for(const e of this._customTracks)e.onDisable?.();for(const e of this._animationTracks)e.onDisable?.();this._visibilityChangeEvt&&window.removeEventListener("visibilitychange",this._visibilityChangeEvt)}onDestroy(){for(const e of this._allTracks)for(const t of e)t.onDestroy?.()}rebuildGraph(){this.isValid()&&(this.resolveBindings(),this.updateTimelineDuration(),this.setupAndCreateTrackHandlers())}async play(){if(!this.isValid())return;const e=this._isPaused==!0;if(this._isPaused=!1,!this._isPlaying){if(this._isPlaying=!0,e&&this.invokePauseChangedMethodsOnTracks(),this.waitForAudio){const t=[];for(const i of this._audioTracks){const n=i.loadAudio(this._time,1,0);n&&t.push(n)}if(t.length>0&&(await Promise.all(t),!this._isPlaying))return;for(;this._audioTracks.length>0&&this._isPlaying&&!Mi.userInteractionRegistered&&this.waitForAudio;)await Un(200)}this.invokeStateChangedMethodsOnTracks(),this._internalUpdateRoutine=this.startCoroutine(this.internalUpdate(),xe.LateUpdate)}}pause(){this.isValid()&&(this._isPlaying=!1,!this._isPaused&&(this._isPaused=!0,this.internalEvaluate(),this.invokePauseChangedMethodsOnTracks(),this.invokeStateChangedMethodsOnTracks()))}stop(){this._isStopping=!0;for(const i of this._audioTracks)i.stop();const e=this._isPaused==!0,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(const e of this._allTracks)for(const 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(const t of this._markerTracks)for(const i of t.foreachMarker(e))yield i}_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=[];_allTracks=[this._animationTracks,this._audioTracks,this._signalTracks,this._markerTracks,this._controlTracks,this._customTracks];invokePauseChangedMethodsOnTracks(){for(const e of this.forEachTrack())e.onPauseChanged?.call(e)}invokeStateChangedMethodsOnTracks(){for(const 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 0:this._speed>0?t=Math.min(t,this._duration):this._speed<0&&(t=Math.max(t,0)),this._time=t;break;case 1:t%=this._duration,this._time=t;break;case 2:if(t>this._duration){this.stop();return}break}const i=this._time;for(const n of this.playableAsset.tracks)if(!n.muted)switch(n.type){case Bi.Activation:if(!e&&!this._isPlaying)continue;for(let s=0;s<n.outputs.length;s++){const r=n.outputs[s];if(typeof r=="object"){let a=!1;if(n.clips)for(const c of n.clips)c.start<=i&&i<=c.end&&(a=!0);const l=r;l.visible!==void 0&&l.visible!==a&&(l.visible=a,qo&&console.warn(this.name,"set ActivationTrack-"+s,l.name,a,i))}}break}for(const n of this._allTracks)for(const s of n)this._isStopping&&s instanceof Ah||s.evaluate(i)}resolveBindings(){if(this._clonedPlayableAsset||(this._clonedPlayableAsset=!0,this.playableAsset=Ql(this.playableAsset)),!this.playableAsset||!this.playableAsset.tracks)return;const e=this.findRoot(this.gameObject);for(const t of this.playableAsset.tracks){for(let i=t.outputs.length-1;i>=0;i--){let n=t.outputs[i];if(typeof n=="string"){this._guidsMap&&this._guidsMap[n]&&(n=this._guidsMap[n]);const s=w.findByGuid(n,e);s===null||typeof s!="object"?(t.outputs.splice(i,1),console.warn("Failed to resolve binding",n,t.name,t.type)):(qo&&console.log("Resolved binding",n,"to",s),t.outputs[i]=s)}else if(n===null){if(t.outputs.splice(i,1),$0.createTrackFunctions[t.type])continue;t.type!==Bi.Audio&&t.type!==Bi.Control&&t.type!==Bi.Marker&&t.type!==Bi.Signal&&console.warn("Missing binding",n,t.name,t.type,this.name,this.playableAsset.name)}}if(t.type===Bi.Control&&t.clips)for(let i=0;i<t.clips.length;i++){const n=t.clips[i];let s=n.asset.sourceObject;if(typeof s=="string"){this._guidsMap&&this._guidsMap[s]&&(s=this._guidsMap[s]);const r=w.findByGuid(s,e);r===null||typeof r!="object"?console.warn("Failed to resolve sourceObject binding",s,t.name,n):(qo&&console.log("Resolved binding",s,"to",r),n.asset.sourceObject=r)}}}}findRoot(e){return e.parent?this.findRoot(e.parent):e}updateTimelineDuration(){if(this._duration=0,!(!this.playableAsset||!this.playableAsset.tracks)){for(const e of this.playableAsset.tracks)if(e.muted!==!0){if(e.clips)for(const t of e.clips)t.end>this._duration&&(this._duration=t.end);if(e.markers)for(const 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 e=w.findObjectOfType(Eo,this.context);for(const t of this.playableAsset.tracks){const i=t.type,n=$0.createTrackFunctions[i];if(n!=null){const s=n(this,t);if(typeof s.evaluate=="function"){s.director=this,s.track=t,this._customTracks.push(s);continue}}if(t.type===Bi.Animation){if(!t.clips||t.clips.length<=0){qo&&console.warn("Animation track has no clips",t);continue}for(let s=t.outputs.length-1;s>=0;s--){let r=t.outputs[s];if(r instanceof k){const l=w.getOrAddComponent(r,ft);l&&(r=l)}const a=r?.gameObject?.animations;if(a){const l=new Ah;l.trackOffset=t.trackOffset,l.director=this,l.track=t;for(let c=0;c<t.clips.length;c++){const h=t.clips[c],d=h.asset;if(!d){console.error(`Timeline ${this.name}: clip #${c} on track "${t.name}" has no animation data`);continue}const p=d.clip;let m=p;if((typeof m=="string"||typeof m=="number")&&(m=a.find(g=>g.name===p)),qo&&console.log(d,p,"\u2192",m),!m){console.warn("Could not find animationClip for model",h,t.name,this.name,this.playableAsset?.name,a,r);continue}r instanceof ft&&r.runtimeAnimatorController&&(r.__internalDidAwakeAndStart||r.initializeRuntimeAnimatorController(),r.runtimeAnimatorController.mixer||r.runtimeAnimatorController.bind(r),l.mixer=r.runtimeAnimatorController.mixer),l.mixer||(l.mixer=new mm(r.gameObject),this.context.animations.registerAnimationMixer(l.mixer)),l.clips.push(m),l.mixer.uncacheAction(m),l.createHooks(h.asset,m);const f=l.mixer.clipAction(m);l.actions.push(f),l.models.push(h)}this._animationTracks.push(l)}}}else if(t.type===Bi.Audio){if(!t.clips||t.clips.length<=0)continue;const s=new ss;s.director=this,s.track=t,s.audioSource=t.outputs.find(r=>r instanceof Mi),this._audioTracks.push(s),e||(e=this.context.mainCameraComponent?.gameObject.addComponent(Eo)),s.listener=e.listener;for(let r=0;r<t.clips.length;r++){const a=t.clips[r];s.addModel(a)}}else if(t.type===Bi.Marker){if(t.markers){const s=new Ih;s.director=this,s.track=t;const r=new zp;r.director=this,r.track=t;for(const a of t.markers)switch(a.type){case b0.Signal:s.models.push(a),s.didTrigger.push(!1);break;default:r.models.push(a);break}if(s!==null&&s.models.length>0){const a=w.getComponent(this.gameObject,Eh);a&&(s.receivers.push(a),this._signalTracks.push(s))}r!==null&&r.models.length>0&&this._markerTracks.push(r)}}else if(t.type===Bi.Signal){const s=new Ih;if(s.director=this,s.track=t,t.markers)for(const r of t.markers)s.models.push(r),s.didTrigger.push(!1);for(const r of t.outputs)s.receivers.push(r);this._signalTracks.push(s)}else if(t.type===Bi.Control){const s=new Up;if(s.director=this,s.track=t,t.clips)for(const r of t.clips)s.models.push(r);s.resolveSourceObjects(this.context),this._controlTracks.push(s)}}}setAudioTracksAllowPlaying(e){for(const t of this._audioTracks)t.onAllowAudioChanged(e)}animationCallbackReceivers=[];registerAnimationCallback(e){this.animationCallbackReceivers.push(e)}unregisterAnimationCallback(e){const t=this.animationCallbackReceivers.indexOf(e);t!==-1&&this.animationCallbackReceivers.splice(t,1)}};C1([u()],_0.prototype,"playOnAwake"),C1([u()],_0.prototype,"extrapolationMode");let ra=_0;var H2=Object.defineProperty,Np=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&H2(e,t,n),n};class aa extends R{isGizmo=!1;translationSnap=1;rotationSnapAngle=15;scaleSnap=.25;get control(){return this._control}_control;orbit;onEnable(){if(!(this.isGizmo&&!fc)&&this.context.mainCamera&&(this._control||(this._control=new GC(this.context.mainCamera,this.context.renderer.domElement),this._control.enabled=!0,this._control.getRaycaster().layers.set(2),this._control.size=1,("_root"in this._control?this._control._root:this._control).traverse(e=>{const t=e;if(t.layers.set(2),t){const i=t.material;i&&(i.opacity=.3)}}),this.orbit=w.getComponentInParent(this.context.mainCamera,fe)??void 0),this._control)){const e=this._control.getHelper();this.context.scene.add(e),this._control.attach(this.gameObject),this._control?.addEventListener("dragging-changed",this.onControlChangedEvent),window.addEventListener("keydown",this.windowKeyDownListener),window.addEventListener("keyup",this.windowKeyUpListener)}}onDisable(){this._control?.getHelper()?.removeFromParent(),this._control?.removeEventListener("dragging-changed",this.onControlChangedEvent),window.removeEventListener("keydown",this.windowKeyDownListener),window.removeEventListener("keyup",this.windowKeyUpListener)}enableSnapping(){this._control&&(this._control.setTranslationSnap(this.translationSnap),this._control.setRotationSnap(yo.degToRad(this.rotationSnapAngle)),this._control.setScaleSnap(this.scaleSnap))}disableSnapping(){this._control&&(this._control.setTranslationSnap(null),this._control.setRotationSnap(null),this._control.setScaleSnap(null))}onControlChangedEvent=e=>{const t=this.orbit;if(t&&(t.enabled=!e.value),e.value){const i=this.gameObject.getComponentInParent(Cn);i&&(i.fastMode=!0,i.requestOwnership())}else{const i=this.gameObject.getComponentInParent(Cn);i&&(i.fastMode=!1)}};windowKeyDownListener=e=>{if(this.enabled&&this._control)switch(e.keyCode){case 81:this._control.setSpace(this._control.space==="local"?"world":"local");break;case 16:this.enableSnapping();break;case 87:this._control.setMode("translate");break;case 69:this._control.setMode("rotate");break;case 82:this._control.setMode("scale");break;case 187:case 107:this._control.setSize(this._control.size+.1);break;case 189:case 109:this._control.setSize(Math.max(this._control.size-.1,.1));break;case 88:this._control.showX=!this._control.showX;break;case 89:this._control.showY=!this._control.showY;break;case 90:this._control.showZ=!this._control.showZ;break;case 32:this._control.enabled=!this._control.enabled;break}};windowKeyUpListener=e=>{if(this.enabled)switch(e.keyCode){case 16:this.disableSnapping();break}}}Np([u()],aa.prototype,"isGizmo"),Np([u()],aa.prototype,"translationSnap"),Np([u()],aa.prototype,"rotationSnapAngle"),Np([u()],aa.prototype,"scaleSnap");var G2=Object.defineProperty,q2=Object.getOwnPropertyDescriptor,Vp=(o,e,t,i)=>{for(var n=i>1?void 0:i?q2(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&G2(e,t,n),n};class v0{texture=null;rect}Vp([u(Re)],v0.prototype,"texture",2);let Ml=class extends oh{set image(o){this.sprite||(this.sprite=new v0),this.sprite.texture=o,this.onAfterCreated()}get image(){return this.sprite?this.sprite.texture:null}get sprite(){return this._sprite}set sprite(o){this._sprite!==o&&(this._sprite=o,this.onAfterCreated())}_sprite;pixelsPerUnitMultiplier=1;isBuiltinSprite(){const o=this.sprite;switch(o?.texture?.name){case"InputFieldBackground":case"UISprite":case"Background":case"Knob":return!0}return!o?.texture?.name?.length&&o?.texture?.image?.width===32&&o?.texture?.image?.height===32}onBeforeCreate(o){super.onBeforeCreate(o),this.isBuiltinSprite()&&(o.borderRadius=5/this.pixelsPerUnitMultiplier,this.sprite?.texture?.name==="Knob"&&(o.borderRadius=999))}onAfterCreated(){this.__didAwake&&(super.onAfterCreated(),!this.isBuiltinSprite()&&this.setTexture(this.sprite?.texture))}};Vp([u(v0)],Ml.prototype,"sprite",1),Vp([u()],Ml.prototype,"pixelsPerUnitMultiplier",2);class Wp extends oh{get mainTexture(){return this._mainTexture}set mainTexture(e){this._mainTexture!==e&&(this._mainTexture=e,this.onAfterCreated())}_mainTexture;onAfterCreated(){this.__didAwake&&(super.onAfterCreated(),this.setTexture(this.mainTexture))}}Vp([u(Re)],Wp.prototype,"mainTexture",1);var X2=Object.defineProperty,Q2=Object.getOwnPropertyDescriptor,Fi=(o,e,t,i)=>{for(var n=i>1?void 0:i?Q2(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&X2(e,t,n),n};const la=x("debugbutton");class Ys{colorMultiplier;disabledColor;fadeDuration;highlightedColor;normalColor;pressedColor;selectedColor}Fi([u()],Ys.prototype,"colorMultiplier",2),Fi([u(oe)],Ys.prototype,"disabledColor",2),Fi([u()],Ys.prototype,"fadeDuration",2),Fi([u(oe)],Ys.prototype,"highlightedColor",2),Fi([u(oe)],Ys.prototype,"normalColor",2),Fi([u(oe)],Ys.prototype,"pressedColor",2),Fi([u(oe)],Ys.prototype,"selectedColor",2);class Y2{disabledTrigger;highlightedTrigger;normalTrigger;pressedTrigger;selectedTrigger}class Xo extends R{click(){this.onClick?.invoke()}onClick=new he;_isHovered=0;onPointerEnter(e){const t=e.event.pointerType==="mouse"&&e.button===0;t&&(this._isHovered+=1),la&&console.warn("Button Enter",t,this._isHovered,this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.highlightedTrigger):this.transition===1&&this.colors&&this._image?.setState("hovered"),t&&this.context.input.setCursor("pointer"))}onPointerExit(){this._isHovered-=1,this._isHovered<0&&(this._isHovered=0),la&&console.log("Button Exit",this._isHovered,this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this._isHovered>0||(this._isHovered=0,this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.normalTrigger):this.transition===1&&this.colors&&this._image?.setState("normal"),this.context.input.unsetCursor("pointer")))}onPointerDown(e){la&&console.log("Button Down",this.animationTriggers?.highlightedTrigger,this.animator),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this.animationTriggers.pressedTrigger):this.transition===1&&this.colors&&this._image?.setState("pressed"))}onPointerUp(e){la&&console.warn("Button Up",this.animationTriggers?.highlightedTrigger,this.animator,this._isHovered),this.interactable&&(this.transition==3&&this.animationTriggers&&this.animator?this.animator.setTrigger(this._isHovered?this.animationTriggers.highlightedTrigger:this.animationTriggers.normalTrigger):this.transition===1&&this.colors&&this._image?.setState(this._isHovered?"hovered":"normal"))}onPointerClick(e){if(this.interactable&&!(e.button!==0&&e.event.pointerType===Dd.Mouse)&&(la&&(console.warn("Button Click",this.onClick),Te("CLICKED button "+this.name+" at "+this.context.time.frameCount)),this.onClick&&this.onClick.listenerCount>0&&(this.onClick.invoke(),e.use(),la))){const t=this.gameObject.worldPosition;t.add(this.gameObject.worldUp.multiplyScalar(1+Math.random()*.5)),F.DrawLabel(t,"CLICK:"+Date.now(),.1,1+Math.random()*.5)}}colors;transition;animationTriggers;animator;set interactable(e){this._interactable=e,this._image&&(this._image.setInteractable(e),e?this._image.setState("normal"):this._image.setState("disabled"))}get interactable(){return this._interactable}_interactable=!0;set_interactable(e){this.interactable=e}awake(){super.awake(),la&&console.log(this),this._isInit=!1,this.init()}start(){this._image?.setInteractable(this.interactable),this.gameObject.getComponentInParent(qa)||this.gameObject.addComponent(Mu)}onEnable(){super.onEnable()}onDestroy(){this._isHovered&&this.context.input.unsetCursor("pointer")}_requestedAnimatorTrigger;*setAnimatorTriggerAtEndOfFrame(e){this._requestedAnimatorTrigger=e,yield,yield,this._requestedAnimatorTrigger==e&&this.animator?.setTrigger(e)}_isInit=!1;_image;init(){this._isInit||(this._isInit=!0,this._image=w.getComponent(this.gameObject,Ml),this._image&&(this.stateSetup(this._image),this.interactable?this._image.setState("normal"):this._image.setState("disabled")))}stateSetup(e){e.setInteractable(this.interactable);const t=this.getFinalColor(e.color,this.colors?.normalColor),i={state:"normal",attributes:{backgroundColor:t,backgroundOpacity:t.alpha}};e.setupState(i);const n=this.getFinalColor(e.color,this.colors?.highlightedColor),s={state:"hovered",attributes:{backgroundColor:n,backgroundOpacity:n.alpha}};e.setupState(s);const r=this.getFinalColor(e.color,this.colors?.pressedColor),a={state:"pressed",attributes:{backgroundColor:r,backgroundOpacity:r.alpha}};e.setupState(a);const l=this.getFinalColor(e.color,this.colors?.selectedColor),c={state:"selected",attributes:{backgroundColor:l,backgroundOpacity:l.alpha}};e.setupState(c);const h=this.getFinalColor(e.color,this.colors?.disabledColor),d={state:"disabled",attributes:{backgroundColor:h,backgroundOpacity:h.alpha}};e.setupState(d)}getFinalColor(e,t){return t?e.clone().multiply(t).convertLinearToSRGB():e.clone().convertLinearToSRGB()}}Fi([u(he)],Xo.prototype,"onClick",2),Fi([u(Ys)],Xo.prototype,"colors",2),Fi([u()],Xo.prototype,"transition",2),Fi([u(Y2)],Xo.prototype,"animationTriggers",2),Fi([u(ft)],Xo.prototype,"animator",2),Fi([u()],Xo.prototype,"interactable",1);var Z2=Object.defineProperty,$p=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&Z2(e,t,n),n};const Zs=x("debuginputfield"),Lh=class X extends R{get text(){return this.textComponent?.text??""}set text(e){this.textComponent&&(this.textComponent.text=e,this.placeholder&&(e.length>0?this.placeholder.gameObject.visible=!1:this.placeholder.gameObject.visible=!0))}get isFocused(){return X.active===this}textComponent;placeholder;onValueChanged;onEndEdit;static active=null;static activeTime=-1;static htmlField=null;static htmlFieldFocused=!1;inputEventFn;_iosEventFn;start(){Zs&&console.log(this.name,this)}onEnable(){X.htmlField||(X.htmlField=document.createElement("input"),X.htmlField.style.width="0px",X.htmlField.style.height="0px",X.htmlField.style.padding="0px",X.htmlField.style.border="none",X.htmlField.style.overflow="hidden",X.htmlField.style.caretColor="transparent",X.htmlField.style.outline="none",X.htmlField.classList.add("ar"),X.htmlField.onfocus=()=>X.htmlFieldFocused=!0,X.htmlField.onblur=()=>X.htmlFieldFocused=!1,document.body.append(X.htmlField)),this.inputEventFn||(this.inputEventFn=this.onInput.bind(this)),X.htmlField.addEventListener("keyup",this.inputEventFn),this.placeholder&&this.textComponent?.text.length&&w.setActive(this.placeholder.gameObject,!1),G.isiOS()&&(this._iosEventFn=this.processInputOniOS.bind(this),window.addEventListener("click",this._iosEventFn))}onDisable(){X.htmlField?.removeEventListener("keyup",this.inputEventFn),this.onDeselected(),this._iosEventFn&&window.removeEventListener("click",this._iosEventFn)}clear(){X.active===this&&X.htmlField?(X.htmlField.value="",this.setTextFromInputField()):(this.textComponent&&(this.textComponent.text=""),this.placeholder&&w.setActive(this.placeholder.gameObject,!0))}select(){this.onSelected()}deselect(){this.onDeselected()}onPointerEnter(e){e.event.pointerType==="mouse"&&e.button===0&&this.context.input.setCursor("text")}onPointerExit(e){this.context.input.unsetCursor("text")}onPointerClick(e){Zs&&console.log("CLICK",e,X.active),X.activeTime=this.context.time.time,X.active!==this&&this.startCoroutine(this.activeLoop(),xe.LateUpdate),this.selectInputField()}*activeLoop(){for(this.onSelected();X.active===this&&!(this.context.input.getPointerClicked(0)&&this.context.time.time-X.activeTime>.2);)this.setTextFromInputField(),yield;this.onDeselected()}onSelected(){if(X.active!==this&&(Zs&&console.log("Select",this.name,this,X.htmlField,this.context.isInXR,this.context.arOverlayElement,this.textComponent?.text,X.htmlField?.value),X.active?.onDeselected(),X.active=this,this.placeholder&&w.setActive(this.placeholder.gameObject,!1),X.htmlField)){if(X.htmlField.value=this.textComponent?.text||"",Zs&&console.log("set input field value",X.htmlField.value),this.context.isInXR){const e=this.context.arOverlayElement;e&&e.append(X.htmlField)}this.selectInputField()}}onDeselected(){X.active===this&&(X.active=null,Zs&&console.log("Deselect",this.name,this),X.htmlField&&(X.htmlField.blur(),document.body.append(X.htmlField)),this.placeholder&&(!this.textComponent||this.textComponent.text.length<=0)&&w.setActive(this.placeholder.gameObject,!0),X.htmlField&&this.onEndEdit?.invoke(X.htmlField.value))}update(){X.active===this&&this.textComponent?.markDirty()}onInput(e){if(X.active===this){if(Zs&&console.log(e.code,e,X.htmlField?.value,this.textComponent?.text),e.code==="Escape"||e.code==="Enter"){this.onDeselected();return}X.htmlField&&(this.textComponent&&(this.setTextFromInputField(),this.placeholder&&w.setActive(this.placeholder.gameObject,this.textComponent.text.length<=0)),this.selectInputField())}}setTextFromInputField(){if(this.textComponent&&X.htmlField){const e=this.textComponent.text,t=X.htmlField.value,i=this.textComponent.text!==X.htmlField.value;this.textComponent.text=X.htmlField.value,i&&(Zs&&console.log("[InputField] value changed:",t,e),this.onValueChanged?.invoke(t,e))}}selectInputField(){X.htmlField&&(Zs&&console.log("Focus Inputfield",X.htmlFieldFocused),X.htmlField.setSelectionRange(X.htmlField.value.length,X.htmlField.value.length),G.isiOS()?X.htmlField.focus({preventScroll:!0}):setTimeout(()=>X.htmlField?.focus(),1))}processInputOniOS(){const e=this.context.physics.raycast();if(!e.length)return;const t=e[0].object,i=gf(t);(i?.gameObject===this.gameObject||i?.gameObject.parent===this.gameObject)&&this.selectInputField()}};$p([u(Bt)],Lh.prototype,"textComponent"),$p([u(Bt)],Lh.prototype,"placeholder"),$p([u(he)],Lh.prototype,"onValueChanged"),$p([u(he)],Lh.prototype,"onEndEdit");let x0=Lh;var K2=Object.defineProperty,P1=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&K2(e,t,n),n};class jh extends R{id=null;keepAspect=!1;_object=null;onEnable(){if(this._object){this.gameObject.add(this._object);return}if(!this.id||!this.context.mainCamera)return;const e=document.getElementById(this.id);if(!e){console.warn('Could not find element with id "'+this.id+'"');return}e.style.display="block",e.style.visibility="hidden";const t=new qC;t.listenToPointerEvents(this.context.renderer,this.context.mainCamera),this.gameObject.add(t);const i=new XC(e);t.add(i),i.visible=!1;const n=i.material;n.transparent=!0,setTimeout(()=>{i.visible=!0;const s=Rd(this.gameObject).clone();Jl(this.gameObject,0,0,0),this.gameObject.updateMatrixWorld();const r=new bi;r.setFromObject(t),this.setWorldRotation(s.x,s.y,s.z);const a=r.max.x-r.min.x,l=r.max.y-r.min.y;if(this.keepAspect){const h=a/l;a>l?i.scale.set(1/a,1/l/h,1):i.scale.set(1/a*h,1/l,1)}else i.scale.set(1/a,1/l,1);const c=this.gameObject.scale;i.scale.multiply(c)},1)}onDisable(){this._object?.removeFromParent()}}P1([u()],jh.prototype,"id"),P1([u()],jh.prototype,"keepAspect");/* @license
|
|
1418
1418
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
1419
1419
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
1420
1420
|
* you may not use this file except in compliance with the License.
|
|
@@ -1474,7 +1474,7 @@ void main() {
|
|
|
1474
1474
|
#include <colorspace_fragment>
|
|
1475
1475
|
}
|
|
1476
1476
|
`;var _I=Object.defineProperty,Ks=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&_I(e,t,n),n};const Qp=x("debugimagetracking");class Vl{get url(){return this._trackedImage.image??""}get widthInMeters(){return this._trackedImage.widthInMeters??void 0}get bitmap(){return this._bitmap}get model(){return this._trackedImage}measuredSize;state;getPosition(e){return this.ensureTransformData(),e.copy(this._position),e}getQuaternion(e){return this.ensureTransformData(),e.copy(this._rotation),e}applyToObject(e,t=void 0){this.ensureTransformData();const i=e.position.distanceToSquared(this._position)/.05+e.quaternion.angleTo(this._rotation)/.05;t&&(t*=Math.max(1,i)),t===void 0||t>=1?(e.position.copy(this._position),e.quaternion.copy(this._rotation)):(t=Math.max(0,Math.min(1,t)),e.position.lerp(this._position,t),e.quaternion.slerp(this._rotation,t))}static _positionBuffer=new xi(()=>new b,20);static _rotationBuffer=new xi(()=>new U,20);_position;_rotation;ensureTransformData(){if(!this._position){this._position=Vl._positionBuffer.get(),this._rotation=Vl._rotationBuffer.get();const e=this._pose.transform,t=Y.active.convertSpace(e);this._position.copy(t?.position),this._rotation.copy(t?.quaternion)}}_trackingComponent;_trackedImage;_bitmap;_pose;constructor(e,t,i,n,s,r){this._trackingComponent=e,this._trackedImage=t,this._bitmap=i,this.measuredSize=n,this.state=s,this._pose=r}}class Zo{constructor(e){this.image=e.url,this.widthInMeters=e.widthInMeters,e.object instanceof k?this.object=new ie({asset:e.object}):this.object=e.object,e.createObjectInstance!==void 0&&(this.createObjectInstance=e.createObjectInstance),e.imageDoesNotMove!==void 0&&(this.imageDoesNotMove=e.imageDoesNotMove),e.hideWhenTrackingIsLost!==void 0&&(this.hideWhenTrackingIsLost=e.hideWhenTrackingIsLost)}image;widthInMeters=.25;object;createObjectInstance=!1;imageDoesNotMove=!1;hideWhenTrackingIsLost=!0;getNameFromUrl(){if(this.image){const e=this.image.split("/");return e[e.length-1]}return null}}Ks([u(URL)],Zo.prototype,"image"),Ks([u()],Zo.prototype,"widthInMeters"),Ks([u(ie)],Zo.prototype,"object"),Ks([u()],Zo.prototype,"createObjectInstance"),Ks([u()],Zo.prototype,"imageDoesNotMove"),Ks([u()],Zo.prototype,"hideWhenTrackingIsLost");class vI{constructor(e,t){this.exporter=e,this.component=t,Qp&&console.log(this),this.exporter.anchoringType="image"}isImageTrackingExtension=!0;get extensionName(){return"image-tracking"}shouldExport=!0;filename=null;imageModel=null;onBeforeBuildDocument(e){const t=this.exporter.extensions.filter(i=>{const n=i;return n.isImageTrackingExtension&&n.component.activeAndEnabled&&n.component.trackedImages?.length>0}).indexOf(this);this.shouldExport=t===0,this.shouldExport&&this.component.trackedImages?.length>1&&(Qp||A())&&(ge("USDZ: Only one tracked image is supported."),console.warn("USDZ: Only one tracked image is supported. Will choose the first one in the trackedImages list"))}onAfterHierarchy(e,t){if(!this.shouldExport)return;const i=G.getiOSVersion(),n=(i?parseInt(i.split(".")[0]):18)>=18?1:100;t.beginBlock('def Preliminary_ReferenceImage "AnchoringReferenceImage"'),t.appendLine("uniform asset image = @image_tracking/"+this.filename+"@"),t.appendLine("uniform double physicalWidth = "+(this.imageModel.widthInMeters*n).toFixed(8)),t.closeBlock()}async onAfterSerialize(e){if(!this.shouldExport)return;const t=this.imageModel,i=Vh.get(t.image),n=await(await(await Pw(i)).convertToBlob({type:"image/png"})).arrayBuffer();e.files["image_tracking/"+this.filename]=new Uint8Array(n)}onExportObject(e,t,i){if(!this.shouldExport)return;const n=this.component;if(!n||!n.trackedImages?.length||!n.activeAndEnabled)return;const s=n.trackedImages[0];if(s.object?.asset===e){this.imageModel=s,this.filename=s.getNameFromUrl()||"marker.png";const{scale:r,target:a}=this.exporter.getARScaleAndTarget();let l=e;const c=new ee;if(e!==a)for(;l&&l.parent&&l.parent!==a;)l=l.parent,c.premultiply(l.matrix);const h=c.clone().invert();t.setMatrix(h.scale(new b(r,r,r)))}}}class Nh extends R{setPrimaryImage(e){const t=this.trackedImages.indexOf(e);if(t>=0){const i=this.trackedImages[0];i!==e&&(this.trackedImages[0]=e,this.trackedImages[t]=i)}else console.warn(`[WebXRImageTracking] Can not set primary: image not found in 'trackedImages' array ${e.image}`)}addImage(e,t=!1){this.trackedImages.includes(e)||(this.trackedImages.push(e),L1(e.image)),t&&this.setPrimaryImage(e)}trackedImages=[];smooth=!0;trackedImageIndexMap=new Map;get supported(){return this._supported}_supported=!0;awake(){if(Qp&&console.log(this),!!this.trackedImages)for(const e of this.trackedImages)e.image&&L1(e.image)}onEnable(){oo.beforeExport.addEventListener(this.onBeforeUSDZExport)}onDisable(){oo.beforeExport.removeEventListener(this.onBeforeUSDZExport)}onBeforeUSDZExport=e=>{this.activeAndEnabled&&this.trackedImages?.length&&e.exporter.extensions.push(new vI(e.exporter,this))};onBeforeXR(e,t){if(this.trackedImages){t.optionalFeatures=t.optionalFeatures||[],t.optionalFeatures.includes("image-tracking")||t.optionalFeatures.push("image-tracking"),t.trackedImages=[];for(const i of this.trackedImages)if(i.image?.length&&i.widthInMeters>0){const n=Vh.get(i.image);n&&(this.trackedImageIndexMap.set(t.trackedImages.length,i),t.trackedImages.push({image:n,widthInMeters:i.widthInMeters}))}}}onEnterXR(e){if(this.trackedImages){for(const t of this.trackedImages)if(t.object?.asset){const i=t.object.asset;i.userData||(i.userData={});const n={visible:i.visible,parent:i.parent,matrix:i.matrix.clone()};i.userData["image-tracking"]=n}}for(const t of this.imageToObjectMap.values())t.frames=0}onLeaveXR(e){if(!this.supported&&G.isAndroidDevice()&&ge(this.webXRIncubationsWarning),this.trackedImages){for(const t of this.trackedImages)if(t.object?.asset){const i=t.object.asset;if(i.userData){const n=i.userData["image-tracking"];n&&(i.visible=n.visible,n.parent?.add(i),i.matrix.copy(n.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale)),delete i.userData["image-tracking"]}}}}imageToObjectMap=new Map;currentImages=[];webXRIncubationsWarning=`Image tracking is currently not supported on this device. On Chrome for Android, you can enable the <a target="_blank" href="#" onclick="() => console.log('I')">chrome://flags/#webxr-incubations</a> flag.`;onUpdateXR(e){this.currentImages.length=0;const t=e.xr.frame;if(!t)return;if("getImageTrackingResults"in t){if(e.xr.session.enabledFeatures?.includes("image-tracking")===!1)return;if(t.session&&typeof t.getImageTrackingResults=="function"){const n=t.getImageTrackingResults();if(n.length>0){const s=this.context.renderer.xr.getReferenceSpace();if(s){for(const r of n){const a=r.trackingState,l=r.index,c=this.trackedImageIndexMap.get(l);if(c){const h=t.getPose(r.imageSpace,s),d=new Vl(this,c,r.image,r.measuredSize,a,h);this.currentImages.push(d)}else Qp&&console.warn("No tracked image for index",l)}if(this.currentImages.length>0)try{this.dispatchEvent(new CustomEvent("image-tracking",{detail:this.currentImages})),this.onImageTrackingUpdate(this.currentImages)}catch(r){console.error(r)}}}}}else{this.didPrintWarning||(this.didPrintWarning=!0,console.log(this.webXRIncubationsWarning)),this._supported=!1,ge(this.webXRIncubationsWarning);return}const i=1e3;for(const[n,s]of this.imageToObjectMap){if(!s.object||!n||n.hideWhenTrackingIsLost===!1)continue;let r=!1;for(const a of this.currentImages)if(a.model===n){const l=Date.now()-s.lastTrackingTime;if(n.imageDoesNotMove||a.state==="tracked"||l<=i){r=!0;break}}r||w.setActive(s.object,!1)}}onImageTrackingUpdate=e=>{const t=Y.active;if(t)for(const i of e){const n=i.model,s=i.state==="tracked";if(!n.object)continue;let r=this.imageToObjectMap.get(n);if(r===void 0)r={object:null,frames:0,lastTrackingTime:Date.now()},this.imageToObjectMap.set(n,r),n.object.loadAssetAsync().then(a=>{if(n.createObjectInstance&&a&&(a=w.instantiate(a)),a){r.object=a;for(const l of a.getComponentsInChildren(Ti))l.setInstancingEnabled(!1);t.rig?(t.rig.gameObject.add(a),i.applyToObject(a),a.activeSelf||w.setActive(a,!0)):console.warn("XRImageTracking: missing XRRig")}});else{if(r.frames++,s&&(r.lastTrackingTime=Date.now()),n.imageDoesNotMove&&r.frames>10||!r.object)continue;t.rig&&(t.rig.gameObject.add(r.object),i.applyToObject(r.object,this.smooth?this.context.time.deltaTimeUnscaled*3:void 0),r.object.activeSelf||w.setActive(r.object,!0))}}}}Ks([u(Zo)],Nh.prototype,"trackedImages"),Ks([u()],Nh.prototype,"smooth");const Vh=new Map,Yp=new Map;async function L1(o){if(Vh.has(o))return Yp.has(o)?Yp.get(o):Promise.resolve(!0);const e=new Promise(t=>{Vh.set(o,null);const i=document.createElement("img");i.src=o,i.addEventListener("load",async()=>{const n=await createImageBitmap(i);Vh.set(o,n),t(!0)})});return Yp.set(o,e),e.finally(()=>{Yp.delete(o)}),e}var xI=Object.defineProperty,Ll=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&xI(e,t,n),n};const ha=x("debugplanetracking");class Ko extends R{dataTemplate;occluder=!0;initiateRoomCaptureIfNoData=!0;usePlaneData=!0;useMeshData=!0;runInVR=!0;get trackedPlanes(){return this._allPlanes.values()}get trackedMeshes(){return this._allMeshes.values()}onBeforeXR(e,t){e==="immersive-vr"&&!this.runInVR||(t.optionalFeatures=t.optionalFeatures||[],this.usePlaneData&&!t.optionalFeatures.includes("plane-detection")&&t.optionalFeatures.push("plane-detection"),this.useMeshData&&!t.optionalFeatures.includes("mesh-detection")&&t.optionalFeatures.push("mesh-detection"))}onEnterXR(e){for(const t of this._allPlanes.keys())this.removeData(t,this._allPlanes);for(const t of this._allMeshes.keys())this.removeData(t,this._allMeshes)}onLeaveXR(e){for(const t of this._allPlanes.keys())this.removeData(t,this._allPlanes);for(const t of this._allMeshes.keys())this.removeData(t,this._allMeshes)}onUpdateXR(e){if(!this.runInVR&&e.xr.isVR)return;const t=e.xr.rig;if(!t){console.warn("No XR rig found, cannot parent tracked planes to it");return}const i=e.xr.frame;if(!this.context.renderer.xr.getReferenceSpace())return;const n=i.detectedPlanes,s=i.detectedMeshes,r=n!==void 0&&n.size>0,a=s!==void 0&&s.size>0;if(this.initiateRoomCaptureIfNoData&&(!r&&!a&&this.firstTimeNoPlanesDetected<-10&&(this.firstTimeNoPlanesDetected=Date.now()),(r||a)&&(this.firstTimeNoPlanesDetected=-1),this.firstTimeNoPlanesDetected>0&&Date.now()-this.firstTimeNoPlanesDetected>2500&&"initiateRoomCapture"in i.session&&(i.session.initiateRoomCapture(),this.firstTimeNoPlanesDetected=-1)),n!==void 0&&this.processFrameData(e.xr,t.gameObject,i,n,this._allPlanes),s!==void 0&&this.processFrameData(e.xr,t.gameObject,i,s,this._allMeshes),ha){const l=this.context.mainCameraComponent.gameObject.worldPosition;for(const c of this._allPlanes.values())!c.mesh||!c.mesh.visible||(this.bounds.makeEmpty(),c.mesh.traverse(h=>{h instanceof H&&this.bounds.expandByObject(h)}),this.bounds.getCenter(this.center),this.labelOffset.copy(l).sub(this.center).normalize().multiplyScalar(.1),F.DrawLabel(this.center.add(this.labelOffset),(c.xrData.semanticLabel||"plane").toUpperCase()+`
|
|
1477
|
-
`+c.xrData.lastChangedTime.toFixed(2),.02))}}bounds=new bi;center=new b;labelOffset=new b;removeData(e,t){const i=t.get(e);if(!i)return;t.delete(e),ha&&console.log("Plane no longer tracked, id="+i.id),i.mesh&&(i.mesh.removeFromParent(),i.mesh.traverse(s=>{const r=s.userData.normalsHelper;r?(r.dispose(),r.removeFromParent()):ha&&console.warn("No normals helper found for mesh",i.mesh)}),Ci(i.mesh,!0,!0));const n=new CustomEvent("plane-tracking",{detail:{type:"plane-removed",context:i}});this.dispatchEvent(n)}_dataId=1;_allPlanes=new Map;_allMeshes=new Map;firstTimeNoPlanesDetected=-100;makeOccluder=(e,t,i=!1)=>{if(t){if(t instanceof Array){for(const n of t)this.makeOccluder(e,n,i);return}!i&&!t.name.toLowerCase().includes("occlu")||(t.colorWrite=!1,t.depthTest=!0,t.depthWrite=!0,t.transparent=!1,t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=.1,e.renderOrder=-1e3)}};processFrameData(e,t,i,n,s){const r=this.context.renderer.xr.getReferenceSpace();if(r){for(const a of s.keys())n.has(a)||this.removeData(a,s);for(const a of n){const l="planeSpace"in a?a.planeSpace:"meshSpace"in a?a.meshSpace:void 0;if(!l)continue;const c=i.getPose(l,r);let h;if(s.has(a)){const d=s.get(a);if(h=d.mesh,d.timestamp<a.lastChangedTime){if(d.timestamp=a.lastChangedTime,d.mesh){const m=this.createGeometry(a);if(d.mesh instanceof H)d.mesh.geometry.dispose(),d.mesh.geometry=m,this.makeOccluder(d.mesh,d.mesh.material);else if(d.mesh instanceof cs)for(const f of d.mesh.children)f instanceof H&&(f.geometry.dispose(),f.geometry=m,this.makeOccluder(f,f.material));if(d.collider){const f=d.mesh;d.collider.sharedMesh=f,d.collider.convex=this.checkIfContextShouldBeConvex(f,d.xrData),d.collider.onDisable(),d.collider.onEnable()}ha&&(console.log("Plane updated, id="+d.id,d),d.mesh.traverse(f=>{if(!(f instanceof H))return;const g=f.userData.normalsHelper;g&&g.update()}))}const p=new CustomEvent("plane-tracking",{detail:{type:"plane-updated",context:d}});this.dispatchEvent(p)}}else{if(!this.dataTemplate){const d=new H;ha?d.material=new PC:this.occluder?(d.material=new we,this.makeOccluder(d,d.material,!0)):d.material=new we({wireframe:!0,opacity:.5,transparent:!0,color:3355443}),this.dataTemplate=new ie("","",d)}if(!this.dataTemplate.asset)this.dataTemplate.loadAssetAsync();else{const d=w.instantiate(this.dataTemplate.asset);if(d.name="xr-tracked-plane",h=d,Ym(d,!1),d instanceof H)Pe(d.geometry),d.geometry=this.createGeometry(a),this.makeOccluder(d,d.material,this.occluder&&!this.dataTemplate);else if(d instanceof cs)for(const f of d.children)f instanceof H&&(Pe(f.geometry),f.geometry=this.createGeometry(a),this.makeOccluder(f,f.material,this.occluder&&!this.dataTemplate));const p=d.getComponent(Ms);if(p){const f=d;p.sharedMesh=f,p.convex=this.checkIfContextShouldBeConvex(f,a),p.onDisable(),p.onEnable()}d.matrixAutoUpdate=!1,d.matrixWorldNeedsUpdate=!0,t.add(d);const m={id:this._dataId++,xrData:a,timestamp:a.lastChangedTime,mesh:d,collider:p};s.set(a,m),ha&&console.log("New plane detected, id="+m.id,m,{hasCollider:!!p,isGroup:d instanceof cs});try{const f=new CustomEvent("plane-tracking",{detail:{type:"plane-added",context:m}});this.dispatchEvent(f)}catch(f){console.error(f)}}}h&&(c?(h.visible=!0,h.matrix.fromArray(c.transform.matrix),h.matrix.premultiply(this._flipForwardMatrix)):h.visible=!1,ha&&h.traverse(d=>{if(d instanceof H)if(d.userData.normalsHelper)d.userData.normalsHelper.update();else{const p=new QC(d,.05,255);p.layers.disableAll(),p.layers.set(2),this.context.scene.add(p),d.userData.normalsHelper=p}}))}}}_flipForwardMatrix=new ee().makeRotationY(Math.PI);checkIfContextShouldBeConvex(e,t){if(!e)return!0;if(e){const i=new bi;i.expandByObject(e);const n=new b;i.getSize(n);let s=!0;return n.x>2&&n.y>2&&n.z>1.5&&(s=!1),s&&"semanticLabel"in t&&t.semanticLabel==="wall"&&(s=!0),s}return!0}createGeometry(e){return"polygon"in e?this.createPlaneGeometry(e.polygon):"vertices"in e&&"indices"in e?this.createMeshGeometry(e.vertices,e.indices):new mn}_verticesCache=new Map;createMeshGeometry(e,t){const i=e.toString()+"_"+t.toString();if(this._verticesCache.has(i))return this._verticesCache.get(i);const n=new mn;n.setIndex(new pt(t,1)),n.setAttribute("position",new pt(e,3));const s=Array();for(let r=0;r<e.length;r+=3)s.push(e[r],e[r+2]);return n.setAttribute("uv",new pt(e,3)),n.computeVertexNormals(),this._verticesCache.set(i,n),n}createPlaneGeometry(e){const t=new mn,i=[],n=[];e.forEach(p=>{i.push(p.x,p.y,p.z),n.push(p.x,p.z)});const s=new b(i[0],i[1],i[2]),r=new b(i[3],i[4],i[5]),a=new b(i[6],i[7],i[8]),l=new b,c=new b;l.subVectors(r,s),c.subVectors(a,s),l.cross(c),l.normalize();const h=[];for(let p=0;p<i.length/3;p++)h.push(l.x,l.y,l.z);const d=[];for(let p=2;p<e.length;++p)d.push(0,p-1,p);return t.setAttribute("position",new pt(new Float32Array(i),3)),t.setAttribute("uv",new pt(new Float32Array(n),2)),t.setAttribute("normal",new pt(new Float32Array(h),3)),t.setIndex(d),t.computeBoundingBox(),t.computeBoundingSphere(),t}}Ll([u(ie)],Ko.prototype,"dataTemplate"),Ll([u()],Ko.prototype,"occluder"),Ll([u()],Ko.prototype,"initiateRoomCaptureIfNoData"),Ll([u()],Ko.prototype,"usePlaneData"),Ll([u()],Ko.prototype,"useMeshData"),Ll([u()],Ko.prototype,"runInVR");var wI=Object.defineProperty,SI=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&wI(e,t,n),n};const j1=x("debugwebxr");class Zp extends R{priority=0;get isActive(){return this.activeAndEnabled&&this.gameObject.visible}setAsActiveXRRig(){Y.active?.setRigActive(this)}setPriority(e){this.priority=e}awake(){if(j1){const e=new k;e.position.y+=.5,this.gameObject.add(e);const t=e.addNewComponent(qr);t&&(t.isGizmo=!1);const i=new _i(.5);this.gameObject.add(i)}}isXRRig(){return!0}supportsXR(e){return!0}_startScale;onEnterXR(e){this._startScale=this.gameObject.scale.clone(),e.xr.addRig(this),j1&&console.log("WebXR: add Rig",this.name,this.priority)}onLeaveXR(e){e.xr.removeRig(this),this._startScale&&this.gameObject&&this.gameObject.scale.copy(this._startScale)}}SI([u()],Zp.prototype,"priority");class CI extends R{toggleKey="KeyP";update(){this.context.input.isKeyDown(this.toggleKey)&&this.context.domElement.classList.toggle("presentation-mode")}}C.add("AlignmentConstraint",Mc),C.add("Animation",Lt),C.add("Animator",ft),C.add("AudioListener",Eo),C.add("AudioSource",Mi),C.add("Avatar_Brain_LookAt",jc),C.add("Avatar_MouthShapes",Dc),C.add("Avatar_MustacheShake",wf),C.add("AvatarBlink_Simple",jr),C.add("AvatarEyeLook_Rotation",Cf),C.add("AxesHelper",Ya),C.add("BasicIKConstraint",Of),C.add("BoxHelperComponent",wt),C.add("Camera",si),C.add("CharacterController",Dr),C.add("CharacterControllerInput",Lo),C.add("Collider",ai),C.add("SphereCollider",Za),C.add("BoxCollider",Lu),C.add("MeshCollider",Ms),C.add("CapsuleCollider",Ao),C.add("ContactShadows",Fc),C.add("LogStats",Rf),C.add("DeleteBox",or),C.add("Deletable",Ef),C.add("DeviceFlag",ju),C.add("DragControls",zr),C.add("DropListener",jo),C.add("Duplicatable",Bf),C.add("EventListEvent",Pu),C.add("EventTrigger",zu),C.add("GltfExportBox",Qf),C.add("GltfExport",Zf),C.add("VariantAction",ay),C.add("ChangeTransformOnClick",Wr),C.add("ChangeMaterialOnClick",cy),C.add("SetActiveOnClick",hy),C.add("HideOnStart",dn),C.add("EmphasizeOnClick",cl),C.add("PlayAudioOnClick",As),C.add("PlayAnimationOnClick",qc),C.add("PreliminaryAction",hl),C.add("PreliminaryTrigger",Xc),C.add("VisibilityAction",Qc),C.add("TapGestureTrigger",uy),C.add("USDZExporter",oo),C.add("Fog",bl),C.add("BoxGizmo",qr),C.add("GridHelper",_l),C.add("GroundProjectedEnv",qn),C.add("UsageMarker",zc),C.add("Interactable",Tf),C.add("FixedJoint",Uy),C.add("HingeJoint",rh),C.add("Light",di),C.add("LODGroup",lh),C.add("LookAtConstraint",Er),C.add("NeedleMenu",io),C.add("NestedGltf",ch),C.add("Networking",$y),C.add("OffsetConstraint",Xr),C.add("CameraTargetReachedEvent",Lc),C.add("OrbitControls",fe),C.add("ParticleSystemRenderer",sn),C.add("ParticleSystem",ph),C.add("Attractor",Sl),C.add("PlayerColor",Nl),C.add("Antialiasing",gh),C.add("BloomEffect",Cp),C.add("ChromaticAberration",fh),C.add("ColorAdjustments",Gs),C.add("DepthOfField",Tn),C.add("EffectWrapper",bh),C.add("PixelationEffect",_h),C.add("ScreenSpaceAmbientOcclusion",Ho),C.add("ScreenSpaceAmbientOcclusionN8",En),C.add("SharpeningEffect",xh),C.add("TiltShiftEffect",ro),C.add("ToneMappingEffect",Hs),C.add("Vignette",ta),C.add("Volume",Pl),C.add("ReflectionProbe",Vc),C.add("Renderer",Ti),C.add("MeshRenderer",Wc),C.add("SkinnedMeshRenderer",Xf),C.add("Rigidbody",Ze),C.add("SceneSwitcher",Xe),C.add("ScreenCapture",Xs),C.add("ShadowCatcher",Ph),C.add("RemoteSkybox",Ep),C.add("SmoothFollow",Ip),C.add("SpatialTriggerReceiver",ao),C.add("SpatialTrigger",Lp),C.add("SpectatorCamera",jp),C.add("SplineContainer",oa),C.add("SplineWalker",An),C.add("SpriteRenderer",ci),C.add("SyncedCamera",p0),C.add("SyncedRoom",In),C.add("SyncedTransform",Cn),C.add("TestRunner",f0),C.add("TestSimulateUserData",y0),C.add("PlayableDirector",ra),C.add("SignalReceiver",Eh),C.add("AnimationTrackHandler",Ah),C.add("AudioTrackHandler",ss),C.add("MarkerTrackHandler",zp),C.add("SignalTrackHandler",Ih),C.add("ControlTrackHandler",Up),C.add("TransformGizmo",aa),C.add("BaseUIComponent",ln),C.add("UIRootComponent",eh),C.add("Button",Xo),C.add("Canvas",yl),C.add("CanvasGroup",zs),C.add("EventSystem",ei),C.add("Graphic",nh),C.add("MaskableGraphic",oh),C.add("Image",Ml),C.add("RawImage",Wp),C.add("InputField",x0),C.add("VerticalLayoutGroup",Ry),C.add("HorizontalLayoutGroup",Ty),C.add("GridLayoutGroup",Ey),C.add("Outline",gl),C.add("ObjectRaycaster",ki),C.add("GraphicRaycaster",Mu),C.add("SpatialGrabRaycaster",ua),C.add("RectTransform",Mn),C.add("SpatialHtml",jh),C.add("Text",Bt),C.add("EnvironmentScene",Hp),C.add("LookAt",w0),C.add("OpenURL",Rl),C.add("VideoPlayer",ht),C.add("Voip",ks),C.add("ClickThrough",qp),C.add("CursorFollow",Bh),C.add("HoverAnimation",uo),C.add("ScrollFollow",Qo),C.add("ResponsiveBox",zi),C.add("Avatar",Ls),C.add("XRControllerFollow",Yo),C.add("XRControllerModel",Uo),C.add("XRControllerMovement",Ei),C.add("TeleportTarget",sp),C.add("WebARCameraBackground",Uh),C.add("WebARSessionRoot",Ui),C.add("WebXR",rp),C.add("AvatarMarker",Le),C.add("WebXRImageTracking",Nh),C.add("WebXRPlaneTracking",Ko),C.add("XRRig",Zp),C.add("XRFlag",Ji),C.add("PlayerSync",by),C.add("PlayerState",On),C.add("PresentationMode",CI);const Wh=gt,PI=x("debugtypestore");PI&&console.log(C);function OI(o,e){const t=bv(o,e);return t!==void 0?t:null}const kI=new jk,M0=Symbol("deserialize-queue");async function MI(o,e,t,i=null,n){if(!t){console.debug("Can not create component instances: gltf is null");return}const s=[];let r=i;typeof r=="number"&&(r=new At(i));const a=e.indexOf("?");e=a===-1?e:e.substring(0,a);const l=new Ug(t.scene);l.gltfId=e,l.context=o,l.gltf=t,l.nodeToObject=n?.nodeToObjectMap,l.implementationInformation=kI;let c=o[M0];if(c||(c=o[M0]=[]),t.scenes)for(const h of t.scenes)await E0(l,h,c,s,0);if(t.children)for(const h of t.children)await E0(l,h,c,s,0);o.new_scripts_pre_setup_callbacks.push(()=>{const h=o[M0];if(h){for(const d of h)RI(d,l);h.length=0}if(r){const d={},p=[];T0(t,r,d,p);for(const m of t.scenes)T0(m,r,d,p);for(const m of p)m.resolveGuids(d)}})}const R0=Symbol("original-component-name"),jl=new Map;function T0(o,e,t,i){if(e===null||!o)return;const n=o.guid,s=o.guid;s?.length&&(jl.has(s)||(Wh&&console.log('Creating InstanceIdProvider with key "'+s+'" for object '+o.name),jl.set(s,new At(s))));const r=s&&jl.get(s)||e;if(o.guid=r.generateUUID(),n&&n!=="invalid"&&(t[n]=o.guid),o&&o.userData&&o.userData.components)for(const a of o.userData.components){if(a===null)continue;const l=a.guid;l?jl.has(l)||(Wh&&console.log('Creating InstanceIdProvider with key "'+l+'" for component '+a[R0]),jl.set(l,new At(l))):Wh&&console.warn("Can not create IdProvider: component "+a[R0]+" has no guid",a.guid);const c=jl.get(l)||e,h=a.guid;a.guid=c.generateUUID(),h&&h!=="invalid"&&(t[h]=a.guid),a.resolveGuids&&i.push(a)}if(o.children)for(const a of o.children)T0(a,e,t,i)}const $h=[];async function E0(o,e,t,i,n){if(!e)return;const s=e.userData;if(s){const r=s.builtin_components;if(r&&r.length>0)for(const a of r)try{if(a===null)continue;const l=C.get(a.name);if(l!=null){const c=new l;c.sourceId=o.gltfId,Fa(c,a,o.implementationInformation),c.context=o.context,"guid"in a&&(c[oc]=a.guid),c[R0]=a.name,Sr(e,c,!1),t.push({instance:c,compData:a,obj:e}),c.isCamera&&o.context&&o.context.mainCamera===null&&c.tag==="MainCamera"&&o.context.setCurrentCamera(c),o.context?.physics?.engine?.isInitialized===!1&&(c.isCollider||c.isRigidbody)&&o.context?.physics.engine?.initialize()}else Wh&&console.debug("unknown component: "+a.name),$h.includes(a.name)||$h.push(a.name)}catch(l){console.error(a.name+" - "+l.message,l)}}if(e.children)for(const r of e.children)await E0(o,r,t,i,n+1);if($h.length>0&&n===0){const r=$h.join(", ");console.warn(`Unknown components in scene: ${r}`),$h.length=0,$i()&&Te(`<strong>Unknown components in scene</strong>:
|
|
1477
|
+
`+c.xrData.lastChangedTime.toFixed(2),.02))}}bounds=new bi;center=new b;labelOffset=new b;removeData(e,t){const i=t.get(e);if(!i)return;t.delete(e),ha&&console.log("Plane no longer tracked, id="+i.id),i.mesh&&(i.mesh.removeFromParent(),i.mesh.traverse(s=>{const r=s.userData.normalsHelper;r?(r.dispose(),r.removeFromParent()):ha&&console.warn("No normals helper found for mesh",i.mesh)}),Ci(i.mesh,!0,!0));const n=new CustomEvent("plane-tracking",{detail:{type:"plane-removed",context:i}});this.dispatchEvent(n)}_dataId=1;_allPlanes=new Map;_allMeshes=new Map;firstTimeNoPlanesDetected=-100;makeOccluder=(e,t,i=!1)=>{if(t){if(t instanceof Array){for(const n of t)this.makeOccluder(e,n,i);return}!i&&!t.name.toLowerCase().includes("occlu")||(t.colorWrite=!1,t.depthTest=!0,t.depthWrite=!0,t.transparent=!1,t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=.1,e.renderOrder=-1e3)}};processFrameData(e,t,i,n,s){const r=this.context.renderer.xr.getReferenceSpace();if(r){for(const a of s.keys())n.has(a)||this.removeData(a,s);for(const a of n){const l="planeSpace"in a?a.planeSpace:"meshSpace"in a?a.meshSpace:void 0;if(!l)continue;const c=i.getPose(l,r);let h;if(s.has(a)){const d=s.get(a);if(h=d.mesh,d.timestamp<a.lastChangedTime){if(d.timestamp=a.lastChangedTime,d.mesh){const m=this.createGeometry(a);if(d.mesh instanceof H)d.mesh.geometry.dispose(),d.mesh.geometry=m,this.makeOccluder(d.mesh,d.mesh.material);else if(d.mesh instanceof cs)for(const f of d.mesh.children)f instanceof H&&(f.geometry.dispose(),f.geometry=m,this.makeOccluder(f,f.material));if(d.collider){const f=d.mesh;d.collider.sharedMesh=f,d.collider.convex=this.checkIfContextShouldBeConvex(f,d.xrData),d.collider.onDisable(),d.collider.onEnable()}ha&&(console.log("Plane updated, id="+d.id,d),d.mesh.traverse(f=>{if(!(f instanceof H))return;const g=f.userData.normalsHelper;g&&g.update()}))}const p=new CustomEvent("plane-tracking",{detail:{type:"plane-updated",context:d}});this.dispatchEvent(p)}}else{if(!this.dataTemplate){const d=new H;ha?d.material=new PC:this.occluder?(d.material=new we,this.makeOccluder(d,d.material,!0)):d.material=new we({wireframe:!0,opacity:.5,transparent:!0,color:3355443}),this.dataTemplate=new ie("","",d)}if(!this.dataTemplate.asset)this.dataTemplate.loadAssetAsync();else{const d=w.instantiate(this.dataTemplate.asset);if(d.name="xr-tracked-plane",h=d,Ym(d,!1),d instanceof H)Pe(d.geometry),d.geometry=this.createGeometry(a),this.makeOccluder(d,d.material,this.occluder&&!this.dataTemplate);else if(d instanceof cs)for(const f of d.children)f instanceof H&&(Pe(f.geometry),f.geometry=this.createGeometry(a),this.makeOccluder(f,f.material,this.occluder&&!this.dataTemplate));const p=d.getComponent(Ms);if(p){const f=d;p.sharedMesh=f,p.convex=this.checkIfContextShouldBeConvex(f,a),p.onDisable(),p.onEnable()}d.matrixAutoUpdate=!1,d.matrixWorldNeedsUpdate=!0,t.add(d);const m={id:this._dataId++,xrData:a,timestamp:a.lastChangedTime,mesh:d,collider:p};s.set(a,m),ha&&console.log("New plane detected, id="+m.id,m,{hasCollider:!!p,isGroup:d instanceof cs});try{const f=new CustomEvent("plane-tracking",{detail:{type:"plane-added",context:m}});this.dispatchEvent(f)}catch(f){console.error(f)}}}h&&(c?(h.visible=!0,h.matrix.fromArray(c.transform.matrix),h.matrix.premultiply(this._flipForwardMatrix)):h.visible=!1,ha&&h.traverse(d=>{if(d instanceof H)if(d.userData.normalsHelper)d.userData.normalsHelper.update();else{const p=new QC(d,.05,255);p.layers.disableAll(),p.layers.set(2),this.context.scene.add(p),d.userData.normalsHelper=p}}))}}}_flipForwardMatrix=new ee().makeRotationY(Math.PI);checkIfContextShouldBeConvex(e,t){if(!e)return!0;if(e){const i=new bi;i.expandByObject(e);const n=new b;i.getSize(n);let s=!0;return n.x>2&&n.y>2&&n.z>1.5&&(s=!1),s&&"semanticLabel"in t&&t.semanticLabel==="wall"&&(s=!0),s}return!0}createGeometry(e){return"polygon"in e?this.createPlaneGeometry(e.polygon):"vertices"in e&&"indices"in e?this.createMeshGeometry(e.vertices,e.indices):new mn}_verticesCache=new Map;createMeshGeometry(e,t){const i=e.toString()+"_"+t.toString();if(this._verticesCache.has(i))return this._verticesCache.get(i);const n=new mn;n.setIndex(new pt(t,1)),n.setAttribute("position",new pt(e,3));const s=Array();for(let r=0;r<e.length;r+=3)s.push(e[r],e[r+2]);return n.setAttribute("uv",new pt(e,3)),n.computeVertexNormals(),this._verticesCache.set(i,n),n}createPlaneGeometry(e){const t=new mn,i=[],n=[];e.forEach(p=>{i.push(p.x,p.y,p.z),n.push(p.x,p.z)});const s=new b(i[0],i[1],i[2]),r=new b(i[3],i[4],i[5]),a=new b(i[6],i[7],i[8]),l=new b,c=new b;l.subVectors(r,s),c.subVectors(a,s),l.cross(c),l.normalize();const h=[];for(let p=0;p<i.length/3;p++)h.push(l.x,l.y,l.z);const d=[];for(let p=2;p<e.length;++p)d.push(0,p-1,p);return t.setAttribute("position",new pt(new Float32Array(i),3)),t.setAttribute("uv",new pt(new Float32Array(n),2)),t.setAttribute("normal",new pt(new Float32Array(h),3)),t.setIndex(d),t.computeBoundingBox(),t.computeBoundingSphere(),t}}Ll([u(ie)],Ko.prototype,"dataTemplate"),Ll([u()],Ko.prototype,"occluder"),Ll([u()],Ko.prototype,"initiateRoomCaptureIfNoData"),Ll([u()],Ko.prototype,"usePlaneData"),Ll([u()],Ko.prototype,"useMeshData"),Ll([u()],Ko.prototype,"runInVR");var wI=Object.defineProperty,SI=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&wI(e,t,n),n};const j1=x("debugwebxr");class Zp extends R{priority=0;get isActive(){return this.activeAndEnabled&&this.gameObject.visible}setAsActiveXRRig(){Y.active?.setRigActive(this)}setPriority(e){this.priority=e}awake(){if(j1){const e=new k;e.position.y+=.5,this.gameObject.add(e);const t=e.addNewComponent(qr);t&&(t.isGizmo=!1);const i=new _i(.5);this.gameObject.add(i)}}isXRRig(){return!0}supportsXR(e){return!0}_startScale;onEnterXR(e){this._startScale=this.gameObject.scale.clone(),e.xr.addRig(this),j1&&console.log("WebXR: add Rig",this.name,this.priority)}onLeaveXR(e){e.xr.removeRig(this),this._startScale&&this.gameObject&&this.gameObject.scale.copy(this._startScale)}}SI([u()],Zp.prototype,"priority");class CI extends R{toggleKey="KeyP";update(){this.context.input.isKeyDown(this.toggleKey)&&this.context.domElement.classList.toggle("presentation-mode")}}C.add("AlignmentConstraint",Mc),C.add("Animation",Lt),C.add("Animator",ft),C.add("AudioListener",Eo),C.add("AudioSource",Mi),C.add("Avatar_Brain_LookAt",jc),C.add("Avatar_MouthShapes",Dc),C.add("Avatar_MustacheShake",wf),C.add("AvatarBlink_Simple",jr),C.add("AvatarEyeLook_Rotation",Cf),C.add("AxesHelper",Ya),C.add("BasicIKConstraint",Of),C.add("BoxHelperComponent",wt),C.add("Camera",si),C.add("CharacterController",Dr),C.add("CharacterControllerInput",Lo),C.add("Collider",ai),C.add("SphereCollider",Za),C.add("BoxCollider",Lu),C.add("MeshCollider",Ms),C.add("CapsuleCollider",Ao),C.add("ContactShadows",Fc),C.add("LogStats",Rf),C.add("DeleteBox",or),C.add("Deletable",Ef),C.add("DeviceFlag",ju),C.add("DragControls",zr),C.add("DropListener",jo),C.add("Duplicatable",Bf),C.add("EventListEvent",Pu),C.add("EventTrigger",zu),C.add("GltfExportBox",Qf),C.add("GltfExport",Zf),C.add("VariantAction",ay),C.add("ChangeTransformOnClick",Wr),C.add("ChangeMaterialOnClick",cy),C.add("SetActiveOnClick",hy),C.add("HideOnStart",dn),C.add("EmphasizeOnClick",cl),C.add("PlayAudioOnClick",As),C.add("PlayAnimationOnClick",qc),C.add("PreliminaryAction",hl),C.add("PreliminaryTrigger",Xc),C.add("VisibilityAction",Qc),C.add("TapGestureTrigger",uy),C.add("USDZExporter",oo),C.add("Fog",bl),C.add("BoxGizmo",qr),C.add("GridHelper",_l),C.add("GroundProjectedEnv",qn),C.add("UsageMarker",zc),C.add("Interactable",Tf),C.add("FixedJoint",Uy),C.add("HingeJoint",rh),C.add("Light",di),C.add("LODGroup",lh),C.add("LookAtConstraint",Er),C.add("NeedleMenu",io),C.add("NestedGltf",ch),C.add("Networking",$y),C.add("OffsetConstraint",Xr),C.add("CameraTargetReachedEvent",Lc),C.add("OrbitControls",fe),C.add("ParticleSystemRenderer",sn),C.add("ParticleSystem",ph),C.add("Attractor",Sl),C.add("PlayerColor",Nl),C.add("Antialiasing",gh),C.add("BloomEffect",Cp),C.add("ChromaticAberration",fh),C.add("ColorAdjustments",Gs),C.add("DepthOfField",Tn),C.add("EffectWrapper",bh),C.add("PixelationEffect",_h),C.add("ScreenSpaceAmbientOcclusion",Ho),C.add("ScreenSpaceAmbientOcclusionN8",En),C.add("SharpeningEffect",xh),C.add("TiltShiftEffect",ro),C.add("ToneMappingEffect",Hs),C.add("Vignette",ta),C.add("Volume",Pl),C.add("ReflectionProbe",Vc),C.add("Renderer",Ti),C.add("MeshRenderer",Wc),C.add("SkinnedMeshRenderer",Xf),C.add("Rigidbody",Ze),C.add("SceneSwitcher",Xe),C.add("ScreenCapture",Xs),C.add("ShadowCatcher",Ph),C.add("RemoteSkybox",Ep),C.add("SmoothFollow",Ip),C.add("SpatialTriggerReceiver",ao),C.add("SpatialTrigger",Lp),C.add("SpectatorCamera",jp),C.add("SplineContainer",oa),C.add("SplineWalker",An),C.add("SpriteRenderer",ci),C.add("SyncedCamera",p0),C.add("SyncedRoom",In),C.add("SyncedTransform",Cn),C.add("TestRunner",f0),C.add("TestSimulateUserData",y0),C.add("PlayableDirector",ra),C.add("SignalReceiver",Eh),C.add("AnimationTrackHandler",Ah),C.add("AudioTrackHandler",ss),C.add("MarkerTrackHandler",zp),C.add("SignalTrackHandler",Ih),C.add("ControlTrackHandler",Up),C.add("TransformGizmo",aa),C.add("BaseUIComponent",ln),C.add("UIRootComponent",eh),C.add("Button",Xo),C.add("Canvas",yl),C.add("CanvasGroup",zs),C.add("EventSystem",ei),C.add("Graphic",nh),C.add("MaskableGraphic",oh),C.add("Image",Ml),C.add("RawImage",Wp),C.add("InputField",x0),C.add("VerticalLayoutGroup",Ry),C.add("HorizontalLayoutGroup",Ty),C.add("GridLayoutGroup",Ey),C.add("Outline",gl),C.add("ObjectRaycaster",ki),C.add("GraphicRaycaster",Mu),C.add("SpatialGrabRaycaster",ua),C.add("RectTransform",Mn),C.add("SpatialHtml",jh),C.add("Text",Bt),C.add("EnvironmentScene",Hp),C.add("LookAt",w0),C.add("OpenURL",Rl),C.add("VideoPlayer",ht),C.add("Voip",ks),C.add("ClickThrough",qp),C.add("CursorFollow",Bh),C.add("HoverAnimation",uo),C.add("ScrollFollow",Qo),C.add("ViewBox",zi),C.add("Avatar",Ls),C.add("XRControllerFollow",Yo),C.add("XRControllerModel",Uo),C.add("XRControllerMovement",Ei),C.add("TeleportTarget",sp),C.add("WebARCameraBackground",Uh),C.add("WebARSessionRoot",Ui),C.add("WebXR",rp),C.add("AvatarMarker",Le),C.add("WebXRImageTracking",Nh),C.add("WebXRPlaneTracking",Ko),C.add("XRRig",Zp),C.add("XRFlag",Ji),C.add("PlayerSync",by),C.add("PlayerState",On),C.add("PresentationMode",CI);const Wh=gt,PI=x("debugtypestore");PI&&console.log(C);function OI(o,e){const t=bv(o,e);return t!==void 0?t:null}const kI=new jk,M0=Symbol("deserialize-queue");async function MI(o,e,t,i=null,n){if(!t){console.debug("Can not create component instances: gltf is null");return}const s=[];let r=i;typeof r=="number"&&(r=new At(i));const a=e.indexOf("?");e=a===-1?e:e.substring(0,a);const l=new Ug(t.scene);l.gltfId=e,l.context=o,l.gltf=t,l.nodeToObject=n?.nodeToObjectMap,l.implementationInformation=kI;let c=o[M0];if(c||(c=o[M0]=[]),t.scenes)for(const h of t.scenes)await E0(l,h,c,s,0);if(t.children)for(const h of t.children)await E0(l,h,c,s,0);o.new_scripts_pre_setup_callbacks.push(()=>{const h=o[M0];if(h){for(const d of h)RI(d,l);h.length=0}if(r){const d={},p=[];T0(t,r,d,p);for(const m of t.scenes)T0(m,r,d,p);for(const m of p)m.resolveGuids(d)}})}const R0=Symbol("original-component-name"),jl=new Map;function T0(o,e,t,i){if(e===null||!o)return;const n=o.guid,s=o.guid;s?.length&&(jl.has(s)||(Wh&&console.log('Creating InstanceIdProvider with key "'+s+'" for object '+o.name),jl.set(s,new At(s))));const r=s&&jl.get(s)||e;if(o.guid=r.generateUUID(),n&&n!=="invalid"&&(t[n]=o.guid),o&&o.userData&&o.userData.components)for(const a of o.userData.components){if(a===null)continue;const l=a.guid;l?jl.has(l)||(Wh&&console.log('Creating InstanceIdProvider with key "'+l+'" for component '+a[R0]),jl.set(l,new At(l))):Wh&&console.warn("Can not create IdProvider: component "+a[R0]+" has no guid",a.guid);const c=jl.get(l)||e,h=a.guid;a.guid=c.generateUUID(),h&&h!=="invalid"&&(t[h]=a.guid),a.resolveGuids&&i.push(a)}if(o.children)for(const a of o.children)T0(a,e,t,i)}const $h=[];async function E0(o,e,t,i,n){if(!e)return;const s=e.userData;if(s){const r=s.builtin_components;if(r&&r.length>0)for(const a of r)try{if(a===null)continue;const l=C.get(a.name);if(l!=null){const c=new l;c.sourceId=o.gltfId,Fa(c,a,o.implementationInformation),c.context=o.context,"guid"in a&&(c[oc]=a.guid),c[R0]=a.name,Sr(e,c,!1),t.push({instance:c,compData:a,obj:e}),c.isCamera&&o.context&&o.context.mainCamera===null&&c.tag==="MainCamera"&&o.context.setCurrentCamera(c),o.context?.physics?.engine?.isInitialized===!1&&(c.isCollider||c.isRigidbody)&&o.context?.physics.engine?.initialize()}else Wh&&console.debug("unknown component: "+a.name),$h.includes(a.name)||$h.push(a.name)}catch(l){console.error(a.name+" - "+l.message,l)}}if(e.children)for(const r of e.children)await E0(o,r,t,i,n+1);if($h.length>0&&n===0){const r=$h.join(", ");console.warn(`Unknown components in scene: ${r}`),$h.length=0,$i()&&Te(`<strong>Unknown components in scene</strong>:
|
|
1478
1478
|
|
|
1479
1479
|
${r}
|
|
1480
1480
|
|
|
@@ -1649,4 +1649,4 @@ Error:`,r),null}}updateColliderCollisionGroups(e){const t=e[Vt],i=e.membership;l
|
|
|
1649
1649
|
justify-content: center;
|
|
1650
1650
|
gap: .5rem;
|
|
1651
1651
|
}
|
|
1652
|
-
`),this.#n.innerHTML=this.#e.innerHTML,this.#n.style.cssText="display: flex; align-items: center; justify-content: center;",this.#e.innerHTML=this.#n.outerHTML,this.#t.innerHTML=this.#e.outerHTML,this.#t.prepend(this.#o),pu(ef,{element:this.#t}),this.#s?.disconnect(),this.#s??=new MutationObserver(()=>this.#l()),this.#s.observe(this.#e,{attributes:!0}),F0&&console.log("Needle Button updated")}#l(){this.#e&&(this.#e.style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))}#r=e=>{F0&&console.log("Needle Button clicked"),!e.defaultPrevented&&this.#e&&this.#e.click()}}typeof window<"u"&&!window.customElements.get(Q1)&&window.customElements.define(Q1,Y1);const Zh=x("debugavatar");class z0{root;head;leftHand;rigthHand;get isValid(){return this.head!==null&&this.head!==void 0}constructor(e,t,i,n){this.root=e,this.head=t,this.leftHand=i,this.rigthHand=n,this.root?.traverse(s=>s.layers.set(2))}}class Z1{avatarRegistryUrl=null;async getOrCreateNewAvatarInstance(e,t){if(!t)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof t=="string"){if(i=await this.loadAvatar(e,t),!i){const s=new jn;i=w.instantiate(Pa(t,e.scene),s)}}else i=t;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Zh&&console.log("[Custom Avatar] valid config",t,Zh?n:""),n):(console.warn("[Custom Avatar] config isn't valid",t,Zh?n:""),null)}async loadAvatar(e,t){if(console.assert(t!=null&&typeof t=="string","Avatar id must not be null"),t.length<=0||!t)return null;if(Zh&&console.log("[Custom Avatar] "+t+", loading..."),t.endsWith(".glb")||(t+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+t);let s=null;if(n.ok){const r=await n.blob();r&&(s=await r.arrayBuffer())}return s?(await bn().parseSync(e,s,null,0))?.scene??null:null}const i=new xo;return cf(i,e),new Promise((n,s)=>{const r=this.avatarRegistryUrl+"/"+t;i.load(r,async a=>{await bn().createBuiltinComponents(e,r,a,null,void 0),n(a.scene)},a=>{Zh&&console.log("[Custom Avatar] "+a.loaded/a.total*100+"% loaded of "+a.total/1024+"kB")},a=>{console.error("[Custom Avatar] Error when loading: "+a),n(null)})})}cacheModel(e,t){}findAvatar(e){const t=e;let i=t;i.children.length==1&&(i=e.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),r=this.findAvatarPart(i,["right","hand"]);if(!n){n=t;const a=new b;new bi().setFromObject(n).getSize(a);const l=Math.max(a.x,a.y,a.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+l+" meters! Should be < 0.3m"),l>.3&&n.scale.multiplyScalar(1/l*.3)}return new z0(t,n,s,r)}findAvatarPart(e,t){const i=e.name.toLowerCase();let n=!0;for(const s of t){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return e;if(e.children)for(const s of e.children){const r=this.findAvatarPart(s,t);if(r)return r}return null}handleCustomAvatarErrors(e){if(!e.ok)throw Error(e.statusText);return e}}class K1{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(e){}}class J1{}const KI=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:me,ActionCollection:Lw,ActionModel:fi,AlignmentConstraint:Mc,Animation:Lt,AnimationCurve:hh,AnimationExtension:ep,AnimationTrackHandler:Ah,Animator:ft,AnimatorController:hn,Antialiasing:gh,Attractor:Sl,AudioExtension:pa,AudioListener:Eo,AudioSource:Mi,AudioTrackHandler:ss,Avatar:Ls,AvatarBlink_Simple:jr,AvatarEyeLook_Rotation:Cf,AvatarLoader:Z1,AvatarMarker:Le,AvatarModel:z0,Avatar_Brain_LookAt:jc,Avatar_MouthShapes:Dc,Avatar_MustacheShake:wf,Avatar_POI:Lr,AxesHelper:Ya,BaseUIComponent:ln,BasicIKConstraint:Of,BehaviorExtension:wy,BehaviorModel:Et,BloomEffect:Cp,BoxCollider:Lu,BoxGizmo:qr,BoxHelperComponent:wt,Button:Xo,CallInfo:To,Camera:si,CameraTargetReachedEvent:Lc,Canvas:yl,CanvasGroup:zs,CapsuleCollider:Ao,ChangeMaterialOnClick:cy,ChangeTransformOnClick:Wr,CharacterController:Dr,CharacterControllerInput:Lo,ChromaticAberration:fh,ClickThrough:qp,Collider:ai,ColorAdjustments:Gs,ColorBySpeedModule:xl,ColorOverLifetimeModule:yp,ContactShadows:Fc,ControlTrackHandler:Up,CursorFollow:Bh,CustomBranding:Gr,Deletable:Ef,DeleteBox:or,DepthOfField:Tn,DeviceFlag:ju,DocumentExtension:K1,DragControls:zr,DropListener:jo,Duplicatable:Bf,EffectWrapper:bh,EmissionModule:$o,EmphasizeOnClick:cl,EnvironmentScene:Hp,EventList:he,EventListEvent:Pu,EventSystem:ei,EventTrigger:zu,FieldWithDefault:uw,FixedJoint:Uy,Fog:bl,GltfExport:Zf,GltfExportBox:Qf,Gradient:Qr,Graphic:nh,GraphicRaycaster:Mu,GridHelper:_l,GridLayoutGroup:Ey,GroundProjectedEnv:qn,GroupActionModel:Vr,HideOnStart:dn,HingeJoint:rh,HorizontalLayoutGroup:Ty,get HoverAnimation(){return uo},Image:Ml,InheritVelocityModule:qy,InputField:x0,InstanceHandle:ba,InstancingHandler:ma,Interactable:Tf,Keyframe:ui,LODGroup:lh,LODModel:vl,Light:di,LimitVelocityOverLifetimeModule:lt,LogStats:Rf,LookAt:w0,LookAtConstraint:Er,MainModule:Ft,MarkerTrackHandler:zp,MaskableGraphic:oh,MeshCollider:Ms,MeshRenderer:Wc,MinMaxCurve:Q,MinMaxGradient:Yr,NeedleMenu:io,NestedGltf:ch,Networking:$y,NoiseModule:_e,ObjectRaycaster:ki,OffsetConstraint:Xr,OpenURL:Rl,OrbitControls:fe,Outline:gl,Padding:Hr,ParticleBurst:fp,ParticleSubEmitter:Xy,ParticleSystem:ph,ParticleSystemRenderer:sn,PhysicsExtension:Sy,PixelationEffect:_h,PlayAnimationOnClick:qc,PlayAudioOnClick:As,PlayableDirector:ra,PlayerColor:Nl,PointerEventData:rd,PostProcessingHandler:d0,PreliminaryAction:hl,PreliminaryTrigger:Xc,RawImage:Wp,Rect:Nw,RectTransform:Mn,ReflectionProbe:Vc,RegisteredAnimationInfo:sr,RemoteSkybox:Ep,Renderer:Ti,RendererLightmap:$u,get ResponsiveBox(){return zi},Rigidbody:Ze,RotationBySpeedModule:on,RotationOverLifetimeModule:Rn,SceneSwitcher:Xe,ScreenCapture:Xs,ScreenSpaceAmbientOcclusion:Ho,ScreenSpaceAmbientOcclusionN8:En,ScrollFollow:Qo,SetActiveOnClick:hy,ShadowCatcher:Ph,ShapeModule:Gy,SharpeningEffect:xh,SignalAsset:Fp,SignalReceiver:Eh,SignalReceiverEvent:Th,SignalTrackHandler:Ih,Size:Uw,SizeBySpeedModule:pi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Xf,SmoothFollow:Ip,SpatialGrabRaycaster:ua,SpatialHtml:jh,SpatialTrigger:Lp,SpatialTriggerReceiver:ao,SpectatorCamera:jp,SphereCollider:Za,SplineContainer:oa,SplineData:lo,SplineWalker:An,Sprite:zo,SpriteData:ul,SpriteRenderer:ci,SpriteSheet:dl,SubEmitterSystem:xp,SyncedCamera:p0,SyncedRoom:In,SyncedTransform:Cn,TapGestureTrigger:uy,TeleportTarget:sp,TestRunner:f0,TestSimulateUserData:y0,Text:Bt,TextBuilder:My,TextExtension:hp,TextureSheetAnimationModule:zt,TiltShiftEffect:ro,ToneMappingEffect:Hs,TrailModule:Fe,TransformData:Ne,TransformGizmo:aa,TriggerBuilder:Dt,TriggerModel:er,UIRaycastUtils:mf,UIRootComponent:eh,USDZExporter:oo,USDZText:fl,USDZUIExtension:Ly,UsageMarker:zc,VariantAction:ay,VelocityOverLifetimeModule:Ve,VerticalLayoutGroup:Ry,VideoPlayer:ht,Vignette:ta,VisibilityAction:Qc,Voip:ks,Volume:Pl,VolumeParameter:B,VolumeProfile:wp,WebARCameraBackground:Uh,WebARSessionRoot:Ui,WebXR:rp,WebXRImageTracking:Nh,WebXRImageTrackingModel:Zo,WebXRPlaneTracking:Ko,WebXRTrackedImage:Vl,XRControllerFollow:Yo,XRControllerModel:Uo,XRControllerMovement:Ei,XRFlag:Ji,XRRig:Zp,XRState:Jt,__Ignore:J1},Symbol.toStringTag,{value:"Module"})),Kh=x("debugmissingcamera");ue.registerCallback(de.MissingCamera,o=>{Kh&&console.warn("Creating missing camera");const e=o.context.scene,t=new re;t.name="Default Fallback Camera",e.add(t);const i=new si;if(i.sourceId=o.files?.[0]?.src??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Ir.Uninitialized;else if(o.context.domElement.getAttribute("background-image")?.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Ir.Skybox;else{if(i.clearFlags=Ir.SolidColor,!o.context.domElement.getAttribute("background-color")){let s="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(s="#1f1f1f"),e.background=new ne(s)}if(!e.environment){const s=new kC(o.context.renderer),r=new Hp("neutral");e.environment=s.fromScene(r,.025).texture}}const n=Sr(t,i,!0);return t.position.x=0,t.position.y=1,t.position.z=2,o.context.domElement?.cameraControls!=!1&&eS(o.context,n),n}),ue.registerCallback(de.ContextCreated,o=>{if(!o.context.mainCamera){Kh&&console.log("Will not auto-fit because a default camera exists");return}if(o.context.domElement?.cameraControls==!0){if(Nb(o.context.mainCamera)?.isCameraController==!0){Kh&&console.log("Will not auto-fit because a camera controller exists");return}eS(o.context)}});function eS(o,e){e=e??o.mainCameraComponent;const t=e?.gameObject;if(Kh&&console.log("Creating default camera controls",e?.name),t){const i=yc(t,fe);i.sourceId=e?.sourceId??"unknown";const n=o.domElement.getAttribute("auto-rotate");i.autoRotate=n!="0"&&n?.toLowerCase()!="false";const s=Number.parseFloat(n||".5");i.autoRotateSpeed=isNaN(s)?.5:s,Kh&&console.log("Auto-rotate",i.autoRotate,"speed:",i.autoRotateSpeed);const r=o.domElement.getAttribute("auto-fit");i.autoFit=r!=="0"&&r?.toLowerCase()!="false",i.autoTarget=!0}else console.warn("Missing camera object, can not add orbit controls")}ue.registerCallback(de.ContextCreated,o=>{const e=o.context.domElement.getAttribute("autoplay");if(e!==void 0&&(e===""||e==="true"||e==="1")&&o.files)for(const t of o.files)w.foreachComponent(t.file.scene,i=>{if(i.enabled!==!1){if(i instanceof Lt&&i.playAutomatically||i instanceof ft||i instanceof ra&&i.playOnAwake===!0)return!0;if(i instanceof Lt)return i.playAutomatically=!0,!0;if(i instanceof ra)return i.playOnAwake=!0,!0}},!0)!==!0&&bs.autoplayAnimations(t.file)});var U0;(o=>{function e(t,i=!1,n=.75){const s=new oa,r=1-j.clamp(n,0,1);return t.forEach((a,l)=>{const c=new b;l<t.length-1?c.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&c.subVectors(t[0],a).normalize().multiplyScalar(r);const h=new lo;h.position.copy(a),h.tangentIn.copy(c),h.tangentOut.copy(c),s.addKnot(h)}),s.closed=i,s}o.createFromPoints=e})(U0||(U0={}));class JI extends rP{constructor(){super(new Worker(URL.createObjectURL(new Blob([`import '${new URL("./generateMeshBVH.worker-2qGLkQjg.js",import.meta.url).toString()}';`],{type:"text/javascript"})),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,s)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=c=>{s(new Error(`[GenerateMeshBVHWorker] ${c.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},e.onmessage=c=>{const{data:h}=c;if(h.error)s(new Error(h.error)),e.onmessage=null;else if(h.serialized){const{serialized:d,position:p}=h,m=aP.deserialize(d,t,{setIndex:!1}),f=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=p,d.index)if(t.index)t.index.array=d.index;else{const g=new pt(d.index,1,!1);t.setIndex(g)}f.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new bi)),i.onProgress&&i.onProgress(h.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(h.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(c=>c.buffer).filter(c=>typeof SharedArrayBuffer>"u"||!(c instanceof SharedArrayBuffer)))})}}const eL=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:JI},Symbol.toStringTag,{value:"Module"}));export{TR as $physicsKey,me as ActionBuilder,Lw as ActionCollection,fi as ActionModel,zv as Addressables,Mc as AlignmentConstraint,Ha as AmbientMode,Lt as Animation,hh as AnimationCurve,ep as AnimationExtension,Ah as AnimationTrackHandler,bs as AnimationUtils,ft as Animator,Ss as AnimatorConditionMode,hn as AnimatorController,df as AnimatorControllerParameterType,Rc as AnimatorStateInfo,gh as Antialiasing,Ln as Application,H_ as AssetDatabase,ie as AssetReference,Sl as Attractor,pa as AudioExtension,Eo as AudioListener,Mi as AudioSource,ss as AudioTrackHandler,Ls as Avatar,jr as AvatarBlink_Simple,Cf as AvatarEyeLook_Rotation,Z1 as AvatarLoader,Le as AvatarMarker,z0 as AvatarModel,jc as Avatar_Brain_LookAt,Dc as Avatar_MouthShapes,wf as Avatar_MustacheShake,Lr as Avatar_POI,Ga as Axes,Ya as AxesHelper,tg as BUILD_TIME,ln as BaseUIComponent,Of as BasicIKConstraint,wy as BehaviorExtension,Et as BehaviorModel,Mr as BlobStorage,Cp as BloomEffect,Lu as BoxCollider,qr as BoxGizmo,wt as BoxHelperComponent,Xo as Button,Dn as ButtonsFactory,zx as CallDirection,To as CallInfo,si as Camera,Lc as CameraTargetReachedEvent,yl as Canvas,zs as CanvasGroup,Ao as CapsuleCollider,cy as ChangeMaterialOnClick,Wr as ChangeTransformOnClick,Dr as CharacterController,Lo as CharacterControllerInput,fh as ChromaticAberration,xi as CircularBuffer,Ir as ClearFlags,qp as ClickThrough,co as ClipExtrapolation,ai as Collider,Dx as Collision,Su as CollisionDetectionMode,Gs as ColorAdjustments,xl as ColorBySpeedModule,yp as ColorOverLifetimeModule,FM as Component,R as Component$1,qd as ComponentLifecycleEvents,KI as Components,T_ as ConnectionEvents,jx as ContactPoint,Fc as ContactShadows,N as Context,SM as ContextArgs,de as ContextEvent,ue as ContextRegistry,Up as ControlTrackHandler,Bh as CursorFollow,Gr as CustomBranding,Me as CustomShader,du as DefaultReflectionMode,Ef as Deletable,or as DeleteBox,Tn as DepthOfField,ju as DeviceFlag,G as DeviceUtilities,K1 as DocumentExtension,zr as DragControls,If as DragMode,jo as DropListener,Bf as Duplicatable,bh as EffectWrapper,$o as EmissionModule,cl as EmphasizeOnClick,ld as EngineLoadingView,Hp as EnvironmentScene,he as EventList,Pu as EventListEvent,ei as EventSystem,zu as EventTrigger,uw as FieldWithDefault,ya as FileReference,Nv as FileReferenceSerializer,JR as FileSpawnModel,qx as File_Event,Uy as FixedJoint,bl as Fog,xe as FrameEvent,Ad as GENERATOR,w as GameObject,F as Gizmos,Zf as GltfExport,Qf as GltfExportBox,Qr as Gradient,nh as Graphic,Mu as GraphicRaycaster,ir as Graphics,_l as GridHelper,Ey as GridLayoutGroup,qn as GroundProjectedEnv,Vr as GroupActionModel,Eu as HideFlags,dn as HideOnStart,rh as HingeJoint,Ty as HorizontalLayoutGroup,Ck as HostData,uo as HoverAnimation,Ml as Image,fa as ImageReference,Uv as ImageReferenceSerializer,qy as InheritVelocityModule,y_ as Input,ii as InputEventQueue,Ee as InputEvents,x0 as InputField,ba as InstanceHandle,ma as InstancingHandler,cn as InstancingUtil,rv as InstantiateEvent,At as InstantiateIdProvider,jn as InstantiateOptions,Tf as Interactable,zh as InternalScreenshotUtils,XO as JoinedRoomResponse,BO as KeyEventArgs,ui as Keyframe,lh as LODGroup,vl as LODModel,QO as LeftRoomResponse,di as Light,Qv as LightData,lt as LimitVelocityOverLifetimeModule,BI as LoadingElementOptions,Rf as LogStats,wi as LogType,w0 as LookAt,Er as LookAtConstraint,T as MODULES,Ft as MainModule,zp as MarkerTrackHandler,b0 as MarkerType,oh as MaskableGraphic,j as Mathf,Ms as MeshCollider,Wc as MeshRenderer,Q as MinMaxCurve,Yr as MinMaxGradient,pc as NEEDLE_ENGINE_FEATURE_FLAGS,sc as NEKeyboardEvent,Co as NEPointerEvent,Y1 as NeedleButtonElement,jf as NeedleEngineModelLoader,L0 as NeedleEngineWebComponent,io as NeedleMenu,Ld as NeedlePatchesKey,rg as NeedleXRController,Y as NeedleXRSession,I_ as NeedleXRSync,z_ as NeedleXRUtils,ch as NestedGltf,A_ as NetworkConnection,Qn as NetworkedStreamEvents,ad as NetworkedStreams,$y as Networking,lv as NewInstanceModel,_e as NoiseModule,ki as ObjectRaycaster,_r as ObjectUtils,Xr as OffsetConstraint,Pd as OneEuroFilter,Nm as OneEuroFilterXYZ,Rl as OpenURL,fe as OrbitControls,gl as Outline,E_ as OwnershipEvent,ug as OwnershipModel,Ma as PUBLIC_KEY,Hr as Padding,fp as ParticleBurst,Xy as ParticleSubEmitter,ph as ParticleSystem,$s as ParticleSystemBaseBehaviour,sn as ParticleSystemRenderer,gp as ParticleSystemShapeType,os as PeerHandle,M_ as PeerNetworking,zl as Physics,Sy as PhysicsExtension,yt as PhysicsMaterialCombine,_h as PixelationEffect,qc as PlayAnimationOnClick,As as PlayAudioOnClick,ra as PlayableDirector,Nl as PlayerColor,On as PlayerState,Fw as PlayerStateEvent,by as PlayerSync,$v as PlayerView,Hv as PlayerViewManager,rd as PointerEventData,Dd as PointerType,tt as PostProcessingEffect,ct as PostProcessingEffectOrder,d0 as PostProcessingHandler,hl as PreliminaryAction,Xc as PreliminaryTrigger,Ts as PreviewHelper,br as PrimitiveType,ae as Progress,Dm as PromiseAllWithErrors,jm as PromiseErrorResult,oe as RGBAColor,Wl as RapierPhysics,Wp as RawImage,fs as RaycastOptions,Nw as Rect,Mn as RectTransform,Vc as ReflectionProbe,sr as RegisteredAnimationInfo,Ep as RemoteSkybox,fo as RenderTexture,Rx as RenderTextureSerializer,Ti as Renderer,Xv as RendererData,$u as RendererLightmap,Ze as Rigidbody,qe as RigidbodyConstraints,te as RoomEvents,on as RotationBySpeedModule,Rn as RotationOverLifetimeModule,Nu as SceneLightSettings,Xe as SceneSwitcher,Xs as ScreenCapture,Ho as ScreenSpaceAmbientOcclusion,En as ScreenSpaceAmbientOcclusionN8,Qo as ScrollFollow,_n as SendQueue,Ug as SerializationContext,hy as SetActiveOnClick,Ph as ShadowCatcher,Gy as ShapeModule,Bx as ShapeOverlapResult,xh as SharpeningEffect,Fp as SignalAsset,Eh as SignalReceiver,Th as SignalReceiverEvent,Ih as SignalTrackHandler,Uw as Size,pi as SizeBySpeedModule,Zr as SizeOverLifetimeModule,Xf as SkinnedMeshRenderer,Ip as SmoothFollow,ua as SpatialGrabRaycaster,jh as SpatialHtml,Lp as SpatialTrigger,ao as SpatialTriggerReceiver,jp as SpectatorCamera,Za as SphereCollider,wg as SphereIntersection,oa as SplineContainer,lo as SplineData,U0 as SplineUtils,An as SplineWalker,zo as Sprite,ul as SpriteData,ci as SpriteRenderer,dl as SpriteSheet,$M as StateMachineBehaviour,vf as StreamEndedEvent,Fx as StreamReceivedEvent,xp as SubEmitterSystem,p0 as SyncedCamera,In as SyncedRoom,Cn as SyncedTransform,uy as TapGestureTrigger,sp as TeleportTarget,f0 as TestRunner,GI as TestSceneUtils,y0 as TestSimulateUserData,Bt as Text,My as TextBuilder,hp as TextExtension,zt as TextureSheetAnimationModule,ro as TiltShiftEffect,Zv as Time,Hs as ToneMappingEffect,kl as TrackHandler,Bi as TrackType,Fe as TrailModule,Ne as TransformData,aa as TransformGizmo,Dt as TriggerBuilder,er as TriggerModel,C as TypeStore,mf as UIRaycastUtils,eh as UIRootComponent,Kf as USDDocument,it as USDObject,bw as USDWriter,oo as USDZExporter,_w as USDZExporter$1,fl as USDZText,Ly as USDZUIExtension,Tx as UriSerializer,zc as UsageMarker,YO as UserJoinedOrLeftRoomModel,yn as VERSION,ay as VariantAction,Ve as VelocityOverLifetimeModule,Ry as VerticalLayoutGroup,ht as VideoPlayer,zi as ViewBox,_s as ViewDevice,ta as Vignette,Qc as VisibilityAction,ks as Voip,Pl as Volume,B as VolumeParameter,wp as VolumeProfile,iM as WaitForFrames,Vv as WaitForPromise,Xg as WaitForSeconds,is as Watch,Uh as WebARCameraBackground,Ui as WebARSessionRoot,rp as WebXR,tr as WebXRButtonFactory,Nh as WebXRImageTracking,Zo as WebXRImageTrackingModel,Ko as WebXRPlaneTracking,Vl as WebXRTrackedImage,Yo as XRControllerFollow,Uo as XRControllerModel,Ei as XRControllerMovement,Ji as XRFlag,Zp as XRRig,Jt as XRState,Zn as XRStateFlag,J1 as __Ignore,pk as __internalNotifyObjectDestroyed,So as activeInHierarchyFieldName,Im as addAttributeChangeCallback,wn as addComponent,xT as addCustomExtensionPlugin,Sr as addNewComponent,Id as addPatch,iu as apply,BM as applyHMRChanges,Cv as applyPrototypeExtensions,av as beginListenDestroy,hv as beginListenInstantiate,cg as binaryIdentifierCasts,wM as build_scene_functions,fr as builtinComponentKeyName,I0 as calculateProgress01,GP as clearMessages,aR as colorSerializer,mv as compareAssociation,Ou as componentSerializer,Jb as copyTexture,wx as createMotion,ni as debugNet,rc as debugOwner,Cw as decompressGpuTexture,Ql as deepClone,Un as delay,Yl as delayForFrames,eu as deserializeObject,Ci as destroy,Mv as destroyComponentInstance,Xx as determineMimeTypeFromExtension,Pe as disposeObjectResources,Yn as disposeStream,oc as editorGuidKeyName,pr as enableSpatialConsole,cR as euler,pR as eventListSerializer,QI as exportAsGLTF,$g as findByGuid,Ua as findObjectOfType,Ev as findObjectsOfType,Sg as findResourceUsers,Px as fitCamera,t_ as fitObjectIntoVolume,kr as foreachComponent,au as foreachComponentEnumerator,hO as forward,Ib as generateQRCode,cv as generateSeed,$t as getBoundingBox,Nb as getCameraController,Cr as getComponent,_c as getComponentInChildren,vc as getComponentInParent,bc as getComponents,za as getComponentsInChildren,tu as getComponentsInParent,mw as getFormattedDate,Ct as getIconElement,Jg as getIconTexture,bn as getLoader,yc as getOrAddComponent,x as getParam,pO as getParentHierarchyPath,SP as getPath,$O as getPeerOptions,O_ as getPeerjsInstance,gk as getResourceUserCount,$b as getTempColor,ti as getTempQuaternion,z as getTempVector,ql as getUrlParams,e_ as getVisibleInCustomShadowRendering,Xb as getWorldDirection,Xm as getWorldEuler,K as getWorldPosition,be as getWorldQuaternion,Rd as getWorldRotation,He as getWorldScale,vs as hasCommercialLicense,Pc as hasIndieLicense,Cu as hasPointerEventComponent,Gn as hasProLicense,r_ as hideDebugConsole,Pw as imageToCanvas,Wa as instantiate,ow as invokeLoadedImportPluginHooks,f_ as invokeXRSessionEnd,g_ as invokeXRSessionStart,Av as isActiveInHierarchy,Na as isActiveSelf,RP as isAndroidDevice,Kb as isAnimationAction,Lx as isComponent,_P as isDebugMode,PP as isDesktop,Or as isDestroyed,A as isDevEnvironment,uk as isDisposed,qI as isExporting,Ix as isGLTFModel,wb as isHostedOnGlitch,hf as isHotReloadEnabled,jM as isHotReloading,kP as isIPad,tx as isIconElement,$i as isLocalNetwork,EP as isMacOS,OP as isMobileDevice,TP as isMozillaXR,LP as isQuest,q_ as isResourceTrackingEnabled,IP as isSafari,ou as isUsingInstancing,AP as isiOS,MP as isiPad,EI as loadAsset,f1 as loadPMREM,A0 as loadSync,Td as logHierarchy,iO as lookAtInverse,Kl as lookAtObject,nO as lookAtScreenPoint,xP as makeId,Rb as makeIdFromRandomWords,en as makeNameSafe,Iv as markAsInstancedRendered,jP as microphonePermissionsGranted,bP as nameof,Pb as nameofFactory,Mx as objectSerializer,DO as offXRSessionEnd,jO as offXRSessionStart,IM as onAfterRender,AM as onBeforeRender,TM as onClear,EM as onDestroy,cx as onInitialized,bu as onStart,hx as onUpdate,sg as onXRSessionEnd,jd as onXRSessionStart,z1 as parseSync,i_ as placeOnSurface,Zm as postprocessFBXMaterials,tR as prefix,Ob as pushState,wP as randomNumber,hg as registerBinaryType,gu as registerComponent,$f as registerComponentExtension,rn as registerCustomEffectType,Hf as registerExportExtensions,Wu as registerExtensions,fx as registerHotReloadType,ig as registerLoader,uv as registerPrefabProvider,Pv as registerPrototypeExtensions,jg as registerType,Eb as relativePathPrefix,Lm as removeAttributeChangeCallback,Wg as removeComponent,wT as removeCustomImportExtensionType,IO as removePatch,us as resolveUrl,Tb as sanitizeString,A1 as saveImage,mI as screenshot,k0 as screenshot2,Ag as sendDestroyed,u as serializable,bv as serializeObject,Ye as serializeable,xc as setActive,Db as setAllowBalloonMessages,VP as setAllowOverlayMessages,kd as setAutoFitEnabled,Vm as setCameraController,jv as setDestroyed,xO as setDevEnvironment,Q_ as setDisposable,Va as setDontDestroy,Tm as setOrAddParamsToUrl,vP as setParam,Xl as setParamWithoutReload,HO as setPeerOptions,dk as setResourceTrackingEnabled,Em as setState,Ym as setVisibleInCustomShadowRendering,Qm as setWorldEuler,mt as setWorldPosition,dr as setWorldPositionXYZ,fn as setWorldQuaternion,qm as setWorldQuaternionXYZW,Zb as setWorldRotation,Jl as setWorldRotationXYZ,ka as setWorldScale,ic as showBalloonError,Te as showBalloonMessage,ge as showBalloonWarning,eg as showDebugConsole,tO as slerp,gc as syncDestroy,yy as syncField,Ig as syncInstantiate,mO as textureToCanvas,Ab as toSourceId,C_ as tryCastBinary,Yx as tryDetermineMimetypeFromBinary,Qx as tryDetermineMimetypeFromURL,Pa as tryFindObject,P_ as tryGetGuid,yx as unregisterHotReloadType,Am as unwatchWrite,Vb as useForAutoFit,Pt as validate,Sd as watchWrite};
|
|
1652
|
+
`),this.#n.innerHTML=this.#e.innerHTML,this.#n.style.cssText="display: flex; align-items: center; justify-content: center;",this.#e.innerHTML=this.#n.outerHTML,this.#t.innerHTML=this.#e.outerHTML,this.#t.prepend(this.#o),pu(ef,{element:this.#t}),this.#s?.disconnect(),this.#s??=new MutationObserver(()=>this.#l()),this.#s.observe(this.#e,{attributes:!0}),F0&&console.log("Needle Button updated")}#l(){this.#e&&(this.#e.style.display==="none"?this.style.display="none":this.style.display==="none"&&(this.style.display=""))}#r=e=>{F0&&console.log("Needle Button clicked"),!e.defaultPrevented&&this.#e&&this.#e.click()}}typeof window<"u"&&!window.customElements.get(Q1)&&window.customElements.define(Q1,Y1);const Zh=x("debugavatar");class z0{root;head;leftHand;rigthHand;get isValid(){return this.head!==null&&this.head!==void 0}constructor(e,t,i,n){this.root=e,this.head=t,this.leftHand=i,this.rigthHand=n,this.root?.traverse(s=>s.layers.set(2))}}class Z1{avatarRegistryUrl=null;async getOrCreateNewAvatarInstance(e,t){if(!t)return console.error("Can not create avatar: failed to provide id or root object"),null;let i=null;if(typeof t=="string"){if(i=await this.loadAvatar(e,t),!i){const s=new jn;i=w.instantiate(Pa(t,e.scene),s)}}else i=t;if(!i)return null;const n=this.findAvatar(i);return n.isValid?(Zh&&console.log("[Custom Avatar] valid config",t,Zh?n:""),n):(console.warn("[Custom Avatar] config isn't valid",t,Zh?n:""),null)}async loadAvatar(e,t){if(console.assert(t!=null&&typeof t=="string","Avatar id must not be null"),t.length<=0||!t)return null;if(Zh&&console.log("[Custom Avatar] "+t+", loading..."),t.endsWith(".glb")||(t+=".glb"),this.avatarRegistryUrl===null){const n=await fetch("./"+t);let s=null;if(n.ok){const r=await n.blob();r&&(s=await r.arrayBuffer())}return s?(await bn().parseSync(e,s,null,0))?.scene??null:null}const i=new xo;return cf(i,e),new Promise((n,s)=>{const r=this.avatarRegistryUrl+"/"+t;i.load(r,async a=>{await bn().createBuiltinComponents(e,r,a,null,void 0),n(a.scene)},a=>{Zh&&console.log("[Custom Avatar] "+a.loaded/a.total*100+"% loaded of "+a.total/1024+"kB")},a=>{console.error("[Custom Avatar] Error when loading: "+a),n(null)})})}cacheModel(e,t){}findAvatar(e){const t=e;let i=t;i.children.length==1&&(i=e.children[0]);let n=this.findAvatarPart(i,["head"]);const s=this.findAvatarPart(i,["left","hand"]),r=this.findAvatarPart(i,["right","hand"]);if(!n){n=t;const a=new b;new bi().setFromObject(n).getSize(a);const l=Math.max(a.x,a.y,a.z);console.warn("[Custom Avatar] Normalizing head scale, it's too big: "+l+" meters! Should be < 0.3m"),l>.3&&n.scale.multiplyScalar(1/l*.3)}return new z0(t,n,s,r)}findAvatarPart(e,t){const i=e.name.toLowerCase();let n=!0;for(const s of t){if(!n)break;i.indexOf(s)===-1&&(n=!1)}if(n)return e;if(e.children)for(const s of e.children){const r=this.findAvatarPart(s,t);if(r)return r}return null}handleCustomAvatarErrors(e){if(!e.ok)throw Error(e.statusText);return e}}class K1{get extensionName(){return"DocumentExtension"}onAfterBuildDocument(e){}}class J1{}const KI=Object.freeze(Object.defineProperty({__proto__:null,ActionBuilder:me,ActionCollection:Lw,ActionModel:fi,AlignmentConstraint:Mc,Animation:Lt,AnimationCurve:hh,AnimationExtension:ep,AnimationTrackHandler:Ah,Animator:ft,AnimatorController:hn,Antialiasing:gh,Attractor:Sl,AudioExtension:pa,AudioListener:Eo,AudioSource:Mi,AudioTrackHandler:ss,Avatar:Ls,AvatarBlink_Simple:jr,AvatarEyeLook_Rotation:Cf,AvatarLoader:Z1,AvatarMarker:Le,AvatarModel:z0,Avatar_Brain_LookAt:jc,Avatar_MouthShapes:Dc,Avatar_MustacheShake:wf,Avatar_POI:Lr,AxesHelper:Ya,BaseUIComponent:ln,BasicIKConstraint:Of,BehaviorExtension:wy,BehaviorModel:Et,BloomEffect:Cp,BoxCollider:Lu,BoxGizmo:qr,BoxHelperComponent:wt,Button:Xo,CallInfo:To,Camera:si,CameraTargetReachedEvent:Lc,Canvas:yl,CanvasGroup:zs,CapsuleCollider:Ao,ChangeMaterialOnClick:cy,ChangeTransformOnClick:Wr,CharacterController:Dr,CharacterControllerInput:Lo,ChromaticAberration:fh,ClickThrough:qp,Collider:ai,ColorAdjustments:Gs,ColorBySpeedModule:xl,ColorOverLifetimeModule:yp,ContactShadows:Fc,ControlTrackHandler:Up,CursorFollow:Bh,CustomBranding:Gr,Deletable:Ef,DeleteBox:or,DepthOfField:Tn,DeviceFlag:ju,DocumentExtension:K1,DragControls:zr,DropListener:jo,Duplicatable:Bf,EffectWrapper:bh,EmissionModule:$o,EmphasizeOnClick:cl,EnvironmentScene:Hp,EventList:he,EventListEvent:Pu,EventSystem:ei,EventTrigger:zu,FieldWithDefault:uw,FixedJoint:Uy,Fog:bl,GltfExport:Zf,GltfExportBox:Qf,Gradient:Qr,Graphic:nh,GraphicRaycaster:Mu,GridHelper:_l,GridLayoutGroup:Ey,GroundProjectedEnv:qn,GroupActionModel:Vr,HideOnStart:dn,HingeJoint:rh,HorizontalLayoutGroup:Ty,get HoverAnimation(){return uo},Image:Ml,InheritVelocityModule:qy,InputField:x0,InstanceHandle:ba,InstancingHandler:ma,Interactable:Tf,Keyframe:ui,LODGroup:lh,LODModel:vl,Light:di,LimitVelocityOverLifetimeModule:lt,LogStats:Rf,LookAt:w0,LookAtConstraint:Er,MainModule:Ft,MarkerTrackHandler:zp,MaskableGraphic:oh,MeshCollider:Ms,MeshRenderer:Wc,MinMaxCurve:Q,MinMaxGradient:Yr,NeedleMenu:io,NestedGltf:ch,Networking:$y,NoiseModule:_e,ObjectRaycaster:ki,OffsetConstraint:Xr,OpenURL:Rl,OrbitControls:fe,Outline:gl,Padding:Hr,ParticleBurst:fp,ParticleSubEmitter:Xy,ParticleSystem:ph,ParticleSystemRenderer:sn,PhysicsExtension:Sy,PixelationEffect:_h,PlayAnimationOnClick:qc,PlayAudioOnClick:As,PlayableDirector:ra,PlayerColor:Nl,PointerEventData:rd,PostProcessingHandler:d0,PreliminaryAction:hl,PreliminaryTrigger:Xc,RawImage:Wp,Rect:Nw,RectTransform:Mn,ReflectionProbe:Vc,RegisteredAnimationInfo:sr,RemoteSkybox:Ep,Renderer:Ti,RendererLightmap:$u,Rigidbody:Ze,RotationBySpeedModule:on,RotationOverLifetimeModule:Rn,SceneSwitcher:Xe,ScreenCapture:Xs,ScreenSpaceAmbientOcclusion:Ho,ScreenSpaceAmbientOcclusionN8:En,ScrollFollow:Qo,SetActiveOnClick:hy,ShadowCatcher:Ph,ShapeModule:Gy,SharpeningEffect:xh,SignalAsset:Fp,SignalReceiver:Eh,SignalReceiverEvent:Th,SignalTrackHandler:Ih,Size:Uw,SizeBySpeedModule:pi,SizeOverLifetimeModule:Zr,SkinnedMeshRenderer:Xf,SmoothFollow:Ip,SpatialGrabRaycaster:ua,SpatialHtml:jh,SpatialTrigger:Lp,SpatialTriggerReceiver:ao,SpectatorCamera:jp,SphereCollider:Za,SplineContainer:oa,SplineData:lo,SplineWalker:An,Sprite:zo,SpriteData:ul,SpriteRenderer:ci,SpriteSheet:dl,SubEmitterSystem:xp,SyncedCamera:p0,SyncedRoom:In,SyncedTransform:Cn,TapGestureTrigger:uy,TeleportTarget:sp,TestRunner:f0,TestSimulateUserData:y0,Text:Bt,TextBuilder:My,TextExtension:hp,TextureSheetAnimationModule:zt,TiltShiftEffect:ro,ToneMappingEffect:Hs,TrailModule:Fe,TransformData:Ne,TransformGizmo:aa,TriggerBuilder:Dt,TriggerModel:er,UIRaycastUtils:mf,UIRootComponent:eh,USDZExporter:oo,USDZText:fl,USDZUIExtension:Ly,UsageMarker:zc,VariantAction:ay,VelocityOverLifetimeModule:Ve,VerticalLayoutGroup:Ry,VideoPlayer:ht,get ViewBox(){return zi},Vignette:ta,VisibilityAction:Qc,Voip:ks,Volume:Pl,VolumeParameter:B,VolumeProfile:wp,WebARCameraBackground:Uh,WebARSessionRoot:Ui,WebXR:rp,WebXRImageTracking:Nh,WebXRImageTrackingModel:Zo,WebXRPlaneTracking:Ko,WebXRTrackedImage:Vl,XRControllerFollow:Yo,XRControllerModel:Uo,XRControllerMovement:Ei,XRFlag:Ji,XRRig:Zp,XRState:Jt,__Ignore:J1},Symbol.toStringTag,{value:"Module"})),Kh=x("debugmissingcamera");ue.registerCallback(de.MissingCamera,o=>{Kh&&console.warn("Creating missing camera");const e=o.context.scene,t=new re;t.name="Default Fallback Camera",e.add(t);const i=new si;if(i.sourceId=o.files?.[0]?.src??"unknown",i.fieldOfView=35,o.context.domElement.getAttribute("transparent")!=null)i.clearFlags=Ir.Uninitialized;else if(o.context.domElement.getAttribute("background-image")?.length||o.context.lightmaps.tryGetSkybox(i.sourceId))i.clearFlags=Ir.Skybox;else{if(i.clearFlags=Ir.SolidColor,!o.context.domElement.getAttribute("background-color")){let s="#efefef";typeof window!==void 0&&window.matchMedia("(prefers-color-scheme: dark)").matches&&(s="#1f1f1f"),e.background=new ne(s)}if(!e.environment){const s=new kC(o.context.renderer),r=new Hp("neutral");e.environment=s.fromScene(r,.025).texture}}const n=Sr(t,i,!0);return t.position.x=0,t.position.y=1,t.position.z=2,o.context.domElement?.cameraControls!=!1&&eS(o.context,n),n}),ue.registerCallback(de.ContextCreated,o=>{if(!o.context.mainCamera){Kh&&console.log("Will not auto-fit because a default camera exists");return}if(o.context.domElement?.cameraControls==!0){if(Nb(o.context.mainCamera)?.isCameraController==!0){Kh&&console.log("Will not auto-fit because a camera controller exists");return}eS(o.context)}});function eS(o,e){e=e??o.mainCameraComponent;const t=e?.gameObject;if(Kh&&console.log("Creating default camera controls",e?.name),t){const i=yc(t,fe);i.sourceId=e?.sourceId??"unknown";const n=o.domElement.getAttribute("auto-rotate");i.autoRotate=n!="0"&&n?.toLowerCase()!="false";const s=Number.parseFloat(n||".5");i.autoRotateSpeed=isNaN(s)?.5:s,Kh&&console.log("Auto-rotate",i.autoRotate,"speed:",i.autoRotateSpeed);const r=o.domElement.getAttribute("auto-fit");i.autoFit=r!=="0"&&r?.toLowerCase()!="false",i.autoTarget=!0}else console.warn("Missing camera object, can not add orbit controls")}ue.registerCallback(de.ContextCreated,o=>{const e=o.context.domElement.getAttribute("autoplay");if(e!==void 0&&(e===""||e==="true"||e==="1")&&o.files)for(const t of o.files)w.foreachComponent(t.file.scene,i=>{if(i.enabled!==!1){if(i instanceof Lt&&i.playAutomatically||i instanceof ft||i instanceof ra&&i.playOnAwake===!0)return!0;if(i instanceof Lt)return i.playAutomatically=!0,!0;if(i instanceof ra)return i.playOnAwake=!0,!0}},!0)!==!0&&bs.autoplayAnimations(t.file)});var U0;(o=>{function e(t,i=!1,n=.75){const s=new oa,r=1-j.clamp(n,0,1);return t.forEach((a,l)=>{const c=new b;l<t.length-1?c.subVectors(t[l+1],a).normalize().multiplyScalar(r):i&&t.length>1&&c.subVectors(t[0],a).normalize().multiplyScalar(r);const h=new lo;h.position.copy(a),h.tangentIn.copy(c),h.tangentOut.copy(c),s.addKnot(h)}),s.closed=i,s}o.createFromPoints=e})(U0||(U0={}));class JI extends rP{constructor(){super(new Worker(URL.createObjectURL(new Blob([`import '${new URL("./generateMeshBVH.worker-2qGLkQjg.js",import.meta.url).toString()}';`],{type:"text/javascript"})),{type:"module"})),this.name="GenerateMeshBVHWorker"}runTask(e,t,i={}){return new Promise((n,s)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=c=>{s(new Error(`[GenerateMeshBVHWorker] ${c.message||"Unknown error. Please check the server console. If you're using vite try adding 'three-mesh-bvh' to 'optimizeDeps.exclude' in your vite.config.js"}`))},e.onmessage=c=>{const{data:h}=c;if(h.error)s(new Error(h.error)),e.onmessage=null;else if(h.serialized){const{serialized:d,position:p}=h,m=aP.deserialize(d,t,{setIndex:!1}),f=Object.assign({setBoundingBox:!0},i);if(t.attributes.position.array=p,d.index)if(t.index)t.index.array=d.index;else{const g=new pt(d.index,1,!1);t.setIndex(g)}f.setBoundingBox&&(t.boundingBox=m.getBoundingBox(new bi)),i.onProgress&&i.onProgress(h.progress),n(m),e.onmessage=null}else i.onProgress&&i.onProgress(h.progress)};const r=t.index?t.index.array:null,a=t.attributes.position.array,l=[a];r&&l.push(r),e.postMessage({index:r,position:a,options:{...i,onProgress:null,includedProgressCallback:!!i.onProgress,groups:[...t.groups]}},l.map(c=>c.buffer).filter(c=>typeof SharedArrayBuffer>"u"||!(c instanceof SharedArrayBuffer)))})}}const eL=Object.freeze(Object.defineProperty({__proto__:null,GenerateMeshBVHWorker:JI},Symbol.toStringTag,{value:"Module"}));export{TR as $physicsKey,me as ActionBuilder,Lw as ActionCollection,fi as ActionModel,zv as Addressables,Mc as AlignmentConstraint,Ha as AmbientMode,Lt as Animation,hh as AnimationCurve,ep as AnimationExtension,Ah as AnimationTrackHandler,bs as AnimationUtils,ft as Animator,Ss as AnimatorConditionMode,hn as AnimatorController,df as AnimatorControllerParameterType,Rc as AnimatorStateInfo,gh as Antialiasing,Ln as Application,H_ as AssetDatabase,ie as AssetReference,Sl as Attractor,pa as AudioExtension,Eo as AudioListener,Mi as AudioSource,ss as AudioTrackHandler,Ls as Avatar,jr as AvatarBlink_Simple,Cf as AvatarEyeLook_Rotation,Z1 as AvatarLoader,Le as AvatarMarker,z0 as AvatarModel,jc as Avatar_Brain_LookAt,Dc as Avatar_MouthShapes,wf as Avatar_MustacheShake,Lr as Avatar_POI,Ga as Axes,Ya as AxesHelper,tg as BUILD_TIME,ln as BaseUIComponent,Of as BasicIKConstraint,wy as BehaviorExtension,Et as BehaviorModel,Mr as BlobStorage,Cp as BloomEffect,Lu as BoxCollider,qr as BoxGizmo,wt as BoxHelperComponent,Xo as Button,Dn as ButtonsFactory,zx as CallDirection,To as CallInfo,si as Camera,Lc as CameraTargetReachedEvent,yl as Canvas,zs as CanvasGroup,Ao as CapsuleCollider,cy as ChangeMaterialOnClick,Wr as ChangeTransformOnClick,Dr as CharacterController,Lo as CharacterControllerInput,fh as ChromaticAberration,xi as CircularBuffer,Ir as ClearFlags,qp as ClickThrough,co as ClipExtrapolation,ai as Collider,Dx as Collision,Su as CollisionDetectionMode,Gs as ColorAdjustments,xl as ColorBySpeedModule,yp as ColorOverLifetimeModule,FM as Component,R as Component$1,qd as ComponentLifecycleEvents,KI as Components,T_ as ConnectionEvents,jx as ContactPoint,Fc as ContactShadows,N as Context,SM as ContextArgs,de as ContextEvent,ue as ContextRegistry,Up as ControlTrackHandler,Bh as CursorFollow,Gr as CustomBranding,Me as CustomShader,du as DefaultReflectionMode,Ef as Deletable,or as DeleteBox,Tn as DepthOfField,ju as DeviceFlag,G as DeviceUtilities,K1 as DocumentExtension,zr as DragControls,If as DragMode,jo as DropListener,Bf as Duplicatable,bh as EffectWrapper,$o as EmissionModule,cl as EmphasizeOnClick,ld as EngineLoadingView,Hp as EnvironmentScene,he as EventList,Pu as EventListEvent,ei as EventSystem,zu as EventTrigger,uw as FieldWithDefault,ya as FileReference,Nv as FileReferenceSerializer,JR as FileSpawnModel,qx as File_Event,Uy as FixedJoint,bl as Fog,xe as FrameEvent,Ad as GENERATOR,w as GameObject,F as Gizmos,Zf as GltfExport,Qf as GltfExportBox,Qr as Gradient,nh as Graphic,Mu as GraphicRaycaster,ir as Graphics,_l as GridHelper,Ey as GridLayoutGroup,qn as GroundProjectedEnv,Vr as GroupActionModel,Eu as HideFlags,dn as HideOnStart,rh as HingeJoint,Ty as HorizontalLayoutGroup,Ck as HostData,uo as HoverAnimation,Ml as Image,fa as ImageReference,Uv as ImageReferenceSerializer,qy as InheritVelocityModule,y_ as Input,ii as InputEventQueue,Ee as InputEvents,x0 as InputField,ba as InstanceHandle,ma as InstancingHandler,cn as InstancingUtil,rv as InstantiateEvent,At as InstantiateIdProvider,jn as InstantiateOptions,Tf as Interactable,zh as InternalScreenshotUtils,XO as JoinedRoomResponse,BO as KeyEventArgs,ui as Keyframe,lh as LODGroup,vl as LODModel,QO as LeftRoomResponse,di as Light,Qv as LightData,lt as LimitVelocityOverLifetimeModule,BI as LoadingElementOptions,Rf as LogStats,wi as LogType,w0 as LookAt,Er as LookAtConstraint,T as MODULES,Ft as MainModule,zp as MarkerTrackHandler,b0 as MarkerType,oh as MaskableGraphic,j as Mathf,Ms as MeshCollider,Wc as MeshRenderer,Q as MinMaxCurve,Yr as MinMaxGradient,pc as NEEDLE_ENGINE_FEATURE_FLAGS,sc as NEKeyboardEvent,Co as NEPointerEvent,Y1 as NeedleButtonElement,jf as NeedleEngineModelLoader,L0 as NeedleEngineWebComponent,io as NeedleMenu,Ld as NeedlePatchesKey,rg as NeedleXRController,Y as NeedleXRSession,I_ as NeedleXRSync,z_ as NeedleXRUtils,ch as NestedGltf,A_ as NetworkConnection,Qn as NetworkedStreamEvents,ad as NetworkedStreams,$y as Networking,lv as NewInstanceModel,_e as NoiseModule,ki as ObjectRaycaster,_r as ObjectUtils,Xr as OffsetConstraint,Pd as OneEuroFilter,Nm as OneEuroFilterXYZ,Rl as OpenURL,fe as OrbitControls,gl as Outline,E_ as OwnershipEvent,ug as OwnershipModel,Ma as PUBLIC_KEY,Hr as Padding,fp as ParticleBurst,Xy as ParticleSubEmitter,ph as ParticleSystem,$s as ParticleSystemBaseBehaviour,sn as ParticleSystemRenderer,gp as ParticleSystemShapeType,os as PeerHandle,M_ as PeerNetworking,zl as Physics,Sy as PhysicsExtension,yt as PhysicsMaterialCombine,_h as PixelationEffect,qc as PlayAnimationOnClick,As as PlayAudioOnClick,ra as PlayableDirector,Nl as PlayerColor,On as PlayerState,Fw as PlayerStateEvent,by as PlayerSync,$v as PlayerView,Hv as PlayerViewManager,rd as PointerEventData,Dd as PointerType,tt as PostProcessingEffect,ct as PostProcessingEffectOrder,d0 as PostProcessingHandler,hl as PreliminaryAction,Xc as PreliminaryTrigger,Ts as PreviewHelper,br as PrimitiveType,ae as Progress,Dm as PromiseAllWithErrors,jm as PromiseErrorResult,oe as RGBAColor,Wl as RapierPhysics,Wp as RawImage,fs as RaycastOptions,Nw as Rect,Mn as RectTransform,Vc as ReflectionProbe,sr as RegisteredAnimationInfo,Ep as RemoteSkybox,fo as RenderTexture,Rx as RenderTextureSerializer,Ti as Renderer,Xv as RendererData,$u as RendererLightmap,Ze as Rigidbody,qe as RigidbodyConstraints,te as RoomEvents,on as RotationBySpeedModule,Rn as RotationOverLifetimeModule,Nu as SceneLightSettings,Xe as SceneSwitcher,Xs as ScreenCapture,Ho as ScreenSpaceAmbientOcclusion,En as ScreenSpaceAmbientOcclusionN8,Qo as ScrollFollow,_n as SendQueue,Ug as SerializationContext,hy as SetActiveOnClick,Ph as ShadowCatcher,Gy as ShapeModule,Bx as ShapeOverlapResult,xh as SharpeningEffect,Fp as SignalAsset,Eh as SignalReceiver,Th as SignalReceiverEvent,Ih as SignalTrackHandler,Uw as Size,pi as SizeBySpeedModule,Zr as SizeOverLifetimeModule,Xf as SkinnedMeshRenderer,Ip as SmoothFollow,ua as SpatialGrabRaycaster,jh as SpatialHtml,Lp as SpatialTrigger,ao as SpatialTriggerReceiver,jp as SpectatorCamera,Za as SphereCollider,wg as SphereIntersection,oa as SplineContainer,lo as SplineData,U0 as SplineUtils,An as SplineWalker,zo as Sprite,ul as SpriteData,ci as SpriteRenderer,dl as SpriteSheet,$M as StateMachineBehaviour,vf as StreamEndedEvent,Fx as StreamReceivedEvent,xp as SubEmitterSystem,p0 as SyncedCamera,In as SyncedRoom,Cn as SyncedTransform,uy as TapGestureTrigger,sp as TeleportTarget,f0 as TestRunner,GI as TestSceneUtils,y0 as TestSimulateUserData,Bt as Text,My as TextBuilder,hp as TextExtension,zt as TextureSheetAnimationModule,ro as TiltShiftEffect,Zv as Time,Hs as ToneMappingEffect,kl as TrackHandler,Bi as TrackType,Fe as TrailModule,Ne as TransformData,aa as TransformGizmo,Dt as TriggerBuilder,er as TriggerModel,C as TypeStore,mf as UIRaycastUtils,eh as UIRootComponent,Kf as USDDocument,it as USDObject,bw as USDWriter,oo as USDZExporter,_w as USDZExporter$1,fl as USDZText,Ly as USDZUIExtension,Tx as UriSerializer,zc as UsageMarker,YO as UserJoinedOrLeftRoomModel,yn as VERSION,ay as VariantAction,Ve as VelocityOverLifetimeModule,Ry as VerticalLayoutGroup,ht as VideoPlayer,zi as ViewBox,_s as ViewDevice,ta as Vignette,Qc as VisibilityAction,ks as Voip,Pl as Volume,B as VolumeParameter,wp as VolumeProfile,iM as WaitForFrames,Vv as WaitForPromise,Xg as WaitForSeconds,is as Watch,Uh as WebARCameraBackground,Ui as WebARSessionRoot,rp as WebXR,tr as WebXRButtonFactory,Nh as WebXRImageTracking,Zo as WebXRImageTrackingModel,Ko as WebXRPlaneTracking,Vl as WebXRTrackedImage,Yo as XRControllerFollow,Uo as XRControllerModel,Ei as XRControllerMovement,Ji as XRFlag,Zp as XRRig,Jt as XRState,Zn as XRStateFlag,J1 as __Ignore,pk as __internalNotifyObjectDestroyed,So as activeInHierarchyFieldName,Im as addAttributeChangeCallback,wn as addComponent,xT as addCustomExtensionPlugin,Sr as addNewComponent,Id as addPatch,iu as apply,BM as applyHMRChanges,Cv as applyPrototypeExtensions,av as beginListenDestroy,hv as beginListenInstantiate,cg as binaryIdentifierCasts,wM as build_scene_functions,fr as builtinComponentKeyName,I0 as calculateProgress01,GP as clearMessages,aR as colorSerializer,mv as compareAssociation,Ou as componentSerializer,Jb as copyTexture,wx as createMotion,ni as debugNet,rc as debugOwner,Cw as decompressGpuTexture,Ql as deepClone,Un as delay,Yl as delayForFrames,eu as deserializeObject,Ci as destroy,Mv as destroyComponentInstance,Xx as determineMimeTypeFromExtension,Pe as disposeObjectResources,Yn as disposeStream,oc as editorGuidKeyName,pr as enableSpatialConsole,cR as euler,pR as eventListSerializer,QI as exportAsGLTF,$g as findByGuid,Ua as findObjectOfType,Ev as findObjectsOfType,Sg as findResourceUsers,Px as fitCamera,t_ as fitObjectIntoVolume,kr as foreachComponent,au as foreachComponentEnumerator,hO as forward,Ib as generateQRCode,cv as generateSeed,$t as getBoundingBox,Nb as getCameraController,Cr as getComponent,_c as getComponentInChildren,vc as getComponentInParent,bc as getComponents,za as getComponentsInChildren,tu as getComponentsInParent,mw as getFormattedDate,Ct as getIconElement,Jg as getIconTexture,bn as getLoader,yc as getOrAddComponent,x as getParam,pO as getParentHierarchyPath,SP as getPath,$O as getPeerOptions,O_ as getPeerjsInstance,gk as getResourceUserCount,$b as getTempColor,ti as getTempQuaternion,z as getTempVector,ql as getUrlParams,e_ as getVisibleInCustomShadowRendering,Xb as getWorldDirection,Xm as getWorldEuler,K as getWorldPosition,be as getWorldQuaternion,Rd as getWorldRotation,He as getWorldScale,vs as hasCommercialLicense,Pc as hasIndieLicense,Cu as hasPointerEventComponent,Gn as hasProLicense,r_ as hideDebugConsole,Pw as imageToCanvas,Wa as instantiate,ow as invokeLoadedImportPluginHooks,f_ as invokeXRSessionEnd,g_ as invokeXRSessionStart,Av as isActiveInHierarchy,Na as isActiveSelf,RP as isAndroidDevice,Kb as isAnimationAction,Lx as isComponent,_P as isDebugMode,PP as isDesktop,Or as isDestroyed,A as isDevEnvironment,uk as isDisposed,qI as isExporting,Ix as isGLTFModel,wb as isHostedOnGlitch,hf as isHotReloadEnabled,jM as isHotReloading,kP as isIPad,tx as isIconElement,$i as isLocalNetwork,EP as isMacOS,OP as isMobileDevice,TP as isMozillaXR,LP as isQuest,q_ as isResourceTrackingEnabled,IP as isSafari,ou as isUsingInstancing,AP as isiOS,MP as isiPad,EI as loadAsset,f1 as loadPMREM,A0 as loadSync,Td as logHierarchy,iO as lookAtInverse,Kl as lookAtObject,nO as lookAtScreenPoint,xP as makeId,Rb as makeIdFromRandomWords,en as makeNameSafe,Iv as markAsInstancedRendered,jP as microphonePermissionsGranted,bP as nameof,Pb as nameofFactory,Mx as objectSerializer,DO as offXRSessionEnd,jO as offXRSessionStart,IM as onAfterRender,AM as onBeforeRender,TM as onClear,EM as onDestroy,cx as onInitialized,bu as onStart,hx as onUpdate,sg as onXRSessionEnd,jd as onXRSessionStart,z1 as parseSync,i_ as placeOnSurface,Zm as postprocessFBXMaterials,tR as prefix,Ob as pushState,wP as randomNumber,hg as registerBinaryType,gu as registerComponent,$f as registerComponentExtension,rn as registerCustomEffectType,Hf as registerExportExtensions,Wu as registerExtensions,fx as registerHotReloadType,ig as registerLoader,uv as registerPrefabProvider,Pv as registerPrototypeExtensions,jg as registerType,Eb as relativePathPrefix,Lm as removeAttributeChangeCallback,Wg as removeComponent,wT as removeCustomImportExtensionType,IO as removePatch,us as resolveUrl,Tb as sanitizeString,A1 as saveImage,mI as screenshot,k0 as screenshot2,Ag as sendDestroyed,u as serializable,bv as serializeObject,Ye as serializeable,xc as setActive,Db as setAllowBalloonMessages,VP as setAllowOverlayMessages,kd as setAutoFitEnabled,Vm as setCameraController,jv as setDestroyed,xO as setDevEnvironment,Q_ as setDisposable,Va as setDontDestroy,Tm as setOrAddParamsToUrl,vP as setParam,Xl as setParamWithoutReload,HO as setPeerOptions,dk as setResourceTrackingEnabled,Em as setState,Ym as setVisibleInCustomShadowRendering,Qm as setWorldEuler,mt as setWorldPosition,dr as setWorldPositionXYZ,fn as setWorldQuaternion,qm as setWorldQuaternionXYZW,Zb as setWorldRotation,Jl as setWorldRotationXYZ,ka as setWorldScale,ic as showBalloonError,Te as showBalloonMessage,ge as showBalloonWarning,eg as showDebugConsole,tO as slerp,gc as syncDestroy,yy as syncField,Ig as syncInstantiate,mO as textureToCanvas,Ab as toSourceId,C_ as tryCastBinary,Yx as tryDetermineMimetypeFromBinary,Qx as tryDetermineMimetypeFromURL,Pa as tryFindObject,P_ as tryGetGuid,yx as unregisterHotReloadType,Am as unwatchWrite,Vb as useForAutoFit,Pt as validate,Sd as watchWrite};
|