endset_three_editor 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "endset_three_editor",
3
3
  "private": false,
4
- "version": "0.1.2",
4
+ "version": "0.1.3",
5
5
  "description": "A 3D model editor built with Three.js and Vue 3",
6
6
  "type": "module",
7
7
  "main": "dist/three-editor.cjs.js",
@@ -1,6 +0,0 @@
1
- (function(B,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("three"),require("@tweenjs/tween.js")):typeof define=="function"&&define.amd?define(["exports","vue","three","@tweenjs/tween.js"],u):(B=typeof globalThis<"u"?globalThis:B||self,u(B.ThreeEditor={},B.Vue,B.THREE,B.TWEEN))})(this,(function(B,u,r,mt){"use strict";function gt(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const T=gt(r),Be={type:"change"},Pe={type:"start"},Ue={type:"end"},pe=new r.Ray,ze=new r.Plane,yt=Math.cos(70*r.MathUtils.DEG2RAD),k=new r.Vector3,F=2*Math.PI,N={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Le=1e-6;class _t extends r.Controls{constructor(e,t=null){super(e,t),this.state=N.NONE,this.target=new r.Vector3,this.cursor=new r.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},this.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new r.Vector3,this._lastQuaternion=new r.Quaternion,this._lastTargetPosition=new r.Vector3,this._quat=new r.Quaternion().setFromUnitVectors(e.up,new r.Vector3(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new r.Spherical,this._sphericalDelta=new r.Spherical,this._scale=1,this._panOffset=new r.Vector3,this._rotateStart=new r.Vector2,this._rotateEnd=new r.Vector2,this._rotateDelta=new r.Vector2,this._panStart=new r.Vector2,this._panEnd=new r.Vector2,this._panDelta=new r.Vector2,this._dollyStart=new r.Vector2,this._dollyEnd=new r.Vector2,this._dollyDelta=new r.Vector2,this._dollyDirection=new r.Vector3,this._mouse=new r.Vector2,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=wt.bind(this),this._onPointerDown=bt.bind(this),this._onPointerUp=Mt.bind(this),this._onContextMenu=It.bind(this),this._onMouseWheel=At.bind(this),this._onKeyDown=Pt.bind(this),this._onTouchStart=Lt.bind(this),this._onTouchMove=Nt.bind(this),this._onMouseDown=xt.bind(this),this._onMouseMove=St.bind(this),this._interceptControlDown=Ct.bind(this),this._interceptControlUp=Ot.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Be),this.update(),this.state=N.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){const t=this.object.position;k.copy(t).sub(this.target),k.applyQuaternion(this._quat),this._spherical.setFromVector3(k),this.autoRotate&&this.state===N.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let s=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(s)&&isFinite(n)&&(s<-Math.PI?s+=F:s>Math.PI&&(s-=F),n<-Math.PI?n+=F:n>Math.PI&&(n-=F),s<=n?this._spherical.theta=Math.max(s,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(s+n)/2?Math.max(s,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=o!=this._spherical.radius}if(k.setFromSpherical(this._spherical),k.applyQuaternion(this._quatInverse),t.copy(this.target).add(k),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const l=k.length();o=this._clampDistance(l*this._scale);const c=l-o;this.object.position.addScaledVector(this._dollyDirection,c),this.object.updateMatrixWorld(),i=!!c}else if(this.object.isOrthographicCamera){const l=new r.Vector3(this._mouse.x,this._mouse.y,0);l.unproject(this.object);const c=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=c!==this.object.zoom;const d=new r.Vector3(this._mouse.x,this._mouse.y,0);d.unproject(this.object),this.object.position.sub(d).add(l),this.object.updateMatrixWorld(),o=k.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(pe.origin.copy(this.object.position),pe.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(pe.direction))<yt?this.object.lookAt(this.target):(ze.setFromNormalAndCoplanarPoint(this.object.up,this.target),pe.intersectPlane(ze,this.target))))}else if(this.object.isOrthographicCamera){const o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),i=!0)}return this._scale=1,this._performCursorZoom=!1,i||this._lastPosition.distanceToSquared(this.object.position)>Le||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Le||this._lastTargetPosition.distanceToSquared(this.target)>Le?(this.dispatchEvent(Be),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?F/60*this.autoRotateSpeed*e:F/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),this._panOffset.add(k)}_panUp(e,t){this.screenSpacePanning===!0?k.setFromMatrixColumn(t,1):(k.setFromMatrixColumn(t,0),k.crossVectors(this.object.up,k)),k.multiplyScalar(e),this._panOffset.add(k)}_pan(e,t){const s=this.domElement;if(this.object.isPerspectiveCamera){const n=this.object.position;k.copy(n).sub(this.target);let i=k.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/s.clientHeight,this.object.matrix),this._panUp(2*t*i/s.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/s.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/s.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const s=this.domElement.getBoundingClientRect(),n=e-s.left,i=t-s.top,o=s.width,l=s.height;this._mouse.x=n/o*2-1,this._mouse.y=-(i/l)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(F*this._rotateDelta.x/t.clientHeight),this._rotateUp(F*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-F*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._rotateStart.set(s,n)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panStart.set(s,n)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const s=this._getSecondPointerPosition(e),n=.5*(e.pageX+s.x),i=.5*(e.pageY+s.y);this._rotateEnd.set(n,i)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(F*this._rotateDelta.x/t.clientHeight),this._rotateUp(F*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),s=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);this._panEnd.set(s,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),s=e.pageX-t.x,n=e.pageY-t.y,i=Math.sqrt(s*s+n*n);this._dollyEnd.set(0,i),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,l=(e.pageY+t.y)*.5;this._updateZoomParameters(o,l)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new r.Vector2,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){const t=e.deltaMode,s={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:s.deltaY*=16;break;case 2:s.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(s.deltaY*=10),s}}function bt(a){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(a.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(a)&&(this._addPointer(a),a.pointerType==="touch"?this._onTouchStart(a):this._onMouseDown(a),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function wt(a){this.enabled!==!1&&(a.pointerType==="touch"?this._onTouchMove(a):this._onMouseMove(a))}function Mt(a){switch(this._removePointer(a),this._pointers.length){case 0:this.domElement.releasePointerCapture(a.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Ue),this.state=N.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function xt(a){let e;switch(a.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case r.MOUSE.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(a),this.state=N.DOLLY;break;case r.MOUSE.ROTATE:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=N.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=N.ROTATE}break;case r.MOUSE.PAN:if(a.ctrlKey||a.metaKey||a.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(a),this.state=N.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(a),this.state=N.PAN}break;default:this.state=N.NONE}this.state!==N.NONE&&this.dispatchEvent(Pe)}function St(a){switch(this.state){case N.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(a);break;case N.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(a);break;case N.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(a);break}}function At(a){this.enabled===!1||this.enableZoom===!1||this.state!==N.NONE||(a.preventDefault(),this.dispatchEvent(Pe),this._handleMouseWheel(this._customWheelEvent(a)),this.dispatchEvent(Ue))}function Pt(a){this.enabled!==!1&&this._handleKeyDown(a)}function Lt(a){switch(this._trackPointer(a),this._pointers.length){case 1:switch(this.touches.ONE){case r.TOUCH.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(a),this.state=N.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(a),this.state=N.TOUCH_PAN;break;default:this.state=N.NONE}break;case 2:switch(this.touches.TWO){case r.TOUCH.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(a),this.state=N.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(a),this.state=N.TOUCH_DOLLY_ROTATE;break;default:this.state=N.NONE}break;default:this.state=N.NONE}this.state!==N.NONE&&this.dispatchEvent(Pe)}function Nt(a){switch(this._trackPointer(a),this.state){case N.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(a),this.update();break;case N.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(a),this.update();break;case N.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(a),this.update();break;case N.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(a),this.update();break;default:this.state=N.NONE}}function It(a){this.enabled!==!1&&a.preventDefault()}function Ct(a){a.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Ot(a){a.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const E=new r.Raycaster,j=new r.Vector3,$=new r.Vector3,O=new r.Quaternion,Xe={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},Ne={type:"change"},Ye={type:"mouseDown",mode:null},Ke={type:"mouseUp",mode:null},Ze={type:"objectChange"};class Dt extends r.Controls{constructor(e,t=null){super(void 0,t);const s=new Ft(this);this._root=s;const n=new Gt;this._gizmo=n,s.add(n);const i=new Bt;this._plane=i,s.add(i);const o=this;function l(S,A){let C=A;Object.defineProperty(o,S,{get:function(){return C!==void 0?C:A},set:function(P){C!==P&&(C=P,i[S]=P,n[S]=P,o.dispatchEvent({type:S+"-changed",value:P}),o.dispatchEvent(Ne))}}),o[S]=A,i[S]=A,n[S]=A}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),l("showXY",!0),l("showYZ",!0),l("showXZ",!0),l("minX",-1/0),l("maxX",1/0),l("minY",-1/0),l("maxY",1/0),l("minZ",-1/0),l("maxZ",1/0);const c=new r.Vector3,d=new r.Vector3,p=new r.Quaternion,h=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,g=new r.Vector3,y=new r.Vector3,_=new r.Vector3,b=0,x=new r.Vector3;l("worldPosition",c),l("worldPositionStart",d),l("worldQuaternion",p),l("worldQuaternionStart",h),l("cameraPosition",f),l("cameraQuaternion",m),l("pointStart",g),l("pointEnd",y),l("rotationAxis",_),l("rotationAngle",b),l("eye",x),this._offset=new r.Vector3,this._startNorm=new r.Vector3,this._endNorm=new r.Vector3,this._cameraScale=new r.Vector3,this._parentPosition=new r.Vector3,this._parentQuaternion=new r.Quaternion,this._parentQuaternionInv=new r.Quaternion,this._parentScale=new r.Vector3,this._worldScaleStart=new r.Vector3,this._worldQuaternionInv=new r.Quaternion,this._worldScale=new r.Vector3,this._positionStart=new r.Vector3,this._quaternionStart=new r.Quaternion,this._scaleStart=new r.Vector3,this._getPointer=vt.bind(this),this._onPointerDown=kt.bind(this),this._onPointerHover=Tt.bind(this),this._onPointerMove=Vt.bind(this),this._onPointerUp=jt.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),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=""}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&E.setFromCamera(e,this.camera);const t=Ie(this._gizmo.picker[this.mode],E);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&&E.setFromCamera(e,this.camera);const t=Ie(this._plane,E,!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,Ye.mode=this.mode,this.dispatchEvent(Ye)}}pointerMove(e){const t=this.axis,s=this.mode,n=this.object;let i=this.space;if(s==="scale"?i="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(i="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&E.setFromCamera(e,this.camera);const o=Ie(this._plane,E,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),i==="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),i==="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&&(i==="local"&&(n.position.applyQuaternion(O.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)),i==="world"&&(n.parent&&n.position.add(j.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(j.setFromMatrixPosition(n.parent.matrixWorld)))),n.position.x=Math.max(this.minX,Math.min(this.maxX,n.position.x)),n.position.y=Math.max(this.minY,Math.min(this.maxY,n.position.y)),n.position.z=Math.max(this.minZ,Math.min(this.maxZ,n.position.z));else if(s==="scale"){if(t.search("XYZ")!==-1){let l=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(l*=-1),$.set(l,l,l)}else j.copy(this.pointStart),$.copy(this.pointEnd),j.applyQuaternion(this._worldQuaternionInv),$.applyQuaternion(this._worldQuaternionInv),$.divide(j),t.search("X")===-1&&($.x=1),t.search("Y")===-1&&($.y=1),t.search("Z")===-1&&($.z=1);n.scale.copy(this._scaleStart).multiply($),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(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const l=20/this.worldPosition.distanceTo(j.setFromMatrixPosition(this.camera.matrixWorld));let c=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(j.copy(this.rotationAxis).cross(this.eye))*l):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Xe[t]),j.copy(Xe[t]),i==="local"&&j.applyQuaternion(this.worldQuaternion),j.cross(this.eye),j.length()===0?c=!0:this.rotationAngle=this._offset.dot(j.normalize())*l),(t==="E"||c)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(O.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(O.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Ne),this.dispatchEvent(Ze)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Ke.mode=this.mode,this.dispatchEvent(Ke)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.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(Ne),this.dispatchEvent(Ze),this.pointStart.copy(this.pointEnd))}getRaycaster(){return E}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}setColors(e,t,s,n){const i=this._gizmo.materialLib;i.xAxis.color.set(e),i.yAxis.color.set(t),i.zAxis.color.set(s),i.active.color.set(n),i.xAxisTransparent.color.set(e),i.yAxisTransparent.color.set(t),i.zAxisTransparent.color.set(s),i.activeTransparent.color.set(n),i.xAxis._color&&i.xAxis._color.set(e),i.yAxis._color&&i.yAxis._color.set(t),i.zAxis._color&&i.zAxis._color.set(s),i.active._color&&i.active._color.set(n),i.xAxisTransparent._color&&i.xAxisTransparent._color.set(e),i.yAxisTransparent._color&&i.yAxisTransparent._color.set(t),i.zAxisTransparent._color&&i.zAxisTransparent._color.set(s),i.activeTransparent._color&&i.activeTransparent._color.set(n)}}function vt(a){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:a.button};{const e=this.domElement.getBoundingClientRect();return{x:(a.clientX-e.left)/e.width*2-1,y:-(a.clientY-e.top)/e.height*2+1,button:a.button}}}function Tt(a){if(this.enabled)switch(a.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(a));break}}function kt(a){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(a.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(a)),this.pointerDown(this._getPointer(a)))}function Vt(a){this.enabled&&this.pointerMove(this._getPointer(a))}function jt(a){this.enabled&&(this.domElement.releasePointerCapture(a.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(a)))}function Ie(a,e,t){const s=e.intersectObject(a,!0);for(let n=0;n<s.length;n++)if(s[n].object.visible||t)return s[n];return!1}const fe=new r.Euler,I=new r.Vector3(0,1,0),Qe=new r.Vector3(0,0,0),Re=new r.Matrix4,me=new r.Quaternion,ge=new r.Quaternion,Z=new r.Vector3,qe=new r.Matrix4,ae=new r.Vector3(1,0,0),H=new r.Vector3(0,1,0),le=new r.Vector3(0,0,1),ye=new r.Vector3,ce=new r.Vector3,he=new r.Vector3;class Ft extends r.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)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}}class Gt extends r.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const n=t.clone();n.opacity=.5;const i=e.clone();i.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const l=e.clone();l.color.setHex(255);const c=e.clone();c.color.setHex(16711680),c.opacity=.5;const d=e.clone();d.color.setHex(65280),d.opacity=.5;const p=e.clone();p.color.setHex(255),p.opacity=.5;const h=e.clone();h.opacity=.25;const f=e.clone();f.color.setHex(16776960),f.opacity=.25;const m=e.clone();m.color.setHex(16776960);const g=e.clone();g.color.setHex(7895160),this.materialLib={xAxis:i,yAxis:o,zAxis:l,active:m,xAxisTransparent:c,yAxisTransparent:d,zAxisTransparent:p,activeTransparent:f};const y=new r.CylinderGeometry(0,.04,.1,12);y.translate(0,.05,0);const _=new r.BoxGeometry(.08,.08,.08);_.translate(0,.04,0);const b=new r.BufferGeometry;b.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3));const x=new r.CylinderGeometry(.0075,.0075,.5,3);x.translate(0,.25,0);function S(X,Me){const K=new r.TorusGeometry(X,.0075,3,64,Me*Math.PI*2);return K.rotateY(Math.PI/2),K.rotateX(Math.PI/2),K}function A(){const X=new r.BufferGeometry;return X.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),X}const C={X:[[new r.Mesh(y,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(y,i),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(x,i),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(y,o),[0,.5,0]],[new r.Mesh(y,o),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(x,o)]],Z:[[new r.Mesh(y,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(y,l),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(x,l),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),h),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]]},P={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new r.Line(A(),n),null,null,null,"helper"]],X:[[new r.Line(b,n),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(b,n),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(b,n),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},q={XYZE:[[new r.Mesh(S(.5,1),g),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(S(.5,.5),i)]],Y:[[new r.Mesh(S(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(S(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(S(.75,1),f),null,[0,Math.PI/2,0]]]},R={AXIS:[[new r.Line(b,n),[-1e3,0,0],null,[1e6,1,1],"helper"]]},se={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},Y={X:[[new r.Mesh(_,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(x,i),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(_,i),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(_,o),[0,.5,0]],[new r.Mesh(x,o)],[new r.Mesh(_,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(_,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(x,l),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(_,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),h)]]},M={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},V={X:[[new r.Line(b,n),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(b,n),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(b,n),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function W(X){const Me=new r.Object3D;for(const K in X)for(let re=X[K].length;re--;){const G=X[K][re][0].clone(),xe=X[K][re][1],Se=X[K][re][2],Ae=X[K][re][3],Ns=X[K][re][4];G.name=K,G.tag=Ns,xe&&G.position.set(xe[0],xe[1],xe[2]),Se&&G.rotation.set(Se[0],Se[1],Se[2]),Ae&&G.scale.set(Ae[0],Ae[1],Ae[2]),G.updateMatrix();const ft=G.geometry.clone();ft.applyMatrix4(G.matrix),G.geometry=ft,G.renderOrder=1/0,G.position.set(0,0,0),G.rotation.set(0,0,0),G.scale.set(1,1,1),Me.add(G)}return Me}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=W(C)),this.add(this.gizmo.rotate=W(q)),this.add(this.gizmo.scale=W(Y)),this.add(this.picker.translate=W(P)),this.add(this.picker.rotate=W(se)),this.add(this.picker.scale=W(M)),this.add(this.helper.translate=W(D)),this.add(this.helper.rotate=W(R)),this.add(this.helper.scale=W(V)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const s=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:ge;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 i=0;i<n.length;i++){const o=n[i];o.visible=!0,o.rotation.set(0,0,0),o.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),o.scale.set(1,1,1).multiplyScalar(l*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(O.setFromEuler(fe.set(0,0,0)),o.quaternion.copy(s).multiply(O),Math.abs(I.copy(ae).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(O.setFromEuler(fe.set(0,0,Math.PI/2)),o.quaternion.copy(s).multiply(O),Math.abs(I.copy(H).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(O.setFromEuler(fe.set(0,Math.PI/2,0)),o.quaternion.copy(s).multiply(O),Math.abs(I.copy(le).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(O.setFromEuler(fe.set(0,Math.PI/2,0)),I.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Re.lookAt(Qe,I,H)),o.quaternion.multiply(O),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),j.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),j.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(j),o.visible=this.dragging):(o.quaternion.copy(s),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(I.copy(ae).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(I.copy(H).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(I.copy(le).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(I.copy(le).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(I.copy(ae).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(I.copy(H).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(me.copy(s),I.copy(this.eye).applyQuaternion(O.copy(s).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Re.lookAt(this.eye,Qe,H)),o.name==="X"&&(O.setFromAxisAngle(ae,Math.atan2(-I.y,I.z)),O.multiplyQuaternions(me,O),o.quaternion.copy(O)),o.name==="Y"&&(O.setFromAxisAngle(H,Math.atan2(I.x,I.z)),O.multiplyQuaternions(me,O),o.quaternion.copy(O)),o.name==="Z"&&(O.setFromAxisAngle(le,Math.atan2(I.y,I.x)),O.multiplyQuaternions(me,O),o.quaternion.copy(O))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.visible=o.visible&&(o.name.indexOf("XY")===-1||this.showXY),o.visible=o.visible&&(o.name.indexOf("YZ")===-1||this.showYZ),o.visible=o.visible&&(o.name.indexOf("XZ")===-1||this.showXZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis?(o.material.color.copy(this.materialLib.active.color),o.material.opacity=1):this.axis.split("").some(function(c){return o.name===c})&&(o.material.color.copy(this.materialLib.active.color),o.material.opacity=1))}super.updateMatrixWorld(e)}}class Bt extends r.Mesh{constructor(){super(new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.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"),ye.copy(ae).applyQuaternion(t==="local"?this.worldQuaternion:ge),ce.copy(H).applyQuaternion(t==="local"?this.worldQuaternion:ge),he.copy(le).applyQuaternion(t==="local"?this.worldQuaternion:ge),I.copy(ce),this.mode){case"translate":case"scale":switch(this.axis){case"X":I.copy(this.eye).cross(ye),Z.copy(ye).cross(I);break;case"Y":I.copy(this.eye).cross(ce),Z.copy(ce).cross(I);break;case"Z":I.copy(this.eye).cross(he),Z.copy(he).cross(I);break;case"XY":Z.copy(he);break;case"YZ":Z.copy(ye);break;case"XZ":I.copy(he),Z.copy(ce);break;case"XYZ":case"E":Z.set(0,0,0);break}break;case"rotate":default:Z.set(0,0,0)}Z.length()===0?this.quaternion.copy(this.cameraQuaternion):(qe.lookAt(j.set(0,0,0),Z,I),this.quaternion.setFromRotationMatrix(qe)),super.updateMatrixWorld(e)}}const w={scene:null,camera:null,renderer:null,orbitControls:null,transformControls:null,container:null,gridHelper:null,selectedObject:null};let Ce=!1,ie=!1,ee=null,Oe=null,_e=null,te=[];function Ut(a){w.container=a,zt(),Xt(),Yt(),Kt(),Qt(),Zt(),en(),Rt(),We(),a.addEventListener("click",Wt),window.addEventListener("resize",qt)}function zt(){const a=new T.WebGLRenderer({antialias:!0,alpha:!0});a.setSize(w.container.clientWidth,w.container.clientHeight),a.setPixelRatio(Math.min(window.devicePixelRatio,2)),w.container.appendChild(a.domElement),w.renderer=a}function Xt(){w.scene=new T.Scene,w.scene.name="sl_scene"}function Yt(){const a=new T.GridHelper(30,30,8956671,3364232);a.name="地板",w.scene.add(a),w.gridHelper=a}function Kt(){const a=w.container,e=a.clientWidth/a.clientHeight,t=new T.PerspectiveCamera(45,e,.1,1e3);t.position.set(0,6,15),t.lookAt(0,0,0),w.camera=t}function Zt(){const a=new _t(w.camera,w.renderer.domElement);a.minDistance=0,a.maxDistance=1/0,a.addEventListener("start",()=>{Ce=!1}),a.addEventListener("change",()=>{Ce=!0}),a.addEventListener("end",()=>{Ce&&(ie=!0,setTimeout(()=>{ie=!1},200))}),w.orbitControls=a}function Qt(){const a=new Dt(w.camera,w.renderer.domElement);a.addEventListener("dragging-changed",e=>{w.orbitControls.enabled=!e.value,e.value||(ie=!0,setTimeout(()=>{ie=!1},200))}),a.addEventListener("objectChange",()=>{Oe&&w.selectedObject&&Oe(w.selectedObject)}),w.scene.add(a.getHelper()),w.transformControls=a}function Rt(){const a=new T.AmbientLight(16777215,2);w.scene.add(a);const e=new T.DirectionalLight(16777215,3);e.position.set(48,104,138),w.scene.add(e);const t=new T.BoxGeometry(1,1,1),s=new T.MeshStandardMaterial({color:16777215}),n=new T.Mesh(t,s);n.position.y=1,n.userData.isMovable=!0,n.name="默认立方体",be(n,!0)}function We(){var a,e;requestAnimationFrame(We),mt.update(),(a=w.orbitControls)==null||a.update(),(e=w.renderer)==null||e.render(w.scene,w.camera)}function qt(){if(!w.container||!w.camera||!w.renderer)return;const a=w.container.clientWidth,e=w.container.clientHeight;a===0||e===0||(w.camera.aspect=a/e,w.camera.updateProjectionMatrix(),w.renderer.setSize(a,e))}function De(a){w.selectedObject!==a&&(w.selectedObject&&w.transformControls.detach(),w.selectedObject=a,w.transformControls.attach(a),w.transformControls.setMode("translate"),w.transformControls.showX=!0,w.transformControls.showY=!0,w.transformControls.showZ=!0,ee==null||ee(a))}function $e(){w.selectedObject&&(w.transformControls.detach(),w.selectedObject=null,ee==null||ee(null))}function Wt(a){if(ie){ie=!1;return}const e=w.renderer.domElement.getBoundingClientRect(),t=new T.Vector2((a.clientX-e.left)/e.width*2-1,-((a.clientY-e.top)/e.height)*2+1),s=new T.Raycaster;s.setFromCamera(t,w.camera);const n=[];w.scene.traverse(o=>{o.type==="Mesh"&&o.userData.isMovable&&n.push(o)});const i=s.intersectObjects(n);i.length>0?De(i[0].object):$e()}function be(a,e=!1){w.scene.add(a),a.userData.isMovable&&(Et(a),ve()),e&&De(a)}function $t(a){w.selectedObject===a&&$e(),a.parent?a.parent.remove(a):w.scene.remove(a),Ht(a),ve()}function Jt(a){const e=w.scene.getObjectByProperty("uuid",a);e&&$t(e)}function Et(a){a.userData.isMovable&&a.parent===w.scene&&(te.includes(a)||te.push(a))}function Ht(a){const e=te.indexOf(a);e!==-1&&te.splice(e,1)}function en(){const a=[];w.scene.children.forEach(e=>{e.userData.isMovable&&a.push(e)}),te=a,ve()}function ve(){_e==null||_e([...te])}function tn(a){ee=a}function nn(a){Oe=a}function sn(a){_e=a}function on(){return te}const rn=/^[og]\s*(.+)?/,an=/^mtllib /,ln=/^usemtl /,cn=/^usemap /,Je=/\s+/,Ee=new r.Vector3,Te=new r.Vector3,He=new r.Vector3,et=new r.Vector3,U=new r.Vector3,we=new r.Color;function hn(){const a={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(n,i){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const l={index:this.materials.length,name:n||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(c){const d={index:typeof c=="number"?c:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return d.clone=this.clone.bind(d),d}};return this.materials.push(l),l},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(n){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),n&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return n&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},s&&s.name&&typeof s.clone=="function"){const n=s.clone(0);n.inherited=!0,this.object.materials.push(n)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseNormalIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseUVIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/2)*2},addVertex:function(e,t,s){const n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[s+0],n[s+1],n[s+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,s){const n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[s+0],n[s+1],n[s+2])},addFaceNormal:function(e,t,s){const n=this.vertices,i=this.object.geometry.normals;Ee.fromArray(n,e),Te.fromArray(n,t),He.fromArray(n,s),U.subVectors(He,Te),et.subVectors(Ee,Te),U.cross(et),U.normalize(),i.push(U.x,U.y,U.z),i.push(U.x,U.y,U.z),i.push(U.x,U.y,U.z)},addColor:function(e,t,s){const n=this.colors,i=this.object.geometry.colors;n[e]!==void 0&&i.push(n[e+0],n[e+1],n[e+2]),n[t]!==void 0&&i.push(n[t+0],n[t+1],n[t+2]),n[s]!==void 0&&i.push(n[s+0],n[s+1],n[s+2])},addUV:function(e,t,s){const n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[s+0],n[s+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,s,n,i,o,l,c,d){const p=this.vertices.length;let h=this.parseVertexIndex(e,p),f=this.parseVertexIndex(t,p),m=this.parseVertexIndex(s,p);if(this.addVertex(h,f,m),this.addColor(h,f,m),l!==void 0&&l!==""){const g=this.normals.length;h=this.parseNormalIndex(l,g),f=this.parseNormalIndex(c,g),m=this.parseNormalIndex(d,g),this.addNormal(h,f,m)}else this.addFaceNormal(h,f,m);if(n!==void 0&&n!==""){const g=this.uvs.length;h=this.parseUVIndex(n,g),f=this.parseUVIndex(i,g),m=this.parseUVIndex(o,g),this.addUV(h,f,m),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let s=0,n=e.length;s<n;s++){const i=this.parseVertexIndex(e[s],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const s=this.vertices.length,n=this.uvs.length;for(let i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],s));for(let i=0,o=t.length;i<o;i++)this.addUVLine(this.parseUVIndex(t[i],n))}};return a.startObject("",!1),a}class dn extends r.Loader{constructor(e){super(e),this.materials=null}load(e,t,s,n){const i=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(i.parse(l))}catch(c){n?n(c):console.error(c),i.manager.itemError(e)}},s,n)}setMaterials(e){return this.materials=e,this}parse(e){const t=new hn;e.indexOf(`\r
2
- `)!==-1&&(e=e.replace(/\r\n/g,`
3
- `)),e.indexOf(`\\
4
- `)!==-1&&(e=e.replace(/\\\n/g,""));const s=e.split(`
5
- `);let n=[];for(let l=0,c=s.length;l<c;l++){const d=s[l].trimStart();if(d.length===0)continue;const p=d.charAt(0);if(p!=="#")if(p==="v"){const h=d.split(Je);switch(h[0]){case"v":t.vertices.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),h.length>=7?(we.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),r.SRGBColorSpace),t.colors.push(we.r,we.g,we.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(p==="f"){const f=d.slice(1).trim().split(Je),m=[];for(let y=0,_=f.length;y<_;y++){const b=f[y];if(b.length>0){const x=b.split("/");m.push(x)}}const g=m[0];for(let y=1,_=m.length-1;y<_;y++){const b=m[y],x=m[y+1];t.addFace(g[0],b[0],x[0],g[1],b[1],x[1],g[2],b[2],x[2])}}else if(p==="l"){const h=d.substring(1).trim().split(" ");let f=[];const m=[];if(d.indexOf("/")===-1)f=h;else for(let g=0,y=h.length;g<y;g++){const _=h[g].split("/");_[0]!==""&&f.push(_[0]),_[1]!==""&&m.push(_[1])}t.addLineGeometry(f,m)}else if(p==="p"){const f=d.slice(1).trim().split(" ");t.addPointGeometry(f)}else if((n=rn.exec(d))!==null){const h=(" "+n[0].slice(1).trim()).slice(1);t.startObject(h)}else if(ln.test(d))t.object.startMaterial(d.substring(7).trim(),t.materialLibraries);else if(an.test(d))t.materialLibraries.push(d.substring(7).trim());else if(cn.test(d))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(p==="s"){if(n=d.split(" "),n.length>1){const f=n[1].trim().toLowerCase();t.object.smooth=f!=="0"&&f!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(d==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+d+'"')}}t.finalize();const i=new r.Group;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,c=t.objects.length;l<c;l++){const d=t.objects[l],p=d.geometry,h=d.materials,f=p.type==="Line",m=p.type==="Points";let g=!1;if(p.vertices.length===0)continue;const y=new r.BufferGeometry;y.setAttribute("position",new r.Float32BufferAttribute(p.vertices,3)),p.normals.length>0&&y.setAttribute("normal",new r.Float32BufferAttribute(p.normals,3)),p.colors.length>0&&(g=!0,y.setAttribute("color",new r.Float32BufferAttribute(p.colors,3))),p.hasUVIndices===!0&&y.setAttribute("uv",new r.Float32BufferAttribute(p.uvs,2));const _=[];for(let x=0,S=h.length;x<S;x++){const A=h[x],C=A.name+"_"+A.smooth+"_"+g;let P=t.materials[C];if(this.materials!==null){if(P=this.materials.create(A.name),f&&P&&!(P instanceof r.LineBasicMaterial)){const D=new r.LineBasicMaterial;r.Material.prototype.copy.call(D,P),D.color.copy(P.color),P=D}else if(m&&P&&!(P instanceof r.PointsMaterial)){const D=new r.PointsMaterial({size:10,sizeAttenuation:!1});r.Material.prototype.copy.call(D,P),D.color.copy(P.color),D.map=P.map,P=D}}P===void 0&&(f?P=new r.LineBasicMaterial:m?P=new r.PointsMaterial({size:1,sizeAttenuation:!1}):P=new r.MeshPhongMaterial,P.name=A.name,P.flatShading=!A.smooth,P.vertexColors=g,t.materials[C]=P),_.push(P)}let b;if(_.length>1){for(let x=0,S=h.length;x<S;x++){const A=h[x];y.addGroup(A.groupStart,A.groupCount,x)}f?b=new r.LineSegments(y,_):m?b=new r.Points(y,_):b=new r.Mesh(y,_)}else f?b=new r.LineSegments(y,_[0]):m?b=new r.Points(y,_[0]):b=new r.Mesh(y,_[0]);b.name=d.name,i.add(b)}else if(t.vertices.length>0){const l=new r.PointsMaterial({size:1,sizeAttenuation:!1}),c=new r.BufferGeometry;c.setAttribute("position",new r.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(c.setAttribute("color",new r.Float32BufferAttribute(t.colors,3)),l.vertexColors=!0);const d=new r.Points(c,l);i.add(d)}return i}}function tt(a,e){if(e===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(e===r.TriangleFanDrawMode||e===r.TriangleStripDrawMode){let t=a.getIndex();if(t===null){const o=[],l=a.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)o.push(c);a.setIndex(o),t=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const s=t.count-2,n=[];if(e===r.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=a.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),a}function un(a){const e=new Map,t=new Map,s=a.clone();return nt(a,s,function(n,i){e.set(i,n),t.set(n,i)}),s.traverse(function(n){if(!n.isSkinnedMesh)return;const i=n,o=e.get(n),l=o.skeleton.bones;i.skeleton=o.skeleton.clone(),i.bindMatrix.copy(o.bindMatrix),i.skeleton.bones=l.map(function(c){return t.get(c)}),i.bind(i.skeleton,i.bindMatrix)}),s}function nt(a,e,t){t(a,e);for(let s=0;s<a.children.length;s++)nt(a.children[s],e.children[s],t)}class pn extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new _n(t)}),this.register(function(t){return new bn(t)}),this.register(function(t){return new In(t)}),this.register(function(t){return new Cn(t)}),this.register(function(t){return new On(t)}),this.register(function(t){return new Mn(t)}),this.register(function(t){return new xn(t)}),this.register(function(t){return new Sn(t)}),this.register(function(t){return new An(t)}),this.register(function(t){return new yn(t)}),this.register(function(t){return new Pn(t)}),this.register(function(t){return new wn(t)}),this.register(function(t){return new Nn(t)}),this.register(function(t){return new Ln(t)}),this.register(function(t){return new mn(t)}),this.register(function(t){return new st(t,L.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new st(t,L.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Dn(t)})}load(e,t,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const d=r.LoaderUtils.extractUrlBase(e);o=r.LoaderUtils.resolveURL(d,this.path)}else o=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const l=function(d){n?n(d):console.error(d),i.manager.itemError(e),i.manager.itemEnd(e)},c=new r.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(d){try{i.parse(d,o,function(p){t(p),i.manager.itemEnd(e)},l)}catch(p){l(p)}},s,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let i;const o={},l={},c=new TextDecoder;if(typeof e=="string")i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===it){try{o[L.KHR_BINARY_GLTF]=new vn(e)}catch(h){n&&n(h);return}i=JSON.parse(o[L.KHR_BINARY_GLTF].content)}else i=JSON.parse(c.decode(e));else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const d=new Zn(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let p=0;p<this.pluginCallbacks.length;p++){const h=this.pluginCallbacks[p](d);h.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[h.name]=h,o[h.name]=!0}if(i.extensionsUsed)for(let p=0;p<i.extensionsUsed.length;++p){const h=i.extensionsUsed[p],f=i.extensionsRequired||[];switch(h){case L.KHR_MATERIALS_UNLIT:o[h]=new gn;break;case L.KHR_DRACO_MESH_COMPRESSION:o[h]=new Tn(i,this.dracoLoader);break;case L.KHR_TEXTURE_TRANSFORM:o[h]=new kn;break;case L.KHR_MESH_QUANTIZATION:o[h]=new Vn;break;default:f.indexOf(h)>=0&&l[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}d.setExtensions(o),d.setPlugins(l),d.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function fn(){let a={};return{get:function(e){return a[e]},add:function(e,t){a[e]=t},remove:function(e){delete a[e]},removeAll:function(){a={}}}}function v(a,e,t){const s=a.json.materials[e];return s.extensions&&s.extensions[t]?s.extensions[t]:null}const L={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class mn{constructor(e){this.parser=e,this.name=L.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,c=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let d;const p=new r.Color(16777215);c.color!==void 0&&p.setRGB(c.color[0],c.color[1],c.color[2],r.LinearSRGBColorSpace);const h=c.range!==void 0?c.range:0;switch(c.type){case"directional":d=new r.DirectionalLight(p),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new r.PointLight(p),d.distance=h;break;case"spot":d=new r.SpotLight(p),d.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,d.angle=c.spot.outerConeAngle,d.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return d.position.set(0,0,0),Q(d,c),c.intensity!==void 0&&(d.intensity=c.intensity),d.name=t.createUniqueName(c.name||"light_"+e),n=Promise.resolve(d),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],l=(i.extensions&&i.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(c){return s._getNodeRef(t.cache,l,c)})}}class gn{constructor(){this.name=L.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new r.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,r.SRGBColorSpace))}return Promise.all(n)}}class yn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);return s===null||s.emissiveStrength!==void 0&&(t.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class _n{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(n.push(this.parser.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const i=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(i,i)}return Promise.all(n)}}class bn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_DISPERSION}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);return s===null||(t.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class wn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(n)}}class Mn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_SHEEN}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,s.sheenColorFactor!==void 0){const i=s.sheenColorFactor;t.sheenColor.setRGB(i[0],i[1],i[2],r.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenColorMap",s.sheenColorTexture,r.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(n)}}class xn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&n.push(this.parser.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(n)}}class Sn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_VOLUME}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const i=s.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(i[0],i[1],i[2],r.LinearSRGBColorSpace),Promise.all(n)}}class An{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_IOR}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);return s===null||(t.ior=s.ior!==void 0?s.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}}class Pn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_SPECULAR}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularIntensityMap",s.specularTexture));const i=s.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(i[0],i[1],i[2],r.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularColorMap",s.specularColorTexture,r.SRGBColorSpace)),Promise.all(n)}}class Ln{constructor(e){this.parser=e,this.name=L.EXT_MATERIALS_BUMP}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&n.push(this.parser.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(n)}}class Nn{constructor(e){this.parser=e,this.name=L.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return v(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=v(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&n.push(this.parser.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(n)}}class In{constructor(e){this.parser=e,this.name=L.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class Cn{constructor(e){this.parser=e,this.name=L.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],l=n.images[o.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,o.source,c)}}class On{constructor(e){this.parser=e,this.name=L.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],l=n.images[o.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,o.source,c)}}class st{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(l){const c=n.byteOffset||0,d=n.byteLength||0,p=n.count,h=n.byteStride,f=new Uint8Array(l,c,d);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(p,h,f,n.mode,n.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(p*h);return o.decodeGltfBuffer(new Uint8Array(m),p,h,f,n.mode,n.filter),m})})}else return null}}class Dn{constructor(e){this.name=L.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const d of n.primitives)if(d.mode!==z.TRIANGLES&&d.mode!==z.TRIANGLE_STRIP&&d.mode!==z.TRIANGLE_FAN&&d.mode!==void 0)return null;const o=s.extensions[this.name].attributes,l=[],c={};for(const d in o)l.push(this.parser.getDependency("accessor",o[d]).then(p=>(c[d]=p,c[d])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(d=>{const p=d.pop(),h=p.isGroup?p.children:[p],f=d[0].count,m=[];for(const g of h){const y=new r.Matrix4,_=new r.Vector3,b=new r.Quaternion,x=new r.Vector3(1,1,1),S=new r.InstancedMesh(g.geometry,g.material,f);for(let A=0;A<f;A++)c.TRANSLATION&&_.fromBufferAttribute(c.TRANSLATION,A),c.ROTATION&&b.fromBufferAttribute(c.ROTATION,A),c.SCALE&&x.fromBufferAttribute(c.SCALE,A),S.setMatrixAt(A,y.compose(_,b,x));for(const A in c)if(A==="_COLOR_0"){const C=c[A];S.instanceColor=new r.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else A!=="TRANSLATION"&&A!=="ROTATION"&&A!=="SCALE"&&g.geometry.setAttribute(A,c[A]);r.Object3D.prototype.copy.call(S,g),this.parser.assignFinalMaterial(S),m.push(S)}return p.isGroup?(p.clear(),p.add(...m),p):m[0]}))}}const it="glTF",de=12,ot={JSON:1313821514,BIN:5130562};class vn{constructor(e){this.name=L.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,de),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==it)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-de,i=new DataView(e,de);let o=0;for(;o<n;){const l=i.getUint32(o,!0);o+=4;const c=i.getUint32(o,!0);if(o+=4,c===ot.JSON){const d=new Uint8Array(e,de+o,l);this.content=s.decode(d)}else if(c===ot.BIN){const d=de+o;this.body=e.slice(d,d+l)}o+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Tn{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=L.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},d={};for(const p in o){const h=Ve[p]||p.toLowerCase();l[h]=o[p]}for(const p in e.attributes){const h=Ve[p]||p.toLowerCase();if(o[p]!==void 0){const f=s.accessors[e.attributes[p]],m=oe[f.componentType];d[h]=m.name,c[h]=f.normalized===!0}}return t.getDependency("bufferView",i).then(function(p){return new Promise(function(h,f){n.decodeDracoFile(p,function(m){for(const g in m.attributes){const y=m.attributes[g],_=c[g];_!==void 0&&(y.normalized=_)}h(m)},l,d,r.LinearSRGBColorSpace,f)})})}}class kn{constructor(){this.name=L.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Vn{constructor(){this.name=L.KHR_MESH_QUANTIZATION}}class rt extends r.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,l=this.valueSize,c=l*2,d=l*3,p=n-t,h=(s-t)/p,f=h*h,m=f*h,g=e*d,y=g-d,_=-2*m+3*f,b=m-f,x=1-_,S=b-f+h;for(let A=0;A!==l;A++){const C=o[y+A+l],P=o[y+A+c]*p,D=o[g+A+l],q=o[g+A]*p;i[A]=x*C+S*P+_*D+b*q}return i}}const jn=new r.Quaternion;class Fn extends rt{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return jn.fromArray(i).normalize().toArray(i),i}}const z={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},at={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},lt={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},ke={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ve={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},J={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Gn={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},je={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Bn(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),a.DefaultMaterial}function ne(a,e,t){for(const s in t.extensions)a[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function Q(a,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(a.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Un(a,e,t){let s=!1,n=!1,i=!1;for(let d=0,p=e.length;d<p;d++){const h=e[d];if(h.POSITION!==void 0&&(s=!0),h.NORMAL!==void 0&&(n=!0),h.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(a);const o=[],l=[],c=[];for(let d=0,p=e.length;d<p;d++){const h=e[d];if(s){const f=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):a.attributes.position;o.push(f)}if(n){const f=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):a.attributes.normal;l.push(f)}if(i){const f=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):a.attributes.color;c.push(f)}}return Promise.all([Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(d){const p=d[0],h=d[1],f=d[2];return s&&(a.morphAttributes.position=p),n&&(a.morphAttributes.normal=h),i&&(a.morphAttributes.color=f),a.morphTargetsRelative=!0,a})}function zn(a,e){if(a.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)a.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(a.morphTargetInfluences.length===t.length){a.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)a.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Xn(a){let e;const t=a.extensions&&a.extensions[L.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Fe(t.attributes):e=a.indices+":"+Fe(a.attributes)+":"+a.mode,a.targets!==void 0)for(let s=0,n=a.targets.length;s<n;s++)e+=":"+Fe(a.targets[s]);return e}function Fe(a){let e="";const t=Object.keys(a).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+a[t[s]]+";";return e}function Ge(a){switch(a){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Yn(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":a.search(/\.ktx2($|\?)/i)>0||a.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Kn=new r.Matrix4;class Zn{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new fn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=-1,i=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const l=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(l)===!0;const c=l.match(/Version\/(\d+)/);n=s&&c?parseInt(c[1],10):-1,i=l.indexOf("Firefox")>-1,o=i?l.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||i&&o<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const l={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return ne(i,l,n),Q(l,n),Promise.all(s._invokeAll(function(c){return c.afterRoot&&c.afterRoot(l)})).then(function(){for(const c of l.scenes)c.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let l=0,c=o.length;l<c;l++)e[o[l]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,l)=>{const c=this.associations.get(o);c!=null&&this.associations.set(l,c);for(const[d,p]of o.children.entries())i(p,l.children[d])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[L.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=ke[n.type],l=oe[n.componentType],c=n.normalized===!0,d=new l(n.count*o);return Promise.resolve(new r.BufferAttribute(d,o,c))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const l=o[0],c=ke[n.type],d=oe[n.componentType],p=d.BYTES_PER_ELEMENT,h=p*c,f=n.byteOffset||0,m=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let y,_;if(m&&m!==h){const b=Math.floor(f/m),x="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+b+":"+n.count;let S=t.cache.get(x);S||(y=new d(l,b*m,n.count*m/p),S=new r.InterleavedBuffer(y,m/p),t.cache.add(x,S)),_=new r.InterleavedBufferAttribute(S,c,f%m/p,g)}else l===null?y=new d(n.count*c):y=new d(l,f,n.count*c),_=new r.BufferAttribute(y,c,g);if(n.sparse!==void 0){const b=ke.SCALAR,x=oe[n.sparse.indices.componentType],S=n.sparse.indices.byteOffset||0,A=n.sparse.values.byteOffset||0,C=new x(o[1],S,n.sparse.count*b),P=new d(o[2],A,n.sparse.count*c);l!==null&&(_=new r.BufferAttribute(_.array.slice(),_.itemSize,_.normalized)),_.normalized=!1;for(let D=0,q=C.length;D<q;D++){const R=C[D];if(_.setX(R,P[D*c]),c>=2&&_.setY(R,P[D*c+1]),c>=3&&_.setZ(R,P[D*c+2]),c>=4&&_.setW(R,P[D*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}_.normalized=g}return _})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let l=this.textureLoader;if(o.uri){const c=s.manager.getHandler(o.uri);c!==null&&(l=c)}return this.loadTextureImage(e,i,l)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],l=i.images[t],c=(l.uri||l.bufferView)+":"+o.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then(function(p){p.flipY=!1,p.name=o.name||l.name||"",p.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(p.name=l.uri);const f=(i.samplers||{})[o.sampler]||{};return p.magFilter=at[f.magFilter]||r.LinearFilter,p.minFilter=at[f.minFilter]||r.LinearMipmapLinearFilter,p.wrapS=lt[f.wrapS]||r.RepeatWrapping,p.wrapT=lt[f.wrapT]||r.RepeatWrapping,p.generateMipmaps=!p.isCompressedTexture&&p.minFilter!==r.NearestFilter&&p.minFilter!==r.LinearFilter,n.associations.set(p,{textures:e}),p}).catch(function(){return null});return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=n.images[e],l=self.URL||self.webkitURL;let c=o.uri||"",d=!1;if(o.bufferView!==void 0)c=s.getDependency("bufferView",o.bufferView).then(function(h){d=!0;const f=new Blob([h],{type:o.mimeType});return c=l.createObjectURL(f),c});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(c).then(function(h){return new Promise(function(f,m){let g=f;t.isImageBitmapLoader===!0&&(g=function(y){const _=new r.Texture(y);_.needsUpdate=!0,f(_)}),t.load(r.LoaderUtils.resolveURL(h,i.path),g,void 0,m)})}).then(function(h){return d===!0&&l.revokeObjectURL(c),Q(h,o),h.userData.mimeType=o.mimeType||Yn(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),h});return this.sourceCache[e]=p,p}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[L.KHR_TEXTURE_TRANSFORM]){const l=s.extensions!==void 0?s.extensions[L.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const c=i.associations.get(o);o=i.extensions[L.KHR_TEXTURE_TRANSFORM].extendTexture(o,l),i.associations.set(o,c)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.PointsMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,c.sizeAttenuation=!1,this.cache.add(l,c)),s=c}else if(e.isLine){const l="LineBasicMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.LineBasicMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,this.cache.add(l,c)),s=c}if(n||i||o){let l="ClonedMaterial:"+s.uuid+":";n&&(l+="derivative-tangents:"),i&&(l+="vertex-colors:"),o&&(l+="flat-shading:");let c=this.cache.get(l);c||(c=s.clone(),i&&(c.vertexColors=!0),o&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(l,c),this.associations.set(c,this.associations.get(s))),s=c}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const l={},c=i.extensions||{},d=[];if(c[L.KHR_MATERIALS_UNLIT]){const h=n[L.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),d.push(h.extendParams(l,i,t))}else{const h=i.pbrMetallicRoughness||{};if(l.color=new r.Color(1,1,1),l.opacity=1,Array.isArray(h.baseColorFactor)){const f=h.baseColorFactor;l.color.setRGB(f[0],f[1],f[2],r.LinearSRGBColorSpace),l.opacity=f[3]}h.baseColorTexture!==void 0&&d.push(t.assignTexture(l,"map",h.baseColorTexture,r.SRGBColorSpace)),l.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,l.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(l,"metalnessMap",h.metallicRoughnessTexture)),d.push(t.assignTexture(l,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,l)})))}i.doubleSided===!0&&(l.side=r.DoubleSide);const p=i.alphaMode||je.OPAQUE;if(p===je.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,p===je.MASK&&(l.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"normalMap",i.normalTexture)),l.normalScale=new r.Vector2(1,1),i.normalTexture.scale!==void 0)){const h=i.normalTexture.scale;l.normalScale.set(h,h)}if(i.occlusionTexture!==void 0&&o!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==r.MeshBasicMaterial){const h=i.emissiveFactor;l.emissive=new r.Color().setRGB(h[0],h[1],h[2],r.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==r.MeshBasicMaterial&&d.push(t.assignTexture(l,"emissiveMap",i.emissiveTexture,r.SRGBColorSpace)),Promise.all(d).then(function(){const h=new o(l);return i.name&&(h.name=i.name),Q(h,i),t.associations.set(h,{materials:e}),i.extensions&&ne(n,h,i),h})}createUniqueName(e){const t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(l){return s[L.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(c){return ct(c,l,t)})}const o=[];for(let l=0,c=e.length;l<c;l++){const d=e[l],p=Xn(d),h=n[p];if(h)o.push(h.promise);else{let f;d.extensions&&d.extensions[L.KHR_DRACO_MESH_COMPRESSION]?f=i(d):f=ct(new r.BufferGeometry,d,t),n[p]={primitive:d,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,l=[];for(let c=0,d=o.length;c<d;c++){const p=o[c].material===void 0?Bn(this.cache):this.getDependency("material",o[c].material);l.push(p)}return l.push(t.loadGeometries(o)),Promise.all(l).then(function(c){const d=c.slice(0,c.length-1),p=c[c.length-1],h=[];for(let m=0,g=p.length;m<g;m++){const y=p[m],_=o[m];let b;const x=d[m];if(_.mode===z.TRIANGLES||_.mode===z.TRIANGLE_STRIP||_.mode===z.TRIANGLE_FAN||_.mode===void 0)b=i.isSkinnedMesh===!0?new r.SkinnedMesh(y,x):new r.Mesh(y,x),b.isSkinnedMesh===!0&&b.normalizeSkinWeights(),_.mode===z.TRIANGLE_STRIP?b.geometry=tt(b.geometry,r.TriangleStripDrawMode):_.mode===z.TRIANGLE_FAN&&(b.geometry=tt(b.geometry,r.TriangleFanDrawMode));else if(_.mode===z.LINES)b=new r.LineSegments(y,x);else if(_.mode===z.LINE_STRIP)b=new r.Line(y,x);else if(_.mode===z.LINE_LOOP)b=new r.LineLoop(y,x);else if(_.mode===z.POINTS)b=new r.Points(y,x);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(b.geometry.morphAttributes).length>0&&zn(b,i),b.name=t.createUniqueName(i.name||"mesh_"+e),Q(b,i),_.extensions&&ne(n,b,_),t.assignFinalMaterial(b),h.push(b)}for(let m=0,g=h.length;m<g;m++)t.associations.set(h[m],{meshes:e,primitives:m});if(h.length===1)return i.extensions&&ne(n,h[0],i),h[0];const f=new r.Group;i.extensions&&ne(n,f,i),t.associations.set(f,{meshes:e});for(let m=0,g=h.length;m<g;m++)f.add(h[m]);return f})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),Q(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,l=[],c=[];for(let d=0,p=o.length;d<p;d++){const h=o[d];if(h){l.push(h);const f=new r.Matrix4;i!==null&&f.fromArray(i.array,d*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new r.Skeleton(l,c)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],l=[],c=[],d=[],p=[];for(let h=0,f=n.channels.length;h<f;h++){const m=n.channels[h],g=n.samplers[m.sampler],y=m.target,_=y.node,b=n.parameters!==void 0?n.parameters[g.input]:g.input,x=n.parameters!==void 0?n.parameters[g.output]:g.output;y.node!==void 0&&(o.push(this.getDependency("node",_)),l.push(this.getDependency("accessor",b)),c.push(this.getDependency("accessor",x)),d.push(g),p.push(y))}return Promise.all([Promise.all(o),Promise.all(l),Promise.all(c),Promise.all(d),Promise.all(p)]).then(function(h){const f=h[0],m=h[1],g=h[2],y=h[3],_=h[4],b=[];for(let S=0,A=f.length;S<A;S++){const C=f[S],P=m[S],D=g[S],q=y[S],R=_[S];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const se=s._createAnimationTracks(C,P,D,q,R);if(se)for(let Y=0;Y<se.length;Y++)b.push(se[Y])}const x=new r.AnimationClip(i,void 0,b);return Q(x,n),x})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(l){if(l.isMesh)for(let c=0,d=n.weights.length;c<d;c++)l.morphTargetInfluences[c]=n.weights[c]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],l=n.children||[];for(let d=0,p=l.length;d<p;d++)o.push(s.getDependency("node",l[d]));const c=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),c]).then(function(d){const p=d[0],h=d[1],f=d[2];f!==null&&p.traverse(function(m){m.isSkinnedMesh&&m.bind(f,Kn)});for(let m=0,g=h.length;m<g;m++)p.add(h[m]);if(p.userData.pivot!==void 0&&h.length>0){const m=p.userData.pivot,g=h[0];p.pivot=new r.Vector3().fromArray(m),p.position.x-=m[0],p.position.y-=m[1],p.position.z-=m[2],g.position.set(0,0,0),delete p.userData.pivot}return p})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",l=[],c=n._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return c&&l.push(c),i.camera!==void 0&&l.push(n.getDependency("camera",i.camera).then(function(d){return n._getNodeRef(n.cameraCache,i.camera,d)})),n._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){l.push(d)}),this.nodeCache[e]=Promise.all(l).then(function(d){let p;if(i.isBone===!0?p=new r.Bone:d.length>1?p=new r.Group:d.length===1?p=d[0]:p=new r.Object3D,p!==d[0])for(let h=0,f=d.length;h<f;h++)p.add(d[h]);if(i.name&&(p.userData.name=i.name,p.name=o),Q(p,i),i.extensions&&ne(s,p,i),i.matrix!==void 0){const h=new r.Matrix4;h.fromArray(i.matrix),p.applyMatrix4(h)}else i.translation!==void 0&&p.position.fromArray(i.translation),i.rotation!==void 0&&p.quaternion.fromArray(i.rotation),i.scale!==void 0&&p.scale.fromArray(i.scale);if(!n.associations.has(p))n.associations.set(p,{});else if(i.mesh!==void 0&&n.meshCache.refs[i.mesh]>1){const h=n.associations.get(p);n.associations.set(p,{...h})}return n.associations.get(p).nodes=e,p}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new r.Group;s.name&&(i.name=n.createUniqueName(s.name)),Q(i,s),s.extensions&&ne(t,i,s);const o=s.nodes||[],l=[];for(let c=0,d=o.length;c<d;c++)l.push(n.getDependency("node",o[c]));return Promise.all(l).then(function(c){for(let p=0,h=c.length;p<h;p++){const f=c[p];f.parent!==null?i.add(un(f)):i.add(f)}const d=p=>{const h=new Map;for(const[f,m]of n.associations)(f instanceof r.Material||f instanceof r.Texture)&&h.set(f,m);return p.traverse(f=>{const m=n.associations.get(f);m!=null&&h.set(f,m)}),h};return n.associations=d(i),i})}_createAnimationTracks(e,t,s,n,i){const o=[],l=e.name?e.name:e.uuid,c=[];function d(m){m.morphTargetInfluences&&c.push(m.name?m.name:m.uuid)}J[i.path]===J.weights?(d(e),e.isGroup&&e.children.forEach(d)):c.push(l);let p;switch(J[i.path]){case J.weights:p=r.NumberKeyframeTrack;break;case J.rotation:p=r.QuaternionKeyframeTrack;break;case J.translation:case J.scale:p=r.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:p=r.NumberKeyframeTrack;break;case 2:case 3:default:p=r.VectorKeyframeTrack;break}break}const h=n.interpolation!==void 0?Gn[n.interpolation]:r.InterpolateLinear,f=this._getArrayFromAccessor(s);for(let m=0,g=c.length;m<g;m++){const y=new p(c[m]+"."+J[i.path],t.array,f,h);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),o.push(y)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=Ge(t.constructor),n=new Float32Array(t.length);for(let i=0,o=t.length;i<o;i++)n[i]=t[i]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof r.QuaternionKeyframeTrack?Fn:rt;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Qn(a,e,t){const s=e.attributes,n=new r.Box3;if(s.POSITION!==void 0){const l=t.json.accessors[s.POSITION],c=l.min,d=l.max;if(c!==void 0&&d!==void 0){if(n.set(new r.Vector3(c[0],c[1],c[2]),new r.Vector3(d[0],d[1],d[2])),l.normalized){const p=Ge(oe[l.componentType]);n.min.multiplyScalar(p),n.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const l=new r.Vector3,c=new r.Vector3;for(let d=0,p=i.length;d<p;d++){const h=i[d];if(h.POSITION!==void 0){const f=t.json.accessors[h.POSITION],m=f.min,g=f.max;if(m!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(m[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(m[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(m[2]),Math.abs(g[2]))),f.normalized){const y=Ge(oe[f.componentType]);c.multiplyScalar(y)}l.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(l)}a.boundingBox=n;const o=new r.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,a.boundingSphere=o}function ct(a,e,t){const s=e.attributes,n=[];function i(o,l){return t.getDependency("accessor",o).then(function(c){a.setAttribute(l,c)})}for(const o in s){const l=Ve[o]||o.toLowerCase();l in a.attributes||n.push(i(s[o],l))}if(e.indices!==void 0&&!a.index){const o=t.getDependency("accessor",e.indices).then(function(l){a.setIndex(l)});n.push(o)}return r.ColorManagement.workingColorSpace!==r.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${r.ColorManagement.workingColorSpace}" not supported.`),Q(a,e),Qn(a,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Un(a,e.targets,t):a})}function Rn(){const a=new T.BoxGeometry(1,1,1),e=new T.MeshStandardMaterial({color:43775}),t=new T.Mesh(a,e);return t.position.y=.5,t.userData.isMovable=!0,t.name="正方体",be(t,!0),t}function qn(){const a=new T.SphereGeometry(.6,32,32),e=new T.MeshStandardMaterial({color:16746496}),t=new T.Mesh(a,e);return t.position.y=.6,t.userData.isMovable=!0,t.name="球体",be(t,!0),t}function Wn(a){return new Promise((e,t)=>{var o;const s=(o=a.name.split(".").pop())==null?void 0:o.toLowerCase(),n=URL.createObjectURL(a);let i;if(s==="obj")i=new dn;else if(s==="gltf"||s==="glb")i=new pn;else{t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));return}i.load(n,l=>{const c=s==="gltf"||s==="glb"?l.scene:l;c.traverse(h=>{var f;h.userData.isMovable=!0,h.name||(h.name=h.type),h.type==="Mesh"&&(h.frustumCulled=!0,(f=h.geometry)==null||f.computeVertexNormals())});const p=new T.Box3().setFromObject(c).getCenter(new T.Vector3);c.position.sub(p),be(c,!0),e(c)},void 0,l=>t(l))})}function $n(a){switch(a){case"box":Rn();break;case"sphere":qn();break}}const Jn={key:1,class:"toggle-placeholder"},En={class:"tree-icon"},Hn={class:"tree-name"},es={key:0,class:"tree-children"},ts=u.defineComponent({__name:"TreeItem",props:{node:{},selectedObject:{},version:{}},emits:["select","delete"],setup(a,{emit:e}){const t=a,s=e,n=u.ref(null),{expandedSet:i,toggleExpand:o}=u.inject("treeExpand"),l=u.computed(()=>i.value.has(t.node.uuid)),c=u.computed(()=>(t.version,t.node.children.some(y=>y.userData.isMovable===!0))),d=u.computed(()=>(t.version,t.node.children.filter(y=>y.userData.isMovable===!0))),p=u.computed(()=>{var y;return((y=t.selectedObject)==null?void 0:y.uuid)===t.node.uuid});u.watchEffect(()=>{p.value&&n.value&&n.value.scrollIntoView({block:"nearest",behavior:"smooth"})},{flush:"post"});const h=y=>{y.stopPropagation(),s("select",t.node)},f=y=>{y.stopPropagation(),s("delete",t.node)},m=y=>y.type==="Mesh"||y.type==="Sprite"?"🟦":y.type==="Light"?"💡":"📦",g=y=>y.name||`${y.type} (${y.id})`;return(y,_)=>{const b=u.resolveComponent("TreeItem",!0);return u.openBlock(),u.createElementBlock("div",{class:"tree-node",ref_key:"nodeRef",ref:n},[u.createElementVNode("div",{class:u.normalizeClass(["tree-item",{selected:p.value}]),onClick:h},[c.value?(u.openBlock(),u.createElementBlock("span",{key:0,class:"toggle-icon",onClick:_[0]||(_[0]=u.withModifiers(x=>u.unref(o)(a.node.uuid),["stop"]))},u.toDisplayString(l.value?"▼":"▶"),1)):(u.openBlock(),u.createElementBlock("span",Jn)),u.createElementVNode("span",En,u.toDisplayString(m(a.node)),1),u.createElementVNode("span",Hn,u.toDisplayString(g(a.node)),1),u.createElementVNode("button",{class:"tree-delete",onClick:u.withModifiers(f,["stop"])},"×")],2),l.value&&c.value?(u.openBlock(),u.createElementBlock("div",es,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(d.value,x=>(u.openBlock(),u.createBlock(b,{key:x.uuid,node:x,"selected-object":a.selectedObject,version:a.version,onSelect:_[1]||(_[1]=S=>s("select",S)),onDelete:_[2]||(_[2]=S=>s("delete",S))},null,8,["node","selected-object","version"]))),128))])):u.createCommentVNode("",!0)],512)}}}),ue=(a,e)=>{const t=a.__vccOpts||a;for(const[s,n]of e)t[s]=n;return t},ht=ue(ts,[["__scopeId","data-v-5ad9c842"]]);function ns(a){const e=u.ref(new Set),t=n=>{const i=new Set(e.value);i.has(n)?i.delete(n):i.add(n),e.value=i},s=n=>{if(!n)return;const i=new Set(e.value);let o=n.parent;for(;o&&o.type!=="Scene";)i.add(o.uuid),o=o.parent;e.value=i};return u.watch(a,n=>{n&&s(n)},{immediate:!0}),{expandedSet:e,toggleExpand:t}}const ss={key:0,class:"property-panel"},is={class:"property-group tree-group"},os={class:"tree-container"},rs={key:0,class:"tree-empty"},as={class:"property-group"},ls={class:"row"},cs={class:"property-group"},hs={class:"row"},ds={class:"property-group"},us={class:"row"},ps={key:1,class:"property-panel empty"},dt=ue(u.defineComponent({__name:"PropertyPanel",props:{transform:{},treeData:{},selectedObject:{}},emits:["propertyChange","treeSelect","treeDelete"],setup(a,{emit:e}){const t=a,s=e,n=()=>s("propertyChange"),i=u.ref(0),o=u.toRef(t,"selectedObject"),{expandedSet:l,toggleExpand:c}=ns(o);u.provide("treeExpand",{expandedSet:l,toggleExpand:c});const d=p=>{i.value++,s("treeDelete",p)};return(p,h)=>a.transform?(u.openBlock(),u.createElementBlock("div",ss,[h[23]||(h[23]=u.createElementVNode("h3",null,"属性面板",-1)),u.createElementVNode("div",is,[h[10]||(h[10]=u.createElementVNode("label",null,"场景物体",-1)),u.createElementVNode("div",os,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(a.treeData,f=>(u.openBlock(),u.createBlock(ht,{key:f.uuid,node:f,"selected-object":a.selectedObject,version:i.value,onSelect:h[0]||(h[0]=m=>s("treeSelect",m)),onDelete:d},null,8,["node","selected-object","version"]))),128)),a.treeData.length===0?(u.openBlock(),u.createElementBlock("div",rs,"暂无物体")):u.createCommentVNode("",!0)])]),u.createElementVNode("div",as,[h[14]||(h[14]=u.createElementVNode("label",null,"位置",-1)),u.createElementVNode("div",ls,[h[11]||(h[11]=u.createElementVNode("span",null,"X:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[1]||(h[1]=f=>a.transform.position.x=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.position.x,void 0,{number:!0}]]),h[12]||(h[12]=u.createElementVNode("span",null,"Y:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[2]||(h[2]=f=>a.transform.position.y=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.position.y,void 0,{number:!0}]]),h[13]||(h[13]=u.createElementVNode("span",null,"Z:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[3]||(h[3]=f=>a.transform.position.z=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.position.z,void 0,{number:!0}]])])]),u.createElementVNode("div",cs,[h[18]||(h[18]=u.createElementVNode("label",null,"旋转 (弧度)",-1)),u.createElementVNode("div",hs,[h[15]||(h[15]=u.createElementVNode("span",null,"X:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[4]||(h[4]=f=>a.transform.rotation.x=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.rotation.x,void 0,{number:!0}]]),h[16]||(h[16]=u.createElementVNode("span",null,"Y:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[5]||(h[5]=f=>a.transform.rotation.y=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.rotation.y,void 0,{number:!0}]]),h[17]||(h[17]=u.createElementVNode("span",null,"Z:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[6]||(h[6]=f=>a.transform.rotation.z=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.rotation.z,void 0,{number:!0}]])])]),u.createElementVNode("div",ds,[h[22]||(h[22]=u.createElementVNode("label",null,"缩放",-1)),u.createElementVNode("div",us,[h[19]||(h[19]=u.createElementVNode("span",null,"X:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[7]||(h[7]=f=>a.transform.scale.x=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.scale.x,void 0,{number:!0}]]),h[20]||(h[20]=u.createElementVNode("span",null,"Y:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[8]||(h[8]=f=>a.transform.scale.y=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.scale.y,void 0,{number:!0}]]),h[21]||(h[21]=u.createElementVNode("span",null,"Z:",-1)),u.withDirectives(u.createElementVNode("input",{type:"number","onUpdate:modelValue":h[9]||(h[9]=f=>a.transform.scale.z=f),step:"0.01",onInput:n},null,544),[[u.vModelText,a.transform.scale.z,void 0,{number:!0}]])])])])):(u.openBlock(),u.createElementBlock("div",ps,[...h[24]||(h[24]=[u.createElementVNode("p",null,"未选中任何模型",-1)])]))}}),[["__scopeId","data-v-94ef5fd1"]]),fs={class:"top-bar"},ms={class:"left-section"},gs={class:"dropdown-menu"},ys={class:"dropdown-menu sub-menu"},_s={class:"dropdown-menu"},bs={class:"dropdown-menu sub-menu"},ws={class:"dropdown-menu"},Ms={class:"dropdown-menu"},xs={class:"dropdown-menu"},ut=ue(u.defineComponent({__name:"TopBar",emits:["addModel","importModel"],setup(a,{emit:e}){const t=u.ref(!1),s=u.ref(!1),n=u.ref(!1),i=u.ref(!1),o=u.ref(!1),l=u.ref(!1),c=u.ref(!1),d=e,p=u.ref(null),h=()=>{var Y;return(Y=p.value)==null?void 0:Y.click()},f=Y=>{const M=Y.target;M.files&&M.files.length>0&&(d("importModel",M.files[0]),M.value="")},m=()=>console.log("新建项目"),g=()=>console.log("保存场景"),y=()=>console.log("导出模型"),_=()=>console.log("撤销"),b=()=>console.log("重做"),x=()=>console.log("复制物体"),S=()=>console.log("删除物体"),A=()=>console.log("重置相机"),C=()=>console.log("切换网格"),P=()=>console.log("打开帮助"),D=()=>console.log("关于编辑器"),q=()=>console.log("打开项目"),R=()=>console.log("打开模型"),se=()=>console.log("打开场景");return(Y,M)=>(u.openBlock(),u.createElementBlock("div",fs,[u.createElementVNode("div",ms,[u.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:M[2]||(M[2]=V=>t.value=!0),onMouseleave:M[3]||(M[3]=V=>t.value=!1)},[M[17]||(M[17]=u.createElementVNode("button",{class:"menu-btn"},"文件",-1)),u.withDirectives(u.createElementVNode("div",gs,[u.createElementVNode("div",{class:"menu-item",onClick:m},"新建"),u.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:M[0]||(M[0]=V=>l.value=!0),onMouseleave:M[1]||(M[1]=V=>l.value=!1)},[M[16]||(M[16]=u.createElementVNode("span",null,"打开",-1)),u.withDirectives(u.createElementVNode("div",ys,[u.createElementVNode("div",{class:"menu-item",onClick:q},"打开项目"),u.createElementVNode("div",{class:"menu-item",onClick:R},"打开模型"),u.createElementVNode("div",{class:"menu-item",onClick:se},"打开场景")],512),[[u.vShow,l.value]])],32),u.createElementVNode("div",{class:"menu-item",onClick:g},"保存"),u.createElementVNode("div",{class:"menu-item",onClick:y},"导出")],512),[[u.vShow,t.value]])],32),u.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:M[8]||(M[8]=V=>o.value=!0),onMouseleave:M[9]||(M[9]=V=>o.value=!1)},[M[19]||(M[19]=u.createElementVNode("button",{class:"menu-btn"},"添加",-1)),u.withDirectives(u.createElementVNode("div",_s,[u.createElementVNode("div",{class:"menu-item",onClick:_},"组"),u.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:M[6]||(M[6]=V=>c.value=!0),onMouseleave:M[7]||(M[7]=V=>c.value=!1)},[M[18]||(M[18]=u.createElementVNode("span",null,"网格",-1)),u.withDirectives(u.createElementVNode("div",bs,[u.createElementVNode("div",{class:"menu-item",onClick:M[4]||(M[4]=V=>d("addModel","box"))}," 正方体 "),u.createElementVNode("div",{class:"menu-item",onClick:M[5]||(M[5]=V=>d("addModel","sphere"))}," 球体 "),u.createElementVNode("div",{class:"menu-item",onClick:h},"导入")],512),[[u.vShow,c.value]])],32),u.createElementVNode("div",{class:"menu-item",onClick:x},"光源"),u.createElementVNode("div",{class:"menu-item",onClick:S},"摄像机")],512),[[u.vShow,o.value]])],32),u.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:M[10]||(M[10]=V=>s.value=!0),onMouseleave:M[11]||(M[11]=V=>s.value=!1)},[M[20]||(M[20]=u.createElementVNode("button",{class:"menu-btn"},"编辑",-1)),u.withDirectives(u.createElementVNode("div",ws,[u.createElementVNode("div",{class:"menu-item",onClick:_},"撤销"),u.createElementVNode("div",{class:"menu-item",onClick:b},"重做"),u.createElementVNode("div",{class:"menu-item",onClick:x},"复制"),u.createElementVNode("div",{class:"menu-item",onClick:S},"删除")],512),[[u.vShow,s.value]])],32),u.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:M[12]||(M[12]=V=>n.value=!0),onMouseleave:M[13]||(M[13]=V=>n.value=!1)},[M[21]||(M[21]=u.createElementVNode("button",{class:"menu-btn"},"视图",-1)),u.withDirectives(u.createElementVNode("div",Ms,[u.createElementVNode("div",{class:"menu-item",onClick:A},"重置相机"),u.createElementVNode("div",{class:"menu-item",onClick:C},"显示网格")],512),[[u.vShow,n.value]])],32),u.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:M[14]||(M[14]=V=>i.value=!0),onMouseleave:M[15]||(M[15]=V=>i.value=!1)},[M[22]||(M[22]=u.createElementVNode("button",{class:"menu-btn"},"帮助",-1)),u.withDirectives(u.createElementVNode("div",xs,[u.createElementVNode("div",{class:"menu-item",onClick:P},"使用帮助"),u.createElementVNode("div",{class:"menu-item",onClick:D},"关于")],512),[[u.vShow,i.value]])],32)]),M[23]||(M[23]=u.createElementVNode("div",{class:"right-section"},[u.createElementVNode("span",{class:"app-title"},"3D 模型编辑器")],-1)),u.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:p,accept:".obj,.gltf,.glb",style:{display:"none"},onChange:f},null,544)]))}}),[["__scopeId","data-v-6bb4762f"]]),Ss={class:"bottom-bar"},pt=ue(u.defineComponent({__name:"BottomBar",setup(a){return(e,t)=>(u.openBlock(),u.createElementBlock("div",Ss,[...t[0]||(t[0]=[u.createElementVNode("div",{class:"status-left"},[u.createElementVNode("span",null,"就绪")],-1),u.createElementVNode("div",{class:"status-right"},[u.createElementVNode("span",null,"顶点: 0 | 面: 0")],-1)])]))}}),[["__scopeId","data-v-3427bb27"]]),As={class:"app-layout"},Ps={class:"editor-container"},Ls=ue(u.defineComponent({__name:"DrawingBoard",setup(a){const e=u.ref(null),t=u.reactive({position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}),s=g=>{t.position.x=Number(g.position.x.toFixed(3)),t.position.y=Number(g.position.y.toFixed(3)),t.position.z=Number(g.position.z.toFixed(3)),t.rotation.x=Number(g.rotation.x.toFixed(3)),t.rotation.y=Number(g.rotation.y.toFixed(3)),t.rotation.z=Number(g.rotation.z.toFixed(3)),t.scale.x=Number(g.scale.x.toFixed(3)),t.scale.y=Number(g.scale.y.toFixed(3)),t.scale.z=Number(g.scale.z.toFixed(3))},n=g=>{g.position.set(t.position.x,t.position.y,t.position.z),g.rotation.set(t.rotation.x,t.rotation.y,t.rotation.z),g.scale.set(t.scale.x,t.scale.y,t.scale.z)};tn(g=>{e.value=g,g&&s(g)}),nn(g=>{s(g)});const i=()=>{e.value&&n(e.value)},o=g=>$n(g),l=async g=>{try{await Wn(g)}catch(y){console.error("导入失败:",y),alert("导入失败:"+y.message)}},c=u.shallowRef([]);sn(g=>{c.value=g});const d=()=>{const g=on();g&&(c.value=g)},p=g=>De(g),h=g=>Jt(g.uuid),f=u.ref(null),m=()=>{f.value&&Ut(f.value),d()};return u.onMounted(m),(g,y)=>(u.openBlock(),u.createElementBlock("div",As,[u.createVNode(ut,{onAddModel:o,onImportModel:l}),u.createElementVNode("div",Ps,[u.createElementVNode("div",{class:"canvas",ref_key:"containerRef",ref:f},null,512),u.createVNode(dt,{transform:t,"tree-data":c.value,"selected-object":e.value,onPropertyChange:i,onTreeSelect:p,onTreeDelete:h},null,8,["transform","tree-data","selected-object"])]),u.createVNode(pt)]))}}),[["__scopeId","data-v-a7595f5b"]]);B.BottomBar=pt,B.DrawingBoard=Ls,B.PropertyPanel=dt,B.TopBar=ut,B.TreeItem=ht,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
6
- //# sourceMappingURL=three-editor.umd.js.map