@needle-tools/engine 3.34.2-alpha.1 โ†’ 3.34.2-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [3.34.2-alpha.1] - 2023-03-13
7
+ ## [3.34.2-alpha.2] - 2023-03-13
8
8
  - Fix: vite build pipeline plugin should wait for output directory up to 10 seconds
9
9
  - Fix: input event button index for mouse on pointer move
10
10
  - Fix: basic styles for links inside needle menu
@@ -30138,13 +30138,13 @@ class Hw {
30138
30138
  }
30139
30139
  r(Hw, "eventListeners", /* @__PURE__ */ new Map());
30140
30140
  const sT = IA("debugdefines");
30141
- GE('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";');
30141
+ GE('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";');
30142
30142
  GE('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
30143
- GE('if(!globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""] = "unknown";');
30144
- GE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";');
30143
+ GE('if(!globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""] = "unknown";');
30144
+ GE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";');
30145
30145
  GE('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
30146
- GE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";');
30147
- const sC = "3.34.2-alpha.1", HR = "undefined", nT = "Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";
30146
+ GE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";');
30147
+ const sC = "3.34.2-alpha.2", HR = "undefined", nT = "Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";
30148
30148
  sT && console.log(`Engine version: ${sC} (generator: ${HR})
30149
30149
  Project built at ${nT}`);
30150
30150
  const ma = "needle_isActiveInHierarchy", lQ = "builtin_components", Hp = "needle_editor_guid";
@@ -30138,13 +30138,13 @@ class Hb {
30138
30138
  }
30139
30139
  h(Hb, "eventListeners", /* @__PURE__ */ new Map());
30140
30140
  const CU = ne("debugdefines");
30141
- ep('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";');
30141
+ ep('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";');
30142
30142
  ep('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
30143
- ep('if(!globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""] = "unknown";');
30144
- ep('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";');
30143
+ ep('if(!globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""] = "unknown";');
30144
+ ep('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";');
30145
30145
  ep('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
30146
- ep('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";');
30147
- const ql = "3.34.2-alpha.1", TT = "undefined", EU = "Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";
30146
+ ep('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";');
30147
+ const ql = "3.34.2-alpha.2", TT = "undefined", EU = "Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";
30148
30148
  CU && console.log(`Engine version: ${ql} (generator: ${TT})
30149
30149
  Project built at ${EU}`);
30150
30150
  const oh = "needle_isActiveInHierarchy", Wd = "builtin_components", o0 = "needle_editor_guid";
@@ -4322,7 +4322,7 @@ void main() {
4322
4322
  `;a+=r(o);const l=Object.keys(s);let c="";for(let u=0;u<l.length;u++){const d=l[u],p=s[d];if(Zm.has(p)){c+="";continue}Zm.set(p,!0),c+=d+":"+n(p,o+1),u<l.length-1&&(c+=", "),c.length>=60&&(c+=`
4323
4323
  `,c+=r(o),a+=c,c="")}return a+=c,a+=`
4324
4324
  }`,a}return s}function r(s){let o="";for(let a=0;a<s;a++)o+=" ";return o}}const eY=ee("nodevlogs");function cn(i,e=Vs.Log){Ra(e,i)}function ji(i){cn(i,Vs.Warn)}function Tk(i){cn(i,Vs.Error)}let sE;function pt(){return eY?!1:sE!==void 0?sE:Is()}function tY(i){sE=i}const wu=new mu,Qr=new S,Hc=new S,Qi=new Me,Ik={X:new S(1,0,0),Y:new S(0,1,0),Z:new S(0,0,1)},oE={type:"change"},Rk={type:"mouseDown"},Pk={type:"mouseUp",mode:null},Bk={type:"objectChange"};class iY extends ge{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new lE;this._gizmo=n,this.add(n);const r=new lY;this._plane=r,this.add(r);const s=this;function o(y,b){let _=b;Object.defineProperty(s,y,{get:function(){return _!==void 0?_:b},set:function(E){_!==E&&(_=E,r[y]=E,n[y]=E,s.dispatchEvent({type:y+"-changed",value:E}),s.dispatchEvent(oE))}}),s[y]=b,r[y]=b,n[y]=b}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new S,l=new S,c=new Me,u=new Me,d=new S,p=new Me,f=new S,m=new S,A=new S,v=0,g=new S;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",u),o("cameraPosition",d),o("cameraQuaternion",p),o("pointStart",f),o("pointEnd",m),o("rotationAxis",A),o("rotationAngle",v),o("eye",g),this._offset=new S,this._startNorm=new S,this._endNorm=new S,this._cameraScale=new S,this._parentPosition=new S,this._parentQuaternion=new Me,this._parentQuaternionInv=new Me,this._parentScale=new S,this._worldScaleStart=new S,this._worldQuaternionInv=new Me,this._worldScale=new S,this._positionStart=new S,this._quaternionStart=new Me,this._scaleStart=new S,this._getPointer=nY.bind(this),this._onPointerDown=sY.bind(this),this._onPointerHover=rY.bind(this),this._onPointerMove=oY.bind(this),this._onPointerUp=aY.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&wu.setFromCamera(e,this.camera);const t=aE(this._gizmo.picker[this.mode],wu);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&wu.setFromCamera(e,this.camera);const t=aE(this._plane,wu,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Rk.mode=this.mode,this.dispatchEvent(Rk)}}pointerMove(e){const t=this.axis,n=this.mode,r=this.object;let s=this.space;if(n==="scale"?s="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(s="world"),r===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&wu.setFromCamera(e,this.camera);const o=aE(this._plane,wu,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),s==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),s==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(s==="local"&&(r.position.applyQuaternion(Qi.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),s==="world"&&(r.parent&&r.position.add(Qr.setFromMatrixPosition(r.parent.matrixWorld)),t.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(Qr.setFromMatrixPosition(r.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Hc.set(a,a,a)}else Qr.copy(this.pointStart),Hc.copy(this.pointEnd),Qr.applyQuaternion(this._worldQuaternionInv),Hc.applyQuaternion(this._worldQuaternionInv),Hc.divide(Qr),t.search("X")===-1&&(Hc.x=1),t.search("Y")===-1&&(Hc.y=1),t.search("Z")===-1&&(Hc.z=1);r.scale.copy(this._scaleStart).multiply(Hc),this.scaleSnap&&(t.search("X")!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Qr.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Qr.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Ik[t]),Qr.copy(Ik[t]),s==="local"&&Qr.applyQuaternion(this.worldQuaternion),Qr.cross(this.eye),Qr.length()===0?l=!0:this.rotationAngle=this._offset.dot(Qr.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),s==="local"&&t!=="E"&&t!=="XYZE"?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(Qi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(Qi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(oE),this.dispatchEvent(Bk)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Pk.mode=this.mode,this.dispatchEvent(Pk)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(oE),this.dispatchEvent(Bk),this.pointStart.copy(this.pointEnd))}getRaycaster(){return wu}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function nY(i){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:i.button};{const e=this.domElement.getBoundingClientRect();return{x:(i.clientX-e.left)/e.width*2-1,y:-(i.clientY-e.top)/e.height*2+1,button:i.button}}}function rY(i){if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(i));break}}function sY(i){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(i.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(i)),this.pointerDown(this._getPointer(i)))}function oY(i){this.enabled&&this.pointerMove(this._getPointer(i))}function aY(i){this.enabled&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(i)))}function aE(i,e,t){const n=e.intersectObject(i,!0);for(let r=0;r<n.length;r++)if(n[r].object.visible||t)return n[r];return!1}const Jy=new Li,Mi=new S(0,1,0),Dk=new S(0,0,0),Ok=new Ee,Ky=new Me,Zy=new Me,Ba=new S,kk=new Ee,$m=new S(1,0,0),Su=new S(0,1,0),eg=new S(0,0,1),$y=new S,tg=new S,ig=new S;class lE extends ge{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new ii({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new gn({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=e.clone();n.opacity=.15;const r=t.clone();r.opacity=.5;const s=e.clone();s.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const u=e.clone();u.color.setHex(255),u.opacity=.5;const d=e.clone();d.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25,e.clone().color.setHex(16776960);const f=e.clone();f.color.setHex(7895160);const m=new xn(0,.04,.1,12);m.translate(0,.05,0);const A=new Bi(.08,.08,.08);A.translate(0,.04,0);const v=new yt;v.setAttribute("position",new ot([0,0,0,1,0,0],3));const g=new xn(.0075,.0075,.5,3);g.translate(0,.25,0);function y(k,W){const U=new yc(k,.0075,3,64,W*Math.PI*2);return U.rotateY(Math.PI/2),U.rotateX(Math.PI/2),U}function b(){const k=new yt;return k.setAttribute("position",new ot([0,0,0,1,1,1],3)),k}const _={X:[[new me(m,s),[.5,0,0],[0,0,-Math.PI/2]],[new me(m,s),[-.5,0,0],[0,0,Math.PI/2]],[new me(g,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new me(m,o),[0,.5,0]],[new me(m,o),[0,-.5,0],[Math.PI,0,0]],[new me(g,o)]],Z:[[new me(m,a),[0,0,.5],[Math.PI/2,0,0]],[new me(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new me(g,a),null,[Math.PI/2,0,0]]],XYZ:[[new me(new Ac(.1,0),d.clone()),[0,0,0]]],XY:[[new me(new Bi(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new me(new Bi(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new me(new Bi(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},E={X:[[new me(new xn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new me(new xn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new me(new xn(.2,0,.6,4),n),[0,.3,0]],[new me(new xn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new me(new xn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new me(new xn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new me(new Ac(.2,0),n)]],XY:[[new me(new Bi(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new me(new Bi(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new me(new Bi(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]]},I={START:[[new me(new Ac(.01,2),r),null,null,null,"helper"]],END:[[new me(new Ac(.01,2),r),null,null,null,"helper"]],DELTA:[[new vn(b(),r),null,null,null,"helper"]],X:[[new vn(v,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vn(v,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vn(v,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},M={XYZE:[[new me(y(.5,1),f),null,[0,Math.PI/2,0]]],X:[[new me(y(.5,.5),s)]],Y:[[new me(y(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new me(y(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new me(y(.75,1),p),null,[0,Math.PI/2,0]]]},T={AXIS:[[new vn(v,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},D={XYZE:[[new me(new va(.25,10,8),n)]],X:[[new me(new yc(.5,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new me(new yc(.5,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new me(new yc(.5,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new me(new yc(.75,.1,2,24),n)]]},C={X:[[new me(A,s),[.5,0,0],[0,0,-Math.PI/2]],[new me(g,s),[0,0,0],[0,0,-Math.PI/2]],[new me(A,s),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new me(A,o),[0,.5,0]],[new me(g,o)],[new me(A,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new me(A,a),[0,0,.5],[Math.PI/2,0,0]],[new me(g,a),[0,0,0],[Math.PI/2,0,0]],[new me(A,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new me(new Bi(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new me(new Bi(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new me(new Bi(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new me(new Bi(.1,.1,.1),d.clone())]]},P={X:[[new me(new xn(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new me(new xn(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new me(new xn(.2,0,.6,4),n),[0,.3,0]],[new me(new xn(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new me(new xn(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new me(new xn(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new me(new Bi(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new me(new Bi(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new me(new Bi(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new me(new Bi(.2,.2,.2),n),[0,0,0]]]},Q={X:[[new vn(v,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vn(v,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vn(v,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function G(k){const W=new ge;for(const U in k)for(let F=k[U].length;F--;){const z=k[U][F][0].clone(),Z=k[U][F][1],K=k[U][F][2],se=k[U][F][3],Ae=k[U][F][4];z.name=U,z.tag=Ae,Z&&z.position.set(Z[0],Z[1],Z[2]),K&&z.rotation.set(K[0],K[1],K[2]),se&&z.scale.set(se[0],se[1],se[2]),z.updateMatrix();const Re=z.geometry.clone();Re.applyMatrix4(z.matrix),z.geometry=Re,z.renderOrder=1/0,z.position.set(0,0,0),z.rotation.set(0,0,0),z.scale.set(1,1,1),W.add(z)}return W}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=G(_)),this.add(this.gizmo.rotate=G(M)),this.add(this.gizmo.scale=G(C)),this.add(this.picker.translate=G(E)),this.add(this.picker.rotate=G(D)),this.add(this.picker.scale=G(P)),this.add(this.helper.translate=G(I)),this.add(this.helper.rotate=G(T)),this.add(this.helper.scale=G(Q)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const t=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Zy;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let r=0;r<n.length;r++){const s=n[r];s.visible=!0,s.rotation.set(0,0,0),s.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),s.scale.set(1,1,1).multiplyScalar(o*this.size/4),s.tag==="helper"){s.visible=!1,s.name==="AXIS"?(s.visible=!!this.axis,this.axis==="X"&&(Qi.setFromEuler(Jy.set(0,0,0)),s.quaternion.copy(t).multiply(Qi),Math.abs(Mi.copy($m).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),this.axis==="Y"&&(Qi.setFromEuler(Jy.set(0,0,Math.PI/2)),s.quaternion.copy(t).multiply(Qi),Math.abs(Mi.copy(Su).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),this.axis==="Z"&&(Qi.setFromEuler(Jy.set(0,Math.PI/2,0)),s.quaternion.copy(t).multiply(Qi),Math.abs(Mi.copy(eg).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),this.axis==="XYZE"&&(Qi.setFromEuler(Jy.set(0,Math.PI/2,0)),Mi.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(Ok.lookAt(Dk,Mi,Su)),s.quaternion.multiply(Qi),s.visible=this.dragging),this.axis==="E"&&(s.visible=!1)):s.name==="START"?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):s.name==="END"?(s.position.copy(this.worldPosition),s.visible=this.dragging):s.name==="DELTA"?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),Qr.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Qr.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(Qr),s.visible=this.dragging):(s.quaternion.copy(t),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=this.axis.search(s.name)!==-1));continue}s.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(s.name==="X"&&Math.abs(Mi.copy($m).applyQuaternion(t).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="Y"&&Math.abs(Mi.copy(Su).applyQuaternion(t).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="Z"&&Math.abs(Mi.copy(eg).applyQuaternion(t).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="XY"&&Math.abs(Mi.copy(eg).applyQuaternion(t).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="YZ"&&Math.abs(Mi.copy($m).applyQuaternion(t).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="XZ"&&Math.abs(Mi.copy(Su).applyQuaternion(t).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)):this.mode==="rotate"&&(Ky.copy(t),Mi.copy(this.eye).applyQuaternion(Qi.copy(t).invert()),s.name.search("E")!==-1&&s.quaternion.setFromRotationMatrix(Ok.lookAt(this.eye,Dk,Su)),s.name==="X"&&(Qi.setFromAxisAngle($m,Math.atan2(-Mi.y,Mi.z)),Qi.multiplyQuaternions(Ky,Qi),s.quaternion.copy(Qi)),s.name==="Y"&&(Qi.setFromAxisAngle(Su,Math.atan2(Mi.x,Mi.z)),Qi.multiplyQuaternions(Ky,Qi),s.quaternion.copy(Qi)),s.name==="Z"&&(Qi.setFromAxisAngle(eg,Math.atan2(Mi.y,Mi.x)),Qi.multiplyQuaternions(Ky,Qi),s.quaternion.copy(Qi))),s.visible=s.visible&&(s.name.indexOf("X")===-1||this.showX),s.visible=s.visible&&(s.name.indexOf("Y")===-1||this.showY),s.visible=s.visible&&(s.name.indexOf("Z")===-1||this.showZ),s.visible=s.visible&&(s.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),s.material._color=s.material._color||s.material.color.clone(),s.material._opacity=s.material._opacity||s.material.opacity,s.material.color.copy(s.material._color),s.material.opacity=s.material._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some(function(a){return s.name===a}))&&(s.material.color.setHex(16776960),s.material.opacity=1)}super.updateMatrixWorld(e)}}class lY extends me{constructor(){super(new Ln(1e5,1e5,2,2),new ii({visible:!1,wireframe:!0,side:hi,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),$y.copy($m).applyQuaternion(t==="local"?this.worldQuaternion:Zy),tg.copy(Su).applyQuaternion(t==="local"?this.worldQuaternion:Zy),ig.copy(eg).applyQuaternion(t==="local"?this.worldQuaternion:Zy),Mi.copy(tg),this.mode){case"translate":case"scale":switch(this.axis){case"X":Mi.copy(this.eye).cross($y),Ba.copy($y).cross(Mi);break;case"Y":Mi.copy(this.eye).cross(tg),Ba.copy(tg).cross(Mi);break;case"Z":Mi.copy(this.eye).cross(ig),Ba.copy(ig).cross(Mi);break;case"XY":Ba.copy(ig);break;case"YZ":Ba.copy($y);break;case"XZ":Mi.copy(ig),Ba.copy(tg);break;case"XYZ":case"E":Ba.set(0,0,0);break}break;case"rotate":default:Ba.set(0,0,0)}Ba.length()===0?this.quaternion.copy(this.cameraQuaternion):(kk.lookAt(Qr.set(0,0,0),Ba,Mi),this.quaternion.setFromRotationMatrix(kk)),super.updateMatrixWorld(e)}}const cY=ee("debugpatch");function eb(i,e,t,n){const r=cY===e;if(!t&&!n)return;const s=e+"___needle";uY(i,e,t,n);const o=Object.getOwnPropertyDescriptor(i,e),a=i[e];r&&console.log("Patch",i.constructor.name,e,o,a),o?(r&&console.log("Apply patch with existing descriptor",i.constructor.name,e,o),typeof o.value=="function"&&(i[e]=Uk(o.value,i,e))):(r&&console.log("Create patch with new property",i.constructor.name,e,o),Object.defineProperty(i,e,{set:function(l){if(typeof l=="function")this[s]=Uk(l,i,e);else{const c=this[s];Fk(i,e,this,c,l),this[s]=l,Nk(i,e,this,c,l)}},get:function(){const l=this[s];return typeof l=="function"&&l[s]?l[s]:l}}))}function hY(i,e,t){const n=hE(i,e);if(n)for(let r=n.length-1;r>=0;r--){const s=n[r];s.prefix===t&&(s.prefix=null),s.postfix===t&&(s.postfix=null),!s.prefix&&!s.postfix&&n.splice(r,1)}}const Lk=Symbol("Needle:Patches:WrappedFunction");function Uk(i,e,t){if(i[Lk])return i;const n=function(...r){Fk(e,t,this,...r);const s=i.apply(this,r);return Nk(e,t,this,s,...r),s};return n[Lk]=!0,n}const tb="Needle:Patches";function cE(){return globalThis[tb]||(globalThis[tb]=new WeakMap),globalThis[tb]}function hE(i,e){const t=cE().get(i);return t?t.get(e):null}function uY(i,e,t,n){let r=cE().get(i);r||(r=new Map,cE().set(i,r));let s=r.get(e);s||(s=[],r.set(e,s)),s.push({prefix:t,postfix:n})}function Fk(i,e,t,...n){var r;if(!t)return;const s=hE(i,e);if(s)for(const o of s)(r=o.prefix)==null||r.call(t,...n)}function Nk(i,e,t,n,...r){var s;if(!t)return;const o=hE(i,e);if(o)for(const a of o)(s=a.postfix)==null||s.call(t,n,...r)}const zk=Symbol("gltf-loader-internal-usage-tracker"),dY=ee("debugusers"),ib=class{constructor(i){h(this,"parser"),h(this,"_getDependency"),h(this,"_loadingId"),h(this,"_loadedObjects",new Set),this.parser=i,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(i){return ib._loadingProcesses>0}beforeRoot(){ib._loadingProcesses++;const i=this,e=this._getDependency;return this.parser.getDependency=function(t,n){const r=e.call(this,t,n);return r.then(s=>(s&&(i._loadedObjects.add(s),s[zk]=i._loadingId),s)),r},null}afterRoot(i){ib._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const e of this._loadedObjects)delete e[zk],e instanceof ge&&(e.parent||e instanceof me&&(dY&&console.warn("> GLTF LOADER: Mesh not used in scene!",e),e.material=null,e.geometry=null));return null}};let uE=ib;h(uE,"_loadingProcesses",0);class jk{constructor(){window.addEventListener("unhandledrejection",e=>{var t;if(e.defaultPrevented)return;const n=(t=e?.reason)==null?void 0:t.path;if(n){const r=n[0];r&&r.tagName==="IMG"&&(console.warn(`Could not load image:
4325
- `+r.src),e.preventDefault())}})}}const nb=ee("trackresources");function Qk(){return nb==="dispose"}let Cu=!0;nb===0&&(Cu=!1);function pY(i){Cu=i}function Gk(){return Cu}const Hk=Symbol("disposable");function dE(i,e){i&&(i[Hk]=e,Eu&&console.warn("Set disposable",e,i))}const Vk=Symbol("disposed");function fY(i){return i[Vk]===!0}function Ii(i){var e;if(i){if(i[Hk]===!1){Eu&&console.warn("Object is marked as not disposable",i);return}if(i[Vk]=!0,i instanceof Nr)Ii(i.environment),Ii(i.background),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial);else if(i instanceof Yo)Ii(i.geometry),Ii(i.material),Ii(i.skeleton),Ii(i.bindMatrix),Ii(i.bindMatrixInverse),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof me)Ii(i.geometry),Ii(i.material),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof yt){xp(i);for(const t of Object.keys(i.attributes)){const n=i.attributes[t];Ii(n)}}else if(i instanceof $e||i instanceof xs)Eu&&console.warn("BufferAttribute dispose not supported",i.count);else if(i instanceof Array)for(const t of i)t instanceof Ot&&Ii(t);else if(i instanceof Ot){xp(i);for(const n of Object.keys(i)){const r=i[n];r instanceof Tt&&(Ii(r),i[n]=null)}const t=i.uniforms;if(t)for(const n of Object.keys(t)){const r=t[n];r instanceof Tt?(Ii(r),t[n]=null):r instanceof be&&(Ii(r.value),r.value=null)}}else i instanceof Tt?(xp(i),xp(i.source),((e=i.source)==null?void 0:e.data)instanceof ImageBitmap&&xp(i.source.data)):i instanceof Hf?(xp(i.boneTexture),i.boneTexture=null):i instanceof Em||!(i instanceof ge)&&Eu&&console.warn("Unknown object type",i)}}function xp(i){i&&((Eu||Qk()||nb)&&console.warn("\u{1F9E8} FREE",i),i instanceof ImageBitmap?i.close():i instanceof _l?i.data=null:i.dispose())}function Wk(i){(i instanceof me||i instanceof Yo)&&(i.material=null,i.geometry=null)}const mY=new Set;function pE(i,e,t=null,n){if(n||(n=mY,n.clear()),!i)return n;const r=i[ng];if(r)for(const s of r)n.has(s)||t?.call(null,s)!==!1&&(n.add(s),e&&pE(s,!0,t,n));return n}function gY(i){return i[rg]}const Eu=ee("debugresourceusers")||ee("debugmemory"),ng=Symbol("needle-resource-users"),rg=Symbol("needle-resource-users-count");function as(i,e){eb(i,e,function(t,n){Cu&&(rb(ng,this,t,!1),rb(ng,this,n,!0))})}Cu&&(as(me.prototype,"material"),as(me.prototype,"geometry"),as(Ot.prototype,"map"),as(Ot.prototype,"bumpMap"),as(Ot.prototype,"alphaMap"),as(Ot.prototype,"normalMap"),as(Ot.prototype,"displacementMap"),as(Ot.prototype,"roughnessMap"),as(Ot.prototype,"metalnessMap"),as(Ot.prototype,"emissiveMap"),as(Ot.prototype,"specularMap"),as(Ot.prototype,"envMap"),as(Ot.prototype,"lightMap"),as(Ot.prototype,"aoMap"),as(Ot.prototype,"gradientMap"));function vY(i){if(Cu===!1)return;const e=i[ng];if(e)for(const t of e)rb(ng,t,i,!1)}Cu&&eb(Ot.prototype,"dispose",function(){vY(this)});let fE=0;function rb(i,e,t,n){if(fE>0)return;if(Array.isArray(t)){for(const s of t)rb(i,e,s,n);return}if(!t)return;let r=t[i];if(r||(r=new Set),n){if(e&&!r.has(e)){r.add(e);let s=t[rg]||0;s+=1,t[rg]=s,Eu&&console.warn(`\u{1F7E2} Added user of "${t.type}"`,e,t,s,"users:",r)}}else if(e&&r.has(e)){r.delete(e);let s=t[rg]||0;s>0&&(s-=1,t[rg]=s),Eu&&console.warn(`\u{1F534} Removed user of "${t.type}"`,e,t,s,"users:",r),s<=0&&(uE.isLoading(t)||(nb&&console.warn(`\u{1F534} Removed all user of "${t.type}"`,t),Qk()&&Ii(t)))}t[i]=r}try{eb(Il.prototype,"render",function(){fE++},function(){fE--})}catch(i){console.warn("Could not wrap WebGLRenderer.render",i)}var sg=(i=>(i.Added="component-added",i.Removing="removing-component",i))(sg||{});const qk=ee("debugcomponentevents");class og{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let n=this.eventListeners.get(e);n||(n=[]),n.push(t),this.eventListeners.set(e,n),qk&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const n=this.eventListeners.get(e);if(!n)return;const r=n.indexOf(t);r<0||n.splice(r,1)}static dispatchComponentLifecycleEvent(e,t){const n=this.eventListeners.get(e);if(qk&&console.log("Dispatching event "+e,n),!!n)for(const r of n)r(t)}}h(og,"eventListeners",new Map);const Xk=ee("debugdefines");wp('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";'),wp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),wp('if(!globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""] = "unknown";'),wp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";'),wp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),wp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";');const Ul="3.34.2-alpha.1",sb="undefined",mE="Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";Xk&&console.log(`Engine version: ${Ul} (generator: ${sb})
4325
+ `+r.src),e.preventDefault())}})}}const nb=ee("trackresources");function Qk(){return nb==="dispose"}let Cu=!0;nb===0&&(Cu=!1);function pY(i){Cu=i}function Gk(){return Cu}const Hk=Symbol("disposable");function dE(i,e){i&&(i[Hk]=e,Eu&&console.warn("Set disposable",e,i))}const Vk=Symbol("disposed");function fY(i){return i[Vk]===!0}function Ii(i){var e;if(i){if(i[Hk]===!1){Eu&&console.warn("Object is marked as not disposable",i);return}if(i[Vk]=!0,i instanceof Nr)Ii(i.environment),Ii(i.background),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial);else if(i instanceof Yo)Ii(i.geometry),Ii(i.material),Ii(i.skeleton),Ii(i.bindMatrix),Ii(i.bindMatrixInverse),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof me)Ii(i.geometry),Ii(i.material),Ii(i.customDepthMaterial),Ii(i.customDistanceMaterial),i.geometry=null,i.material=null;else if(i instanceof yt){xp(i);for(const t of Object.keys(i.attributes)){const n=i.attributes[t];Ii(n)}}else if(i instanceof $e||i instanceof xs)Eu&&console.warn("BufferAttribute dispose not supported",i.count);else if(i instanceof Array)for(const t of i)t instanceof Ot&&Ii(t);else if(i instanceof Ot){xp(i);for(const n of Object.keys(i)){const r=i[n];r instanceof Tt&&(Ii(r),i[n]=null)}const t=i.uniforms;if(t)for(const n of Object.keys(t)){const r=t[n];r instanceof Tt?(Ii(r),t[n]=null):r instanceof be&&(Ii(r.value),r.value=null)}}else i instanceof Tt?(xp(i),xp(i.source),((e=i.source)==null?void 0:e.data)instanceof ImageBitmap&&xp(i.source.data)):i instanceof Hf?(xp(i.boneTexture),i.boneTexture=null):i instanceof Em||!(i instanceof ge)&&Eu&&console.warn("Unknown object type",i)}}function xp(i){i&&((Eu||Qk()||nb)&&console.warn("\u{1F9E8} FREE",i),i instanceof ImageBitmap?i.close():i instanceof _l?i.data=null:i.dispose())}function Wk(i){(i instanceof me||i instanceof Yo)&&(i.material=null,i.geometry=null)}const mY=new Set;function pE(i,e,t=null,n){if(n||(n=mY,n.clear()),!i)return n;const r=i[ng];if(r)for(const s of r)n.has(s)||t?.call(null,s)!==!1&&(n.add(s),e&&pE(s,!0,t,n));return n}function gY(i){return i[rg]}const Eu=ee("debugresourceusers")||ee("debugmemory"),ng=Symbol("needle-resource-users"),rg=Symbol("needle-resource-users-count");function as(i,e){eb(i,e,function(t,n){Cu&&(rb(ng,this,t,!1),rb(ng,this,n,!0))})}Cu&&(as(me.prototype,"material"),as(me.prototype,"geometry"),as(Ot.prototype,"map"),as(Ot.prototype,"bumpMap"),as(Ot.prototype,"alphaMap"),as(Ot.prototype,"normalMap"),as(Ot.prototype,"displacementMap"),as(Ot.prototype,"roughnessMap"),as(Ot.prototype,"metalnessMap"),as(Ot.prototype,"emissiveMap"),as(Ot.prototype,"specularMap"),as(Ot.prototype,"envMap"),as(Ot.prototype,"lightMap"),as(Ot.prototype,"aoMap"),as(Ot.prototype,"gradientMap"));function vY(i){if(Cu===!1)return;const e=i[ng];if(e)for(const t of e)rb(ng,t,i,!1)}Cu&&eb(Ot.prototype,"dispose",function(){vY(this)});let fE=0;function rb(i,e,t,n){if(fE>0)return;if(Array.isArray(t)){for(const s of t)rb(i,e,s,n);return}if(!t)return;let r=t[i];if(r||(r=new Set),n){if(e&&!r.has(e)){r.add(e);let s=t[rg]||0;s+=1,t[rg]=s,Eu&&console.warn(`\u{1F7E2} Added user of "${t.type}"`,e,t,s,"users:",r)}}else if(e&&r.has(e)){r.delete(e);let s=t[rg]||0;s>0&&(s-=1,t[rg]=s),Eu&&console.warn(`\u{1F534} Removed user of "${t.type}"`,e,t,s,"users:",r),s<=0&&(uE.isLoading(t)||(nb&&console.warn(`\u{1F534} Removed all user of "${t.type}"`,t),Qk()&&Ii(t)))}t[i]=r}try{eb(Il.prototype,"render",function(){fE++},function(){fE--})}catch(i){console.warn("Could not wrap WebGLRenderer.render",i)}var sg=(i=>(i.Added="component-added",i.Removing="removing-component",i))(sg||{});const qk=ee("debugcomponentevents");class og{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let n=this.eventListeners.get(e);n||(n=[]),n.push(t),this.eventListeners.set(e,n),qk&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const n=this.eventListeners.get(e);if(!n)return;const r=n.indexOf(t);r<0||n.splice(r,1)}static dispatchComponentLifecycleEvent(e,t){const n=this.eventListeners.get(e);if(qk&&console.log("Dispatching event "+e,n),!!n)for(const r of n)r(t)}}h(og,"eventListeners",new Map);const Xk=ee("debugdefines");wp('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";'),wp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),wp('if(!globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""] = "unknown";'),wp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";'),wp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),wp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";');const Ul="3.34.2-alpha.2",sb="undefined",mE="Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";Xk&&console.log(`Engine version: ${Ul} (generator: ${sb})
4326
4326
  Project built at ${mE}`);const Fl="needle_isActiveInHierarchy",Mu="builtin_components",ag="needle_editor_guid";function wp(i){try{(0,eval)(i)}catch(e){Xk&&console.error(e)}}const lg=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),Yk=Symbol("isUsingInstancing"),Jk=Symbol("instancingRenderer"),gE=Symbol("instancingAutoUpdateBounds");class ba{static isUsingInstancing(e){return e[Yk]===!0}static getRenderer(e){return e[Jk]||null}setAutoUpdateBounds(e,t){const n=ba.getRenderer(e);n&&(n[gE]=t)}static markDirty(e,t=!0){if(e&&(this.isUsingInstancing(e)&&(e[lg]=!0,e.matrixWorldNeedsUpdate=!0),t))for(const n of e.children)ba.markDirty(n,!0)}}function Tu(i,e){try{e?i(e):i()}catch(t){return console.error(t),!1}return!0}const vE=ee("debugnewscripts"),AY=ee("debughierarchy"),Gi=[];function yY(){return Gi.length>0}function ob(i){if(!(i.new_scripts.length<=0)){if(vE&&console.log("Register new components",i.new_scripts.length,[...i.new_scripts],i.alias?"element: "+i.alias:i.hash,i),i.new_scripts_pre_setup_callbacks.length>0){for(const e of i.new_scripts_pre_setup_callbacks)e&&e();i.new_scripts_pre_setup_callbacks.length=0}Gi.length=0,i.new_scripts.length>0&&Gi.push(...i.new_scripts),i.new_scripts.length=0;for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.isComponent!==!0){(pt()||vE)&&console.error(`Registered script is not a Needle Engine component.
4327
4327
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4328
4328
  `,t),Gi.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),Gi.splice(e,1),e--;continue}t.context=i,cg(t.gameObject),AE(t,i)}catch(t){console.error(t),Nl(Gi[e],i),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed){Nl(Gi[e],i),Gi.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(n){console.error(n)}t.__internalAwake!==void 0&&(t.gameObject||console.error("MISSING GAMEOBJECT",t,t.gameObject),cg(t.gameObject),t.activeAndEnabled&&Tu(t.__internalAwake.bind(t)))}catch(t){console.error(t),Nl(Gi[e],i),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed||t.enabled===!1||(cg(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,Tu(t.__internalEnable.bind(t)))}catch(t){console.error(t),Nl(Gi[e],i),Gi.splice(e,1),e--}for(let e=0;e<Gi.length;e++)try{const t=Gi[e];if(t.destroyed||!t.gameObject)continue;i.new_script_start.push(t)}catch(t){console.error(t),Nl(Gi[e],i),Gi.splice(e,1),e--}Gi.length=0;for(const e of i.new_scripts_post_setup_callbacks)e&&e();i.new_scripts_post_setup_callbacks.length=0}}function bY(i){i&&(i.__internalDisable(!0),Nl(i,i.context))}function Kk(i,e){for(let t=0;t<i.new_script_start.length;t++)try{const n=i.new_script_start[t];if(e!==void 0&&n.gameObject!==e||n.destroyed||n.activeAndEnabled===!1)continue;Tu(n.__internalAwake.bind(n)),n.enabled&&(Tu(n.__internalEnable.bind(n)),Tu(n.__internalStart.bind(n)),i.new_script_start.splice(t,1),t--)}catch(n){console.error(n),Nl(i.new_script_start[t],i),i.new_script_start.splice(t,1),t--}}function AE(i,e){e.scripts.indexOf(i)===-1&&(e.scripts.push(i),i.earlyUpdate&&e.scripts_earlyUpdate.push(i),i.update&&e.scripts_update.push(i),i.lateUpdate&&e.scripts_lateUpdate.push(i),i.onBeforeRender&&e.scripts_onBeforeRender.push(i),i.onAfterRender&&e.scripts_onAfterRender.push(i),i.onPausedChanged&&e.scripts_pausedChanged.push(i),yE(i,null)&&e.new_scripts_xr.push(i),yE(i,"immersive-vr")&&e.scripts_immersive_vr.push(i),yE(i,"immersive-ar")&&e.scripts_immersive_ar.push(i))}function Nl(i,e){xo(i,e.new_scripts),xo(i,e.new_script_start),xo(i,e.scripts),xo(i,e.scripts_earlyUpdate),xo(i,e.scripts_update),xo(i,e.scripts_lateUpdate),xo(i,e.scripts_onBeforeRender),xo(i,e.scripts_onAfterRender),xo(i,e.scripts_pausedChanged),xo(i,e.new_scripts_xr),xo(i,e.scripts_immersive_vr),xo(i,e.scripts_immersive_ar),e.stopAllCoroutinesFrom(i)}function xo(i,e){const t=e.indexOf(i);t>=0&&e.splice(t,1)}function yE(i,e){var t;if(i){const n=i;if(n.onBeforeXR||n.onEnterXR||n.onUpdateXR||n.onLeaveXR||n.onXRControllerAdded||n.onXRControllerRemoved)return!(e!=null&&((t=n.supportsXR)==null?void 0:t.call(n,e))===!1)}return!1}function ab(i){if(i||(i=li.Current.scene),!i){console.trace("Invalid call - no current context.");return}const e=Op(i);Zk(i,e,!0)||(vE||pt()?console.error(`Error updating hierarchy
@@ -4322,7 +4322,7 @@ void main() {
4322
4322
  `;a+=n(o);const l=Object.keys(r);let c="";for(let u=0;u<l.length;u++){const d=l[u],f=r[d];if(xm.has(f)){c+="";continue}xm.set(f,!0),c+=d+":"+i(f,o+1),u<l.length-1&&(c+=", "),c.length>=60&&(c+=`
4323
4323
  `,c+=n(o),a+=c,c="")}return a+=c,a+=`
4324
4324
  }`,a}return r}function n(r){let o="";for(let a=0;a<r;a++)o+=" ";return o}}const eY=ne("nodevlogs");function yn(s,e=oo.Log){$a(e,s)}function $i(s){yn(s,oo.Warn)}function SN(s){yn(s,oo.Error)}let w1;function _t(){return eY?!1:w1!==void 0?w1:Gr()}function tY(s){w1=s}const hu=new fd,Xs=new w,Vc=new w,Yi=new Ce,B2={X:new w(1,0,0),Y:new w(0,1,0),Z:new w(0,0,1)},XS={type:"change"},D2={type:"mouseDown"},O2={type:"mouseUp",mode:null},L2={type:"objectChange"};class iY extends ge{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const i=new SI;this._gizmo=i,this.add(i);const n=new lY;this._plane=n,this.add(n);const r=this;function o(_,y){let b=y;Object.defineProperty(r,_,{get:function(){return b!==void 0?b:y},set:function(E){b!==E&&(b=E,n[_]=E,i[_]=E,r.dispatchEvent({type:_+"-changed",value:E}),r.dispatchEvent(XS))}}),r[_]=y,n[_]=y,i[_]=y}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new w,l=new w,c=new Ce,u=new Ce,d=new w,f=new Ce,p=new w,m=new w,A=new w,v=0,g=new w;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",u),o("cameraPosition",d),o("cameraQuaternion",f),o("pointStart",p),o("pointEnd",m),o("rotationAxis",A),o("rotationAngle",v),o("eye",g),this._offset=new w,this._startNorm=new w,this._endNorm=new w,this._cameraScale=new w,this._parentPosition=new w,this._parentQuaternion=new Ce,this._parentQuaternionInv=new Ce,this._parentScale=new w,this._worldScaleStart=new w,this._worldQuaternionInv=new Ce,this._worldScale=new w,this._positionStart=new w,this._quaternionStart=new Ce,this._scaleStart=new w,this._getPointer=nY.bind(this),this._onPointerDown=rY.bind(this),this._onPointerHover=sY.bind(this),this._onPointerMove=oY.bind(this),this._onPointerUp=aY.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&hu.setFromCamera(e,this.camera);const t=YS(this._gizmo.picker[this.mode],hu);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&hu.setFromCamera(e,this.camera);const t=YS(this._plane,hu,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,D2.mode=this.mode,this.dispatchEvent(D2)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&hu.setFromCamera(e,this.camera);const o=YS(this._plane,hu,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(n.position.applyQuaternion(Yi.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),r==="world"&&(n.parent&&n.position.add(Xs.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(Xs.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Vc.set(a,a,a)}else Xs.copy(this.pointStart),Vc.copy(this.pointEnd),Xs.applyQuaternion(this._worldQuaternionInv),Vc.applyQuaternion(this._worldQuaternionInv),Vc.divide(Xs),t.search("X")===-1&&(Vc.x=1),t.search("Y")===-1&&(Vc.y=1),t.search("Z")===-1&&(Vc.z=1);n.scale.copy(this._scaleStart).multiply(Vc),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Xs.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Xs.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(B2[t]),Xs.copy(B2[t]),r==="local"&&Xs.applyQuaternion(this.worldQuaternion),Xs.cross(this.eye),Xs.length()===0?l=!0:this.rotationAngle=this._offset.dot(Xs.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),r==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(Yi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Yi.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(XS),this.dispatchEvent(L2)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(O2.mode=this.mode,this.dispatchEvent(O2)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(XS),this.dispatchEvent(L2),this.pointStart.copy(this.pointEnd))}getRaycaster(){return hu}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function nY(s){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:s.button};{const e=this.domElement.getBoundingClientRect();return{x:(s.clientX-e.left)/e.width*2-1,y:-(s.clientY-e.top)/e.height*2+1,button:s.button}}}function sY(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function rY(s){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(s.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(s)),this.pointerDown(this._getPointer(s)))}function oY(s){this.enabled&&this.pointerMove(this._getPointer(s))}function aY(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function YS(s,e,t){const i=e.intersectObject(s,!0);for(let n=0;n<i.length;n++)if(i[n].object.visible||t)return i[n];return!1}const c0=new Gi,Pi=new w(0,1,0),k2=new w(0,0,0),F2=new we,h0=new Ce,h_=new Ce,Ra=new w,U2=new we,$m=new w(1,0,0),Eu=new w(0,1,0),eg=new w(0,0,1),u0=new w,wm=new w,Sm=new w;class SI extends ge{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new ai({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new Rn({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const n=t.clone();n.opacity=.5;const r=e.clone();r.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const u=e.clone();u.color.setHex(255),u.opacity=.5;const d=e.clone();d.opacity=.25;const f=e.clone();f.color.setHex(16776960),f.opacity=.25,e.clone().color.setHex(16776960);const m=e.clone();m.color.setHex(7895160);const A=new Cn(0,.04,.1,12);A.translate(0,.05,0);const v=new Li(.08,.08,.08);v.translate(0,.04,0);const g=new wt;g.setAttribute("position",new ut([0,0,0,1,0,0],3));const _=new Cn(.0075,.0075,.5,3);_.translate(0,.25,0);function y(V,L){const k=new Jl(V,.0075,3,64,L*Math.PI*2);return k.rotateY(Math.PI/2),k.rotateX(Math.PI/2),k}function b(){const V=new wt;return V.setAttribute("position",new ut([0,0,0,1,1,1],3)),V}const E={X:[[new pe(A,r),[.5,0,0],[0,0,-Math.PI/2]],[new pe(A,r),[-.5,0,0],[0,0,Math.PI/2]],[new pe(_,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new pe(A,o),[0,.5,0]],[new pe(A,o),[0,-.5,0],[Math.PI,0,0]],[new pe(_,o)]],Z:[[new pe(A,a),[0,0,.5],[Math.PI/2,0,0]],[new pe(A,a),[0,0,-.5],[-Math.PI/2,0,0]],[new pe(_,a),null,[Math.PI/2,0,0]]],XYZ:[[new pe(new nc(.1,0),d.clone()),[0,0,0]]],XY:[[new pe(new Li(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new pe(new Li(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new pe(new Li(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},M={X:[[new pe(new Cn(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new pe(new Cn(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new pe(new Cn(.2,0,.6,4),i),[0,.3,0]],[new pe(new Cn(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new pe(new Cn(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new pe(new Cn(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new pe(new nc(.2,0),i)]],XY:[[new pe(new Li(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new pe(new Li(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new pe(new Li(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},T={START:[[new pe(new nc(.01,2),n),null,null,null,"helper"]],END:[[new pe(new nc(.01,2),n),null,null,null,"helper"]],DELTA:[[new Mn(b(),n),null,null,null,"helper"]],X:[[new Mn(g,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Mn(g,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Mn(g,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},C={XYZE:[[new pe(y(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new pe(y(.5,.5),r)]],Y:[[new pe(y(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new pe(y(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new pe(y(.75,1),f),null,[0,Math.PI/2,0]]]},B={AXIS:[[new Mn(g,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},S={XYZE:[[new pe(new Sa(.25,10,8),i)]],X:[[new pe(new Jl(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new pe(new Jl(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new pe(new Jl(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new pe(new Jl(.75,.1,2,24),i)]]},R={X:[[new pe(v,r),[.5,0,0],[0,0,-Math.PI/2]],[new pe(_,r),[0,0,0],[0,0,-Math.PI/2]],[new pe(v,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new pe(v,o),[0,.5,0]],[new pe(_,o)],[new pe(v,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new pe(v,a),[0,0,.5],[Math.PI/2,0,0]],[new pe(_,a),[0,0,0],[Math.PI/2,0,0]],[new pe(v,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new pe(new Li(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new pe(new Li(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new pe(new Li(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new pe(new Li(.1,.1,.1),d.clone())]]},Q={X:[[new pe(new Cn(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new pe(new Cn(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new pe(new Cn(.2,0,.6,4),i),[0,.3,0]],[new pe(new Cn(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new pe(new Cn(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new pe(new Cn(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new pe(new Li(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new pe(new Li(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new pe(new Li(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new pe(new Li(.2,.2,.2),i),[0,0,0]]]},z={X:[[new Mn(g,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new Mn(g,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new Mn(g,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function O(V){const L=new ge;for(const k in V)for(let G=V[k].length;G--;){const Y=V[k][G][0].clone(),$=V[k][G][1],re=V[k][G][2],ce=V[k][G][3],Re=V[k][G][4];Y.name=k,Y.tag=Re,$&&Y.position.set($[0],$[1],$[2]),re&&Y.rotation.set(re[0],re[1],re[2]),ce&&Y.scale.set(ce[0],ce[1],ce[2]),Y.updateMatrix();const ie=Y.geometry.clone();ie.applyMatrix4(Y.matrix),Y.geometry=ie,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),L.add(Y)}return L}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=O(E)),this.add(this.gizmo.rotate=O(C)),this.add(this.gizmo.scale=O(R)),this.add(this.picker.translate=O(M)),this.add(this.picker.rotate=O(S)),this.add(this.picker.scale=O(Q)),this.add(this.helper.translate=O(T)),this.add(this.helper.rotate=O(B)),this.add(this.helper.scale=O(z)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:h_;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let r=0;r<n.length;r++){const o=n[r];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(Yi.setFromEuler(c0.set(0,0,0)),o.quaternion.copy(i).multiply(Yi),Math.abs(Pi.copy($m).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(Yi.setFromEuler(c0.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(Yi),Math.abs(Pi.copy(Eu).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Yi.setFromEuler(c0.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(Yi),Math.abs(Pi.copy(eg).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Yi.setFromEuler(c0.set(0,Math.PI/2,0)),Pi.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(F2.lookAt(k2,Pi,Eu)),o.quaternion.multiply(Yi),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Xs.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Xs.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Xs),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(Pi.copy($m).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(Pi.copy(Eu).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(Pi.copy(eg).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(Pi.copy(eg).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(Pi.copy($m).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(Pi.copy(Eu).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(h0.copy(i),Pi.copy(this.eye).applyQuaternion(Yi.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(F2.lookAt(this.eye,k2,Eu)),o.name==="X"&&(Yi.setFromAxisAngle($m,Math.atan2(-Pi.y,Pi.z)),Yi.multiplyQuaternions(h0,Yi),o.quaternion.copy(Yi)),o.name==="Y"&&(Yi.setFromAxisAngle(Eu,Math.atan2(Pi.x,Pi.z)),Yi.multiplyQuaternions(h0,Yi),o.quaternion.copy(Yi)),o.name==="Z"&&(Yi.setFromAxisAngle(eg,Math.atan2(Pi.y,Pi.x)),Yi.multiplyQuaternions(h0,Yi),o.quaternion.copy(Yi))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class lY extends pe{constructor(){super(new zn(1e5,1e5,2,2),new ai({visible:!1,wireframe:!0,side:mi,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),u0.copy($m).applyQuaternion(t==="local"?this.worldQuaternion:h_),wm.copy(Eu).applyQuaternion(t==="local"?this.worldQuaternion:h_),Sm.copy(eg).applyQuaternion(t==="local"?this.worldQuaternion:h_),Pi.copy(wm),this.mode){case"translate":case"scale":switch(this.axis){case"X":Pi.copy(this.eye).cross(u0),Ra.copy(u0).cross(Pi);break;case"Y":Pi.copy(this.eye).cross(wm),Ra.copy(wm).cross(Pi);break;case"Z":Pi.copy(this.eye).cross(Sm),Ra.copy(Sm).cross(Pi);break;case"XY":Ra.copy(Sm);break;case"YZ":Ra.copy(u0);break;case"XZ":Pi.copy(Sm),Ra.copy(wm);break;case"XYZ":case"E":Ra.set(0,0,0);break}break;case"rotate":default:Ra.set(0,0,0)}Ra.length()===0?this.quaternion.copy(this.cameraQuaternion):(U2.lookAt(Xs.set(0,0,0),Ra,Pi),this.quaternion.setFromRotationMatrix(U2)),super.updateMatrixWorld(e)}}const cY=ne("debugpatch");function Nx(s,e,t,i){const n=cY===e;if(!t&&!i)return;const r=e+"___needle";uY(s,e,t,i);const o=Object.getOwnPropertyDescriptor(s,e),a=s[e];n&&console.log("Patch",s.constructor.name,e,o,a),o?(n&&console.log("Apply patch with existing descriptor",s.constructor.name,e,o),typeof o.value=="function"&&(s[e]=z2(o.value,s,e))):(n&&console.log("Create patch with new property",s.constructor.name,e,o),Object.defineProperty(s,e,{set:function(l){if(typeof l=="function")this[r]=z2(l,s,e);else{const c=this[r];CN(s,e,this,c,l),this[r]=l,EN(s,e,this,c,l)}},get:function(){const l=this[r];return typeof l=="function"&&l[r]?l[r]:l}}))}function hY(s,e,t){const i=CI(s,e);if(i)for(let n=i.length-1;n>=0;n--){const r=i[n];r.prefix===t&&(r.prefix=null),r.postfix===t&&(r.postfix=null),!r.prefix&&!r.postfix&&i.splice(n,1)}}const N2=Symbol("Needle:Patches:WrappedFunction");function z2(s,e,t){if(s[N2])return s;const i=function(...n){CN(e,t,this,...n);const r=s.apply(this,n);return EN(e,t,this,r,...n),r};return i[N2]=!0,i}const u_="Needle:Patches";function S1(){return globalThis[u_]||(globalThis[u_]=new WeakMap),globalThis[u_]}function CI(s,e){const t=S1().get(s);return t?t.get(e):null}function uY(s,e,t,i){let n=S1().get(s);n||(n=new Map,S1().set(s,n));let r=n.get(e);r||(r=[],n.set(e,r)),r.push({prefix:t,postfix:i})}function CN(s,e,t,...i){var r;if(!t)return;const n=CI(s,e);if(n)for(const o of n)(r=o.prefix)==null||r.call(t,...i)}function EN(s,e,t,i,...n){var o;if(!t)return;const r=CI(s,e);if(r)for(const a of r)(o=a.postfix)==null||o.call(t,i,...n)}const G2=Symbol("gltf-loader-internal-usage-tracker"),dY=ne("debugusers"),Hg=class{constructor(e){h(this,"parser");h(this,"_getDependency");h(this,"_loadingId");h(this,"_loadedObjects",new Set);this.parser=e,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(e){return Hg._loadingProcesses>0}beforeRoot(){Hg._loadingProcesses++;const e=this,t=this._getDependency;return this.parser.getDependency=function(i,n){const r=t.call(this,i,n);return r.then(o=>(o&&(e._loadedObjects.add(o),o[G2]=e._loadingId),o)),r},null}afterRoot(e){Hg._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const t of this._loadedObjects)delete t[G2],t instanceof ge&&(t.parent||t instanceof pe&&(dY&&console.warn("> GLTF LOADER: Mesh not used in scene!",t),t.material=null,t.geometry=null));return null}};let xg=Hg;h(xg,"_loadingProcesses",0);class MN{constructor(){window.addEventListener("unhandledrejection",e=>{var i;if(e.defaultPrevented)return;const t=(i=e==null?void 0:e.reason)==null?void 0:i.path;if(t){const n=t[0];n&&n.tagName==="IMG"&&(console.warn(`Could not load image:
4325
- `+n.src),e.preventDefault())}})}}const zx=ne("trackresources");function TN(){return zx==="dispose"}let md=!0;zx===0&&(md=!1);function fY(s){md=s}function IN(){return md}const RN=Symbol("disposable");function EI(s,e){s&&(s[RN]=e,Wu&&console.warn("Set disposable",e,s))}const PN=Symbol("disposed");function pY(s){return s[PN]===!0}function Di(s){var e;if(s){if(s[RN]===!1){Wu&&console.warn("Object is marked as not disposable",s);return}if(s[PN]=!0,s instanceof tr)Di(s.environment),Di(s.background),Di(s.customDepthMaterial),Di(s.customDistanceMaterial);else if(s instanceof ma)Di(s.geometry),Di(s.material),Di(s.skeleton),Di(s.bindMatrix),Di(s.bindMatrixInverse),Di(s.customDepthMaterial),Di(s.customDistanceMaterial),s.geometry=null,s.material=null;else if(s instanceof pe)Di(s.geometry),Di(s.material),Di(s.customDepthMaterial),Di(s.customDistanceMaterial),s.geometry=null,s.material=null;else if(s instanceof wt){uf(s);for(const t of Object.keys(s.attributes)){const i=s.attributes[t];Di(i)}}else if(s instanceof it||s instanceof xr)Wu&&console.warn("BufferAttribute dispose not supported",s.count);else if(s instanceof Array)for(const t of s)t instanceof Nt&&Di(t);else if(s instanceof Nt){uf(s);for(const i of Object.keys(s)){const n=s[i];n instanceof Dt&&(Di(n),s[i]=null)}const t=s.uniforms;if(t)for(const i of Object.keys(t)){const n=t[i];n instanceof Dt?(Di(n),t[i]=null):n instanceof _e&&(Di(n.value),n.value=null)}}else s instanceof Dt?(uf(s),uf(s.source),((e=s.source)==null?void 0:e.data)instanceof ImageBitmap&&uf(s.source.data)):s instanceof Rp?(uf(s.boneTexture),s.boneTexture=null):s instanceof qv||!(s instanceof ge)&&Wu&&console.warn("Unknown object type",s)}}function uf(s){s&&((Wu||TN()||zx)&&console.warn("๐Ÿงจ FREE",s),s instanceof ImageBitmap?s.close():s instanceof ic?s.data=null:s.dispose())}function BN(s){(s instanceof pe||s instanceof ma)&&(s.material=null,s.geometry=null)}const mY=new Set;function MI(s,e,t=null,i){if(i||(i=mY,i.clear()),!s)return i;const n=s[gv];if(n)for(const r of n)i.has(r)||(t==null?void 0:t.call(null,r))!==!1&&(i.add(r),e&&MI(r,!0,t,i));return i}function gY(s){return s[tg]}const Wu=ne("debugresourceusers")||ne("debugmemory"),gv=Symbol("needle-resource-users"),tg=Symbol("needle-resource-users-count");function lr(s,e){Nx(s,e,function(t,i){md&&(hb(gv,this,t,!1),hb(gv,this,i,!0))})}md&&(lr(pe.prototype,"material"),lr(pe.prototype,"geometry"),lr(Nt.prototype,"map"),lr(Nt.prototype,"bumpMap"),lr(Nt.prototype,"alphaMap"),lr(Nt.prototype,"normalMap"),lr(Nt.prototype,"displacementMap"),lr(Nt.prototype,"roughnessMap"),lr(Nt.prototype,"metalnessMap"),lr(Nt.prototype,"emissiveMap"),lr(Nt.prototype,"specularMap"),lr(Nt.prototype,"envMap"),lr(Nt.prototype,"lightMap"),lr(Nt.prototype,"aoMap"),lr(Nt.prototype,"gradientMap"));function vY(s){if(md===!1)return;const e=s[gv];if(e)for(const t of e)hb(gv,t,s,!1)}md&&Nx(Nt.prototype,"dispose",function(){vY(this)});let C1=0;function hb(s,e,t,i){if(C1>0)return;if(Array.isArray(t)){for(const r of t)hb(s,e,r,i);return}if(!t)return;let n=t[s];if(n||(n=new Set),i){if(e&&!n.has(e)){n.add(e);let r=t[tg]||0;r+=1,t[tg]=r,Wu&&console.warn(`๐ŸŸข Added user of "${t.type}"`,e,t,r,"users:",n)}}else if(e&&n.has(e)){n.delete(e);let r=t[tg]||0;r>0&&(r-=1,t[tg]=r),Wu&&console.warn(`๐Ÿ”ด Removed user of "${t.type}"`,e,t,r,"users:",n),r<=0&&(xg.isLoading(t)||(zx&&console.warn(`๐Ÿ”ด Removed all user of "${t.type}"`,t),TN()&&Di(t)))}t[s]=n}try{Nx(bc.prototype,"render",function(){C1++},function(){C1--})}catch(s){console.warn("Could not wrap WebGLRenderer.render",s)}var rA=(s=>(s.Added="component-added",s.Removing="removing-component",s))(rA||{});const H2=ne("debugcomponentevents");class oA{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let i=this.eventListeners.get(e);i||(i=[]),i.push(t),this.eventListeners.set(e,i),H2&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const i=this.eventListeners.get(e);if(!i)return;const n=i.indexOf(t);n<0||i.splice(n,1)}static dispatchComponentLifecycleEvent(e,t){const i=this.eventListeners.get(e);if(H2&&console.log("Dispatching event "+e,i),!!i)for(const n of i)n(t)}}h(oA,"eventListeners",new Map);const DN=ne("debugdefines");Dp('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";');Dp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');Dp('if(!globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)""] = "unknown";');Dp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";');Dp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');Dp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";');const tl="3.34.2-alpha.1",Gx="undefined",TI="Wed Mar 13 2024 18:21:37 GMT+0100 (Central European Standard Time)";DN&&console.log(`Engine version: ${tl} (generator: ${Gx})
4325
+ `+n.src),e.preventDefault())}})}}const zx=ne("trackresources");function TN(){return zx==="dispose"}let md=!0;zx===0&&(md=!1);function fY(s){md=s}function IN(){return md}const RN=Symbol("disposable");function EI(s,e){s&&(s[RN]=e,Wu&&console.warn("Set disposable",e,s))}const PN=Symbol("disposed");function pY(s){return s[PN]===!0}function Di(s){var e;if(s){if(s[RN]===!1){Wu&&console.warn("Object is marked as not disposable",s);return}if(s[PN]=!0,s instanceof tr)Di(s.environment),Di(s.background),Di(s.customDepthMaterial),Di(s.customDistanceMaterial);else if(s instanceof ma)Di(s.geometry),Di(s.material),Di(s.skeleton),Di(s.bindMatrix),Di(s.bindMatrixInverse),Di(s.customDepthMaterial),Di(s.customDistanceMaterial),s.geometry=null,s.material=null;else if(s instanceof pe)Di(s.geometry),Di(s.material),Di(s.customDepthMaterial),Di(s.customDistanceMaterial),s.geometry=null,s.material=null;else if(s instanceof wt){uf(s);for(const t of Object.keys(s.attributes)){const i=s.attributes[t];Di(i)}}else if(s instanceof it||s instanceof xr)Wu&&console.warn("BufferAttribute dispose not supported",s.count);else if(s instanceof Array)for(const t of s)t instanceof Nt&&Di(t);else if(s instanceof Nt){uf(s);for(const i of Object.keys(s)){const n=s[i];n instanceof Dt&&(Di(n),s[i]=null)}const t=s.uniforms;if(t)for(const i of Object.keys(t)){const n=t[i];n instanceof Dt?(Di(n),t[i]=null):n instanceof _e&&(Di(n.value),n.value=null)}}else s instanceof Dt?(uf(s),uf(s.source),((e=s.source)==null?void 0:e.data)instanceof ImageBitmap&&uf(s.source.data)):s instanceof Rp?(uf(s.boneTexture),s.boneTexture=null):s instanceof qv||!(s instanceof ge)&&Wu&&console.warn("Unknown object type",s)}}function uf(s){s&&((Wu||TN()||zx)&&console.warn("๐Ÿงจ FREE",s),s instanceof ImageBitmap?s.close():s instanceof ic?s.data=null:s.dispose())}function BN(s){(s instanceof pe||s instanceof ma)&&(s.material=null,s.geometry=null)}const mY=new Set;function MI(s,e,t=null,i){if(i||(i=mY,i.clear()),!s)return i;const n=s[gv];if(n)for(const r of n)i.has(r)||(t==null?void 0:t.call(null,r))!==!1&&(i.add(r),e&&MI(r,!0,t,i));return i}function gY(s){return s[tg]}const Wu=ne("debugresourceusers")||ne("debugmemory"),gv=Symbol("needle-resource-users"),tg=Symbol("needle-resource-users-count");function lr(s,e){Nx(s,e,function(t,i){md&&(hb(gv,this,t,!1),hb(gv,this,i,!0))})}md&&(lr(pe.prototype,"material"),lr(pe.prototype,"geometry"),lr(Nt.prototype,"map"),lr(Nt.prototype,"bumpMap"),lr(Nt.prototype,"alphaMap"),lr(Nt.prototype,"normalMap"),lr(Nt.prototype,"displacementMap"),lr(Nt.prototype,"roughnessMap"),lr(Nt.prototype,"metalnessMap"),lr(Nt.prototype,"emissiveMap"),lr(Nt.prototype,"specularMap"),lr(Nt.prototype,"envMap"),lr(Nt.prototype,"lightMap"),lr(Nt.prototype,"aoMap"),lr(Nt.prototype,"gradientMap"));function vY(s){if(md===!1)return;const e=s[gv];if(e)for(const t of e)hb(gv,t,s,!1)}md&&Nx(Nt.prototype,"dispose",function(){vY(this)});let C1=0;function hb(s,e,t,i){if(C1>0)return;if(Array.isArray(t)){for(const r of t)hb(s,e,r,i);return}if(!t)return;let n=t[s];if(n||(n=new Set),i){if(e&&!n.has(e)){n.add(e);let r=t[tg]||0;r+=1,t[tg]=r,Wu&&console.warn(`๐ŸŸข Added user of "${t.type}"`,e,t,r,"users:",n)}}else if(e&&n.has(e)){n.delete(e);let r=t[tg]||0;r>0&&(r-=1,t[tg]=r),Wu&&console.warn(`๐Ÿ”ด Removed user of "${t.type}"`,e,t,r,"users:",n),r<=0&&(xg.isLoading(t)||(zx&&console.warn(`๐Ÿ”ด Removed all user of "${t.type}"`,t),TN()&&Di(t)))}t[s]=n}try{Nx(bc.prototype,"render",function(){C1++},function(){C1--})}catch(s){console.warn("Could not wrap WebGLRenderer.render",s)}var rA=(s=>(s.Added="component-added",s.Removing="removing-component",s))(rA||{});const H2=ne("debugcomponentevents");class oA{static addComponentLifecylceEventListener(e,t){this.eventListeners.has(e)&&this.eventListeners.set(e,[]);let i=this.eventListeners.get(e);i||(i=[]),i.push(t),this.eventListeners.set(e,i),H2&&console.log("Added event listener for "+e,this.eventListeners)}static removeComponentLifecylceEventListener(e,t){const i=this.eventListeners.get(e);if(!i)return;const n=i.indexOf(t);n<0||i.splice(n,1)}static dispatchComponentLifecycleEvent(e,t){const i=this.eventListeners.get(e);if(H2&&console.log("Dispatching event "+e,i),!!i)for(const n of i)n(t)}}h(oA,"eventListeners",new Map);const DN=ne("debugdefines");Dp('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";');Dp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');Dp('if(!globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)""] = "unknown";');Dp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";');Dp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');Dp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";');const tl="3.34.2-alpha.2",Gx="undefined",TI="Wed Mar 13 2024 19:14:10 GMT+0100 (Central European Standard Time)";DN&&console.log(`Engine version: ${tl} (generator: ${Gx})
4326
4326
  Project built at ${TI}`);const hc="needle_isActiveInHierarchy",Iu="builtin_components",wg="needle_editor_guid";function Dp(s){try{(0,eval)(s)}catch(e){DN&&console.error(e)}}const vv=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),ON=Symbol("isUsingInstancing"),LN=Symbol("instancingRenderer"),E1=Symbol("instancingAutoUpdateBounds");class va{static isUsingInstancing(e){return e[ON]===!0}static getRenderer(e){return e[LN]||null}setAutoUpdateBounds(e,t){const i=va.getRenderer(e);i&&(i[E1]=t)}static markDirty(e,t=!0){if(e&&(this.isUsingInstancing(e)&&(e[vv]=!0,e.matrixWorldNeedsUpdate=!0),t))for(const i of e.children)va.markDirty(i,!0)}}function qu(s,e){try{e?s(e):s()}catch(t){return console.error(t),!1}return!0}const M1=ne("debugnewscripts"),AY=ne("debughierarchy"),qi=[];function yY(){return qi.length>0}function ub(s){if(!(s.new_scripts.length<=0)){if(M1&&console.log("Register new components",s.new_scripts.length,[...s.new_scripts],s.alias?"element: "+s.alias:s.hash,s),s.new_scripts_pre_setup_callbacks.length>0){for(const e of s.new_scripts_pre_setup_callbacks)e&&e();s.new_scripts_pre_setup_callbacks.length=0}qi.length=0,s.new_scripts.length>0&&qi.push(...s.new_scripts),s.new_scripts.length=0;for(let e=0;e<qi.length;e++)try{const t=qi[e];if(t.isComponent!==!0){(_t()||M1)&&console.error(`Registered script is not a Needle Engine component.
4327
4327
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4328
4328
  `,t),qi.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.error("MISSING GAMEOBJECT - will ignore",t),qi.splice(e,1),e--;continue}t.context=s,Sg(t.gameObject),II(t,s)}catch(t){console.error(t),Kl(qi[e],s),qi.splice(e,1),e--}for(let e=0;e<qi.length;e++)try{const t=qi[e];if(t.destroyed){Kl(qi[e],s),qi.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(i){console.error(i)}t.__internalAwake!==void 0&&(t.gameObject||console.error("MISSING GAMEOBJECT",t,t.gameObject),Sg(t.gameObject),t.activeAndEnabled&&qu(t.__internalAwake.bind(t)))}catch(t){console.error(t),Kl(qi[e],s),qi.splice(e,1),e--}for(let e=0;e<qi.length;e++)try{const t=qi[e];if(t.destroyed||t.enabled===!1||(Sg(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,qu(t.__internalEnable.bind(t)))}catch(t){console.error(t),Kl(qi[e],s),qi.splice(e,1),e--}for(let e=0;e<qi.length;e++)try{const t=qi[e];if(t.destroyed||!t.gameObject)continue;s.new_script_start.push(t)}catch(t){console.error(t),Kl(qi[e],s),qi.splice(e,1),e--}qi.length=0;for(const e of s.new_scripts_post_setup_callbacks)e&&e();s.new_scripts_post_setup_callbacks.length=0}}function _Y(s){s&&(s.__internalDisable(!0),Kl(s,s.context))}function kN(s,e){for(let t=0;t<s.new_script_start.length;t++)try{const i=s.new_script_start[t];if(e!==void 0&&i.gameObject!==e||i.destroyed||i.activeAndEnabled===!1)continue;qu(i.__internalAwake.bind(i)),i.enabled&&(qu(i.__internalEnable.bind(i)),qu(i.__internalStart.bind(i)),s.new_script_start.splice(t,1),t--)}catch(i){console.error(i),Kl(s.new_script_start[t],s),s.new_script_start.splice(t,1),t--}}function II(s,e){e.scripts.indexOf(s)===-1&&(e.scripts.push(s),s.earlyUpdate&&e.scripts_earlyUpdate.push(s),s.update&&e.scripts_update.push(s),s.lateUpdate&&e.scripts_lateUpdate.push(s),s.onBeforeRender&&e.scripts_onBeforeRender.push(s),s.onAfterRender&&e.scripts_onAfterRender.push(s),s.onPausedChanged&&e.scripts_pausedChanged.push(s),JS(s,null)&&e.new_scripts_xr.push(s),JS(s,"immersive-vr")&&e.scripts_immersive_vr.push(s),JS(s,"immersive-ar")&&e.scripts_immersive_ar.push(s))}function Kl(s,e){Co(s,e.new_scripts),Co(s,e.new_script_start),Co(s,e.scripts),Co(s,e.scripts_earlyUpdate),Co(s,e.scripts_update),Co(s,e.scripts_lateUpdate),Co(s,e.scripts_onBeforeRender),Co(s,e.scripts_onAfterRender),Co(s,e.scripts_pausedChanged),Co(s,e.new_scripts_xr),Co(s,e.scripts_immersive_vr),Co(s,e.scripts_immersive_ar),e.stopAllCoroutinesFrom(s)}function Co(s,e){const t=e.indexOf(s);t>=0&&e.splice(t,1)}function JS(s,e){var t;if(s){const i=s;if(i.onBeforeXR||i.onEnterXR||i.onUpdateXR||i.onLeaveXR||i.onXRControllerAdded||i.onXRControllerRemoved)return!(e!=null&&((t=i.supportsXR)==null?void 0:t.call(i,e))===!1)}return!1}function d_(s){if(s||(s=hi.Current.scene),!s){console.trace("Invalid call - no current context.");return}const e=kp(s);FN(s,e,!0)||(M1||_t()?console.error(`Error updating hierarchy
@@ -4322,7 +4322,7 @@ void main() {
4322
4322
  `;s+=g(o);const C=Object.keys(I);let a="";for(let r=0;r<C.length;r++){const B=C[r],Q=I[B];if(Uc.has(Q)){a+="";continue}Uc.set(Q,!0),a+=B+":"+i(Q,o+1),r<C.length-1&&(a+=", "),a.length>=60&&(a+=`
4323
4323
  `,a+=g(o),s+=a,a="")}return s+=a,s+=`
4324
4324
  }`,s}return I}function g(I){let o="";for(let s=0;s<I;s++)o+=" ";return o}}const G9=tA("nodevlogs");function ci(t,A=eo.Log){Ts(A,t)}function Wt(t){ci(t,eo.Warn)}function uL(t){ci(t,eo.Error)}let kM;function he(){return G9?!1:kM!==void 0?kM:LI()}function R9(t){kM=t}const Pr=new qr,Xg=new S,sn=new S,zt=new UA,pL={X:new S(1,0,0),Y:new S(0,1,0),Z:new S(0,0,1)},MM={type:"change"},DL={type:"mouseDown"},wL={type:"mouseUp",mode:null},yL={type:"objectChange"};class U9 extends pA{constructor(A,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const i=new RM;this._gizmo=i,this.add(i);const g=new b9;this._plane=g,this.add(g);const I=this;function o(u,p){let D=p;Object.defineProperty(I,u,{get:function(){return D!==void 0?D:p},set:function(m){D!==m&&(D=m,g[u]=m,i[u]=m,I.dispatchEvent({type:u+"-changed",value:m}),I.dispatchEvent(MM))}}),I[u]=p,g[u]=p,i[u]=p}o("camera",A),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const s=new S,C=new S,a=new UA,r=new UA,B=new S,Q=new UA,E=new S,h=new S,d=new S,l=0,c=new S;o("worldPosition",s),o("worldPositionStart",C),o("worldQuaternion",a),o("worldQuaternionStart",r),o("cameraPosition",B),o("cameraQuaternion",Q),o("pointStart",E),o("pointEnd",h),o("rotationAxis",d),o("rotationAngle",l),o("eye",c),this._offset=new S,this._startNorm=new S,this._endNorm=new S,this._cameraScale=new S,this._parentPosition=new S,this._parentQuaternion=new UA,this._parentQuaternionInv=new UA,this._parentScale=new S,this._worldScaleStart=new S,this._worldQuaternionInv=new UA,this._worldScale=new S,this._positionStart=new S,this._quaternionStart=new UA,this._scaleStart=new S,this._getPointer=N9.bind(this),this._onPointerDown=K9.bind(this),this._onPointerHover=F9.bind(this),this._onPointerMove=J9.bind(this),this._onPointerUp=v9.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(A){if(this.object===void 0||this.dragging===!0)return;A!==null&&Pr.setFromCamera(A,this.camera);const e=GM(this._gizmo.picker[this.mode],Pr);e?this.axis=e.object.name:this.axis=null}pointerDown(A){if(!(this.object===void 0||this.dragging===!0||A!=null&&A.button!==0)&&this.axis!==null){A!==null&&Pr.setFromCamera(A,this.camera);const e=GM(this._plane,Pr,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,DL.mode=this.mode,this.dispatchEvent(DL)}}pointerMove(A){const e=this.axis,i=this.mode,g=this.object;let I=this.space;if(i==="scale"?I="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(I="world"),g===void 0||e===null||this.dragging===!1||A!==null&&A.button!==-1)return;A!==null&&Pr.setFromCamera(A,this.camera);const o=GM(this._plane,Pr,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),I==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),I==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),g.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(I==="local"&&(g.position.applyQuaternion(zt.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(g.position.x=Math.round(g.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(g.position.y=Math.round(g.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(g.position.z=Math.round(g.position.z/this.translationSnap)*this.translationSnap),g.position.applyQuaternion(this._quaternionStart)),I==="world"&&(g.parent&&g.position.add(Xg.setFromMatrixPosition(g.parent.matrixWorld)),e.search("X")!==-1&&(g.position.x=Math.round(g.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(g.position.y=Math.round(g.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(g.position.z=Math.round(g.position.z/this.translationSnap)*this.translationSnap),g.parent&&g.position.sub(Xg.setFromMatrixPosition(g.parent.matrixWorld))));else if(i==="scale"){if(e.search("XYZ")!==-1){let s=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(s*=-1),sn.set(s,s,s)}else Xg.copy(this.pointStart),sn.copy(this.pointEnd),Xg.applyQuaternion(this._worldQuaternionInv),sn.applyQuaternion(this._worldQuaternionInv),sn.divide(Xg),e.search("X")===-1&&(sn.x=1),e.search("Y")===-1&&(sn.y=1),e.search("Z")===-1&&(sn.z=1);g.scale.copy(this._scaleStart).multiply(sn),this.scaleSnap&&(e.search("X")!==-1&&(g.scale.x=Math.round(g.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(g.scale.y=Math.round(g.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(g.scale.z=Math.round(g.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const s=20/this.worldPosition.distanceTo(Xg.setFromMatrixPosition(this.camera.matrixWorld));let C=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Xg.copy(this.rotationAxis).cross(this.eye))*s):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(pL[e]),Xg.copy(pL[e]),I==="local"&&Xg.applyQuaternion(this.worldQuaternion),Xg.cross(this.eye),Xg.length()===0?C=!0:this.rotationAngle=this._offset.dot(Xg.normalize())*s),(e==="E"||C)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),I==="local"&&e!=="E"&&e!=="XYZE"?(g.quaternion.copy(this._quaternionStart),g.quaternion.multiply(zt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),g.quaternion.copy(zt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),g.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(MM),this.dispatchEvent(yL)}}pointerUp(A){A!==null&&A.button!==0||(this.dragging&&this.axis!==null&&(wL.mode=this.mode,this.dispatchEvent(wL)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(A){A.geometry&&A.geometry.dispose(),A.material&&A.material.dispose()})}attach(A){return this.object=A,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(MM),this.dispatchEvent(yL),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Pr}getMode(){return this.mode}setMode(A){this.mode=A}setTranslationSnap(A){this.translationSnap=A}setRotationSnap(A){this.rotationSnap=A}setScaleSnap(A){this.scaleSnap=A}setSize(A){this.size=A}setSpace(A){this.space=A}}function N9(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const A=this.domElement.getBoundingClientRect();return{x:(t.clientX-A.left)/A.width*2-1,y:-(t.clientY-A.top)/A.height*2+1,button:t.button}}}function F9(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t));break}}function K9(t){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function J9(t){this.enabled&&this.pointerMove(this._getPointer(t))}function v9(t){this.enabled&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function GM(t,A,e){const i=A.intersectObject(t,!0);for(let g=0;g<i.length;g++)if(i[g].object.visible||e)return i[g];return!1}const KD=new Ht,Ft=new S(0,1,0),SL=new S(0,0,0),fL=new RA,JD=new UA,vD=new UA,_s=new S,mL=new RA,Nc=new S(1,0,0),jr=new S(0,1,0),Fc=new S(0,0,1),bD=new S,Kc=new S,Jc=new S;class RM extends pA{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const A=new It({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new fi({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=A.clone();i.opacity=.15;const g=e.clone();g.opacity=.5;const I=A.clone();I.color.setHex(16711680);const o=A.clone();o.color.setHex(65280);const s=A.clone();s.color.setHex(255);const C=A.clone();C.color.setHex(16711680),C.opacity=.5;const a=A.clone();a.color.setHex(65280),a.opacity=.5;const r=A.clone();r.color.setHex(255),r.opacity=.5;const B=A.clone();B.opacity=.25;const Q=A.clone();Q.color.setHex(16776960),Q.opacity=.25,A.clone().color.setHex(16776960);const E=A.clone();E.color.setHex(7895160);const h=new Fi(0,.04,.1,12);h.translate(0,.05,0);const d=new qt(.08,.08,.08);d.translate(0,.04,0);const l=new pe;l.setAttribute("position",new Ce([0,0,0,1,0,0],3));const c=new Fi(.0075,.0075,.5,3);c.translate(0,.25,0);function u(v,j){const q=new Na(v,.0075,3,64,j*Math.PI*2);return q.rotateY(Math.PI/2),q.rotateX(Math.PI/2),q}function p(){const v=new pe;return v.setAttribute("position",new Ce([0,0,0,1,1,1],3)),v}const D={X:[[new uA(h,I),[.5,0,0],[0,0,-Math.PI/2]],[new uA(h,I),[-.5,0,0],[0,0,Math.PI/2]],[new uA(c,I),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new uA(h,o),[0,.5,0]],[new uA(h,o),[0,-.5,0],[Math.PI,0,0]],[new uA(c,o)]],Z:[[new uA(h,s),[0,0,.5],[Math.PI/2,0,0]],[new uA(h,s),[0,0,-.5],[-Math.PI/2,0,0]],[new uA(c,s),null,[Math.PI/2,0,0]]],XYZ:[[new uA(new Ua(.1,0),B.clone()),[0,0,0]]],XY:[[new uA(new qt(.15,.15,.01),r.clone()),[.15,.15,0]]],YZ:[[new uA(new qt(.15,.15,.01),C.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.15,.15,.01),a.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},m={X:[[new uA(new Fi(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new uA(new Fi(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new uA(new Fi(.2,0,.6,4),i),[0,.3,0]],[new uA(new Fi(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new uA(new Fi(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new uA(new Fi(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new uA(new Ua(.2,0),i)]],XY:[[new uA(new qt(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new uA(new qt(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},G={START:[[new uA(new Ua(.01,2),g),null,null,null,"helper"]],END:[[new uA(new Ua(.01,2),g),null,null,null,"helper"]],DELTA:[[new mi(p(),g),null,null,null,"helper"]],X:[[new mi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new mi(l,g.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new mi(l,g.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},k={XYZE:[[new uA(u(.5,1),E),null,[0,Math.PI/2,0]]],X:[[new uA(u(.5,.5),I)]],Y:[[new uA(u(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new uA(u(.5,.5),s),null,[0,Math.PI/2,0]]],E:[[new uA(u(.75,1),Q),null,[0,Math.PI/2,0]]]},M={AXIS:[[new mi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},K={XYZE:[[new uA(new Ms(.25,10,8),i)]],X:[[new uA(new Na(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new uA(new Na(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new uA(new Na(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new uA(new Na(.75,.1,2,24),i)]]},f={X:[[new uA(d,I),[.5,0,0],[0,0,-Math.PI/2]],[new uA(c,I),[0,0,0],[0,0,-Math.PI/2]],[new uA(d,I),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new uA(d,o),[0,.5,0]],[new uA(c,o)],[new uA(d,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new uA(d,s),[0,0,.5],[Math.PI/2,0,0]],[new uA(c,s),[0,0,0],[Math.PI/2,0,0]],[new uA(d,s),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new uA(new qt(.15,.15,.01),r),[.15,.15,0]]],YZ:[[new uA(new qt(.15,.15,.01),C),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.15,.15,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new uA(new qt(.1,.1,.1),B.clone())]]},N={X:[[new uA(new Fi(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new uA(new Fi(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new uA(new Fi(.2,0,.6,4),i),[0,.3,0]],[new uA(new Fi(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new uA(new Fi(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new uA(new Fi(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new uA(new qt(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new uA(new qt(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new uA(new qt(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new uA(new qt(.2,.2,.2),i),[0,0,0]]]},H={X:[[new mi(l,g.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new mi(l,g.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new mi(l,g.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function _(v){const j=new pA;for(const q in v)for(let L=v[q].length;L--;){const Y=v[q][L][0].clone(),$=v[q][L][1],X=v[q][L][2],sA=v[q][L][3],wA=v[q][L][4];Y.name=q,Y.tag=wA,$&&Y.position.set($[0],$[1],$[2]),X&&Y.rotation.set(X[0],X[1],X[2]),sA&&Y.scale.set(sA[0],sA[1],sA[2]),Y.updateMatrix();const KA=Y.geometry.clone();KA.applyMatrix4(Y.matrix),Y.geometry=KA,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),j.add(Y)}return j}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=_(D)),this.add(this.gizmo.rotate=_(k)),this.add(this.gizmo.scale=_(f)),this.add(this.picker.translate=_(m)),this.add(this.picker.rotate=_(K)),this.add(this.picker.scale=_(N)),this.add(this.helper.translate=_(G)),this.add(this.helper.rotate=_(M)),this.add(this.helper.scale=_(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(A){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:vD;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let g=0;g<i.length;g++){const I=i[g];I.visible=!0,I.rotation.set(0,0,0),I.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),I.scale.set(1,1,1).multiplyScalar(o*this.size/4),I.tag==="helper"){I.visible=!1,I.name==="AXIS"?(I.visible=!!this.axis,this.axis==="X"&&(zt.setFromEuler(KD.set(0,0,0)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(Nc).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="Y"&&(zt.setFromEuler(KD.set(0,0,Math.PI/2)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="Z"&&(zt.setFromEuler(KD.set(0,Math.PI/2,0)),I.quaternion.copy(e).multiply(zt),Math.abs(Ft.copy(Fc).applyQuaternion(e).dot(this.eye))>.9&&(I.visible=!1)),this.axis==="XYZE"&&(zt.setFromEuler(KD.set(0,Math.PI/2,0)),Ft.copy(this.rotationAxis),I.quaternion.setFromRotationMatrix(fL.lookAt(SL,Ft,jr)),I.quaternion.multiply(zt),I.visible=this.dragging),this.axis==="E"&&(I.visible=!1)):I.name==="START"?(I.position.copy(this.worldPositionStart),I.visible=this.dragging):I.name==="END"?(I.position.copy(this.worldPosition),I.visible=this.dragging):I.name==="DELTA"?(I.position.copy(this.worldPositionStart),I.quaternion.copy(this.worldQuaternionStart),Xg.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Xg.applyQuaternion(this.worldQuaternionStart.clone().invert()),I.scale.copy(Xg),I.visible=this.dragging):(I.quaternion.copy(e),this.dragging?I.position.copy(this.worldPositionStart):I.position.copy(this.worldPosition),this.axis&&(I.visible=this.axis.search(I.name)!==-1));continue}I.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(I.name==="X"&&Math.abs(Ft.copy(Nc).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="Y"&&Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="Z"&&Math.abs(Ft.copy(Fc).applyQuaternion(e).dot(this.eye))>.99&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="XY"&&Math.abs(Ft.copy(Fc).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="YZ"&&Math.abs(Ft.copy(Nc).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1),I.name==="XZ"&&Math.abs(Ft.copy(jr).applyQuaternion(e).dot(this.eye))<.2&&(I.scale.set(1e-10,1e-10,1e-10),I.visible=!1)):this.mode==="rotate"&&(JD.copy(e),Ft.copy(this.eye).applyQuaternion(zt.copy(e).invert()),I.name.search("E")!==-1&&I.quaternion.setFromRotationMatrix(fL.lookAt(this.eye,SL,jr)),I.name==="X"&&(zt.setFromAxisAngle(Nc,Math.atan2(-Ft.y,Ft.z)),zt.multiplyQuaternions(JD,zt),I.quaternion.copy(zt)),I.name==="Y"&&(zt.setFromAxisAngle(jr,Math.atan2(Ft.x,Ft.z)),zt.multiplyQuaternions(JD,zt),I.quaternion.copy(zt)),I.name==="Z"&&(zt.setFromAxisAngle(Fc,Math.atan2(Ft.y,Ft.x)),zt.multiplyQuaternions(JD,zt),I.quaternion.copy(zt))),I.visible=I.visible&&(I.name.indexOf("X")===-1||this.showX),I.visible=I.visible&&(I.name.indexOf("Y")===-1||this.showY),I.visible=I.visible&&(I.name.indexOf("Z")===-1||this.showZ),I.visible=I.visible&&(I.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),I.material._color=I.material._color||I.material.color.clone(),I.material._opacity=I.material._opacity||I.material.opacity,I.material.color.copy(I.material._color),I.material.opacity=I.material._opacity,this.enabled&&this.axis&&(I.name===this.axis||this.axis.split("").some(function(s){return I.name===s}))&&(I.material.color.setHex(16776960),I.material.opacity=1)}super.updateMatrixWorld(A)}}class b9 extends uA{constructor(){super(new Wi(1e5,1e5,2,2),new It({visible:!1,wireframe:!0,side:Et,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(A){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),bD.copy(Nc).applyQuaternion(e==="local"?this.worldQuaternion:vD),Kc.copy(jr).applyQuaternion(e==="local"?this.worldQuaternion:vD),Jc.copy(Fc).applyQuaternion(e==="local"?this.worldQuaternion:vD),Ft.copy(Kc),this.mode){case"translate":case"scale":switch(this.axis){case"X":Ft.copy(this.eye).cross(bD),_s.copy(bD).cross(Ft);break;case"Y":Ft.copy(this.eye).cross(Kc),_s.copy(Kc).cross(Ft);break;case"Z":Ft.copy(this.eye).cross(Jc),_s.copy(Jc).cross(Ft);break;case"XY":_s.copy(Jc);break;case"YZ":_s.copy(bD);break;case"XZ":Ft.copy(Jc),_s.copy(Kc);break;case"XYZ":case"E":_s.set(0,0,0);break}break;case"rotate":default:_s.set(0,0,0)}_s.length()===0?this.quaternion.copy(this.cameraQuaternion):(mL.lookAt(Xg.set(0,0,0),_s,Ft),this.quaternion.setFromRotationMatrix(mL)),super.updateMatrixWorld(A)}}const q9=tA("debugpatch");function qD(t,A,e,i){const g=q9===A;if(!e&&!i)return;const I=A+"___needle";x9(t,A,e,i);const o=Object.getOwnPropertyDescriptor(t,A),s=t[A];g&&console.log("Patch",t.constructor.name,A,o,s),o?(g&&console.log("Apply patch with existing descriptor",t.constructor.name,A,o),typeof o.value=="function"&&(t[A]=ML(o.value,t,A))):(g&&console.log("Create patch with new property",t.constructor.name,A,o),Object.defineProperty(t,A,{set:function(C){if(typeof C=="function")this[I]=ML(C,t,A);else{const a=this[I];GL(t,A,this,a,C),this[I]=C,RL(t,A,this,a,C)}},get:function(){const C=this[I];return typeof C=="function"&&C[I]?C[I]:C}}))}function L9(t,A,e){const i=NM(t,A);if(i)for(let g=i.length-1;g>=0;g--){const I=i[g];I.prefix===e&&(I.prefix=null),I.postfix===e&&(I.postfix=null),!I.prefix&&!I.postfix&&i.splice(g,1)}}const kL=Symbol("Needle:Patches:WrappedFunction");function ML(t,A,e){if(t[kL])return t;const i=function(...g){GL(A,e,this,...g);const I=t.apply(this,g);return RL(A,e,this,I,...g),I};return i[kL]=!0,i}const LD="Needle:Patches";function UM(){return globalThis[LD]||(globalThis[LD]=new WeakMap),globalThis[LD]}function NM(t,A){const e=UM().get(t);return e?e.get(A):null}function x9(t,A,e,i){let g=UM().get(t);g||(g=new Map,UM().set(t,g));let I=g.get(A);I||(I=[],g.set(A,I)),I.push({prefix:e,postfix:i})}function GL(t,A,e,...i){var g;if(!e)return;const I=NM(t,A);if(I)for(const o of I)(g=o.prefix)==null||g.call(e,...i)}function RL(t,A,e,i,...g){var I;if(!e)return;const o=NM(t,A);if(o)for(const s of o)(I=s.postfix)==null||I.call(e,i,...g)}const UL=Symbol("gltf-loader-internal-usage-tracker"),Y9=tA("debugusers"),xD=class{constructor(t){n(this,"parser"),n(this,"_getDependency"),n(this,"_loadingId"),n(this,"_loadedObjects",new Set),this.parser=t,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(t){return xD._loadingProcesses>0}beforeRoot(){xD._loadingProcesses++;const t=this,A=this._getDependency;return this.parser.getDependency=function(e,i){const g=A.call(this,e,i);return g.then(I=>(I&&(t._loadedObjects.add(I),I[UL]=t._loadingId),I)),g},null}afterRoot(t){xD._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const A of this._loadedObjects)delete A[UL],A instanceof pA&&(A.parent||A instanceof uA&&(Y9&&console.warn("> GLTF LOADER: Mesh not used in scene!",A),A.material=null,A.geometry=null));return null}};let FM=xD;n(FM,"_loadingProcesses",0);class NL{constructor(){window.addEventListener("unhandledrejection",A=>{var e;if(A.defaultPrevented)return;const i=(e=A?.reason)==null?void 0:e.path;if(i){const g=i[0];g&&g.tagName==="IMG"&&(console.warn(`Could not load image:
4325
- `+g.src),A.preventDefault())}})}}const YD=tA("trackresources");function FL(){return YD==="dispose"}let Wr=!0;YD===0&&(Wr=!1);function T9(t){Wr=t}function KL(){return Wr}const JL=Symbol("disposable");function KM(t,A){t&&(t[JL]=A,zr&&console.warn("Set disposable",A,t))}const vL=Symbol("disposed");function H9(t){return t[vL]===!0}function Jt(t){var A;if(t){if(t[JL]===!1){zr&&console.warn("Object is marked as not disposable",t);return}if(t[vL]=!0,t instanceof zg)Jt(t.environment),Jt(t.background),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial);else if(t instanceof os)Jt(t.geometry),Jt(t.material),Jt(t.skeleton),Jt(t.bindMatrix),Jt(t.bindMatrixInverse),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof uA)Jt(t.geometry),Jt(t.material),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof pe){WQ(t);for(const e of Object.keys(t.attributes)){const i=t.attributes[e];Jt(i)}}else if(t instanceof ee||t instanceof NI)zr&&console.warn("BufferAttribute dispose not supported",t.count);else if(t instanceof Array)for(const e of t)e instanceof ve&&Jt(e);else if(t instanceof ve){WQ(t);for(const i of Object.keys(t)){const g=t[i];g instanceof Re&&(Jt(g),t[i]=null)}const e=t.uniforms;if(e)for(const i of Object.keys(e)){const g=e[i];g instanceof Re?(Jt(g),e[i]=null):g instanceof SA&&(Jt(g.value),g.value=null)}}else t instanceof Re?(WQ(t),WQ(t.source),((A=t.source)==null?void 0:A.data)instanceof ImageBitmap&&WQ(t.source.data)):t instanceof lh?(WQ(t.boneTexture),t.boneTexture=null):t instanceof Ic||!(t instanceof pA)&&zr&&console.warn("Unknown object type",t)}}function WQ(t){t&&((zr||FL()||YD)&&console.warn("\u{1F9E8} FREE",t),t instanceof ImageBitmap?t.close():t instanceof KC?t.data=null:t.dispose())}function bL(t){(t instanceof uA||t instanceof os)&&(t.material=null,t.geometry=null)}const _9=new Set;function JM(t,A,e=null,i){if(i||(i=_9,i.clear()),!t)return i;const g=t[vc];if(g)for(const I of g)i.has(I)||e?.call(null,I)!==!1&&(i.add(I),A&&JM(I,!0,e,i));return i}function O9(t){return t[bc]}const zr=tA("debugresourceusers")||tA("debugmemory"),vc=Symbol("needle-resource-users"),bc=Symbol("needle-resource-users-count");function cI(t,A){qD(t,A,function(e,i){Wr&&(TD(vc,this,e,!1),TD(vc,this,i,!0))})}Wr&&(cI(uA.prototype,"material"),cI(uA.prototype,"geometry"),cI(ve.prototype,"map"),cI(ve.prototype,"bumpMap"),cI(ve.prototype,"alphaMap"),cI(ve.prototype,"normalMap"),cI(ve.prototype,"displacementMap"),cI(ve.prototype,"roughnessMap"),cI(ve.prototype,"metalnessMap"),cI(ve.prototype,"emissiveMap"),cI(ve.prototype,"specularMap"),cI(ve.prototype,"envMap"),cI(ve.prototype,"lightMap"),cI(ve.prototype,"aoMap"),cI(ve.prototype,"gradientMap"));function P9(t){if(Wr===!1)return;const A=t[vc];if(A)for(const e of A)TD(vc,e,t,!1)}Wr&&qD(ve.prototype,"dispose",function(){P9(this)});let vM=0;function TD(t,A,e,i){if(vM>0)return;if(Array.isArray(e)){for(const I of e)TD(t,A,I,i);return}if(!e)return;let g=e[t];if(g||(g=new Set),i){if(A&&!g.has(A)){g.add(A);let I=e[bc]||0;I+=1,e[bc]=I,zr&&console.warn(`\u{1F7E2} Added user of "${e.type}"`,A,e,I,"users:",g)}}else if(A&&g.has(A)){g.delete(A);let I=e[bc]||0;I>0&&(I-=1,e[bc]=I),zr&&console.warn(`\u{1F534} Removed user of "${e.type}"`,A,e,I,"users:",g),I<=0&&(FM.isLoading(e)||(YD&&console.warn(`\u{1F534} Removed all user of "${e.type}"`,e),FL()&&Jt(e)))}e[t]=g}try{qD(TC.prototype,"render",function(){vM++},function(){vM--})}catch(t){console.warn("Could not wrap WebGLRenderer.render",t)}var qc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(qc||{});const qL=tA("debugcomponentevents");class Lc{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let i=this.eventListeners.get(A);i||(i=[]),i.push(e),this.eventListeners.set(A,i),qL&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const i=this.eventListeners.get(A);if(!i)return;const g=i.indexOf(e);g<0||i.splice(g,1)}static dispatchComponentLifecycleEvent(A,e){const i=this.eventListeners.get(A);if(qL&&console.log("Dispatching event "+A,i),!!i)for(const g of i)g(e)}}n(Lc,"eventListeners",new Map);const LL=tA("debugdefines");zQ('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";'),zQ('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),zQ('if(!globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""] = "unknown";'),zQ('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";'),zQ('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),zQ('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";');const ZC="3.34.2-alpha.1",HD="undefined",bM="Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";LL&&console.log(`Engine version: ${ZC} (generator: ${HD})
4325
+ `+g.src),A.preventDefault())}})}}const YD=tA("trackresources");function FL(){return YD==="dispose"}let Wr=!0;YD===0&&(Wr=!1);function T9(t){Wr=t}function KL(){return Wr}const JL=Symbol("disposable");function KM(t,A){t&&(t[JL]=A,zr&&console.warn("Set disposable",A,t))}const vL=Symbol("disposed");function H9(t){return t[vL]===!0}function Jt(t){var A;if(t){if(t[JL]===!1){zr&&console.warn("Object is marked as not disposable",t);return}if(t[vL]=!0,t instanceof zg)Jt(t.environment),Jt(t.background),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial);else if(t instanceof os)Jt(t.geometry),Jt(t.material),Jt(t.skeleton),Jt(t.bindMatrix),Jt(t.bindMatrixInverse),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof uA)Jt(t.geometry),Jt(t.material),Jt(t.customDepthMaterial),Jt(t.customDistanceMaterial),t.geometry=null,t.material=null;else if(t instanceof pe){WQ(t);for(const e of Object.keys(t.attributes)){const i=t.attributes[e];Jt(i)}}else if(t instanceof ee||t instanceof NI)zr&&console.warn("BufferAttribute dispose not supported",t.count);else if(t instanceof Array)for(const e of t)e instanceof ve&&Jt(e);else if(t instanceof ve){WQ(t);for(const i of Object.keys(t)){const g=t[i];g instanceof Re&&(Jt(g),t[i]=null)}const e=t.uniforms;if(e)for(const i of Object.keys(e)){const g=e[i];g instanceof Re?(Jt(g),e[i]=null):g instanceof SA&&(Jt(g.value),g.value=null)}}else t instanceof Re?(WQ(t),WQ(t.source),((A=t.source)==null?void 0:A.data)instanceof ImageBitmap&&WQ(t.source.data)):t instanceof lh?(WQ(t.boneTexture),t.boneTexture=null):t instanceof Ic||!(t instanceof pA)&&zr&&console.warn("Unknown object type",t)}}function WQ(t){t&&((zr||FL()||YD)&&console.warn("\u{1F9E8} FREE",t),t instanceof ImageBitmap?t.close():t instanceof KC?t.data=null:t.dispose())}function bL(t){(t instanceof uA||t instanceof os)&&(t.material=null,t.geometry=null)}const _9=new Set;function JM(t,A,e=null,i){if(i||(i=_9,i.clear()),!t)return i;const g=t[vc];if(g)for(const I of g)i.has(I)||e?.call(null,I)!==!1&&(i.add(I),A&&JM(I,!0,e,i));return i}function O9(t){return t[bc]}const zr=tA("debugresourceusers")||tA("debugmemory"),vc=Symbol("needle-resource-users"),bc=Symbol("needle-resource-users-count");function cI(t,A){qD(t,A,function(e,i){Wr&&(TD(vc,this,e,!1),TD(vc,this,i,!0))})}Wr&&(cI(uA.prototype,"material"),cI(uA.prototype,"geometry"),cI(ve.prototype,"map"),cI(ve.prototype,"bumpMap"),cI(ve.prototype,"alphaMap"),cI(ve.prototype,"normalMap"),cI(ve.prototype,"displacementMap"),cI(ve.prototype,"roughnessMap"),cI(ve.prototype,"metalnessMap"),cI(ve.prototype,"emissiveMap"),cI(ve.prototype,"specularMap"),cI(ve.prototype,"envMap"),cI(ve.prototype,"lightMap"),cI(ve.prototype,"aoMap"),cI(ve.prototype,"gradientMap"));function P9(t){if(Wr===!1)return;const A=t[vc];if(A)for(const e of A)TD(vc,e,t,!1)}Wr&&qD(ve.prototype,"dispose",function(){P9(this)});let vM=0;function TD(t,A,e,i){if(vM>0)return;if(Array.isArray(e)){for(const I of e)TD(t,A,I,i);return}if(!e)return;let g=e[t];if(g||(g=new Set),i){if(A&&!g.has(A)){g.add(A);let I=e[bc]||0;I+=1,e[bc]=I,zr&&console.warn(`\u{1F7E2} Added user of "${e.type}"`,A,e,I,"users:",g)}}else if(A&&g.has(A)){g.delete(A);let I=e[bc]||0;I>0&&(I-=1,e[bc]=I),zr&&console.warn(`\u{1F534} Removed user of "${e.type}"`,A,e,I,"users:",g),I<=0&&(FM.isLoading(e)||(YD&&console.warn(`\u{1F534} Removed all user of "${e.type}"`,e),FL()&&Jt(e)))}e[t]=g}try{qD(TC.prototype,"render",function(){vM++},function(){vM--})}catch(t){console.warn("Could not wrap WebGLRenderer.render",t)}var qc=(t=>(t.Added="component-added",t.Removing="removing-component",t))(qc||{});const qL=tA("debugcomponentevents");class Lc{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let i=this.eventListeners.get(A);i||(i=[]),i.push(e),this.eventListeners.set(A,i),qL&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const i=this.eventListeners.get(A);if(!i)return;const g=i.indexOf(e);g<0||i.splice(g,1)}static dispatchComponentLifecycleEvent(A,e){const i=this.eventListeners.get(A);if(qL&&console.log("Dispatching event "+A,i),!!i)for(const g of i)g(e)}}n(Lc,"eventListeners",new Map);const LL=tA("debugdefines");zQ('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";'),zQ('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";'),zQ('if(!globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""] = "unknown";'),zQ('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";'),zQ('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),zQ('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";');const ZC="3.34.2-alpha.2",HD="undefined",bM="Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";LL&&console.log(`Engine version: ${ZC} (generator: ${HD})
4326
4326
  Project built at ${bM}`);const VC="needle_isActiveInHierarchy",Zr="builtin_components",xc="needle_editor_guid";function zQ(t){try{(0,eval)(t)}catch(A){LL&&console.error(A)}}const Yc=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),xL=Symbol("isUsingInstancing"),YL=Symbol("instancingRenderer"),qM=Symbol("instancingAutoUpdateBounds");class Us{static isUsingInstancing(A){return A[xL]===!0}static getRenderer(A){return A[YL]||null}setAutoUpdateBounds(A,e){const i=Us.getRenderer(A);i&&(i[qM]=e)}static markDirty(A,e=!0){if(A&&(this.isUsingInstancing(A)&&(A[Yc]=!0,A.matrixWorldNeedsUpdate=!0),e))for(const i of A.children)Us.markDirty(i,!0)}}function Vr(t,A){try{A?t(A):t()}catch(e){return console.error(e),!1}return!0}const LM=tA("debugnewscripts"),j9=tA("debughierarchy"),Zt=[];function W9(){return Zt.length>0}function _D(t){if(!(t.new_scripts.length<=0)){if(LM&&console.log("Register new components",t.new_scripts.length,[...t.new_scripts],t.alias?"element: "+t.alias:t.hash,t),t.new_scripts_pre_setup_callbacks.length>0){for(const A of t.new_scripts_pre_setup_callbacks)A&&A();t.new_scripts_pre_setup_callbacks.length=0}Zt.length=0,t.new_scripts.length>0&&Zt.push(...t.new_scripts),t.new_scripts.length=0;for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.isComponent!==!0){(he()||LM)&&console.error(`Registered script is not a Needle Engine component.
4327
4327
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4328
4328
  `,e),Zt.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),Zt.splice(A,1),A--;continue}e.context=t,Tc(e.gameObject),xM(e,t)}catch(e){console.error(e),XC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed){XC(Zt[A],t),Zt.splice(A,1),A--;continue}if(e.registering)try{e.registering()}catch(i){console.error(i)}e.__internalAwake!==void 0&&(e.gameObject||console.error("MISSING GAMEOBJECT",e,e.gameObject),Tc(e.gameObject),e.activeAndEnabled&&Vr(e.__internalAwake.bind(e)))}catch(e){console.error(e),XC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed||e.enabled===!1||(Tc(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,Vr(e.__internalEnable.bind(e)))}catch(e){console.error(e),XC(Zt[A],t),Zt.splice(A,1),A--}for(let A=0;A<Zt.length;A++)try{const e=Zt[A];if(e.destroyed||!e.gameObject)continue;t.new_script_start.push(e)}catch(e){console.error(e),XC(Zt[A],t),Zt.splice(A,1),A--}Zt.length=0;for(const A of t.new_scripts_post_setup_callbacks)A&&A();t.new_scripts_post_setup_callbacks.length=0}}function z9(t){t&&(t.__internalDisable(!0),XC(t,t.context))}function TL(t,A){for(let e=0;e<t.new_script_start.length;e++)try{const i=t.new_script_start[e];if(A!==void 0&&i.gameObject!==A||i.destroyed||i.activeAndEnabled===!1)continue;Vr(i.__internalAwake.bind(i)),i.enabled&&(Vr(i.__internalEnable.bind(i)),Vr(i.__internalStart.bind(i)),t.new_script_start.splice(e,1),e--)}catch(i){console.error(i),XC(t.new_script_start[e],t),t.new_script_start.splice(e,1),e--}}function xM(t,A){A.scripts.indexOf(t)===-1&&(A.scripts.push(t),t.earlyUpdate&&A.scripts_earlyUpdate.push(t),t.update&&A.scripts_update.push(t),t.lateUpdate&&A.scripts_lateUpdate.push(t),t.onBeforeRender&&A.scripts_onBeforeRender.push(t),t.onAfterRender&&A.scripts_onAfterRender.push(t),t.onPausedChanged&&A.scripts_pausedChanged.push(t),YM(t,null)&&A.new_scripts_xr.push(t),YM(t,"immersive-vr")&&A.scripts_immersive_vr.push(t),YM(t,"immersive-ar")&&A.scripts_immersive_ar.push(t))}function XC(t,A){No(t,A.new_scripts),No(t,A.new_script_start),No(t,A.scripts),No(t,A.scripts_earlyUpdate),No(t,A.scripts_update),No(t,A.scripts_lateUpdate),No(t,A.scripts_onBeforeRender),No(t,A.scripts_onAfterRender),No(t,A.scripts_pausedChanged),No(t,A.new_scripts_xr),No(t,A.scripts_immersive_vr),No(t,A.scripts_immersive_ar),A.stopAllCoroutinesFrom(t)}function No(t,A){const e=A.indexOf(t);e>=0&&A.splice(e,1)}function YM(t,A){var e;if(t){const i=t;if(i.onBeforeXR||i.onEnterXR||i.onUpdateXR||i.onLeaveXR||i.onXRControllerAdded||i.onXRControllerRemoved)return!(A!=null&&((e=i.supportsXR)==null?void 0:e.call(i,A))===!1)}return!1}function OD(t){if(t||(t=at.Current.scene),!t){console.trace("Invalid call - no current context.");return}const A=oE(t);HL(t,A,!0)||(LM||he()?console.error(`Error updating hierarchy
@@ -4322,7 +4322,7 @@ void main() {
4322
4322
  `;s+=i(o);const n=Object.keys(I);let C="";for(let a=0;a<n.length;a++){const B=n[a],Q=I[B];if(Ah.has(Q)){C+="";continue}Ah.set(Q,!0),C+=B+":"+t(Q,o+1),a<n.length-1&&(C+=", "),C.length>=60&&(C+=`
4323
4323
  `,C+=i(o),s+=C,C="")}return s+=C,s+=`
4324
4324
  }`,s}return I}function i(I){let o="";for(let s=0;s<I;s++)o+=" ";return o}}const k9=IA("nodevlogs");function Gi(g,A=ho.Log){an(A,g)}function Ii(g){Gi(g,ho.Warn)}function o2(g){Gi(g,ho.Error)}let _G;function De(){return k9?!1:_G!==void 0?_G:ZI()}function R9(g){_G=g}const Kr=new bB,iI=new y,sa=new y,ti=new kA,yq={X:new y(1,0,0),Y:new y(0,1,0),Z:new y(0,0,1)},hm={type:"change"},wq={type:"mouseDown"},Sq={type:"mouseUp",mode:null},mq={type:"objectChange"};class U9 extends pA{constructor(A,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const t=new xU;this._gizmo=t,this.add(t);const i=new v9;this._plane=i,this.add(i);const I=this;function o(p,u){let f=u;Object.defineProperty(I,p,{get:function(){return f!==void 0?f:u},set:function(m){f!==m&&(f=m,i[p]=m,t[p]=m,I.dispatchEvent({type:p+"-changed",value:m}),I.dispatchEvent(hm))}}),I[p]=u,i[p]=u,t[p]=u}o("camera",A),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const s=new y,n=new y,C=new kA,a=new kA,B=new y,Q=new kA,E=new y,c=new y,d=new y,l=0,h=new y;o("worldPosition",s),o("worldPositionStart",n),o("worldQuaternion",C),o("worldQuaternionStart",a),o("cameraPosition",B),o("cameraQuaternion",Q),o("pointStart",E),o("pointEnd",c),o("rotationAxis",d),o("rotationAngle",l),o("eye",h),this._offset=new y,this._startNorm=new y,this._endNorm=new y,this._cameraScale=new y,this._parentPosition=new y,this._parentQuaternion=new kA,this._parentQuaternionInv=new kA,this._parentScale=new y,this._worldScaleStart=new y,this._worldQuaternionInv=new kA,this._worldScale=new y,this._positionStart=new y,this._quaternionStart=new kA,this._scaleStart=new y,this._getPointer=N9.bind(this),this._onPointerDown=K9.bind(this),this._onPointerHover=F9.bind(this),this._onPointerMove=J9.bind(this),this._onPointerUp=q9.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(A){if(this.object===void 0||this.dragging===!0)return;A!==null&&Kr.setFromCamera(A,this.camera);const e=lm(this._gizmo.picker[this.mode],Kr);e?this.axis=e.object.name:this.axis=null}pointerDown(A){if(!(this.object===void 0||this.dragging===!0||A!=null&&A.button!==0)&&this.axis!==null){A!==null&&Kr.setFromCamera(A,this.camera);const e=lm(this._plane,Kr,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,wq.mode=this.mode,this.dispatchEvent(wq)}}pointerMove(A){const e=this.axis,t=this.mode,i=this.object;let I=this.space;if(t==="scale"?I="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(I="world"),i===void 0||e===null||this.dragging===!1||A!==null&&A.button!==-1)return;A!==null&&Kr.setFromCamera(A,this.camera);const o=lm(this._plane,Kr,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),t==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),I==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),I==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(I==="local"&&(i.position.applyQuaternion(ti.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),I==="world"&&(i.parent&&i.position.add(iI.setFromMatrixPosition(i.parent.matrixWorld)),e.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(iI.setFromMatrixPosition(i.parent.matrixWorld))));else if(t==="scale"){if(e.search("XYZ")!==-1){let s=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(s*=-1),sa.set(s,s,s)}else iI.copy(this.pointStart),sa.copy(this.pointEnd),iI.applyQuaternion(this._worldQuaternionInv),sa.applyQuaternion(this._worldQuaternionInv),sa.divide(iI),e.search("X")===-1&&(sa.x=1),e.search("Y")===-1&&(sa.y=1),e.search("Z")===-1&&(sa.z=1);i.scale.copy(this._scaleStart).multiply(sa),this.scaleSnap&&(e.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(t==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const s=20/this.worldPosition.distanceTo(iI.setFromMatrixPosition(this.camera.matrixWorld));let n=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(iI.copy(this.rotationAxis).cross(this.eye))*s):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(yq[e]),iI.copy(yq[e]),I==="local"&&iI.applyQuaternion(this.worldQuaternion),iI.cross(this.eye),iI.length()===0?n=!0:this.rotationAngle=this._offset.dot(iI.normalize())*s),(e==="E"||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),I==="local"&&e!=="E"&&e!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(ti.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(ti.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(hm),this.dispatchEvent(mq)}}pointerUp(A){A!==null&&A.button!==0||(this.dragging&&this.axis!==null&&(Sq.mode=this.mode,this.dispatchEvent(Sq)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(A){A.geometry&&A.geometry.dispose(),A.material&&A.material.dispose()})}attach(A){return this.object=A,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(hm),this.dispatchEvent(mq),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Kr}getMode(){return this.mode}setMode(A){this.mode=A}setTranslationSnap(A){this.translationSnap=A}setRotationSnap(A){this.rotationSnap=A}setScaleSnap(A){this.scaleSnap=A}setSize(A){this.size=A}setSpace(A){this.space=A}}function N9(g){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:g.button};{const A=this.domElement.getBoundingClientRect();return{x:(g.clientX-A.left)/A.width*2-1,y:-(g.clientY-A.top)/A.height*2+1,button:g.button}}}function F9(g){if(this.enabled)switch(g.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(g));break}}function K9(g){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(g.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(g)),this.pointerDown(this._getPointer(g)))}function J9(g){this.enabled&&this.pointerMove(this._getPointer(g))}function q9(g){this.enabled&&(this.domElement.releasePointerCapture(g.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(g)))}function lm(g,A,e){const t=A.intersectObject(g,!0);for(let i=0;i<t.length;i++)if(t[i].object.visible||e)return t[i];return!1}const Wp=new jt,vt=new y(0,1,0),Mq=new y(0,0,0),Gq=new MA,jp=new kA,zf=new kA,Ts=new y,kq=new MA,Uh=new y(1,0,0),Vr=new y(0,1,0),Nh=new y(0,0,1),zp=new y,eh=new y,th=new y;class xU extends pA{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const A=new at({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new Yi({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=A.clone();t.opacity=.15;const i=e.clone();i.opacity=.5;const I=A.clone();I.color.setHex(16711680);const o=A.clone();o.color.setHex(65280);const s=A.clone();s.color.setHex(255);const n=A.clone();n.color.setHex(16711680),n.opacity=.5;const C=A.clone();C.color.setHex(65280),C.opacity=.5;const a=A.clone();a.color.setHex(255),a.opacity=.5;const B=A.clone();B.opacity=.25;const Q=A.clone();Q.color.setHex(16776960),Q.opacity=.25,A.clone().color.setHex(16776960);const c=A.clone();c.color.setHex(7895160);const d=new Ji(0,.04,.1,12);d.translate(0,.05,0);const l=new Tt(.08,.08,.08);l.translate(0,.04,0);const h=new we;h.setAttribute("position",new Qe([0,0,0,1,0,0],3));const p=new Ji(.0075,.0075,.5,3);p.translate(0,.25,0);function u(O,q){const v=new aC(O,.0075,3,64,q*Math.PI*2);return v.rotateY(Math.PI/2),v.rotateX(Math.PI/2),v}function f(){const O=new we;return O.setAttribute("position",new Qe([0,0,0,1,1,1],3)),O}const m={X:[[new dA(d,I),[.5,0,0],[0,0,-Math.PI/2]],[new dA(d,I),[-.5,0,0],[0,0,Math.PI/2]],[new dA(p,I),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new dA(d,o),[0,.5,0]],[new dA(d,o),[0,-.5,0],[Math.PI,0,0]],[new dA(p,o)]],Z:[[new dA(d,s),[0,0,.5],[Math.PI/2,0,0]],[new dA(d,s),[0,0,-.5],[-Math.PI/2,0,0]],[new dA(p,s),null,[Math.PI/2,0,0]]],XYZ:[[new dA(new lC(.1,0),B.clone()),[0,0,0]]],XY:[[new dA(new Tt(.15,.15,.01),a.clone()),[.15,.15,0]]],YZ:[[new dA(new Tt(.15,.15,.01),n.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new dA(new Tt(.15,.15,.01),C.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},M={X:[[new dA(new Ji(.2,0,.6,4),t),[.3,0,0],[0,0,-Math.PI/2]],[new dA(new Ji(.2,0,.6,4),t),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new dA(new Ji(.2,0,.6,4),t),[0,.3,0]],[new dA(new Ji(.2,0,.6,4),t),[0,-.3,0],[0,0,Math.PI]]],Z:[[new dA(new Ji(.2,0,.6,4),t),[0,0,.3],[Math.PI/2,0,0]],[new dA(new Ji(.2,0,.6,4),t),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new dA(new lC(.2,0),t)]],XY:[[new dA(new Tt(.2,.2,.01),t),[.15,.15,0]]],YZ:[[new dA(new Tt(.2,.2,.01),t),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new dA(new Tt(.2,.2,.01),t),[.15,0,.15],[-Math.PI/2,0,0]]]},k={START:[[new dA(new lC(.01,2),i),null,null,null,"helper"]],END:[[new dA(new lC(.01,2),i),null,null,null,"helper"]],DELTA:[[new vi(f(),i),null,null,null,"helper"]],X:[[new vi(h,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vi(h,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vi(h,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},S={XYZE:[[new dA(u(.5,1),c),null,[0,Math.PI/2,0]]],X:[[new dA(u(.5,.5),I)]],Y:[[new dA(u(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new dA(u(.5,.5),s),null,[0,Math.PI/2,0]]],E:[[new dA(u(.75,1),Q),null,[0,Math.PI/2,0]]]},F={AXIS:[[new vi(h,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},w={XYZE:[[new dA(new qs(.25,10,8),t)]],X:[[new dA(new aC(.5,.1,4,24),t),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new dA(new aC(.5,.1,4,24),t),[0,0,0],[Math.PI/2,0,0]]],Z:[[new dA(new aC(.5,.1,4,24),t),[0,0,0],[0,0,-Math.PI/2]]],E:[[new dA(new aC(.75,.1,2,24),t)]]},R={X:[[new dA(l,I),[.5,0,0],[0,0,-Math.PI/2]],[new dA(p,I),[0,0,0],[0,0,-Math.PI/2]],[new dA(l,I),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new dA(l,o),[0,.5,0]],[new dA(p,o)],[new dA(l,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new dA(l,s),[0,0,.5],[Math.PI/2,0,0]],[new dA(p,s),[0,0,0],[Math.PI/2,0,0]],[new dA(l,s),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new dA(new Tt(.15,.15,.01),a),[.15,.15,0]]],YZ:[[new dA(new Tt(.15,.15,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new dA(new Tt(.15,.15,.01),C),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new dA(new Tt(.1,.1,.1),B.clone())]]},H={X:[[new dA(new Ji(.2,0,.6,4),t),[.3,0,0],[0,0,-Math.PI/2]],[new dA(new Ji(.2,0,.6,4),t),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new dA(new Ji(.2,0,.6,4),t),[0,.3,0]],[new dA(new Ji(.2,0,.6,4),t),[0,-.3,0],[0,0,Math.PI]]],Z:[[new dA(new Ji(.2,0,.6,4),t),[0,0,.3],[Math.PI/2,0,0]],[new dA(new Ji(.2,0,.6,4),t),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new dA(new Tt(.2,.2,.01),t),[.15,.15,0]]],YZ:[[new dA(new Tt(.2,.2,.01),t),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new dA(new Tt(.2,.2,.01),t),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new dA(new Tt(.2,.2,.2),t),[0,0,0]]]},Y={X:[[new vi(h,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new vi(h,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new vi(h,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function J(O){const q=new pA;for(const v in O)for(let T=O[v].length;T--;){const V=O[v][T][0].clone(),AA=O[v][T][1],sA=O[v][T][2],QA=O[v][T][3],FA=O[v][T][4];V.name=v,V.tag=FA,AA&&V.position.set(AA[0],AA[1],AA[2]),sA&&V.rotation.set(sA[0],sA[1],sA[2]),QA&&V.scale.set(QA[0],QA[1],QA[2]),V.updateMatrix();const iA=V.geometry.clone();iA.applyMatrix4(V.matrix),V.geometry=iA,V.renderOrder=1/0,V.position.set(0,0,0),V.rotation.set(0,0,0),V.scale.set(1,1,1),q.add(V)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=J(m)),this.add(this.gizmo.rotate=J(S)),this.add(this.gizmo.scale=J(R)),this.add(this.picker.translate=J(M)),this.add(this.picker.rotate=J(w)),this.add(this.picker.scale=J(H)),this.add(this.helper.translate=J(k)),this.add(this.helper.rotate=J(F)),this.add(this.helper.scale=J(Y)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(A){const t=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:zf;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let I=0;I<i.length;I++){const o=i[I];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let s;if(this.camera.isOrthographicCamera?s=(this.camera.top-this.camera.bottom)/this.camera.zoom:s=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(s*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(ti.setFromEuler(Wp.set(0,0,0)),o.quaternion.copy(t).multiply(ti),Math.abs(vt.copy(Uh).applyQuaternion(t).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(ti.setFromEuler(Wp.set(0,0,Math.PI/2)),o.quaternion.copy(t).multiply(ti),Math.abs(vt.copy(Vr).applyQuaternion(t).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(ti.setFromEuler(Wp.set(0,Math.PI/2,0)),o.quaternion.copy(t).multiply(ti),Math.abs(vt.copy(Nh).applyQuaternion(t).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(ti.setFromEuler(Wp.set(0,Math.PI/2,0)),vt.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Gq.lookAt(Mq,vt,Vr)),o.quaternion.multiply(ti),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),iI.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),iI.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(iI),o.visible=this.dragging):(o.quaternion.copy(t),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(vt.copy(Uh).applyQuaternion(t).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(vt.copy(Vr).applyQuaternion(t).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(vt.copy(Nh).applyQuaternion(t).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(vt.copy(Nh).applyQuaternion(t).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(vt.copy(Uh).applyQuaternion(t).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(vt.copy(Vr).applyQuaternion(t).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(jp.copy(t),vt.copy(this.eye).applyQuaternion(ti.copy(t).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Gq.lookAt(this.eye,Mq,Vr)),o.name==="X"&&(ti.setFromAxisAngle(Uh,Math.atan2(-vt.y,vt.z)),ti.multiplyQuaternions(jp,ti),o.quaternion.copy(ti)),o.name==="Y"&&(ti.setFromAxisAngle(Vr,Math.atan2(vt.x,vt.z)),ti.multiplyQuaternions(jp,ti),o.quaternion.copy(ti)),o.name==="Z"&&(ti.setFromAxisAngle(Nh,Math.atan2(vt.y,vt.x)),ti.multiplyQuaternions(jp,ti),o.quaternion.copy(ti))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(n){return o.name===n}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(A)}}class v9 extends dA{constructor(){super(new Zi(1e5,1e5,2,2),new at({visible:!1,wireframe:!0,side:ut,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(A){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),zp.copy(Uh).applyQuaternion(e==="local"?this.worldQuaternion:zf),eh.copy(Vr).applyQuaternion(e==="local"?this.worldQuaternion:zf),th.copy(Nh).applyQuaternion(e==="local"?this.worldQuaternion:zf),vt.copy(eh),this.mode){case"translate":case"scale":switch(this.axis){case"X":vt.copy(this.eye).cross(zp),Ts.copy(zp).cross(vt);break;case"Y":vt.copy(this.eye).cross(eh),Ts.copy(eh).cross(vt);break;case"Z":vt.copy(this.eye).cross(th),Ts.copy(th).cross(vt);break;case"XY":Ts.copy(th);break;case"YZ":Ts.copy(zp);break;case"XZ":vt.copy(th),Ts.copy(eh);break;case"XYZ":case"E":Ts.set(0,0,0);break}break;case"rotate":default:Ts.set(0,0,0)}Ts.length()===0?this.quaternion.copy(this.cameraQuaternion):(kq.lookAt(iI.set(0,0,0),Ts,vt),this.quaternion.setFromRotationMatrix(kq)),super.updateMatrixWorld(A)}}const b9=IA("debugpatch");function Yw(g,A,e,t){const i=b9===A;if(!e&&!t)return;const I=A+"___needle";x9(g,A,e,t);const o=Object.getOwnPropertyDescriptor(g,A),s=g[A];i&&console.log("Patch",g.constructor.name,A,o,s),o?(i&&console.log("Apply patch with existing descriptor",g.constructor.name,A,o),typeof o.value=="function"&&(g[A]=Uq(o.value,g,A))):(i&&console.log("Create patch with new property",g.constructor.name,A,o),Object.defineProperty(g,A,{set:function(n){if(typeof n=="function")this[I]=Uq(n,g,A);else{const C=this[I];s2(g,A,this,C,n),this[I]=n,n2(g,A,this,C,n)}},get:function(){const n=this[I];return typeof n=="function"&&n[I]?n[I]:n}}))}function L9(g,A,e){const t=YU(g,A);if(t)for(let i=t.length-1;i>=0;i--){const I=t[i];I.prefix===e&&(I.prefix=null),I.postfix===e&&(I.postfix=null),!I.prefix&&!I.postfix&&t.splice(i,1)}}const Rq=Symbol("Needle:Patches:WrappedFunction");function Uq(g,A,e){if(g[Rq])return g;const t=function(...i){s2(A,e,this,...i);const I=g.apply(this,i);return n2(A,e,this,I,...i),I};return t[Rq]=!0,t}const Vf="Needle:Patches";function HG(){return globalThis[Vf]||(globalThis[Vf]=new WeakMap),globalThis[Vf]}function YU(g,A){const e=HG().get(g);return e?e.get(A):null}function x9(g,A,e,t){let i=HG().get(g);i||(i=new Map,HG().set(g,i));let I=i.get(A);I||(I=[],i.set(A,I)),I.push({prefix:e,postfix:t})}function s2(g,A,e,...t){var I;if(!e)return;const i=YU(g,A);if(i)for(const o of i)(I=o.prefix)==null||I.call(e,...t)}function n2(g,A,e,t,...i){var o;if(!e)return;const I=YU(g,A);if(I)for(const s of I)(o=s.postfix)==null||o.call(e,t,...i)}const Nq=Symbol("gltf-loader-internal-usage-tracker"),Y9=IA("debugusers"),ul=class{constructor(A){r(this,"parser");r(this,"_getDependency");r(this,"_loadingId");r(this,"_loadedObjects",new Set);this.parser=A,this._getDependency=this.parser.getDependency,this._loadingId=Date.now().toString()}get name(){return"NEEDLE_internal_usage_tracker"}static isLoading(A){return ul._loadingProcesses>0}beforeRoot(){ul._loadingProcesses++;const A=this,e=this._getDependency;return this.parser.getDependency=function(t,i){const I=e.call(this,t,i);return I.then(o=>(o&&(A._loadedObjects.add(o),o[Nq]=A._loadingId),o)),I},null}afterRoot(A){ul._loadingProcesses--,this.parser.getDependency=this._getDependency;for(const e of this._loadedObjects)delete e[Nq],e instanceof pA&&(e.parent||e instanceof dA&&(Y9&&console.warn("> GLTF LOADER: Mesh not used in scene!",e),e.material=null,e.geometry=null));return null}};let Al=ul;r(Al,"_loadingProcesses",0);class C2{constructor(){window.addEventListener("unhandledrejection",A=>{var t;if(A.defaultPrevented)return;const e=(t=A==null?void 0:A.reason)==null?void 0:t.path;if(e){const i=e[0];i&&i.tagName==="IMG"&&(console.warn(`Could not load image:
4325
- `+i.src),A.preventDefault())}})}}const Tw=IA("trackresources");function a2(){return Tw==="dispose"}let xB=!0;Tw===0&&(xB=!1);function T9(g){xB=g}function r2(){return xB}const B2=Symbol("disposable");function TU(g,A){g&&(g[B2]=A,cB&&console.warn("Set disposable",A,g))}const Q2=Symbol("disposed");function _9(g){return g[Q2]===!0}function Lt(g){var A;if(g){if(g[B2]===!1){cB&&console.warn("Object is marked as not disposable",g);return}if(g[Q2]=!0,g instanceof aI)Lt(g.environment),Lt(g.background),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial);else if(g instanceof Ms)Lt(g.geometry),Lt(g.material),Lt(g.skeleton),Lt(g.bindMatrix),Lt(g.bindMatrixInverse),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial),g.geometry=null,g.material=null;else if(g instanceof dA)Lt(g.geometry),Lt(g.material),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial),g.geometry=null,g.material=null;else if(g instanceof we){qQ(g);for(const e of Object.keys(g.attributes)){const t=g.attributes[e];Lt(t)}}else if(g instanceof ge||g instanceof NI)cB&&console.warn("BufferAttribute dispose not supported",g.count);else if(g instanceof Array)for(const e of g)e instanceof Ye&&Lt(e);else if(g instanceof Ye){qQ(g);for(const t of Object.keys(g)){const i=g[t];i instanceof Je&&(Lt(i),g[t]=null)}const e=g.uniforms;if(e)for(const t of Object.keys(e)){const i=e[t];i instanceof Je?(Lt(i),e[t]=null):i instanceof wA&&(Lt(i.value),i.value=null)}}else g instanceof Je?(qQ(g),qQ(g.source),((A=g.source)==null?void 0:A.data)instanceof ImageBitmap&&qQ(g.source.data)):g instanceof gc?(qQ(g.boneTexture),g.boneTexture=null):g instanceof Rd||!(g instanceof pA)&&cB&&console.warn("Unknown object type",g)}}function qQ(g){g&&((cB||a2()||Tw)&&console.warn("๐Ÿงจ FREE",g),g instanceof ImageBitmap?g.close():g instanceof hC?g.data=null:g.dispose())}function E2(g){(g instanceof dA||g instanceof Ms)&&(g.material=null,g.geometry=null)}const H9=new Set;function _U(g,A,e=null,t){if(t||(t=H9,t.clear()),!g)return t;const i=g[Wl];if(i)for(const I of i)t.has(I)||(e==null?void 0:e.call(null,I))!==!1&&(t.add(I),A&&_U(I,!0,e,t));return t}function O9(g){return g[Fh]}const cB=IA("debugresourceusers")||IA("debugmemory"),Wl=Symbol("needle-resource-users"),Fh=Symbol("needle-resource-users-count");function lI(g,A){Yw(g,A,function(e,t){xB&&(Ay(Wl,this,e,!1),Ay(Wl,this,t,!0))})}xB&&(lI(dA.prototype,"material"),lI(dA.prototype,"geometry"),lI(Ye.prototype,"map"),lI(Ye.prototype,"bumpMap"),lI(Ye.prototype,"alphaMap"),lI(Ye.prototype,"normalMap"),lI(Ye.prototype,"displacementMap"),lI(Ye.prototype,"roughnessMap"),lI(Ye.prototype,"metalnessMap"),lI(Ye.prototype,"emissiveMap"),lI(Ye.prototype,"specularMap"),lI(Ye.prototype,"envMap"),lI(Ye.prototype,"lightMap"),lI(Ye.prototype,"aoMap"),lI(Ye.prototype,"gradientMap"));function P9(g){if(xB===!1)return;const A=g[Wl];if(A)for(const e of A)Ay(Wl,e,g,!1)}xB&&Yw(Ye.prototype,"dispose",function(){P9(this)});let OG=0;function Ay(g,A,e,t){if(OG>0)return;if(Array.isArray(e)){for(const I of e)Ay(g,A,I,t);return}if(!e)return;let i=e[g];if(i||(i=new Set),t){if(A&&!i.has(A)){i.add(A);let I=e[Fh]||0;I+=1,e[Fh]=I,cB&&console.warn(`๐ŸŸข Added user of "${e.type}"`,A,e,I,"users:",i)}}else if(A&&i.has(A)){i.delete(A);let I=e[Fh]||0;I>0&&(I-=1,e[Fh]=I),cB&&console.warn(`๐Ÿ”ด Removed user of "${e.type}"`,A,e,I,"users:",i),I<=0&&(Al.isLoading(e)||(Tw&&console.warn(`๐Ÿ”ด Removed all user of "${e.type}"`,e),a2()&&Lt(e)))}e[g]=i}try{Yw(bC.prototype,"render",function(){OG++},function(){OG--})}catch(g){console.warn("Could not wrap WebGLRenderer.render",g)}var Td=(g=>(g.Added="component-added",g.Removing="removing-component",g))(Td||{});const Fq=IA("debugcomponentevents");class _d{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let t=this.eventListeners.get(A);t||(t=[]),t.push(e),this.eventListeners.set(A,t),Fq&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const t=this.eventListeners.get(A);if(!t)return;const i=t.indexOf(e);i<0||t.splice(i,1)}static dispatchComponentLifecycleEvent(A,e){const t=this.eventListeners.get(A);if(Fq&&console.log("Dispatching event "+A,t),!!t)for(const i of t)i(e)}}r(_d,"eventListeners",new Map);const c2=IA("debugdefines");sc('if(!globalThis[""3.34.2-alpha.1""]) globalThis[""3.34.2-alpha.1""] = "0.0.0";');sc('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');sc('if(!globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)""] = "unknown";');sc('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.1";');sc('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');sc('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";');const Bn="3.34.2-alpha.1",_w="undefined",HU="Wed Mar 13 2024 18:21:27 GMT+0100 (Central European Standard Time)";c2&&console.log(`Engine version: ${Bn} (generator: ${_w})
4325
+ `+i.src),A.preventDefault())}})}}const Tw=IA("trackresources");function a2(){return Tw==="dispose"}let xB=!0;Tw===0&&(xB=!1);function T9(g){xB=g}function r2(){return xB}const B2=Symbol("disposable");function TU(g,A){g&&(g[B2]=A,cB&&console.warn("Set disposable",A,g))}const Q2=Symbol("disposed");function _9(g){return g[Q2]===!0}function Lt(g){var A;if(g){if(g[B2]===!1){cB&&console.warn("Object is marked as not disposable",g);return}if(g[Q2]=!0,g instanceof aI)Lt(g.environment),Lt(g.background),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial);else if(g instanceof Ms)Lt(g.geometry),Lt(g.material),Lt(g.skeleton),Lt(g.bindMatrix),Lt(g.bindMatrixInverse),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial),g.geometry=null,g.material=null;else if(g instanceof dA)Lt(g.geometry),Lt(g.material),Lt(g.customDepthMaterial),Lt(g.customDistanceMaterial),g.geometry=null,g.material=null;else if(g instanceof we){qQ(g);for(const e of Object.keys(g.attributes)){const t=g.attributes[e];Lt(t)}}else if(g instanceof ge||g instanceof NI)cB&&console.warn("BufferAttribute dispose not supported",g.count);else if(g instanceof Array)for(const e of g)e instanceof Ye&&Lt(e);else if(g instanceof Ye){qQ(g);for(const t of Object.keys(g)){const i=g[t];i instanceof Je&&(Lt(i),g[t]=null)}const e=g.uniforms;if(e)for(const t of Object.keys(e)){const i=e[t];i instanceof Je?(Lt(i),e[t]=null):i instanceof wA&&(Lt(i.value),i.value=null)}}else g instanceof Je?(qQ(g),qQ(g.source),((A=g.source)==null?void 0:A.data)instanceof ImageBitmap&&qQ(g.source.data)):g instanceof gc?(qQ(g.boneTexture),g.boneTexture=null):g instanceof Rd||!(g instanceof pA)&&cB&&console.warn("Unknown object type",g)}}function qQ(g){g&&((cB||a2()||Tw)&&console.warn("๐Ÿงจ FREE",g),g instanceof ImageBitmap?g.close():g instanceof hC?g.data=null:g.dispose())}function E2(g){(g instanceof dA||g instanceof Ms)&&(g.material=null,g.geometry=null)}const H9=new Set;function _U(g,A,e=null,t){if(t||(t=H9,t.clear()),!g)return t;const i=g[Wl];if(i)for(const I of i)t.has(I)||(e==null?void 0:e.call(null,I))!==!1&&(t.add(I),A&&_U(I,!0,e,t));return t}function O9(g){return g[Fh]}const cB=IA("debugresourceusers")||IA("debugmemory"),Wl=Symbol("needle-resource-users"),Fh=Symbol("needle-resource-users-count");function lI(g,A){Yw(g,A,function(e,t){xB&&(Ay(Wl,this,e,!1),Ay(Wl,this,t,!0))})}xB&&(lI(dA.prototype,"material"),lI(dA.prototype,"geometry"),lI(Ye.prototype,"map"),lI(Ye.prototype,"bumpMap"),lI(Ye.prototype,"alphaMap"),lI(Ye.prototype,"normalMap"),lI(Ye.prototype,"displacementMap"),lI(Ye.prototype,"roughnessMap"),lI(Ye.prototype,"metalnessMap"),lI(Ye.prototype,"emissiveMap"),lI(Ye.prototype,"specularMap"),lI(Ye.prototype,"envMap"),lI(Ye.prototype,"lightMap"),lI(Ye.prototype,"aoMap"),lI(Ye.prototype,"gradientMap"));function P9(g){if(xB===!1)return;const A=g[Wl];if(A)for(const e of A)Ay(Wl,e,g,!1)}xB&&Yw(Ye.prototype,"dispose",function(){P9(this)});let OG=0;function Ay(g,A,e,t){if(OG>0)return;if(Array.isArray(e)){for(const I of e)Ay(g,A,I,t);return}if(!e)return;let i=e[g];if(i||(i=new Set),t){if(A&&!i.has(A)){i.add(A);let I=e[Fh]||0;I+=1,e[Fh]=I,cB&&console.warn(`๐ŸŸข Added user of "${e.type}"`,A,e,I,"users:",i)}}else if(A&&i.has(A)){i.delete(A);let I=e[Fh]||0;I>0&&(I-=1,e[Fh]=I),cB&&console.warn(`๐Ÿ”ด Removed user of "${e.type}"`,A,e,I,"users:",i),I<=0&&(Al.isLoading(e)||(Tw&&console.warn(`๐Ÿ”ด Removed all user of "${e.type}"`,e),a2()&&Lt(e)))}e[g]=i}try{Yw(bC.prototype,"render",function(){OG++},function(){OG--})}catch(g){console.warn("Could not wrap WebGLRenderer.render",g)}var Td=(g=>(g.Added="component-added",g.Removing="removing-component",g))(Td||{});const Fq=IA("debugcomponentevents");class _d{static addComponentLifecylceEventListener(A,e){this.eventListeners.has(A)&&this.eventListeners.set(A,[]);let t=this.eventListeners.get(A);t||(t=[]),t.push(e),this.eventListeners.set(A,t),Fq&&console.log("Added event listener for "+A,this.eventListeners)}static removeComponentLifecylceEventListener(A,e){const t=this.eventListeners.get(A);if(!t)return;const i=t.indexOf(e);i<0||t.splice(i,1)}static dispatchComponentLifecycleEvent(A,e){const t=this.eventListeners.get(A);if(Fq&&console.log("Dispatching event "+A,t),!!t)for(const i of t)i(e)}}r(_d,"eventListeners",new Map);const c2=IA("debugdefines");sc('if(!globalThis[""3.34.2-alpha.2""]) globalThis[""3.34.2-alpha.2""] = "0.0.0";');sc('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');sc('if(!globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""]) globalThis[""Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)""] = "unknown";');sc('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.34.2-alpha.2";');sc('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');sc('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";');const Bn="3.34.2-alpha.2",_w="undefined",HU="Wed Mar 13 2024 19:13:59 GMT+0100 (Central European Standard Time)";c2&&console.log(`Engine version: ${Bn} (generator: ${_w})
4326
4326
  Project built at ${HU}`);const wC="needle_isActiveInHierarchy",Xr="builtin_components",el="needle_editor_guid";function sc(g){try{(0,eval)(g)}catch(A){c2&&console.error(A)}}const jl=Symbol("NEEDLE_NEED_UPDATE_INSTANCE"),h2=Symbol("isUsingInstancing"),l2=Symbol("instancingRenderer"),PG=Symbol("instancingAutoUpdateBounds");class ks{static isUsingInstancing(A){return A[h2]===!0}static getRenderer(A){return A[l2]||null}setAutoUpdateBounds(A,e){const t=ks.getRenderer(A);t&&(t[PG]=e)}static markDirty(A,e=!0){if(A&&(this.isUsingInstancing(A)&&(A[jl]=!0,A.matrixWorldNeedsUpdate=!0),e))for(const t of A.children)ks.markDirty(t,!0)}}function hB(g,A){try{A?g(A):g()}catch(e){return console.error(e),!1}return!0}const WG=IA("debugnewscripts"),W9=IA("debughierarchy"),Ai=[];function j9(){return Ai.length>0}function ey(g){if(!(g.new_scripts.length<=0)){if(WG&&console.log("Register new components",g.new_scripts.length,[...g.new_scripts],g.alias?"element: "+g.alias:g.hash,g),g.new_scripts_pre_setup_callbacks.length>0){for(const A of g.new_scripts_pre_setup_callbacks)A&&A();g.new_scripts_pre_setup_callbacks.length=0}Ai.length=0,g.new_scripts.length>0&&Ai.push(...g.new_scripts),g.new_scripts.length=0;for(let A=0;A<Ai.length;A++)try{const e=Ai[A];if(e.isComponent!==!0){(De()||WG)&&console.error(`Registered script is not a Needle Engine component.
4327
4327
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
4328
4328
  `,e),Ai.splice(A,1),A--;continue}if(e.destroyed)continue;if(!e.gameObject){console.error("MISSING GAMEOBJECT - will ignore",e),Ai.splice(A,1),A--;continue}e.context=g,tl(e.gameObject),OU(e,g)}catch(e){console.error(e),rC(Ai[A],g),Ai.splice(A,1),A--}for(let A=0;A<Ai.length;A++)try{const e=Ai[A];if(e.destroyed){rC(Ai[A],g),Ai.splice(A,1),A--;continue}if(e.registering)try{e.registering()}catch(t){console.error(t)}e.__internalAwake!==void 0&&(e.gameObject||console.error("MISSING GAMEOBJECT",e,e.gameObject),tl(e.gameObject),e.activeAndEnabled&&hB(e.__internalAwake.bind(e)))}catch(e){console.error(e),rC(Ai[A],g),Ai.splice(A,1),A--}for(let A=0;A<Ai.length;A++)try{const e=Ai[A];if(e.destroyed||e.enabled===!1||(tl(e.gameObject),e.activeAndEnabled===!1))continue;e.__internalEnable!==void 0&&(e.enabled=!0,hB(e.__internalEnable.bind(e)))}catch(e){console.error(e),rC(Ai[A],g),Ai.splice(A,1),A--}for(let A=0;A<Ai.length;A++)try{const e=Ai[A];if(e.destroyed||!e.gameObject)continue;g.new_script_start.push(e)}catch(e){console.error(e),rC(Ai[A],g),Ai.splice(A,1),A--}Ai.length=0;for(const A of g.new_scripts_post_setup_callbacks)A&&A();g.new_scripts_post_setup_callbacks.length=0}}function z9(g){g&&(g.__internalDisable(!0),rC(g,g.context))}function d2(g,A){for(let e=0;e<g.new_script_start.length;e++)try{const t=g.new_script_start[e];if(A!==void 0&&t.gameObject!==A||t.destroyed||t.activeAndEnabled===!1)continue;hB(t.__internalAwake.bind(t)),t.enabled&&(hB(t.__internalEnable.bind(t)),hB(t.__internalStart.bind(t)),g.new_script_start.splice(e,1),e--)}catch(t){console.error(t),rC(g.new_script_start[e],g),g.new_script_start.splice(e,1),e--}}function OU(g,A){A.scripts.indexOf(g)===-1&&(A.scripts.push(g),g.earlyUpdate&&A.scripts_earlyUpdate.push(g),g.update&&A.scripts_update.push(g),g.lateUpdate&&A.scripts_lateUpdate.push(g),g.onBeforeRender&&A.scripts_onBeforeRender.push(g),g.onAfterRender&&A.scripts_onAfterRender.push(g),g.onPausedChanged&&A.scripts_pausedChanged.push(g),dm(g,null)&&A.new_scripts_xr.push(g),dm(g,"immersive-vr")&&A.scripts_immersive_vr.push(g),dm(g,"immersive-ar")&&A.scripts_immersive_ar.push(g))}function rC(g,A){Jo(g,A.new_scripts),Jo(g,A.new_script_start),Jo(g,A.scripts),Jo(g,A.scripts_earlyUpdate),Jo(g,A.scripts_update),Jo(g,A.scripts_lateUpdate),Jo(g,A.scripts_onBeforeRender),Jo(g,A.scripts_onAfterRender),Jo(g,A.scripts_pausedChanged),Jo(g,A.new_scripts_xr),Jo(g,A.scripts_immersive_vr),Jo(g,A.scripts_immersive_ar),A.stopAllCoroutinesFrom(g)}function Jo(g,A){const e=A.indexOf(g);e>=0&&A.splice(e,1)}function dm(g,A){var e;if(g){const t=g;if(t.onBeforeXR||t.onEnterXR||t.onUpdateXR||t.onLeaveXR||t.onXRControllerAdded||t.onXRControllerRemoved)return!(A!=null&&((e=t.supportsXR)==null?void 0:e.call(t,A))===!1)}return!1}function Zf(g){if(g||(g=Bt.Current.scene),!g){console.trace("Invalid call - no current context.");return}const A=ac(g);u2(g,A,!0)||(WG||De()?console.error(`Error updating hierarchy
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "3.34.2-alpha.1",
3
+ "version": "3.34.2-alpha.2",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "type": "module",