x||this.reportIntersection(o,D2,r,a,b)}}}}_intersectTrimesh(e,t,i,a,r,s){let o=N7,c=k7,l=U7,u=Ya,f=R7,h=F7,m=B7,v=I7,g=P7,x=e.indices;e.vertices;let p=this.from,d=this.to,w=this.direction;l.position.copy(i),l.quaternion.copy(t),N1.vectorToLocalFrame(i,t,w,f),N1.pointToLocalFrame(i,t,p,h),N1.pointToLocalFrame(i,t,d,m),m.x*=e.scale.x,m.y*=e.scale.y,m.z*=e.scale.z,h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,m.vsub(h,f),f.normalize();let b=h.distanceSquared(m);e.tree.rayQuery(this,l,c);for(let C=0,E=c.length;!this.result.shouldStop&&C!==E;C++){let T=c[C];e.getNormal(T,o),e.getVertex(x[T*3],Y2),Y2.vsub(h,u);let _=f.dot(o),P=o.dot(u)/_;if(P<0)continue;f.scale(P,D2),D2.vadd(h,D2),e.getVertex(x[T*3+1],ve),e.getVertex(x[T*3+2],ge);let F=D2.distanceSquared(h);!(Q1.pointInTriangle(D2,ve,Y2,ge)||Q1.pointInTriangle(D2,Y2,ve,ge))||F>b||(N1.vectorToWorldFrame(t,o,g),N1.pointToWorldFrame(i,t,D2,v),this.reportIntersection(g,v,r,a,T))}c.length=0}reportIntersection(e,t,i,a,r){let s=this.from,o=this.to,c=s.distanceTo(t),l=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(l.hitFaceIndex=typeof r!="undefined"?r:-1,this.mode){case Q1.ALL:this.hasHit=!0,l.set(s,o,e,t,i,a,c),l.hasHit=!0,this.callback(l);break;case Q1.CLOSEST:(c x||this.reportIntersection(o,D2,r,a,b)}}}}_intersectTrimesh(e,t,i,a,r,n){let o=N7,c=I7,l=U7,u=Ya,f=R7,h=F7,m=B7,g=k7,v=P7,x=e.indices;e.vertices;let p=this.from,d=this.to,w=this.direction;l.position.copy(i),l.quaternion.copy(t),N1.vectorToLocalFrame(i,t,w,f),N1.pointToLocalFrame(i,t,p,h),N1.pointToLocalFrame(i,t,d,m),m.x*=e.scale.x,m.y*=e.scale.y,m.z*=e.scale.z,h.x*=e.scale.x,h.y*=e.scale.y,h.z*=e.scale.z,m.vsub(h,f),f.normalize();let b=h.distanceSquared(m);e.tree.rayQuery(this,l,c);for(let C=0,E=c.length;!this.result.shouldStop&&C!==E;C++){let T=c[C];e.getNormal(T,o),e.getVertex(x[T*3],Y2),Y2.vsub(h,u);let _=f.dot(o),P=o.dot(u)/_;if(P<0)continue;f.scale(P,D2),D2.vadd(h,D2),e.getVertex(x[T*3+1],ve),e.getVertex(x[T*3+2],ge);let F=D2.distanceSquared(h);!(Q1.pointInTriangle(D2,ve,Y2,ge)||Q1.pointInTriangle(D2,Y2,ve,ge))||F>b||(N1.vectorToWorldFrame(t,o,v),N1.pointToWorldFrame(i,t,D2,g),this.reportIntersection(v,g,r,a,T))}c.length=0}reportIntersection(e,t,i,a,r){let n=this.from,o=this.to,c=n.distanceTo(t),l=this.result;if(!(this.skipBackfaces&&e.dot(this.direction)>0))switch(l.hitFaceIndex=typeof r!="undefined"?r:-1,this.mode){case Q1.ALL:this.hasHit=!0,l.set(n,o,e,t,i,a,c),l.hasHit=!0,this.callback(l);break;case Q1.CLOSEST:(c =0){let X=N[O];if(X===void 0&&(O==="instanceMatrix"&&z.instanceMatrix&&(X=z.instanceMatrix),O==="instanceColor"&&z.instanceColor&&(X=z.instanceColor)),X!==void 0){let Q=X.normalized,a1=X.itemSize,B=t.get(X);if(B===void 0)continue;let b1=B.buffer,u1=B.type,v1=B.bytesPerElement;if(X.isInterleavedBufferAttribute){let s1=X.data,T1=s1.stride,A1=X.offset;if(s1&&s1.isInstancedInterleavedBuffer){for(let z1=0;z1 0){let l=new h0(c.height/2);return l.fromEquirectangularTexture(n,s),e.set(s,l),s.addEventListener("dispose",a),t(l.texture,s.mapping)}else return null}}return s}function a(s){let o=s.target;o.removeEventListener("dispose",a);let c=e.get(o);c!==void 0&&(e.delete(o),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}var f0=class extends o4{constructor(e=-1,t=1,i=1,a=-1,r=.1,s=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=a,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,a,r,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=a,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,a=(this.top+this.bottom)/2,r=i-e,s=i+e,o=a+t,c=a-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,s=r+l*this.view.width,o-=u*this.view.offsetY,c=o-u*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};f0.prototype.isOrthographicCamera=!0;var h4=class extends ne{constructor(e){super(e);this.type="RawShaderMaterial"}};h4.prototype.isRawShaderMaterial=!0;var f4=4,Mt=8,Ae=Math.pow(2,Mt),To=[.125,.215,.35,.446,.526,.582],Ho=Mt-f4+1+To.length,d4=20,Di=new f0,{_lodPlanes:X4,_sizeLods:Vo,_sigmas:d0}=X9(),No=new x1,Ti=null,Bt=(1+Math.sqrt(5))/2,p4=1/Bt,Ro=[new k(1,1,1),new k(-1,1,1),new k(1,1,-1),new k(-1,1,-1),new k(0,Bt,p4),new k(0,Bt,-p4),new k(p4,0,Bt),new k(-p4,0,Bt),new k(Bt,p4,0),new k(-Bt,p4,0)],p0=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Z9(d4),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,a=100){Ti=this._renderer.getRenderTarget();let r=this._allocateTargets();return this._sceneToCubeUV(e,i,a,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=Po(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=Bo(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e-Q&&M1
i[o];)o++;l=i[o]===u,l||Nr(t,u)}}};function Nr(n,e){n.push((e&4294901760)>>16,e&65535)}var Rr=class{constructor(){this.data={keys:[]}}get(e,t){if(e>t){let i=t;t=e,e=i}return this.data[e+"-"+t]}set(e,t,i){if(e>t){let r=t;t=e,e=r}let a=e+"-"+t;this.get(e,t)||this.data.keys.push(a),this.data[a]=i}reset(){let e=this.data,t=e.keys;for(;t.length>0;){let i=t.pop();delete e[i]}}},l3=class extends K0{constructor(e={}){super();this.dt=void 0,this.allowSleep=void 0,this.contacts=void 0,this.frictionEquations=void 0,this.quatNormalizeSkip=void 0,this.quatNormalizeFast=void 0,this.time=void 0,this.stepnumber=void 0,this.default_dt=void 0,this.nextId=void 0,this.gravity=void 0,this.broadphase=void 0,this.bodies=void 0,this.hasActiveBodies=void 0,this.solver=void 0,this.constraints=void 0,this.narrowphase=void 0,this.collisionMatrix=void 0,this.collisionMatrixPrevious=void 0,this.bodyOverlapKeeper=void 0,this.shapeOverlapKeeper=void 0,this.materials=void 0,this.contactmaterials=void 0,this.contactMaterialTable=void 0,this.defaultMaterial=void 0,this.defaultContactMaterial=void 0,this.doProfiling=void 0,this.profile=void 0,this.accumulator=void 0,this.subsystems=void 0,this.addBodyEvent=void 0,this.removeBodyEvent=void 0,this.idToBodyMap=void 0,this.dt=-1,this.allowSleep=!!e.allowSleep,this.contacts=[],this.frictionEquations=[],this.quatNormalizeSkip=e.quatNormalizeSkip!==void 0?e.quatNormalizeSkip:0,this.quatNormalizeFast=e.quatNormalizeFast!==void 0?e.quatNormalizeFast:!1,this.time=0,this.stepnumber=0,this.default_dt=1/60,this.nextId=0,this.gravity=new y,e.gravity&&this.gravity.copy(e.gravity),this.broadphase=e.broadphase!==void 0?e.broadphase:new b6,this.bodies=[],this.hasActiveBodies=!1,this.solver=e.solver!==void 0?e.solver:new ir,this.constraints=[],this.narrowphase=new Dr(this),this.collisionMatrix=new $0,this.collisionMatrixPrevious=new $0,this.bodyOverlapKeeper=new c3,this.shapeOverlapKeeper=new c3,this.materials=[],this.contactmaterials=[],this.contactMaterialTable=new Rr,this.defaultMaterial=new Fe("default"),this.defaultContactMaterial=new Re(this.defaultMaterial,this.defaultMaterial,{friction:.3,restitution:0}),this.doProfiling=!1,this.profile={solve:0,makeContactConstraints:0,broadphase:0,integrate:0,narrowphase:0},this.accumulator=0,this.subsystems=[],this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.idToBodyMap={},this.broadphase.setWorld(this)}getContactMaterial(e,t){return this.contactMaterialTable.get(e.id,t.id)}numObjects(){return this.bodies.length}collisionMatrixTick(){let e=this.collisionMatrixPrevious;this.collisionMatrixPrevious=this.collisionMatrix,this.collisionMatrix=e,this.collisionMatrix.reset(),this.bodyOverlapKeeper.tick(),this.shapeOverlapKeeper.tick()}addConstraint(e){this.constraints.push(e)}removeConstraint(e){let t=this.constraints.indexOf(e);t!==-1&&this.constraints.splice(t,1)}rayTest(e,t,i){i instanceof y6?this.raycastClosest(e,t,{skipBackfaces:!0},i):this.raycastAll(e,t,{skipBackfaces:!0},i)}raycastAll(e,t,i={},a){return i.mode=Q1.ALL,i.from=e,i.to=t,i.callback=a,u3.intersectWorld(this,i)}raycastAny(e,t,i={},a){return i.mode=Q1.ANY,i.from=e,i.to=t,i.result=a,u3.intersectWorld(this,i)}raycastClosest(e,t,i={},a){return i.mode=Q1.CLOSEST,i.from=e,i.to=t,i.result=a,u3.intersectWorld(this,i)}addBody(e){this.bodies.includes(e)||(e.index=this.bodies.length,this.bodies.push(e),e.world=this,e.initPosition.copy(e.position),e.initVelocity.copy(e.velocity),e.timeLastSleepy=this.time,e instanceof i1&&(e.initAngularVelocity.copy(e.angularVelocity),e.initQuaternion.copy(e.quaternion)),this.collisionMatrix.setNumObjects(this.bodies.length),this.addBodyEvent.body=e,this.idToBodyMap[e.id]=e,this.dispatchEvent(this.addBodyEvent))}removeBody(e){e.world=null;let t=this.bodies.length-1,i=this.bodies,a=i.indexOf(e);if(a!==-1){i.splice(a,1);for(let r=0;r!==i.length;r++)i[r].index=r;this.collisionMatrix.setNumObjects(t),this.removeBodyEvent.body=e,delete this.idToBodyMap[e.id],this.dispatchEvent(this.removeBodyEvent)}}getBodyById(e){return this.idToBodyMap[e]}getShapeById(e){let t=this.bodies;for(let i=0;iDate.now()-n}var h9={type:"postStep"},f9={type:"preStep"},_4={type:i1.COLLIDE_EVENT_NAME,body:null,contact:null},d9=[],p9=[],m9=[],v9=[],Pe=[],Ie=[],E4={type:"beginContact",bodyA:null,bodyB:null},L4={type:"endContact",bodyA:null,bodyB:null},ke={type:"beginShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null},Ue={type:"endShapeContact",bodyA:null,bodyB:null,shapeA:null,shapeB:null};var q1=class{constructor(e=0,t=0,i=0,a=1){this.x=e,this.y=t,this.z=i,this.w=a}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,a){return this.x=e,this.y=t,this.z=i,this.w=a,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,a=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*a+s[12]*r,this.y=s[1]*t+s[5]*i+s[9]*a+s[13]*r,this.z=s[2]*t+s[6]*i+s[10]*a+s[14]*r,this.w=s[3]*t+s[7]*i+s[11]*a+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,a,r,s=.01,o=.1,c=e.elements,l=c[0],u=c[4],f=c[8],h=c[1],m=c[5],v=c[9],g=c[2],x=c[6],p=c[10];if(Math.abs(u-h)b&&w>C?wC?b>8&255]+p2[n>>16&255]+p2[n>>24&255]+"-"+p2[e&255]+p2[e>>8&255]+"-"+p2[e>>16&15|64]+p2[e>>24&255]+"-"+p2[t&63|128]+p2[t>>8&255]+"-"+p2[t>>16&255]+p2[t>>24&255]+p2[i&255]+p2[i>>8&255]+p2[i>>16&255]+p2[i>>24&255]).toUpperCase()}function T2(n,e,t){return Math.max(e,Math.min(t,n))}function Fr(n,e){return(n%e+e)%e}function L6(n,e,t){return(1-t)*n+t*e}function h3(n){return(n&n-1)==0&&n!==0}function Br(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}var Me=class{constructor(e=0,t=0,i=0,a=1){this._x=e,this._y=t,this._z=i,this._w=a}static slerp(e,t,i,a){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,a)}static slerpFlat(e,t,i,a,r,s,o){let c=i[a+0],l=i[a+1],u=i[a+2],f=i[a+3],h=r[s+0],m=r[s+1],v=r[s+2],g=r[s+3];if(o===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=f;return}if(o===1){e[t+0]=h,e[t+1]=m,e[t+2]=v,e[t+3]=g;return}if(f!==g||c!==h||l!==m||u!==v){let x=1-o,p=c*h+l*m+u*v+f*g,d=p>=0?1:-1,w=1-p*p;if(w>Number.EPSILON){let C=Math.sqrt(w),E=Math.atan2(C,p*d);x=Math.sin(x*E)/C,o=Math.sin(o*E)/C}let b=o*d;if(c=c*x+h*b,l=l*x+m*b,u=u*x+v*b,f=f*x+g*b,x===1-o){let C=1/Math.sqrt(c*c+l*l+u*u+f*f);c*=C,l*=C,u*=C,f*=C}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,a,r,s){let o=i[a],c=i[a+1],l=i[a+2],u=i[a+3],f=r[s],h=r[s+1],m=r[s+2],v=r[s+3];return e[t]=o*v+u*f+c*m-l*h,e[t+1]=c*v+u*h+l*f-o*m,e[t+2]=l*v+u*m+o*h-c*f,e[t+3]=u*v-o*f-c*h-l*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,a){return this._x=e,this._y=t,this._z=i,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let i=e._x,a=e._y,r=e._z,s=e._order,o=Math.cos,c=Math.sin,l=o(i/2),u=o(a/2),f=o(r/2),h=c(i/2),m=c(a/2),v=c(r/2);switch(s){case"XYZ":this._x=h*u*f+l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f-h*m*v;break;case"YXZ":this._x=h*u*f+l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f+h*m*v;break;case"ZXY":this._x=h*u*f-l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f-h*m*v;break;case"ZYX":this._x=h*u*f-l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f+h*m*v;break;case"YZX":this._x=h*u*f+l*m*v,this._y=l*m*f+h*u*v,this._z=l*u*v-h*m*f,this._w=l*u*f-h*m*v;break;case"XZY":this._x=h*u*f-l*m*v,this._y=l*m*f-h*u*v,this._z=l*u*v+h*m*f,this._w=l*u*f+h*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,a=Math.sin(i);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],a=t[4],r=t[8],s=t[1],o=t[5],c=t[9],l=t[2],u=t[6],f=t[10],h=i+o+f;if(h>0){let m=.5/Math.sqrt(h+1);this._w=.25/m,this._x=(u-c)*m,this._y=(r-l)*m,this._z=(s-a)*m}else if(i>o&&i>f){let m=2*Math.sqrt(1+i-o-f);this._w=(u-c)/m,this._x=.25*m,this._y=(a+s)/m,this._z=(r+l)/m}else if(o>f){let m=2*Math.sqrt(1+o-i-f);this._w=(r-l)/m,this._x=(a+s)/m,this._y=.25*m,this._z=(c+u)/m}else{let m=2*Math.sqrt(1+f-i-o);this._w=(s-a)/m,this._x=(r+l)/m,this._y=(c+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Y3.subVectors(e,this.center);let t=Y3.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),a=(i-this.radius)*.5;this.center.add(Y3.multiplyScalar(a/i)),this.radius+=a}return this}union(e){return this.center.equals(e.center)===!0?q6.set(0,0,1).multiplyScalar(e.radius):q6.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(F8.copy(e.center).add(q6)),this.expandByPoint(F8.copy(e.center).sub(q6)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};var k1=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,a,r,s,o,c,l,u,f,h,m,v,g,x){let p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=a,p[1]=r,p[5]=s,p[9]=o,p[13]=c,p[2]=l,p[6]=u,p[10]=f,p[14]=h,p[3]=m,p[7]=v,p[11]=g,p[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new k1().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,a=1/Jt.setFromMatrixColumn(e,0).length(),r=1/Jt.setFromMatrixColumn(e,1).length(),s=1/Jt.setFromMatrixColumn(e,2).length();return t[0]=i[0]*a,t[1]=i[1]*a,t[2]=i[2]*a,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*s,t[9]=i[9]*s,t[10]=i[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,i=e.x,a=e.y,r=e.z,s=Math.cos(i),o=Math.sin(i),c=Math.cos(a),l=Math.sin(a),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){let h=s*u,m=s*f,v=o*u,g=o*f;t[0]=c*u,t[4]=-c*f,t[8]=l,t[1]=m+v*l,t[5]=h-g*l,t[9]=-o*c,t[2]=g-h*l,t[6]=v+m*l,t[10]=s*c}else if(e.order==="YXZ"){let h=c*u,m=c*f,v=l*u,g=l*f;t[0]=h+g*o,t[4]=v*o-m,t[8]=s*l,t[1]=s*f,t[5]=s*u,t[9]=-o,t[2]=m*o-v,t[6]=g+h*o,t[10]=s*c}else if(e.order==="ZXY"){let h=c*u,m=c*f,v=l*u,g=l*f;t[0]=h-g*o,t[4]=-s*f,t[8]=v+m*o,t[1]=m+v*o,t[5]=s*u,t[9]=g-h*o,t[2]=-s*l,t[6]=o,t[10]=s*c}else if(e.order==="ZYX"){let h=s*u,m=s*f,v=o*u,g=o*f;t[0]=c*u,t[4]=v*l-m,t[8]=h*l+g,t[1]=c*f,t[5]=g*l+h,t[9]=m*l-v,t[2]=-l,t[6]=o*c,t[10]=s*c}else if(e.order==="YZX"){let h=s*c,m=s*l,v=o*c,g=o*l;t[0]=c*u,t[4]=g-h*f,t[8]=v*f+m,t[1]=f,t[5]=s*u,t[9]=-o*u,t[2]=-l*u,t[6]=m*f+v,t[10]=h-g*f}else if(e.order==="XZY"){let h=s*c,m=s*l,v=o*c,g=o*l;t[0]=c*u,t[4]=-f,t[8]=l*u,t[1]=h*f+g,t[5]=s*u,t[9]=m*f-v,t[2]=v*f-m,t[6]=o*u,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(x9,e,M9)}lookAt(e,t,i){let a=this.elements;return P2.subVectors(e,t),P2.lengthSq()===0&&(P2.z=1),P2.normalize(),ft.crossVectors(i,P2),ft.lengthSq()===0&&(Math.abs(i.z)===1?P2.x+=1e-4:P2.z+=1e-4,P2.normalize(),ft.crossVectors(i,P2)),ft.normalize(),W6.crossVectors(P2,ft),a[0]=ft.x,a[4]=W6.x,a[8]=P2.x,a[1]=ft.y,a[5]=W6.y,a[9]=P2.y,a[2]=ft.z,a[6]=W6.z,a[10]=P2.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,a=t.elements,r=this.elements,s=i[0],o=i[4],c=i[8],l=i[12],u=i[1],f=i[5],h=i[9],m=i[13],v=i[2],g=i[6],x=i[10],p=i[14],d=i[3],w=i[7],b=i[11],C=i[15],E=a[0],T=a[4],_=a[8],P=a[12],F=a[1],M=a[5],D=a[9],z=a[13],H=a[2],V=a[6],L=a[10],N=a[14],U=a[3],Z=a[7],O=a[11],W=a[15];return r[0]=s*E+o*F+c*H+l*U,r[4]=s*T+o*M+c*V+l*Z,r[8]=s*_+o*D+c*L+l*O,r[12]=s*P+o*z+c*N+l*W,r[1]=u*E+f*F+h*H+m*U,r[5]=u*T+f*M+h*V+m*Z,r[9]=u*_+f*D+h*L+m*O,r[13]=u*P+f*z+h*N+m*W,r[2]=v*E+g*F+x*H+p*U,r[6]=v*T+g*M+x*V+p*Z,r[10]=v*_+g*D+x*L+p*O,r[14]=v*P+g*z+x*N+p*W,r[3]=d*E+w*F+b*H+C*U,r[7]=d*T+w*M+b*V+C*Z,r[11]=d*_+w*D+b*L+C*O,r[15]=d*P+w*z+b*N+C*W,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],a=e[8],r=e[12],s=e[1],o=e[5],c=e[9],l=e[13],u=e[2],f=e[6],h=e[10],m=e[14],v=e[3],g=e[7],x=e[11],p=e[15];return v*(+r*c*f-a*l*f-r*o*h+i*l*h+a*o*m-i*c*m)+g*(+t*c*m-t*l*h+r*s*h-a*s*m+a*l*u-r*c*u)+x*(+t*l*f-t*o*m-r*s*f+i*s*m+r*o*u-i*l*u)+p*(-a*o*u-t*c*f+t*o*h+a*s*f-i*s*h+i*c*u)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let a=this.elements;return e.isVector3?(a[12]=e.x,a[13]=e.y,a[14]=e.z):(a[12]=e,a[13]=t,a[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],a=e[2],r=e[3],s=e[4],o=e[5],c=e[6],l=e[7],u=e[8],f=e[9],h=e[10],m=e[11],v=e[12],g=e[13],x=e[14],p=e[15],d=f*x*l-g*h*l+g*c*m-o*x*m-f*c*p+o*h*p,w=v*h*l-u*x*l-v*c*m+s*x*m+u*c*p-s*h*p,b=u*g*l-v*f*l+v*o*m-s*g*m-u*o*p+s*f*p,C=v*f*c-u*g*c-v*o*h+s*g*h+u*o*x-s*f*x,E=t*d+i*w+a*b+r*C;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let T=1/E;return e[0]=d*T,e[1]=(g*h*r-f*x*r-g*a*m+i*x*m+f*a*p-i*h*p)*T,e[2]=(o*x*r-g*c*r+g*a*l-i*x*l-o*a*p+i*c*p)*T,e[3]=(f*c*r-o*h*r-f*a*l+i*h*l+o*a*m-i*c*m)*T,e[4]=w*T,e[5]=(u*x*r-v*h*r+v*a*m-t*x*m-u*a*p+t*h*p)*T,e[6]=(v*c*r-s*x*r-v*a*l+t*x*l+s*a*p-t*c*p)*T,e[7]=(s*h*r-u*c*r+u*a*l-t*h*l-s*a*m+t*c*m)*T,e[8]=b*T,e[9]=(v*f*r-u*g*r-v*i*m+t*g*m+u*i*p-t*f*p)*T,e[10]=(s*g*r-v*o*r+v*i*l-t*g*l-s*i*p+t*o*p)*T,e[11]=(u*o*r-s*f*r-u*i*l+t*f*l+s*i*m-t*o*m)*T,e[12]=C*T,e[13]=(u*g*a-v*f*a+v*i*h-t*g*h-u*i*x+t*f*x)*T,e[14]=(v*o*a-s*g*a-v*i*c+t*g*c+s*i*x-t*o*x)*T,e[15]=(s*f*a-u*o*a+u*i*c-t*f*c-s*i*h+t*o*h)*T,this}scale(e){let t=this.elements,i=e.x,a=e.y,r=e.z;return t[0]*=i,t[4]*=a,t[8]*=r,t[1]*=i,t[5]*=a,t[9]*=r,t[2]*=i,t[6]*=a,t[10]*=r,t[3]*=i,t[7]*=a,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],a=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,a))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),a=Math.sin(t),r=1-i,s=e.x,o=e.y,c=e.z,l=r*s,u=r*o;return this.set(l*s+i,l*o-a*c,l*c+a*o,0,l*o+a*c,u*o+i,u*c-a*s,0,l*c-a*o,u*c+a*s,r*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,a,r,s){return this.set(1,i,r,0,e,1,s,0,t,a,1,0,0,0,0,1),this}compose(e,t,i){let a=this.elements,r=t._x,s=t._y,o=t._z,c=t._w,l=r+r,u=s+s,f=o+o,h=r*l,m=r*u,v=r*f,g=s*u,x=s*f,p=o*f,d=c*l,w=c*u,b=c*f,C=i.x,E=i.y,T=i.z;return a[0]=(1-(g+p))*C,a[1]=(m+b)*C,a[2]=(v-w)*C,a[3]=0,a[4]=(m-b)*E,a[5]=(1-(h+p))*E,a[6]=(x+d)*E,a[7]=0,a[8]=(v+w)*T,a[9]=(x-d)*T,a[10]=(1-(h+g))*T,a[11]=0,a[12]=e.x,a[13]=e.y,a[14]=e.z,a[15]=1,this}decompose(e,t,i){let a=this.elements,r=Jt.set(a[0],a[1],a[2]).length(),s=Jt.set(a[4],a[5],a[6]).length(),o=Jt.set(a[8],a[9],a[10]).length();this.determinant()<0&&(r=-r),e.x=a[12],e.y=a[13],e.z=a[14],ee.copy(this);let l=1/r,u=1/s,f=1/o;return ee.elements[0]*=l,ee.elements[1]*=l,ee.elements[2]*=l,ee.elements[4]*=u,ee.elements[5]*=u,ee.elements[6]*=u,ee.elements[8]*=f,ee.elements[9]*=f,ee.elements[10]*=f,t.setFromRotationMatrix(ee),i.x=r,i.y=s,i.z=o,this}makePerspective(e,t,i,a,r,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let o=this.elements,c=2*r/(t-e),l=2*r/(i-a),u=(t+e)/(t-e),f=(i+a)/(i-a),h=-(s+r)/(s-r),m=-2*s*r/(s-r);return o[0]=c,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=f,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,i,a,r,s){let o=this.elements,c=1/(t-e),l=1/(i-a),u=1/(s-r),f=(t+e)*c,h=(i+a)*l,m=(s+r)*u;return o[0]=2*c,o[4]=0,o[8]=0,o[12]=-f,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let a=0;a<16;a++)if(t[a]!==i[a])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}};k1.prototype.isMatrix4=!0;var Jt=new k,ee=new k1,x9=new k(0,0,0),M9=new k(1,1,1),ft=new k,W6=new k,P2=new k;var B8=new k1,P8=new Me,dt=class{constructor(e=0,t=0,i=0,a=dt.DefaultOrder){this._x=e,this._y=t,this._z=i,this._order=a}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,a=this._order){return this._x=e,this._y=t,this._z=i,this._order=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let a=e.elements,r=a[0],s=a[4],o=a[8],c=a[1],l=a[5],u=a[9],f=a[2],h=a[6],m=a[10];switch(t){case"XYZ":this._y=Math.asin(T2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-T2(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(T2(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,m),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-T2(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,m),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(T2(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,r)):(this._x=0,this._y=Math.atan2(o,m));break;case"XZY":this._z=Math.asin(-T2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return B8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(B8,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return P8.setFromEuler(this),this.setFromQuaternion(P8,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new k(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};dt.prototype.isEuler=!0;dt.DefaultOrder="XYZ";dt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var U4=class{constructor(){this.mask=1|0}set(e){this.mask=(1<0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let i=this.geometry,a=this.material,r=this.matrixWorld;if(a===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),ni.copy(i.boundingSphere),ni.applyMatrix4(r),e.ray.intersectsSphere(ni)===!1)||(W8.copy(r).invert(),r4.copy(e.ray).applyMatrix4(W8),i.boundingBox!==null&&r4.intersectsBox(i.boundingBox)===!1))return;let s;if(i.isBufferGeometry){let o=i.index,c=i.attributes.position,l=i.morphAttributes.position,u=i.morphTargetsRelative,f=i.attributes.uv,h=i.attributes.uv2,m=i.groups,v=i.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,x=m.length;g-Q&&b1