@tomorrowevening/hermes 0.0.112 → 0.0.113

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -11,6 +11,26 @@ Open the [Application](https://hermes-lovat.vercel.app/) and [editor](https://he
11
11
  - [ThreeJS](https://threejs.org/)
12
12
  - Custom ThreeJS Scene + Object Inspector
13
13
 
14
+ ### MultiView
15
+
16
+ | Action | Keys |
17
+ | ------ | ------ |
18
+ | Zoom to Selected Item | CTRL + 0 |
19
+ | Rotate to Front | CTRL + 1 |
20
+ | Rotate to Top | CTRL + 2 |
21
+ | Rotate to Right | CTRL + 3 |
22
+ | Rotate to Back | CTRL + 4 |
23
+ | Set Transform Controls to Rotate | r |
24
+ | Set Transform Controls to Scale | s |
25
+ | Set Transform Controls to Translate | t |
26
+ | Toggles Transform Controls between **world** and **local** | q |
27
+
28
+ ### Side Panel
29
+
30
+ Holding down the **CTRL** key while dragging a number's label will multiply the delta by 10
31
+
32
+ ![Drag Multiplier](images/dragMultiplier.gif)
33
+
14
34
  ### Assets
15
35
 
16
36
  Animation / Models found at [Mixamo](https://www.mixamo.com/)
@@ -146,4 +146,4 @@ void main() {
146
146
  void main() {
147
147
  #include <clipping_planes_fragment>
148
148
  gl_FragColor = vec4(vec3(vUv, 0.0), 1.0);
149
- }`;class tr extends o.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Jn,fragmentShader:er})}}const ke=new o.Raycaster,se=new o.Vector3,xe=new o.Vector3,G=new o.Quaternion,Wi={X:new o.Vector3(1,0,0),Y:new o.Vector3(0,1,0),Z:new o.Vector3(0,0,1)},ei={type:"change"},Xi={type:"mouseDown",mode:null},Qi={type:"mouseUp",mode:null},qi={type:"objectChange"};class ir extends o.Controls{constructor(e,t=null){super(void 0,t);const i=new lr(this);this._root=i;const n=new cr;this._gizmo=n,i.add(n);const a=new hr;this._plane=a,i.add(a);const r=this;function l(C,E){let A=E;Object.defineProperty(r,C,{get:function(){return A!==void 0?A:E},set:function(T){A!==T&&(A=T,a[C]=T,n[C]=T,r.dispatchEvent({type:C+"-changed",value:T}),r.dispatchEvent(ei))}}),r[C]=E,a[C]=E,n[C]=E}l("camera",e),l("object",void 0),l("enabled",!0),l("axis",null),l("mode","translate"),l("translationSnap",null),l("rotationSnap",null),l("scaleSnap",null),l("space","world"),l("size",1),l("dragging",!1),l("showX",!0),l("showY",!0),l("showZ",!0);const h=new o.Vector3,c=new o.Vector3,p=new o.Quaternion,m=new o.Quaternion,f=new o.Vector3,y=new o.Quaternion,x=new o.Vector3,O=new o.Vector3,M=new o.Vector3,_=0,v=new o.Vector3;l("worldPosition",h),l("worldPositionStart",c),l("worldQuaternion",p),l("worldQuaternionStart",m),l("cameraPosition",f),l("cameraQuaternion",y),l("pointStart",x),l("pointEnd",O),l("rotationAxis",M),l("rotationAngle",_),l("eye",v),this._offset=new o.Vector3,this._startNorm=new o.Vector3,this._endNorm=new o.Vector3,this._cameraScale=new o.Vector3,this._parentPosition=new o.Vector3,this._parentQuaternion=new o.Quaternion,this._parentQuaternionInv=new o.Quaternion,this._parentScale=new o.Vector3,this._worldScaleStart=new o.Vector3,this._worldQuaternionInv=new o.Quaternion,this._worldScale=new o.Vector3,this._positionStart=new o.Vector3,this._quaternionStart=new o.Quaternion,this._scaleStart=new o.Vector3,this._getPointer=sr.bind(this),this._onPointerDown=rr.bind(this),this._onPointerHover=nr.bind(this),this._onPointerMove=ar.bind(this),this._onPointerUp=or.bind(this),t!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){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.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&ke.setFromCamera(e,this.camera);const t=ti(this._gizmo.picker[this.mode],ke);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&&ke.setFromCamera(e,this.camera);const t=ti(this._plane,ke,!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,Xi.mode=this.mode,this.dispatchEvent(Xi)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let a=this.space;if(i==="scale"?a="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(a="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&ke.setFromCamera(e,this.camera);const r=ti(this._plane,ke,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="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),a==="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&&(a==="local"&&(n.position.applyQuaternion(G.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)),a==="world"&&(n.parent&&n.position.add(se.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(se.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),xe.set(l,l,l)}else se.copy(this.pointStart),xe.copy(this.pointEnd),se.applyQuaternion(this._worldQuaternionInv),xe.applyQuaternion(this._worldQuaternionInv),xe.divide(se),t.search("X")===-1&&(xe.x=1),t.search("Y")===-1&&(xe.y=1),t.search("Z")===-1&&(xe.z=1);n.scale.copy(this._scaleStart).multiply(xe),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 l=20/this.worldPosition.distanceTo(se.setFromMatrixPosition(this.camera.matrixWorld));let h=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(se.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Wi[t]),se.copy(Wi[t]),a==="local"&&se.applyQuaternion(this.worldQuaternion),se.cross(this.eye),se.length()===0?h=!0:this.rotationAngle=this._offset.dot(se.normalize())*l),(t==="E"||h)&&(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),a==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(G.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(G.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ei),this.dispatchEvent(qi)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Qi.mode=this.mode,this.dispatchEvent(Qi)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(ei),this.dispatchEvent(qi),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ke}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 sr(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 nr(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function rr(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 ar(s){this.enabled&&this.pointerMove(this._getPointer(s))}function or(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function ti(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 xt=new o.Euler,B=new o.Vector3(0,1,0),Ki=new o.Vector3(0,0,0),$i=new o.Matrix4,Ot=new o.Quaternion,At=new o.Quaternion,ve=new o.Vector3,Ji=new o.Matrix4,lt=new o.Vector3(1,0,0),Ue=new o.Vector3(0,1,0),ct=new o.Vector3(0,0,1),Tt=new o.Vector3,rt=new o.Vector3,at=new o.Vector3;class lr extends o.Object3D{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}}class cr extends o.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new o.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new o.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const n=t.clone();n.opacity=.5;const a=e.clone();a.color.setHex(16711680);const r=e.clone();r.color.setHex(65280);const l=e.clone();l.color.setHex(255);const h=e.clone();h.color.setHex(16711680),h.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const p=e.clone();p.color.setHex(255),p.opacity=.5;const m=e.clone();m.opacity=.25;const f=e.clone();f.color.setHex(16776960),f.opacity=.25,e.clone().color.setHex(16776960);const x=e.clone();x.color.setHex(7895160);const O=new o.CylinderGeometry(0,.04,.1,12);O.translate(0,.05,0);const M=new o.BoxGeometry(.08,.08,.08);M.translate(0,.04,0);const _=new o.BufferGeometry;_.setAttribute("position",new o.Float32BufferAttribute([0,0,0,1,0,0],3));const v=new o.CylinderGeometry(.0075,.0075,.5,3);v.translate(0,.25,0);function C(X,Me){const ae=new o.TorusGeometry(X,.0075,3,64,Me*Math.PI*2);return ae.rotateY(Math.PI/2),ae.rotateX(Math.PI/2),ae}function E(){const X=new o.BufferGeometry;return X.setAttribute("position",new o.Float32BufferAttribute([0,0,0,1,1,1],3)),X}const A={X:[[new o.Mesh(O,a),[.5,0,0],[0,0,-Math.PI/2]],[new o.Mesh(O,a),[-.5,0,0],[0,0,Math.PI/2]],[new o.Mesh(v,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new o.Mesh(O,r),[0,.5,0]],[new o.Mesh(O,r),[0,-.5,0],[Math.PI,0,0]],[new o.Mesh(v,r)]],Z:[[new o.Mesh(O,l),[0,0,.5],[Math.PI/2,0,0]],[new o.Mesh(O,l),[0,0,-.5],[-Math.PI/2,0,0]],[new o.Mesh(v,l),null,[Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.OctahedronGeometry(.1,0),m.clone()),[0,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),p.clone()),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),h.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},T={X:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.OctahedronGeometry(.2,0),i)]],XY:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},j={START:[[new o.Mesh(new o.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new o.Mesh(new o.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new o.Line(E(),n),null,null,null,"helper"]],X:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new o.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new o.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},W={XYZE:[[new o.Mesh(C(.5,1),x),null,[0,Math.PI/2,0]]],X:[[new o.Mesh(C(.5,.5),a)]],Y:[[new o.Mesh(C(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new o.Mesh(C(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new o.Mesh(C(.75,1),f),null,[0,Math.PI/2,0]]]},he={AXIS:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},we={XYZE:[[new o.Mesh(new o.SphereGeometry(.25,10,8),i)]],X:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new o.Mesh(new o.TorusGeometry(.75,.1,2,24),i)]]},Qe={X:[[new o.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new o.Mesh(v,a),[0,0,0],[0,0,-Math.PI/2]],[new o.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(M,r),[0,.5,0]],[new o.Mesh(v,r)],[new o.Mesh(M,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new o.Mesh(M,l),[0,0,.5],[Math.PI/2,0,0]],[new o.Mesh(v,l),[0,0,0],[Math.PI/2,0,0]],[new o.Mesh(M,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.BoxGeometry(.1,.1,.1),m.clone())]]},Fe={X:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.2),i),[0,0,0]]]},ce={X:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new o.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new o.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function J(X){const Me=new o.Object3D;for(const ae in X)for(let Ce=X[ae].length;Ce--;){const te=X[ae][Ce][0].clone(),Pe=X[ae][Ce][1],Ae=X[ae][Ce][2],Re=X[ae][Ce][3],pt=X[ae][Ce][4];te.name=ae,te.tag=pt,Pe&&te.position.set(Pe[0],Pe[1],Pe[2]),Ae&&te.rotation.set(Ae[0],Ae[1],Ae[2]),Re&&te.scale.set(Re[0],Re[1],Re[2]),te.updateMatrix();const mt=te.geometry.clone();mt.applyMatrix4(te.matrix),te.geometry=mt,te.renderOrder=1/0,te.position.set(0,0,0),te.rotation.set(0,0,0),te.scale.set(1,1,1),Me.add(te)}return Me}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=J(A)),this.add(this.gizmo.rotate=J(W)),this.add(this.gizmo.scale=J(Qe)),this.add(this.picker.translate=J(T)),this.add(this.picker.rotate=J(we)),this.add(this.picker.scale=J(Fe)),this.add(this.helper.translate=J(j)),this.add(this.helper.rotate=J(he)),this.add(this.helper.scale=J(ce)),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:At;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 a=0;a<n.length;a++){const r=n[a];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(l*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(G.setFromEuler(xt.set(0,0,0)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(G.setFromEuler(xt.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(G.setFromEuler(xt.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(G.setFromEuler(xt.set(0,Math.PI/2,0)),B.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix($i.lookAt(Ki,B,Ue)),r.quaternion.multiply(G),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),se.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),se.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(se),r.visible=this.dragging):(r.quaternion.copy(i),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Ot.copy(i),B.copy(this.eye).applyQuaternion(G.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix($i.lookAt(this.eye,Ki,Ue)),r.name==="X"&&(G.setFromAxisAngle(lt,Math.atan2(-B.y,B.z)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G)),r.name==="Y"&&(G.setFromAxisAngle(Ue,Math.atan2(B.x,B.z)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G)),r.name==="Z"&&(G.setFromAxisAngle(ct,Math.atan2(B.y,B.x)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(h){return r.name===h}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class hr extends o.Mesh{constructor(){super(new o.PlaneGeometry(1e5,1e5,2,2),new o.MeshBasicMaterial({visible:!1,wireframe:!0,side:o.DoubleSide,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"),Tt.copy(lt).applyQuaternion(t==="local"?this.worldQuaternion:At),rt.copy(Ue).applyQuaternion(t==="local"?this.worldQuaternion:At),at.copy(ct).applyQuaternion(t==="local"?this.worldQuaternion:At),B.copy(rt),this.mode){case"translate":case"scale":switch(this.axis){case"X":B.copy(this.eye).cross(Tt),ve.copy(Tt).cross(B);break;case"Y":B.copy(this.eye).cross(rt),ve.copy(rt).cross(B);break;case"Z":B.copy(this.eye).cross(at),ve.copy(at).cross(B);break;case"XY":ve.copy(at);break;case"YZ":ve.copy(Tt);break;case"XZ":B.copy(at),ve.copy(rt);break;case"XYZ":case"E":ve.set(0,0,0);break}break;case"rotate":default:ve.set(0,0,0)}ve.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ji.lookAt(se.set(0,0,0),ve,B),this.quaternion.setFromRotationMatrix(Ji)),super.updateMatrixWorld(e)}}class ne extends o.EventDispatcher{static DRAG_START="Transform::dragStart";static DRAG_END="Transform::dragEnd";static _instance;three;activeCamera;controls=new Map;visibility=new Map;constructor(){super(),R.addEventListener(P.SET_SCENE,this.setScene)}clear(){for(const e of this.controls.values()){e.detach(),e.disconnect();const t=e.getHelper();Ee(t)}this.controls=new Map,this.visibility=new Map}add(e){let t=this.controls.get(e);if(t===void 0){const i=document.querySelector(".clickable");t=new ir(this.activeCamera,i),t.getHelper().name=e,t.setSpace("local"),this.controls.set(e,t),this.visibility.set(e,!0),t.addEventListener("mouseDown",()=>{this.dispatchEvent({type:ne.DRAG_START})}),t.addEventListener("mouseUp",()=>{this.dispatchEvent({type:ne.DRAG_END})}),t.addEventListener("dragging-changed",n=>{fe.instance?.toggleOrbitControls(n.value)})}return t}get(e){return this.controls.get(e)}remove(e){const t=this.get(e);return t===void 0?!1:(t.detach(),t.disconnect(),Ee(t.getHelper()),this.controls.delete(e),!0)}enabled(e){this.controls.forEach(t=>{t.enabled=e})}updateCamera(e,t){this.activeCamera=e,this.controls.forEach(i=>{i.camera!==e&&(i.camera=e,e.getWorldPosition(i.cameraPosition),e.getWorldQuaternion(i.cameraQuaternion)),i.domElement!==t&&(i.disconnect(),i.domElement=t,i.connect())})}show(){this.controls.forEach(e=>{const t=e.getHelper(),i=this.visibility.get(t.name);i!==void 0&&(t.visible=i)})}hide(){this.controls.forEach(e=>{const t=e.getHelper();this.visibility.set(t.name,t.visible),t.visible=!1})}setScene=()=>{this.clear()};static get instance(){return ne._instance||(ne._instance=new ne),ne._instance}}const dr=new o.BoxGeometry,ii=new o.Vector2;class hi extends o.Object3D{curve=new o.CatmullRomCurve3;line;draggable;curvePos;tension=.5;closed=!1;subdivide=50;curveType;offset=1;lineMaterial;_camera;_curvePercentage=0;_draggableScale=10;_transform;raycaster;draggedMat=new o.MeshBasicMaterial;parentGroup;group;constructor(e,t){const i=new o.Color(Be(.5,1,Math.random()),Be(.5,1,Math.random()),Be(.5,1,Math.random()));super(),this.name=e,this.lineMaterial=new o.LineBasicMaterial({color:i}),this.line=new o.Line(new o.BufferGeometry,this.lineMaterial),this.line.name="line",this.add(this.line),this._camera=t,this.curveType="catmullrom",this.draggedMat.color=i,this.draggable=new o.Object3D,this.draggable.name="draggablePoints",this.add(this.draggable),this.curvePos=new o.Mesh(new o.SphereGeometry(1.5),new o.MeshBasicMaterial({color:i})),this.curvePos.name="curvePos",this.curvePos.scale.setScalar(this._draggableScale),this.curvePos.visible=!1,this.add(this.curvePos),this.raycaster=new o.Raycaster,this.raycaster.params.Line.threshold=3,this.enable()}enable(){document.addEventListener("pointerdown",this.onMouseClick)}disable(){document.removeEventListener("pointerdown",this.onMouseClick)}dispose=()=>{this._transform&&(this._transform.removeEventListener("objectChange",this.updateSpline),ne.instance.remove(this.name)),this.disable(),this.parentGroup.removeGroup(this.name)};hideTransform=()=>{this._transform?.detach()};exportSpline=()=>{const e=[];this.draggable.children.forEach(t=>{e.push([pe(t.position.x,3),pe(t.position.y,3),pe(t.position.z,3)])}),ss({name:this.name,points:e,tension:this.tension,closed:this.closed,subdivide:this.subdivide,type:this.curveType}),console.log("Spline copied!")};showPoints=(e=!0)=>{this.draggable.visible=e};addPoints=(e=[])=>{if(e.length>0){const t=e.length-1;for(let i=0;i<t;i++)this.addPoint(e[i],!1);this.addPoint(e[t])}else this.addPoint(new o.Vector3(-50,0,0),!1),this.addPoint(new o.Vector3(50,0,0))};addPoint=(e,t=!0)=>{const i=this.draggable.children.length,n=new o.Mesh(dr,this.draggedMat);return n.name=`point_${i}`,n.position.copy(e),n.scale.setScalar(this._draggableScale),this.draggable.add(n),t&&this.updateSpline(),n};addNextPt=()=>{const e=this.draggable.children.length,t=new o.Vector3(Be(-this.offset,this.offset,Math.random()),Be(-this.offset,this.offset,Math.random()),Be(-this.offset,this.offset,Math.random()));e>0&&t.add(this.draggable.children[e-1].position);const i=this.addPoint(t);this._transform?.attach(i),this.group.current?.setField("Current Point",i.position)};removePoint=e=>{if(this._transform?.object===e){this._transform?.detach();const t=this.draggable.children[this.draggable.children.length-1];this._transform?.attach(t),this.group.current?.setField("Current Point",t.position)}Ee(e),this.updateSpline()};removePointAt=e=>{const t=this.draggable.children[e];this.removePoint(t)};removeSelectedPt=()=>{this._transform?.object!==void 0&&this.removePoint(this._transform?.object)};updateSpline=()=>{this.curve=new o.CatmullRomCurve3(this.points,this.closed,this.curveType,this.tension),this.line.geometry.setFromPoints(this.getPoints()),this.curvePos.position.copy(this.getPointAt(this._curvePercentage))};onMouseClick=e=>{if(!fe.instance||this._transform&&!this._transform.getHelper().visible)return;const i=fe.instance.currentWindow.current.getBoundingClientRect();ii.x=(e.clientX-i.x)/i.width*2-1,ii.y=-((e.clientY-i.y)/i.height)*2+1,this.raycaster.setFromCamera(ii,this.camera);const n=this.raycaster.intersectObjects(this.draggable.children,!1);if(n.length>0){const a=n[0].object;a!==this._transform?.object&&(this._transform?.attach(a),this.group.current?.setField("Current Point",a.position))}};getPointAt(e){return this.curve.getPointAt(e)}getPoints(){return this.curve.getPoints(this.subdivide)}getTangentAt(e){return this.curve.getTangentAt(e)}get points(){const e=[];return this.draggable.children.forEach(t=>{e.push(t.position)}),e}get total(){return this.draggable.children.length}get draggableScale(){return this._draggableScale}set draggableScale(e){this._draggableScale=e,this.draggable.children.forEach(t=>t.scale.setScalar(e)),this.curvePos.scale.setScalar(e)}get camera(){return this._camera}set camera(e){this._camera=e,this._transform!==void 0&&(this._transform.camera=e)}get curvePercentage(){return this._curvePercentage}set curvePercentage(e){this._curvePercentage=e,this.curvePos.position.copy(this.getPointAt(e))}onUpdateTransform=()=>{if(this._transform?.object&&this.group){const e=this._transform?.object;e.name.search("point")>-1&&this.group.current?.setField("Current Point",e.position)}this.updateSpline()};initDebug(e){const t=this.draggable.children;this.parentGroup=e,this._transform=ne.instance.add(this.name),this._transform.camera=this._camera,this._transform.addEventListener("objectChange",this.onUpdateTransform),this._transform.attach(t.length>0?t[t.length-1]:this),fe.instance?.scene.add(this._transform.getHelper());const i=t.length>0?t[t.length-1].position:{x:0,y:0,z:0};this.group=e.addGroup({title:this.name,items:[{prop:"Closed",type:"boolean",value:this.closed},{prop:"Visible",type:"boolean",value:this.visible},{prop:"Show Position",type:"boolean",value:this.curvePos.visible},{prop:"Show Points",type:"boolean",value:this.draggable.visible},{prop:"Color",type:"color",value:`#${this.draggedMat.color.getHexString()}`},{prop:"Curve",type:"option",options:[{title:"Catmullrom",value:"catmullrom"},{title:"Centripetal",value:"centripetal"},{title:"Chordal",value:"chordal"}]},{prop:"Draggable Scale",type:"range",min:.01,max:100,step:.01,value:this._draggableScale},{prop:"Subdivide",type:"range",min:1,max:100,step:1,value:this.subdivide},{prop:"Tension",type:"range",min:0,max:1,step:.01,value:this.tension},{prop:"New Pt Offset",type:"range",min:0,max:10,value:this.offset},{prop:"Curve At",type:"range",min:0,max:1,step:.01,value:0},{prop:"Toggle Transform",type:"button"},{prop:"Add Point",type:"button"},{prop:"Remove Point",type:"button"},{prop:"Export",type:"button"},{prop:"Delete",type:"button"},{prop:"Current Point",type:"grid3",value:i}],onUpdate:(n,a)=>{switch(n){case"Closed":this.closed=a,this.updateSpline();break;case"Visible":this.visible=a;break;case"Color":this.lineMaterial.color.setStyle(a),this.draggedMat.color.setStyle(a);break;case"Curve":this.curveType=a,this.updateSpline();break;case"Draggable Scale":this.draggableScale=a;break;case"Subdivide":this.subdivide=a,this.updateSpline();break;case"Tension":this.tension=a,this.updateSpline();break;case"New Pt Offset":this.offset=a;break;case"Curve At":this.curvePos.position.copy(this.getPointAt(a));break;case"Show Position":this.curvePos.visible=a;break;case"Show Points":this.draggable.visible=a;break;case"Toggle Transform":this._transform&&(this._transform.getHelper().visible=!this._transform.getHelper().visible);break;case"Add Point":this.addNextPt();break;case"Remove Point":this.removeSelectedPt();break;case"Export":this.exportSpline();break;case"Delete":Ee(this);break;case"Current Point":if(this.group.current&&this._transform?.object){const r=this._transform?.object;r.name.search("point")>-1&&(r.position.copy(a),this.updateSpline())}break}}}),this.draggable.children.forEach(n=>{this.debugPoint(n)})}debugPoint=e=>{e.name,e.visible=this.draggable.visible}}let Mt=0;class fs extends o.Object3D{defaultScale=10;_camera;group=null;constructor(e){super(),this.name="Spline Editor",this._camera=e,R.addEventListener(P.ADD_SPLINE,this.onAddSpline)}initDebug(){this.group=$.addEditorGroup({title:this.name,items:[{type:"button",prop:"New Spline"},{type:"boolean",prop:"Show Points",value:!0},{type:"boolean",prop:"Visible",value:this.visible},{type:"range",prop:"Default Scale",min:0,max:50,step:.01,value:this.defaultScale}],onUpdate:(e,t)=>{switch(e){case"New Spline":this.createSpline();break;case"Show Points":this.showPoints(t);break;case"Visible":this.visible=t;break;case"Default Scale":this.defaultScale=t;break}}})}dispose(){R.removeEventListener(P.ADD_SPLINE,this.onAddSpline),$.removeEditorGroup(this.name)}addSpline(e){e.draggableScale=this.defaultScale,e.hideTransform(),this.group?.current!==null&&e.initDebug(this.group.current),this.add(e)}createSpline=(e=[])=>{const t=`Spline ${Mt+1}`,i=new hi(t,this._camera);return i.addPoints(e),this.addSpline(i),Mt++,i};createSplineFromArray=e=>{const t=[];return e.forEach(i=>{t.push(new o.Vector3(i[0],i[1],i[2]))}),this.createSpline(t)};createSplineFromCatmullRom=e=>this.createSpline(e.points);createSplineFromJSON=e=>{const t=this.createSplineFromArray(e.points);return t.name=e.name,t.closed=e.closed,t.subdivide=e.subdivide,t.tension=e.tension,t.type=e.type,t.updateSpline(),t};showPoints=(e=!0)=>{this.children.forEach(t=>{t.showPoints(e)})};onAddSpline=e=>{const t=JSON.parse(e.value),i=`Spline ${Mt+1}`,n=[];t.points.forEach(r=>{n.push(new o.Vector3(r[0],r[1],r[2]))});const a=new hi(i,this.camera);a.addPoints(n),this.addSpline(a),Mt++};get camera(){return this._camera}set camera(e){this._camera=e,this.children.forEach(t=>{const i=t;i.camera=e})}}const es=["Single","Side by Side","Stacked","Quad"],ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAC60lEQVRYhe2YT4hNcRTHP48xpmYaNAvRyEQxEhnKQljYsRm9/EmSyJiMFAsMZWNhJYoNIUVJ2VGiyb9ZzIpMpkQSahbGv9GMYWrM+1rc2zjvzvvdd+99rzdvMd+6de75nd+5387vnN/v/G5KEuWMKRNNIB8mCRaKiiL5qQb2ApuBuUAV0Ad0AJeB3sSeJRX6LJbULTf6JTUn9Z+KWMUpPyp/Avoa4CNQZ3Sj/lNpdL/xottR7AjOkHRUUpekN5I6JbVLavDH75lIfZN0UFKTpCWS0pJem/HeJBEMG6yV1ONYtgFJbZJ+GF1jDh+zJb03NuliEuwMkMo4yErS2RA/LcbuYVyCrm1mA7Dal/8Cu4FG4JD/HsTTkCy6a+SVMTPQuc1sBKb78nHghi+/A+YBxwL2lbhRY+ThuARdEVxu5JdGFvACr0otdoZ8Y4+Rn0Sn5sFFsMvI6YB9MzA1YJ8mN8k1wAHzfj4uQVdyrpI0aJL7oqTtkq4FiqPLyCOSbktqlbRL0jlJQ2b8QdwCUZ4qvhRStZL0XFK1pMd57CRvq5mfhKBriRfiFUMY6oD7eOdwPlQAN4G10dfWg+uouwXsiOssAj4AC+JMcEWwvnAuOTEr7gTXPmg34zagOwkbIIOXAo9CbDYBrcBXYN+4UUdy2sRflyS5zVNlfPX7ugpJW5V9nI7mmh+lYU0lCZ2B3TOnAVuAk0BTwC5nuhWro46KauBOQJch5OpRaoIW34GreGf+YZdRqS9NAj4Bp4ClQDvwOWxCqSM4ADQEdKE5XvbXzlITrAVe4TW+M6NMKDXBFLAMuAD0ACfIc7pMZBXXA2cY3/xmodQRHAL2A2+NLtj8ZiEKwUL/z2WMPAJcAVYALWSf8dZuDFGWeBHwKxm3sWYhiGG8Tfo6sA2vSfiSy4GrH3wGrDcfKSSKKf6v1E9yF0XK9Q1XBPuMXMw8HXTonQFwETwNzMFr64v1jzgFHIk9ybHEZYPJo65QlD3Bf2/Q/eaHPiSWAAAAAElFTkSuQmCC",pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAETklEQVRYhe2YXYhVVRTHf3d0/JhyUrMpFbImM+whSa3Mynww+4AeIgiKoozooQ+KyMyXIAujF6OXqHyI6iEKKYgIP/owsjSFqCkprdDUTEcjbWZ0HHV+Pex1ucfb9Z57Z9REXHA4Z++99l7/s/ZZ/7X2KaiczNLwfwPIk9MA+yunNMAG4DHgV+BvoB3YFff2TPstYEyfrajVroI6Sr1GvahsbJC63HzZq04pmztSvU5tVRuqYRiYg78JeBR4HPg5ntdmxovz9wJfA3uAxuibDLQCA+IqynnAQuBuYCnwMLC1rx48U12U8cZqdWqMDcx4cI16qTpYbVKHqa+ovWUeHKsujn7VL9ULq2HI+wY7gVeBJdGeFu3J4ZUiy/cAXeHRRuAQsC/GC0B3eG4BcH/0tUV7czUAeVsMsBF4Kha9HZgCvAncAuwPnXHA0wFuGLANuDrGuoGDwFxgTqzzQ7RX5FrP2eLsdb76vnogtme6+nE8H1YPlQXHwbi3q9eqn0e7Tb25VrsF68vFY0lb1AGcDTwItGQ8tQM4AIwGmqP/EPAu8A0wElgJfFGzxTo8mKWXu9Rd4ZF96jvqjSbauEC9Sn1O3R463epLaku99voCsFXdkAH3kNpcQW+IiT/bQne3eufxBtioPqP2mKhioXpWzpxb1T8C5Ifh4ZptVoriRmAIKdrI3Lujf3bobAPeJpF0NVkKrAFuI9HTOBIxnxFrF4OgQKKr/dnJlQA+AcwABgOHA4zAamA5cE7orQL+zAEHiWI+A2bFC7aSguheYCgpqAphZz3wSB7AecCICv2TgH8oFRib4gVqka0k0h8CXAxMBW6ooDejFoCvA9OBQUAvKWM0kDz4XUZvNKXtyZMWUl7vBbaQXq457PeEziDgx/KJlQAuIPFdMcEXv5OdYWBP9M8k8VpnDQCvB4aTSrCNJB5cSdrW3tBpIJVnR0qdUTxAfdGUOVTnmwqEanNmqltC/9OgqePKg5eom8PgdvW+oJ9Kupera0O3U50TL3lcAaI+oHaF4R3qa6Z822wq0Saq89T1lmSxOrxeW/Xm4uGkiqQDmECKuKHxHW0HdpMiewSpvGqKeR8Ay0iBsYIjg6261PE2o9Q3Yqv+MqWxO9R1Hl12qs+q49Vlppy82pSr+5xJKsko4AXgHlJ0t5NIeg3wLXAlqZhtIUV8J6nmWwX8QiLjdhL5TwMWkY4R6/rrwYKlMr1Y321QZ/vfwBijPqm+rF4Wc7PjE9QllurGVeoV5gRNHsAm9fnMom3qrKPoTjKdMXaYyrFygEWQ72XWW24qhPu8xcUc2UU6O8wFPjmK7jhgPHAuMJGUGQ6U6WwE5sfzTXGvei7KA9hFOiR9D/wOfFVFt4dS2tpfRe83Ur7/CPiJakfOGgBCypubatArl2r8VfOax/LfzABKtePAzHO/5FgC7KBEzB2kOrDfUm8mOeFySv9+OyFyGmB/5aQH+C9BVKmVCNuMZgAAAABJRU5ErkJggg==";class fe extends w.Component{static instance=null;scene=new o.Scene;renderer;currentScene;cameras=new Map;controls=new Map;currentCamera;currentWindow;cameraHelpers=new Map;lightHelpers=new Map;helpersContainer=new o.Group;grid=new $n;axisHelper=new o.AxesHelper(500);interactionHelper=new o.AxesHelper(100);currentTransform;splineEditor;depthMaterial=new o.MeshDepthMaterial;normalsMaterial=new o.MeshNormalMaterial;uvMaterial=new tr;wireframeMaterial=new o.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0});playing=!1;rafID=-1;width=0;height=0;sceneSet=!1;tlCam=null;trCam=null;blCam=null;brCam=null;tlRender="Renderer";trRender="Renderer";blRender="Renderer";brRender="Renderer";cameraVisibility=!0;lightVisibility=!0;selectedItem=void 0;debugCamera;raycaster=new o.Raycaster;pointer=new o.Vector2;cameraControls=void 0;canvasRef;containerRef;tlWindow;trWindow;blWindow;brWindow;constructor(e){super(e),this.canvasRef=w.createRef(),this.containerRef=w.createRef(),this.tlWindow=w.createRef(),this.trWindow=w.createRef(),this.blWindow=w.createRef(),this.brWindow=w.createRef();const t=e.three.app.appID,i=localStorage,n=i.getItem(`${t}_mode`);this.state={mode:n!==null?n:"Single",modeOpen:!1,renderModeOpen:!1,interactionMode:"Orbit",interactionModeOpen:!1,lastUpdate:Date.now()},i.setItem(`${t}_mode`,this.state.mode),i.setItem(`${t}_tlCam`,i.getItem(`${t}_tlCam`)!==null?i.getItem(`${t}_tlCam`):"Debug"),i.setItem(`${t}_trCam`,i.getItem(`${t}_trCam`)!==null?i.getItem(`${t}_trCam`):"Orthographic"),i.setItem(`${t}_blCam`,i.getItem(`${t}_blCam`)!==null?i.getItem(`${t}_blCam`):"Front"),i.setItem(`${t}_brCam`,i.getItem(`${t}_brCam`)!==null?i.getItem(`${t}_brCam`):"Top"),i.setItem(`${t}_tlRender`,i.getItem(`${t}_tlRender`)!==null?i.getItem(`${t}_tlRender`):"Renderer"),i.setItem(`${t}_trRender`,i.getItem(`${t}_trRender`)!==null?i.getItem(`${t}_trRender`):"Renderer"),i.setItem(`${t}_blRender`,i.getItem(`${t}_blRender`)!==null?i.getItem(`${t}_blRender`):"Renderer"),i.setItem(`${t}_brRender`,i.getItem(`${t}_brRender`)!==null?i.getItem(`${t}_brRender`):"Renderer");const a={Vector2:o.Vector2,Vector3:o.Vector3,Vector4:o.Vector4,Quaternion:o.Quaternion,Matrix4:o.Matrix4,Spherical:o.Spherical,Box3:o.Box3,Sphere:o.Sphere,Raycaster:o.Raycaster};be.install({THREE:a}),this.setupScene(),this.setupTools();const r=localStorage.getItem(this.expandedCameraVisibility);this.cameraVisibility=r!==null?r==="open":!1,this.saveExpandedCameraVisibility();const l=localStorage.getItem(this.expandedLightVisibility);this.lightVisibility=l!==null?l==="open":!1,this.saveExpandedLightVisibility(),fe.instance=this}componentDidMount(){this.setupRenderer(),this.enable(),this.assignControls(),this.resize(),this.play(),ne.instance.three=this.props.three,ne.instance.activeCamera=this.debugCamera}componentDidUpdate(e,t,i){t.mode!==this.state.mode&&(this.assignControls(),this.resize())}componentWillUnmount(){this.disable()}render(){const e=[];return this.cameras.forEach((t,i)=>{e.push(i)}),u.jsxs("div",{className:"multiview",children:[u.jsx("canvas",{ref:this.canvasRef}),u.jsxs("div",{className:`cameras ${this.state.mode==="Single"||this.state.mode==="Stacked"?"single":""}`,ref:this.containerRef,children:[this.state.mode==="Single"&&u.jsx(u.Fragment,{children:u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}})}),(this.state.mode==="Side by Side"||this.state.mode==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}}),u.jsx(Le,{name:"tr",camera:this.trCam,options:e,ref:this.trWindow,onSelectCamera:t=>{this.controls.get(this.trCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.trCam),this.trCam=i,localStorage.setItem(`${this.appID}_trCam`,i.name),this.createControls(i,this.trWindow.current))},onSelectRenderMode:t=>{this.trRender=t,localStorage.setItem(`${this.appID}_trRender`,t)}})]}),this.state.mode==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}}),u.jsx(Le,{name:"tr",camera:this.trCam,options:e,ref:this.trWindow,onSelectCamera:t=>{this.controls.get(this.trCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.trCam),this.trCam=i,localStorage.setItem(`${this.appID}_trCam`,i.name),this.createControls(i,this.trWindow.current))},onSelectRenderMode:t=>{this.trRender=t,localStorage.setItem(`${this.appID}_trRender`,t)}}),u.jsx(Le,{name:"bl",camera:this.blCam,options:e,ref:this.blWindow,onSelectCamera:t=>{this.controls.get(this.blCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.blCam),this.blCam=i,localStorage.setItem(`${this.appID}_blCam`,i.name),this.createControls(i,this.blWindow.current))},onSelectRenderMode:t=>{this.blRender=t,localStorage.setItem(`${this.appID}_blRender`,t)}}),u.jsx(Le,{name:"br",camera:this.brCam,options:e,ref:this.brWindow,onSelectCamera:t=>{this.controls.get(this.brCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.brCam),this.brCam=i,localStorage.setItem(`${this.appID}_brCam`,i.name),this.createControls(i,this.brWindow.current))},onSelectRenderMode:t=>{this.brRender=t,localStorage.setItem(`${this.appID}_brRender`,t)}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(It,{title:"View",index:es.indexOf(this.state.mode),options:es,onSelect:t=>{t!==this.state.mode&&(this.killControls(),this.setState({mode:t}),localStorage.setItem(`${this.appID}_mode`,t))},open:this.state.modeOpen,onToggle:t=>{this.setState({modeOpen:t,renderModeOpen:!1,interactionModeOpen:!1})}}),u.jsx(It,{title:"Interact",index:this.state.interactionMode==="Orbit"?0:1,options:["Orbit Mode","Selection Mode"],onSelect:t=>{this.interactionHelper.visible=t==="Selection Mode",this.setState({interactionMode:this.interactionHelper.visible?"Selection":"Orbit"})},open:this.state.interactionModeOpen,onToggle:t=>{this.setState({modeOpen:!1,renderModeOpen:!1,interactionModeOpen:t})}}),u.jsx(Zi,{name:"cameraHelper",icon:ur,selected:this.cameraVisibility,height:24,top:2,onClick:t=>{if(this.cameraVisibility=t,this.saveExpandedCameraVisibility(),this.cameraHelpers.forEach(i=>{i.visible=t}),this.selectedItem!==void 0&&!t&&this.selectedItem instanceof o.PerspectiveCamera){const i=this.cameraHelpers.get(this.selectedItem.name);i!==void 0&&(i.visible=!0)}}}),u.jsx(Zi,{name:"lightHelper",icon:pr,selected:this.lightVisibility,height:24,top:4,onClick:t=>{if(this.lightVisibility=t,this.saveExpandedLightVisibility(),this.lightHelpers.forEach(i=>{i.visible=t}),this.selectedItem!==void 0&&!t&&this.selectedItem.isLight===!0){const i=this.lightHelpers.get(this.selectedItem.name);i!==void 0&&(i.visible=!0)}}})]},this.state.lastUpdate)]})}setupRenderer(){this.renderer=new o.WebGLRenderer({canvas:this.canvasRef.current,stencil:!1}),this.renderer.autoClear=!1,this.renderer.shadowMap.enabled=!0,this.renderer.setPixelRatio(devicePixelRatio),this.renderer.setClearColor(0),this.props.three.renderer=this.renderer}setupScene(){this.scene.name="Debug Scene",this.scene.uuid="",this.helpersContainer.name="helpers",this.scene.add(this.helpersContainer),this.helpersContainer.add(this.grid),this.axisHelper.name="axisHelper",this.helpersContainer.add(this.axisHelper),this.interactionHelper.name="interactionHelper",this.helpersContainer.add(this.interactionHelper),this.interactionHelper.visible=!1;const e=(n,a)=>{const r=new o.OrthographicCamera(-100,100,100,-100,50,5e3);return r.name=n,r.position.copy(a),r.lookAt(0,0,0),this.cameras.set(n,r),r};e("Top",new o.Vector3(0,1e3,0)),e("Bottom",new o.Vector3(0,-1e3,0)),e("Left",new o.Vector3(-1e3,0,0)),e("Right",new o.Vector3(1e3,0,0)),e("Front",new o.Vector3(0,0,1e3)),e("Back",new o.Vector3(0,0,-1e3)),e("Orthographic",new o.Vector3(1e3,1e3,1e3)),e("UI",new o.Vector3),this.debugCamera=new o.PerspectiveCamera(60,1,50,5e3),this.debugCamera.name="Debug",this.debugCamera.position.set(500,500,500),this.debugCamera.lookAt(0,0,0),this.cameras.set("Debug",this.debugCamera),this.currentCamera=this.debugCamera;const t=localStorage,i=this.props.three.app.appID;this.tlCam=this.cameras.get(t.getItem(`${i}_tlCam`)),this.trCam=this.cameras.get(t.getItem(`${i}_trCam`)),this.blCam=this.cameras.get(t.getItem(`${i}_blCam`)),this.brCam=this.cameras.get(t.getItem(`${i}_brCam`)),this.tlCam===void 0&&(this.tlCam=this.cameras.get("Debug")),this.trCam===void 0&&(this.trCam=this.cameras.get("Orthographic")),this.blCam===void 0&&(this.blCam=this.cameras.get("Front")),this.brCam===void 0&&(this.brCam=this.cameras.get("Top"))}setupTools(){this.splineEditor=new fs(this.currentCamera),this.splineEditor.initDebug(),this.scene.add(this.splineEditor)}play(){this.playing=!0,this.onUpdate()}pause(){this.playing=!1,cancelAnimationFrame(this.rafID),this.rafID=-1}toggleOrbitControls(e){this.controls.forEach(t=>{t.enabled=!e})}update(){this.controls.forEach(e=>{e.update()}),this.cameraHelpers.forEach(e=>{e.update()}),this.lightHelpers.forEach(e=>{e.update!==void 0&&e.update()}),this.props.onSceneUpdate!==void 0&&this.sceneSet&&this.props.onSceneUpdate(this.currentScene)}draw(){switch(this.renderer?.clear(),this.state.mode){case"Single":this.drawSingle();break;case"Side by Side":case"Stacked":this.drawDouble();break;case"Quad":this.drawQuad();break}}onUpdate=()=>{this.playing&&(this.update(),this.draw(),this.rafID=requestAnimationFrame(this.onUpdate))};enable(){const e=this.containerRef.current;e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("click",this.onClick),window.addEventListener("keydown",this.onKey),window.addEventListener("resize",this.resize),R.addEventListener(P.SET_SCENE,this.sceneUpdate),R.addEventListener(P.ADD_CAMERA,this.addCamera),R.addEventListener(P.REMOVE_CAMERA,this.removeCamera),R.addEventListener(P.SET_OBJECT,this.onSetSelectedItem)}disable(){const e=this.containerRef.current;e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("click",this.onClick),window.removeEventListener("keydown",this.onKey),window.removeEventListener("resize",this.resize),R.removeEventListener(P.SET_SCENE,this.sceneUpdate),R.removeEventListener(P.ADD_CAMERA,this.addCamera),R.removeEventListener(P.REMOVE_CAMERA,this.removeCamera),R.removeEventListener(P.SET_OBJECT,this.onSetSelectedItem)}resize=()=>{this.width=window.innerWidth-300,this.height=window.innerHeight;const e=Math.floor(this.width/2),t=Math.floor(this.height/2);this.props.three.resize(this.width,this.height),this.props.onSceneResize!==void 0&&this.sceneSet&&this.currentScene!==void 0&&this.props.onSceneResize(this.currentScene,this.width,this.height);let i=this.width,n=this.height;switch(this.state.mode){case"Side by Side":i=e,n=this.height;break;case"Stacked":i=this.width,n=t;break;case"Quad":i=e,n=t;break}const a=i/n;this.cameras.forEach(r=>{r instanceof o.OrthographicCamera?(r.left=i/-2,r.right=i/2,r.top=n/2,r.bottom=n/-2,r.name==="UI"&&(r.position.x=this.width/2,r.position.y=this.height/-2,r.position.z=100),r.updateProjectionMatrix()):r instanceof o.PerspectiveCamera&&(r.aspect=a,r.updateProjectionMatrix(),this.cameraHelpers.get(r.name)?.update())})};sceneUpdate=e=>{this.helpersContainer.add(this.axisHelper),this.clearLightHelpers(),this.scene.remove(this.currentScene),Ee(this.currentScene);const t=this.props.scenes.get(e.value.name);if(t!==void 0){const i=new t;this.props.onSceneSet!==void 0&&this.props.onSceneSet(i),this.currentScene=i,this.props.three.scene=this.currentScene,this.scene.add(this.currentScene),this.sceneSet=!0,this.addLightHelpers()}};addCamera=e=>{const t=e.value,i=this.props.three.scene?.getObjectByProperty("uuid",t.uuid);if(i!==void 0&&this.cameras.set(t.name,i),i instanceof o.PerspectiveCamera){const n=new o.CameraHelper(i);n.visible=this.cameraVisibility,this.cameraHelpers.set(i.name,n),this.scene.add(n)}this.setState({lastUpdate:Date.now()})};removeCamera=e=>{const t=this.cameraHelpers.get(e.value.name);t!==void 0&&(this.scene.remove(t),t.dispose()),this.cameras.delete(e.value.name),this.setState({lastUpdate:Date.now()})};onMouseMove=e=>{const t=new o.Vector2;this.renderer.getSize(t);const i=Math.min(e.clientX,t.x),n=Math.min(e.clientY,t.y);this.pointer.x=Ve(i,0,t.x,-1,1),this.pointer.y=Ve(n,0,t.y,1,-1);const a=t.x/2,r=t.y/2,l=()=>{i<a?this.pointer.x=Ve(i,0,a,-1,1):this.pointer.x=Ve(i,a,t.x,-1,1)},h=()=>{n<r?this.pointer.y=Ve(n,0,r,1,-1):this.pointer.y=Ve(n,r,t.y,1,-1)};switch(this.state.mode){case"Quad":l(),h();break;case"Side by Side":l();break;case"Stacked":h(),h();break}if(this.updateCamera(i,n,a,r),this.state.interactionMode==="Orbit")return;const c=this.raycaster.intersectObjects(this.currentScene.children);c.length>0&&this.interactionHelper.position.copy(c[0].point)};onClick=e=>{if(this.state.interactionMode==="Orbit")return;const t=new o.Vector2;if(this.renderer.getSize(t),e.clientX>=t.x)return;this.onMouseMove(e);const i=this.raycaster.intersectObjects(this.currentScene.children);i.length>0&&(this.props.three.getObject(i[0].object.uuid),this.interactionHelper.visible=!1,this.setState({interactionMode:"Orbit",lastUpdate:Date.now()}))};onKey=e=>{if(this.selectedItem!==void 0){if(e.ctrlKey){if(this.currentCamera.name==="UI")return;const t=this.controls.get(this.currentCamera.name);e.key==="0"?(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.selectedItem instanceof o.Mesh||this.selectedItem instanceof o.SkinnedMesh?(this.selectedItem.geometry.computeBoundingBox(),this.cameraControls.fitToBox(this.selectedItem.geometry.boundingBox,!0)):this.cameraControls.fitToSphere(this.selectedItem,!0),this.updateCameraControls(t,!0)):e.key==="1"?(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(0,Math.PI*.5,!0),this.cameraControls.moveTo(this.selectedItem.position.x,this.selectedItem.position.y,0,!0),this.updateCameraControls(t)):e.key==="2"?(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(0,0,!0),this.cameraControls.moveTo(this.selectedItem.position.x,0,this.selectedItem.position.z,!0),this.updateCameraControls(t)):e.key==="3"?(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(Math.PI/2,Math.PI/2,!0),this.cameraControls.moveTo(0,this.selectedItem.position.y,this.selectedItem.position.z,!0),this.updateCameraControls(t)):e.key==="4"?(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(Math.PI,Math.PI/2,!0),this.cameraControls.moveTo(this.selectedItem.position.x,this.selectedItem.position.y,0,!0),this.updateCameraControls(t)):e.key==="5"&&(this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(li(45),li(45),!0),this.updateCameraControls(t))}else if(this.currentTransform!==void 0)switch(e.key){case"r":this.currentTransform.setMode("rotate");break;case"s":this.currentTransform.setMode("scale");break;case"t":this.currentTransform.setMode("translate");break;case"q":this.currentTransform.setSpace(this.currentTransform.space==="local"?"world":"local");break}}};onSetSelectedItem=e=>{this.selectedItem!==void 0&&this.updateSelectedItemHelper(!1),this.selectedItem=this.currentScene.getObjectByProperty("uuid",e.value.uuid),this.selectedItem!==void 0&&(this.currentTransform!==void 0&&(this.currentTransform.removeEventListener("objectChange",this.onUpdateTransform),ne.instance.remove(this.currentTransform.getHelper().name)),this.currentTransform=ne.instance.add(e.value.name),this.currentTransform.attach(this.selectedItem),this.scene.add(this.currentTransform.getHelper()),this.currentTransform.addEventListener("objectChange",this.onUpdateTransform),this.updateSelectedItemHelper(!0))};updateSelectedItemHelper(e){if(this.selectedItem!==void 0){if(this.selectedItem instanceof o.PerspectiveCamera&&!this.cameraVisibility){const t=this.cameraHelpers.get(this.selectedItem.name);t!==void 0&&(t.visible=e)}else if(this.selectedItem.isLight===!0&&!this.lightVisibility){const t=this.lightHelpers.get(this.selectedItem.name);t!==void 0&&(t.visible=e)}}}onUpdateTransform=()=>{this.selectedItem!==void 0&&(this.props.three.updateObject(this.selectedItem.uuid,"position",this.selectedItem.position),this.props.three.updateObject(this.selectedItem.uuid,"rotation",{x:this.selectedItem.rotation.x,y:this.selectedItem.rotation.y,z:this.selectedItem.rotation.z}),this.props.three.updateObject(this.selectedItem.uuid,"scale",this.selectedItem.scale),Ut.instance.update())};clearLightHelpers=()=>{this.lightHelpers.forEach(e=>{this.helpersContainer.remove(e),e.dispose()}),this.lightHelpers.clear()};addLightHelpers=()=>{this.currentScene!==void 0&&this.currentScene.traverse(e=>{if(e.type.search("Light")>-1){let t;switch(e.type){case"DirectionalLight":t=new o.DirectionalLightHelper(e,100),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"HemisphereLight":t=new o.HemisphereLightHelper(e,250),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"RectAreaLight":t=new In(e),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"PointLight":t=new o.PointLightHelper(e,100),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"SpotLight":t=new o.SpotLightHelper(e),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break}}})};createControls(e,t){const i=this.controls.get(e.name);if(i!==void 0&&i.dispose(),this.controls.delete(e.name),e.name==="UI")return;const n=new kn(e,t);switch(n.enableDamping=!0,n.dampingFactor=.05,e.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":n.enableRotate=!1;break}this.controls.set(e.name,n)}clearCamera(e){const t=this.cameraHelpers.get(e.name);t!==void 0&&(this.scene.remove(t),t.dispose(),this.cameraHelpers.delete(e.name));const i=this.controls.get(e.name);i!==void 0&&(i.dispose(),this.controls.delete(e.name))}killControls(){this.controls.forEach((e,t)=>{e.dispose();const i=this.cameraHelpers.get(t);i!==void 0&&(this.scene.remove(i),i.dispose()),this.cameraHelpers.delete(t),this.controls.delete(t)}),this.controls.clear(),this.cameraHelpers.clear()}assignControls(){switch(this.state.mode){case"Single":this.createControls(this.tlCam,this.tlWindow.current);break;case"Side by Side":case"Stacked":this.createControls(this.tlCam,this.tlWindow.current),this.createControls(this.trCam,this.trWindow.current);break;case"Quad":this.createControls(this.tlCam,this.tlWindow.current),this.createControls(this.trCam,this.trWindow.current),this.createControls(this.blCam,this.blWindow.current),this.createControls(this.brCam,this.brWindow.current);break}}updateCamera=(e,t,i,n)=>{switch(this.state.mode){case"Quad":t<n?e<i?this.currentCamera=this.tlCam:this.currentCamera=this.trCam:e<i?this.currentCamera=this.blCam:this.currentCamera=this.brCam;break;case"Side by Side":e<i?this.currentCamera=this.tlCam:this.currentCamera=this.trCam;break;case"Single":this.currentCamera=this.tlCam;break;case"Stacked":t<n?this.currentCamera=this.tlCam:this.currentCamera=this.trCam;break}this.splineEditor.camera=this.currentCamera,this.raycaster.setFromCamera(this.pointer,this.currentCamera),this.currentCamera===this.tlCam?this.currentWindow=this.tlWindow:this.currentCamera===this.trCam?this.currentWindow=this.trWindow:this.currentCamera===this.blCam?this.currentWindow=this.blWindow:this.currentCamera===this.brCam&&(this.currentWindow=this.brWindow),ne.instance.updateCamera(this.currentCamera,this.currentWindow.current)};updateCameraControls=(e,t=!1)=>{if(this.selectedItem===void 0)return;cancelAnimationFrame(this.rafID),this.rafID=-1,this.cameraControls&&(this.cameraControls.smoothTime=.1);const i=.15,n=new o.Clock;n.start(),this.selectedItem.getWorldPosition(e.target0);const a=()=>{const r=n.getDelta();this.cameraControls&&this.cameraControls.update(r),t&&(e.target.lerp(e.target0,i),e.object.position.lerp(e.position0,i),e.object.zoom=Rt(e.object.zoom,e.zoom0,i),e.object.updateProjectionMatrix(),e.dispatchEvent({type:"change"})),n.getElapsedTime()>=.5?(cancelAnimationFrame(this.rafID),this.rafID=-1,this.clearControls()):this.rafID=requestAnimationFrame(a)};a()};clearControls=()=>{this.cameraControls!==void 0&&(this.cameraControls.disconnect(),this.cameraControls.dispose(),this.cameraControls=void 0)};saveExpandedCameraVisibility(){localStorage.setItem(this.expandedCameraVisibility,this.cameraVisibility?"open":"closed")}saveExpandedLightVisibility(){localStorage.setItem(this.expandedLightVisibility,this.lightVisibility?"open":"closed")}getSceneOverride(e){switch(e){case"Depth":return this.depthMaterial;case"Normals":return this.normalsMaterial;case"Renderer":return null;case"UVs":return this.uvMaterial;case"Wireframe":return this.wireframeMaterial}return null}drawSingle(){const e=this.getSceneOverride(this.tlRender);this.scene.overrideMaterial=e,this.renderer?.setViewport(0,0,this.width,this.height),this.renderer?.setScissor(0,0,this.width,this.height),this.renderer?.render(this.scene,this.tlCam)}drawDouble=()=>{const e=this.getSceneOverride(this.tlRender),t=this.getSceneOverride(this.trRender),i=Math.floor(this.width/2),n=Math.floor(this.height/2);if(this.scene.overrideMaterial=e,this.state.mode==="Side by Side")this.renderer?.setViewport(0,0,i,this.height),this.renderer?.setScissor(0,0,i,this.height),this.renderer?.render(this.scene,this.tlCam),this.scene.overrideMaterial=t,this.renderer?.setViewport(i,0,i,this.height),this.renderer?.setScissor(i,0,i,this.height),this.renderer?.render(this.scene,this.trCam);else{const a=this.height-n;this.renderer?.setViewport(0,a,this.width,n),this.renderer?.setScissor(0,a,this.width,n),this.renderer?.render(this.scene,this.tlCam),this.scene.overrideMaterial=t,this.renderer?.setViewport(0,0,this.width,n),this.renderer?.setScissor(0,0,this.width,n),this.renderer?.render(this.scene,this.trCam)}};drawQuad=()=>{const e=this.getSceneOverride(this.tlRender),t=this.getSceneOverride(this.trRender),i=this.getSceneOverride(this.blRender),n=this.getSceneOverride(this.brRender),a=Math.floor(this.width/2),r=Math.floor(this.height/2);let l=0,h=0;h=this.height-r,l=0,this.scene.overrideMaterial=e,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.tlCam),l=a,this.scene.overrideMaterial=t,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.trCam),h=0,l=0,this.scene.overrideMaterial=i,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.blCam),l=a,this.scene.overrideMaterial=n,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.brCam)};get appID(){return this.props.three.app.appID}get mode(){return this.state.mode}get three(){return this.props.three}get expandedCameraVisibility(){return`${this.appID}_multiviewCameraVisibility`}get expandedLightVisibility(){return`${this.appID}_multiviewLightVisibility`}}class Ut extends w.Component{static instance;matrix=new o.Matrix4;position=new o.Vector3;rotation=new o.Euler;scale=new o.Vector3;open=!1;constructor(e){super(e);const t=localStorage.getItem(this.expandedName),i=t!==null?t==="open":!1;this.open=i,this.saveExpanded(),this.state={lastUpdated:0,expanded:i},this.matrix.elements=e.object.matrix,e.object.uuid.length>0&&(this.position.setFromMatrixPosition(this.matrix),this.rotation.setFromRotationMatrix(this.matrix),this.scale.setFromMatrixScale(this.matrix)),Ut.instance=this}update(){if(fe.instance){const e=fe.instance.selectedItem;if(e===void 0)return;this.position.x=pe(e.position.x,3),this.position.y=pe(e.position.y,3),this.position.z=pe(e.position.z,3),this.rotation.copy(e.rotation),this.scale.x=pe(e.scale.x,3),this.scale.y=pe(e.scale.y,3),this.scale.z=pe(e.scale.z,3),this.setState({lastUpdated:Date.now()})}}render(){return u.jsx(ge,{title:"Transform",expanded:this.open,items:[{title:"Position",prop:"position",type:"grid3",step:.1,value:this.position,onChange:this.updateTransform},{title:"Rotation",prop:"rotation",type:"euler",value:this.rotation,onChange:this.updateTransform},{title:"Scale",prop:"scale",type:"grid3",value:this.scale,onChange:this.updateTransform},{title:"Visible",prop:"visible",type:"boolean",value:this.props.object.visible,onChange:this.updateTransform}],onToggle:e=>{this.open=e,this.saveExpanded()}},this.state.lastUpdated)}updateTransform=(e,t)=>{const i=e==="rotation"?{x:t._x,y:t._y,z:t._z}:t;this.props.three.updateObject(this.props.object.uuid,e,i);const n=this.props.three.getScene(this.props.object.uuid);if(n){const a=n.getObjectByProperty("uuid",this.props.object.uuid);q(a,e,i)}};saveExpanded(){localStorage.setItem(this.expandedName,this.open?"open":"closed")}get expandedName(){return`${this.props.three.app.appID}_transform`}}function ts(s){switch(s){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color";case"width":return"Width";case"height":return"Height"}return s}function mr(s,e){function t(){return`${e.app.appID}_light`}const i=localStorage.getItem(t()),n=i!==null?i==="open":!1;function a(l){localStorage.setItem(t(),l?"open":"closed")}const r=[];if(s.lightInfo!==void 0)for(const l in s.lightInfo){const h=s.lightInfo[l];h!==void 0&&(h.isColor!==void 0?r.push({title:ts(l),prop:l,type:"color",value:h,onChange:(c,p)=>{const m=new o.Color(p);e.updateObject(s.uuid,c,m);const f=e.getScene(s.uuid);if(f!==null){const y=f.getObjectByProperty("uuid",s.uuid);q(y,c,m)}}}):r.push({title:ts(l),prop:l,type:typeof h,value:h,step:typeof h=="number"?.01:void 0,onChange:(c,p)=>{e.updateObject(s.uuid,c,p);const m=e.getScene(s.uuid);if(m!==null){const f=m.getObjectByProperty("uuid",s.uuid);q(f,c,p)}}}))}return u.jsx(ge,{title:"Light",items:r,expanded:n,onToggle:l=>{a(l)}})}function fr(s){const e=s.object,t=s.three;function i(){return`${t.app.appID}_animation`}const n=localStorage.getItem(i()),a=n!==null?n==="open":!1;function r(f){localStorage.setItem(i(),f?"open":"closed")}const l=[],h=[];let c=0;e.animations.forEach(f=>{c=Math.max(c,f.duration),f.duration>0&&h.push({title:f.name,items:[{title:"Duration",type:"number",value:f.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),l.push({title:"Animations",items:h});let p;const m=t.getScene(e.uuid);if(m!==null){const f=m.getObjectByProperty("uuid",e.uuid);if(f!==void 0){const y=f.mixer;if(y!==void 0){const O=[{title:"Time Scale",type:"range",value:y.timeScale,step:.01,min:-1,max:2,onChange:(M,_)=>{y.timeScale=_,t.updateObject(e.uuid,"mixer.timeScale",_)}}];O.push({title:"Stop All",type:"button",onChange:()=>{y.stopAllAction(),t.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),l.push({title:"Mixer",items:O}),p=new o.SkeletonHelper(f),fe.instance?.scene.add(p)}}}return w.useEffect(()=>()=>{p!==void 0&&Ee(p)},[]),u.jsx(ge,{title:"Animation",items:l,expanded:a,onToggle:f=>{r(f)}})}const di={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};let ie={...di};function gs(s){const[e,t]=w.useState(-1);w.useEffect(()=>{function r(h){ie={...h.value},t(Date.now())}function l(){ie={...di},t(Date.now())}return R.addEventListener(P.SET_SCENE,l),R.addEventListener(P.SET_OBJECT,r),()=>{R.removeEventListener(P.SET_SCENE,l),R.removeEventListener(P.SET_OBJECT,r)}},[]);const i=ie.type.toLowerCase(),n=ie.animations.length>0||ie.mixer!==void 0,a=i.search("mesh")>-1||i.search("line")>-1||i.search("points")>-1;return u.jsx(ut,{label:"Inspector",button:ie.uuid.length>0?u.jsx("button",{className:"remove",onClick:()=>{ne.instance.remove(ie.name),ie={...di},t(Date.now())}}):void 0,children:u.jsx("div",{id:"Inspector",className:s.class,children:ie.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(u.Fragment,{children:[u.jsx(Pt,{type:"string",title:"Name",prop:"name",value:ie.name,disabled:!0}),u.jsx(Pt,{type:"string",title:"Type",prop:"type",value:ie.type,disabled:!0}),u.jsx(Pt,{type:"string",title:"UUID",prop:"uuid",value:ie.uuid,disabled:!0})]}),u.jsxs(u.Fragment,{children:[u.jsx(Ut,{object:ie,three:s.three}),n?u.jsx(fr,{object:ie,three:s.three}):null,i.search("camera")>-1?Dn(ie,s.three):null,i.search("light")>-1?mr(ie,s.three):null,a?Pn(ie,s.three):null]})]})},e)},"Inspector")}function _s(s){const[e]=w.useState([]),[t]=w.useState([]),[i,n]=w.useState(0),a=h=>{const c=h.value;e.push(c),t.push(u.jsx(ut,{label:`Scene: ${c.name}`,scene:c,open:!0,onRefresh:()=>{s.three.refreshScene(c.name)},children:u.jsx(oi,{child:c,scene:c,three:s.three})},Math.random())),n(Date.now())},r=h=>{const c=h.value;for(let p=0;p<e.length;p++)if(c.uuid===e[p].uuid){e[p]=c,t[p]=u.jsx(ut,{label:`Scene: ${c.name}`,scene:c,open:!0,onRefresh:()=>{s.three.refreshScene(c.name)},children:u.jsx(oi,{child:c,scene:c,three:s.three})},Math.random()),n(Date.now());return}},l=h=>{const c=h.value;for(let p=0;p<e.length;p++)if(c.uuid===e[p].uuid){e.splice(p,1),t.splice(p,1),n(Date.now());return}};return w.useEffect(()=>(R.addEventListener(P.ADD_SCENE,a),R.addEventListener(P.REFRESH_SCENE,r),R.addEventListener(P.REMOVE_SCENE,l),()=>{R.removeEventListener(P.ADD_SCENE,a),R.removeEventListener(P.REFRESH_SCENE,r),R.removeEventListener(P.REMOVE_SCENE,l)}),[]),u.jsxs("div",{id:"SidePanel",children:[u.jsx("div",{className:"scenes",children:t},i),u.jsx(gs,{three:s.three}),u.jsx($,{three:s.three})]})}function gr(s){return w.useEffect(()=>{function e(l){let h=null;return s.three.scenes.forEach(c=>{l.search(c.uuid)>-1&&(h=c)}),h}const t=l=>{const h=l.value,p=e(h)?.getObjectByProperty("uuid",h);p!==void 0&&s.three.setObject(p)},i=(l,h,c)=>{const m=e(l)?.getObjectByProperty("uuid",l);m!==void 0&&q(m,h,c)},n=l=>{const h=l.value,{key:c,value:p,uuid:m}=h;i(m,c,p)},a=l=>{const h=l.value,p=e(h.uuid)?.getObjectByProperty("uuid",h.uuid);if(p!==void 0){const m=f=>{const y=h.key.split(".");switch(y.length){case 1:p[y[0]]=f;break;case 2:p[y[0]][y[1]]=f;break;case 3:p[y[0]][y[1]][y[2]]=f;break;case 4:p[y[0]][y[1]][y[2]][y[3]]=f;break;case 5:p[y[0]][y[1]][y[2]][y[3]][y[4]]=f;break}p.material.needsUpdate=!0};h.value.src.length>0?os(h.value.src).then(f=>{f.offset.set(h.value.offset[0],h.value.offset[1]),f.repeat.set(h.value.repeat[0],h.value.repeat[1]),m(f)}):m(null)}},r=l=>{const{key:h,uuid:c,value:p,subitem:m}=l.value,y=e(c)?.getObjectByProperty("uuid",c);if(y!==void 0)try{m!==void 0?en(y,m)[h](p):y[h](p)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(h),console.log(p)}};return R.addEventListener(P.GET_OBJECT,t),R.addEventListener(P.UPDATE_OBJECT,n),R.addEventListener(P.CREATE_TEXTURE,a),R.addEventListener(P.REQUEST_METHOD,r),()=>{R.removeEventListener(P.GET_OBJECT,t),R.removeEventListener(P.UPDATE_OBJECT,n),R.removeEventListener(P.CREATE_TEXTURE,a),R.removeEventListener(P.REQUEST_METHOD,r)}},[]),null}function ys(s){return u.jsxs("div",{className:"editor",ref:s.ref,style:s.style,children:[u.jsx("div",{className:"header",children:s.header}),s.children,u.jsx("div",{className:"footer",children:s.footer})]})}function _r(s){return u.jsx(ys,{children:u.jsxs(u.Fragment,{children:[u.jsx(fe,{three:s.three,scenes:s.scenes,onSceneResize:s.onSceneResize,onSceneSet:s.onSceneSet,onSceneUpdate:s.onSceneUpdate}),u.jsx(_s,{three:s.three})]})})}exports.Accordion=ut;exports.Application=Zs;exports.BaseRemote=Lt;exports.ChildObject=mi;exports.ContainerObject=oi;exports.Draggable=cs;exports.DraggableItem=ls;exports.Dropdown=hs;exports.DropdownItem=ds;exports.Editor=ys;exports.ExportTexture=ht;exports.Inspector=gs;exports.MultiView=fe;exports.NavButton=pi;exports.RemoteComponents=Ws;exports.RemoteController=ln;exports.RemoteTheatre=qs;exports.RemoteThree=sn;exports.SceneInspector=gr;exports.SidePanel=_s;exports.Spline=hi;exports.SplineEditor=fs;exports.ThreeEditor=_r;exports.ToolEvents=P;exports.Transform=ne;exports.capitalize=dt;exports.clamp=Te;exports.colorToHex=ni;exports.copyToClipboard=ss;exports.customizeTheatreElements=Qs;exports.debugDispatcher=R;exports.defaultTheatreCallback=Bs;exports.dispose=Ee;exports.disposeMaterial=as;exports.disposeTexture=Gs;exports.distance=Ys;exports.hierarchyUUID=Dt;exports.isColor=rs;exports.mix=Rt;exports.noop=ui;exports.normalize=si;exports.randomID=ns;exports.resetThreeObjects=ri;exports.round=pe;exports.theatreEditorApp=Xs;
149
+ }`;class tr extends o.ShaderMaterial{constructor(){super({defines:{USE_UV:""},vertexShader:Jn,fragmentShader:er})}}const ke=new o.Raycaster,se=new o.Vector3,xe=new o.Vector3,G=new o.Quaternion,Wi={X:new o.Vector3(1,0,0),Y:new o.Vector3(0,1,0),Z:new o.Vector3(0,0,1)},ei={type:"change"},Xi={type:"mouseDown",mode:null},Qi={type:"mouseUp",mode:null},qi={type:"objectChange"};class ir extends o.Controls{constructor(e,t=null){super(void 0,t);const i=new lr(this);this._root=i;const n=new cr;this._gizmo=n,i.add(n);const a=new hr;this._plane=a,i.add(a);const r=this;function l(C,E){let A=E;Object.defineProperty(r,C,{get:function(){return A!==void 0?A:E},set:function(T){A!==T&&(A=T,a[C]=T,n[C]=T,r.dispatchEvent({type:C+"-changed",value:T}),r.dispatchEvent(ei))}}),r[C]=E,a[C]=E,n[C]=E}l("camera",e),l("object",void 0),l("enabled",!0),l("axis",null),l("mode","translate"),l("translationSnap",null),l("rotationSnap",null),l("scaleSnap",null),l("space","world"),l("size",1),l("dragging",!1),l("showX",!0),l("showY",!0),l("showZ",!0);const h=new o.Vector3,c=new o.Vector3,p=new o.Quaternion,m=new o.Quaternion,f=new o.Vector3,y=new o.Quaternion,x=new o.Vector3,O=new o.Vector3,M=new o.Vector3,_=0,v=new o.Vector3;l("worldPosition",h),l("worldPositionStart",c),l("worldQuaternion",p),l("worldQuaternionStart",m),l("cameraPosition",f),l("cameraQuaternion",y),l("pointStart",x),l("pointEnd",O),l("rotationAxis",M),l("rotationAngle",_),l("eye",v),this._offset=new o.Vector3,this._startNorm=new o.Vector3,this._endNorm=new o.Vector3,this._cameraScale=new o.Vector3,this._parentPosition=new o.Vector3,this._parentQuaternion=new o.Quaternion,this._parentQuaternionInv=new o.Quaternion,this._parentScale=new o.Vector3,this._worldScaleStart=new o.Vector3,this._worldQuaternionInv=new o.Quaternion,this._worldScale=new o.Vector3,this._positionStart=new o.Vector3,this._quaternionStart=new o.Quaternion,this._scaleStart=new o.Vector3,this._getPointer=sr.bind(this),this._onPointerDown=rr.bind(this),this._onPointerHover=nr.bind(this),this._onPointerMove=ar.bind(this),this._onPointerUp=or.bind(this),t!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){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.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&ke.setFromCamera(e,this.camera);const t=ti(this._gizmo.picker[this.mode],ke);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&&ke.setFromCamera(e,this.camera);const t=ti(this._plane,ke,!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,Xi.mode=this.mode,this.dispatchEvent(Xi)}}pointerMove(e){const t=this.axis,i=this.mode,n=this.object;let a=this.space;if(i==="scale"?a="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(a="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&ke.setFromCamera(e,this.camera);const r=ti(this._plane,ke,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="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),a==="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&&(a==="local"&&(n.position.applyQuaternion(G.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)),a==="world"&&(n.parent&&n.position.add(se.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(se.setFromMatrixPosition(n.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),xe.set(l,l,l)}else se.copy(this.pointStart),xe.copy(this.pointEnd),se.applyQuaternion(this._worldQuaternionInv),xe.applyQuaternion(this._worldQuaternionInv),xe.divide(se),t.search("X")===-1&&(xe.x=1),t.search("Y")===-1&&(xe.y=1),t.search("Z")===-1&&(xe.z=1);n.scale.copy(this._scaleStart).multiply(xe),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 l=20/this.worldPosition.distanceTo(se.setFromMatrixPosition(this.camera.matrixWorld));let h=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(se.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Wi[t]),se.copy(Wi[t]),a==="local"&&se.applyQuaternion(this.worldQuaternion),se.cross(this.eye),se.length()===0?h=!0:this.rotationAngle=this._offset.dot(se.normalize())*l),(t==="E"||h)&&(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),a==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(G.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(G.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ei),this.dispatchEvent(qi)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Qi.mode=this.mode,this.dispatchEvent(Qi)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(ei),this.dispatchEvent(qi),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ke}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 sr(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 nr(s){if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(s));break}}function rr(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 ar(s){this.enabled&&this.pointerMove(this._getPointer(s))}function or(s){this.enabled&&(this.domElement.releasePointerCapture(s.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(s)))}function ti(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 xt=new o.Euler,B=new o.Vector3(0,1,0),Ki=new o.Vector3(0,0,0),$i=new o.Matrix4,Ot=new o.Quaternion,At=new o.Quaternion,ve=new o.Vector3,Ji=new o.Matrix4,lt=new o.Vector3(1,0,0),Ue=new o.Vector3(0,1,0),ct=new o.Vector3(0,0,1),Tt=new o.Vector3,rt=new o.Vector3,at=new o.Vector3;class lr extends o.Object3D{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}}class cr extends o.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new o.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new o.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const n=t.clone();n.opacity=.5;const a=e.clone();a.color.setHex(16711680);const r=e.clone();r.color.setHex(65280);const l=e.clone();l.color.setHex(255);const h=e.clone();h.color.setHex(16711680),h.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const p=e.clone();p.color.setHex(255),p.opacity=.5;const m=e.clone();m.opacity=.25;const f=e.clone();f.color.setHex(16776960),f.opacity=.25,e.clone().color.setHex(16776960);const x=e.clone();x.color.setHex(7895160);const O=new o.CylinderGeometry(0,.04,.1,12);O.translate(0,.05,0);const M=new o.BoxGeometry(.08,.08,.08);M.translate(0,.04,0);const _=new o.BufferGeometry;_.setAttribute("position",new o.Float32BufferAttribute([0,0,0,1,0,0],3));const v=new o.CylinderGeometry(.0075,.0075,.5,3);v.translate(0,.25,0);function C(X,Me){const ae=new o.TorusGeometry(X,.0075,3,64,Me*Math.PI*2);return ae.rotateY(Math.PI/2),ae.rotateX(Math.PI/2),ae}function E(){const X=new o.BufferGeometry;return X.setAttribute("position",new o.Float32BufferAttribute([0,0,0,1,1,1],3)),X}const A={X:[[new o.Mesh(O,a),[.5,0,0],[0,0,-Math.PI/2]],[new o.Mesh(O,a),[-.5,0,0],[0,0,Math.PI/2]],[new o.Mesh(v,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new o.Mesh(O,r),[0,.5,0]],[new o.Mesh(O,r),[0,-.5,0],[Math.PI,0,0]],[new o.Mesh(v,r)]],Z:[[new o.Mesh(O,l),[0,0,.5],[Math.PI/2,0,0]],[new o.Mesh(O,l),[0,0,-.5],[-Math.PI/2,0,0]],[new o.Mesh(v,l),null,[Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.OctahedronGeometry(.1,0),m.clone()),[0,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),p.clone()),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),h.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},T={X:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.OctahedronGeometry(.2,0),i)]],XY:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},j={START:[[new o.Mesh(new o.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new o.Mesh(new o.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new o.Line(E(),n),null,null,null,"helper"]],X:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new o.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new o.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},W={XYZE:[[new o.Mesh(C(.5,1),x),null,[0,Math.PI/2,0]]],X:[[new o.Mesh(C(.5,.5),a)]],Y:[[new o.Mesh(C(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new o.Mesh(C(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new o.Mesh(C(.75,1),f),null,[0,Math.PI/2,0]]]},he={AXIS:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},we={XYZE:[[new o.Mesh(new o.SphereGeometry(.25,10,8),i)]],X:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new o.Mesh(new o.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new o.Mesh(new o.TorusGeometry(.75,.1,2,24),i)]]},Qe={X:[[new o.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new o.Mesh(v,a),[0,0,0],[0,0,-Math.PI/2]],[new o.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(M,r),[0,.5,0]],[new o.Mesh(v,r)],[new o.Mesh(M,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new o.Mesh(M,l),[0,0,.5],[Math.PI/2,0,0]],[new o.Mesh(v,l),[0,0,0],[Math.PI/2,0,0]],[new o.Mesh(M,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.BoxGeometry(.1,.1,.1),m.clone())]]},Fe={X:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new o.Mesh(new o.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new o.Mesh(new o.BoxGeometry(.2,.2,.2),i),[0,0,0]]]},ce={X:[[new o.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new o.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new o.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function J(X){const Me=new o.Object3D;for(const ae in X)for(let Ce=X[ae].length;Ce--;){const te=X[ae][Ce][0].clone(),Pe=X[ae][Ce][1],Ae=X[ae][Ce][2],Re=X[ae][Ce][3],pt=X[ae][Ce][4];te.name=ae,te.tag=pt,Pe&&te.position.set(Pe[0],Pe[1],Pe[2]),Ae&&te.rotation.set(Ae[0],Ae[1],Ae[2]),Re&&te.scale.set(Re[0],Re[1],Re[2]),te.updateMatrix();const mt=te.geometry.clone();mt.applyMatrix4(te.matrix),te.geometry=mt,te.renderOrder=1/0,te.position.set(0,0,0),te.rotation.set(0,0,0),te.scale.set(1,1,1),Me.add(te)}return Me}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=J(A)),this.add(this.gizmo.rotate=J(W)),this.add(this.gizmo.scale=J(Qe)),this.add(this.picker.translate=J(T)),this.add(this.picker.rotate=J(we)),this.add(this.picker.scale=J(Fe)),this.add(this.helper.translate=J(j)),this.add(this.helper.rotate=J(he)),this.add(this.helper.scale=J(ce)),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:At;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 a=0;a<n.length;a++){const r=n[a];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let l;if(this.camera.isOrthographicCamera?l=(this.camera.top-this.camera.bottom)/this.camera.zoom:l=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(l*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(G.setFromEuler(xt.set(0,0,0)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(G.setFromEuler(xt.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(G.setFromEuler(xt.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(G),Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(G.setFromEuler(xt.set(0,Math.PI/2,0)),B.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix($i.lookAt(Ki,B,Ue)),r.quaternion.multiply(G),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),se.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),se.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(se),r.visible=this.dragging):(r.quaternion.copy(i),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(B.copy(ct).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(B.copy(lt).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(B.copy(Ue).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Ot.copy(i),B.copy(this.eye).applyQuaternion(G.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix($i.lookAt(this.eye,Ki,Ue)),r.name==="X"&&(G.setFromAxisAngle(lt,Math.atan2(-B.y,B.z)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G)),r.name==="Y"&&(G.setFromAxisAngle(Ue,Math.atan2(B.x,B.z)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G)),r.name==="Z"&&(G.setFromAxisAngle(ct,Math.atan2(B.y,B.x)),G.multiplyQuaternions(Ot,G),r.quaternion.copy(G))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(h){return r.name===h}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(e)}}class hr extends o.Mesh{constructor(){super(new o.PlaneGeometry(1e5,1e5,2,2),new o.MeshBasicMaterial({visible:!1,wireframe:!0,side:o.DoubleSide,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"),Tt.copy(lt).applyQuaternion(t==="local"?this.worldQuaternion:At),rt.copy(Ue).applyQuaternion(t==="local"?this.worldQuaternion:At),at.copy(ct).applyQuaternion(t==="local"?this.worldQuaternion:At),B.copy(rt),this.mode){case"translate":case"scale":switch(this.axis){case"X":B.copy(this.eye).cross(Tt),ve.copy(Tt).cross(B);break;case"Y":B.copy(this.eye).cross(rt),ve.copy(rt).cross(B);break;case"Z":B.copy(this.eye).cross(at),ve.copy(at).cross(B);break;case"XY":ve.copy(at);break;case"YZ":ve.copy(Tt);break;case"XZ":B.copy(at),ve.copy(rt);break;case"XYZ":case"E":ve.set(0,0,0);break}break;case"rotate":default:ve.set(0,0,0)}ve.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ji.lookAt(se.set(0,0,0),ve,B),this.quaternion.setFromRotationMatrix(Ji)),super.updateMatrixWorld(e)}}class ne extends o.EventDispatcher{static DRAG_START="Transform::dragStart";static DRAG_END="Transform::dragEnd";static _instance;three;activeCamera;controls=new Map;visibility=new Map;constructor(){super(),R.addEventListener(P.SET_SCENE,this.setScene)}clear(){for(const e of this.controls.values()){e.detach(),e.disconnect();const t=e.getHelper();Ee(t)}this.controls=new Map,this.visibility=new Map}add(e){let t=this.controls.get(e);if(t===void 0){const i=document.querySelector(".clickable");t=new ir(this.activeCamera,i),t.getHelper().name=e,t.setSpace("local"),this.controls.set(e,t),this.visibility.set(e,!0),t.addEventListener("mouseDown",()=>{this.dispatchEvent({type:ne.DRAG_START})}),t.addEventListener("mouseUp",()=>{this.dispatchEvent({type:ne.DRAG_END})}),t.addEventListener("dragging-changed",n=>{fe.instance?.toggleOrbitControls(n.value)})}return t}get(e){return this.controls.get(e)}remove(e){const t=this.get(e);return t===void 0?!1:(t.detach(),t.disconnect(),Ee(t.getHelper()),this.controls.delete(e),!0)}enabled(e){this.controls.forEach(t=>{t.enabled=e})}updateCamera(e,t){this.activeCamera=e,this.controls.forEach(i=>{i.camera!==e&&(i.camera=e,e.getWorldPosition(i.cameraPosition),e.getWorldQuaternion(i.cameraQuaternion)),i.domElement!==t&&(i.disconnect(),i.domElement=t,i.connect())})}show(){this.controls.forEach(e=>{const t=e.getHelper(),i=this.visibility.get(t.name);i!==void 0&&(t.visible=i)})}hide(){this.controls.forEach(e=>{const t=e.getHelper();this.visibility.set(t.name,t.visible),t.visible=!1})}setScene=()=>{this.clear()};static get instance(){return ne._instance||(ne._instance=new ne),ne._instance}}const dr=new o.BoxGeometry,ii=new o.Vector2;class hi extends o.Object3D{curve=new o.CatmullRomCurve3;line;draggable;curvePos;tension=.5;closed=!1;subdivide=50;curveType;offset=1;lineMaterial;_camera;_curvePercentage=0;_draggableScale=10;_transform;raycaster;draggedMat=new o.MeshBasicMaterial;parentGroup;group;constructor(e,t){const i=new o.Color(Be(.5,1,Math.random()),Be(.5,1,Math.random()),Be(.5,1,Math.random()));super(),this.name=e,this.lineMaterial=new o.LineBasicMaterial({color:i}),this.line=new o.Line(new o.BufferGeometry,this.lineMaterial),this.line.name="line",this.add(this.line),this._camera=t,this.curveType="catmullrom",this.draggedMat.color=i,this.draggable=new o.Object3D,this.draggable.name="draggablePoints",this.add(this.draggable),this.curvePos=new o.Mesh(new o.SphereGeometry(1.5),new o.MeshBasicMaterial({color:i})),this.curvePos.name="curvePos",this.curvePos.scale.setScalar(this._draggableScale),this.curvePos.visible=!1,this.add(this.curvePos),this.raycaster=new o.Raycaster,this.raycaster.params.Line.threshold=3,this.enable()}enable(){document.addEventListener("pointerdown",this.onMouseClick)}disable(){document.removeEventListener("pointerdown",this.onMouseClick)}dispose=()=>{this._transform&&(this._transform.removeEventListener("objectChange",this.updateSpline),ne.instance.remove(this.name)),this.disable(),this.parentGroup.removeGroup(this.name)};hideTransform=()=>{this._transform?.detach()};exportSpline=()=>{const e=[];this.draggable.children.forEach(t=>{e.push([pe(t.position.x,3),pe(t.position.y,3),pe(t.position.z,3)])}),ss({name:this.name,points:e,tension:this.tension,closed:this.closed,subdivide:this.subdivide,type:this.curveType}),console.log("Spline copied!")};showPoints=(e=!0)=>{this.draggable.visible=e};addPoints=(e=[])=>{if(e.length>0){const t=e.length-1;for(let i=0;i<t;i++)this.addPoint(e[i],!1);this.addPoint(e[t])}else this.addPoint(new o.Vector3(-50,0,0),!1),this.addPoint(new o.Vector3(50,0,0))};addPoint=(e,t=!0)=>{const i=this.draggable.children.length,n=new o.Mesh(dr,this.draggedMat);return n.name=`point_${i}`,n.position.copy(e),n.scale.setScalar(this._draggableScale),this.draggable.add(n),t&&this.updateSpline(),n};addNextPt=()=>{const e=this.draggable.children.length,t=new o.Vector3(Be(-this.offset,this.offset,Math.random()),Be(-this.offset,this.offset,Math.random()),Be(-this.offset,this.offset,Math.random()));e>0&&t.add(this.draggable.children[e-1].position);const i=this.addPoint(t);this._transform?.attach(i),this.group.current?.setField("Current Point",i.position)};removePoint=e=>{if(this._transform?.object===e){this._transform?.detach();const t=this.draggable.children[this.draggable.children.length-1];this._transform?.attach(t),this.group.current?.setField("Current Point",t.position)}Ee(e),this.updateSpline()};removePointAt=e=>{const t=this.draggable.children[e];this.removePoint(t)};removeSelectedPt=()=>{this._transform?.object!==void 0&&this.removePoint(this._transform?.object)};updateSpline=()=>{this.curve=new o.CatmullRomCurve3(this.points,this.closed,this.curveType,this.tension),this.line.geometry.setFromPoints(this.getPoints()),this.curvePos.position.copy(this.getPointAt(this._curvePercentage))};onMouseClick=e=>{if(!fe.instance||this._transform&&!this._transform.getHelper().visible)return;const i=fe.instance.currentWindow.current.getBoundingClientRect();ii.x=(e.clientX-i.x)/i.width*2-1,ii.y=-((e.clientY-i.y)/i.height)*2+1,this.raycaster.setFromCamera(ii,this.camera);const n=this.raycaster.intersectObjects(this.draggable.children,!1);if(n.length>0){const a=n[0].object;a!==this._transform?.object&&(this._transform?.attach(a),this.group.current?.setField("Current Point",a.position))}};getPointAt(e){return this.curve.getPointAt(e)}getPoints(){return this.curve.getPoints(this.subdivide)}getTangentAt(e){return this.curve.getTangentAt(e)}get points(){const e=[];return this.draggable.children.forEach(t=>{e.push(t.position)}),e}get total(){return this.draggable.children.length}get draggableScale(){return this._draggableScale}set draggableScale(e){this._draggableScale=e,this.draggable.children.forEach(t=>t.scale.setScalar(e)),this.curvePos.scale.setScalar(e)}get camera(){return this._camera}set camera(e){this._camera=e,this._transform!==void 0&&(this._transform.camera=e)}get curvePercentage(){return this._curvePercentage}set curvePercentage(e){this._curvePercentage=e,this.curvePos.position.copy(this.getPointAt(e))}onUpdateTransform=()=>{if(this._transform?.object&&this.group){const e=this._transform?.object;e.name.search("point")>-1&&this.group.current?.setField("Current Point",e.position)}this.updateSpline()};initDebug(e){const t=this.draggable.children;this.parentGroup=e,this._transform=ne.instance.add(this.name),this._transform.camera=this._camera,this._transform.addEventListener("objectChange",this.onUpdateTransform),this._transform.attach(t.length>0?t[t.length-1]:this),fe.instance?.scene.add(this._transform.getHelper());const i=t.length>0?t[t.length-1].position:{x:0,y:0,z:0};this.group=e.addGroup({title:this.name,items:[{prop:"Closed",type:"boolean",value:this.closed},{prop:"Visible",type:"boolean",value:this.visible},{prop:"Show Position",type:"boolean",value:this.curvePos.visible},{prop:"Show Points",type:"boolean",value:this.draggable.visible},{prop:"Color",type:"color",value:`#${this.draggedMat.color.getHexString()}`},{prop:"Curve",type:"option",options:[{title:"Catmullrom",value:"catmullrom"},{title:"Centripetal",value:"centripetal"},{title:"Chordal",value:"chordal"}]},{prop:"Draggable Scale",type:"range",min:.01,max:100,step:.01,value:this._draggableScale},{prop:"Subdivide",type:"range",min:1,max:100,step:1,value:this.subdivide},{prop:"Tension",type:"range",min:0,max:1,step:.01,value:this.tension},{prop:"New Pt Offset",type:"range",min:0,max:10,value:this.offset},{prop:"Curve At",type:"range",min:0,max:1,step:.01,value:0},{prop:"Toggle Transform",type:"button"},{prop:"Add Point",type:"button"},{prop:"Remove Point",type:"button"},{prop:"Export",type:"button"},{prop:"Delete",type:"button"},{prop:"Current Point",type:"grid3",value:i}],onUpdate:(n,a)=>{switch(n){case"Closed":this.closed=a,this.updateSpline();break;case"Visible":this.visible=a;break;case"Color":this.lineMaterial.color.setStyle(a),this.draggedMat.color.setStyle(a);break;case"Curve":this.curveType=a,this.updateSpline();break;case"Draggable Scale":this.draggableScale=a;break;case"Subdivide":this.subdivide=a,this.updateSpline();break;case"Tension":this.tension=a,this.updateSpline();break;case"New Pt Offset":this.offset=a;break;case"Curve At":this.curvePos.position.copy(this.getPointAt(a));break;case"Show Position":this.curvePos.visible=a;break;case"Show Points":this.draggable.visible=a;break;case"Toggle Transform":this._transform&&(this._transform.getHelper().visible=!this._transform.getHelper().visible);break;case"Add Point":this.addNextPt();break;case"Remove Point":this.removeSelectedPt();break;case"Export":this.exportSpline();break;case"Delete":Ee(this);break;case"Current Point":if(this.group.current&&this._transform?.object){const r=this._transform?.object;r.name.search("point")>-1&&(r.position.copy(a),this.updateSpline())}break}}}),this.draggable.children.forEach(n=>{this.debugPoint(n)})}debugPoint=e=>{e.name,e.visible=this.draggable.visible}}let Mt=0;class fs extends o.Object3D{defaultScale=10;_camera;group=null;constructor(e){super(),this.name="Spline Editor",this._camera=e,R.addEventListener(P.ADD_SPLINE,this.onAddSpline)}initDebug(){this.group=$.addEditorGroup({title:this.name,items:[{type:"button",prop:"New Spline"},{type:"boolean",prop:"Show Points",value:!0},{type:"boolean",prop:"Visible",value:this.visible},{type:"range",prop:"Default Scale",min:0,max:50,step:.01,value:this.defaultScale}],onUpdate:(e,t)=>{switch(e){case"New Spline":this.createSpline();break;case"Show Points":this.showPoints(t);break;case"Visible":this.visible=t;break;case"Default Scale":this.defaultScale=t;break}}})}dispose(){R.removeEventListener(P.ADD_SPLINE,this.onAddSpline),$.removeEditorGroup(this.name)}addSpline(e){e.draggableScale=this.defaultScale,e.hideTransform(),this.group?.current!==null&&e.initDebug(this.group.current),this.add(e)}createSpline=(e=[])=>{const t=`Spline ${Mt+1}`,i=new hi(t,this._camera);return i.addPoints(e),this.addSpline(i),Mt++,i};createSplineFromArray=e=>{const t=[];return e.forEach(i=>{t.push(new o.Vector3(i[0],i[1],i[2]))}),this.createSpline(t)};createSplineFromCatmullRom=e=>this.createSpline(e.points);createSplineFromJSON=e=>{const t=this.createSplineFromArray(e.points);return t.name=e.name,t.closed=e.closed,t.subdivide=e.subdivide,t.tension=e.tension,t.type=e.type,t.updateSpline(),t};showPoints=(e=!0)=>{this.children.forEach(t=>{t.showPoints(e)})};onAddSpline=e=>{const t=JSON.parse(e.value),i=`Spline ${Mt+1}`,n=[];t.points.forEach(r=>{n.push(new o.Vector3(r[0],r[1],r[2]))});const a=new hi(i,this.camera);a.addPoints(n),this.addSpline(a),Mt++};get camera(){return this._camera}set camera(e){this._camera=e,this.children.forEach(t=>{const i=t;i.camera=e})}}const es=["Single","Side by Side","Stacked","Quad"],ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAC60lEQVRYhe2YT4hNcRTHP48xpmYaNAvRyEQxEhnKQljYsRm9/EmSyJiMFAsMZWNhJYoNIUVJ2VGiyb9ZzIpMpkQSahbGv9GMYWrM+1rc2zjvzvvdd+99rzdvMd+6de75nd+5387vnN/v/G5KEuWMKRNNIB8mCRaKiiL5qQb2ApuBuUAV0Ad0AJeB3sSeJRX6LJbULTf6JTUn9Z+KWMUpPyp/Avoa4CNQZ3Sj/lNpdL/xottR7AjOkHRUUpekN5I6JbVLavDH75lIfZN0UFKTpCWS0pJem/HeJBEMG6yV1ONYtgFJbZJ+GF1jDh+zJb03NuliEuwMkMo4yErS2RA/LcbuYVyCrm1mA7Dal/8Cu4FG4JD/HsTTkCy6a+SVMTPQuc1sBKb78nHghi+/A+YBxwL2lbhRY+ThuARdEVxu5JdGFvACr0otdoZ8Y4+Rn0Sn5sFFsMvI6YB9MzA1YJ8mN8k1wAHzfj4uQVdyrpI0aJL7oqTtkq4FiqPLyCOSbktqlbRL0jlJQ2b8QdwCUZ4qvhRStZL0XFK1pMd57CRvq5mfhKBriRfiFUMY6oD7eOdwPlQAN4G10dfWg+uouwXsiOssAj4AC+JMcEWwvnAuOTEr7gTXPmg34zagOwkbIIOXAo9CbDYBrcBXYN+4UUdy2sRflyS5zVNlfPX7ugpJW5V9nI7mmh+lYU0lCZ2B3TOnAVuAk0BTwC5nuhWro46KauBOQJch5OpRaoIW34GreGf+YZdRqS9NAj4Bp4ClQDvwOWxCqSM4ADQEdKE5XvbXzlITrAVe4TW+M6NMKDXBFLAMuAD0ACfIc7pMZBXXA2cY3/xmodQRHAL2A2+NLtj8ZiEKwUL/z2WMPAJcAVYALWSf8dZuDFGWeBHwKxm3sWYhiGG8Tfo6sA2vSfiSy4GrH3wGrDcfKSSKKf6v1E9yF0XK9Q1XBPuMXMw8HXTonQFwETwNzMFr64v1jzgFHIk9ybHEZYPJo65QlD3Bf2/Q/eaHPiSWAAAAAElFTkSuQmCC",pr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAETklEQVRYhe2YXYhVVRTHf3d0/JhyUrMpFbImM+whSa3Mynww+4AeIgiKoozooQ+KyMyXIAujF6OXqHyI6iEKKYgIP/owsjSFqCkprdDUTEcjbWZ0HHV+Pex1ucfb9Z57Z9REXHA4Z++99l7/s/ZZ/7X2KaiczNLwfwPIk9MA+yunNMAG4DHgV+BvoB3YFff2TPstYEyfrajVroI6Sr1GvahsbJC63HzZq04pmztSvU5tVRuqYRiYg78JeBR4HPg5ntdmxovz9wJfA3uAxuibDLQCA+IqynnAQuBuYCnwMLC1rx48U12U8cZqdWqMDcx4cI16qTpYbVKHqa+ovWUeHKsujn7VL9ULq2HI+wY7gVeBJdGeFu3J4ZUiy/cAXeHRRuAQsC/GC0B3eG4BcH/0tUV7czUAeVsMsBF4Kha9HZgCvAncAuwPnXHA0wFuGLANuDrGuoGDwFxgTqzzQ7RX5FrP2eLsdb76vnogtme6+nE8H1YPlQXHwbi3q9eqn0e7Tb25VrsF68vFY0lb1AGcDTwItGQ8tQM4AIwGmqP/EPAu8A0wElgJfFGzxTo8mKWXu9Rd4ZF96jvqjSbauEC9Sn1O3R463epLaku99voCsFXdkAH3kNpcQW+IiT/bQne3eufxBtioPqP2mKhioXpWzpxb1T8C5Ifh4ZptVoriRmAIKdrI3Lujf3bobAPeJpF0NVkKrAFuI9HTOBIxnxFrF4OgQKKr/dnJlQA+AcwABgOHA4zAamA5cE7orQL+zAEHiWI+A2bFC7aSguheYCgpqAphZz3wSB7AecCICv2TgH8oFRib4gVqka0k0h8CXAxMBW6ooDejFoCvA9OBQUAvKWM0kDz4XUZvNKXtyZMWUl7vBbaQXq457PeEziDgx/KJlQAuIPFdMcEXv5OdYWBP9M8k8VpnDQCvB4aTSrCNJB5cSdrW3tBpIJVnR0qdUTxAfdGUOVTnmwqEanNmqltC/9OgqePKg5eom8PgdvW+oJ9Kupera0O3U50TL3lcAaI+oHaF4R3qa6Z822wq0Saq89T1lmSxOrxeW/Xm4uGkiqQDmECKuKHxHW0HdpMiewSpvGqKeR8Ay0iBsYIjg6261PE2o9Q3Yqv+MqWxO9R1Hl12qs+q49Vlppy82pSr+5xJKsko4AXgHlJ0t5NIeg3wLXAlqZhtIUV8J6nmWwX8QiLjdhL5TwMWkY4R6/rrwYKlMr1Y321QZ/vfwBijPqm+rF4Wc7PjE9QllurGVeoV5gRNHsAm9fnMom3qrKPoTjKdMXaYyrFygEWQ72XWW24qhPu8xcUc2UU6O8wFPjmK7jhgPHAuMJGUGQ6U6WwE5sfzTXGvei7KA9hFOiR9D/wOfFVFt4dS2tpfRe83Ur7/CPiJakfOGgBCypubatArl2r8VfOax/LfzABKtePAzHO/5FgC7KBEzB2kOrDfUm8mOeFySv9+OyFyGmB/5aQH+C9BVKmVCNuMZgAAAABJRU5ErkJggg==";class fe extends w.Component{static instance=null;scene=new o.Scene;renderer;currentScene;cameras=new Map;controls=new Map;currentCamera;currentWindow;cameraHelpers=new Map;lightHelpers=new Map;helpersContainer=new o.Group;grid=new $n;axisHelper=new o.AxesHelper(500);interactionHelper=new o.AxesHelper(100);currentTransform;splineEditor;depthMaterial=new o.MeshDepthMaterial;normalsMaterial=new o.MeshNormalMaterial;uvMaterial=new tr;wireframeMaterial=new o.MeshBasicMaterial({opacity:.33,transparent:!0,wireframe:!0});playing=!1;rafID=-1;cameraControlsRafID=-1;width=0;height=0;sceneSet=!1;tlCam=null;trCam=null;blCam=null;brCam=null;tlRender="Renderer";trRender="Renderer";blRender="Renderer";brRender="Renderer";cameraVisibility=!0;lightVisibility=!0;selectedItem=void 0;debugCamera;raycaster=new o.Raycaster;pointer=new o.Vector2;cameraControls=void 0;canvasRef;containerRef;tlWindow;trWindow;blWindow;brWindow;constructor(e){super(e),this.canvasRef=w.createRef(),this.containerRef=w.createRef(),this.tlWindow=w.createRef(),this.trWindow=w.createRef(),this.blWindow=w.createRef(),this.brWindow=w.createRef();const t=e.three.app.appID,i=localStorage,n=i.getItem(`${t}_mode`);this.state={mode:n!==null?n:"Single",modeOpen:!1,renderModeOpen:!1,interactionMode:"Orbit",interactionModeOpen:!1,lastUpdate:Date.now()},i.setItem(`${t}_mode`,this.state.mode),i.setItem(`${t}_tlCam`,i.getItem(`${t}_tlCam`)!==null?i.getItem(`${t}_tlCam`):"Debug"),i.setItem(`${t}_trCam`,i.getItem(`${t}_trCam`)!==null?i.getItem(`${t}_trCam`):"Orthographic"),i.setItem(`${t}_blCam`,i.getItem(`${t}_blCam`)!==null?i.getItem(`${t}_blCam`):"Front"),i.setItem(`${t}_brCam`,i.getItem(`${t}_brCam`)!==null?i.getItem(`${t}_brCam`):"Top"),i.setItem(`${t}_tlRender`,i.getItem(`${t}_tlRender`)!==null?i.getItem(`${t}_tlRender`):"Renderer"),i.setItem(`${t}_trRender`,i.getItem(`${t}_trRender`)!==null?i.getItem(`${t}_trRender`):"Renderer"),i.setItem(`${t}_blRender`,i.getItem(`${t}_blRender`)!==null?i.getItem(`${t}_blRender`):"Renderer"),i.setItem(`${t}_brRender`,i.getItem(`${t}_brRender`)!==null?i.getItem(`${t}_brRender`):"Renderer");const a={Vector2:o.Vector2,Vector3:o.Vector3,Vector4:o.Vector4,Quaternion:o.Quaternion,Matrix4:o.Matrix4,Spherical:o.Spherical,Box3:o.Box3,Sphere:o.Sphere,Raycaster:o.Raycaster};be.install({THREE:a}),this.setupScene(),this.setupTools();const r=localStorage.getItem(this.expandedCameraVisibility);this.cameraVisibility=r!==null?r==="open":!1,this.saveExpandedCameraVisibility();const l=localStorage.getItem(this.expandedLightVisibility);this.lightVisibility=l!==null?l==="open":!1,this.saveExpandedLightVisibility(),fe.instance=this}componentDidMount(){this.setupRenderer(),this.enable(),this.assignControls(),this.resize(),this.play(),ne.instance.three=this.props.three,ne.instance.activeCamera=this.debugCamera}componentDidUpdate(e,t,i){t.mode!==this.state.mode&&(this.assignControls(),this.resize())}componentWillUnmount(){this.disable()}render(){const e=[];return this.cameras.forEach((t,i)=>{e.push(i)}),u.jsxs("div",{className:"multiview",children:[u.jsx("canvas",{ref:this.canvasRef}),u.jsxs("div",{className:`cameras ${this.state.mode==="Single"||this.state.mode==="Stacked"?"single":""}`,ref:this.containerRef,children:[this.state.mode==="Single"&&u.jsx(u.Fragment,{children:u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}})}),(this.state.mode==="Side by Side"||this.state.mode==="Stacked")&&u.jsxs(u.Fragment,{children:[u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}}),u.jsx(Le,{name:"tr",camera:this.trCam,options:e,ref:this.trWindow,onSelectCamera:t=>{this.controls.get(this.trCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.trCam),this.trCam=i,localStorage.setItem(`${this.appID}_trCam`,i.name),this.createControls(i,this.trWindow.current))},onSelectRenderMode:t=>{this.trRender=t,localStorage.setItem(`${this.appID}_trRender`,t)}})]}),this.state.mode==="Quad"&&u.jsxs(u.Fragment,{children:[u.jsx(Le,{name:"tl",camera:this.tlCam,options:e,ref:this.tlWindow,onSelectCamera:t=>{this.controls.get(this.tlCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.tlCam),this.tlCam=i,localStorage.setItem(`${this.appID}_tlCam`,i.name),this.createControls(i,this.tlWindow.current))},onSelectRenderMode:t=>{this.tlRender=t,localStorage.setItem(`${this.appID}_tlRender`,t)}}),u.jsx(Le,{name:"tr",camera:this.trCam,options:e,ref:this.trWindow,onSelectCamera:t=>{this.controls.get(this.trCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.trCam),this.trCam=i,localStorage.setItem(`${this.appID}_trCam`,i.name),this.createControls(i,this.trWindow.current))},onSelectRenderMode:t=>{this.trRender=t,localStorage.setItem(`${this.appID}_trRender`,t)}}),u.jsx(Le,{name:"bl",camera:this.blCam,options:e,ref:this.blWindow,onSelectCamera:t=>{this.controls.get(this.blCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.blCam),this.blCam=i,localStorage.setItem(`${this.appID}_blCam`,i.name),this.createControls(i,this.blWindow.current))},onSelectRenderMode:t=>{this.blRender=t,localStorage.setItem(`${this.appID}_blRender`,t)}}),u.jsx(Le,{name:"br",camera:this.brCam,options:e,ref:this.brWindow,onSelectCamera:t=>{this.controls.get(this.brCam.name)?.dispose();const i=this.cameras.get(t);i!==void 0&&(this.clearCamera(this.brCam),this.brCam=i,localStorage.setItem(`${this.appID}_brCam`,i.name),this.createControls(i,this.brWindow.current))},onSelectRenderMode:t=>{this.brRender=t,localStorage.setItem(`${this.appID}_brRender`,t)}})]})]}),u.jsxs("div",{className:"settings",children:[u.jsx(It,{title:"View",index:es.indexOf(this.state.mode),options:es,onSelect:t=>{t!==this.state.mode&&(this.killControls(),this.setState({mode:t}),localStorage.setItem(`${this.appID}_mode`,t))},open:this.state.modeOpen,onToggle:t=>{this.setState({modeOpen:t,renderModeOpen:!1,interactionModeOpen:!1})}}),u.jsx(It,{title:"Interact",index:this.state.interactionMode==="Orbit"?0:1,options:["Orbit Mode","Selection Mode"],onSelect:t=>{this.interactionHelper.visible=t==="Selection Mode",this.setState({interactionMode:this.interactionHelper.visible?"Selection":"Orbit"})},open:this.state.interactionModeOpen,onToggle:t=>{this.setState({modeOpen:!1,renderModeOpen:!1,interactionModeOpen:t})}}),u.jsx(Zi,{name:"cameraHelper",icon:ur,selected:this.cameraVisibility,height:24,top:2,onClick:t=>{if(this.cameraVisibility=t,this.saveExpandedCameraVisibility(),this.cameraHelpers.forEach(i=>{i.visible=t}),this.selectedItem!==void 0&&!t&&this.selectedItem instanceof o.PerspectiveCamera){const i=this.cameraHelpers.get(this.selectedItem.name);i!==void 0&&(i.visible=!0)}}}),u.jsx(Zi,{name:"lightHelper",icon:pr,selected:this.lightVisibility,height:24,top:4,onClick:t=>{if(this.lightVisibility=t,this.saveExpandedLightVisibility(),this.lightHelpers.forEach(i=>{i.visible=t}),this.selectedItem!==void 0&&!t&&this.selectedItem.isLight===!0){const i=this.lightHelpers.get(this.selectedItem.name);i!==void 0&&(i.visible=!0)}}})]},this.state.lastUpdate)]})}setupRenderer(){this.renderer=new o.WebGLRenderer({canvas:this.canvasRef.current,stencil:!1}),this.renderer.autoClear=!1,this.renderer.shadowMap.enabled=!0,this.renderer.setPixelRatio(devicePixelRatio),this.renderer.setClearColor(0),this.props.three.renderer=this.renderer}setupScene(){this.scene.name="Debug Scene",this.scene.uuid="",this.helpersContainer.name="helpers",this.scene.add(this.helpersContainer),this.helpersContainer.add(this.grid),this.axisHelper.name="axisHelper",this.helpersContainer.add(this.axisHelper),this.interactionHelper.name="interactionHelper",this.helpersContainer.add(this.interactionHelper),this.interactionHelper.visible=!1;const e=(n,a)=>{const r=new o.OrthographicCamera(-100,100,100,-100,50,5e3);return r.name=n,r.position.copy(a),r.lookAt(0,0,0),this.cameras.set(n,r),r};e("Top",new o.Vector3(0,1e3,0)),e("Bottom",new o.Vector3(0,-1e3,0)),e("Left",new o.Vector3(-1e3,0,0)),e("Right",new o.Vector3(1e3,0,0)),e("Front",new o.Vector3(0,0,1e3)),e("Back",new o.Vector3(0,0,-1e3)),e("Orthographic",new o.Vector3(1e3,1e3,1e3)),e("UI",new o.Vector3),this.debugCamera=new o.PerspectiveCamera(60,1,50,5e3),this.debugCamera.name="Debug",this.debugCamera.position.set(500,500,500),this.debugCamera.lookAt(0,0,0),this.cameras.set("Debug",this.debugCamera),this.currentCamera=this.debugCamera;const t=localStorage,i=this.props.three.app.appID;this.tlCam=this.cameras.get(t.getItem(`${i}_tlCam`)),this.trCam=this.cameras.get(t.getItem(`${i}_trCam`)),this.blCam=this.cameras.get(t.getItem(`${i}_blCam`)),this.brCam=this.cameras.get(t.getItem(`${i}_brCam`)),this.tlCam===void 0&&(this.tlCam=this.cameras.get("Debug")),this.trCam===void 0&&(this.trCam=this.cameras.get("Orthographic")),this.blCam===void 0&&(this.blCam=this.cameras.get("Front")),this.brCam===void 0&&(this.brCam=this.cameras.get("Top"))}setupTools(){this.splineEditor=new fs(this.currentCamera),this.splineEditor.initDebug(),this.scene.add(this.splineEditor)}play(){this.playing=!0,this.onUpdate()}pause(){this.playing=!1,cancelAnimationFrame(this.rafID),this.rafID=-1}toggleOrbitControls(e){this.controls.forEach(t=>{t.enabled=!e})}update(){this.controls.forEach(e=>{e.update()}),this.cameraHelpers.forEach(e=>{e.update()}),this.lightHelpers.forEach(e=>{e.update!==void 0&&e.update()}),this.props.onSceneUpdate!==void 0&&this.sceneSet&&this.props.onSceneUpdate(this.currentScene)}draw(){switch(this.renderer?.clear(),this.state.mode){case"Single":this.drawSingle();break;case"Side by Side":case"Stacked":this.drawDouble();break;case"Quad":this.drawQuad();break}}onUpdate=()=>{this.playing&&(this.update(),this.draw(),this.rafID=requestAnimationFrame(this.onUpdate))};enable(){const e=this.containerRef.current;e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("click",this.onClick),window.addEventListener("keydown",this.onKey),window.addEventListener("resize",this.resize),R.addEventListener(P.SET_SCENE,this.sceneUpdate),R.addEventListener(P.ADD_CAMERA,this.addCamera),R.addEventListener(P.REMOVE_CAMERA,this.removeCamera),R.addEventListener(P.SET_OBJECT,this.onSetSelectedItem)}disable(){const e=this.containerRef.current;e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("click",this.onClick),window.removeEventListener("keydown",this.onKey),window.removeEventListener("resize",this.resize),R.removeEventListener(P.SET_SCENE,this.sceneUpdate),R.removeEventListener(P.ADD_CAMERA,this.addCamera),R.removeEventListener(P.REMOVE_CAMERA,this.removeCamera),R.removeEventListener(P.SET_OBJECT,this.onSetSelectedItem)}resize=()=>{this.width=window.innerWidth-300,this.height=window.innerHeight;const e=Math.floor(this.width/2),t=Math.floor(this.height/2);this.props.three.resize(this.width,this.height),this.props.onSceneResize!==void 0&&this.sceneSet&&this.currentScene!==void 0&&this.props.onSceneResize(this.currentScene,this.width,this.height);let i=this.width,n=this.height;switch(this.state.mode){case"Side by Side":i=e,n=this.height;break;case"Stacked":i=this.width,n=t;break;case"Quad":i=e,n=t;break}const a=i/n;this.cameras.forEach(r=>{r instanceof o.OrthographicCamera?(r.left=i/-2,r.right=i/2,r.top=n/2,r.bottom=n/-2,r.name==="UI"&&(r.position.x=this.width/2,r.position.y=this.height/-2,r.position.z=100),r.updateProjectionMatrix()):r instanceof o.PerspectiveCamera&&(r.aspect=a,r.updateProjectionMatrix(),this.cameraHelpers.get(r.name)?.update())})};sceneUpdate=e=>{this.helpersContainer.add(this.axisHelper),this.clearLightHelpers(),this.scene.remove(this.currentScene),Ee(this.currentScene);const t=this.props.scenes.get(e.value.name);if(t!==void 0){const i=new t;this.props.onSceneSet!==void 0&&this.props.onSceneSet(i),this.currentScene=i,this.props.three.scene=this.currentScene,this.scene.add(this.currentScene),this.sceneSet=!0,this.addLightHelpers()}};addCamera=e=>{const t=e.value,i=this.props.three.scene?.getObjectByProperty("uuid",t.uuid);if(i!==void 0&&this.cameras.set(t.name,i),i instanceof o.PerspectiveCamera){const n=new o.CameraHelper(i);n.visible=this.cameraVisibility,this.cameraHelpers.set(i.name,n),this.scene.add(n)}this.setState({lastUpdate:Date.now()})};removeCamera=e=>{const t=this.cameraHelpers.get(e.value.name);t!==void 0&&(this.scene.remove(t),t.dispose()),this.cameras.delete(e.value.name),this.setState({lastUpdate:Date.now()})};onMouseMove=e=>{const t=new o.Vector2;this.renderer.getSize(t);const i=Math.min(e.clientX,t.x),n=Math.min(e.clientY,t.y);this.pointer.x=Ve(i,0,t.x,-1,1),this.pointer.y=Ve(n,0,t.y,1,-1);const a=t.x/2,r=t.y/2,l=()=>{i<a?this.pointer.x=Ve(i,0,a,-1,1):this.pointer.x=Ve(i,a,t.x,-1,1)},h=()=>{n<r?this.pointer.y=Ve(n,0,r,1,-1):this.pointer.y=Ve(n,r,t.y,1,-1)};switch(this.state.mode){case"Quad":l(),h();break;case"Side by Side":l();break;case"Stacked":h(),h();break}if(this.updateCamera(i,n,a,r),this.state.interactionMode==="Orbit")return;const c=this.raycaster.intersectObjects(this.currentScene.children);c.length>0&&this.interactionHelper.position.copy(c[0].point)};onClick=e=>{if(this.state.interactionMode==="Orbit")return;const t=new o.Vector2;if(this.renderer.getSize(t),e.clientX>=t.x)return;this.onMouseMove(e);const i=this.raycaster.intersectObjects(this.currentScene.children);i.length>0&&(this.props.three.getObject(i[0].object.uuid),this.interactionHelper.visible=!1,this.setState({interactionMode:"Orbit",lastUpdate:Date.now()}))};onKey=e=>{if(this.selectedItem!==void 0){if(e.ctrlKey){if(this.currentCamera.name==="UI")return;const t=this.controls.get(this.currentCamera.name);e.key==="0"?(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.selectedItem instanceof o.Mesh||this.selectedItem instanceof o.SkinnedMesh?(this.selectedItem.geometry.computeBoundingBox(),this.cameraControls.fitToBox(this.selectedItem.geometry.boundingBox,!0)):this.cameraControls.fitToSphere(this.selectedItem,!0),this.updateCameraControls(t,!0)):e.key==="1"?(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(0,Math.PI*.5,!0),this.cameraControls.moveTo(this.selectedItem.position.x,this.selectedItem.position.y,0,!0),this.updateCameraControls(t)):e.key==="2"?(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(0,0,!0),this.cameraControls.moveTo(this.selectedItem.position.x,0,this.selectedItem.position.z,!0),this.updateCameraControls(t)):e.key==="3"?(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(Math.PI/2,Math.PI/2,!0),this.cameraControls.moveTo(0,this.selectedItem.position.y,this.selectedItem.position.z,!0),this.updateCameraControls(t)):e.key==="4"?(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(Math.PI,Math.PI/2,!0),this.cameraControls.moveTo(this.selectedItem.position.x,this.selectedItem.position.y,0,!0),this.updateCameraControls(t)):e.key==="5"&&(e.preventDefault(),this.clearControls(),this.cameraControls=new be(this.currentCamera,this.currentWindow.current),this.cameraControls.rotateTo(li(45),li(45),!0),this.updateCameraControls(t))}else if(this.currentTransform!==void 0)switch(e.key){case"r":this.currentTransform.setMode("rotate");break;case"s":this.currentTransform.setMode("scale");break;case"t":this.currentTransform.setMode("translate");break;case"q":this.currentTransform.setSpace(this.currentTransform.space==="local"?"world":"local");break}}};onSetSelectedItem=e=>{this.selectedItem!==void 0&&this.updateSelectedItemHelper(!1),this.selectedItem=this.currentScene.getObjectByProperty("uuid",e.value.uuid),this.selectedItem!==void 0&&(this.currentTransform!==void 0&&(this.currentTransform.removeEventListener("objectChange",this.onUpdateTransform),ne.instance.remove(this.currentTransform.getHelper().name)),this.currentTransform=ne.instance.add(e.value.name),this.currentTransform.attach(this.selectedItem),this.scene.add(this.currentTransform.getHelper()),this.currentTransform.addEventListener("objectChange",this.onUpdateTransform),this.updateSelectedItemHelper(!0))};updateSelectedItemHelper(e){if(this.selectedItem!==void 0){if(this.selectedItem instanceof o.PerspectiveCamera&&!this.cameraVisibility){const t=this.cameraHelpers.get(this.selectedItem.name);t!==void 0&&(t.visible=e)}else if(this.selectedItem.isLight===!0&&!this.lightVisibility){const t=this.lightHelpers.get(this.selectedItem.name);t!==void 0&&(t.visible=e)}}}onUpdateTransform=()=>{this.selectedItem!==void 0&&(this.props.three.updateObject(this.selectedItem.uuid,"position",this.selectedItem.position),this.props.three.updateObject(this.selectedItem.uuid,"rotation",{x:this.selectedItem.rotation.x,y:this.selectedItem.rotation.y,z:this.selectedItem.rotation.z}),this.props.three.updateObject(this.selectedItem.uuid,"scale",this.selectedItem.scale),Ut.instance.update())};clearLightHelpers=()=>{this.lightHelpers.forEach(e=>{this.helpersContainer.remove(e),e.dispose()}),this.lightHelpers.clear()};addLightHelpers=()=>{this.currentScene!==void 0&&this.currentScene.traverse(e=>{if(e.type.search("Light")>-1){let t;switch(e.type){case"DirectionalLight":t=new o.DirectionalLightHelper(e,100),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"HemisphereLight":t=new o.HemisphereLightHelper(e,250),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"RectAreaLight":t=new In(e),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"PointLight":t=new o.PointLightHelper(e,100),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break;case"SpotLight":t=new o.SpotLightHelper(e),t.name=`${e.name}Helper`,t.visible=this.lightVisibility,this.lightHelpers.set(e.name,t),this.helpersContainer.add(t);break}}})};createControls(e,t){const i=this.controls.get(e.name);if(i!==void 0&&i.dispose(),this.controls.delete(e.name),e.name==="UI")return;const n=new kn(e,t);switch(n.enableDamping=!0,n.dampingFactor=.05,e.name){case"Top":case"Bottom":case"Left":case"Right":case"Front":case"Back":n.enableRotate=!1;break}this.controls.set(e.name,n)}clearCamera(e){const t=this.cameraHelpers.get(e.name);t!==void 0&&(this.scene.remove(t),t.dispose(),this.cameraHelpers.delete(e.name));const i=this.controls.get(e.name);i!==void 0&&(i.dispose(),this.controls.delete(e.name))}killControls(){this.controls.forEach((e,t)=>{e.dispose();const i=this.cameraHelpers.get(t);i!==void 0&&(this.scene.remove(i),i.dispose()),this.cameraHelpers.delete(t),this.controls.delete(t)}),this.controls.clear(),this.cameraHelpers.clear()}assignControls(){switch(this.state.mode){case"Single":this.createControls(this.tlCam,this.tlWindow.current);break;case"Side by Side":case"Stacked":this.createControls(this.tlCam,this.tlWindow.current),this.createControls(this.trCam,this.trWindow.current);break;case"Quad":this.createControls(this.tlCam,this.tlWindow.current),this.createControls(this.trCam,this.trWindow.current),this.createControls(this.blCam,this.blWindow.current),this.createControls(this.brCam,this.brWindow.current);break}}updateCamera=(e,t,i,n)=>{switch(this.state.mode){case"Quad":t<n?e<i?this.currentCamera=this.tlCam:this.currentCamera=this.trCam:e<i?this.currentCamera=this.blCam:this.currentCamera=this.brCam;break;case"Side by Side":e<i?this.currentCamera=this.tlCam:this.currentCamera=this.trCam;break;case"Single":this.currentCamera=this.tlCam;break;case"Stacked":t<n?this.currentCamera=this.tlCam:this.currentCamera=this.trCam;break}this.splineEditor.camera=this.currentCamera,this.raycaster.setFromCamera(this.pointer,this.currentCamera),this.currentCamera===this.tlCam?this.currentWindow=this.tlWindow:this.currentCamera===this.trCam?this.currentWindow=this.trWindow:this.currentCamera===this.blCam?this.currentWindow=this.blWindow:this.currentCamera===this.brCam&&(this.currentWindow=this.brWindow),ne.instance.updateCamera(this.currentCamera,this.currentWindow.current)};updateCameraControls=(e,t=!1)=>{if(this.selectedItem===void 0)return;cancelAnimationFrame(this.cameraControlsRafID),this.cameraControlsRafID=-1,this.cameraControls&&(this.cameraControls.smoothTime=.1);const i=.15,n=new o.Clock;n.start(),this.selectedItem.getWorldPosition(e.target0);const a=()=>{const r=n.getDelta();this.cameraControls&&this.cameraControls.update(r),t&&(e.target.lerp(e.target0,i),e.object.position.lerp(e.position0,i),e.object.zoom=Rt(e.object.zoom,e.zoom0,i),e.object.updateProjectionMatrix(),e.dispatchEvent({type:"change"})),n.getElapsedTime()>=.5?(cancelAnimationFrame(this.cameraControlsRafID),this.cameraControlsRafID=-1,this.clearControls()):this.cameraControlsRafID=requestAnimationFrame(a)};a()};clearControls=()=>{this.cameraControls!==void 0&&(this.cameraControls.disconnect(),this.cameraControls.dispose(),this.cameraControls=void 0)};saveExpandedCameraVisibility(){localStorage.setItem(this.expandedCameraVisibility,this.cameraVisibility?"open":"closed")}saveExpandedLightVisibility(){localStorage.setItem(this.expandedLightVisibility,this.lightVisibility?"open":"closed")}getSceneOverride(e){switch(e){case"Depth":return this.depthMaterial;case"Normals":return this.normalsMaterial;case"Renderer":return null;case"UVs":return this.uvMaterial;case"Wireframe":return this.wireframeMaterial}return null}drawSingle(){const e=this.getSceneOverride(this.tlRender);this.scene.overrideMaterial=e,this.renderer?.setViewport(0,0,this.width,this.height),this.renderer?.setScissor(0,0,this.width,this.height),this.renderer?.render(this.scene,this.tlCam)}drawDouble=()=>{const e=this.getSceneOverride(this.tlRender),t=this.getSceneOverride(this.trRender),i=Math.floor(this.width/2),n=Math.floor(this.height/2);if(this.scene.overrideMaterial=e,this.state.mode==="Side by Side")this.renderer?.setViewport(0,0,i,this.height),this.renderer?.setScissor(0,0,i,this.height),this.renderer?.render(this.scene,this.tlCam),this.scene.overrideMaterial=t,this.renderer?.setViewport(i,0,i,this.height),this.renderer?.setScissor(i,0,i,this.height),this.renderer?.render(this.scene,this.trCam);else{const a=this.height-n;this.renderer?.setViewport(0,a,this.width,n),this.renderer?.setScissor(0,a,this.width,n),this.renderer?.render(this.scene,this.tlCam),this.scene.overrideMaterial=t,this.renderer?.setViewport(0,0,this.width,n),this.renderer?.setScissor(0,0,this.width,n),this.renderer?.render(this.scene,this.trCam)}};drawQuad=()=>{const e=this.getSceneOverride(this.tlRender),t=this.getSceneOverride(this.trRender),i=this.getSceneOverride(this.blRender),n=this.getSceneOverride(this.brRender),a=Math.floor(this.width/2),r=Math.floor(this.height/2);let l=0,h=0;h=this.height-r,l=0,this.scene.overrideMaterial=e,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.tlCam),l=a,this.scene.overrideMaterial=t,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.trCam),h=0,l=0,this.scene.overrideMaterial=i,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.blCam),l=a,this.scene.overrideMaterial=n,this.renderer?.setViewport(l,h,a,r),this.renderer?.setScissor(l,h,a,r),this.renderer?.render(this.scene,this.brCam)};get appID(){return this.props.three.app.appID}get mode(){return this.state.mode}get three(){return this.props.three}get expandedCameraVisibility(){return`${this.appID}_multiviewCameraVisibility`}get expandedLightVisibility(){return`${this.appID}_multiviewLightVisibility`}}class Ut extends w.Component{static instance;matrix=new o.Matrix4;position=new o.Vector3;rotation=new o.Euler;scale=new o.Vector3;open=!1;constructor(e){super(e);const t=localStorage.getItem(this.expandedName),i=t!==null?t==="open":!1;this.open=i,this.saveExpanded(),this.state={lastUpdated:0,expanded:i},this.matrix.elements=e.object.matrix,e.object.uuid.length>0&&(this.position.setFromMatrixPosition(this.matrix),this.rotation.setFromRotationMatrix(this.matrix),this.scale.setFromMatrixScale(this.matrix)),Ut.instance=this}update(){if(fe.instance){const e=fe.instance.selectedItem;if(e===void 0)return;this.position.x=pe(e.position.x,3),this.position.y=pe(e.position.y,3),this.position.z=pe(e.position.z,3),this.rotation.copy(e.rotation),this.scale.x=pe(e.scale.x,3),this.scale.y=pe(e.scale.y,3),this.scale.z=pe(e.scale.z,3),this.setState({lastUpdated:Date.now()})}}render(){return u.jsx(ge,{title:"Transform",expanded:this.open,items:[{title:"Position",prop:"position",type:"grid3",step:.1,value:this.position,onChange:this.updateTransform},{title:"Rotation",prop:"rotation",type:"euler",value:this.rotation,onChange:this.updateTransform},{title:"Scale",prop:"scale",type:"grid3",value:this.scale,onChange:this.updateTransform},{title:"Visible",prop:"visible",type:"boolean",value:this.props.object.visible,onChange:this.updateTransform}],onToggle:e=>{this.open=e,this.saveExpanded()}},this.state.lastUpdated)}updateTransform=(e,t)=>{const i=e==="rotation"?{x:t._x,y:t._y,z:t._z}:t;this.props.three.updateObject(this.props.object.uuid,e,i);const n=this.props.three.getScene(this.props.object.uuid);if(n){const a=n.getObjectByProperty("uuid",this.props.object.uuid);q(a,e,i)}};saveExpanded(){localStorage.setItem(this.expandedName,this.open?"open":"closed")}get expandedName(){return`${this.props.three.app.appID}_transform`}}function ts(s){switch(s){case"color":return"Color";case"intensity":return"Intensity";case"decay":return"Decay";case"distance":return"Distance";case"angle":return"Angle";case"penumbra":return"Penumbra";case"groundColor":return"Ground Color";case"width":return"Width";case"height":return"Height"}return s}function mr(s,e){function t(){return`${e.app.appID}_light`}const i=localStorage.getItem(t()),n=i!==null?i==="open":!1;function a(l){localStorage.setItem(t(),l?"open":"closed")}const r=[];if(s.lightInfo!==void 0)for(const l in s.lightInfo){const h=s.lightInfo[l];h!==void 0&&(h.isColor!==void 0?r.push({title:ts(l),prop:l,type:"color",value:h,onChange:(c,p)=>{const m=new o.Color(p);e.updateObject(s.uuid,c,m);const f=e.getScene(s.uuid);if(f!==null){const y=f.getObjectByProperty("uuid",s.uuid);q(y,c,m)}}}):r.push({title:ts(l),prop:l,type:typeof h,value:h,step:typeof h=="number"?.01:void 0,onChange:(c,p)=>{e.updateObject(s.uuid,c,p);const m=e.getScene(s.uuid);if(m!==null){const f=m.getObjectByProperty("uuid",s.uuid);q(f,c,p)}}}))}return u.jsx(ge,{title:"Light",items:r,expanded:n,onToggle:l=>{a(l)}})}function fr(s){const e=s.object,t=s.three;function i(){return`${t.app.appID}_animation`}const n=localStorage.getItem(i()),a=n!==null?n==="open":!1;function r(f){localStorage.setItem(i(),f?"open":"closed")}const l=[],h=[];let c=0;e.animations.forEach(f=>{c=Math.max(c,f.duration),f.duration>0&&h.push({title:f.name,items:[{title:"Duration",type:"number",value:f.duration,disabled:!0},{title:"Blend Mode",type:"option",disabled:!0,options:[{title:"Normal",value:2500},{title:"Additive",value:2501}]}]})}),l.push({title:"Animations",items:h});let p;const m=t.getScene(e.uuid);if(m!==null){const f=m.getObjectByProperty("uuid",e.uuid);if(f!==void 0){const y=f.mixer;if(y!==void 0){const O=[{title:"Time Scale",type:"range",value:y.timeScale,step:.01,min:-1,max:2,onChange:(M,_)=>{y.timeScale=_,t.updateObject(e.uuid,"mixer.timeScale",_)}}];O.push({title:"Stop All",type:"button",onChange:()=>{y.stopAllAction(),t.requestMethod(e.uuid,"stopAllAction",void 0,"mixer")}}),l.push({title:"Mixer",items:O}),p=new o.SkeletonHelper(f),fe.instance?.scene.add(p)}}}return w.useEffect(()=>()=>{p!==void 0&&Ee(p)},[]),u.jsx(ge,{title:"Animation",items:l,expanded:a,onToggle:f=>{r(f)}})}const di={name:"",uuid:"",type:"",visible:!1,matrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],animations:[],material:void 0,perspectiveCameraInfo:void 0,orthographicCameraInfo:void 0,lightInfo:void 0,children:[]};let ie={...di};function gs(s){const[e,t]=w.useState(-1);w.useEffect(()=>{function r(h){ie={...h.value},t(Date.now())}function l(){ie={...di},t(Date.now())}return R.addEventListener(P.SET_SCENE,l),R.addEventListener(P.SET_OBJECT,r),()=>{R.removeEventListener(P.SET_SCENE,l),R.removeEventListener(P.SET_OBJECT,r)}},[]);const i=ie.type.toLowerCase(),n=ie.animations.length>0||ie.mixer!==void 0,a=i.search("mesh")>-1||i.search("line")>-1||i.search("points")>-1;return u.jsx(ut,{label:"Inspector",button:ie.uuid.length>0?u.jsx("button",{className:"remove",onClick:()=>{ne.instance.remove(ie.name),ie={...di},t(Date.now())}}):void 0,children:u.jsx("div",{id:"Inspector",className:s.class,children:ie.uuid.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(u.Fragment,{children:[u.jsx(Pt,{type:"string",title:"Name",prop:"name",value:ie.name,disabled:!0}),u.jsx(Pt,{type:"string",title:"Type",prop:"type",value:ie.type,disabled:!0}),u.jsx(Pt,{type:"string",title:"UUID",prop:"uuid",value:ie.uuid,disabled:!0})]}),u.jsxs(u.Fragment,{children:[u.jsx(Ut,{object:ie,three:s.three}),n?u.jsx(fr,{object:ie,three:s.three}):null,i.search("camera")>-1?Dn(ie,s.three):null,i.search("light")>-1?mr(ie,s.three):null,a?Pn(ie,s.three):null]})]})},e)},"Inspector")}function _s(s){const[e]=w.useState([]),[t]=w.useState([]),[i,n]=w.useState(0),a=h=>{const c=h.value;e.push(c),t.push(u.jsx(ut,{label:`Scene: ${c.name}`,scene:c,open:!0,onRefresh:()=>{s.three.refreshScene(c.name)},children:u.jsx(oi,{child:c,scene:c,three:s.three})},Math.random())),n(Date.now())},r=h=>{const c=h.value;for(let p=0;p<e.length;p++)if(c.uuid===e[p].uuid){e[p]=c,t[p]=u.jsx(ut,{label:`Scene: ${c.name}`,scene:c,open:!0,onRefresh:()=>{s.three.refreshScene(c.name)},children:u.jsx(oi,{child:c,scene:c,three:s.three})},Math.random()),n(Date.now());return}},l=h=>{const c=h.value;for(let p=0;p<e.length;p++)if(c.uuid===e[p].uuid){e.splice(p,1),t.splice(p,1),n(Date.now());return}};return w.useEffect(()=>(R.addEventListener(P.ADD_SCENE,a),R.addEventListener(P.REFRESH_SCENE,r),R.addEventListener(P.REMOVE_SCENE,l),()=>{R.removeEventListener(P.ADD_SCENE,a),R.removeEventListener(P.REFRESH_SCENE,r),R.removeEventListener(P.REMOVE_SCENE,l)}),[]),u.jsxs("div",{id:"SidePanel",children:[u.jsx("div",{className:"scenes",children:t},i),u.jsx(gs,{three:s.three}),u.jsx($,{three:s.three})]})}function gr(s){return w.useEffect(()=>{function e(l){let h=null;return s.three.scenes.forEach(c=>{l.search(c.uuid)>-1&&(h=c)}),h}const t=l=>{const h=l.value,p=e(h)?.getObjectByProperty("uuid",h);p!==void 0&&s.three.setObject(p)},i=(l,h,c)=>{const m=e(l)?.getObjectByProperty("uuid",l);m!==void 0&&q(m,h,c)},n=l=>{const h=l.value,{key:c,value:p,uuid:m}=h;i(m,c,p)},a=l=>{const h=l.value,p=e(h.uuid)?.getObjectByProperty("uuid",h.uuid);if(p!==void 0){const m=f=>{const y=h.key.split(".");switch(y.length){case 1:p[y[0]]=f;break;case 2:p[y[0]][y[1]]=f;break;case 3:p[y[0]][y[1]][y[2]]=f;break;case 4:p[y[0]][y[1]][y[2]][y[3]]=f;break;case 5:p[y[0]][y[1]][y[2]][y[3]][y[4]]=f;break}p.material.needsUpdate=!0};h.value.src.length>0?os(h.value.src).then(f=>{f.offset.set(h.value.offset[0],h.value.offset[1]),f.repeat.set(h.value.repeat[0],h.value.repeat[1]),m(f)}):m(null)}},r=l=>{const{key:h,uuid:c,value:p,subitem:m}=l.value,y=e(c)?.getObjectByProperty("uuid",c);if(y!==void 0)try{m!==void 0?en(y,m)[h](p):y[h](p)}catch(x){console.log("Error requesting method:"),console.log(x),console.log(h),console.log(p)}};return R.addEventListener(P.GET_OBJECT,t),R.addEventListener(P.UPDATE_OBJECT,n),R.addEventListener(P.CREATE_TEXTURE,a),R.addEventListener(P.REQUEST_METHOD,r),()=>{R.removeEventListener(P.GET_OBJECT,t),R.removeEventListener(P.UPDATE_OBJECT,n),R.removeEventListener(P.CREATE_TEXTURE,a),R.removeEventListener(P.REQUEST_METHOD,r)}},[]),null}function ys(s){return u.jsxs("div",{className:"editor",ref:s.ref,style:s.style,children:[u.jsx("div",{className:"header",children:s.header}),s.children,u.jsx("div",{className:"footer",children:s.footer})]})}function _r(s){return u.jsx(ys,{children:u.jsxs(u.Fragment,{children:[u.jsx(fe,{three:s.three,scenes:s.scenes,onSceneResize:s.onSceneResize,onSceneSet:s.onSceneSet,onSceneUpdate:s.onSceneUpdate}),u.jsx(_s,{three:s.three})]})})}exports.Accordion=ut;exports.Application=Zs;exports.BaseRemote=Lt;exports.ChildObject=mi;exports.ContainerObject=oi;exports.Draggable=cs;exports.DraggableItem=ls;exports.Dropdown=hs;exports.DropdownItem=ds;exports.Editor=ys;exports.ExportTexture=ht;exports.Inspector=gs;exports.MultiView=fe;exports.NavButton=pi;exports.RemoteComponents=Ws;exports.RemoteController=ln;exports.RemoteTheatre=qs;exports.RemoteThree=sn;exports.SceneInspector=gr;exports.SidePanel=_s;exports.Spline=hi;exports.SplineEditor=fs;exports.ThreeEditor=_r;exports.ToolEvents=P;exports.Transform=ne;exports.capitalize=dt;exports.clamp=Te;exports.colorToHex=ni;exports.copyToClipboard=ss;exports.customizeTheatreElements=Qs;exports.debugDispatcher=R;exports.defaultTheatreCallback=Bs;exports.dispose=Ee;exports.disposeMaterial=as;exports.disposeTexture=Gs;exports.distance=Ys;exports.hierarchyUUID=Dt;exports.isColor=rs;exports.mix=Rt;exports.noop=ui;exports.normalize=si;exports.randomID=ns;exports.resetThreeObjects=ri;exports.round=pe;exports.theatreEditorApp=Xs;
package/dist/hermes.es.js CHANGED
@@ -6544,6 +6544,7 @@ class Te extends ei {
6544
6544
  // Playback
6545
6545
  playing = !1;
6546
6546
  rafID = -1;
6547
+ cameraControlsRafID = -1;
6547
6548
  width = 0;
6548
6549
  height = 0;
6549
6550
  // Windows
@@ -6971,7 +6972,7 @@ class Te extends ei {
6971
6972
  if (this.currentCamera.name === "UI")
6972
6973
  return;
6973
6974
  const t = this.controls.get(this.currentCamera.name);
6974
- e.key === "0" ? (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.selectedItem instanceof S || this.selectedItem instanceof sa ? (this.selectedItem.geometry.computeBoundingBox(), this.cameraControls.fitToBox(this.selectedItem.geometry.boundingBox, !0)) : this.cameraControls.fitToSphere(this.selectedItem, !0), this.updateCameraControls(t, !0)) : e.key === "1" ? (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(0, Math.PI * 0.5, !0), this.cameraControls.moveTo(this.selectedItem.position.x, this.selectedItem.position.y, 0, !0), this.updateCameraControls(t)) : e.key === "2" ? (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(0, 0, !0), this.cameraControls.moveTo(this.selectedItem.position.x, 0, this.selectedItem.position.z, !0), this.updateCameraControls(t)) : e.key === "3" ? (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Math.PI / 2, Math.PI / 2, !0), this.cameraControls.moveTo(0, this.selectedItem.position.y, this.selectedItem.position.z, !0), this.updateCameraControls(t)) : e.key === "4" ? (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Math.PI, Math.PI / 2, !0), this.cameraControls.moveTo(this.selectedItem.position.x, this.selectedItem.position.y, 0, !0), this.updateCameraControls(t)) : e.key === "5" && (this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Pi(45), Pi(45), !0), this.updateCameraControls(t));
6975
+ e.key === "0" ? (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.selectedItem instanceof S || this.selectedItem instanceof sa ? (this.selectedItem.geometry.computeBoundingBox(), this.cameraControls.fitToBox(this.selectedItem.geometry.boundingBox, !0)) : this.cameraControls.fitToSphere(this.selectedItem, !0), this.updateCameraControls(t, !0)) : e.key === "1" ? (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(0, Math.PI * 0.5, !0), this.cameraControls.moveTo(this.selectedItem.position.x, this.selectedItem.position.y, 0, !0), this.updateCameraControls(t)) : e.key === "2" ? (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(0, 0, !0), this.cameraControls.moveTo(this.selectedItem.position.x, 0, this.selectedItem.position.z, !0), this.updateCameraControls(t)) : e.key === "3" ? (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Math.PI / 2, Math.PI / 2, !0), this.cameraControls.moveTo(0, this.selectedItem.position.y, this.selectedItem.position.z, !0), this.updateCameraControls(t)) : e.key === "4" ? (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Math.PI, Math.PI / 2, !0), this.cameraControls.moveTo(this.selectedItem.position.x, this.selectedItem.position.y, 0, !0), this.updateCameraControls(t)) : e.key === "5" && (e.preventDefault(), this.clearControls(), this.cameraControls = new Oe(this.currentCamera, this.currentWindow.current), this.cameraControls.rotateTo(Pi(45), Pi(45), !0), this.updateCameraControls(t));
6975
6976
  } else if (this.currentTransform !== void 0)
6976
6977
  switch (e.key) {
6977
6978
  case "r":
@@ -7104,12 +7105,12 @@ class Te extends ei {
7104
7105
  updateCameraControls = (e, t = !1) => {
7105
7106
  if (this.selectedItem === void 0)
7106
7107
  return;
7107
- cancelAnimationFrame(this.rafID), this.rafID = -1, this.cameraControls && (this.cameraControls.smoothTime = 0.1);
7108
+ cancelAnimationFrame(this.cameraControlsRafID), this.cameraControlsRafID = -1, this.cameraControls && (this.cameraControls.smoothTime = 0.1);
7108
7109
  const i = 0.15, n = new la();
7109
7110
  n.start(), this.selectedItem.getWorldPosition(e.target0);
7110
7111
  const r = () => {
7111
7112
  const a = n.getDelta();
7112
- this.cameraControls && this.cameraControls.update(a), t && (e.target.lerp(e.target0, i), e.object.position.lerp(e.position0, i), e.object.zoom = xi(e.object.zoom, e.zoom0, i), e.object.updateProjectionMatrix(), e.dispatchEvent({ type: "change" })), n.getElapsedTime() >= 0.5 ? (cancelAnimationFrame(this.rafID), this.rafID = -1, this.clearControls()) : this.rafID = requestAnimationFrame(r);
7113
+ this.cameraControls && this.cameraControls.update(a), t && (e.target.lerp(e.target0, i), e.object.position.lerp(e.position0, i), e.object.zoom = xi(e.object.zoom, e.zoom0, i), e.object.updateProjectionMatrix(), e.dispatchEvent({ type: "change" })), n.getElapsedTime() >= 0.5 ? (cancelAnimationFrame(this.cameraControlsRafID), this.cameraControlsRafID = -1, this.clearControls()) : this.cameraControlsRafID = requestAnimationFrame(r);
7113
7114
  };
7114
7115
  r();
7115
7116
  };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "module": "./dist/hermes.esm.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
- "version": "0.0.112",
10
+ "version": "0.0.113",
11
11
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -1,116 +1,117 @@
1
- import { Component, ReactNode } from 'react';
2
- import { Camera, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
3
- import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
4
- import RemoteThree from '@/core/remote/RemoteThree';
5
- import { InteractionMode, MultiViewMode } from './MultiViewData';
6
- import './MultiView.scss';
7
- type MultiViewProps = {
8
- three: RemoteThree;
9
- scenes: Map<string, any>;
10
- onSceneSet?: (scene: Scene) => void;
11
- onSceneUpdate?: (scene: Scene) => void;
12
- onSceneResize?: (scene: Scene, width: number, height: number) => void;
13
- };
14
- type MultiViewState = {
15
- mode: MultiViewMode;
16
- modeOpen: boolean;
17
- renderModeOpen: boolean;
18
- interactionMode: InteractionMode;
19
- interactionModeOpen: boolean;
20
- lastUpdate: number;
21
- };
22
- export default class MultiView extends Component<MultiViewProps, MultiViewState> {
23
- static instance: MultiView | null;
24
- scene: Scene;
25
- renderer?: WebGLRenderer | null;
26
- currentScene?: Scene;
27
- cameras: Map<string, Camera>;
28
- controls: Map<string, OrbitControls>;
29
- currentCamera: PerspectiveCamera | OrthographicCamera;
30
- currentWindow: any;
31
- private cameraHelpers;
32
- private lightHelpers;
33
- private helpersContainer;
34
- private grid;
35
- private axisHelper;
36
- private interactionHelper;
37
- private currentTransform?;
38
- private splineEditor;
39
- private depthMaterial;
40
- private normalsMaterial;
41
- private uvMaterial;
42
- private wireframeMaterial;
43
- private playing;
44
- private rafID;
45
- private width;
46
- private height;
47
- private sceneSet;
48
- private tlCam;
49
- private trCam;
50
- private blCam;
51
- private brCam;
52
- private tlRender;
53
- private trRender;
54
- private blRender;
55
- private brRender;
56
- private cameraVisibility;
57
- private lightVisibility;
58
- selectedItem: Object3D | undefined;
59
- private debugCamera;
60
- private raycaster;
61
- private pointer;
62
- private cameraControls;
63
- private canvasRef;
64
- private containerRef;
65
- private tlWindow;
66
- private trWindow;
67
- private blWindow;
68
- private brWindow;
69
- constructor(props: MultiViewProps);
70
- componentDidMount(): void;
71
- componentDidUpdate(prevProps: Readonly<MultiViewProps>, prevState: Readonly<MultiViewState>, snapshot?: any): void;
72
- componentWillUnmount(): void;
73
- render(): ReactNode;
74
- private setupRenderer;
75
- private setupScene;
76
- private setupTools;
77
- play(): void;
78
- pause(): void;
79
- toggleOrbitControls(value: boolean): void;
80
- private update;
81
- private draw;
82
- private onUpdate;
83
- private enable;
84
- private disable;
85
- private resize;
86
- private sceneUpdate;
87
- private addCamera;
88
- private removeCamera;
89
- private onMouseMove;
90
- private onClick;
91
- private onKey;
92
- private onSetSelectedItem;
93
- private updateSelectedItemHelper;
94
- private onUpdateTransform;
95
- private clearLightHelpers;
96
- private addLightHelpers;
97
- private createControls;
98
- private clearCamera;
99
- private killControls;
100
- private assignControls;
101
- private updateCamera;
102
- private updateCameraControls;
103
- private clearControls;
104
- private saveExpandedCameraVisibility;
105
- private saveExpandedLightVisibility;
106
- private getSceneOverride;
107
- private drawSingle;
108
- private drawDouble;
109
- private drawQuad;
110
- get appID(): string;
111
- get mode(): MultiViewMode;
112
- get three(): RemoteThree;
113
- get expandedCameraVisibility(): string;
114
- get expandedLightVisibility(): string;
115
- }
116
- export {};
1
+ import { Component, ReactNode } from 'react';
2
+ import { Camera, Object3D, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
3
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
4
+ import RemoteThree from '@/core/remote/RemoteThree';
5
+ import { InteractionMode, MultiViewMode } from './MultiViewData';
6
+ import './MultiView.scss';
7
+ type MultiViewProps = {
8
+ three: RemoteThree;
9
+ scenes: Map<string, any>;
10
+ onSceneSet?: (scene: Scene) => void;
11
+ onSceneUpdate?: (scene: Scene) => void;
12
+ onSceneResize?: (scene: Scene, width: number, height: number) => void;
13
+ };
14
+ type MultiViewState = {
15
+ mode: MultiViewMode;
16
+ modeOpen: boolean;
17
+ renderModeOpen: boolean;
18
+ interactionMode: InteractionMode;
19
+ interactionModeOpen: boolean;
20
+ lastUpdate: number;
21
+ };
22
+ export default class MultiView extends Component<MultiViewProps, MultiViewState> {
23
+ static instance: MultiView | null;
24
+ scene: Scene;
25
+ renderer?: WebGLRenderer | null;
26
+ currentScene?: Scene;
27
+ cameras: Map<string, Camera>;
28
+ controls: Map<string, OrbitControls>;
29
+ currentCamera: PerspectiveCamera | OrthographicCamera;
30
+ currentWindow: any;
31
+ private cameraHelpers;
32
+ private lightHelpers;
33
+ private helpersContainer;
34
+ private grid;
35
+ private axisHelper;
36
+ private interactionHelper;
37
+ private currentTransform?;
38
+ private splineEditor;
39
+ private depthMaterial;
40
+ private normalsMaterial;
41
+ private uvMaterial;
42
+ private wireframeMaterial;
43
+ private playing;
44
+ private rafID;
45
+ private cameraControlsRafID;
46
+ private width;
47
+ private height;
48
+ private sceneSet;
49
+ private tlCam;
50
+ private trCam;
51
+ private blCam;
52
+ private brCam;
53
+ private tlRender;
54
+ private trRender;
55
+ private blRender;
56
+ private brRender;
57
+ private cameraVisibility;
58
+ private lightVisibility;
59
+ selectedItem: Object3D | undefined;
60
+ private debugCamera;
61
+ private raycaster;
62
+ private pointer;
63
+ private cameraControls;
64
+ private canvasRef;
65
+ private containerRef;
66
+ private tlWindow;
67
+ private trWindow;
68
+ private blWindow;
69
+ private brWindow;
70
+ constructor(props: MultiViewProps);
71
+ componentDidMount(): void;
72
+ componentDidUpdate(prevProps: Readonly<MultiViewProps>, prevState: Readonly<MultiViewState>, snapshot?: any): void;
73
+ componentWillUnmount(): void;
74
+ render(): ReactNode;
75
+ private setupRenderer;
76
+ private setupScene;
77
+ private setupTools;
78
+ play(): void;
79
+ pause(): void;
80
+ toggleOrbitControls(value: boolean): void;
81
+ private update;
82
+ private draw;
83
+ private onUpdate;
84
+ private enable;
85
+ private disable;
86
+ private resize;
87
+ private sceneUpdate;
88
+ private addCamera;
89
+ private removeCamera;
90
+ private onMouseMove;
91
+ private onClick;
92
+ private onKey;
93
+ private onSetSelectedItem;
94
+ private updateSelectedItemHelper;
95
+ private onUpdateTransform;
96
+ private clearLightHelpers;
97
+ private addLightHelpers;
98
+ private createControls;
99
+ private clearCamera;
100
+ private killControls;
101
+ private assignControls;
102
+ private updateCamera;
103
+ private updateCameraControls;
104
+ private clearControls;
105
+ private saveExpandedCameraVisibility;
106
+ private saveExpandedLightVisibility;
107
+ private getSceneOverride;
108
+ private drawSingle;
109
+ private drawDouble;
110
+ private drawQuad;
111
+ get appID(): string;
112
+ get mode(): MultiViewMode;
113
+ get three(): RemoteThree;
114
+ get expandedCameraVisibility(): string;
115
+ get expandedLightVisibility(): string;
116
+ }
117
+ export {};
@@ -1,8 +1,8 @@
1
- import RemoteThree from '@/core/remote/RemoteThree';
2
- import { RemoteObject } from '../../types';
3
- type InspectAnimationProps = {
4
- object: RemoteObject;
5
- three: RemoteThree;
6
- };
7
- export default function InspectAnimation(props: InspectAnimationProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
1
+ import RemoteThree from '@/core/remote/RemoteThree';
2
+ import { RemoteObject } from '../../types';
3
+ type InspectAnimationProps = {
4
+ object: RemoteObject;
5
+ three: RemoteThree;
6
+ };
7
+ export default function InspectAnimation(props: InspectAnimationProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};