@smoud/tiny
Version:
Fast and tiny JavaScript library for HTML5 game and playable ads creation.
1 lines • 583 kB
JavaScript
!function(){var t={613:function(t,e,n){var i=n(212),r=i.Sprite,a=i.SpriteMaterial,o=i.CanvasTexture,s=i.sRGBEncoding,c=i.LinearFilter;Tiny.Canvas2D=class extends r{constructor(t,e){const n=new Tiny.CanvasRenderer(t,e,{transparent:!0}),i=new o(n.domElement);i.encoding=s,i.minFilter=c;super(new a({map:i})),this.width=t,this.height=e,this.autoUpdate=!1,this.renderer=n;const r=this.container=new Tiny.Scene;this.texture=i,this.add=r.add.bind(r),this.remove=r.remove.bind(r)}onBeforeRender(){this.autoUpdate&&this.update()}update(){this.renderer.render(this.container),this.texture.needsUpdate=!0}}},547:function(t,e,n){var i=n(212),r=i.Mesh,a=i.MeshBasicMaterial,o=i.CanvasTexture,s=i.sRGBEncoding,c=i.LinearFilter,u=i.PlaneBufferGeometry,h=null;Tiny.Canvas3D=class extends r{constructor(t,e){const n=new Tiny.CanvasRenderer(t,e,{transparent:!0}),i=new o(n.domElement);i.encoding=s,i.minFilter=c;const r=new a({map:i,transparent:!0});null==h&&(h=new u(1,1)),super(h,r),this.width=t,this.height=e,this.autoUpdate=!1,this.renderer=n;const l=this.container=new Tiny.Scene;this.texture=i,this.add=l.add.bind(l),this.remove=l.remove.bind(l)}onBeforeRender(){this.autoUpdate&&this.update()}update(){this.renderer.render(this.container),this.texture.needsUpdate=!0}}},362:function(t,e,n){var i=n(212),r=i.Scene,a=i.OrthographicCamera;class o extends Tiny.Canvas2D{constructor(t,e){super(t,e),this.autoUpdate=!0,this.scene=new r,this.camera=new a(-this.width/2,this.width/2,this.height/2,-this.height/2,1,10),this.scale.set(this.width,this.height,1),this.camera.position.z=1,this.scene.add(this)}setSize(t,e){this.renderer.resize(t,e),this.width=t,this.height=e,this.camera.left=-this.width/2,this.camera.right=this.width/2,this.camera.top=this.height/2,this.camera.bottom=-this.height/2,this.camera.updateProjectionMatrix(),this.scale.set(this.width,this.height,1)}}Tiny.Screen2D=o},478:function(t,e,n){var i=n(212),r=i.Mesh,a=i.MeshBasicMaterial,o=i.CanvasTexture,s=i.sRGBEncoding,c=i.LinearFilter,u=i.PlaneBufferGeometry;Tiny.Text3D=class extends r{constructor(t,e){(e=e||{}).size=e.size||1;const n=new Tiny.Text(t,e),i=new o(n.canvas);i.encoding=s,i.minFilter=c;const r=new a({map:i,transparent:!0});super(new u(1,1),r);const h=Math.max(n.width,n.height);this.scale.set(e.size*n.width/h,e.size*n.height/h,1),this.size=e.size,this.text=n,this.texture=i}setText(t){const e=this.text;e.setText(t),e.updateText();const n=Math.max(e.width,e.height);this.scale.set(this.size*e.width/n,this.size*e.height/n,1),this.texture.needsUpdate=!0}}},818:function(t,e,n){var i=n(212),r=i.Vector3,a=i.Box3,o=i.Raycaster;const s=new a,c=new r(1,1,1),u=new r;var h={init:function(){this.raycaster=new o},preHandle:function(t,e){this.game.camera&&(u.set(t/this.game.width*2-1,-e/this.game.height*2+1,0),this.raycaster.setFromCamera(u,this.game.camera))}};Tiny.Input.systems.push(h),Tiny.Input.checkBounds3D=function(t,e,n){if(t.input.hitBox?c.copy(t.input.hitBox):t.getWorldScale(c),s.setFromCenterAndSize(t.position,c),this.raycaster.ray.intersectsBox(s))return!0},Tiny.Input.prototype.add3d=function(t,e){(e=e||{}).checkBounds=Tiny.Input.checkBounds3D,this.add(t,e)}},883:function(t,e,n){var i=n(212),r=i.LoadingManager,a=i.Texture,o=i.sRGBEncoding,s=null;Tiny.Cache.gltf={},Tiny.Cache.texture3d={},Tiny.Cache.mesh3d={},Tiny.Cache.animation3d={},Tiny.Loader.prototype.gltf=function(t,e,n,i){this.list.push({key:t,src:e,type:"gltf",split:n,cb:i})},Tiny.Loader.prototype.texture3d=function(t,e,n){this.list.push({key:t,src:e,type:"texture3d",cb:n})},Tiny.Loader.gltf=function(t,e){var n=t.key;if(null==s){var i=new r;s=new window.GLTFLoader(i)}function a(i){if(Tiny.Cache.gltf[n]=i,t.split){i.scene.traverse((function(t){t.isMesh&&(Tiny.Cache.mesh3d[n+"."+t.name]=t)}));for(var r=0;r<i.animations.length;r++){var a=i.animations[r];Tiny.Cache.animation3d[n+"."+a.name]=a}}t.cb&&t.cb(i),e()}t.src.length>200?s.parse(t.src,"",a):s.load(t.src,a)},Tiny.Loader.texture3d=function(t,e){var n=t.key;Tiny.Loader.image(t,(function(t,i){var r=new a(i);r.encoding=o,r.flipY=!1,r.needsUpdate=!0,r.key=n,Tiny.Cache.texture3d[t.key]=r,e()}))}},212:function(t,e,n){"use strict";n.r(e),n.d(e,{ACESFilmicToneMapping:function(){return ct},AddEquation:function(){return E},AddOperation:function(){return nt},AdditiveBlending:function(){return A},AlphaFormat:function(){return kt},AlwaysDepth:function(){return X},AlwaysStencilFunc:function(){return ln},AmbientLight:function(){return nl},AmbientLightProbe:function(){return Tl},AnimationClip:function(){return uh},AnimationLoader:function(){return gh},AnimationMixer:function(){return ip},AnimationObjectGroup:function(){return ep},AnimationUtils:function(){return Ju},ArcCurve:function(){return Th},ArrayCamera:function(){return _s},ArrowHelper:function(){return qp},Audio:function(){return zl},AudioAnalyser:function(){return Vl},AudioContext:function(){return _l},AudioListener:function(){return Nl},AudioLoader:function(){return bl},AxesHelper:function(){return Xp},AxisHelper:function(){return nd},BackSide:function(){return g},BasicDepthPacking:function(){return He},BasicShadowMap:function(){return p},BinaryTextureLoader:function(){return sd},Bone:function(){return Qs},BooleanKeyframeTrack:function(){return nh},BoundingBoxHelper:function(){return id},Box2:function(){return pp},Box3:function(){return Ti},Box3Helper:function(){return Vp},BoxBufferGeometry:function(){return na},BoxGeometry:function(){return ea},BoxHelper:function(){return Gp},BufferAttribute:function(){return hr},BufferGeometry:function(){return Pr},BufferGeometryLoader:function(){return cl},ByteType:function(){return Ot},Cache:function(){return lh},Camera:function(){return ua},CameraHelper:function(){return Fp},CanvasRenderer:function(){return ud},CanvasTexture:function(){return Sc},CatmullRomCurve3:function(){return Oh},CineonToneMapping:function(){return st},CircleBufferGeometry:function(){return Fu},CircleGeometry:function(){return Ru},ClampToEdgeWrapping:function(){return yt},Clock:function(){return Pl},ClosedSplineCurve3:function(){return $f},Color:function(){return er},ColorKeyframeTrack:function(){return ih},CompressedTexture:function(){return wc},CompressedTextureLoader:function(){return yh},ConeBufferGeometry:function(){return zu},ConeGeometry:function(){return Nu},CubeCamera:function(){return fa},CubeGeometry:function(){return ea},CubeReflectionMapping:function(){return ht},CubeRefractionMapping:function(){return lt},CubeTexture:function(){return Fa},CubeTextureLoader:function(){return bh},CubeUVReflectionMapping:function(){return mt},CubeUVRefractionMapping:function(){return vt},CubicBezierCurve:function(){return zh},CubicBezierCurve3:function(){return Rh},CubicInterpolant:function(){return Qu},CullFaceBack:function(){return s},CullFaceFront:function(){return c},CullFaceFrontBack:function(){return u},CullFaceNone:function(){return o},Curve:function(){return wh},CurvePath:function(){return jh},CustomBlending:function(){return P},CylinderBufferGeometry:function(){return Iu},CylinderGeometry:function(){return Du},Cylindrical:function(){return hp},DataTexture:function(){return ma},DataTexture2DArray:function(){return Ba},DataTexture3D:function(){return Ua},DataTextureLoader:function(){return xh},DecrementStencilOp:function(){return $e},DecrementWrapStencilOp:function(){return en},DefaultLoadingManager:function(){return fh},DepthFormat:function(){return Yt},DepthStencilFormat:function(){return Zt},DepthTexture:function(){return Tc},DirectionalLight:function(){return el},DirectionalLightHelper:function(){return Np},DirectionalLightShadow:function(){return tl},DiscreteInterpolant:function(){return th},DodecahedronBufferGeometry:function(){return Bc},DodecahedronGeometry:function(){return Fc},DoubleSide:function(){return y},DstAlphaFactor:function(){return V},DstColorFactor:function(){return j},DynamicBufferAttribute:function(){return jf},DynamicCopyUsage:function(){return xn},DynamicDrawUsage:function(){return fn},DynamicReadUsage:function(){return vn},EdgesGeometry:function(){return Ou},EdgesHelper:function(){return rd},EllipseCurve:function(){return Sh},EqualDepth:function(){return J},EqualStencilFunc:function(){return on},EquirectangularReflectionMapping:function(){return pt},EquirectangularRefractionMapping:function(){return ft},Euler:function(){return Zn},EventDispatcher:function(){return bn},ExtrudeBufferGeometry:function(){return gu},ExtrudeGeometry:function(){return vu},Face3:function(){return ar},Face4:function(){return Of},FaceColors:function(){return M},FileLoader:function(){return vh},FlatShading:function(){return x},Float32Attribute:function(){return Kf},Float32BufferAttribute:function(){return yr},Float64Attribute:function(){return Qf},Float64BufferAttribute:function(){return xr},FloatType:function(){return Rt},Fog:function(){return Ts},FogExp2:function(){return Ss},Font:function(){return gl},FontLoader:function(){return xl},FrontFaceDirectionCCW:function(){return l},FrontFaceDirectionCW:function(){return h},FrontSide:function(){return v},Frustum:function(){return ya},GammaEncoding:function(){return Ue},Geometry:function(){return ta},GeometryUtils:function(){return cd},GreaterDepth:function(){return Q},GreaterEqualDepth:function(){return K},GreaterEqualStencilFunc:function(){return hn},GreaterStencilFunc:function(){return cn},GridHelper:function(){return Pp},Group:function(){return bs},HalfFloatType:function(){return Ft},HemisphereLight:function(){return Xh},HemisphereLightHelper:function(){return Cp},HemisphereLightProbe:function(){return Sl},IcosahedronBufferGeometry:function(){return Rc},IcosahedronGeometry:function(){return zc},ImageBitmapLoader:function(){return ml},ImageLoader:function(){return _h},ImageUtils:function(){return In},ImmediateRenderObject:function(){return vp},IncrementStencilOp:function(){return Qe},IncrementWrapStencilOp:function(){return tn},InstancedBufferAttribute:function(){return sl},InstancedBufferGeometry:function(){return ol},InstancedInterleavedBuffer:function(){return ap},InstancedMesh:function(){return ic},Int16Attribute:function(){return Xf},Int16BufferAttribute:function(){return dr},Int32Attribute:function(){return Zf},Int32BufferAttribute:function(){return vr},Int8Attribute:function(){return Wf},Int8BufferAttribute:function(){return lr},IntType:function(){return Nt},InterleavedBuffer:function(){return As},InterleavedBufferAttribute:function(){return Ps},Interpolant:function(){return Ku},InterpolateDiscrete:function(){return Ce},InterpolateLinear:function(){return Pe},InterpolateSmooth:function(){return Ee},InvertStencilOp:function(){return nn},JSONLoader:function(){return hd},KeepStencilOp:function(){return Je},KeyframeTrack:function(){return eh},LOD:function(){return Xs},LatheBufferGeometry:function(){return Lu},LatheGeometry:function(){return Au},Layers:function(){return Jn},LensFlare:function(){return pd},LessDepth:function(){return Y},LessEqualDepth:function(){return Z},LessEqualStencilFunc:function(){return sn},LessStencilFunc:function(){return an},Light:function(){return qh},LightProbe:function(){return wl},LightShadow:function(){return Yh},Line:function(){return hc},Line3:function(){return mp},LineBasicMaterial:function(){return rc},LineCurve:function(){return Fh},LineCurve3:function(){return Bh},LineDashedMaterial:function(){return Yu},LineLoop:function(){return dc},LinePieces:function(){return If},LineSegments:function(){return fc},LineStrip:function(){return Df},LinearEncoding:function(){return Fe},LinearFilter:function(){return Tt},LinearInterpolant:function(){return $u},LinearMipMapLinearFilter:function(){return Pt},LinearMipMapNearestFilter:function(){return Lt},LinearMipmapLinearFilter:function(){return Ct},LinearMipmapNearestFilter:function(){return At},LinearToneMapping:function(){return rt},Loader:function(){return dh},LoaderUtils:function(){return al},LoadingManager:function(){return ph},LogLuvEncoding:function(){return Ve},LoopOnce:function(){return Te},LoopPingPong:function(){return Le},LoopRepeat:function(){return Ae},LuminanceAlphaFormat:function(){return qt},LuminanceFormat:function(){return Ht},MOUSE:function(){return r},Material:function(){return sr},MaterialLoader:function(){return rl},Math:function(){return Sn},Matrix3:function(){return Dn},Matrix4:function(){return qn},MaxEquation:function(){return N},Mesh:function(){return Xr},MeshBasicMaterial:function(){return cr},MeshDepthMaterial:function(){return hs},MeshDistanceMaterial:function(){return ls},MeshFaceMaterial:function(){return Nf},MeshLambertMaterial:function(){return qu},MeshMatcapMaterial:function(){return Xu},MeshNormalMaterial:function(){return Hu},MeshPhongMaterial:function(){return ju},MeshPhysicalMaterial:function(){return ku},MeshStandardMaterial:function(){return Vu},MeshToonMaterial:function(){return Wu},MinEquation:function(){return I},MirroredRepeatWrapping:function(){return xt},MixOperation:function(){return et},MultiMaterial:function(){return zf},MultiplyBlending:function(){return C},MultiplyOperation:function(){return tt},NearestFilter:function(){return _t},NearestMipMapLinearFilter:function(){return St},NearestMipMapNearestFilter:function(){return Mt},NearestMipmapLinearFilter:function(){return wt},NearestMipmapNearestFilter:function(){return bt},NeverDepth:function(){return q},NeverStencilFunc:function(){return rn},NoBlending:function(){return S},NoColors:function(){return b},NoToneMapping:function(){return it},NormalBlending:function(){return T},NotEqualDepth:function(){return $},NotEqualStencilFunc:function(){return un},NumberKeyframeTrack:function(){return rh},Object3D:function(){return hi},ObjectLoader:function(){return hl},ObjectSpaceNormalMap:function(){return Ye},OctahedronBufferGeometry:function(){return Nc},OctahedronGeometry:function(){return Ic},OneFactor:function(){return R},OneMinusDstAlphaFactor:function(){return k},OneMinusDstColorFactor:function(){return W},OneMinusSrcAlphaFactor:function(){return G},OneMinusSrcColorFactor:function(){return B},OrthographicCamera:function(){return $h},PCFShadowMap:function(){return f},PCFSoftShadowMap:function(){return d},PMREMGenerator:function(){return yf},ParametricBufferGeometry:function(){return Cc},ParametricGeometry:function(){return Lc},Particle:function(){return Ff},ParticleBasicMaterial:function(){return Gf},ParticleSystem:function(){return Bf},ParticleSystemMaterial:function(){return Vf},Path:function(){return Wh},PerspectiveCamera:function(){return ha},Plane:function(){return Gi},PlaneBufferGeometry:function(){return Ta},PlaneGeometry:function(){return Sa},PlaneHelper:function(){return kp},PointCloud:function(){return Rf},PointCloudMaterial:function(){return Uf},PointLight:function(){return Qh},PointLightHelper:function(){return Sp},Points:function(){return _c},PointsMaterial:function(){return mc},PolarGridHelper:function(){return Ep},PolyhedronBufferGeometry:function(){return Ec},PolyhedronGeometry:function(){return Pc},PositionalAudio:function(){return Gl},PropertyBinding:function(){return tp},PropertyMixer:function(){return kl},QuadraticBezierCurve:function(){return Uh},QuadraticBezierCurve3:function(){return Gh},Quaternion:function(){return An},QuaternionKeyframeTrack:function(){return oh},QuaternionLinearInterpolant:function(){return ah},REVISION:function(){return i},RGBADepthPacking:function(){return qe},RGBAFormat:function(){return Wt},RGBAIntegerFormat:function(){return ee},RGBA_ASTC_10x10_Format:function(){return Me},RGBA_ASTC_10x5_Format:function(){return xe},RGBA_ASTC_10x6_Format:function(){return _e},RGBA_ASTC_10x8_Format:function(){return be},RGBA_ASTC_12x10_Format:function(){return we},RGBA_ASTC_12x12_Format:function(){return Se},RGBA_ASTC_4x4_Format:function(){return le},RGBA_ASTC_5x4_Format:function(){return pe},RGBA_ASTC_5x5_Format:function(){return fe},RGBA_ASTC_6x5_Format:function(){return de},RGBA_ASTC_6x6_Format:function(){return me},RGBA_ASTC_8x5_Format:function(){return ve},RGBA_ASTC_8x6_Format:function(){return ge},RGBA_ASTC_8x8_Format:function(){return ye},RGBA_PVRTC_2BPPV1_Format:function(){return ue},RGBA_PVRTC_4BPPV1_Format:function(){return ce},RGBA_S3TC_DXT1_Format:function(){return ie},RGBA_S3TC_DXT3_Format:function(){return re},RGBA_S3TC_DXT5_Format:function(){return ae},RGBDEncoding:function(){return We},RGBEEncoding:function(){return Ge},RGBEFormat:function(){return Xt},RGBFormat:function(){return jt},RGBIntegerFormat:function(){return te},RGBM16Encoding:function(){return je},RGBM7Encoding:function(){return ke},RGB_ETC1_Format:function(){return he},RGB_PVRTC_2BPPV1_Format:function(){return se},RGB_PVRTC_4BPPV1_Format:function(){return oe},RGB_S3TC_DXT1_Format:function(){return ne},RGFormat:function(){return Qt},RGIntegerFormat:function(){return $t},RawShaderMaterial:function(){return Gu},Ray:function(){return Ri},Raycaster:function(){return op},RectAreaLight:function(){return il},RedFormat:function(){return Jt},RedIntegerFormat:function(){return Kt},ReinhardToneMapping:function(){return at},RepeatWrapping:function(){return gt},ReplaceStencilOp:function(){return Ke},ReverseSubtractEquation:function(){return D},RingBufferGeometry:function(){return Tu},RingGeometry:function(){return Su},Scene:function(){return li},SceneUtils:function(){return ld},ShaderChunk:function(){return xa},ShaderLib:function(){return ba},ShaderMaterial:function(){return ca},ShadowMaterial:function(){return Uu},Shape:function(){return Hh},ShapeBufferGeometry:function(){return Pu},ShapeGeometry:function(){return Cu},ShapePath:function(){return vl},ShapeUtils:function(){return fu},ShortType:function(){return Dt},Skeleton:function(){return Ks},SkeletonHelper:function(){return wp},SkinnedMesh:function(){return Ys},SmoothShading:function(){return _},Sphere:function(){return Ci},SphereBufferGeometry:function(){return wu},SphereGeometry:function(){return Mu},Spherical:function(){return up},SphericalHarmonics3:function(){return Ml},SphericalReflectionMapping:function(){return dt},Spline:function(){return ed},SplineCurve:function(){return Vh},SplineCurve3:function(){return td},SpotLight:function(){return Jh},SpotLightHelper:function(){return yp},SpotLightShadow:function(){return Zh},Sprite:function(){return js},SpriteMaterial:function(){return Es},SrcAlphaFactor:function(){return U},SrcAlphaSaturateFactor:function(){return H},SrcColorFactor:function(){return F},StaticCopyUsage:function(){return yn},StaticDrawUsage:function(){return pn},StaticReadUsage:function(){return mn},StereoCamera:function(){return Cl},StreamCopyUsage:function(){return _n},StreamDrawUsage:function(){return dn},StreamReadUsage:function(){return gn},StringKeyframeTrack:function(){return sh},SubtractEquation:function(){return O},SubtractiveBlending:function(){return L},TOUCH:function(){return a},TangentSpaceNormalMap:function(){return Xe},TetrahedronBufferGeometry:function(){return Dc},TetrahedronGeometry:function(){return Oc},TextBufferGeometry:function(){return bu},TextGeometry:function(){return _u},Texture:function(){return zn},TextureLoader:function(){return Mh},TorusBufferGeometry:function(){return Wc},TorusGeometry:function(){return jc},TorusKnotBufferGeometry:function(){return kc},TorusKnotGeometry:function(){return Vc},Triangle:function(){return Ki},TriangleFanDrawMode:function(){return Re},TriangleStripDrawMode:function(){return ze},TrianglesDrawMode:function(){return Ne},TubeBufferGeometry:function(){return Gc},TubeGeometry:function(){return Uc},UVMapping:function(){return ut},Uint16Attribute:function(){return Yf},Uint16BufferAttribute:function(){return mr},Uint32Attribute:function(){return Jf},Uint32BufferAttribute:function(){return gr},Uint8Attribute:function(){return Hf},Uint8BufferAttribute:function(){return pr},Uint8ClampedAttribute:function(){return qf},Uint8ClampedBufferAttribute:function(){return fr},Uncharted2ToneMapping:function(){return ot},Uniform:function(){return rp},UniformsLib:function(){return _a},UniformsUtils:function(){return aa},UnsignedByteType:function(){return Et},UnsignedInt248Type:function(){return Vt},UnsignedIntType:function(){return zt},UnsignedShort4444Type:function(){return Bt},UnsignedShort5551Type:function(){return Ut},UnsignedShort565Type:function(){return Gt},UnsignedShortType:function(){return It},VSMShadowMap:function(){return m},Vector2:function(){return Tn},Vector3:function(){return Pn},Vector4:function(){return Rn},VectorKeyframeTrack:function(){return ch},Vertex:function(){return kf},VertexColors:function(){return w},VideoTexture:function(){return Mc},WebGLMultisampleRenderTarget:function(){return Bn},WebGLRenderTarget:function(){return Fn},WebGLRenderTargetCube:function(){return da},WebGLRenderer:function(){return ws},WebGLUtils:function(){return gs},WireframeGeometry:function(){return Ac},WireframeHelper:function(){return ad},WrapAroundEnding:function(){return Ie},XHRLoader:function(){return od},ZeroCurvatureEnding:function(){return Oe},ZeroFactor:function(){return z},ZeroSlopeEnding:function(){return De},ZeroStencilOp:function(){return Ze},sRGBEncoding:function(){return Be}}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return'number'==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),'name'in Function.prototype==!1&&Object.defineProperty(Function.prototype,'name',{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError('Cannot convert undefined or null to object');for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e});var i='112',r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},o=0,s=1,c=2,u=3,h=0,l=1,p=0,f=1,d=2,m=3,v=0,g=1,y=2,x=1,_=2,b=0,M=1,w=2,S=0,T=1,A=2,L=3,C=4,P=5,E=100,O=101,D=102,I=103,N=104,z=200,R=201,F=202,B=203,U=204,G=205,V=206,k=207,j=208,W=209,H=210,q=0,X=1,Y=2,Z=3,J=4,K=5,Q=6,$=7,tt=0,et=1,nt=2,it=0,rt=1,at=2,ot=3,st=4,ct=5,ut=300,ht=301,lt=302,pt=303,ft=304,dt=305,mt=306,vt=307,gt=1e3,yt=1001,xt=1002,_t=1003,bt=1004,Mt=1004,wt=1005,St=1005,Tt=1006,At=1007,Lt=1007,Ct=1008,Pt=1008,Et=1009,Ot=1010,Dt=1011,It=1012,Nt=1013,zt=1014,Rt=1015,Ft=1016,Bt=1017,Ut=1018,Gt=1019,Vt=1020,kt=1021,jt=1022,Wt=1023,Ht=1024,qt=1025,Xt=Wt,Yt=1026,Zt=1027,Jt=1028,Kt=1029,Qt=1030,$t=1031,te=1032,ee=1033,ne=33776,ie=33777,re=33778,ae=33779,oe=35840,se=35841,ce=35842,ue=35843,he=36196,le=37808,pe=37809,fe=37810,de=37811,me=37812,ve=37813,ge=37814,ye=37815,xe=37816,_e=37817,be=37818,Me=37819,we=37820,Se=37821,Te=2200,Ae=2201,Le=2202,Ce=2300,Pe=2301,Ee=2302,Oe=2400,De=2401,Ie=2402,Ne=0,ze=1,Re=2,Fe=3e3,Be=3001,Ue=3007,Ge=3002,Ve=3003,ke=3004,je=3005,We=3006,He=3200,qe=3201,Xe=0,Ye=1,Ze=0,Je=7680,Ke=7681,Qe=7682,$e=7683,tn=34055,en=34056,nn=5386,rn=512,an=513,on=514,sn=515,cn=516,un=517,hn=518,ln=519,pn=35044,fn=35048,dn=35040,mn=35045,vn=35049,gn=35041,yn=35046,xn=35050,_n=35042;function bn(){}Object.assign(bn.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var i=n.indexOf(e);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,t)}}}});for(var Mn=[],wn=0;wn<256;wn++)Mn[wn]=(wn<16?'0':'')+wn.toString(16);var Sn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Mn[255&t]+Mn[t>>8&255]+Mn[t>>16&255]+Mn[t>>24&255]+'-'+Mn[255&e]+Mn[e>>8&255]+'-'+Mn[e>>16&15|64]+Mn[e>>24&255]+'-'+Mn[63&n|128]+Mn[n>>8&255]+'-'+Mn[n>>16&255]+Mn[n>>24&255]+Mn[255&i]+Mn[i>>8&255]+Mn[i>>16&255]+Mn[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Sn.DEG2RAD},radToDeg:function(t){return t*Sn.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function Tn(t,e){this.x=t||0,this.y=e||0}function An(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}Object.defineProperties(Tn.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(Tn.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error('index is out of range: '+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error('index is out of range: '+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}}),Object.assign(An,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,a,o){var s=n[i+0],c=n[i+1],u=n[i+2],h=n[i+3],l=r[a+0],p=r[a+1],f=r[a+2],d=r[a+3];if(h!==d||s!==l||c!==p||u!==f){var m=1-o,v=s*l+c*p+u*f+h*d,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+l*b,c=c*m+p*b,u=u*m+f*b,h=h*m+d*b,m===1-o){var M=1/Math.sqrt(s*s+c*c+u*u+h*h);s*=M,c*=M,u*=M,h*=M}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=h}}),Object.defineProperties(An.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(An.prototype,{isQuaternion:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');var n=t._x,i=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,c=o(n/2),u=o(i/2),h=o(r/2),l=s(n/2),p=s(i/2),f=s(r/2);return'XYZ'===a?(this._x=l*u*h+c*p*f,this._y=c*p*h-l*u*f,this._z=c*u*f+l*p*h,this._w=c*u*h-l*p*f):'YXZ'===a?(this._x=l*u*h+c*p*f,this._y=c*p*h-l*u*f,this._z=c*u*f-l*p*h,this._w=c*u*h+l*p*f):'ZXY'===a?(this._x=l*u*h-c*p*f,this._y=c*p*h+l*u*f,this._z=c*u*f+l*p*h,this._w=c*u*h-l*p*f):'ZYX'===a?(this._x=l*u*h-c*p*f,this._y=c*p*h+l*u*f,this._z=c*u*f-l*p*h,this._w=c*u*h+l*p*f):'YZX'===a?(this._x=l*u*h+c*p*f,this._y=c*p*h+l*u*f,this._z=c*u*f-l*p*h,this._w=c*u*h-l*p*f):'XZY'===a&&(this._x=l*u*h-c*p*f,this._y=c*p*h-l*u*f,this._z=c*u*f+l*p*h,this._w=c*u*h+l*p*f),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],c=n[9],u=n[2],h=n[6],l=n[10],p=i+s+l;return p>0?(e=.5/Math.sqrt(p+1),this._w=.25/e,this._x=(h-c)*e,this._y=(a-u)*e,this._z=(o-r)*e):i>s&&i>l?(e=2*Math.sqrt(1+i-s-l),this._w=(h-c)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+u)/e):s>l?(e=2*Math.sqrt(1+s-i-l),this._w=(a-u)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+l-i-s),this._w=(o-r)/e,this._x=(a+u)/e,this._y=(c+h)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(Sn.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n=this.angleTo(t);if(0===n)return this;var i=Math.min(1,e/n);return this.slerp(t,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,a=t._w,o=e._x,s=e._y,c=e._z,u=e._w;return this._x=n*u+a*o+i*c-r*s,this._y=i*u+a*s+r*o-n*c,this._z=r*u+a*c+n*s-i*o,this._w=a*u-n*o-i*s-r*c,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-e;return this._w=c*a+e*this._w,this._x=c*n+e*this._x,this._y=c*i+e*this._y,this._z=c*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),h=Math.atan2(u,o),l=Math.sin((1-e)*h)/u,p=Math.sin(e*h)/u;return this._w=a*l+this._w*p,this._x=n*l+this._x*p,this._y=i*l+this._y*p,this._z=r*l+this._z*p,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var Ln=new Pn,Cn=new An;function Pn(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}Object.assign(Pn.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error('index is out of range: '+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error('index is out of range: '+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return!t||t.isEuler,this.applyQuaternion(Cn.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(Cn.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,o=t.z,s=t.w,c=s*e+a*i-o*n,u=s*n+o*e-r*i,h=s*i+r*n-a*e,l=-r*e-a*n-o*i;return this.x=c*s+l*-r+u*-o-h*-a,this.y=u*s+l*-a+h*-r-c*-o,this.z=h*s+l*-o+c*-a-u*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(t){return Ln.copy(this).projectOnVector(t),this.sub(Ln)},reflect:function(t){return this.sub(Ln.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq()),n=this.dot(t)/e;return Math.acos(Sn.clamp(n,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}});var En,On=new Pn;function Dn(){this.elements=[1,0,0,0,1,0,0,0,1]}Object.assign(Dn.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,a,o,s,c){var u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=r,u[5]=s,u[6]=n,u[7]=a,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(t){for(var e=0,n=t.count;e<n;e++)On.x=t.getX(e),On.y=t.getY(e),On.z=t.getZ(e),On.applyMatrix3(this),t.setXYZ(e,On.x,On.y,On.z);return t},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],u=n[4],h=n[7],l=n[2],p=n[5],f=n[8],d=i[0],m=i[3],v=i[6],g=i[1],y=i[4],x=i[7],_=i[2],b=i[5],M=i[8];return r[0]=a*d+o*g+s*_,r[3]=a*m+o*y+s*b,r[6]=a*v+o*x+s*M,r[1]=c*d+u*g+h*_,r[4]=c*m+u*y+h*b,r[7]=c*v+u*x+h*M,r[2]=l*d+p*g+f*_,r[5]=l*m+p*y+f*b,r[8]=l*v+p*x+f*M,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],c=t[7],u=t[8];return e*a*u-e*o*c-n*r*u+n*o*s+i*r*c-i*a*s},getInverse:function(t,e){t&&t.isMatrix4;var n=t.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],c=n[4],u=n[5],h=n[6],l=n[7],p=n[8],f=p*c-u*l,d=u*h-p*s,m=l*s-c*h,v=r*f+a*d+o*m;if(0===v){if(!0===e)throw new Error("THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0");return this.identity()}var g=1/v;return i[0]=f*g,i[1]=(o*l-p*a)*g,i[2]=(u*a-o*c)*g,i[3]=d*g,i[4]=(p*r-o*h)*g,i[5]=(o*s-u*r)*g,i[6]=m*g,i[7]=(a*h-l*r)*g,i[8]=(c*r-a*s)*g,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},setUvTransform:function(t,e,n,i,r,a,o){var s=Math.cos(r),c=Math.sin(r);this.set(n*s,n*c,-n*(s*a+c*o)+a+t,-i*c,i*s,-i*(-c*a+s*o)+o+e,0,0,1)},scale:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},rotate:function(t){var e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],c=i[4],u=i[7];return i[0]=e*r+n*s,i[3]=e*a+n*c,i[6]=e*o+n*u,i[1]=-n*r+e*s,i[4]=-n*a+e*c,i[7]=-n*o+e*u,this},translate:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}});var In={getDataURL:function(t){var e;if('undefined'==typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)e=t;else{void 0===En&&(En=document.createElementNS('http://www.w3.org/1999/xhtml','canvas')),En.width=t.width,En.height=t.height;var n=En.getContext('2d');t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=En}return e.width>2048||e.height>2048?e.toDataURL('image/jpeg',.6):e.toDataURL('image/png')}},Nn=0;function zn(t,e,n,i,r,a,o,s,c,u){Object.defineProperty(this,'id',{value:Nn++}),this.uuid=Sn.generateUUID(),this.name='',this.image=void 0!==t?t:zn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:zn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:yt,this.wrapT=void 0!==i?i:yt,this.magFilter=void 0!==r?r:Tt,this.minFilter=void 0!==a?a:Ct,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Wt,this.internalFormat=null,this.type=void 0!==s?s:Et,this.offset=new Tn(0,0),this.repeat=new Tn(1,1),this.center=new Tn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:Fe,this.version=0,this.onUpdate=null}function Rn(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function Fn(t,e,n){this.width=t,this.height=e,this.scissor=new Rn(0,0,t,e),this.scissorTest=!1,this.viewport=new Rn(0,0,t,e),n=n||{},this.texture=new zn(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=e,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Tt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function Bn(t,e,n){Fn.call(this,t,e,n),this.samples=4}zn.DEFAULT_IMAGE=void 0,zn.DEFAULT_MAPPING=ut,zn.prototype=Object.assign(Object.create(bn.prototype),{constructor:zn,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||'string'==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.5,type:'Texture',generator:'Texture.toJSON'},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=Sn.generateUUID()),!e&&void 0===t.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(In.getDataURL(i[a]))}else r=In.getDataURL(i);t.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:'dispose'})},transformUv:function(t){if(this.mapping!==ut)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case gt:t.x=t.x-Math.floor(t.x);break;case yt:t.x=t.x<0?0:1;break;case xt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case gt:t.y=t.y-Math.floor(t.y);break;case yt:t.y=t.y<0?0:1;break;case xt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(zn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.defineProperties(Rn.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(Rn.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error('