main.js 712 KB

1
  1. !function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=2)}([function(e,t,n){"use strict";n.r(t),n.d(t,"ACESFilmicToneMapping",(function(){return ae})),n.d(t,"AddEquation",(function(){return A})),n.d(t,"AddOperation",(function(){return $})),n.d(t,"AdditiveAnimationBlendMode",(function(){return Zt})),n.d(t,"AdditiveBlending",(function(){return M})),n.d(t,"AlphaFormat",(function(){return Ue})),n.d(t,"AlwaysDepth",(function(){return j})),n.d(t,"AlwaysStencilFunc",(function(){return An})),n.d(t,"AmbientLight",(function(){return wh})),n.d(t,"AmbientLightProbe",(function(){return Wh})),n.d(t,"AnimationClip",(function(){return Ru})),n.d(t,"AnimationLoader",(function(){return Bu})),n.d(t,"AnimationMixer",(function(){return _d})),n.d(t,"AnimationObjectGroup",(function(){return xd})),n.d(t,"AnimationUtils",(function(){return gu})),n.d(t,"ArcCurve",(function(){return Wu})),n.d(t,"ArrayCamera",(function(){return Ps})),n.d(t,"ArrowHelper",(function(){return lp})),n.d(t,"Audio",(function(){return td})),n.d(t,"AudioAnalyser",(function(){return sd})),n.d(t,"AudioContext",(function(){return kh})),n.d(t,"AudioListener",(function(){return ed})),n.d(t,"AudioLoader",(function(){return Vh})),n.d(t,"AxesHelper",(function(){return up})),n.d(t,"AxisHelper",(function(){return of})),n.d(t,"BackSide",(function(){return v})),n.d(t,"BasicDepthPacking",(function(){return cn})),n.d(t,"BasicShadowMap",(function(){return d})),n.d(t,"BinaryTextureLoader",(function(){return hf})),n.d(t,"Bone",(function(){return mc})),n.d(t,"BooleanKeyframeTrack",(function(){return wu})),n.d(t,"BoundingBoxHelper",(function(){return sf})),n.d(t,"Box2",(function(){return Pd})),n.d(t,"Box3",(function(){return zr})),n.d(t,"Box3Helper",(function(){return ip})),n.d(t,"BoxBufferGeometry",(function(){return va})),n.d(t,"BoxGeometry",(function(){return ga})),n.d(t,"BoxHelper",(function(){return rp})),n.d(t,"BufferAttribute",(function(){return Si})),n.d(t,"BufferGeometry",(function(){return ji})),n.d(t,"BufferGeometryLoader",(function(){return Ph})),n.d(t,"ByteType",(function(){return Le})),n.d(t,"Cache",(function(){return Cu})),n.d(t,"Camera",(function(){return wa})),n.d(t,"CameraHelper",(function(){return ep})),n.d(t,"CanvasRenderer",(function(){return ff})),n.d(t,"CanvasTexture",(function(){return Gc})),n.d(t,"CatmullRomCurve3",(function(){return Ku})),n.d(t,"CineonToneMapping",(function(){return ie})),n.d(t,"CircleBufferGeometry",(function(){return ru})),n.d(t,"CircleGeometry",(function(){return nu})),n.d(t,"ClampToEdgeWrapping",(function(){return me})),n.d(t,"Clock",(function(){return Zh})),n.d(t,"ClosedSplineCurve3",(function(){return nf})),n.d(t,"Color",(function(){return gi})),n.d(t,"ColorKeyframeTrack",(function(){return Mu})),n.d(t,"CompressedTexture",(function(){return zc})),n.d(t,"CompressedTextureLoader",(function(){return Hu})),n.d(t,"ConeBufferGeometry",(function(){return tu})),n.d(t,"ConeGeometry",(function(){return eu})),n.d(t,"CubeCamera",(function(){return Ta})),n.d(t,"CubeGeometry",(function(){return ga})),n.d(t,"CubeReflectionMapping",(function(){return se})),n.d(t,"CubeRefractionMapping",(function(){return ce})),n.d(t,"CubeTexture",(function(){return Ya})),n.d(t,"CubeTextureLoader",(function(){return Gu})),n.d(t,"CubeUVReflectionMapping",(function(){return de})),n.d(t,"CubeUVRefractionMapping",(function(){return pe})),n.d(t,"CubicBezierCurve",(function(){return th})),n.d(t,"CubicBezierCurve3",(function(){return nh})),n.d(t,"CubicInterpolant",(function(){return yu})),n.d(t,"CullFaceBack",(function(){return s})),n.d(t,"CullFaceFront",(function(){return c})),n.d(t,"CullFaceFrontBack",(function(){return l})),n.d(t,"CullFaceNone",(function(){return o})),n.d(t,"Curve",(function(){return Vu})),n.d(t,"CurvePath",(function(){return lh})),n.d(t,"CustomBlending",(function(){return E})),n.d(t,"CylinderBufferGeometry",(function(){return $l})),n.d(t,"CylinderGeometry",(function(){return Ql})),n.d(t,"Cylindrical",(function(){return Ld})),n.d(t,"DataTexture",(function(){return Ea})),n.d(t,"DataTexture2DArray",(function(){return Za})),n.d(t,"DataTexture3D",(function(){return Ja})),n.d(t,"DataTextureLoader",(function(){return Uu})),n.d(t,"DecrementStencilOp",(function(){return gn})),n.d(t,"DecrementWrapStencilOp",(function(){return yn})),n.d(t,"DefaultLoadingManager",(function(){return Du})),n.d(t,"DepthFormat",(function(){return We})),n.d(t,"DepthStencilFormat",(function(){return qe})),n.d(t,"DepthTexture",(function(){return kc})),n.d(t,"DirectionalLight",(function(){return _h})),n.d(t,"DirectionalLightHelper",(function(){return Kd})),n.d(t,"DirectionalLightShadow",(function(){return bh})),n.d(t,"DiscreteInterpolant",(function(){return bu})),n.d(t,"DodecahedronBufferGeometry",(function(){return tl})),n.d(t,"DodecahedronGeometry",(function(){return el})),n.d(t,"DoubleSide",(function(){return y})),n.d(t,"DstAlphaFactor",(function(){return H})),n.d(t,"DstColorFactor",(function(){return z})),n.d(t,"DynamicBufferAttribute",(function(){return qp})),n.d(t,"DynamicCopyUsage",(function(){return Nn})),n.d(t,"DynamicDrawUsage",(function(){return Rn})),n.d(t,"DynamicReadUsage",(function(){return On})),n.d(t,"EdgesGeometry",(function(){return Kl})),n.d(t,"EdgesHelper",(function(){return cf})),n.d(t,"EllipseCurve",(function(){return ju})),n.d(t,"EqualDepth",(function(){return X})),n.d(t,"EqualStencilFunc",(function(){return wn})),n.d(t,"EquirectangularReflectionMapping",(function(){return le})),n.d(t,"EquirectangularRefractionMapping",(function(){return ue})),n.d(t,"Euler",(function(){return ur})),n.d(t,"EventDispatcher",(function(){return Bn})),n.d(t,"ExtrudeBufferGeometry",(function(){return Bl})),n.d(t,"ExtrudeGeometry",(function(){return Fl})),n.d(t,"Face3",(function(){return bi})),n.d(t,"Face4",(function(){return Cp})),n.d(t,"FaceColors",(function(){return Np})),n.d(t,"FileLoader",(function(){return Fu})),n.d(t,"FlatShading",(function(){return x})),n.d(t,"Float32Attribute",(function(){return ef})),n.d(t,"Float32BufferAttribute",(function(){return Di})),n.d(t,"Float64Attribute",(function(){return tf})),n.d(t,"Float64BufferAttribute",(function(){return Ii})),n.d(t,"FloatType",(function(){return De})),n.d(t,"Fog",(function(){return Bs})),n.d(t,"FogExp2",(function(){return Fs})),n.d(t,"Font",(function(){return Uh})),n.d(t,"FontLoader",(function(){return Gh})),n.d(t,"FrontFaceDirectionCCW",(function(){return h})),n.d(t,"FrontFaceDirectionCW",(function(){return u})),n.d(t,"FrontSide",(function(){return g})),n.d(t,"Frustum",(function(){return Ra})),n.d(t,"GammaEncoding",(function(){return tn})),n.d(t,"Geometry",(function(){return ma})),n.d(t,"GeometryUtils",(function(){return pf})),n.d(t,"GreaterDepth",(function(){return Z})),n.d(t,"GreaterEqualDepth",(function(){return Y})),n.d(t,"GreaterEqualStencilFunc",(function(){return En})),n.d(t,"GreaterStencilFunc",(function(){return Tn})),n.d(t,"GridHelper",(function(){return qd})),n.d(t,"Group",(function(){return Cs})),n.d(t,"HalfFloatType",(function(){return Ie})),n.d(t,"HemisphereLight",(function(){return ph})),n.d(t,"HemisphereLightHelper",(function(){return Wd})),n.d(t,"HemisphereLightProbe",(function(){return jh})),n.d(t,"IcosahedronBufferGeometry",(function(){return $c})),n.d(t,"IcosahedronGeometry",(function(){return Qc})),n.d(t,"ImageBitmapLoader",(function(){return Bh})),n.d(t,"ImageLoader",(function(){return zu})),n.d(t,"ImageUtils",(function(){return jn})),n.d(t,"ImmediateRenderObject",(function(){return Id})),n.d(t,"IncrementStencilOp",(function(){return mn})),n.d(t,"IncrementWrapStencilOp",(function(){return vn})),n.d(t,"InstancedBufferAttribute",(function(){return Rh})),n.d(t,"InstancedBufferGeometry",(function(){return Lh})),n.d(t,"InstancedInterleavedBuffer",(function(){return Md})),n.d(t,"InstancedMesh",(function(){return bc})),n.d(t,"Int16Attribute",(function(){return Jp})),n.d(t,"Int16BufferAttribute",(function(){return Ri})),n.d(t,"Int32Attribute",(function(){return Qp})),n.d(t,"Int32BufferAttribute",(function(){return Ci})),n.d(t,"Int8Attribute",(function(){return Xp})),n.d(t,"Int8BufferAttribute",(function(){return Ei})),n.d(t,"IntType",(function(){return Ce})),n.d(t,"InterleavedBuffer",(function(){return Hs})),n.d(t,"InterleavedBufferAttribute",(function(){return Gs})),n.d(t,"Interpolant",(function(){return vu})),n.d(t,"InterpolateDiscrete",(function(){return kt})),n.d(t,"InterpolateLinear",(function(){return Vt})),n.d(t,"InterpolateSmooth",(function(){return jt})),n.d(t,"InvertStencilOp",(function(){return xn})),n.d(t,"JSONLoader",(function(){return mf})),n.d(t,"KeepStencilOp",(function(){return pn})),n.d(t,"KeyframeTrack",(function(){return _u})),n.d(t,"LOD",(function(){return uc})),n.d(t,"LatheBufferGeometry",(function(){return Xl})),n.d(t,"LatheGeometry",(function(){return ql})),n.d(t,"Layers",(function(){return hr})),n.d(t,"LensFlare",(function(){return vf})),n.d(t,"LessDepth",(function(){return W})),n.d(t,"LessEqualDepth",(function(){return q})),n.d(t,"LessEqualStencilFunc",(function(){return Mn})),n.d(t,"LessStencilFunc",(function(){return _n})),n.d(t,"Light",(function(){return dh})),n.d(t,"LightProbe",(function(){return Sh})),n.d(t,"LightShadow",(function(){return fh})),n.d(t,"Line",(function(){return Ac})),n.d(t,"Line3",(function(){return Dd})),n.d(t,"LineBasicMaterial",(function(){return _c})),n.d(t,"LineCurve",(function(){return rh})),n.d(t,"LineCurve3",(function(){return ih})),n.d(t,"LineDashedMaterial",(function(){return fu})),n.d(t,"LineLoop",(function(){return Cc})),n.d(t,"LinePieces",(function(){return Dp})),n.d(t,"LineSegments",(function(){return Pc})),n.d(t,"LineStrip",(function(){return Op})),n.d(t,"LinearEncoding",(function(){return $t})),n.d(t,"LinearFilter",(function(){return we})),n.d(t,"LinearInterpolant",(function(){return xu})),n.d(t,"LinearMipMapLinearFilter",(function(){return Ee})),n.d(t,"LinearMipMapNearestFilter",(function(){return Te})),n.d(t,"LinearMipmapLinearFilter",(function(){return Se})),n.d(t,"LinearMipmapNearestFilter",(function(){return Me})),n.d(t,"LinearToneMapping",(function(){return te})),n.d(t,"Loader",(function(){return Iu})),n.d(t,"LoaderUtils",(function(){return Ah})),n.d(t,"LoadingManager",(function(){return Ou})),n.d(t,"LogLuvEncoding",(function(){return rn})),n.d(t,"LoopOnce",(function(){return Ut})),n.d(t,"LoopPingPong",(function(){return Gt})),n.d(t,"LoopRepeat",(function(){return zt})),n.d(t,"LuminanceAlphaFormat",(function(){return Ve})),n.d(t,"LuminanceFormat",(function(){return ke})),n.d(t,"MOUSE",(function(){return i})),n.d(t,"Material",(function(){return wi})),n.d(t,"MaterialLoader",(function(){return Eh})),n.d(t,"Math",(function(){return Gn})),n.d(t,"MathUtils",(function(){return Gn})),n.d(t,"Matrix3",(function(){return Vn})),n.d(t,"Matrix4",(function(){return sr})),n.d(t,"MaxEquation",(function(){return C})),n.d(t,"Mesh",(function(){return ca})),n.d(t,"MeshBasicMaterial",(function(){return Mi})),n.d(t,"MeshDepthMaterial",(function(){return Ts})),n.d(t,"MeshDistanceMaterial",(function(){return Ss})),n.d(t,"MeshFaceMaterial",(function(){return Bp})),n.d(t,"MeshLambertMaterial",(function(){return du})),n.d(t,"MeshMatcapMaterial",(function(){return pu})),n.d(t,"MeshNormalMaterial",(function(){return hu})),n.d(t,"MeshPhongMaterial",(function(){return lu})),n.d(t,"MeshPhysicalMaterial",(function(){return cu})),n.d(t,"MeshStandardMaterial",(function(){return su})),n.d(t,"MeshToonMaterial",(function(){return uu})),n.d(t,"MinEquation",(function(){return P})),n.d(t,"MirroredRepeatWrapping",(function(){return ge})),n.d(t,"MixOperation",(function(){return Q})),n.d(t,"MultiMaterial",(function(){return Hp})),n.d(t,"MultiplyBlending",(function(){return S})),n.d(t,"MultiplyOperation",(function(){return K})),n.d(t,"NearestFilter",(function(){return ve})),n.d(t,"NearestMipMapLinearFilter",(function(){return _e})),n.d(t,"NearestMipMapNearestFilter",(function(){return xe})),n.d(t,"NearestMipmapLinearFilter",(function(){return be})),n.d(t,"NearestMipmapNearestFilter",(function(){return ye})),n.d(t,"NeverDepth",(function(){return V})),n.d(t,"NeverStencilFunc",(function(){return bn})),n.d(t,"NoBlending",(function(){return _})),n.d(t,"NoColors",(function(){return Ip})),n.d(t,"NoToneMapping",(function(){return ee})),n.d(t,"NormalAnimationBlendMode",(function(){return Yt})),n.d(t,"NormalBlending",(function(){return w})),n.d(t,"NotEqualDepth",(function(){return J})),n.d(t,"NotEqualStencilFunc",(function(){return Sn})),n.d(t,"NumberKeyframeTrack",(function(){return Tu})),n.d(t,"Object3D",(function(){return Sr})),n.d(t,"ObjectLoader",(function(){return Oh})),n.d(t,"ObjectSpaceNormalMap",(function(){return hn})),n.d(t,"OctahedronBufferGeometry",(function(){return Kc})),n.d(t,"OctahedronGeometry",(function(){return Jc})),n.d(t,"OneFactor",(function(){return D})),n.d(t,"OneMinusDstAlphaFactor",(function(){return U})),n.d(t,"OneMinusDstColorFactor",(function(){return G})),n.d(t,"OneMinusSrcAlphaFactor",(function(){return B})),n.d(t,"OneMinusSrcColorFactor",(function(){return N})),n.d(t,"OrthographicCamera",(function(){return xh})),n.d(t,"PCFShadowMap",(function(){return p})),n.d(t,"PCFSoftShadowMap",(function(){return f})),n.d(t,"PMREMGenerator",(function(){return Mp})),n.d(t,"ParametricBufferGeometry",(function(){return Wc})),n.d(t,"ParametricGeometry",(function(){return jc})),n.d(t,"Particle",(function(){return zp})),n.d(t,"ParticleBasicMaterial",(function(){return Vp})),n.d(t,"ParticleSystem",(function(){return Gp})),n.d(t,"ParticleSystemMaterial",(function(){return jp})),n.d(t,"Path",(function(){return uh})),n.d(t,"PerspectiveCamera",(function(){return Ma})),n.d(t,"Plane",(function(){return ti})),n.d(t,"PlaneBufferGeometry",(function(){return Ia})),n.d(t,"PlaneGeometry",(function(){return Da})),n.d(t,"PlaneHelper",(function(){return ap})),n.d(t,"PointCloud",(function(){return Up})),n.d(t,"PointCloudMaterial",(function(){return kp})),n.d(t,"PointLight",(function(){return yh})),n.d(t,"PointLightHelper",(function(){return Gd})),n.d(t,"Points",(function(){return Bc})),n.d(t,"PointsMaterial",(function(){return Oc})),n.d(t,"PolarGridHelper",(function(){return Xd})),n.d(t,"PolyhedronBufferGeometry",(function(){return Xc})),n.d(t,"PolyhedronGeometry",(function(){return qc})),n.d(t,"PositionalAudio",(function(){return od})),n.d(t,"PropertyBinding",(function(){return yd})),n.d(t,"PropertyMixer",(function(){return cd})),n.d(t,"QuadraticBezierCurve",(function(){return ah})),n.d(t,"QuadraticBezierCurve3",(function(){return oh})),n.d(t,"Quaternion",(function(){return Jn})),n.d(t,"QuaternionKeyframeTrack",(function(){return Eu})),n.d(t,"QuaternionLinearInterpolant",(function(){return Su})),n.d(t,"REVISION",(function(){return r})),n.d(t,"RGBADepthPacking",(function(){return ln})),n.d(t,"RGBAFormat",(function(){return Ge})),n.d(t,"RGBAIntegerFormat",(function(){return Qe})),n.d(t,"RGBA_ASTC_10x10_Format",(function(){return _t})),n.d(t,"RGBA_ASTC_10x5_Format",(function(){return yt})),n.d(t,"RGBA_ASTC_10x6_Format",(function(){return xt})),n.d(t,"RGBA_ASTC_10x8_Format",(function(){return bt})),n.d(t,"RGBA_ASTC_12x10_Format",(function(){return wt})),n.d(t,"RGBA_ASTC_12x12_Format",(function(){return Mt})),n.d(t,"RGBA_ASTC_4x4_Format",(function(){return ut})),n.d(t,"RGBA_ASTC_5x4_Format",(function(){return ht})),n.d(t,"RGBA_ASTC_5x5_Format",(function(){return dt})),n.d(t,"RGBA_ASTC_6x5_Format",(function(){return pt})),n.d(t,"RGBA_ASTC_6x6_Format",(function(){return ft})),n.d(t,"RGBA_ASTC_8x5_Format",(function(){return mt})),n.d(t,"RGBA_ASTC_8x6_Format",(function(){return gt})),n.d(t,"RGBA_ASTC_8x8_Format",(function(){return vt})),n.d(t,"RGBA_BPTC_Format",(function(){return Tt})),n.d(t,"RGBA_ETC2_EAC_Format",(function(){return lt})),n.d(t,"RGBA_PVRTC_2BPPV1_Format",(function(){return ot})),n.d(t,"RGBA_PVRTC_4BPPV1_Format",(function(){return at})),n.d(t,"RGBA_S3TC_DXT1_Format",(function(){return et})),n.d(t,"RGBA_S3TC_DXT3_Format",(function(){return tt})),n.d(t,"RGBA_S3TC_DXT5_Format",(function(){return nt})),n.d(t,"RGBDEncoding",(function(){return sn})),n.d(t,"RGBEEncoding",(function(){return nn})),n.d(t,"RGBEFormat",(function(){return je})),n.d(t,"RGBFormat",(function(){return ze})),n.d(t,"RGBIntegerFormat",(function(){return Ke})),n.d(t,"RGBM16Encoding",(function(){return on})),n.d(t,"RGBM7Encoding",(function(){return an})),n.d(t,"RGB_ETC1_Format",(function(){return st})),n.d(t,"RGB_ETC2_Format",(function(){return ct})),n.d(t,"RGB_PVRTC_2BPPV1_Format",(function(){return it})),n.d(t,"RGB_PVRTC_4BPPV1_Format",(function(){return rt})),n.d(t,"RGB_S3TC_DXT1_Format",(function(){return $e})),n.d(t,"RGFormat",(function(){return Ze})),n.d(t,"RGIntegerFormat",(function(){return Je})),n.d(t,"RawShaderMaterial",(function(){return ou})),n.d(t,"Ray",(function(){return Kr})),n.d(t,"Raycaster",(function(){return Td})),n.d(t,"RectAreaLight",(function(){return Mh})),n.d(t,"RedFormat",(function(){return Xe})),n.d(t,"RedIntegerFormat",(function(){return Ye})),n.d(t,"ReinhardToneMapping",(function(){return ne})),n.d(t,"RepeatWrapping",(function(){return fe})),n.d(t,"ReplaceStencilOp",(function(){return fn})),n.d(t,"ReverseSubtractEquation",(function(){return R})),n.d(t,"RingBufferGeometry",(function(){return Wl})),n.d(t,"RingGeometry",(function(){return jl})),n.d(t,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return Ft})),n.d(t,"SRGB8_ALPHA8_ASTC_10x5_Format",(function(){return Dt})),n.d(t,"SRGB8_ALPHA8_ASTC_10x6_Format",(function(){return It})),n.d(t,"SRGB8_ALPHA8_ASTC_10x8_Format",(function(){return Nt})),n.d(t,"SRGB8_ALPHA8_ASTC_12x10_Format",(function(){return Bt})),n.d(t,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return Ht})),n.d(t,"SRGB8_ALPHA8_ASTC_4x4_Format",(function(){return St})),n.d(t,"SRGB8_ALPHA8_ASTC_5x4_Format",(function(){return Et})),n.d(t,"SRGB8_ALPHA8_ASTC_5x5_Format",(function(){return At})),n.d(t,"SRGB8_ALPHA8_ASTC_6x5_Format",(function(){return Lt})),n.d(t,"SRGB8_ALPHA8_ASTC_6x6_Format",(function(){return Rt})),n.d(t,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return Pt})),n.d(t,"SRGB8_ALPHA8_ASTC_8x6_Format",(function(){return Ct})),n.d(t,"SRGB8_ALPHA8_ASTC_8x8_Format",(function(){return Ot})),n.d(t,"Scene",(function(){return Er})),n.d(t,"SceneUtils",(function(){return gf})),n.d(t,"ShaderChunk",(function(){return Na})),n.d(t,"ShaderLib",(function(){return Fa})),n.d(t,"ShaderMaterial",(function(){return _a})),n.d(t,"ShadowMaterial",(function(){return au})),n.d(t,"Shape",(function(){return hh})),n.d(t,"ShapeBufferGeometry",(function(){return Zl})),n.d(t,"ShapeGeometry",(function(){return Yl})),n.d(t,"ShapePath",(function(){return Hh})),n.d(t,"ShapeUtils",(function(){return Dl})),n.d(t,"ShortType",(function(){return Re})),n.d(t,"Skeleton",(function(){return fc})),n.d(t,"SkeletonHelper",(function(){return zd})),n.d(t,"SkinnedMesh",(function(){return hc})),n.d(t,"SmoothShading",(function(){return b})),n.d(t,"Sphere",(function(){return Vr})),n.d(t,"SphereBufferGeometry",(function(){return Vl})),n.d(t,"SphereGeometry",(function(){return kl})),n.d(t,"Spherical",(function(){return Ad})),n.d(t,"SphericalHarmonics3",(function(){return Th})),n.d(t,"SphericalReflectionMapping",(function(){return he})),n.d(t,"Spline",(function(){return af})),n.d(t,"SplineCurve",(function(){return sh})),n.d(t,"SplineCurve3",(function(){return rf})),n.d(t,"SpotLight",(function(){return gh})),n.d(t,"SpotLightHelper",(function(){return Fd})),n.d(t,"SpotLightShadow",(function(){return mh})),n.d(t,"Sprite",(function(){return tc})),n.d(t,"SpriteMaterial",(function(){return ks})),n.d(t,"SrcAlphaFactor",(function(){return F})),n.d(t,"SrcAlphaSaturateFactor",(function(){return k})),n.d(t,"SrcColorFactor",(function(){return I})),n.d(t,"StaticCopyUsage",(function(){return In})),n.d(t,"StaticDrawUsage",(function(){return Ln})),n.d(t,"StaticReadUsage",(function(){return Cn})),n.d(t,"StereoCamera",(function(){return Yh})),n.d(t,"StreamCopyUsage",(function(){return Fn})),n.d(t,"StreamDrawUsage",(function(){return Pn})),n.d(t,"StreamReadUsage",(function(){return Dn})),n.d(t,"StringKeyframeTrack",(function(){return Au})),n.d(t,"SubtractEquation",(function(){return L})),n.d(t,"SubtractiveBlending",(function(){return T})),n.d(t,"TOUCH",(function(){return a})),n.d(t,"TangentSpaceNormalMap",(function(){return un})),n.d(t,"TetrahedronBufferGeometry",(function(){return Zc})),n.d(t,"TetrahedronGeometry",(function(){return Yc})),n.d(t,"TextBufferGeometry",(function(){return Gl})),n.d(t,"TextGeometry",(function(){return zl})),n.d(t,"Texture",(function(){return qn})),n.d(t,"TextureLoader",(function(){return ku})),n.d(t,"TorusBufferGeometry",(function(){return sl})),n.d(t,"TorusGeometry",(function(){return ol})),n.d(t,"TorusKnotBufferGeometry",(function(){return al})),n.d(t,"TorusKnotGeometry",(function(){return il})),n.d(t,"Triangle",(function(){return di})),n.d(t,"TriangleFanDrawMode",(function(){return Qt})),n.d(t,"TriangleStripDrawMode",(function(){return Kt})),n.d(t,"TrianglesDrawMode",(function(){return Jt})),n.d(t,"TubeBufferGeometry",(function(){return rl})),n.d(t,"TubeGeometry",(function(){return nl})),n.d(t,"UVMapping",(function(){return oe})),n.d(t,"Uint16Attribute",(function(){return Kp})),n.d(t,"Uint16BufferAttribute",(function(){return Pi})),n.d(t,"Uint32Attribute",(function(){return $p})),n.d(t,"Uint32BufferAttribute",(function(){return Oi})),n.d(t,"Uint8Attribute",(function(){return Yp})),n.d(t,"Uint8BufferAttribute",(function(){return Ai})),n.d(t,"Uint8ClampedAttribute",(function(){return Zp})),n.d(t,"Uint8ClampedBufferAttribute",(function(){return Li})),n.d(t,"Uncharted2ToneMapping",(function(){return re})),n.d(t,"Uniform",(function(){return wd})),n.d(t,"UniformsLib",(function(){return Pa})),n.d(t,"UniformsUtils",(function(){return ba})),n.d(t,"UnsignedByteType",(function(){return Ae})),n.d(t,"UnsignedInt248Type",(function(){return He})),n.d(t,"UnsignedIntType",(function(){return Oe})),n.d(t,"UnsignedShort4444Type",(function(){return Ne})),n.d(t,"UnsignedShort5551Type",(function(){return Fe})),n.d(t,"UnsignedShort565Type",(function(){return Be})),n.d(t,"UnsignedShortType",(function(){return Pe})),n.d(t,"VSMShadowMap",(function(){return m})),n.d(t,"Vector2",(function(){return kn})),n.d(t,"Vector3",(function(){return $n})),n.d(t,"Vector4",(function(){return Xn})),n.d(t,"VectorKeyframeTrack",(function(){return Lu})),n.d(t,"Vertex",(function(){return Wp})),n.d(t,"VertexColors",(function(){return Fp})),n.d(t,"VideoTexture",(function(){return Uc})),n.d(t,"WebGLCubeRenderTarget",(function(){return Sa})),n.d(t,"WebGLMultisampleRenderTarget",(function(){return Zn})),n.d(t,"WebGLRenderTarget",(function(){return Yn})),n.d(t,"WebGLRenderTargetCube",(function(){return df})),n.d(t,"WebGLRenderer",(function(){return Ns})),n.d(t,"WebGLUtils",(function(){return Rs})),n.d(t,"WireframeGeometry",(function(){return Vc})),n.d(t,"WireframeHelper",(function(){return lf})),n.d(t,"WrapAroundEnding",(function(){return Xt})),n.d(t,"XHRLoader",(function(){return uf})),n.d(t,"ZeroCurvatureEnding",(function(){return Wt})),n.d(t,"ZeroFactor",(function(){return O})),n.d(t,"ZeroSlopeEnding",(function(){return qt})),n.d(t,"ZeroStencilOp",(function(){return dn})),n.d(t,"sRGBEncoding",(function(){return en})),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"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(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(null!=n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t});const r="117",i={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,l=3,u=0,h=1,d=0,p=1,f=2,m=3,g=0,v=1,y=2,x=1,b=2,_=0,w=1,M=2,T=3,S=4,E=5,A=100,L=101,R=102,P=103,C=104,O=200,D=201,I=202,N=203,F=204,B=205,H=206,U=207,z=208,G=209,k=210,V=0,j=1,W=2,q=3,X=4,Y=5,Z=6,J=7,K=0,Q=1,$=2,ee=0,te=1,ne=2,re=3,ie=4,ae=5,oe=300,se=301,ce=302,le=303,ue=304,he=305,de=306,pe=307,fe=1e3,me=1001,ge=1002,ve=1003,ye=1004,xe=1004,be=1005,_e=1005,we=1006,Me=1007,Te=1007,Se=1008,Ee=1008,Ae=1009,Le=1010,Re=1011,Pe=1012,Ce=1013,Oe=1014,De=1015,Ie=1016,Ne=1017,Fe=1018,Be=1019,He=1020,Ue=1021,ze=1022,Ge=1023,ke=1024,Ve=1025,je=Ge,We=1026,qe=1027,Xe=1028,Ye=1029,Ze=1030,Je=1031,Ke=1032,Qe=1033,$e=33776,et=33777,tt=33778,nt=33779,rt=35840,it=35841,at=35842,ot=35843,st=36196,ct=37492,lt=37496,ut=37808,ht=37809,dt=37810,pt=37811,ft=37812,mt=37813,gt=37814,vt=37815,yt=37816,xt=37817,bt=37818,_t=37819,wt=37820,Mt=37821,Tt=36492,St=37840,Et=37841,At=37842,Lt=37843,Rt=37844,Pt=37845,Ct=37846,Ot=37847,Dt=37848,It=37849,Nt=37850,Ft=37851,Bt=37852,Ht=37853,Ut=2200,zt=2201,Gt=2202,kt=2300,Vt=2301,jt=2302,Wt=2400,qt=2401,Xt=2402,Yt=2500,Zt=2501,Jt=0,Kt=1,Qt=2,$t=3e3,en=3001,tn=3007,nn=3002,rn=3003,an=3004,on=3005,sn=3006,cn=3200,ln=3201,un=0,hn=1,dn=0,pn=7680,fn=7681,mn=7682,gn=7683,vn=34055,yn=34056,xn=5386,bn=512,_n=513,wn=514,Mn=515,Tn=516,Sn=517,En=518,An=519,Ln=35044,Rn=35048,Pn=35040,Cn=35045,On=35049,Dn=35041,In=35046,Nn=35050,Fn=35042;function Bn(){}Object.assign(Bn.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}});for(var Hn=[],Un=0;Un<256;Un++)Hn[Un]=(Un<16?"0":"")+Un.toString(16);var zn,Gn={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Hn[255&e]+Hn[e>>8&255]+Hn[e>>16&255]+Hn[e>>24&255]+"-"+Hn[255&t]+Hn[t>>8&255]+"-"+Hn[t>>16&15|64]+Hn[t>>24&255]+"-"+Hn[63&n|128]+Hn[n>>8&255]+"-"+Hn[n>>16&255]+Hn[n>>24&255]+Hn[255&r]+Hn[r>>8&255]+Hn[r>>16&255]+Hn[r>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Gn.DEG2RAD},radToDeg:function(e){return e*Gn.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),p=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*u,c*h,c*d,s*l);break;case"YZY":e.set(c*d,s*u,c*h,s*l);break;case"ZXZ":e.set(c*h,c*d,s*u,s*l);break;case"XZX":e.set(s*u,c*f,c*p,s*l);break;case"YXY":e.set(c*p,s*u,c*f,s*l);break;case"ZYZ":e.set(c*f,c*p,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};function kn(e,t){this.x=e||0,this.y=t||0}function Vn(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(kn.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(kn.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.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(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Vn.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[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(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],_=r[5],w=r[8];return i[0]=a*f+o*v+s*b,i[3]=a*m+o*y+s*_,i[6]=a*g+o*x+s*w,i[1]=c*f+l*v+u*b,i[4]=c*m+l*y+u*_,i[7]=c*g+l*x+u*w,i[2]=h*f+d*v+p*b,i[5]=h*m+d*y+p*_,i[8]=h*g+d*x+p*w,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],d=n[8],p=d*c-l*h,f=l*u-d*s,m=h*s-c*u,g=i*p+a*f+o*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return r[0]=p*v,r[1]=(o*h-d*a)*v,r[2]=(l*a-o*c)*v,r[3]=f*v,r[4]=(d*i-o*u)*v,r[5]=(o*s-l*i)*v,r[6]=m*v,r[7]=(a*u-h*i)*v,r[8]=(c*i-a*s)*v,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var jn={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===zn&&(zn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),zn.width=e.width,zn.height=e.height;var n=zn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=zn}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},Wn=0;function qn(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,"id",{value:Wn++}),this.uuid=Gn.generateUUID(),this.name="",this.image=void 0!==e?e:qn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:qn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:me,this.wrapT=void 0!==r?r:me,this.magFilter=void 0!==i?i:we,this.minFilter=void 0!==a?a:Se,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Ge,this.internalFormat=null,this.type=void 0!==s?s:Ae,this.offset=new kn(0,0),this.repeat=new kn(1,1),this.center=new kn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Vn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:$t,this.version=0,this.onUpdate=null}function Xn(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function Yn(e,t,n){this.width=e,this.height=t,this.scissor=new Xn(0,0,e,t),this.scissorTest=!1,this.viewport=new Xn(0,0,e,t),n=n||{},this.texture=new qn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:we,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 Zn(e,t,n){Yn.call(this,e,t,n),this.samples=4}function Jn(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}qn.DEFAULT_IMAGE=void 0,qn.DEFAULT_MAPPING=oe,qn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:qn,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(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.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 r=this.image;if(void 0===r.uuid&&(r.uuid=Gn.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(jn.getDataURL(r[a]))}else i=jn.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping!==oe)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case fe:e.x=e.x-Math.floor(e.x);break;case me:e.x=e.x<0?0:1;break;case ge:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case fe:e.y=e.y-Math.floor(e.y);break;case me:e.y=e.y<0?0:1;break;case ge:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(qn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Xn.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Xn.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(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:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(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:function(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:function(e,t){return void 0!==t?(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:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var 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:function(e){var t,n,r,i,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(u+1)/2,v=(f+1)/2,y=(s+l)/4,x=(c+d)/4,b=(h+p)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=x/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(g)),i=b/r):v<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(v)),r=b/i),this.set(n,r,i,t),this}var _=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(_)<.001&&(_=1),this.x=(p-h)/_,this.y=(c-d)/_,this.z=(l-s)/_,this.w=Math.acos((o+u+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),Yn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Yn,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Zn.prototype=Object.assign(Object.create(Yn.prototype),{constructor:Zn,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Yn.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(Jn,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(u!==f||s!==h||c!==d||l!==p){var m=1-o,g=s*h+c*d+l*p+u*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var _=o*v;if(s=s*m+h*_,c=c*m+d*_,l=l*m+p*_,u=u*m+f*_,m===1-o){var w=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=w,c*=w,l*=w,u*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*d-c*h,e[t+1]=s*p+l*h+c*u-o*d,e[t+2]=c*p+l*d+o*h-s*u,e[t+3]=l*p-o*u-s*h-c*d,e}}),Object.defineProperties(Jn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Jn.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"YXZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"ZXY":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"ZYX":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"YZX":this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p;break;case"XZY":this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],d=r+s+h;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+l)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(a-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Gn.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Kn=new $n,Qn=new Jn;function $n(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign($n.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .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)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .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)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Qn.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Qn.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Kn.copy(this).projectOnVector(e),this.sub(Kn)},reflect:function(e){return this.sub(Kn.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Gn.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var er=new $n,tr=new sr,nr=new $n(0,0,0),rr=new $n(1,1,1),ir=new $n,ar=new $n,or=new $n;function sr(){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.")}Object.assign(sr.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,h,d,p,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new sr).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/er.setFromMatrixColumn(e,0).length(),i=1/er.setFromMatrixColumn(e,1).length(),a=1/er.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=d+p*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=p+d*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,g=s*u,v=c*l,y=c*u;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*l,g=s*u,v=c*l,y=c*u;t[0]=m-y*o,t[4]=-a*u,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*l,d=a*u,p=o*l,f=o*u;t[0]=s*l,t[4]=p*c-d,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=d*c-p,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*c,_=o*s,w=o*c;t[0]=s*l,t[4]=w-x*u,t[8]=_*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+_,t[10]=x-w*u}else if("XZY"===e.order){x=a*s,b=a*c,_=o*s,w=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=x*u+w,t[5]=a*l,t[9]=b*u-_,t[2]=_*u-b,t[6]=o*l,t[10]=w*u+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(nr,e,rr)},lookAt:function(e,t,n){var r=this.elements;return or.subVectors(e,t),0===or.lengthSq()&&(or.z=1),or.normalize(),ir.crossVectors(n,or),0===ir.lengthSq()&&(1===Math.abs(n.z)?or.x+=1e-4:or.z+=1e-4,or.normalize(),ir.crossVectors(n,or)),ir.normalize(),ar.crossVectors(or,ir),r[0]=ir.x,r[4]=ar.x,r[8]=or.x,r[1]=ir.y,r[5]=ar.y,r[9]=or.y,r[2]=ir.z,r[6]=ar.z,r[10]=or.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],_=r[0],w=r[4],M=r[8],T=r[12],S=r[1],E=r[5],A=r[9],L=r[13],R=r[2],P=r[6],C=r[10],O=r[14],D=r[3],I=r[7],N=r[11],F=r[15];return i[0]=a*_+o*S+s*R+c*D,i[4]=a*w+o*E+s*P+c*I,i[8]=a*M+o*A+s*C+c*N,i[12]=a*T+o*L+s*O+c*F,i[1]=l*_+u*S+h*R+d*D,i[5]=l*w+u*E+h*P+d*I,i[9]=l*M+u*A+h*C+d*N,i[13]=l*T+u*L+h*O+d*F,i[2]=p*_+f*S+m*R+g*D,i[6]=p*w+f*E+m*P+g*I,i[10]=p*M+f*A+m*C+g*N,i[14]=p*T+f*L+m*O+g*F,i[3]=v*_+y*S+x*R+b*D,i[7]=v*w+y*E+x*P+b*I,i[11]=v*M+y*A+x*C+b*N,i[15]=v*T+y*L+x*O+b*F,this},multiplyScalar:function(e){var 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:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*c*h+i*a*h-r*a*d+r*c*l-i*s*l)+e[11]*(+t*c*u-t*o*d-i*a*u+n*a*d+i*o*l-n*c*l)+e[15]*(-r*o*l-t*s*u+t*o*h+r*a*u-n*a*h+n*s*l)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],d=r[8],p=r[9],f=r[10],m=r[11],g=r[12],v=r[13],y=r[14],x=r[15],b=p*y*h-v*f*h+v*u*m-l*y*m-p*u*x+l*f*x,_=g*f*h-d*y*h-g*u*m+c*y*m+d*u*x-c*f*x,w=d*v*h-g*p*h+g*l*m-c*v*m-d*l*x+c*p*x,M=g*p*u-d*v*u-g*l*f+c*v*f+d*l*y-c*p*y,T=i*b+a*_+o*w+s*M;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/T;return n[0]=b*S,n[1]=(v*f*s-p*y*s-v*o*m+a*y*m+p*o*x-a*f*x)*S,n[2]=(l*y*s-v*u*s+v*o*h-a*y*h-l*o*x+a*u*x)*S,n[3]=(p*u*s-l*f*s-p*o*h+a*f*h+l*o*m-a*u*m)*S,n[4]=_*S,n[5]=(d*y*s-g*f*s+g*o*m-i*y*m-d*o*x+i*f*x)*S,n[6]=(g*u*s-c*y*s-g*o*h+i*y*h+c*o*x-i*u*x)*S,n[7]=(c*f*s-d*u*s+d*o*h-i*f*h-c*o*m+i*u*m)*S,n[8]=w*S,n[9]=(g*p*s-d*v*s-g*a*m+i*v*m+d*a*x-i*p*x)*S,n[10]=(c*v*s-g*l*s+g*a*h-i*v*h-c*a*x+i*l*x)*S,n[11]=(d*l*s-c*p*s-d*a*h+i*p*h+c*a*m-i*l*m)*S,n[12]=M*S,n[13]=(d*v*o-g*p*o+g*a*f-i*v*f-d*a*y+i*p*y)*S,n[14]=(g*l*o-c*v*o-g*a*u+i*v*u+c*a*y-i*l*y)*S,n[15]=(c*p*o-d*l*o+d*a*u-i*p*u-c*a*f+i*l*f)*S,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,h=i*c,d=i*l,p=i*u,f=a*l,m=a*u,g=o*u,v=s*c,y=s*l,x=s*u,b=n.x,_=n.y,w=n.z;return r[0]=(1-(f+g))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*_,r[5]=(1-(h+g))*_,r[6]=(m+v)*_,r[7]=0,r[8]=(p+y)*w,r[9]=(m-v)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=er.set(r[0],r[1],r[2]).length(),a=er.set(r[4],r[5],r[6]).length(),o=er.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],tr.copy(this);var s=1/i,c=1/a,l=1/o;return tr.elements[0]*=s,tr.elements[1]*=s,tr.elements[2]*=s,tr.elements[4]*=c,tr.elements[5]*=c,tr.elements[6]*=c,tr.elements[8]*=l,tr.elements[9]*=l,tr.elements[10]*=l,t.setFromRotationMatrix(tr),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,h=(n+r)*c,d=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var cr=new sr,lr=new Jn;function ur(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||ur.DefaultOrder}function hr(){this.mask=1}ur.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ur.DefaultOrder="XYZ",Object.defineProperties(ur.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(ur.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=Gn.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return cr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cr,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return lr.setFromEuler(this),this.setFromQuaternion(lr,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new $n(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(hr.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let dr=0;const pr=new $n,fr=new Jn,mr=new sr,gr=new $n,vr=new $n,yr=new $n,xr=new Jn,br=new $n(1,0,0),_r=new $n(0,1,0),wr=new $n(0,0,1),Mr={type:"added"},Tr={type:"removed"};function Sr(){Object.defineProperty(this,"id",{value:dr++}),this.uuid=Gn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Sr.DefaultUp.clone();var e=new $n,t=new ur,n=new Jn,r=new $n(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new sr},normalMatrix:{value:new Vn}}),this.matrix=new sr,this.matrixWorld=new sr,this.matrixAutoUpdate=Sr.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new hr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Er(){Sr.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Sr.DefaultUp=new $n(0,1,0),Sr.DefaultMatrixAutoUpdate=!0,Sr.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Sr,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.multiply(fr),this},rotateOnWorldAxis:function(e,t){return fr.setFromAxisAngle(e,t),this.quaternion.premultiply(fr),this},rotateX:function(e){return this.rotateOnAxis(br,e)},rotateY:function(e){return this.rotateOnAxis(_r,e)},rotateZ:function(e){return this.rotateOnAxis(wr,e)},translateOnAxis:function(e,t){return pr.copy(e).applyQuaternion(this.quaternion),this.position.add(pr.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(br,e)},translateY:function(e){return this.translateOnAxis(_r,e)},translateZ:function(e){return this.translateOnAxis(wr,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(mr.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?gr.copy(e):gr.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),vr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mr.lookAt(vr,gr,this.up):mr.lookAt(gr,vr,this.up),this.quaternion.setFromRotationMatrix(mr),r&&(mr.extractRotation(r.matrixWorld),fr.setFromRotationMatrix(mr),this.quaternion.premultiply(fr.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Mr)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Tr)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),mr.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),mr.multiply(e.parent.matrixWorld)),e.applyMatrix4(mr),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new $n),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Jn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(vr,e,yr),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new $n),this.updateMatrixWorld(!0),this.matrixWorld.decompose(vr,xr,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new $n),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var h=m(e.geometries),d=m(e.materials),p=m(e.textures),f=m(e.images);o=m(e.shapes);h.length>0&&(n.geometries=h),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=r,n;function m(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}),Er.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Er,isScene:!0,copy:function(e,t){return Sr.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Sr.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Ar=[new $n,new $n,new $n,new $n,new $n,new $n,new $n,new $n],Lr=new $n,Rr=new zr,Pr=new $n,Cr=new $n,Or=new $n,Dr=new $n,Ir=new $n,Nr=new $n,Fr=new $n,Br=new $n,Hr=new $n,Ur=new $n;function zr(e,t){this.min=void 0!==e?e:new $n(1/0,1/0,1/0),this.max=void 0!==t?t:new $n(-1/0,-1/0,-1/0)}function Gr(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){Ur.fromArray(e,a);var s=i.x*Math.abs(Ur.x)+i.y*Math.abs(Ur.y)+i.z*Math.abs(Ur.z),c=t.dot(Ur),l=n.dot(Ur),u=r.dot(Ur);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}Object.assign(zr.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Lr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new $n),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new $n),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),Rr.copy(t.boundingBox),Rr.applyMatrix4(e.matrixWorld),this.union(Rr));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new $n),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Lr),Lr.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Fr),Br.subVectors(this.max,Fr),Pr.subVectors(e.a,Fr),Cr.subVectors(e.b,Fr),Or.subVectors(e.c,Fr),Dr.subVectors(Cr,Pr),Ir.subVectors(Or,Cr),Nr.subVectors(Pr,Or);var t=[0,-Dr.z,Dr.y,0,-Ir.z,Ir.y,0,-Nr.z,Nr.y,Dr.z,0,-Dr.x,Ir.z,0,-Ir.x,Nr.z,0,-Nr.x,-Dr.y,Dr.x,0,-Ir.y,Ir.x,0,-Nr.y,Nr.x,0];return!!Gr(t,Pr,Cr,Or,Br)&&(!!Gr(t=[1,0,0,0,1,0,0,0,1],Pr,Cr,Or,Br)&&(Hr.crossVectors(Dr,Ir),Gr(t=[Hr.x,Hr.y,Hr.z],Pr,Cr,Or,Br)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new $n),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Lr.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(Lr).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(Ar[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ar[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ar[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ar[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ar[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ar[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ar[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ar[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ar)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var kr=new zr;function Vr(e,t){this.center=void 0!==e?e:new $n,this.radius=void 0!==t?t:-1}Object.assign(Vr.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):kr.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new $n),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new zr),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var jr=new $n,Wr=new $n,qr=new $n,Xr=new $n,Yr=new $n,Zr=new $n,Jr=new $n;function Kr(e,t){this.origin=void 0!==e?e:new $n,this.direction=void 0!==t?t:new $n(0,0,-1)}Object.assign(Kr.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new $n),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,jr)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new $n),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=jr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(jr.copy(this.direction).multiplyScalar(t).add(this.origin),jr.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){Wr.copy(e).add(t).multiplyScalar(.5),qr.copy(t).sub(e).normalize(),Xr.copy(this.origin).sub(Wr);var i,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(qr),u=Xr.dot(this.direction),h=-Xr.dot(qr),d=Xr.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*u-h,s=c*p,(i=l*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+l*(a*=f)+2*u)+a*(l*i+a+2*h)+d}else a=c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;else a=-c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-l*c+u)))*i+(a=i>0?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+d):o=-(i=Math.max(0,-(l*c+u)))*i+(a=i>0?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+d;else a=l>0?-c:c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(qr).multiplyScalar(a).add(Wr),o},intersectSphere:function(e,t){jr.subVectors(e.center,this.origin);var n=jr.dot(this.direction),r=jr.dot(jr)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,jr)},intersectTriangle:function(e,t,n,r,i){Yr.subVectors(t,e),Zr.subVectors(n,e),Jr.crossVectors(Yr,Zr);var a,o=this.direction.dot(Jr);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Xr.subVectors(this.origin,e);var s=a*this.direction.dot(Zr.crossVectors(Xr,Zr));if(s<0)return null;var c=a*this.direction.dot(Yr.cross(Xr));if(c<0)return null;if(s+c>o)return null;var l=-a*Xr.dot(Jr);return l<0?null:this.at(l/o,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Qr=new $n,$r=new $n,ei=new Vn;function ti(e,t){this.normal=void 0!==e?e:new $n(1,0,0),this.constant=void 0!==t?t:0}Object.assign(ti.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=Qr.subVectors(n,t).cross($r.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new $n),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new $n);var n=e.delta(Qr),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?void 0:t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new $n),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||ei.getNormalMatrix(e),r=this.coplanarPoint(Qr).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var ni=new $n,ri=new $n,ii=new $n,ai=new $n,oi=new $n,si=new $n,ci=new $n,li=new $n,ui=new $n,hi=new $n;function di(e,t,n){this.a=void 0!==e?e:new $n,this.b=void 0!==t?t:new $n,this.c=void 0!==n?n:new $n}Object.assign(di,{getNormal:function(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new $n),r.subVectors(n,t),ni.subVectors(e,t),r.cross(ni);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){ni.subVectors(r,t),ri.subVectors(n,t),ii.subVectors(e,t);var a=ni.dot(ni),o=ni.dot(ri),s=ni.dot(ii),c=ri.dot(ri),l=ri.dot(ii),u=a*c-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new $n),0===u)return i.set(-2,-1,-1);var h=1/u,d=(c*s-o*l)*h,p=(a*l-o*s)*h;return i.set(1-d-p,p,d)},containsPoint:function(e,t,n,r){return di.getBarycoord(e,t,n,r,ai),ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,ai),s.set(0,0),s.addScaledVector(i,ai.x),s.addScaledVector(a,ai.y),s.addScaledVector(o,ai.z),s},isFrontFacing:function(e,t,n,r){return ni.subVectors(n,t),ri.subVectors(e,t),ni.cross(ri).dot(r)<0}}),Object.assign(di.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return ni.subVectors(this.c,this.b),ri.subVectors(this.a,this.b),.5*ni.cross(ri).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new $n),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return di.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new ti),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return di.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return di.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return di.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return di.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new $n);var n,r,i=this.a,a=this.b,o=this.c;oi.subVectors(a,i),si.subVectors(o,i),li.subVectors(e,i);var s=oi.dot(li),c=si.dot(li);if(s<=0&&c<=0)return t.copy(i);ui.subVectors(e,a);var l=oi.dot(ui),u=si.dot(ui);if(l>=0&&u<=l)return t.copy(a);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(i).addScaledVector(oi,n);hi.subVectors(e,o);var d=oi.dot(hi),p=si.dot(hi);if(p>=0&&d<=p)return t.copy(o);var f=d*c-s*p;if(f<=0&&c>=0&&p<=0)return r=c/(c-p),t.copy(i).addScaledVector(si,r);var m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return ci.subVectors(o,a),r=(u-l)/(u-l+(d-p)),t.copy(a).addScaledVector(ci,r);var g=1/(m+f+h);return n=f*g,r=h*g,t.copy(i).addScaledVector(oi,n).addScaledVector(si,r)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var pi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fi={h:0,s:0,l:0},mi={h:0,s:0,l:0};function gi(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function vi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function yi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function xi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function bi(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new $n,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new gi,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}Object.assign(gi.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Gn.euclideanModulo(e,1),t=Gn.clamp(t,0,1),n=Gn.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=vi(i,r,e+1/3),this.g=vi(i,r,e),this.b=vi(i,r,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=pi[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=yi(e.r),this.g=yi(e.g),this.b=yi(e.b),this},copyLinearToSRGB:function(e){return this.r=xi(e.r),this.g=xi(e.g),this.b=xi(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)t=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:t=(i-a)/l+(i<a?6:0);break;case i:t=(a-r)/l+2;break;case a:t=(r-i)/l+4}t/=6}return e.h=t,e.s=n,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(fi),fi.h+=e,fi.s+=t,fi.l+=n,this.setHSL(fi.h,fi.s,fi.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(fi),e.getHSL(mi);var n=Gn.lerp(fi.h,mi.h,t),r=Gn.lerp(fi.s,mi.s,t),i=Gn.lerp(fi.l,mi.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),gi.NAMES=pi,Object.assign(bi.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var _i=0;function wi(){Object.defineProperty(this,"id",{value:_i++}),this.uuid=Gn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=w,this.side=g,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=F,this.blendDst=B,this.blendEquation=A,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=An,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pn,this.stencilZFail=pn,this.stencilZPass=pn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Mi(e){wi.call(this),this.type="MeshBasicMaterial",this.color=new gi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}wi.prototype=Object.assign(Object.create(Bn.prototype),{constructor:wi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===x;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==w&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==g&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(wi.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Mi.prototype=Object.create(wi.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshBasicMaterial=!0,Mi.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var Ti=new $n;function Si(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=Ln,this.updateRange={offset:0,count:-1},this.version=0}function Ei(e,t,n){Si.call(this,new Int8Array(e),t,n)}function Ai(e,t,n){Si.call(this,new Uint8Array(e),t,n)}function Li(e,t,n){Si.call(this,new Uint8ClampedArray(e),t,n)}function Ri(e,t,n){Si.call(this,new Int16Array(e),t,n)}function Pi(e,t,n){Si.call(this,new Uint16Array(e),t,n)}function Ci(e,t,n){Si.call(this,new Int32Array(e),t,n)}function Oi(e,t,n){Si.call(this,new Uint32Array(e),t,n)}function Di(e,t,n){Si.call(this,new Float32Array(e),t,n)}function Ii(e,t,n){Si.call(this,new Float64Array(e),t,n)}function Ni(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Fi(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(Si.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Si.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new gi),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new kn),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new $n),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new Xn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Ti.x=this.getX(t),Ti.y=this.getY(t),Ti.z=this.getZ(t),Ti.applyMatrix3(e),this.setXYZ(t,Ti.x,Ti.y,Ti.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Ti.x=this.getX(t),Ti.y=this.getY(t),Ti.z=this.getZ(t),Ti.applyMatrix4(e),this.setXYZ(t,Ti.x,Ti.y,Ti.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Ti.x=this.getX(t),Ti.y=this.getY(t),Ti.z=this.getZ(t),Ti.applyNormalMatrix(e),this.setXYZ(t,Ti.x,Ti.y,Ti.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Ti.x=this.getX(t),Ti.y=this.getY(t),Ti.z=this.getZ(t),Ti.transformDirection(e),this.setXYZ(t,Ti.x,Ti.y,Ti.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Ei.prototype=Object.create(Si.prototype),Ei.prototype.constructor=Ei,Ai.prototype=Object.create(Si.prototype),Ai.prototype.constructor=Ai,Li.prototype=Object.create(Si.prototype),Li.prototype.constructor=Li,Ri.prototype=Object.create(Si.prototype),Ri.prototype.constructor=Ri,Pi.prototype=Object.create(Si.prototype),Pi.prototype.constructor=Pi,Ci.prototype=Object.create(Si.prototype),Ci.prototype.constructor=Ci,Oi.prototype=Object.create(Si.prototype),Oi.prototype.constructor=Oi,Di.prototype=Object.create(Si.prototype),Di.prototype.constructor=Di,Ii.prototype=Object.create(Si.prototype),Ii.prototype.constructor=Ii,Object.assign(Ni.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(d>0){u=[];for(l=0;l<d;l++)u[l]={name:h[l].name,data:[]};this.morphTargets.normal=u}var p=e.skinIndices,f=e.skinWeights,m=p.length===r.length,g=f.length===r.length;r.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var v=n[l];this.vertices.push(r[v.a],r[v.b],r[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,_=v.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var w=v.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(b=i[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new kn,new kn,new kn));if(!0===o)void 0!==(b=i[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new kn,new kn,new kn));for(var M=0;M<c;M++){var T=s[M].vertices;t[M].data.push(T[v.a],T[v.b],T[v.c])}for(M=0;M<d;M++){var S=h[M].vertexNormals[l];u[M].data.push(S.a,S.b,S.c)}m&&this.skinIndices.push(p[v.a],p[v.b],p[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var Bi=1,Hi=new sr,Ui=new Sr,zi=new $n,Gi=new zr,ki=new zr,Vi=new $n;function ji(){Object.defineProperty(this,"id",{value:Bi+=2}),this.uuid=Gn.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}ji.prototype=Object.assign(Object.create(Bn.prototype),{constructor:ji,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Fi(e)>65535?Oi:Pi)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new Vn).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Hi.makeRotationX(e),this.applyMatrix4(Hi),this},rotateY:function(e){return Hi.makeRotationY(e),this.applyMatrix4(Hi),this},rotateZ:function(e){return Hi.makeRotationZ(e),this.applyMatrix4(Hi),this},translate:function(e,t,n){return Hi.makeTranslation(e,t,n),this.applyMatrix4(Hi),this},scale:function(e,t,n){return Hi.makeScale(e,t,n),this.applyMatrix4(Hi),this},lookAt:function(e){return Ui.lookAt(e),Ui.updateMatrix(),this.applyMatrix4(Ui.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(zi).negate(),this.translate(zi.x,zi.y,zi.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Di(3*t.vertices.length,3),r=new Di(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Di(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Di(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ni).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new Si(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Si(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.setAttribute("color",new Si(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Si(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Si(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],d=new Di(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new Di(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Di(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new zr);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Gi.setFromBufferAttribute(i),this.morphTargetsRelative?(Vi.addVectors(this.boundingBox.min,Gi.min),this.boundingBox.expandByPoint(Vi),Vi.addVectors(this.boundingBox.max,Gi.max),this.boundingBox.expandByPoint(Vi)):(this.boundingBox.expandByPoint(Gi.min),this.boundingBox.expandByPoint(Gi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Vr);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(Gi.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];ki.setFromBufferAttribute(a),this.morphTargetsRelative?(Vi.addVectors(Gi.min,ki.min),Gi.expandByPoint(Vi),Vi.addVectors(Gi.max,ki.max),Gi.expandByPoint(Vi)):(Gi.expandByPoint(ki.min),Gi.expandByPoint(ki.max))}Gi.getCenter(n);var o=0;for(r=0,i=e.count;r<i;r++)Vi.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(Vi));if(t)for(r=0,i=t.length;r<i;r++){a=t[r];for(var s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Vi.fromBufferAttribute(a,c),s&&(zi.fromBufferAttribute(e,c),Vi.add(zi)),o=Math.max(o,n.distanceToSquared(Vi))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new Si(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,c,l=t.normal.array,u=new $n,h=new $n,d=new $n,p=new $n,f=new $n;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],c=3*m[i+2],u.fromArray(n,o),h.fromArray(n,s),d.fromArray(n,c),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[o]+=p.x,l[o+1]+=p.y,l[o+2]+=p.z,l[s]+=p.x,l[s+1]+=p.y,l[s+2]+=p.z,l[c]+=p.x,l[c+1]+=p.y,l[c+2]+=p.z}else for(i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),d.fromArray(n,i+6),p.subVectors(d,h),f.subVectors(u,h),p.cross(f),l[i]=p.x,l[i+1]=p.y,l[i+2]=p.z,l[i+3]=p.x,l[i+4]=p.y,l[i+5]=p.z,l[i+6]=p.x,l[i+7]=p.y,l[i+8]=p.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,u=s;l<c;l++,u++)i[u]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Vi.x=e.getX(t),Vi.y=e.getY(t),Vi.z=e.getZ(t),Vi.normalize(),e.setXYZ(t,Vi.x,Vi.y,Vi.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,c=0,l=t.length;c<l;c++){o=t[c]*r;for(var u=0;u<r;u++)a[s++]=n[o++]}return new Si(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new ji,n=this.index.array,r=this.attributes;for(var i in r){var a=e(r[i],n);t.setAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],c=o[i],l=0,u=c.length;l<u;l++){a=e(c[l],n);s.push(a)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,d=(l=0,h.length);l<d;l++){var p=h[l];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=(d=i[n]).toJSON();""!==d.name&&(a.name=d.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],l=[],u=0,h=c.length;u<h;u++){var d;a=(d=c[u]).toJSON();""!==d.name&&(a.name=d.name),l.push(a)}l.length>0&&(o[n]=l,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new ji).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Wi=new sr,qi=new Kr,Xi=new Vr,Yi=new $n,Zi=new $n,Ji=new $n,Ki=new $n,Qi=new $n,$i=new $n,ea=new $n,ta=new $n,na=new $n,ra=new kn,ia=new kn,aa=new kn,oa=new $n,sa=new $n;function ca(e,t){Sr.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new ji,this.material=void 0!==t?t:new Mi,this.updateMorphTargets()}function la(e,t,n,r,i,a,o,s){if(null===(t.side===v?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==y,s)))return null;sa.copy(s),sa.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(sa);return c<n.near||c>n.far?null:{distance:c,point:sa.clone(),object:e}}function ua(e,t,n,r,i,a,o,s,c,l,u,h){Yi.fromBufferAttribute(i,l),Zi.fromBufferAttribute(i,u),Ji.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){ea.set(0,0,0),ta.set(0,0,0),na.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],g=a[p];0!==m&&(Ki.fromBufferAttribute(g,l),Qi.fromBufferAttribute(g,u),$i.fromBufferAttribute(g,h),o?(ea.addScaledVector(Ki,m),ta.addScaledVector(Qi,m),na.addScaledVector($i,m)):(ea.addScaledVector(Ki.sub(Yi),m),ta.addScaledVector(Qi.sub(Zi),m),na.addScaledVector($i.sub(Ji),m)))}Yi.add(ea),Zi.add(ta),Ji.add(na)}e.isSkinnedMesh&&(e.boneTransform(l,Yi),e.boneTransform(u,Zi),e.boneTransform(h,Ji));var v=la(e,t,n,r,Yi,Zi,Ji,oa);if(v){s&&(ra.fromBufferAttribute(s,l),ia.fromBufferAttribute(s,u),aa.fromBufferAttribute(s,h),v.uv=di.getUV(oa,Yi,Zi,Ji,ra,ia,aa,new kn)),c&&(ra.fromBufferAttribute(c,l),ia.fromBufferAttribute(c,u),aa.fromBufferAttribute(c,h),v.uv2=di.getUV(oa,Yi,Zi,Ji,ra,ia,aa,new kn));var y=new bi(l,u,h);di.getNormal(Yi,Zi,Ji,y.normal),v.face=y}return v}ca.prototype=Object.assign(Object.create(Sr.prototype),{constructor:ca,isMesh:!0,copy:function(e){return Sr.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),Xi.copy(r.boundingSphere),Xi.applyMatrix4(a),!1!==e.ray.intersectsSphere(Xi)&&(Wi.getInverse(a),qi.copy(e.ray).applyMatrix4(Wi),null===r.boundingBox||!1!==qi.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o,s,c,l,u,h,d,p,f,m=r.index,g=r.attributes.position,v=r.morphAttributes.position,y=r.morphTargetsRelative,x=r.attributes.uv,b=r.attributes.uv2,_=r.groups,w=r.drawRange;if(null!==m)if(Array.isArray(i))for(l=0,h=_.length;l<h;l++)for(f=i[(p=_[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)o=m.getX(u),s=m.getX(u+1),c=m.getX(u+2),(n=ua(this,f,e,qi,g,v,y,x,b,o,s,c))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(m.count,w.start+w.count);l<h;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(n=ua(this,i,e,qi,g,v,y,x,b,o,s,c))&&(n.faceIndex=Math.floor(l/3),t.push(n));else if(void 0!==g)if(Array.isArray(i))for(l=0,h=_.length;l<h;l++)for(f=i[(p=_[l]).materialIndex],u=Math.max(p.start,w.start),d=Math.min(p.start+p.count,w.start+w.count);u<d;u+=3)(n=ua(this,f,e,qi,g,v,y,x,b,o=u,s=u+1,c=u+2))&&(n.faceIndex=Math.floor(u/3),n.face.materialIndex=p.materialIndex,t.push(n));else for(l=Math.max(0,w.start),h=Math.min(g.count,w.start+w.count);l<h;l+=3)(n=ua(this,i,e,qi,g,v,y,x,b,o=l,s=l+1,c=l+2))&&(n.faceIndex=Math.floor(l/3),t.push(n))}else if(r.isGeometry){var M,T,S,E,A=Array.isArray(i),L=r.vertices,R=r.faces,P=r.faceVertexUvs[0];P.length>0&&(E=P);for(var C=0,O=R.length;C<O;C++){var D=R[C],I=A?i[D.materialIndex]:i;if(void 0!==I&&(M=L[D.a],T=L[D.b],S=L[D.c],n=la(this,I,e,qi,M,T,S,oa))){if(E&&E[C]){var N=E[C];ra.copy(N[0]),ia.copy(N[1]),aa.copy(N[2]),n.uv=di.getUV(oa,M,T,S,ra,ia,aa,new kn)}n.face=D,n.faceIndex=C,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var ha=0,da=new sr,pa=new Sr,fa=new $n;function ma(){Object.defineProperty(this,"id",{value:ha+=2}),this.uuid=Gn.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}ma.prototype=Object.assign(Object.create(Bn.prototype),{constructor:ma,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Vn).getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(e)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return da.makeRotationX(e),this.applyMatrix4(da),this},rotateY:function(e){return da.makeRotationY(e),this.applyMatrix4(da),this},rotateZ:function(e){return da.makeRotationZ(e),this.applyMatrix4(da),this},translate:function(e,t,n){return da.makeTranslation(e,t,n),this.applyMatrix4(da),this},scale:function(e,t,n){return da.makeScale(e,t,n),this.applyMatrix4(da),this},lookAt:function(e){return pa.lookAt(e),pa.updateMatrix(),this.applyMatrix4(pa.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=r.position.array,a=void 0!==r.normal?r.normal.array:void 0,o=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,c=void 0!==r.uv2?r.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push((new $n).fromArray(i,l)),void 0!==o&&t.colors.push((new gi).fromArray(o,l));function u(e,n,r,i){var l=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new bi(e,n,r,void 0===a?[]:[(new $n).fromArray(a,3*e),(new $n).fromArray(a,3*n),(new $n).fromArray(a,3*r)],l,i);t.faces.push(u),void 0!==s&&t.faceVertexUvs[0].push([(new kn).fromArray(s,2*e),(new kn).fromArray(s,2*n),(new kn).fromArray(s,2*r)]),void 0!==c&&t.faceVertexUvs[1].push([(new kn).fromArray(c,2*e),(new kn).fromArray(c,2*n),(new kn).fromArray(c,2*r)])}var h=e.groups;if(h.length>0)for(l=0;l<h.length;l++)for(var d=h[l],p=d.start,f=p,m=p+d.count;f<m;f+=3)void 0!==n?u(n[f],n[f+1],n[f+2],d.materialIndex):u(f,f+1,f+2,d.materialIndex);else if(void 0!==n)for(l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(fa).negate(),this.translate(fa.x,fa.y,fa.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new sr;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new $n,t=new $n,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new $n;if(e){var s,c,l,u=new $n,h=new $n;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){var d=(a=this.faces[r]).vertexNormals;3===d.length?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var r=(n=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new ma;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)c=new $n,l={a:new $n,b:new $n,c:new $n},o.push(c),s.push(l)}var c,l,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new zr),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Vr),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new Vn).getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==t&&p.applyMatrix4(t),a.push(p)}for(h=0,d=u.length;h<d;h++)l.push(u[h].clone());for(h=0,d=c.length;h<d;h++){var f,m,g,v=c[h],y=v.vertexNormals,x=v.vertexColors;(f=new bi(v.a+i,v.b+i,v.c+i)).normal.copy(v.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize();for(var b=0,_=y.length;b<_;b++)m=y[b].clone(),void 0!==r&&m.applyMatrix3(r).normalize(),f.vertexNormals.push(m);f.color.copy(v.color);for(b=0,_=x.length;b<_;b++)g=x[b],f.vertexColors.push(g.clone());f.materialIndex=v.materialIndex+n,s.push(f)}for(h=0,d=e.faceVertexUvs.length;h<d;h++){var w=e.faceVertexUvs[h];void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]);for(b=0,_=w.length;b<_;b++){for(var M=w[b],T=[],S=0,E=M.length;S<E;S++)T.push(M[S].clone());this.faceVertexUvs[h].push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,r,i,a,o,s,c={},l=[],u=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)e=this.vertices[n],void 0===c[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(c[t]=n,l.push(this.vertices[n]),u[n]=l.length-1):u[n]=u[c[t]];var d=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.c];for(var p=0;p<3;p++)if(a[p]===a[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new $n(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(i=[]);for(n=0;n<t;n++){var s=e[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],u={},h=[],d={};for(i=0;i<this.faces.length;i++){var p=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=p.normal.length()>0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][i];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(T(p.normal)),g){var _=p.vertexNormals;o.push(T(_[0]),T(_[1]),T(_[2]))}if(v&&o.push(S(p.color)),y){var w=p.vertexColors;o.push(S(w[0]),S(w[1]),S(w[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function T(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]||(c[t]=s.length/3,s.push(e.x,e.y,e.z)),c[t]}function S(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]||(u[t]=l.length,l.push(e.getHex())),u[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=h.length/2,h.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new ma).copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],d=[];for(a=0,o=h.length;a<o;a++){var p=h[a];d.push(p.clone())}this.faceVertexUvs[t].push(d)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],r=0,i=f[t].vertices.length;r<i;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,i=f[t].normals.length;r<i;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],r=0,i=g[t].vertexNormals.length;r<i;r++){var y=g[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],r=0,i=g[t].faceNormals.length;r<i;r++)v.faceNormals.push(g[t].faceNormals[r].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var _=e.skinIndices;for(t=0,n=_.length;t<n;t++)this.skinIndices.push(_[t].clone());var w=e.lineDistances;for(t=0,n=w.length;t<n;t++)this.lineDistances.push(w[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var T=e.boundingSphere;return null!==T&&(this.boundingSphere=T.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class ga extends ma{constructor(e,t,n,r,i,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new va(e,t,n,r,i,a)),this.mergeVertices()}}class va extends ji{constructor(e,t,n,r,i,a){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};const o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;const s=[],c=[],l=[],u=[];let h=0,d=0;function p(e,t,n,r,i,a,p,f,m,g,v){const y=a/m,x=p/g,b=a/2,_=p/2,w=f/2,M=m+1,T=g+1;let S=0,E=0;const A=new $n;for(let a=0;a<T;a++){const o=a*x-_;for(let s=0;s<M;s++){const h=s*y-b;A[e]=h*r,A[t]=o*i,A[n]=w,c.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,l.push(A.x,A.y,A.z),u.push(s/m),u.push(1-a/g),S+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=h+t+M*e,r=h+t+M*(e+1),i=h+(t+1)+M*(e+1),a=h+(t+1)+M*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(d,E,v),d+=E,h+=S}p("z","y","x",-1,-1,n,t,e,a,i,0),p("z","y","x",1,-1,n,t,-e,a,i,1),p("x","z","y",1,1,e,n,t,r,a,2),p("x","z","y",1,-1,e,n,-t,r,a,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new Di(c,3)),this.setAttribute("normal",new Di(l,3)),this.setAttribute("uv",new Di(u,2))}}function ya(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function xa(e){for(var t={},n=0;n<e.length;n++){var r=ya(e[n]);for(var i in r)t[i]=r[i]}return t}var ba={clone:ya,merge:xa};function _a(e){wi.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function wa(){Sr.call(this),this.type="Camera",this.matrixWorldInverse=new sr,this.projectionMatrix=new sr,this.projectionMatrixInverse=new sr}function Ma(e,t,n,r){wa.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}_a.prototype=Object.create(wi.prototype),_a.prototype.constructor=_a,_a.prototype.isShaderMaterial=!0,_a.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ya(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},_a.prototype.toJSON=function(e){var t=wi.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},wa.prototype=Object.assign(Object.create(Sr.prototype),{constructor:wa,isCamera:!0,copy:function(e,t){return Sr.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new $n),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Sr.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Sr.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Ma.prototype=Object.assign(Object.create(wa.prototype),{constructor:Ma,isPerspectiveCamera:!0,copy:function(e,t){return wa.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Gn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Gn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Gn.RAD2DEG*Math.atan(Math.tan(.5*Gn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(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=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Gn.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Sr.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function Ta(e,t,n){if(Sr.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var r=new Ma(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new $n(1,0,0)),this.add(r);var i=new Ma(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new $n(-1,0,0)),this.add(i);var a=new Ma(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new $n(0,1,0)),this.add(a);var o=new Ma(90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new $n(0,-1,0)),this.add(o);var s=new Ma(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new $n(0,0,1)),this.add(s);var c=new Ma(90,1,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new $n(0,0,-1)),this.add(c),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l},this.clear=function(e,t,r,i){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,r,i);e.setRenderTarget(a)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Sa(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Yn.call(this,e,e,t)}function Ea(e,t,n,r,i,a,o,s,c,l,u,h){qn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==c?c:ve,this.minFilter=void 0!==l?l:ve,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Ta.prototype=Object.create(Sr.prototype),Ta.prototype.constructor=Ta,Sa.prototype=Object.create(Yn.prototype),Sa.prototype.constructor=Sa,Sa.prototype.isWebGLCubeRenderTarget=!0,Sa.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Er,r={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},i=new _a({type:"CubemapFromEquirect",uniforms:ya(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:v,blending:_});i.uniforms.tEquirect.value=t;var a=new ca(new va(5,5,5),i);return n.add(a),new Ta(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},Ea.prototype=Object.create(qn.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isDataTexture=!0;var Aa=new Vr,La=new $n;function Ra(e,t,n,r,i,a){this.planes=[void 0!==e?e:new ti,void 0!==t?t:new ti,void 0!==n?n:new ti,void 0!==r?r:new ti,void 0!==i?i:new ti,void 0!==a?a:new ti]}Object.assign(Ra.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+c,f+d,y+g).normalize(),t[3].setComponents(o-i,u-c,f-d,y-g).normalize(),t[4].setComponents(o-a,u-l,f-p,y-v).normalize(),t[5].setComponents(o+a,u+l,f+p,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Aa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Aa)},intersectsSprite:function(e){return Aa.center.set(0,0,0),Aa.radius=.7071067811865476,Aa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Aa)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(La.x=r.normal.x>0?e.max.x:e.min.x,La.y=r.normal.y>0?e.max.y:e.min.y,La.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(La)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Pa={common:{diffuse:{value:new gi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Vn},uv2Transform:{value:new Vn},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new kn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new gi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new gi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Vn}},sprite:{diffuse:{value:new gi(15658734)},opacity:{value:1},center:{value:new kn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Vn}}};function Ca(){var e=null,t=!1,n=null;function r(i,a){!1!==t&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Oa(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){t.isInterleavedBufferAttribute&&(t=t.data);var a=r.get(t);void 0===a?r.set(t,function(t,n){var r=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:r instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,i)):a.version<t.version&&(!function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,i),a.version=t.version)}}}function Da(e,t,n,r){ma.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ia(e,t,n,r)),this.mergeVertices()}function Ia(e,t,n,r){ji.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,l=Math.floor(r)||1,u=c+1,h=l+1,d=e/c,p=t/l,f=[],m=[],g=[],v=[];for(a=0;a<h;a++){var y=a*p-s;for(i=0;i<u;i++){var x=i*d-o;m.push(x,-y,0),g.push(0,0,1),v.push(i/c),v.push(1-a/l)}}for(a=0;a<l;a++)for(i=0;i<c;i++){var b=i+u*a,_=i+u*(a+1),w=i+1+u*(a+1),M=i+1+u*a;f.push(b,_,M),f.push(_,w,M)}this.setIndex(f),this.setAttribute("position",new Di(m,3)),this.setAttribute("normal",new Di(g,3)),this.setAttribute("uv",new Di(v,2))}Da.prototype=Object.create(ma.prototype),Da.prototype.constructor=Da,Ia.prototype=Object.create(ji.prototype),Ia.prototype.constructor=Ia;var Na={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Fa={basic:{uniforms:xa([Pa.common,Pa.specularmap,Pa.envmap,Pa.aomap,Pa.lightmap,Pa.fog]),vertexShader:Na.meshbasic_vert,fragmentShader:Na.meshbasic_frag},lambert:{uniforms:xa([Pa.common,Pa.specularmap,Pa.envmap,Pa.aomap,Pa.lightmap,Pa.emissivemap,Pa.fog,Pa.lights,{emissive:{value:new gi(0)}}]),vertexShader:Na.meshlambert_vert,fragmentShader:Na.meshlambert_frag},phong:{uniforms:xa([Pa.common,Pa.specularmap,Pa.envmap,Pa.aomap,Pa.lightmap,Pa.emissivemap,Pa.bumpmap,Pa.normalmap,Pa.displacementmap,Pa.fog,Pa.lights,{emissive:{value:new gi(0)},specular:{value:new gi(1118481)},shininess:{value:30}}]),vertexShader:Na.meshphong_vert,fragmentShader:Na.meshphong_frag},standard:{uniforms:xa([Pa.common,Pa.envmap,Pa.aomap,Pa.lightmap,Pa.emissivemap,Pa.bumpmap,Pa.normalmap,Pa.displacementmap,Pa.roughnessmap,Pa.metalnessmap,Pa.fog,Pa.lights,{emissive:{value:new gi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Na.meshphysical_vert,fragmentShader:Na.meshphysical_frag},toon:{uniforms:xa([Pa.common,Pa.specularmap,Pa.aomap,Pa.lightmap,Pa.emissivemap,Pa.bumpmap,Pa.normalmap,Pa.displacementmap,Pa.gradientmap,Pa.fog,Pa.lights,{emissive:{value:new gi(0)},specular:{value:new gi(1118481)},shininess:{value:30}}]),vertexShader:Na.meshtoon_vert,fragmentShader:Na.meshtoon_frag},matcap:{uniforms:xa([Pa.common,Pa.bumpmap,Pa.normalmap,Pa.displacementmap,Pa.fog,{matcap:{value:null}}]),vertexShader:Na.meshmatcap_vert,fragmentShader:Na.meshmatcap_frag},points:{uniforms:xa([Pa.points,Pa.fog]),vertexShader:Na.points_vert,fragmentShader:Na.points_frag},dashed:{uniforms:xa([Pa.common,Pa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Na.linedashed_vert,fragmentShader:Na.linedashed_frag},depth:{uniforms:xa([Pa.common,Pa.displacementmap]),vertexShader:Na.depth_vert,fragmentShader:Na.depth_frag},normal:{uniforms:xa([Pa.common,Pa.bumpmap,Pa.normalmap,Pa.displacementmap,{opacity:{value:1}}]),vertexShader:Na.normal_vert,fragmentShader:Na.normal_frag},sprite:{uniforms:xa([Pa.sprite,Pa.fog]),vertexShader:Na.sprite_vert,fragmentShader:Na.sprite_frag},background:{uniforms:{uvTransform:{value:new Vn},t2D:{value:null}},vertexShader:Na.background_vert,fragmentShader:Na.background_frag},cube:{uniforms:xa([Pa.envmap,{opacity:{value:1}}]),vertexShader:Na.cube_vert,fragmentShader:Na.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Na.equirect_vert,fragmentShader:Na.equirect_frag},distanceRGBA:{uniforms:xa([Pa.common,Pa.displacementmap,{referencePosition:{value:new $n},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Na.distanceRGBA_vert,fragmentShader:Na.distanceRGBA_frag},shadow:{uniforms:xa([Pa.lights,Pa.fog,{color:{value:new gi(0)},opacity:{value:1}}]),vertexShader:Na.shadow_vert,fragmentShader:Na.shadow_frag}};function Ba(e,t,n,r){var i,a,o=new gi(0),s=0,c=null,l=0,u=null;function h(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),h(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){h(o,s=e)},render:function(t,r,d,p){var f=r.background,m=e.xr,y=m.getSession&&m.getSession();if(y&&"additive"===y.environmentBlendMode&&(f=null),null===f?h(o,s):f&&f.isColor&&(h(f,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||f.mapping===de)){void 0===a&&((a=new ca(new va(1,1,1),new _a({type:"BackgroundCubeMaterial",uniforms:ya(Fa.cube.uniforms),vertexShader:Fa.cube.vertexShader,fragmentShader:Fa.cube.fragmentShader,side:v,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var x=f.isWebGLCubeRenderTarget?f.texture:f;a.material.uniforms.envMap.value=x,a.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,c===f&&l===x.version&&u===e.toneMapping||(a.material.needsUpdate=!0,c=f,l=x.version,u=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else f&&f.isTexture&&(void 0===i&&((i=new ca(new Ia(2,2),new _a({type:"BackgroundMaterial",uniforms:ya(Fa.background.uniforms),vertexShader:Fa.background.vertexShader,fragmentShader:Fa.background.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(i)),i.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),i.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&l===f.version&&u===e.toneMapping||(i.material.needsUpdate=!0,c=f,l=f.version,u=e.toneMapping),t.unshift(i,i.geometry,i.material,0,0,null))}}}function Ha(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i)},this.renderInstances=function(r,o,s,c){if(0!==c){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,o,s,c),n.update(s,i,c)}}}function Ua(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===n.logarithmicDepthBuffer,l=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function za(){var e=this,t=null,n=0,r=!1,i=!1,a=new ti,o=new Vn,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==i||null===l){var u=r+4*c,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===l||l.length<u)&&(l=new Float32Array(u));for(var d=0,p=r;d!==c;++d,p+=4)a.copy(t[d]).applyMatrix4(h,o),a.normal.toArray(l,p),l[p+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=0!==e.length||i||0!==n||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,h,d){if(!r||null===e||0===e.length||i&&!o)i?l(null):c();else{var p=i?0:n,f=4*p,m=h.clippingState||null;s.value=m,m=l(e,u,f,d);for(var g=0;g!==f;++g)m[g]=t[g];h.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=p}}}function Ga(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function ka(e,t,n){var r=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=r.get(o);for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener("dispose",a),r.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),n.memory.geometries--}function o(e){var n=[],r=e.index,a=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var c=0,l=s.length;c<l;c+=3){var u=s[c+0],h=s[c+1],d=s[c+2];n.push(u,h,h,d,d,u)}}else{s=a.array;o=a.version;for(c=0,l=s.length/3-1;c<l;c+=3){u=c+0,h=c+1,d=c+2;n.push(u,h,h,d,d,u)}}var p=new(Fi(n)>65535?Oi:Pi)(n,1);p.version=o,t.update(p,34963);var f=i.get(e);f&&t.remove(f),i.set(e,p)}return{get:function(e,t){var i=r.get(t);return i||(t.addEventListener("dispose",a),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new ji).setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)},update:function(e){var n=e.index,r=e.attributes;for(var i in null!==n&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=i.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return i.get(e)}}}function Va(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i)},this.renderInstances=function(r,c,l,u){if(0!==u){var h,d;if(s)h=e,d="drawElementsInstanced";else if(d="drawElementsInstancedANGLE",null===(h=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](i,l,a,c*o,u),n.update(l,i,u)}}}function ja(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(r=r||1,t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Wa(e,t){return Math.abs(t[1])-Math.abs(e[1])}function qa(e){var t={},n=new Float32Array(8);return{update:function(r,i,a,o){var s=r.morphTargetInfluences,c=void 0===s?0:s.length,l=t[i.id];if(void 0===l){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}var h=a.morphTargets&&i.morphAttributes.position,d=a.morphNormals&&i.morphAttributes.normal;for(u=0;u<c;u++){0!==(f=l[u])[1]&&(h&&i.deleteAttribute("morphTarget"+u),d&&i.deleteAttribute("morphNormal"+u))}for(u=0;u<c;u++){(f=l[u])[0]=u,f[1]=s[u]}l.sort(Wa);var p=0;for(u=0;u<8;u++){var f;if(f=l[u]){var m=f[0],g=f[1];if(g){h&&i.setAttribute("morphTarget"+u,h[m]),d&&i.setAttribute("morphNormal"+u,d[m]),n[u]=g,p+=g;continue}}n[u]=0}var v=i.morphTargetsRelative?1:1-p;o.getUniforms().setValue(e,"morphTargetBaseInfluence",v),o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Xa(e,t,n,r){var i=new WeakMap;return{update:function(e){var a=r.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){i=new WeakMap}}}function Ya(e,t,n,r,i,a,o,s,c,l){e=void 0!==e?e:[],t=void 0!==t?t:se,o=void 0!==o?o:ze,qn.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function Za(e,t,n,r){qn.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=ve,this.minFilter=ve,this.wrapR=me,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ja(e,t,n,r){qn.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=ve,this.minFilter=ve,this.wrapR=me,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Fa.physical={uniforms:xa([Fa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new kn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new gi(0)},transparency:{value:0}}]),vertexShader:Na.meshphysical_vert,fragmentShader:Na.meshphysical_frag},Ya.prototype=Object.create(qn.prototype),Ya.prototype.constructor=Ya,Ya.prototype.isCubeTexture=!0,Object.defineProperty(Ya.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Za.prototype=Object.create(qn.prototype),Za.prototype.constructor=Za,Za.prototype.isDataTexture2DArray=!0,Ja.prototype=Object.create(qn.prototype),Ja.prototype.constructor=Ja,Ja.prototype.isDataTexture3D=!0;var Ka=new qn,Qa=new Za,$a=new Ja,eo=new Ya,to=[],no=[],ro=new Float32Array(16),io=new Float32Array(9),ao=new Float32Array(4);function oo(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=to[i];if(void 0===a&&(a=new Float32Array(i),to[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function so(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function co(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function lo(e,t){var n=no[t];void 0===n&&(n=new Int32Array(t),no[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function uo(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ho(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(so(n,t))return;e.uniform2fv(this.addr,t),co(n,t)}}function po(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(so(n,t))return;e.uniform3fv(this.addr,t),co(n,t)}}function fo(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(so(n,t))return;e.uniform4fv(this.addr,t),co(n,t)}}function mo(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(so(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),co(n,t)}else{if(so(n,r))return;ao.set(r),e.uniformMatrix2fv(this.addr,!1,ao),co(n,r)}}function go(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(so(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),co(n,t)}else{if(so(n,r))return;io.set(r),e.uniformMatrix3fv(this.addr,!1,io),co(n,r)}}function vo(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(so(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),co(n,t)}else{if(so(n,r))return;ro.set(r),e.uniformMatrix4fv(this.addr,!1,ro),co(n,r)}}function yo(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||Ka,i)}function xo(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Qa,i)}function bo(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||$a,i)}function _o(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||eo,i)}function wo(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Mo(e,t){var n=this.cache;so(n,t)||(e.uniform2iv(this.addr,t),co(n,t))}function To(e,t){var n=this.cache;so(n,t)||(e.uniform3iv(this.addr,t),co(n,t))}function So(e,t){var n=this.cache;so(n,t)||(e.uniform4iv(this.addr,t),co(n,t))}function Eo(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Ao(e,t){e.uniform1fv(this.addr,t)}function Lo(e,t){e.uniform1iv(this.addr,t)}function Ro(e,t){e.uniform2iv(this.addr,t)}function Po(e,t){e.uniform3iv(this.addr,t)}function Co(e,t){e.uniform4iv(this.addr,t)}function Oo(e,t){var n=oo(t,this.size,2);e.uniform2fv(this.addr,n)}function Do(e,t){var n=oo(t,this.size,3);e.uniform3fv(this.addr,n)}function Io(e,t){var n=oo(t,this.size,4);e.uniform4fv(this.addr,n)}function No(e,t){var n=oo(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Fo(e,t){var n=oo(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Bo(e,t){var n=oo(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ho(e,t,n){var r=t.length,i=lo(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||Ka,i[a])}function Uo(e,t,n){var r=t.length,i=lo(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||eo,i[a])}function zo(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return uo;case 35664:return ho;case 35665:return po;case 35666:return fo;case 35674:return mo;case 35675:return go;case 35676:return vo;case 5124:case 35670:return wo;case 35667:case 35671:return Mo;case 35668:case 35672:return To;case 35669:case 35673:return So;case 5125:return Eo;case 35678:case 36198:case 36298:case 36306:case 35682:return yo;case 35679:case 36299:case 36307:return bo;case 35680:case 36300:case 36308:case 36293:return _o;case 36289:case 36303:case 36311:case 36292:return xo}}(t.type)}function Go(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ao;case 35664:return Oo;case 35665:return Do;case 35666:return Io;case 35674:return No;case 35675:return Fo;case 35676:return Bo;case 5124:case 35670:return Lo;case 35667:case 35671:return Ro;case 35668:case 35672:return Po;case 35669:case 35673:return Co;case 35678:case 36198:case 36298:case 36306:case 35682:return Ho;case 35680:case 36300:case 36308:case 36293:return Uo}}(t.type)}function ko(e){this.id=e,this.seq=[],this.map={}}Go.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),co(t,e)},ko.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Vo=/([\w\d_]+)(\])?(\[|\.)?/g;function jo(e,t){e.seq.push(t),e.map[t.id]=t}function Wo(e,t,n){var r=e.name,i=r.length;for(Vo.lastIndex=0;;){var a=Vo.exec(r),o=Vo.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===i){jo(n,void 0===l?new zo(s,e,t):new Go(s,e,t));break}var u=n.map[s];void 0===u&&jo(n,u=new ko(s)),n=u}}function qo(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Wo(i,e.getUniformLocation(t,i.name),this)}}function Xo(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}qo.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},qo.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},qo.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},qo.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Yo=0;function Zo(e){switch(e){case $t:return["Linear","( value )"];case en:return["sRGB","( value )"];case nn:return["RGBE","( value )"];case an:return["RGBM","( value, 7.0 )"];case on:return["RGBM","( value, 16.0 )"];case sn:return["RGBD","( value, 256.0 )"];case tn:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case rn:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function Jo(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();return r&&""===i?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+i+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Ko(e,t){var n=Zo(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Qo(e,t){var n;switch(t){case te:n="Linear";break;case ne:n="Reinhard";break;case re:n="Uncharted2";break;case ie:n="OptimizedCineon";break;case ae:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function $o(e){return""!==e}function es(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ts(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var ns=/^[ \t]*#include +<([\w\d./]+)>/gm;function rs(e){return e.replace(ns,is)}function is(e,t){var n=Na[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return rs(n)}var as=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,os=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function ss(e){return e.replace(os,ls).replace(as,cs)}function cs(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ls(e,t,n,r)}function ls(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function us(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function hs(e,t,n){var r,i,a,o,s,c=e.getContext(),l=n.defines,u=n.vertexShader,h=n.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===p?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===f?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===m&&(t="SHADOWMAP_TYPE_VSM"),t}(n),g=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case se:case ce:t="ENVMAP_TYPE_CUBE";break;case de:case pe:t="ENVMAP_TYPE_CUBE_UV";break;case le:case ue:t="ENVMAP_TYPE_EQUIREC";break;case he:t="ENVMAP_TYPE_SPHERE"}return t}(n),v=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case ce:case ue:t="ENVMAP_MODE_REFRACTION"}return t}(n),y=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case K:t="ENVMAP_BLENDING_MULTIPLY";break;case Q:t="ENVMAP_BLENDING_MIX";break;case $:t="ENVMAP_BLENDING_ADD"}return t}(n),x=e.gammaFactor>0?e.gammaFactor:1,b=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter($o).join("\n")}(n),_=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(l),w=c.createProgram();if(n.isRawShaderMaterial?((r=[_].filter($o).join("\n")).length>0&&(r+="\n"),(i=[b,_].filter($o).join("\n")).length>0&&(i+="\n")):(r=[us(n),"#define SHADER_NAME "+n.shaderName,_,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+v:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter($o).join("\n"),i=[b,us(n),"#define SHADER_NAME "+n.shaderName,_,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",n.envMap?"#define "+y:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ee?"#define TONE_MAPPING":"",n.toneMapping!==ee?Na.tonemapping_pars_fragment:"",n.toneMapping!==ee?Qo("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Na.encodings_pars_fragment:"",n.mapEncoding?Ko("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Ko("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Ko("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ko("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Ko("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(a="linearToOutputTexel",o=n.outputEncoding,s=Zo(o),"vec4 "+a+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($o).join("\n")),u=ts(u=es(u=rs(u),n),n),h=ts(h=es(h=rs(h),n),n),u=ss(u),h=ss(h),n.isWebGL2&&!n.isRawShaderMaterial){var M=!1,T=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==u.match(T)&&null!==h.match(T)&&(M=!0,u=u.replace(T,""),h=h.replace(T,"")),r=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,i=["#version 300 es\n","#define varying in",M?"":"out highp vec4 pc_fragColor;",M?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+i}var S,E,A=i+h,L=Xo(c,35633,r+u),R=Xo(c,35632,A);if(c.attachShader(w,L),c.attachShader(w,R),void 0!==n.index0AttributeName?c.bindAttribLocation(w,0,n.index0AttributeName):!0===n.morphTargets&&c.bindAttribLocation(w,0,"position"),c.linkProgram(w),e.debug.checkShaderErrors){var P=c.getProgramInfoLog(w).trim(),C=c.getShaderInfoLog(L).trim(),O=c.getShaderInfoLog(R).trim(),D=!0,I=!0;if(!1===c.getProgramParameter(w,35714)){D=!1;var N=Jo(c,L,"vertex"),F=Jo(c,R,"fragment");console.error("THREE.WebGLProgram: shader error: ",c.getError(),"35715",c.getProgramParameter(w,35715),"gl.getProgramInfoLog",P,N,F)}else""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==C&&""!==O||(I=!1);I&&(this.diagnostics={runnable:D,programLog:P,vertexShader:{log:C,prefix:r},fragmentShader:{log:O,prefix:i}})}return c.deleteShader(L),c.deleteShader(R),this.getUniforms=function(){return void 0===S&&(S=new qo(c,w)),S},this.getAttributes=function(){return void 0===E&&(E=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(c,w)),E},this.destroy=function(){c.deleteProgram(w),this.program=void 0},this.name=n.shaderName,this.id=Yo++,this.cacheKey=t,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=R,this}function ds(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},h=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function d(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=$t,t}this.getParameters=function(r,h,p,f,m,g,x){var b=f.fog,_=r.isMeshStandardMaterial?f.environment:null,w=r.envMap||_,M=u[r.type],T=x.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var n=c,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(x):0;null!==r.precision&&(s=n.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",s,"instead.");var S=function(e,t){var n;if(t){var r=Fa[t];n={name:e.type,uniforms:ba.clone(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(r,M);r.onBeforeCompile(S,e);var E=e.getRenderTarget();return{isWebGL2:i,shaderID:M,shaderName:S.name,uniforms:S.uniforms,vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,defines:r.defines,isRawShaderMaterial:r.isRawShaderMaterial,isShaderMaterial:r.isShaderMaterial,precision:s,instancing:!0===x.isInstancedMesh,supportsVertexTextures:l,outputEncoding:null!==E?d(E.texture):e.outputEncoding,map:!!r.map,mapEncoding:d(r.map),matcap:!!r.matcap,matcapEncoding:d(r.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:d(w),envMapCubeUV:!!w&&(w.mapping===de||w.mapping===pe),lightMap:!!r.lightMap,lightMapEncoding:d(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:d(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===hn,tangentSpaceNormalMap:r.normalMapType===un,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||!r.displacementMap),fog:!!b,useFog:r.fog,fogExp2:b&&b.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:a,skinning:r.skinning&&T>0,maxBones:T,useVertexTexture:o,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numDirLightShadows:h.directionalShadowMap.length,numPointLightShadows:h.pointShadowMap.length,numSpotLightShadows:h.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:g,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&p.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:ee,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===y,flipSided:r.side===v,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:i||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:i||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:r.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(void 0===t.isRawShaderMaterial){for(var i=0;i<h.length;i++)n.push(t[h[i]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var i,a=0,o=r.length;a<o;a++){var s=r[a];if(s.cacheKey===n){++(i=s).usedTimes;break}}return void 0===i&&(i=new hs(e,n,t),r.push(i)),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}function ps(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function fs(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function ms(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function gs(){var e=[],t=0,n=[],r=[],i={id:-1};function a(n,r,a,o,s,c){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:a,program:a.program||i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}return{opaque:n,transparent:r,init:function(){t=0,n.length=0,r.length=0},push:function(e,t,i,o,s,c){var l=a(e,t,i,o,s,c);(!0===i.transparent?r:n).push(l)},unshift:function(e,t,i,o,s,c){var l=a(e,t,i,o,s,c);(!0===i.transparent?r:n).unshift(l)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||fs),r.length>1&&r.sort(t||ms)}}}function vs(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener("dispose",t),e.delete(r)}return{get:function(n,r){var i,a=e.get(n);return void 0===a?(i=new gs,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):void 0===(i=a.get(r))&&(i=new gs,a.set(r,i)),i},dispose:function(){e=new WeakMap}}}function ys(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new $n,color:new gi};break;case"SpotLight":n={position:new $n,direction:new $n,color:new gi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new $n,color:new gi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new $n,skyColor:new gi,groundColor:new gi};break;case"RectAreaLight":n={color:new gi,position:new $n,halfWidth:new $n,halfHeight:new $n}}return e[t.id]=n,n}}}var xs=0;function bs(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function _s(){for(var e,t=new ys,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new kn};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new kn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=0;i<9;i++)r.probe.push(new $n);var a=new $n,o=new sr,s=new sr;return{setup:function(e,i,c){for(var l=0,u=0,h=0,d=0;d<9;d++)r.probe[d].set(0,0,0);var p=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,_=c.matrixWorldInverse;e.sort(bs),d=0;for(var w=e.length;d<w;d++){var M=e[d],T=M.color,S=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)l+=T.r*S,u+=T.g*S,h+=T.b*S;else if(M.isLightProbe)for(var L=0;L<9;L++)r.probe[L].addScaledVector(M.sh.coefficients[L],S);else if(M.isDirectionalLight){if((C=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(_),M.castShadow){var R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,r.directionalShadow[p]=P,r.directionalShadowMap[p]=A,r.directionalShadowMatrix[p]=M.shadow.matrix,y++}r.directional[p]=C,p++}else if(M.isSpotLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(_),C.color.copy(T).multiplyScalar(S),C.distance=E,C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(_),C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow){R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,r.spotShadow[m]=P,r.spotShadowMap[m]=A,r.spotShadowMatrix[m]=M.shadow.matrix,b++}r.spot[m]=C,m++}else if(M.isRectAreaLight){(C=t.get(M)).color.copy(T).multiplyScalar(S),C.position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(_),s.identity(),o.copy(M.matrixWorld),o.premultiply(_),s.extractRotation(o),C.halfWidth.set(.5*M.width,0,0),C.halfHeight.set(0,.5*M.height,0),C.halfWidth.applyMatrix4(s),C.halfHeight.applyMatrix4(s),r.rectArea[g]=C,g++}else if(M.isPointLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(_),C.color.copy(M.color).multiplyScalar(M.intensity),C.distance=M.distance,C.decay=M.decay,M.castShadow){var P;R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,P.shadowCameraNear=R.camera.near,P.shadowCameraFar=R.camera.far,r.pointShadow[f]=P,r.pointShadowMap[f]=A,r.pointShadowMatrix[f]=M.shadow.matrix,x++}r.point[f]=C,f++}else if(M.isHemisphereLight){var C;(C=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),C.direction.transformDirection(_),C.direction.normalize(),C.skyColor.copy(M.color).multiplyScalar(S),C.groundColor.copy(M.groundColor).multiplyScalar(S),r.hemi[v]=C,v++}}r.ambient[0]=l,r.ambient[1]=u,r.ambient[2]=h;var O=r.hash;O.directionalLength===p&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===g&&O.hemiLength===v&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===b||(r.directional.length=p,r.spot.length=m,r.rectArea.length=g,r.point.length=f,r.hemi.length=v,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=x,r.pointShadowMap.length=x,r.spotShadow.length=b,r.spotShadowMap.length=b,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=x,r.spotShadowMatrix.length=b,O.directionalLength=p,O.pointLength=f,O.spotLength=m,O.rectAreaLength=g,O.hemiLength=v,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=b,r.version=xs++)},state:r}}function ws(){var e=new _s,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(r){e.setup(t,n,r)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function Ms(){var e=new WeakMap;function t(n){var r=n.target;r.removeEventListener("dispose",t),e.delete(r)}return{get:function(n,r){var i;return!1===e.has(n)?(i=new ws,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):!1===e.get(n).has(r)?(i=new ws,e.get(n).set(r,i)):i=e.get(n).get(r),i},dispose:function(){e=new WeakMap}}}function Ts(e){wi.call(this),this.type="MeshDepthMaterial",this.depthPacking=cn,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function Ss(e){wi.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new $n,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}Ts.prototype=Object.create(wi.prototype),Ts.prototype.constructor=Ts,Ts.prototype.isMeshDepthMaterial=!0,Ts.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Ss.prototype=Object.create(wi.prototype),Ss.prototype.constructor=Ss,Ss.prototype.isMeshDistanceMaterial=!0,Ss.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function Es(e,t,n){var r=new Ra,i=new kn,a=new kn,o=new Xn,s=[],c=[],l={},u={0:v,1:g,2:y},h=new _a({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new kn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=h.clone();d.defines.HORIZONAL_PASS=1;var f=new ji;f.setAttribute("position",new Si(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var x=new ca(f,h),b=this;function w(n,r){var i=t.update(x);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,h,x,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,d,x,null)}function M(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return void 0===i&&(i=new Ts({depthPacking:ln,morphTargets:e,skinning:t}),s[r]=i),i}function T(e,t,n){var r=e<<0|t<<1|n<<2,i=c[r];return void 0===i&&(i=new Ss({morphTargets:e,skinning:t}),c[r]=i),i}function S(t,n,r,i,a,o,s){var c=null,h=M,d=t.customDepthMaterial;if(!0===i.isPointLight&&(h=T,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),c=h(p,f,!0===t.isInstancedMesh)}else c=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var g=c.uuid,v=r.uuid,y=l[g];void 0===y&&(y={},l[g]=y);var x=y[v];void 0===x&&(x=c.clone(),y[v]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,c.side=s===m?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,!0===i.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=a,c.farDistance=o),c}function E(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===m)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var c=t.update(n),l=n.material;if(Array.isArray(l))for(var u=c.groups,h=0,d=u.length;h<d;h++){var p=u[h],f=l[p.materialIndex];if(f&&f.visible){var g=S(n,c,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,g,n,p)}}else if(l.visible){g=S(n,c,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,g,n,null)}}for(var v=n.children,y=0,x=v.length;y<x;y++)E(v[y],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p,this.render=function(t,s,c){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(_),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=t.length;p<f;p++){var g=t[p],v=g.shadow;if(void 0!==v){i.copy(v.mapSize);var y=v.getFrameExtents();if(i.multiply(y),a.copy(v.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/y.x),i.x=a.x*y.x,v.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/y.y),i.y=a.y*y.y,v.mapSize.y=a.y)),null===v.map&&!v.isPointLightShadow&&this.type===m){var x={minFilter:we,magFilter:we,format:Ge};v.map=new Yn(i.x,i.y,x),v.map.texture.name=g.name+".shadowMap",v.mapPass=new Yn(i.x,i.y,x),v.camera.updateProjectionMatrix()}if(null===v.map){x={minFilter:ve,magFilter:ve,format:Ge};v.map=new Yn(i.x,i.y,x),v.map.texture.name=g.name+".shadowMap",v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();for(var M=v.getViewportCount(),T=0;T<M;T++){var S=v.getViewport(T);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),v.updateMatrices(g,T),r=v.getFrustum(),E(s,c,v.camera,g,this.type)}v.isPointLightShadow||this.type!==m||w(v,c)}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}b.needsUpdate=!1,e.setRenderTarget(l,u,h)}}}function As(e,t,n){var r=n.isWebGL2;var i=new function(){var t=!1,n=new Xn,r=null,i=new Xn(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?xe(2929):be(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case V:e.depthFunc(512);break;case j:e.depthFunc(519);break;case W:e.depthFunc(513);break;case q:e.depthFunc(515);break;case X:e.depthFunc(514);break;case Y:e.depthFunc(518);break;case Z:e.depthFunc(516);break;case J:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},l=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?xe(2960):be(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&c===r||(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}},u=e.getParameter(34921),h=new Uint8Array(u),d=new Uint8Array(u),p=new Uint8Array(u),f={},m=null,g=null,x=null,b=null,K=null,Q=null,$=null,ee=null,te=null,ne=!1,re=null,ie=null,ae=null,oe=null,se=null,ce=e.getParameter(35661),le=!1,ue=0,he=e.getParameter(7938);-1!==he.indexOf("WebGL")?(ue=parseFloat(/^WebGL\ ([0-9])/.exec(he)[1]),le=ue>=1):-1!==he.indexOf("OpenGL ES")&&(ue=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(he)[1]),le=ue>=2);var de=null,pe={},fe=new Xn,me=new Xn;function ge(t,n,r){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var ve={};function ye(n,i){(h[n]=1,0===d[n]&&(e.enableVertexAttribArray(n),d[n]=1),p[n]!==i)&&((r?e:t.get("ANGLE_instanced_arrays"))[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),p[n]=i)}function xe(t){!0!==f[t]&&(e.enable(t),f[t]=!0)}function be(t){!1!==f[t]&&(e.disable(t),f[t]=!1)}ve[3553]=ge(3553,3553,1),ve[34067]=ge(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),l.setClear(0),xe(2929),a.setFunc(q),Se(!1),Ee(s),xe(2884),Te(_);var _e={[A]:32774,[L]:32778,[R]:32779};if(r)_e[P]=32775,_e[C]=32776;else{var we=t.get("EXT_blend_minmax");null!==we&&(_e[P]=we.MIN_EXT,_e[C]=we.MAX_EXT)}var Me={[O]:0,[D]:1,[I]:768,[F]:770,[k]:776,[z]:774,[H]:772,[N]:769,[B]:771,[G]:775,[U]:773};function Te(t,n,r,i,a,o,s,c){if(t!==_){if(g||(xe(3042),g=!0),t===E)a=a||n,o=o||r,s=s||i,n===b&&a===$||(e.blendEquationSeparate(_e[n],_e[a]),b=n,$=a),r===K&&i===Q&&o===ee&&s===te||(e.blendFuncSeparate(Me[r],Me[i],Me[o],Me[s]),K=r,Q=i,ee=o,te=s),x=t,ne=null;else if(t!==x||c!==ne){if(b===A&&$===A||(e.blendEquation(32774),b=A,$=A),c)switch(t){case w:e.blendFuncSeparate(1,771,1,771);break;case M:e.blendFunc(1,1);break;case T:e.blendFuncSeparate(0,0,769,771);break;case S:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case w:e.blendFuncSeparate(770,771,1,771);break;case M:e.blendFunc(770,1);break;case T:e.blendFunc(0,769);break;case S:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}K=null,Q=null,ee=null,te=null,x=t,ne=c}}else g&&(be(3042),g=!1)}function Se(t){re!==t&&(t?e.frontFace(2304):e.frontFace(2305),re=t)}function Ee(t){t!==o?(xe(2884),t!==ie&&(t===s?e.cullFace(1029):t===c?e.cullFace(1028):e.cullFace(1032))):be(2884),ie=t}function Ae(t,n,r){t?(xe(32823),oe===n&&se===r||(e.polygonOffset(n,r),oe=n,se=r)):be(32823)}function Le(t){void 0===t&&(t=33984+ce-1),de!==t&&(e.activeTexture(t),de=t)}return{buffers:{color:i,depth:a,stencil:l},initAttributes:function(){for(var e=0,t=h.length;e<t;e++)h[e]=0},enableAttribute:function(e){ye(e,0)},enableAttributeAndDivisor:ye,disableUnusedAttributes:function(){for(var t=0,n=d.length;t!==n;++t)d[t]!==h[t]&&(e.disableVertexAttribArray(t),d[t]=0)},vertexAttribPointer:function(t,n,i,a,o,s){!0!==r||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,a,o,s):e.vertexAttribIPointer(t,n,i,a,o,s)},enable:xe,disable:be,useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:Te,setMaterial:function(e,t){e.side===y?be(2884):xe(2884);var n=e.side===v;t&&(n=!n),Se(n),e.blending===w&&!1===e.transparent?Te(_):Te(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),i.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Ae(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Se,setCullFace:Ee,setLineWidth:function(t){t!==ae&&(le&&e.lineWidth(t),ae=t)},setPolygonOffset:Ae,setScissorTest:function(e){e?xe(3089):be(3089)},activeTexture:Le,bindTexture:function(t,n){null===de&&Le();var r=pe[de];void 0===r&&(r={type:void 0,texture:void 0},pe[de]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||ve[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=pe[de];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===fe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),fe.copy(t))},viewport:function(t){!1===me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),me.copy(t))},reset:function(){for(var t=0;t<d.length;t++)1===d[t]&&(e.disableVertexAttribArray(t),d[t]=0);f={},de=null,pe={},m=null,x=null,re=null,ie=null,i.reset(),a.reset(),l.reset()}}}function Ls(e,t,n,r,i,a,o){var s,c=i.isWebGL2,l=i.maxTextures,u=i.maxCubemapSize,h=i.maxTextureSize,d=i.maxSamples,p=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Gn.floorPowerOfTwo:Math.floor,o=a(i*e.width),c=a(i*e.height);void 0===s&&(s=m(o,c));var l=n?m(o,c):s;return l.width=o,l.height=c,l.getContext("2d").drawImage(e,0,0,o,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+c+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return Gn.isPowerOfTwo(e.width)&&Gn.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==ve&&e.minFilter!==we}function x(t,n,i,a){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function b(n,r,i){if(!1===c)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function _(e){return e===ve||e===ye||e===be?9728:9729}function w(t){var n=t.target;n.removeEventListener("dispose",w),function(t){var n=r.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),r.remove(t)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=r.get(t),i=r.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}(n),o.memory.textures--}var T=0;function S(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function E(t,i){if(6===t.image.length){var o=r.get(t);if(t.version>0&&o.__version!==t.version){C(o,t),n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),l=t.image[0]&&t.image[0].isDataTexture,h=[],d=0;d<6;d++)h[d]=s||l?l?t.image[d].image:t.image[d]:g(t.image[d],!1,!0,u);var p,f=h[0],m=v(f)||c,_=a.convert(t.format),w=a.convert(t.type),M=b(t.internalFormat,_,w);if(P(34067,t,m),s){for(d=0;d<6;d++){p=h[d].mipmaps;for(var T=0;T<p.length;T++){var S=p[T];t.format!==Ge&&t.format!==ze?null!==_?n.compressedTexImage2D(34069+d,T,M,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+d,T,M,S.width,S.height,0,_,w,S.data)}}o.__maxMipLevel=p.length-1}else{p=t.mipmaps;for(d=0;d<6;d++)if(l){n.texImage2D(34069+d,0,M,h[d].width,h[d].height,0,_,w,h[d].data);for(T=0;T<p.length;T++){var E=(S=p[T]).image[d].image;n.texImage2D(34069+d,T+1,M,E.width,E.height,0,_,w,E.data)}}else{n.texImage2D(34069+d,0,M,_,w,h[d]);for(T=0;T<p.length;T++){S=p[T];n.texImage2D(34069+d,T+1,M,_,w,S.image[d])}}o.__maxMipLevel=p.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture)}}function A(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var L={[fe]:10497,[me]:33071,[ge]:33648},R={[ve]:9728,[ye]:9984,[be]:9986,[we]:9729,[Me]:9985,[Se]:9987};function P(n,a,o){o?(e.texParameteri(n,10242,L[a.wrapS]),e.texParameteri(n,10243,L[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,L[a.wrapR]),e.texParameteri(n,10240,R[a.magFilter]),e.texParameteri(n,10241,R[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===me&&a.wrapT===me||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,_(a.magFilter)),e.texParameteri(n,10241,_(a.minFilter)),a.minFilter!==ve&&a.minFilter!==we&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(a.type===De&&null===t.get("OES_texture_float_linear"))return;if(a.type===Ie&&null===(c||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function C(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",w),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),C(t,r),n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var s=function(e){return!c&&(e.wrapS!==me||e.wrapT!==me||e.minFilter!==ve&&e.minFilter!==we)}(r)&&!1===v(r.image),l=g(r.image,s,!1,h),u=v(l)||c,d=a.convert(r.format),p=a.convert(r.type),f=b(r.internalFormat,d,p);P(o,r,u);var m,_=r.mipmaps;if(r.isDepthTexture)f=6402,c?f=r.type===De?36012:r.type===Oe?33190:r.type===He?35056:33189:r.type===De&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===We&&6402===f&&r.type!==Pe&&r.type!==Oe&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Pe,p=a.convert(r.type)),r.format===qe&&6402===f&&(f=34041,r.type!==He&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=He,p=a.convert(r.type))),n.texImage2D(3553,0,f,l.width,l.height,0,d,p,null);else if(r.isDataTexture)if(_.length>0&&u){for(var w=0,M=_.length;w<M;w++)m=_[w],n.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);r.generateMipmaps=!1,t.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,f,l.width,l.height,0,d,p,l.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(w=0,M=_.length;w<M;w++)m=_[w],r.format!==Ge&&r.format!==ze?null!==d?n.compressedTexImage2D(3553,w,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,w,f,m.width,m.height,0,d,p,m.data);t.__maxMipLevel=_.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,f,l.width,l.height,l.depth,0,d,p,l.data),t.__maxMipLevel=0;else if(_.length>0&&u){for(w=0,M=_.length;w<M;w++)m=_[w],n.texImage2D(3553,w,f,d,p,m);r.generateMipmaps=!1,t.__maxMipLevel=_.length-1}else n.texImage2D(3553,0,f,d,p,l),t.__maxMipLevel=0;y(r,u)&&x(o,r,l.width,l.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=b(i.texture.internalFormat,c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function I(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===De?i=36012:o.type===Oe&&(i=33190));var s=F(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){s=F(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),l=a.convert(n.texture.type);i=b(n.texture.internalFormat,c,l);if(r){s=F(n);e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){var n=r.get(t),i=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),S(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===We)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==qe)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),I(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),I(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function F(e){return c&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}var B=!1,H=!1;this.allocateTextureUnit=function(){var e=T;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=S,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(t){var i=r.get(t),s=r.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var l=!0===t.isWebGLCubeRenderTarget,u=!0===t.isWebGLMultisampleRenderTarget,h=v(t)||c;if(!c||t.texture.format!==ze||t.texture.type!==De&&t.texture.type!==Ie||(t.texture.format=Ge,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),l){i.__webglFramebuffer=[];for(var d=0;d<6;d++)i.__webglFramebuffer[d]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),u)if(c){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var p=a.convert(t.texture.format),f=a.convert(t.texture.type),m=b(t.texture.internalFormat,p,f),g=F(t);e.renderbufferStorageMultisample(36161,g,m,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),I(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){n.bindTexture(34067,s.__webglTexture),P(34067,t.texture,h);for(d=0;d<6;d++)D(i.__webglFramebuffer[d],t,36064,34069+d);y(t.texture,h)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),P(3553,t.texture,h),D(i.__webglFramebuffer,t,36064,3553),y(t.texture,h)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,v(e)||c)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(t).__webglTexture;n.bindTexture(i,a),x(i,t,e.width,e.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(c){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),S(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===H&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),H=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):A(e,t)}}function Rs(e,t,n){var r=n.isWebGL2;return{convert:function(e){var n;if(e===Ae)return 5121;if(e===Ne)return 32819;if(e===Fe)return 32820;if(e===Be)return 33635;if(e===Le)return 5120;if(e===Re)return 5122;if(e===Pe)return 5123;if(e===Ce)return 5124;if(e===Oe)return 5125;if(e===De)return 5126;if(e===Ie)return r?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(e===Ue)return 6406;if(e===ze)return 6407;if(e===Ge)return 6408;if(e===ke)return 6409;if(e===Ve)return 6410;if(e===We)return 6402;if(e===qe)return 34041;if(e===Xe)return 6403;if(e===Ye)return 36244;if(e===Ze)return 33319;if(e===Je)return 33320;if(e===Ke)return 36248;if(e===Qe)return 36249;if(e===$e||e===et||e===tt||e===nt){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===$e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===et)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===tt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===nt)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===rt||e===it||e===at||e===ot){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===rt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===it)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===at)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===ot)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===st)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===ct||e===lt)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(e===ct)return n.COMPRESSED_RGB8_ETC2;if(e===lt)return n.COMPRESSED_RGBA8_ETC2_EAC}return e===ut||e===ht||e===dt||e===pt||e===ft||e===mt||e===gt||e===vt||e===yt||e===xt||e===bt||e===_t||e===wt||e===Mt||e===St||e===Et||e===At||e===Lt||e===Rt||e===Pt||e===Ct||e===Ot||e===Dt||e===It||e===Nt||e===Ft||e===Bt||e===Ht?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:e===Tt?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===He?r?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Ps(e){Ma.call(this),this.cameras=e||[]}function Cs(){Sr.call(this),this.type="Group"}function Os(){this._targetRay=null,this._grip=null}function Ds(e,t){var n=this,r=null,i=1,a=null,o="local-floor",s=null,c=[],l=new Map,u=new Ma;u.layers.enable(1),u.viewport=new Xn;var h=new Ma;h.layers.enable(2),h.viewport=new Xn;var d=[u,h],p=new Ps;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function g(e){var t=l.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function v(){l.forEach((function(e,t){e.disconnect(t)})),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),T.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){a=e,T.setContext(r),T.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function x(e){for(var t=r.inputSources,n=0;n<c.length;n++)l.set(t[n],c[n]);for(n=0;n<e.removed.length;n++){var i=e.removed[n];(a=l.get(i))&&(a.dispatchEvent({type:"disconnected",data:i}),l.delete(i))}for(n=0;n<e.added.length;n++){var a;i=e.added[n];(a=l.get(i))&&a.dispatchEvent({type:"connected",data:i})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return void 0===t&&(t=new Os,c[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=c[e];return void 0===t&&(t=new Os,c[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(e){if(null!==(r=e)){r.addEventListener("select",g),r.addEventListener("selectstart",g),r.addEventListener("selectend",g),r.addEventListener("squeeze",g),r.addEventListener("squeezestart",g),r.addEventListener("squeezeend",g),r.addEventListener("end",v);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,a);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(o).then(y),r.addEventListener("inputsourceschange",x)}};var b=new $n,_=new $n;function w(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=h.near=u.near=e.near,p.far=h.far=u.far=e.far,f===p.near&&m===p.far||(r.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);var t=e.parent,n=p.cameras;w(p,t);for(var i=0;i<n.length;i++)w(n[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,o=(i=0,a.length);i<o;i++)a[i].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),_.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(_),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+f,v=s+f,y=d-m,x=p+(r-m),w=c*s/v*g,M=l*s/v*g;e.projectionMatrix.makePerspective(y,x,w,M,g,v)}(p,u,h):p.projectionMatrix.copy(u.projectionMatrix),p};var M=null;var T=new Ca;T.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(a))){var i=s.views,o=r.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var l=!1;i.length!==p.cameras.length&&(p.cameras.length=0,l=!0);for(var u=0;u<i.length;u++){var h=i[u],f=o.getViewport(h),m=d[u];m.matrix.fromArray(h.transform.matrix),m.projectionMatrix.fromArray(h.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===u&&p.matrix.copy(m.matrix),!0===l&&p.cameras.push(m)}}var g=r.inputSources;for(u=0;u<c.length;u++){var v=c[u],y=g[u];v.update(y,n,a)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function Is(e){function t(t,n,r){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i,a,o=n.envMap||r;o&&(t.envMap.value=o,t.flipEnvMap.value=o.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(o).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap&&(i=n.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),t.uv2Transform.value.copy(a.matrix))}function n(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===v&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===v&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){r.isMeshBasicMaterial?t(e,r):r.isMeshLambertMaterial?(t(e,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,r)):r.isMeshToonMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===v&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===v&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshPhongMaterial?(t(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===v&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===v&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshStandardMaterial?(t(e,r,i),r.isMeshPhysicalMaterial?function(e,t,r){n(e,t,r),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===v&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,r,i):n(e,r,i)):r.isMeshMatcapMaterial?(t(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===v&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===v&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDepthMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isMeshDistanceMaterial?(t(e,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?(t(e,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===v&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===v&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ns(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,h=null,d=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=$t,this.physicallyCorrectLights=!1,this.toneMapping=ee,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p,f,m,g,v,y,x,b,_,w,M,T,S,E,A,L,R,P,C,O=this,D=!1,I=null,N=0,F=0,B=null,H=null,U=-1,z={geometry:null,program:null,wireframe:!1},G=null,k=null,V=new Xn,j=new Xn,W=null,q=t.width,X=t.height,Y=1,Z=null,J=null,K=new Xn(0,0,q,X),Q=new Xn(0,0,q,X),$=!1,te=new Ra,ne=new za,re=!1,ie=!1,ae=new sr,oe=new $n;function se(){return null===B?Y:1}try{var ce={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",pe,!1),null===(p=n||t.getContext("webgl",ce)||t.getContext("experimental-webgl",ce)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===p.getShaderPrecisionFormat&&(p.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function le(){f=new Ga(p),!1===(m=new Ua(p,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),C=new Rs(p,f,m),(g=new As(p,f,m)).scissor(j.copy(Q).multiplyScalar(Y).floor()),g.viewport(V.copy(K).multiplyScalar(Y).floor()),v=new ja(p),y=new ps,x=new Ls(p,f,g,y,m,C,v),b=new Oa(p,m),_=new ka(p,b,v),w=new Xa(p,_,b,v),L=new qa(p),M=new ds(O,f,m),T=new Is(y),S=new vs,E=new Ms,A=new Ba(O,g,w,s),R=new Ha(p,f,v,m),P=new Va(p,f,v,m),v.programs=M.programs,O.capabilities=m,O.extensions=f,O.properties=y,O.renderLists=S,O.state=g,O.info=v}le();var ue=new Ds(O,p);this.xr=ue;var he=new Es(O,w,m.maxTextureSize);function de(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function pe(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1,le()}function fe(e){var t=e.target;t.removeEventListener("dispose",fe),function(e){me(e),y.remove(e)}(t)}function me(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=he,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new kn),e.set(q,X)},this.setSize=function(e,n,r){ue.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=e,X=n,t.width=Math.floor(e*Y),t.height=Math.floor(n*Y),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new kn),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,n,r){q=e,X=n,Y=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new Xn),e.copy(V)},this.getViewport=function(e){return e.copy(K)},this.setViewport=function(e,t,n,r){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,r),g.viewport(V.copy(K).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,r){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,r),g.scissor(j.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){g.setScissorTest($=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){J=e},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),p.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",de,!1),t.removeEventListener("webglcontextrestored",pe,!1),S.dispose(),E.dispose(),y.dispose(),w.dispose(),ue.dispose(),ye.stop()},this.renderBufferImmediate=function(e,t){g.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=p.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=p.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=p.createBuffer()),e.hasColors&&!n.color&&(n.color=p.createBuffer());var r=t.getAttributes();e.hasPositions&&(p.bindBuffer(34962,n.position),p.bufferData(34962,e.positionArray,35048),g.enableAttribute(r.position),p.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(p.bindBuffer(34962,n.normal),p.bufferData(34962,e.normalArray,35048),g.enableAttribute(r.normal),p.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(p.bindBuffer(34962,n.uv),p.bufferData(34962,e.uvArray,35048),g.enableAttribute(r.uv),p.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(p.bindBuffer(34962,n.color),p.bufferData(34962,e.colorArray,35048),g.enableAttribute(r.color),p.vertexAttribPointer(r.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),p.drawArrays(4,0,e.count),e.count=0};var ge=new Er;this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=ge);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Me(e,t,r,i);g.setMaterial(r,o);var c=!1;z.geometry===n.id&&z.program===s.id&&z.wireframe===(!0===r.wireframe)||(z.geometry=n.id,z.program=s.id,z.wireframe=!0===r.wireframe,c=!0),(r.morphTargets||r.morphNormals)&&(L.update(i,n,r,s),c=!0),!0===i.isInstancedMesh&&(c=!0);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var h,d=1;!0===r.wireframe&&(l=_.getWireframeAttribute(n),d=2);var v=R;null!==l&&(h=b.get(l),(v=P).setIndex(h)),c&&(!function(e,t,n,r){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;g.initAttributes();var i=t.attributes,a=r.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(void 0!==l){var u=l.normalized,h=l.itemSize;if(void 0===(M=b.get(l)))continue;var d=M.buffer,v=M.type,y=M.bytesPerElement;if(l.isInterleavedBufferAttribute){var x=l.data,_=x.stride,w=l.offset;x&&x.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(c,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):g.enableAttribute(c),p.bindBuffer(34962,d),g.vertexAttribPointer(c,h,v,u,_*y,w*y)}else l.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=l.meshPerAttribute*l.count)):g.enableAttribute(c),p.bindBuffer(34962,d),g.vertexAttribPointer(c,h,v,u,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;d=M.buffer,v=M.type;g.enableAttributeAndDivisor(c+0,1),g.enableAttributeAndDivisor(c+1,1),g.enableAttributeAndDivisor(c+2,1),g.enableAttributeAndDivisor(c+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(c+0,4,v,!1,64,0),p.vertexAttribPointer(c+1,4,v,!1,64,16),p.vertexAttribPointer(c+2,4,v,!1,64,32),p.vertexAttribPointer(c+3,4,v,!1,64,48)}else if(void 0!==o){var T=o[s];if(void 0!==T)switch(T.length){case 2:p.vertexAttrib2fv(c,T);break;case 3:p.vertexAttrib3fv(c,T);break;case 4:p.vertexAttrib4fv(c,T);break;default:p.vertexAttrib1fv(c,T)}}}}g.disableUnusedAttributes()}(i,n,r,s),null!==l&&p.bindBuffer(34963,h.buffer));var y=null!==l?l.count:u.count,x=n.drawRange.start*d,w=n.drawRange.count*d,M=null!==a?a.start*d:0,T=null!==a?a.count*d:1/0,S=Math.max(x,M),E=Math.min(y,x+w,M+T)-1,A=Math.max(0,E-S+1);if(0!==A){if(i.isMesh)!0===r.wireframe?(g.setLineWidth(r.wireframeLinewidth*se()),v.setMode(1)):v.setMode(4);else if(i.isLine){var C=r.linewidth;void 0===C&&(C=1),g.setLineWidth(C*se()),i.isLineSegments?v.setMode(1):i.isLineLoop?v.setMode(2):v.setMode(3)}else i.isPoints?v.setMode(0):i.isSprite&&v.setMode(4);if(i.isInstancedMesh)v.renderInstances(n,S,A,i.count);else if(n.isInstancedBufferGeometry){var O=Math.min(n.instanceCount,n._maxInstanceCount);v.renderInstances(n,S,A,O)}else v.render(S,A)}},this.compile=function(e,t){(d=E.get(e,t)).init(),e.traverse((function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(t);const n={};e.traverse((function(t){let r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=r[i];a.uuid in n==!1&&(we(a,e,t),n[a.uuid]=!0)}else r.uuid in n==!1&&(we(r,e,t),n[r.uuid]=!0)}))};var ve=null;var ye=new Ca;function xe(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||te.intersectsSprite(e)){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae);var i=w.update(e);(a=e.material).visible&&h.push(e,i,a,n,oe.z,null)}}else if(e.isImmediateRenderObject)r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae),h.push(e,null,e.material,n,oe.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==v.render.frame&&(e.skeleton.update(),e.skeleton.frame=v.render.frame),!e.frustumCulled||te.intersectsObject(e))){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ae);i=w.update(e);var a=e.material;if(Array.isArray(a))for(var o=i.groups,s=0,c=o.length;s<c;s++){var l=o[s],u=a[l.materialIndex];u&&u.visible&&h.push(e,i,u,n,oe.z,l)}else a.visible&&h.push(e,i,a,n,oe.z,null)}var p=e.children;for(s=0,c=p.length;s<c;s++)xe(p[s],t,n,r)}}function be(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=void 0===r?o.material:r,u=o.group;if(n.isArrayCamera){k=n;for(var h=n.cameras,p=0,f=h.length;p<f;p++){var m=h[p];s.layers.test(m.layers)&&(g.viewport(V.copy(m.viewport)),d.setupLights(m),_e(s,t,m,c,l,u))}}else k=null,_e(s,t,n,c,l,u)}}function _e(e,t,n,r,i,a){if(e.onBeforeRender(O,t,n,r,i,a),d=E.get(t,k||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Me(n,t,i,e);g.setMaterial(i),z.geometry=null,z.program=null,z.wireframe=!1,function(e,t){e.render((function(e){O.renderBufferImmediate(e,t)}))}(e,o)}else O.renderBufferDirect(n,t,r,i,e,a);e.onAfterRender(O,t,n,r,i,a),d=E.get(t,k||n)}function we(e,t,n){var r=y.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=M.getParameters(e,i.state,a,t,ne.numPlanes,ne.numIntersection,n),c=M.getProgramCacheKey(s),l=r.program,u=!0;if(void 0===l)e.addEventListener("dispose",fe);else if(l.cacheKey!==c)me(e);else if(r.lightsStateVersion!==o)r.lightsStateVersion=o,u=!1;else{if(void 0!==s.shaderID)return;u=!1}u&&(l=M.acquireProgram(s,c),r.program=l,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=l);var h=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var p=0;p<O.maxMorphTargets;p++)h["morphTarget"+p]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(p=0;p<O.maxMorphNormals;p++)h["morphNormal"+p]>=0&&e.numSupportedMorphNormals++}var f=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=ne.numPlanes,r.numIntersection=ne.numIntersection,f.clippingPlanes=ne.uniform),r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMap.value=i.state.directionalShadowMap,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotShadowMap.value=i.state.spotShadowMap,f.spotShadowMatrix.value=i.state.spotShadowMatrix,f.pointShadowMap.value=i.state.pointShadowMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix);var m=r.program.getUniforms(),g=qo.seqWithValue(m.seq,f);r.uniformsList=g}function Me(e,t,n,r){x.resetTextureUnits();var i=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===B?O.outputEncoding:B.texture.encoding,s=y.get(n),c=d.state.lights;if(re&&(ie||e!==G)){var l=e===G&&n.id===U;ne.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,l)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==i||s.environment!==a||s.needsLights&&s.lightsStateVersion!==c.state.version?we(n,t,r):void 0===s.numClippingPlanes||s.numClippingPlanes===ne.numPlanes&&s.numIntersection===ne.numIntersection?s.outputEncoding!==o&&we(n,t,r):we(n,t,r):(we(n,t,r),s.__version=n.version);var u,h,f=!1,v=!1,b=!1,_=s.program,w=_.getUniforms(),M=s.uniforms;if(g.useProgram(_.program)&&(f=!0,v=!0,b=!0),n.id!==U&&(U=n.id,v=!0),f||G!==e){if(w.setValue(p,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&w.setValue(p,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),G!==e&&(G=e,v=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var S=w.map.cameraPosition;void 0!==S&&S.setValue(p,oe.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&w.setValue(p,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&w.setValue(p,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){w.setOptional(p,r,"bindMatrix"),w.setOptional(p,r,"bindMatrixInverse");var E=r.skeleton;if(E){var A=E.bones;if(m.floatVertexTextures){if(void 0===E.boneTexture){var L=Math.sqrt(4*A.length);L=Gn.ceilPowerOfTwo(L),L=Math.max(L,4);var R=new Float32Array(L*L*4);R.set(E.boneMatrices);var P=new Ea(R,L,L,Ge,De);E.boneMatrices=R,E.boneTexture=P,E.boneTextureSize=L}w.setValue(p,"boneTexture",E.boneTexture,x),w.setValue(p,"boneTextureSize",E.boneTextureSize)}else w.setOptional(p,E,"boneMatrices")}}return(v||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,w.setValue(p,"receiveShadow",r.receiveShadow)),v&&(w.setValue(p,"toneMappingExposure",O.toneMappingExposure),w.setValue(p,"toneMappingWhitePoint",O.toneMappingWhitePoint),s.needsLights&&(h=b,(u=M).ambientLightColor.needsUpdate=h,u.lightProbe.needsUpdate=h,u.directionalLights.needsUpdate=h,u.directionalLightShadows.needsUpdate=h,u.pointLights.needsUpdate=h,u.pointLightShadows.needsUpdate=h,u.spotLights.needsUpdate=h,u.spotLightShadows.needsUpdate=h,u.rectAreaLights.needsUpdate=h,u.hemisphereLights.needsUpdate=h),i&&n.fog&&T.refreshFogUniforms(M,i),T.refreshMaterialUniforms(M,n,a,Y,X),void 0!==M.ltc_1&&(M.ltc_1.value=Pa.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=Pa.LTC_2),qo.upload(p,s.uniformsList,M,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(qo.upload(p,s.uniformsList,M,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&w.setValue(p,"center",r.center),w.setValue(p,"modelViewMatrix",r.modelViewMatrix),w.setValue(p,"normalMatrix",r.normalMatrix),w.setValue(p,"modelMatrix",r.matrixWorld),_}ye.setAnimationLoop((function(e){ue.isPresenting||ve&&ve(e)})),"undefined"!=typeof window&&ye.setContext(window),this.setAnimationLoop=function(e){ve=e,ue.setAnimationLoop(e),ye.start()},this.render=function(e,t){var n,r;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),r=arguments[3]),t&&t.isCamera){if(!D){z.geometry=null,z.program=null,z.wireframe=!1,U=-1,G=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ue.enabled&&ue.isPresenting&&(t=ue.getCamera(t)),e.onBeforeRender(O,e,t,n||B),(d=E.get(e,t)).init(),ae.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),te.setFromProjectionMatrix(ae),ie=this.localClippingEnabled,re=ne.init(this.clippingPlanes,ie,t),(h=S.get(e,t)).init(),xe(e,t,0,O.sortObjects),h.finish(),!0===O.sortObjects&&h.sort(Z,J),re&&ne.beginShadows();var i=d.state.shadowsArray;he.render(i,e,t),d.setupLights(t),re&&ne.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),A.render(h,e,t,r);var a=h.opaque,o=h.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&be(a,e,t,s),o.length&&be(o,e,t,s)}else a.length&&be(a,e,t),o.length&&be(o,e,t);e.onAfterRender(O,e,t),null!==B&&(x.updateRenderTargetMipmap(B),x.updateMultisampleRenderTarget(B)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),h=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){I!==e&&null===B&&p.bindFramebuffer(36160,e),I=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return B},this.setRenderTarget=function(e,t,n){B=e,N=t,F=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var r=I,i=!1;if(e){var a=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=a[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:a,V.copy(e.viewport),j.copy(e.scissor),W=e.scissorTest}else V.copy(K).multiplyScalar(Y).floor(),j.copy(Q).multiplyScalar(Y).floor(),W=$;if(H!==r&&(p.bindFramebuffer(36160,r),H=r),g.viewport(V),g.scissor(j),g.setScissorTest(W),i){var o=y.get(e.texture);p.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var c=!1;s!==H&&(p.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,u=l.format,h=l.type;if(u!==Ge&&C.convert(u)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ae||C.convert(h)===p.getParameter(35738)||h===De&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||h===Ie&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&p.readPixels(t,n,r,i,C.convert(u),C.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&p.bindFramebuffer(36160,H)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r),o=C.convert(t.format);x.setTexture2D(t,0),p.copyTexImage2D(3553,n,o,e.x,e.y,i,a,0),g.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){void 0===r&&(r=0);var i=t.image.width,a=t.image.height,o=C.convert(n.format),s=C.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?p.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?p.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):p.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&p.generateMipmap(3553),g.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),g.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Fs(e,t){this.name="",this.color=new gi(e),this.density=void 0!==t?t:25e-5}function Bs(e,t,n){this.name="",this.color=new gi(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Hs(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Ln,this.updateRange={offset:0,count:-1},this.version=0}Ps.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Ps,isArrayCamera:!0}),Cs.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Cs,isGroup:!0}),Object.assign(Os.prototype,{constructor:Os,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Cs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Cs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(null!==a&&null!==(r=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==o&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&(a.visible=null!==r),null!==o&&(o.visible=null!==i),this}}),Object.assign(Ds.prototype,Bn.prototype),Object.assign(Fs.prototype,{isFogExp2:!0,clone:function(){return new Fs(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Bs.prototype,{isFog:!0,clone:function(){return new Bs(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Hs.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Hs.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var Us,zs=new $n;function Gs(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function ks(e){wi.call(this),this.type="SpriteMaterial",this.color=new gi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Gs.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Gs.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)zs.x=this.getX(t),zs.y=this.getY(t),zs.z=this.getZ(t),zs.applyMatrix4(e),this.setXYZ(t,zs.x,zs.y,zs.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new Si(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),ks.prototype=Object.create(wi.prototype),ks.prototype.constructor=ks,ks.prototype.isSpriteMaterial=!0,ks.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Vs=new $n,js=new $n,Ws=new $n,qs=new kn,Xs=new kn,Ys=new sr,Zs=new $n,Js=new $n,Ks=new $n,Qs=new kn,$s=new kn,ec=new kn;function tc(e){if(Sr.call(this),this.type="Sprite",void 0===Us){Us=new ji;var t=new Hs(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);Us.setIndex([0,1,2,0,2,3]),Us.setAttribute("position",new Gs(t,3,0,!1)),Us.setAttribute("uv",new Gs(t,2,3,!1))}this.geometry=Us,this.material=void 0!==e?e:new ks,this.center=new kn(.5,.5)}function nc(e,t,n,r,i,a){qs.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Xs.x=a*qs.x-i*qs.y,Xs.y=i*qs.x+a*qs.y):Xs.copy(qs),e.copy(t),e.x+=Xs.x,e.y+=Xs.y,e.applyMatrix4(Ys)}tc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:tc,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),js.setFromMatrixScale(this.matrixWorld),Ys.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ws.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&js.multiplyScalar(-Ws.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;nc(Zs.set(-.5,-.5,0),Ws,a,js,n,r),nc(Js.set(.5,-.5,0),Ws,a,js,n,r),nc(Ks.set(.5,.5,0),Ws,a,js,n,r),Qs.set(0,0),$s.set(1,0),ec.set(1,1);var o=e.ray.intersectTriangle(Zs,Js,Ks,!1,Vs);if(null!==o||(nc(Js.set(-.5,.5,0),Ws,a,js,n,r),$s.set(0,1),null!==(o=e.ray.intersectTriangle(Zs,Ks,Js,!1,Vs)))){var s=e.ray.origin.distanceTo(Vs);s<e.near||s>e.far||t.push({distance:s,point:Vs.clone(),uv:di.getUV(Vs,Zs,Js,Ks,Qs,$s,ec,new kn),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Sr.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var rc,ic,ac,oc,sc,cc=new $n,lc=new $n;function uc(){Sr.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function hc(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ca.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new sr,this.bindMatrixInverse=new sr}uc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:uc,isLOD:!0,copy:function(e){Sr.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){cc.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(cc);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){cc.setFromMatrixPosition(e.matrixWorld),lc.setFromMatrixPosition(this.matrixWorld);var n=cc.distanceTo(lc)/e.zoom;t[0].object.visible=!0;for(var r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}},toJSON:function(e){var t=Sr.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),hc.prototype=Object.assign(Object.create(ca.prototype),{constructor:hc,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Xn,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){ca.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(rc=new $n,ic=new Xn,ac=new Xn,oc=new $n,sc=new sr,function(e,t){var n=this.skeleton,r=this.geometry;ic.fromBufferAttribute(r.attributes.skinIndex,e),ac.fromBufferAttribute(r.attributes.skinWeight,e),rc.fromBufferAttribute(r.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=ac.getComponent(i);if(0!==a){var o=ic.getComponent(i);sc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(oc.copy(rc).applyMatrix4(sc),a)}}return t.applyMatrix4(this.bindMatrixInverse)})});var dc=new sr,pc=new sr;function fc(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new sr)}}function mc(){Sr.call(this),this.type="Bone"}Object.assign(fc.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new sr;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:pc;dc.multiplyMatrices(o,t[i]),dc.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)},clone:function(){return new fc(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),mc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:mc,isBone:!0});var gc=new sr,vc=new sr,yc=[],xc=new ca;function bc(e,t,n){ca.call(this,e,t),this.instanceMatrix=new Si(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function _c(e){wi.call(this),this.type="LineBasicMaterial",this.color=new gi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}bc.prototype=Object.assign(Object.create(ca.prototype),{constructor:bc,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(xc.geometry=this.geometry,xc.material=this.material,void 0!==xc.material)for(var i=0;i<r;i++){this.getMatrixAt(i,gc),vc.multiplyMatrices(n,gc),xc.matrixWorld=vc,xc.raycast(e,yc);for(var a=0,o=yc.length;a<o;a++){var s=yc[a];s.instanceId=i,s.object=this,t.push(s)}yc.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),_c.prototype=Object.create(wi.prototype),_c.prototype.constructor=_c,_c.prototype.isLineBasicMaterial=!0,_c.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var wc=new $n,Mc=new $n,Tc=new sr,Sc=new Kr,Ec=new Vr;function Ac(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Sr.call(this),this.type="Line",this.geometry=void 0!==e?e:new ji,this.material=void 0!==t?t:new _c,this.updateMorphTargets()}Ac.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Ac,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)wc.fromBufferAttribute(t,r-1),Mc.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=wc.distanceTo(Mc);e.setAttribute("lineDistance",new Di(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(r),Ec.radius+=i,!1!==e.ray.intersectsSphere(Ec)){Tc.getInverse(r),Sc.copy(e.ray).applyMatrix4(Tc);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new $n,c=new $n,l=new $n,u=new $n,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position.array;if(null!==d)for(var f=d.array,m=0,g=f.length-1;m<g;m+=h){var v=f[m],y=f[m+1];if(s.fromArray(p,3*v),c.fromArray(p,3*y),!(Sc.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,g=p.length/3-1;m<g;m+=h){if(s.fromArray(p,3*m),c.fromArray(p,3*m+3),!(Sc.distanceSqToSegment(s,c,u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=h){var _;if(!(Sc.distanceSqToSegment(x[m],x[m+1],u,l)>o))u.applyMatrix4(this.matrixWorld),(_=e.ray.origin.distanceTo(u))<e.near||_>e.far||t.push({distance:_,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Lc=new $n,Rc=new $n;function Pc(e,t){Ac.call(this,e,t),this.type="LineSegments"}function Cc(e,t){Ac.call(this,e,t),this.type="LineLoop"}function Oc(e){wi.call(this),this.type="PointsMaterial",this.color=new gi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Pc.prototype=Object.assign(Object.create(Ac.prototype),{constructor:Pc,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Lc.fromBufferAttribute(t,r),Rc.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Lc.distanceTo(Rc);e.setAttribute("lineDistance",new Di(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,r=0,i=a.length;r<i;r+=2)Lc.copy(a[r]),Rc.copy(a[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Lc.distanceTo(Rc)}return this}}),Cc.prototype=Object.assign(Object.create(Ac.prototype),{constructor:Cc,isLineLoop:!0}),Oc.prototype=Object.create(wi.prototype),Oc.prototype.constructor=Oc,Oc.prototype.isPointsMaterial=!0,Oc.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Dc=new sr,Ic=new Kr,Nc=new Vr,Fc=new $n;function Bc(e,t){Sr.call(this),this.type="Points",this.geometry=void 0!==e?e:new ji,this.material=void 0!==t?t:new Oc,this.updateMorphTargets()}function Hc(e,t,n,r,i,a,o){var s=Ic.distanceSqToPoint(e);if(s<n){var c=new $n;Ic.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Uc(e,t,n,r,i,a,o,s,c){qn.call(this,e,t,n,r,i,a,o,s,c),this.format=void 0!==o?o:ze,this.minFilter=void 0!==a?a:we,this.magFilter=void 0!==i?i:we,this.generateMipmaps=!1}function zc(e,t,n,r,i,a,o,s,c,l,u,h){qn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Gc(e,t,n,r,i,a,o,s,c){qn.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function kc(e,t,n,r,i,a,o,s,c,l){if((l=void 0!==l?l:We)!==We&&l!==qe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===We&&(n=Pe),void 0===n&&l===qe&&(n=He),qn.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:ve,this.minFilter=void 0!==s?s:ve,this.flipY=!1,this.generateMipmaps=!1}function Vc(e){ji.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,c,l,u,h=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var g=m[t];for(n=0;n<3;n++)s=g[f[n]],c=g[f[(n+1)%3]],d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]})}for(l in p)o=p[l],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var v,y,x,b,_,w,M;if(u=new $n,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(t=_=(b=x[i]).start,r=_+b.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),d[0]=Math.min(s,c),d[1]=Math.max(s,c),void 0===p[l=d[0]+","+d[1]]&&(p[l]={index1:d[0],index2:d[1]});for(l in p)o=p[l],u.fromBufferAttribute(v,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(v,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,r=(v=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)w=3*t+n,u.fromBufferAttribute(v,w),h.push(u.x,u.y,u.z),M=3*t+(n+1)%3,u.fromBufferAttribute(v,M),h.push(u.x,u.y,u.z)}this.setAttribute("position",new Di(h,3))}function jc(e,t,n){ma.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Wc(e,t,n)),this.mergeVertices()}function Wc(e,t,n){ji.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r,i,a=[],o=[],s=[],c=[],l=1e-5,u=new $n,h=new $n,d=new $n,p=new $n,f=new $n;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(r=0;r<=n;r++){var g=r/n;for(i=0;i<=t;i++){var v=i/t;e(v,g,h),o.push(h.x,h.y,h.z),v-l>=0?(e(v-l,g,d),p.subVectors(h,d)):(e(v+l,g,d),p.subVectors(d,h)),g-l>=0?(e(v,g-l,d),f.subVectors(h,d)):(e(v,g+l,d),f.subVectors(d,h)),u.crossVectors(p,f).normalize(),s.push(u.x,u.y,u.z),c.push(v,g)}}for(r=0;r<n;r++)for(i=0;i<t;i++){var y=r*m+i,x=r*m+i+1,b=(r+1)*m+i+1,_=(r+1)*m+i;a.push(y,x,_),a.push(x,b,_)}this.setIndex(a),this.setAttribute("position",new Di(o,3)),this.setAttribute("normal",new Di(s,3)),this.setAttribute("uv",new Di(c,2))}function qc(e,t,n,r){ma.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Xc(e,t,n,r)),this.mergeVertices()}function Xc(e,t,n,r){ji.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1;var i=[],a=[];function o(e,t,n,r){var i,a,o=Math.pow(2,r),c=[];for(i=0;i<=o;i++){c[i]=[];var l=e.clone().lerp(n,i/o),u=t.clone().lerp(n,i/o),h=o-i;for(a=0;a<=h;a++)c[i][a]=0===a&&i===o?l:l.clone().lerp(u,a/h)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var d=Math.floor(a/2);a%2==0?(s(c[i][d+1]),s(c[i+1][d]),s(c[i][d])):(s(c[i][d+1]),s(c[i+1][d+1]),s(c[i+1][d]))}}function s(e){i.push(e.x,e.y,e.z)}function c(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}function h(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var n=new $n,r=new $n,i=new $n,a=0;a<t.length;a+=3)c(t[a+0],n),c(t[a+1],r),c(t[a+2],i),o(n,r,i,e)}(r=r||0),function(e){for(var t=new $n,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){for(var e=new $n,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=u(e)/2/Math.PI+.5,r=h(e)/Math.PI+.5;a.push(n,1-r)}(function(){for(var e=new $n,t=new $n,n=new $n,r=new $n,o=new kn,s=new kn,c=new kn,h=0,d=0;h<i.length;h+=9,d+=6){e.set(i[h+0],i[h+1],i[h+2]),t.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),o.set(a[d+0],a[d+1]),s.set(a[d+2],a[d+3]),c.set(a[d+4],a[d+5]),r.copy(e).add(t).add(n).divideScalar(3);var p=u(r);l(o,d+0,e,p),l(s,d+2,t,p),l(c,d+4,n,p)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4],i=Math.max(t,n,r),o=Math.min(t,n,r);i>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new Di(i,3)),this.setAttribute("normal",new Di(i.slice(),3)),this.setAttribute("uv",new Di(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Yc(e,t){ma.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Zc(e,t)),this.mergeVertices()}function Zc(e,t){Xc.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Jc(e,t){ma.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Kc(e,t)),this.mergeVertices()}function Kc(e,t){Xc.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Qc(e,t){ma.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new $c(e,t)),this.mergeVertices()}function $c(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Xc.call(this,r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function el(e,t){ma.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new tl(e,t)),this.mergeVertices()}function tl(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Xc.call(this,i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function nl(e,t,n,r,i,a){ma.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new rl(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function rl(e,t,n,r,i){ji.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new $n,l=new $n,u=new kn,h=new $n,d=[],p=[],f=[],m=[];function g(i){h=e.getPointAt(i/t,h);var o=a.normals[i],u=a.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*o.x+m*u.x,l.y=g*o.y+m*u.y,l.z=g*o.z+m*u.z,l.normalize(),p.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,d.push(c.x,c.y,c.z)}}!function(){for(o=0;o<t;o++)g(o);g(!1===i?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=r;s++)u.x=o/t,u.y=s/r,f.push(u.x,u.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=r;o++){var e=(r+1)*(s-1)+(o-1),n=(r+1)*s+(o-1),i=(r+1)*s+o,a=(r+1)*(s-1)+o;m.push(e,n,a),m.push(n,i,a)}}()}(),this.setIndex(m),this.setAttribute("position",new Di(d,3)),this.setAttribute("normal",new Di(p,3)),this.setAttribute("uv",new Di(f,2))}function il(e,t,n,r,i,a,o){ma.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new al(e,t,n,r,i,a)),this.mergeVertices()}function al(e,t,n,r,i,a){ji.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,c=[],l=[],u=[],h=[],d=new $n,p=new $n,f=new $n,m=new $n,g=new $n,v=new $n,y=new $n;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(A(x,i,a,e,f),A(x+.01,i,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,_=-t*Math.cos(b),w=t*Math.sin(b);d.x=f.x+(_*y.x+w*g.x),d.y=f.y+(_*y.y+w*g.y),d.z=f.z+(_*y.z+w*g.z),l.push(d.x,d.y,d.z),p.subVectors(d,f).normalize(),u.push(p.x,p.y,p.z),h.push(o/n),h.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var M=(r+1)*(s-1)+(o-1),T=(r+1)*s+(o-1),S=(r+1)*s+o,E=(r+1)*(s-1)+o;c.push(M,T,E),c.push(T,S,E)}function A(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new Di(l,3)),this.setAttribute("normal",new Di(u,3)),this.setAttribute("uv",new Di(h,2))}function ol(e,t,n,r,i){ma.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new sl(e,t,n,r,i)),this.mergeVertices()}function sl(e,t,n,r,i){ji.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],c=[],l=[],u=[],h=new $n,d=new $n,p=new $n;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,m=a/n*Math.PI*2;d.x=(e+t*Math.cos(m))*Math.cos(f),d.y=(e+t*Math.cos(m))*Math.sin(f),d.z=t*Math.sin(m),c.push(d.x,d.y,d.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),p.subVectors(d,h).normalize(),l.push(p.x,p.y,p.z),u.push(o/r),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var g=(r+1)*a+o-1,v=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.setAttribute("position",new Di(c,3)),this.setAttribute("normal",new Di(l,3)),this.setAttribute("uv",new Di(u,2))}Bc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Bc,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Nc.copy(n.boundingSphere),Nc.applyMatrix4(r),Nc.radius+=i,!1!==e.ray.intersectsSphere(Nc)){Dc.getInverse(r),Ic.copy(e.ray).applyMatrix4(Dc);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(null!==s)for(var l=s.array,u=0,h=l.length;u<h;u++){var d=l[u];Fc.fromArray(c,3*d),Hc(Fc,d,o,r,e,t,this)}else{u=0;for(var p=c.length/3;u<p;u++)Fc.fromArray(c,3*u),Hc(Fc,u,o,r,e,t,this)}}else{var f=n.vertices;for(u=0,p=f.length;u<p;u++)Hc(f[u],u,o,r,e,t,this)}}},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Uc.prototype=Object.assign(Object.create(qn.prototype),{constructor:Uc,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),zc.prototype=Object.create(qn.prototype),zc.prototype.constructor=zc,zc.prototype.isCompressedTexture=!0,Gc.prototype=Object.create(qn.prototype),Gc.prototype.constructor=Gc,Gc.prototype.isCanvasTexture=!0,kc.prototype=Object.create(qn.prototype),kc.prototype.constructor=kc,kc.prototype.isDepthTexture=!0,Vc.prototype=Object.create(ji.prototype),Vc.prototype.constructor=Vc,jc.prototype=Object.create(ma.prototype),jc.prototype.constructor=jc,Wc.prototype=Object.create(ji.prototype),Wc.prototype.constructor=Wc,qc.prototype=Object.create(ma.prototype),qc.prototype.constructor=qc,Xc.prototype=Object.create(ji.prototype),Xc.prototype.constructor=Xc,Yc.prototype=Object.create(ma.prototype),Yc.prototype.constructor=Yc,Zc.prototype=Object.create(Xc.prototype),Zc.prototype.constructor=Zc,Jc.prototype=Object.create(ma.prototype),Jc.prototype.constructor=Jc,Kc.prototype=Object.create(Xc.prototype),Kc.prototype.constructor=Kc,Qc.prototype=Object.create(ma.prototype),Qc.prototype.constructor=Qc,$c.prototype=Object.create(Xc.prototype),$c.prototype.constructor=$c,el.prototype=Object.create(ma.prototype),el.prototype.constructor=el,tl.prototype=Object.create(Xc.prototype),tl.prototype.constructor=tl,nl.prototype=Object.create(ma.prototype),nl.prototype.constructor=nl,rl.prototype=Object.create(ji.prototype),rl.prototype.constructor=rl,rl.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},il.prototype=Object.create(ma.prototype),il.prototype.constructor=il,al.prototype=Object.create(ji.prototype),al.prototype.constructor=al,ol.prototype=Object.create(ma.prototype),ol.prototype.constructor=ol,sl.prototype=Object.create(ji.prototype),sl.prototype.constructor=sl;var cl=function(e,t,n){n=n||2;var r,i,a,o,s,c,l,u=t&&t.length,h=u?t[0]*n:e.length,d=ll(e,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,n,r){var i,a,o,s,c,l=[];for(i=0,a=t.length;i<a;i++)o=t[i]*r,s=i<a-1?t[i+1]*r:e.length,(c=ll(e,o,s,r,!1))===c.next&&(c.steiner=!0),l.push(bl(c));for(l.sort(gl),i=0;i<l.length;i++)vl(l[i],n),n=ul(n,n.next);return n}(e,t,d,n)),e.length>80*n){r=a=e[0],i=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<r&&(r=s),(c=e[f+1])<i&&(i=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-r,o-i))?1/l:0}return hl(d,p,n,r,i,l),p};function ll(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Pl(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Pl(a,e[a],e[a+1],o);return o&&Tl(o,o.next)&&(Cl(o),o=o.next),o}function ul(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Tl(r,r.next)&&0!==Ml(r.prev,r,r.next))r=r.next;else{if(Cl(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function hl(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=xl(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ);t++);for(c=l;s>0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?pl(e,r,i,a):dl(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Cl(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?hl(e=fl(ul(e),t,n),t,n,r,i,a,2):2===o&&ml(e,t,n,r,i,a):hl(ul(e),t,n,r,i,a,1);break}}}function dl(e){var t=e.prev,n=e,r=e.next;if(Ml(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(_l(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Ml(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function pl(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Ml(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=xl(s,c,t,n,r),d=xl(l,u,t,n,r),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&_l(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ml(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&_l(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ml(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&_l(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ml(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&_l(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ml(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function fl(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Tl(i,a)&&Sl(i,r,r.next,a)&&Ll(i,a)&&Ll(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Cl(r),Cl(r.next),r=e=a),r=r.next}while(r!==e);return ul(r)}function ml(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&wl(o,s)){var c=Rl(o,s);return o=ul(o,o.next),c=ul(c,c.next),hl(o,t,n,r,i,a),void hl(c,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function gl(e,t){return e.x-t.x}function vl(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n;var c,l=n,u=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=u&&i!==r.x&&_l(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&(c=Math.abs(a-r.y)/(i-r.x),Ll(r,e)&&(c<d||c===d&&(r.x>n.x||r.x===n.x&&yl(n,r)))&&(n=r,d=c)),r=r.next}while(r!==l);return n}(e,t)){var n=Rl(t,e);ul(t,t.next),ul(n,n.next)}}function yl(e,t){return Ml(e.prev,e,t.prev)<0&&Ml(t.next,e,e.next)<0}function xl(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function bl(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function _l(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function wl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Sl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ll(e,t)&&Ll(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Ml(e.prev,e,t.prev)||Ml(e,t.prev,t))||Tl(e,t)&&Ml(e.prev,e,e.next)>0&&Ml(t.prev,t,t.next)>0)}function Ml(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Tl(e,t){return e.x===t.x&&e.y===t.y}function Sl(e,t,n,r){var i=Al(Ml(e,t,n)),a=Al(Ml(e,t,r)),o=Al(Ml(n,r,e)),s=Al(Ml(n,r,t));return i!==a&&o!==s||(!(0!==i||!El(e,n,t))||(!(0!==a||!El(e,r,t))||(!(0!==o||!El(n,e,r))||!(0!==s||!El(n,t,r)))))}function El(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Al(e){return e>0?1:e<0?-1:0}function Ll(e,t){return Ml(e.prev,e,e.next)<0?Ml(e,t,e.next)>=0&&Ml(e,e.prev,t)>=0:Ml(e,t,e.prev)<0||Ml(e,e.next,t)<0}function Rl(e,t){var n=new Ol(e.i,e.x,e.y),r=new Ol(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Pl(e,t,n,r){var i=new Ol(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Cl(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ol(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Dl={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return Dl.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Il(e),Nl(n,e);var a=e.length;t.forEach(Il);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Nl(n,t[o]);var s=cl(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function Il(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nl(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Fl(e,t){ma.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Bl(e,t)),this.mergeVertices()}function Bl(e,t){ji.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,c=void 0!==t.depth?t.depth:100,l=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:u-2,d=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:Hl;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);var g,v,y,x,b,_,w,M,T=!1;f&&(g=f.getSpacedPoints(s),T=!0,l=!1,v=f.computeFrenetFrames(s,!1),y=new $n,x=new $n,b=new $n),l||(p=0,u=0,h=0,d=0);var S=e.extractPoints(o),E=S.shape,A=S.holes;if(!Dl.isClockWise(E))for(E=E.reverse(),w=0,M=A.length;w<M;w++)_=A[w],Dl.isClockWise(_)&&(A[w]=_.reverse());var L=Dl.triangulateShape(E,A),R=E;for(w=0,M=A.length;w<M;w++)_=A[w],E=E.concat(_);function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var C,O,D,I,N,F,B=E.length,H=L.length;function U(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,h=o*l-s*c;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(c*c+l*l),f=t.x-s/d,m=t.y+o/d,g=((n.x-l/p-f)*l-(n.y+c/p-m)*c)/(o*l-s*c),v=(r=f+o*g-e.x)*r+(i=m+s*g-e.y)*i;if(v<=2)return new kn(r,i);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new kn(r/a,i/a)}for(var z=[],G=0,k=R.length,V=k-1,j=G+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),z[G]=U(R[G],R[V],R[j]);var W,q,X=[],Y=z.concat();for(w=0,M=A.length;w<M;w++){for(_=A[w],W=[],G=0,V=(k=_.length)-1,j=G+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),W[G]=U(_[G],_[V],_[j]);X.push(W),Y=Y.concat(W)}for(C=0;C<p;C++){for(D=C/p,I=u*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+d,G=0,k=R.length;G<k;G++)J((N=P(R[G],z[G],O)).x,N.y,-I);for(w=0,M=A.length;w<M;w++)for(_=A[w],W=X[w],G=0,k=_.length;G<k;G++)J((N=P(_[G],W[G],O)).x,N.y,-I)}for(O=h+d,G=0;G<B;G++)N=l?P(E[G],Y[G],O):E[G],T?(x.copy(v.normals[0]).multiplyScalar(N.x),y.copy(v.binormals[0]).multiplyScalar(N.y),b.copy(g[0]).add(x).add(y),J(b.x,b.y,b.z)):J(N.x,N.y,0);for(q=1;q<=s;q++)for(G=0;G<B;G++)N=l?P(E[G],Y[G],O):E[G],T?(x.copy(v.normals[q]).multiplyScalar(N.x),y.copy(v.binormals[q]).multiplyScalar(N.y),b.copy(g[q]).add(x).add(y),J(b.x,b.y,b.z)):J(N.x,N.y,c/s*q);for(C=p-1;C>=0;C--){for(D=C/p,I=u*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+d,G=0,k=R.length;G<k;G++)J((N=P(R[G],z[G],O)).x,N.y,c+I);for(w=0,M=A.length;w<M;w++)for(_=A[w],W=X[w],G=0,k=_.length;G<k;G++)N=P(_[G],W[G],O),T?J(N.x,N.y+g[s-1].y,g[s-1].x+I):J(N.x,N.y,c+I)}function Z(e,t){var n,r;for(G=e.length;--G>=0;){n=G,(r=G-1)<0&&(r=e.length-1);var i=0,a=s+2*p;for(i=0;i<a;i++){var o=B*i,c=B*(i+1);Q(t+n+o,t+r+o,t+r+c,t+n+c)}}}function J(e,t,n){a.push(e),a.push(t),a.push(n)}function K(e,t,i){$(e),$(t),$(i);var a=r.length/3,o=m.generateTopUV(n,r,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function Q(e,t,i,a){$(e),$(t),$(a),$(t),$(i),$(a);var o=r.length/3,s=m.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){r.push(a[3*e+0]),r.push(a[3*e+1]),r.push(a[3*e+2])}function ee(e){i.push(e.x),i.push(e.y)}!function(){var e=r.length/3;if(l){var t=0,i=B*t;for(G=0;G<H;G++)K((F=L[G])[2]+i,F[1]+i,F[0]+i);for(i=B*(t=s+2*p),G=0;G<H;G++)K((F=L[G])[0]+i,F[1]+i,F[2]+i)}else{for(G=0;G<H;G++)K((F=L[G])[2],F[1],F[0]);for(G=0;G<H;G++)K((F=L[G])[0]+B*s,F[1]+B*s,F[2]+B*s)}n.addGroup(e,r.length/3-e,0)}(),function(){var e=r.length/3,t=0;for(Z(R,t),t+=R.length,w=0,M=A.length;w<M;w++)Z(_=A[w],t),t+=_.length;n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new Di(r,3)),this.setAttribute("uv",new Di(i,2)),this.computeVertexNormals()}Fl.prototype=Object.create(ma.prototype),Fl.prototype.constructor=Fl,Fl.prototype.toJSON=function(){var e=ma.prototype.toJSON.call(this);return Ul(this.parameters.shapes,this.parameters.options,e)},Bl.prototype=Object.create(ji.prototype),Bl.prototype.constructor=Bl,Bl.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return Ul(this.parameters.shapes,this.parameters.options,e)};var Hl={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],c=t[3*r+1],l=t[3*i],u=t[3*i+1];return[new kn(a,o),new kn(s,c),new kn(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*r],u=t[3*r+1],h=t[3*r+2],d=t[3*i],p=t[3*i+1],f=t[3*i+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-u)<.01?[new kn(o,1-c),new kn(l,1-h),new kn(d,1-f),new kn(m,1-v)]:[new kn(s,1-c),new kn(u,1-h),new kn(p,1-f),new kn(g,1-v)]}};function Ul(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function zl(e,t){ma.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Gl(e,t)),this.mergeVertices()}function Gl(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new ma;var r=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),Bl.call(this,r,t),this.type="TextBufferGeometry"}function kl(e,t,n,r,i,a,o){ma.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Vl(e,t,n,r,i,a,o)),this.mergeVertices()}function Vl(e,t,n,r,i,a,o){ji.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,l=Math.min(a+o,Math.PI),u=0,h=[],d=new $n,p=new $n,f=[],m=[],g=[],v=[];for(c=0;c<=n;c++){var y=[],x=c/n,b=0;for(0==c&&0==a?b=.5/t:c==n&&l==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var _=s/t;d.x=-e*Math.cos(r+_*i)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(r+_*i)*Math.sin(a+x*o),m.push(d.x,d.y,d.z),p.copy(d).normalize(),g.push(p.x,p.y,p.z),v.push(_+b,1-x),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var w=h[c][s+1],M=h[c][s],T=h[c+1][s],S=h[c+1][s+1];(0!==c||a>0)&&f.push(w,M,S),(c!==n-1||l<Math.PI)&&f.push(M,T,S)}this.setIndex(f),this.setAttribute("position",new Di(m,3)),this.setAttribute("normal",new Di(g,3)),this.setAttribute("uv",new Di(v,2))}function jl(e,t,n,r,i,a){ma.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new Wl(e,t,n,r,i,a)),this.mergeVertices()}function Wl(e,t,n,r,i,a){ji.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],u=[],h=[],d=[],p=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new $n,g=new kn;for(s=0;s<=r;s++){for(c=0;c<=n;c++)o=i+c/n*a,m.x=p*Math.cos(o),m.y=p*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,d.push(g.x,g.y);p+=f}for(s=0;s<r;s++){var v=s*(n+1);for(c=0;c<n;c++){var y=o=c+v,x=o+n+1,b=o+n+2,_=o+1;l.push(y,x,_),l.push(x,b,_)}}this.setIndex(l),this.setAttribute("position",new Di(u,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(d,2))}function ql(e,t,n,r){ma.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new Xl(e,t,n,r)),this.mergeVertices()}function Xl(e,t,n,r){ji.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=Gn.clamp(r,0,2*Math.PI);var i,a,o,s=[],c=[],l=[],u=1/t,h=new $n,d=new kn;for(a=0;a<=t;a++){var p=n+a*u*r,f=Math.sin(p),m=Math.cos(p);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,c.push(h.x,h.y,h.z),d.x=a/t,d.y=o/(e.length-1),l.push(d.x,d.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=i=o+a*e.length,v=i+e.length,y=i+e.length+1,x=i+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.setAttribute("position",new Di(c,3)),this.setAttribute("uv",new Di(l,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,_=new $n,w=new $n,M=new $n;for(i=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)_.x=b[o+0],_.y=b[o+1],_.z=b[o+2],w.x=b[i+o+0],w.y=b[i+o+1],w.z=b[i+o+2],M.addVectors(_,w).normalize(),b[o+0]=b[i+o+0]=M.x,b[o+1]=b[i+o+1]=M.y,b[o+2]=b[i+o+2]=M.z}}function Yl(e,t){ma.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Zl(e,t)),this.mergeVertices()}function Zl(e,t){ji.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){var o,c,l,u=r.length/3,h=e.extractPoints(t),d=h.shape,p=h.holes;for(!1===Dl.isClockWise(d)&&(d=d.reverse()),o=0,c=p.length;o<c;o++)l=p[o],!0===Dl.isClockWise(l)&&(p[o]=l.reverse());var f=Dl.triangulateShape(d,p);for(o=0,c=p.length;o<c;o++)l=p[o],d=d.concat(l);for(o=0,c=d.length;o<c;o++){var m=d[o];r.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var g=f[o],v=g[0]+u,y=g[1]+u,x=g[2]+u;n.push(v,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new Di(r,3)),this.setAttribute("normal",new Di(i,3)),this.setAttribute("uv",new Di(a,2))}function Jl(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function Kl(e,t){ji.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,a,o=[],s=Math.cos(Gn.DEG2RAD*t),c=[0,0],l={},u=["a","b","c"];e.isBufferGeometry?(a=new ma).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,d=a.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[u[g]],r=m[u[(g+1)%3]],c[0]=Math.min(n,r),c[1]=Math.max(n,r),void 0===l[i=c[0]+","+c[1]]?l[i]={index1:c[0],index2:c[1],face1:p,face2:void 0}:l[i].face2=p;for(i in l){var v=l[i];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=h[v.index1];o.push(y.x,y.y,y.z),y=h[v.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new Di(o,3))}function Ql(e,t,n,r,i,a,o,s){ma.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new $l(e,t,n,r,i,a,o,s)),this.mergeVertices()}function $l(e,t,n,r,i,a,o,s){ji.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],u=[],h=[],d=[],p=0,f=[],m=n/2,g=0;function v(n){var i,a,f,v=new kn,y=new $n,x=0,b=!0===n?e:t,_=!0===n?1:-1;for(a=p,i=1;i<=r;i++)u.push(0,m*_,0),h.push(0,_,0),d.push(.5,.5),p++;for(f=p,i=0;i<=r;i++){var w=i/r*s+o,M=Math.cos(w),T=Math.sin(w);y.x=b*T,y.y=m*_,y.z=b*M,u.push(y.x,y.y,y.z),h.push(0,_,0),v.x=.5*M+.5,v.y=.5*T*_+.5,d.push(v.x,v.y),p++}for(i=0;i<r;i++){var S=a+i,E=f+i;!0===n?l.push(E,E+1,S):l.push(E+1,E,S),x+=3}c.addGroup(g,x,!0===n?1:2),g+=x}!function(){var a,v,y=new $n,x=new $n,b=0,_=(t-e)/n;for(v=0;v<=i;v++){var w=[],M=v/i,T=M*(t-e)+e;for(a=0;a<=r;a++){var S=a/r,E=S*s+o,A=Math.sin(E),L=Math.cos(E);x.x=T*A,x.y=-M*n+m,x.z=T*L,u.push(x.x,x.y,x.z),y.set(A,_,L).normalize(),h.push(y.x,y.y,y.z),d.push(S,1-M),w.push(p++)}f.push(w)}for(a=0;a<r;a++)for(v=0;v<i;v++){var R=f[v][a],P=f[v+1][a],C=f[v+1][a+1],O=f[v][a+1];l.push(R,P,O),l.push(P,C,O),b+=6}c.addGroup(g,b,0),g+=b}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Di(u,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(d,2))}function eu(e,t,n,r,i,a,o){Ql.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function tu(e,t,n,r,i,a,o){$l.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function nu(e,t,n,r){ma.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new ru(e,t,n,r)),this.mergeVertices()}function ru(e,t,n,r){ji.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],c=[],l=[],u=new $n,h=new kn;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var d=n+a/t*r;u.x=e*Math.cos(d),u.y=e*Math.sin(d),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,l.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.setAttribute("position",new Di(s,3)),this.setAttribute("normal",new Di(c,3)),this.setAttribute("uv",new Di(l,2))}zl.prototype=Object.create(ma.prototype),zl.prototype.constructor=zl,Gl.prototype=Object.create(Bl.prototype),Gl.prototype.constructor=Gl,kl.prototype=Object.create(ma.prototype),kl.prototype.constructor=kl,Vl.prototype=Object.create(ji.prototype),Vl.prototype.constructor=Vl,jl.prototype=Object.create(ma.prototype),jl.prototype.constructor=jl,Wl.prototype=Object.create(ji.prototype),Wl.prototype.constructor=Wl,ql.prototype=Object.create(ma.prototype),ql.prototype.constructor=ql,Xl.prototype=Object.create(ji.prototype),Xl.prototype.constructor=Xl,Yl.prototype=Object.create(ma.prototype),Yl.prototype.constructor=Yl,Yl.prototype.toJSON=function(){var e=ma.prototype.toJSON.call(this);return Jl(this.parameters.shapes,e)},Zl.prototype=Object.create(ji.prototype),Zl.prototype.constructor=Zl,Zl.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return Jl(this.parameters.shapes,e)},Kl.prototype=Object.create(ji.prototype),Kl.prototype.constructor=Kl,Ql.prototype=Object.create(ma.prototype),Ql.prototype.constructor=Ql,$l.prototype=Object.create(ji.prototype),$l.prototype.constructor=$l,eu.prototype=Object.create(Ql.prototype),eu.prototype.constructor=eu,tu.prototype=Object.create($l.prototype),tu.prototype.constructor=tu,nu.prototype=Object.create(ma.prototype),nu.prototype.constructor=nu,ru.prototype=Object.create(ji.prototype),ru.prototype.constructor=ru;var iu=Object.freeze({__proto__:null,WireframeGeometry:Vc,ParametricGeometry:jc,ParametricBufferGeometry:Wc,TetrahedronGeometry:Yc,TetrahedronBufferGeometry:Zc,OctahedronGeometry:Jc,OctahedronBufferGeometry:Kc,IcosahedronGeometry:Qc,IcosahedronBufferGeometry:$c,DodecahedronGeometry:el,DodecahedronBufferGeometry:tl,PolyhedronGeometry:qc,PolyhedronBufferGeometry:Xc,TubeGeometry:nl,TubeBufferGeometry:rl,TorusKnotGeometry:il,TorusKnotBufferGeometry:al,TorusGeometry:ol,TorusBufferGeometry:sl,TextGeometry:zl,TextBufferGeometry:Gl,SphereGeometry:kl,SphereBufferGeometry:Vl,RingGeometry:jl,RingBufferGeometry:Wl,PlaneGeometry:Da,PlaneBufferGeometry:Ia,LatheGeometry:ql,LatheBufferGeometry:Xl,ShapeGeometry:Yl,ShapeBufferGeometry:Zl,ExtrudeGeometry:Fl,ExtrudeBufferGeometry:Bl,EdgesGeometry:Kl,ConeGeometry:eu,ConeBufferGeometry:tu,CylinderGeometry:Ql,CylinderBufferGeometry:$l,CircleGeometry:nu,CircleBufferGeometry:ru,BoxGeometry:ga,BoxBufferGeometry:va});function au(e){wi.call(this),this.type="ShadowMaterial",this.color=new gi(0),this.transparent=!0,this.setValues(e)}function ou(e){_a.call(this,e),this.type="RawShaderMaterial"}function su(e){wi.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new gi(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=un,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function cu(e){su.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new kn(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function lu(e){wi.call(this),this.type="MeshPhongMaterial",this.color=new gi(16777215),this.specular=new gi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=un,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function uu(e){wi.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new gi(16777215),this.specular=new gi(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=un,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function hu(e){wi.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=un,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function du(e){wi.call(this),this.type="MeshLambertMaterial",this.color=new gi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=K,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function pu(e){wi.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new gi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=un,this.normalScale=new kn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function fu(e){_c.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}au.prototype=Object.create(wi.prototype),au.prototype.constructor=au,au.prototype.isShadowMaterial=!0,au.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this},ou.prototype=Object.create(_a.prototype),ou.prototype.constructor=ou,ou.prototype.isRawShaderMaterial=!0,su.prototype=Object.create(wi.prototype),su.prototype.constructor=su,su.prototype.isMeshStandardMaterial=!0,su.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},cu.prototype=Object.create(su.prototype),cu.prototype.constructor=cu,cu.prototype.isMeshPhysicalMaterial=!0,cu.prototype.copy=function(e){return su.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new gi).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},lu.prototype=Object.create(wi.prototype),lu.prototype.constructor=lu,lu.prototype.isMeshPhongMaterial=!0,lu.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},uu.prototype=Object.create(wi.prototype),uu.prototype.constructor=uu,uu.prototype.isMeshToonMaterial=!0,uu.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},hu.prototype=Object.create(wi.prototype),hu.prototype.constructor=hu,hu.prototype.isMeshNormalMaterial=!0,hu.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},du.prototype=Object.create(wi.prototype),du.prototype.constructor=du,du.prototype.isMeshLambertMaterial=!0,du.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},pu.prototype=Object.create(wi.prototype),pu.prototype.constructor=pu,pu.prototype.isMeshMatcapMaterial=!0,pu.prototype.copy=function(e){return wi.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},fu.prototype=Object.create(_c.prototype),fu.prototype.constructor=fu,fu.prototype.isLineDashedMaterial=!0,fu.prototype.copy=function(e){return _c.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var mu=Object.freeze({__proto__:null,ShadowMaterial:au,SpriteMaterial:ks,RawShaderMaterial:ou,ShaderMaterial:_a,PointsMaterial:Oc,MeshPhysicalMaterial:cu,MeshStandardMaterial:su,MeshPhongMaterial:lu,MeshToonMaterial:uu,MeshNormalMaterial:hu,MeshLambertMaterial:du,MeshDepthMaterial:Ts,MeshDistanceMaterial:Ss,MeshBasicMaterial:Mi,MeshMatcapMaterial:pu,LineDashedMaterial:fu,LineBasicMaterial:_c,Material:wi}),gu={arraySlice:function(e,t,n){return gu.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],d=0;d<c.times.length;++d){var p=c.times[d]*i;if(!(p<n||p>=r)){u.push(c.times[d]);for(var f=0;f<l;++f)h.push(c.values[d*l+f])}}0!==u.length&&(c.times=gu.convertArray(u,c.times.constructor),c.values=gu.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===r||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if("bool"!==c&&"string"!==c){var l=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===c}));if(void 0!==l){var u,h=s.getValueSize(),d=s.times.length-1;if(a<=s.times[0])u=gu.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[d]){var p=d*h;u=gu.arraySlice(s.values,p)}else{var f=s.createInterpolant();f.evaluate(a),u=f.resultBuffer}if("quaternion"===c)new Jn(u[0],u[1],u[2],u[3]).normalize().conjugate().toArray(u);for(var m=l.times.length,g=0;g<m;++g){var v=g*h;if("quaternion"===c)Jn.multiplyQuaternionsFlat(l.values,v,u,0,l.values,v);else for(var y=0;y<h;++y)l.values[v+y]-=u[y]}}}}return e.blendMode=Zt,e}};function vu(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function yu(e,t,n,r){vu.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function xu(e,t,n,r){vu.call(this,e,t,n,r)}function bu(e,t,n,r){vu.call(this,e,t,n,r)}function _u(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=gu.convertArray(t,this.TimeBufferType),this.values=gu.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function wu(e,t,n){_u.call(this,e,t,n)}function Mu(e,t,n,r){_u.call(this,e,t,n,r)}function Tu(e,t,n,r){_u.call(this,e,t,n,r)}function Su(e,t,n,r){vu.call(this,e,t,n,r)}function Eu(e,t,n,r){_u.call(this,e,t,n,r)}function Au(e,t,n,r){_u.call(this,e,t,n,r)}function Lu(e,t,n,r){_u.call(this,e,t,n,r)}function Ru(e,t,n,r){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==r?r:Yt,this.uuid=Gn.generateUUID(),this.duration<0&&this.resetDuration()}function Pu(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Tu;case"vector":case"vector2":case"vector3":case"vector4":return Lu;case"color":return Mu;case"quaternion":return Eu;case"bool":case"boolean":return wu;case"string":return Au}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];gu.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(vu.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(vu.prototype,{beforeStart_:vu.prototype.copySampleValue_,afterEnd_:vu.prototype.copySampleValue_}),yu.prototype=Object.assign(Object.create(vu.prototype),{constructor:yu,DefaultSettings_:{endingStart:Wt,endingEnd:Wt},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case qt:i=e,o=2*t-n;break;case Xt:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case qt:a=e,s=2*n-t;break;case Xt:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f,b=0;b!==o;++b)i[b]=g*a[l+b]+v*a[c+b]+y*a[s+b]+x*a[u+b];return i}}),xu.prototype=Object.assign(Object.create(vu.prototype),{constructor:xu,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}}),bu.prototype=Object.assign(Object.create(vu.prototype),{constructor:bu,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(_u,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:gu.convertArray(e.times,Array),values:gu.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(_u.prototype,{constructor:_u,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Vt,InterpolantFactoryMethodDiscrete:function(e){return new bu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new xu(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new yu(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case kt:t=this.InterpolantFactoryMethodDiscrete;break;case Vt:t=this.InterpolantFactoryMethodLinear;break;case jt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return kt;case this.InterpolantFactoryMethodLinear:return Vt;case this.InterpolantFactoryMethodSmooth:return jt}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=gu.arraySlice(n,i,a),this.values=gu.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&gu.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=gu.arraySlice(this.times),t=gu.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===jt,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,h=l+n,d=0;d!==n;++d){var p=t[l+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*n,m=i*n;for(d=0;d!==n;++d)t[m+d]=t[f+d]}++i}}if(a>0){e[i]=e[a];for(f=a*n,m=i*n,d=0;d!==n;++d)t[m+d]=t[f+d];++i}return i!==e.length?(this.times=gu.arraySlice(e,0,i),this.values=gu.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=gu.arraySlice(this.times,0),t=gu.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),wu.prototype=Object.assign(Object.create(_u.prototype),{constructor:wu,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:kt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mu.prototype=Object.assign(Object.create(_u.prototype),{constructor:Mu,ValueTypeName:"color"}),Tu.prototype=Object.assign(Object.create(_u.prototype),{constructor:Tu,ValueTypeName:"number"}),Su.prototype=Object.assign(Object.create(vu.prototype),{constructor:Su,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)Jn.slerpFlat(i,0,a,s-o,a,s,c);return i}}),Eu.prototype=Object.assign(Object.create(_u.prototype),{constructor:Eu,ValueTypeName:"quaternion",DefaultInterpolation:Vt,InterpolantFactoryMethodLinear:function(e){return new Su(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Au.prototype=Object.assign(Object.create(_u.prototype),{constructor:Au,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:kt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Lu.prototype=Object.assign(Object.create(_u.prototype),{constructor:Lu,ValueTypeName:"vector"}),Object.assign(Ru,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Pu(n[i]).scale(r));return new Ru(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(_u.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=gu.getKeyframeOrder(s);s=gu.sortedArray(s,1,l),c=gu.sortedArray(c,1,l),r||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new Tu(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new Ru(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=r[h=c[1]];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(Ru.CreateFromMorphTargetSequence(h,r[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];gu.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var h={},d=0;d<u.length;d++)if(u[d].morphTargets)for(var p=0;p<u[d].morphTargets.length;p++)h[u[d].morphTargets[p]]=-1;for(var f in h){var m=[],g=[];for(p=0;p!==u[d].morphTargets.length;++p){var v=u[d];m.push(v.time),g.push(v.morphTarget===f?1:0)}r.push(new Tu(".morphTargetInfluence["+f+"]",m,g))}a=h.length*(o||1)}else{var y=".bones["+t[l].name+"]";n(Lu,y+".position",u,"pos",r),n(Eu,y+".quaternion",u,"rot",r),n(Lu,y+".scale",u,"scl",r)}}return 0===r.length?null:new Ru(i,a,r,s)}}),Object.assign(Ru.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Ru(this.name,this.duration,e,this.blendMode)}});var Cu={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function Ou(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}}var Du=new Ou;function Iu(e){this.manager=void 0!==e?e:Du,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Iu.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var Nu={};function Fu(e){Iu.call(this,e)}function Bu(e){Iu.call(this,e)}function Hu(e){Iu.call(this,e)}function Uu(e){Iu.call(this,e)}function zu(e){Iu.call(this,e)}function Gu(e){Iu.call(this,e)}function ku(e){Iu.call(this,e)}function Vu(){this.type="Curve",this.arcLengthDivisions=200}function ju(e,t,n,r,i,a,o,s){Vu.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Wu(e,t,n,r,i,a){ju.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function qu(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,c*=o,l*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}Fu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Fu,load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Cu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Nu[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var d=new Uint8Array(l.length),p=0;p<l.length;p++)d[p]=l.charCodeAt(p);u="blob"===h?new Blob([d.buffer],{type:s}):d.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(l,s);break;case"json":u=JSON.parse(l);break;default:u=l}setTimeout((function(){t&&t(u),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{Nu[e]=[],Nu[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,r=Nu[e];if(delete Nu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Cu.add(e,n);for(var a=0,o=r.length;a<o;a++){(s=r[a]).onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(a=0,o=r.length;a<o;a++){var s;(s=r[a]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=Nu[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=Nu[e];delete Nu[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=Nu[e];delete Nu[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return i.manager.itemStart(e),m}Nu[e].push({onLoad:t,onProgress:n,onError:r})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),Bu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Bu,load:function(e,t,n,r){var i=this,a=new Fu(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ru.parse(e[n]);t.push(r)}return t}}),Hu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Hu,load:function(e,t,n,r){var i=this,a=[],o=new zc;o.image=a;var s=new Fu(this.manager);function c(c){s.load(e[c],(function(e){var n=i.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=we),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)c(u);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=we),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}),Uu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Uu,load:function(e,t,n,r){var i=this,a=new Ea,o=new Fu(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){var n=i.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:me,a.wrapT=void 0!==n.wrapT?n.wrapT:me,a.magFilter=void 0!==n.magFilter?n.magFilter:we,a.minFilter=void 0!==n.minFilter?n.minFilter:we,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Se),1===n.mipmapCount&&(a.minFilter=we),a.needsUpdate=!0,t&&t(a,n))}),n,r),a}}),zu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:zu,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Cu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Cu.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),Gu.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Gu,load:function(e,t,n,r){var i=new Ya,a=new zu(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),ku.prototype=Object.assign(Object.create(Iu.prototype),{constructor:ku,load:function(e,t,n,r){var i=new qn,a=new zu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){i.image=n;var r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?ze:Ge,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(Vu.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)},getTangent:function(e,t){var n=e-1e-4,r=e+1e-4;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),a=this.getPoint(r),o=t||(i.isVector2?new kn:new $n);return o.copy(a).sub(i).normalize(),o},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,r,i,a=new $n,o=[],s=[],c=[],l=new $n,u=new sr;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r,new $n),o[n].normalize();s[0]=new $n,c[0]=new $n;var h=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=h&&(h=d,a.set(1,0,0)),p<=h&&(h=p,a.set(0,1,0)),f<=h&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(o[n-1],o[n]),l.length()>Number.EPSILON&&(l.normalize(),i=Math.acos(Gn.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,i))),c[n].crossVectors(o[n],s[n]);if(!0===t)for(i=Math.acos(Gn.clamp(s[0].dot(s[e]),-1,1)),i/=e,o[0].dot(l.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],i*n)),c[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),ju.prototype=Object.create(Vu.prototype),ju.prototype.constructor=ju,ju.prototype.isEllipseCurve=!0,ju.prototype.getPoint=function(e,t){for(var n=t||new kn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=c-this.aY;s=h*l-d*u+this.aX,c=h*u+d*l+this.aY}return n.set(s,c)},ju.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},ju.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},ju.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Wu.prototype=Object.create(ju.prototype),Wu.prototype.constructor=Wu,Wu.prototype.isArcCurve=!0;var Xu=new $n,Yu=new qu,Zu=new qu,Ju=new qu;function Ku(e,t,n,r){Vu.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Qu(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function $u(e,t,n,r){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function eh(e,t,n,r,i){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}function th(e,t,n,r){Vu.call(this),this.type="CubicBezierCurve",this.v0=e||new kn,this.v1=t||new kn,this.v2=n||new kn,this.v3=r||new kn}function nh(e,t,n,r){Vu.call(this),this.type="CubicBezierCurve3",this.v0=e||new $n,this.v1=t||new $n,this.v2=n||new $n,this.v3=r||new $n}function rh(e,t){Vu.call(this),this.type="LineCurve",this.v1=e||new kn,this.v2=t||new kn}function ih(e,t){Vu.call(this),this.type="LineCurve3",this.v1=e||new $n,this.v2=t||new $n}function ah(e,t,n){Vu.call(this),this.type="QuadraticBezierCurve",this.v0=e||new kn,this.v1=t||new kn,this.v2=n||new kn}function oh(e,t,n){Vu.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new $n,this.v1=t||new $n,this.v2=n||new $n}function sh(e){Vu.call(this),this.type="SplineCurve",this.points=e||[]}Ku.prototype=Object.create(Vu.prototype),Ku.prototype.constructor=Ku,Ku.prototype.isCatmullRomCurve3=!0,Ku.prototype.getPoint=function(e,t){var n,r,i,a,o=t||new $n,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,u=Math.floor(l),h=l-u;if(this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Xu.subVectors(s[0],s[1]).add(s[0]),n=Xu),r=s[u%c],i=s[(u+1)%c],this.closed||u+2<c?a=s[(u+2)%c]:(Xu.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Xu),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(r),d),f=Math.pow(r.distanceToSquared(i),d),m=Math.pow(i.distanceToSquared(a),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),Yu.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,p,f,m),Zu.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,p,f,m),Ju.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,p,f,m)}else"catmullrom"===this.curveType&&(Yu.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),Zu.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),Ju.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(Yu.calc(h),Zu.calc(h),Ju.calc(h)),o},Ku.prototype.copy=function(e){Vu.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ku.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ku.prototype.fromJSON=function(e){Vu.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new $n).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},th.prototype=Object.create(Vu.prototype),th.prototype.constructor=th,th.prototype.isCubicBezierCurve=!0,th.prototype.getPoint=function(e,t){var n=t||new kn,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(eh(e,r.x,i.x,a.x,o.x),eh(e,r.y,i.y,a.y,o.y)),n},th.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},th.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},th.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},nh.prototype=Object.create(Vu.prototype),nh.prototype.constructor=nh,nh.prototype.isCubicBezierCurve3=!0,nh.prototype.getPoint=function(e,t){var n=t||new $n,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(eh(e,r.x,i.x,a.x,o.x),eh(e,r.y,i.y,a.y,o.y),eh(e,r.z,i.z,a.z,o.z)),n},nh.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},nh.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},nh.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},rh.prototype=Object.create(Vu.prototype),rh.prototype.constructor=rh,rh.prototype.isLineCurve=!0,rh.prototype.getPoint=function(e,t){var n=t||new kn;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},rh.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},rh.prototype.getTangent=function(e,t){return(t||new kn).copy(this.v2).sub(this.v1).normalize()},rh.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},rh.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},rh.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ih.prototype=Object.create(Vu.prototype),ih.prototype.constructor=ih,ih.prototype.isLineCurve3=!0,ih.prototype.getPoint=function(e,t){var n=t||new $n;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},ih.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},ih.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ih.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ih.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ah.prototype=Object.create(Vu.prototype),ah.prototype.constructor=ah,ah.prototype.isQuadraticBezierCurve=!0,ah.prototype.getPoint=function(e,t){var n=t||new kn,r=this.v0,i=this.v1,a=this.v2;return n.set($u(e,r.x,i.x,a.x),$u(e,r.y,i.y,a.y)),n},ah.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ah.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ah.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},oh.prototype=Object.create(Vu.prototype),oh.prototype.constructor=oh,oh.prototype.isQuadraticBezierCurve3=!0,oh.prototype.getPoint=function(e,t){var n=t||new $n,r=this.v0,i=this.v1,a=this.v2;return n.set($u(e,r.x,i.x,a.x),$u(e,r.y,i.y,a.y),$u(e,r.z,i.z,a.z)),n},oh.prototype.copy=function(e){return Vu.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},oh.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},oh.prototype.fromJSON=function(e){return Vu.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},sh.prototype=Object.create(Vu.prototype),sh.prototype.constructor=sh,sh.prototype.isSplineCurve=!0,sh.prototype.getPoint=function(e,t){var n=t||new kn,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Qu(o,s.x,c.x,l.x,u.x),Qu(o,s.y,c.y,l.y,u.y)),n},sh.prototype.copy=function(e){Vu.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},sh.prototype.toJSON=function(){var e=Vu.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},sh.prototype.fromJSON=function(e){Vu.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new kn).fromArray(r))}return this};var ch=Object.freeze({__proto__:null,ArcCurve:Wu,CatmullRomCurve3:Ku,CubicBezierCurve:th,CubicBezierCurve3:nh,EllipseCurve:ju,LineCurve:rh,LineCurve3:ih,QuadraticBezierCurve:ah,QuadraticBezierCurve3:oh,SplineCurve:sh});function lh(){Vu.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function uh(e){lh.call(this),this.type="Path",this.currentPoint=new kn,e&&this.setFromPoints(e)}function hh(e){uh.call(this,e),this.uuid=Gn.generateUUID(),this.type="Shape",this.holes=[]}function dh(e,t){Sr.call(this),this.type="Light",this.color=new gi(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function ph(e,t,n){dh.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Sr.DefaultUp),this.updateMatrix(),this.groundColor=new gi(t)}function fh(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new kn(512,512),this.map=null,this.mapPass=null,this.matrix=new sr,this._frustum=new Ra,this._frameExtents=new kn(1,1),this._viewportCount=1,this._viewports=[new Xn(0,0,1,1)]}function mh(){fh.call(this,new Ma(50,1,.5,500))}function gh(e,t,n,r,i,a){dh.call(this,e,t),this.type="SpotLight",this.position.copy(Sr.DefaultUp),this.updateMatrix(),this.target=new Sr,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new mh}function vh(){fh.call(this,new Ma(90,1,.5,500)),this._frameExtents=new kn(4,2),this._viewportCount=6,this._viewports=[new Xn(2,1,1,1),new Xn(0,1,1,1),new Xn(3,1,1,1),new Xn(1,1,1,1),new Xn(3,0,1,1),new Xn(1,0,1,1)],this._cubeDirections=[new $n(1,0,0),new $n(-1,0,0),new $n(0,0,1),new $n(0,0,-1),new $n(0,1,0),new $n(0,-1,0)],this._cubeUps=[new $n(0,1,0),new $n(0,1,0),new $n(0,1,0),new $n(0,1,0),new $n(0,0,1),new $n(0,0,-1)]}function yh(e,t,n,r){dh.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new vh}function xh(e,t,n,r,i,a){wa.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function bh(){fh.call(this,new xh(-5,5,5,-5,.5,500))}function _h(e,t){dh.call(this,e,t),this.type="DirectionalLight",this.position.copy(Sr.DefaultUp),this.updateMatrix(),this.target=new Sr,this.shadow=new bh}function wh(e,t){dh.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function Mh(e,t,n,r){dh.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Th(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new $n)}function Sh(e,t){dh.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new Th}function Eh(e){Iu.call(this,e),this.textures={}}lh.prototype=Object.assign(Object.create(Vu.prototype),{constructor:lh,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new rh(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(n.push(l),t=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Vu.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Vu.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Vu.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push((new ch[r.type]).fromJSON(r))}return this}}),uh.prototype=Object.assign(Object.create(lh.prototype),{constructor:uh,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new rh(this.currentPoint.clone(),new kn(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new ah(this.currentPoint.clone(),new kn(e,t),new kn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new th(this.currentPoint.clone(),new kn(e,t),new kn(n,r),new kn(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new sh([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new ju(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return lh.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=lh.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return lh.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),hh.prototype=Object.assign(Object.create(uh.prototype),{constructor:hh,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){uh.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=uh.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){uh.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push((new uh).fromJSON(r))}return this}}),dh.prototype=Object.assign(Object.create(Sr.prototype),{constructor:dh,isLight:!0,copy:function(e){return Sr.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Sr.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),ph.prototype=Object.assign(Object.create(dh.prototype),{constructor:ph,isHemisphereLight:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(fh.prototype,{_projScreenMatrix:new sr,_lightPositionWorld:new $n,_lookTarget:new $n,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),mh.prototype=Object.assign(Object.create(fh.prototype),{constructor:mh,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*Gn.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),fh.prototype.updateMatrices.call(this,e)}}),gh.prototype=Object.assign(Object.create(dh.prototype),{constructor:gh,isSpotLight:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),vh.prototype=Object.assign(Object.create(fh.prototype),{constructor:vh,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),yh.prototype=Object.assign(Object.create(dh.prototype),{constructor:yh,isPointLight:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),xh.prototype=Object.assign(Object.create(wa.prototype),{constructor:xh,isOrthographicCamera:!0,copy:function(e,t){return wa.prototype.copy.call(this,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=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){null===this.view&&(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=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=c*this.view.offsetX)+c*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Sr.prototype.toJSON.call(this,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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),bh.prototype=Object.assign(Object.create(fh.prototype),{constructor:bh,isDirectionalLightShadow:!0,updateMatrices:function(e){fh.prototype.updateMatrices.call(this,e)}}),_h.prototype=Object.assign(Object.create(dh.prototype),{constructor:_h,isDirectionalLight:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),wh.prototype=Object.assign(Object.create(dh.prototype),{constructor:wh,isAmbientLight:!0}),Mh.prototype=Object.assign(Object.create(dh.prototype),{constructor:Mh,isRectAreaLight:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=dh.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Th.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}),Object.assign(Th,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}),Sh.prototype=Object.assign(Object.create(dh.prototype),{constructor:Sh,isLightProbe:!0,copy:function(e){return dh.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=dh.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),Eh.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Eh,load:function(e,t,n,r){var i=this,a=new Fu(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var r=new mu[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=(new gi).setHex(e.sheen)),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(r.morphNormals=e.morphNormals),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.vertexTangents&&(r.vertexTangents=e.vertexTangents),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new gi).setHex(a.value);break;case"v2":r.uniforms[i].value=(new kn).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new $n).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Xn).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new Vn).fromArray(a.value);case"m4":r.uniforms[i].value=(new sr).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new kn).fromArray(s)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new kn).fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}});var Ah={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function Lh(){ji.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Rh(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Si.call(this,e,t,n),this.meshPerAttribute=r||1}function Ph(e){Iu.call(this,e)}Lh.prototype=Object.assign(Object.create(ji.prototype),{constructor:Lh,isInstancedBufferGeometry:!0,copy:function(e){return ji.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=ji.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),Rh.prototype=Object.assign(Object.create(Si.prototype),{constructor:Rh,isInstancedBufferAttribute:!0,copy:function(e){return Si.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=Si.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Ph.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Ph,load:function(e,t,n,r){var i=this,a=new Fu(i.manager);a.setPath(i.path),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new Lh:new ji,n=e.data.index;if(void 0!==n){var r=new Ch[n.type](n.array);t.setIndex(new Si(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=(r=new Ch[o.type](o.array),new(o.isInstancedBufferAttribute?Rh:Si)(r,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],u=[],h=0,d=l.length;h<d;h++){o=l[h],s=new Si(r=new Ch[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),u.push(s)}t.morphAttributes[a]=u}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==p){h=0;for(var f=p.length;h!==f;++h){var m=p[h];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new $n;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new Vr(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Ch={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Oh(e){Iu.call(this,e)}Oh.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Oh,load:function(e,t,n,r){var i=this,a=""===this.path?Ah.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Fu(i.manager);o.setPath(this.path),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new hh).fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var r=new Ph,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new iu[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new iu[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new iu[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new iu[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new iu[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new iu[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new iu[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new iu[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new iu[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new iu[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new iu[s.type]((new ch[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new iu[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new iu[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,u=s.shapes.length;l<u;l++){var h=t[s.shapes[l]];c.push(h)}o=new iu[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,u=s.shapes.length;l<u;l++){h=t[s.shapes[l]];c.push(h)}var d=s.options.extrudePath;void 0!==d&&(s.options.extrudePath=(new ch[d.type]).fromJSON(d)),o=new iu[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(void 0!==e){var i=new Eh;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Ru.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(e){return n.manager.itemStart(e),a.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var a=new zu(new Ou(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,h=l.length;u<h;u++){var d=l[u],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[c.uuid].push(i(p))}}else{p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(p)}}}return r},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new Ya(t[s.image]):new qn(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,Ih)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],Nh),o.wrapT=n(s.wrap[1],Nh)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,Fh)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Fh)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),r[s.uuid]=o}return r},parseObject:function(e,t,n){var r;function i(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":r=new Er,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new gi(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new Bs(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new Fs(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new Ma(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new xh(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new wh(e.color,e.intensity);break;case"DirectionalLight":r=new _h(e.color,e.intensity);break;case"PointLight":r=new yh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new Mh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new gh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new ph(e.color,e.groundColor,e.intensity);break;case"LightProbe":r=(new Sh).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":r=new ca(o=i(e.geometry),s=a(e.material));break;case"InstancedMesh":var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;(r=new bc(o,s,c)).instanceMatrix=new Si(new Float32Array(l.array),16);break;case"LOD":r=new uc;break;case"Line":r=new Ac(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Cc(i(e.geometry),a(e.material));break;case"LineSegments":r=new Pc(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new Bc(i(e.geometry),a(e.material));break;case"Sprite":r=new tc(a(e.material));break;case"Group":r=new Cs;break;default:r=new Sr}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(r.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.frustumCulled&&(r.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(r.renderOrder=e.renderOrder),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.layers&&(r.layers.mask=e.layers),void 0!==e.children)for(var u=e.children,h=0;h<u.length;h++)r.add(this.parseObject(u[h],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(r.autoUpdate=e.autoUpdate);for(var d=e.levels,p=0;p<d.length;p++){var f=d[p],m=r.getObjectByProperty("uuid",f.object);void 0!==m&&r.addLevel(m,f.distance)}}return r}});var Dh,Ih={UVMapping:oe,CubeReflectionMapping:se,CubeRefractionMapping:ce,EquirectangularReflectionMapping:le,EquirectangularRefractionMapping:ue,SphericalReflectionMapping:he,CubeUVReflectionMapping:de,CubeUVRefractionMapping:pe},Nh={RepeatWrapping:fe,ClampToEdgeWrapping:me,MirroredRepeatWrapping:ge},Fh={NearestFilter:ve,NearestMipmapNearestFilter:ye,NearestMipmapLinearFilter:be,LinearFilter:we,LinearMipmapNearestFilter:Me,LinearMipmapLinearFilter:Se};function Bh(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),Iu.call(this,e),this.options=void 0}function Hh(){this.type="ShapePath",this.color=new gi,this.subPaths=[],this.currentPath=null}function Uh(e){this.type="Font",this.data=e}function zh(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,c,l,u,h,d,p,f=new Hh;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":o=m[g++]*t+n,s=m[g++]*t+r,f.moveTo(o,s);break;case"l":o=m[g++]*t+n,s=m[g++]*t+r,f.lineTo(o,s);break;case"q":c=m[g++]*t+n,l=m[g++]*t+r,u=m[g++]*t+n,h=m[g++]*t+r,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[g++]*t+n,l=m[g++]*t+r,u=m[g++]*t+n,h=m[g++]*t+r,d=m[g++]*t+n,p=m[g++]*t+r,f.bezierCurveTo(u,h,d,p,c,l)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".")}function Gh(e){Iu.call(this,e)}Bh.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Bh,setOptions:function(e){return this.options=e,this},load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Cu.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)})).then((function(n){Cu.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}),Object.assign(Hh.prototype,{moveTo:function(e,t){return this.currentPath=new uh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new hh;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Dl.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new hh).curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=i(h=(s=a[v]).getPoints()),(o=e?!o:o)?(!u&&f[g]&&g++,f[g]={s:new hh,p:h},f[g].s.curves=s.curves,u&&g++,m[g]=[]):m[g].push({h:s,p:h[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],_=0,w=f.length;_<w;_++)p[_]=[];for(_=0,w=f.length;_<w;_++)for(var M=m[_],T=0;T<M.length;T++){for(var S=M[T],E=!0,A=0;A<f.length;A++)r(S.p,f[A].p)&&(_!==A&&b.push({froms:_,tos:A,hole:T}),E?(E=!1,p[A].push(S)):x=!0);E&&p[_].push(S)}b.length>0&&(x||(m=p))}v=0;for(var L=f.length;v<L;v++){c=f[v].s,l.push(c);for(var R=0,P=(d=m[v]).length;R<P;R++)c.holes.push(d[R].h)}return l}}),Object.assign(Uh.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],r=function(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if("\n"===u)s=0,c-=a;else{var h=zh(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Gh.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Gh,load:function(e,t,n,r){var i=this,a=new Fu(this.manager);a.setPath(this.path),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var r=i.parse(n);t&&t(r)}),n,r)},parse:function(e){return new Uh(e)}});var kh={getContext:function(){return void 0===Dh&&(Dh=new(window.AudioContext||window.webkitAudioContext)),Dh},setContext:function(e){Dh=e}};function Vh(e){Iu.call(this,e)}function jh(e,t,n){Sh.call(this,void 0,n);var r=(new gi).set(e),i=(new gi).set(t),a=new $n(r.r,r.g,r.b),o=new $n(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Wh(e,t){Sh.call(this,void 0,t);var n=(new gi).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Vh.prototype=Object.assign(Object.create(Iu.prototype),{constructor:Vh,load:function(e,t,n,r){var i=this,a=new Fu(i.manager);a.setResponseType("arraybuffer"),a.setPath(i.path),a.load(e,(function(n){try{var a=n.slice(0);kh.getContext().decodeAudioData(a,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}),jh.prototype=Object.assign(Object.create(Sh.prototype),{constructor:jh,isHemisphereLightProbe:!0,copy:function(e){return Sh.prototype.copy.call(this,e),this},toJSON:function(e){return Sh.prototype.toJSON.call(this,e)}}),Wh.prototype=Object.assign(Object.create(Sh.prototype),{constructor:Wh,isAmbientLightProbe:!0,copy:function(e){return Sh.prototype.copy.call(this,e),this},toJSON:function(e){return Sh.prototype.toJSON.call(this,e)}});var qh=new sr,Xh=new sr;function Yh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ma,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ma,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}function Zh(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Yh.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,r,i=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(Gn.DEG2RAD*t.fov*.5)/t.zoom;Xh.elements[12]=-a,qh.elements[12]=a,n=-s*t.aspect+o,r=s*t.aspect+o,i.elements[0]=2*t.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*t.aspect-o,r=s*t.aspect-o,i.elements[0]=2*t.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Xh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(qh)}}),Object.assign(Zh.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Jh=new $n,Kh=new Jn,Qh=new $n,$h=new $n;function ed(){Sr.call(this),this.type="AudioListener",this.context=kh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Zh}function td(e){Sr.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}ed.prototype=Object.assign(Object.create(Sr.prototype),{constructor:ed,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){Sr.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Jh,Kh,Qh),$h.set(0,0,-1).applyQuaternion(Kh),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Jh.x,r),t.positionY.linearRampToValueAtTime(Jh.y,r),t.positionZ.linearRampToValueAtTime(Jh.z,r),t.forwardX.linearRampToValueAtTime($h.x,r),t.forwardY.linearRampToValueAtTime($h.y,r),t.forwardZ.linearRampToValueAtTime($h.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Jh.x,Jh.y,Jh.z),t.setOrientation($h.x,$h.y,$h.z,n.x,n.y,n.z)}}),td.prototype=Object.assign(Object.create(Sr.prototype),{constructor:td,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var nd=new $n,rd=new Jn,id=new $n,ad=new $n;function od(e){td.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function sd(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function cd(e,t,n){var r,i,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}od.prototype=Object.assign(Object.create(td.prototype),{constructor:od,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(Sr.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(nd,rd,id),ad.set(0,0,1).applyQuaternion(rd);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(nd.x,n),t.positionY.linearRampToValueAtTime(nd.y,n),t.positionZ.linearRampToValueAtTime(nd.z,n),t.orientationX.linearRampToValueAtTime(ad.x,n),t.orientationY.linearRampToValueAtTime(ad.y,n),t.orientationZ.linearRampToValueAtTime(ad.z,n)}else t.setPosition(nd.x,nd.y,nd.z),t.setOrientation(ad.x,ad.y,ad.z)}}}),Object.assign(sd.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(cd.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){Jn.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;Jn.multiplyQuaternionsFlat(e,a,e,t,e,n),Jn.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}});var ld=new RegExp("[\\[\\]\\.:\\/]","g"),ud="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",hd=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),dd=/(WCOD+)?/.source.replace("WCOD",ud),pd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),md=new RegExp("^"+hd+dd+pd+fd+"$"),gd=["material","materials","bones"];function vd(e,t,n){var r=n||yd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function yd(e,t,n){this.path=t,this.parsedPath=n||yd.parseTrackName(t),this.node=yd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function xd(){this.uuid=Gn.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function bd(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=new Array(a),s={endingStart:Wt,endingEnd:Wt},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=zt,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function _d(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function wd(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Md(e,t,n){Hs.call(this,e,t),this.meshPerAttribute=n||1}function Td(e,t,n,r){this.ray=new Kr(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new hr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Sd(e,t){return e.distance-t.distance}function Ed(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)Ed(i[a],t,n,!0)}function Ad(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}function Ld(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}Object.assign(vd.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(yd,{Composite:vd,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new yd.Composite(e,t,n):new yd(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(ld,"")},parseTrackName:function(e){var t=md.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==gd.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function(e){for(var n=0;n<e.length;n++){var i=e[n];if(i.name===t||i.uuid===t)return i;var a=r(i.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(yd.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=yd.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[r];if(void 0!==s){var c=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+r+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(yd.prototype,{_getValue_unbound:yd.prototype.getValue,_setValue_unbound:yd.prototype.setValue}),Object.assign(xd.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],d=h.uuid,p=r[d];if(void 0===p){p=t++,r[d]=p,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new yd(h,i[f],a[f]))}else if(p<n){c=e[p];var g=--n,v=e[g];r[v.uuid]=p,e[p]=v,r[d]=g,e[g]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[p];y[p]=x,void 0===b&&(b=new yd(h,i[f],a[f])),y[g]=b}}else e[p]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&l>=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var d=0,p=i;d!==p;++d){var f=r[d],m=f[u],g=f[l];f[l]=m,f[u]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(void 0!==u)if(delete r[l],u<n){var h=--n,d=e[h],p=e[y=--t];r[d.uuid]=u,e[u]=d,r[p.uuid]=h,e[h]=p,e.pop();for(var f=0,m=a;f!==m;++f){var g=(x=i[f])[h],v=x[y];x[u]=g,x[h]=v,x.pop()}}else{var y;r[(p=e[y=--t]).uuid]=u,e[u]=p,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=i[f])[u]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=l,d=s.length;h!==d;++h){var p=s[h];u[h]=new yd(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(bd.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Zt:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Yt:default:for(u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===Gt;if(0===e)return-1===i?t:a&&1==(1&i)?n-t:t;if(r===Ut){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&i))return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=qt,r.endingEnd=qt):(r.endingStart=e?this.zeroSlopeAtStart?qt:Wt:Xt,r.endingEnd=t?this.zeroSlopeAtEnd?qt:Wt:Xt)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),_d.prototype=Object.assign(Object.create(Bn.prototype),{constructor:_d,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=l[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new cd(yd.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;void 0===i&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new xu(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?Ru.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],c=null;if(void 0===n&&(n=null!==a?a.blendMode:Yt),void 0!==s){var l=s.actionByRoot[i];if(void 0!==l&&l.blendMode===n)return l;c=s.knownActions[0],null===a&&(a=c._clip)}if(null===a)return null;var u=new bd(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Ru.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),wd.prototype.clone=function(){return new wd(void 0===this.value.clone?this.value:this.value.clone())},Md.prototype=Object.assign(Object.create(Hs.prototype),{constructor:Md,isInstancedInterleavedBuffer:!0,copy:function(e){return Hs.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(Td.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return Ed(e,this,r,t),r.sort(Sd),r},intersectObjects:function(e,t,n){var r=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)Ed(e[i],this,r,t);return r.sort(Sd),r}}),Object.assign(Ad.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Gn.clamp(t/this.radius,-1,1))),this}}),Object.assign(Ld.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var Rd=new kn;function Pd(e,t){this.min=void 0!==e?e:new kn(1/0,1/0),this.max=void 0!==t?t:new kn(-1/0,-1/0)}Object.assign(Pd.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Rd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new kn),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new kn),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new kn),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new kn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Rd.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Cd=new $n,Od=new $n;function Dd(e,t){this.start=void 0!==e?e:new $n,this.end=void 0!==t?t:new $n}function Id(e){Sr.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Object.assign(Dd.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new $n),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new $n),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new $n),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Cd.subVectors(e,this.start),Od.subVectors(this.end,this.start);var n=Od.dot(Od),r=Od.dot(Cd)/n;return t&&(r=Gn.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new $n),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Id.prototype=Object.create(Sr.prototype),Id.prototype.constructor=Id,Id.prototype.isImmediateRenderObject=!0;var Nd=new $n;function Fd(e,t){Sr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new ji,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Di(r,3));var c=new _c({fog:!1,toneMapped:!1});this.cone=new Pc(n,c),this.add(this.cone),this.update()}Fd.prototype=Object.create(Sr.prototype),Fd.prototype.constructor=Fd,Fd.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Fd.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Nd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Bd=new $n,Hd=new sr,Ud=new sr;function zd(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,e(t.children[r]));return n}(e),n=new ji,r=[],i=[],a=new gi(0,0,1),o=new gi(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new Di(r,3)),n.setAttribute("color",new Di(i,3));var l=new _c({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Pc.call(this,n,l),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Gd(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Vl(t,4,2),i=new Mi({wireframe:!0,fog:!1,toneMapped:!1});ca.call(this,r,i),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}zd.prototype=Object.create(Pc.prototype),zd.prototype.constructor=zd,zd.prototype.isSkeletonHelper=!0,zd.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");Ud.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Hd.multiplyMatrices(Ud,o.matrixWorld),Bd.setFromMatrixPosition(Hd),r.setXYZ(a,Bd.x,Bd.y,Bd.z),Hd.multiplyMatrices(Ud,o.parent.matrixWorld),Bd.setFromMatrixPosition(Hd),r.setXYZ(a+1,Bd.x,Bd.y,Bd.z),a+=2)}n.getAttribute("position").needsUpdate=!0,Sr.prototype.updateMatrixWorld.call(this,e)},Gd.prototype=Object.create(ca.prototype),Gd.prototype.constructor=Gd,Gd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Gd.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var kd=new $n,Vd=new gi,jd=new gi;function Wd(e,t,n){Sr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new Kc(t);r.rotateY(.5*Math.PI),this.material=new Mi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.setAttribute("color",new Si(a,3)),this.add(new ca(r,this.material)),this.update()}function qd(e,t,n,r){e=e||10,t=t||10,n=new gi(void 0!==n?n:4473924),r=new gi(void 0!==r?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=l===i?n:r;d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3,d.toArray(c,u),u+=3}var p=new ji;p.setAttribute("position",new Di(s,3)),p.setAttribute("color",new Di(c,3));var f=new _c({vertexColors:!0,toneMapped:!1});Pc.call(this,p,f),this.type="GridHelper"}function Xd(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new gi(void 0!==i?i:4473924),a=new gi(void 0!==a?a:8947848);var o,s,c,l,u,h,d,p=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,p.push(0,0,0),p.push(o,0,s),d=1&l?i:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?i:a,h=e-e/n*l,u=0;u<r;u++)c=u/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b),c=(u+1)/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,p.push(o,0,s),f.push(d.r,d.g,d.b);var m=new ji;m.setAttribute("position",new Di(p,3)),m.setAttribute("color",new Di(f,3));var g=new _c({vertexColors:!0,toneMapped:!1});Pc.call(this,m,g),this.type="PolarGridHelper"}Wd.prototype=Object.create(Sr.prototype),Wd.prototype.constructor=Wd,Wd.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Wd.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");Vd.copy(this.light.color),jd.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Vd:jd;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(kd.setFromMatrixPosition(this.light.matrixWorld).negate())},qd.prototype=Object.assign(Object.create(Pc.prototype),{constructor:qd,copy:function(e){return Pc.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Xd.prototype=Object.create(Pc.prototype),Xd.prototype.constructor=Xd;var Yd=new $n,Zd=new $n,Jd=new $n;function Kd(e,t,n){Sr.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var r=new ji;r.setAttribute("position",new Di([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new _c({fog:!1,toneMapped:!1});this.lightPlane=new Ac(r,i),this.add(this.lightPlane),(r=new ji).setAttribute("position",new Di([0,0,0,0,0,1],3)),this.targetLine=new Ac(r,i),this.add(this.targetLine),this.update()}Kd.prototype=Object.create(Sr.prototype),Kd.prototype.constructor=Kd,Kd.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Kd.prototype.update=function(){Yd.setFromMatrixPosition(this.light.matrixWorld),Zd.setFromMatrixPosition(this.light.target.matrixWorld),Jd.subVectors(Zd,Yd),this.lightPlane.lookAt(Zd),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Zd),this.targetLine.scale.z=Jd.length()};var Qd=new $n,$d=new wa;function ep(e){var t=new ji,n=new _c({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new gi(16755200),s=new gi(16711680),c=new gi(43775),l=new gi(16777215),u=new gi(3355443);function h(e,t,n){d(e,n),d(t,n)}function d(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.setAttribute("position",new Di(r,3)),t.setAttribute("color",new Di(i,3)),Pc.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function tp(e,t,n,r,i,a,o){Qd.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],Qd.x,Qd.y,Qd.z)}ep.prototype=Object.create(Pc.prototype),ep.prototype.constructor=ep,ep.prototype.update=function(){var e=this.geometry,t=this.pointMap;$d.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),tp("c",t,e,$d,0,0,-1),tp("t",t,e,$d,0,0,1),tp("n1",t,e,$d,-1,-1,-1),tp("n2",t,e,$d,1,-1,-1),tp("n3",t,e,$d,-1,1,-1),tp("n4",t,e,$d,1,1,-1),tp("f1",t,e,$d,-1,-1,1),tp("f2",t,e,$d,1,-1,1),tp("f3",t,e,$d,-1,1,1),tp("f4",t,e,$d,1,1,1),tp("u1",t,e,$d,.7,1.1,-1),tp("u2",t,e,$d,-.7,1.1,-1),tp("u3",t,e,$d,0,2,-1),tp("cf1",t,e,$d,-1,0,1),tp("cf2",t,e,$d,1,0,1),tp("cf3",t,e,$d,0,-1,1),tp("cf4",t,e,$d,0,1,1),tp("cn1",t,e,$d,-1,0,-1),tp("cn2",t,e,$d,1,0,-1),tp("cn3",t,e,$d,0,-1,-1),tp("cn4",t,e,$d,0,1,-1),e.getAttribute("position").needsUpdate=!0};var np=new zr;function rp(e,t){this.object=e,void 0===t&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new ji;i.setIndex(new Si(n,1)),i.setAttribute("position",new Si(r,3)),Pc.call(this,i,new _c({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function ip(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new ji;r.setIndex(new Si(n,1)),r.setAttribute("position",new Di([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),Pc.call(this,r,new _c({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function ap(e,t,n){this.plane=e,this.size=void 0===t?1:t;var r=void 0!==n?n:16776960,i=new ji;i.setAttribute("position",new Di([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),Ac.call(this,i,new _c({color:r,toneMapped:!1})),this.type="PlaneHelper";var a=new ji;a.setAttribute("position",new Di([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new ca(a,new Mi({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}rp.prototype=Object.create(Pc.prototype),rp.prototype.constructor=rp,rp.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&np.setFromObject(this.object),!np.isEmpty()){var t=np.min,n=np.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}},rp.prototype.setFromObject=function(e){return this.object=e,this.update(),this},rp.prototype.copy=function(e){return Pc.prototype.copy.call(this,e),this.object=e.object,this},rp.prototype.clone=function(){return(new this.constructor).copy(this)},ip.prototype=Object.create(Pc.prototype),ip.prototype.constructor=ip,ip.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Sr.prototype.updateMatrixWorld.call(this,e))},ap.prototype=Object.create(Ac.prototype),ap.prototype.constructor=ap,ap.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?v:g,this.lookAt(this.plane.normal),Sr.prototype.updateMatrixWorld.call(this,e)};var op,sp,cp=new $n;function lp(e,t,n,r,i,a){Sr.call(this),this.type="ArrowHelper",void 0===e&&(e=new $n(0,0,1)),void 0===t&&(t=new $n(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===op&&((op=new ji).setAttribute("position",new Di([0,0,0,0,1,0],3)),(sp=new $l(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Ac(op,new _c({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ca(sp,new Mi({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function up(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new ji;n.setAttribute("position",new Di(t,3)),n.setAttribute("color",new Di([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new _c({vertexColors:!0,toneMapped:!1});Pc.call(this,n,r),this.type="AxesHelper"}lp.prototype=Object.create(Sr.prototype),lp.prototype.constructor=lp,lp.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cp.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cp,t)}},lp.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},lp.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},lp.prototype.copy=function(e){return Sr.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},lp.prototype.clone=function(){return(new this.constructor).copy(this)},up.prototype=Object.create(Pc.prototype),up.prototype.constructor=up;var hp=Math.pow(2,8),dp=[.125,.215,.35,.446,.526,.582],pp=5+dp.length,fp={[$t]:0,[en]:1,[nn]:2,[an]:3,[on]:4,[sn]:5,[tn]:6},mp=new xh,{_lodPlanes:gp,_sizeLods:vp,_sigmas:yp}=function(){for(var e=[],t=[],n=[],r=8,i=0;i<pp;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>4?o=dp[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,g=f>2?0:-1,v=[m,g,0,m+2/3,g,0,m+2/3,g+1,0,m,g,0,m+2/3,g+1,0,m,g+1,0];h.set(v,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new ji;x.setAttribute("position",new Si(h,3)),x.setAttribute("uv",new Si(d,2)),x.setAttribute("faceIndex",new Si(p,1)),e.push(x),r>4&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),xp=null,bp=(1+Math.sqrt(5))/2,_p=1/bp,wp=[new $n(1,1,1),new $n(-1,1,1),new $n(1,1,-1),new $n(-1,1,-1),new $n(0,bp,_p),new $n(0,bp,-_p),new $n(_p,0,bp),new $n(-_p,0,bp),new $n(bp,_p,0),new $n(-bp,_p,0)];function Mp(e){var t,n,r,i;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(t=20,n=new Float32Array(t),r=new $n(0,1,0),(i=new ou({defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:fp[$t]},outputEncoding:{value:fp[$t]}},vertexShader:Rp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${Pp()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",i),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Tp(e){return void 0!==e&&e.type===Ae&&(e.encoding===$t||e.encoding===en||e.encoding===tn)}function Sp(e){var t=new Yn(3*hp,3*hp,e);return t.texture.mapping=de,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Ep(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Ap(){var e=new ou({uniforms:{envMap:{value:null},texelSize:{value:new kn(1,1)},inputEncoding:{value:fp[$t]},outputEncoding:{value:fp[$t]}},vertexShader:Rp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${Pp()}\n\n#include <common>\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv = equirectUv( outputDirection );\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function Lp(){var e=new ou({uniforms:{envMap:{value:null},inputEncoding:{value:fp[$t]},outputEncoding:{value:fp[$t]}},vertexShader:Rp(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${Pp()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Rp(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\t} else if (face == 2.0) {\n\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\t} else if (face == 5.0) {\n\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\t}\n\treturn direction;\n}\n\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function Pp(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function Cp(e,t,n,r,i,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new bi(e,t,n,i,a,o)}Mp.prototype={constructor:Mp,fromScene:function(e,t=0,n=.1,r=100){xp=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=ve,e.minFilter=ve,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){xp=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=Lp(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=Ap(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<gp.length;e++)gp[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(xp),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:ve,minFilter:ve,generateMipmaps:!1,type:Ae,format:je,encoding:Tp(e)?e.encoding:nn,depthBuffer:!1,stencilBuffer:!1},n=Sp(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Sp(t),n},_compileMaterial:function(e){var t=new ca(gp[0],e);this._renderer.compile(t,mp)},_sceneToCubeUV:function(e,t,n,r){var i=new Ma(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,l=s.toneMapping,u=s.toneMappingExposure,h=s.getClearColor(),d=s.getClearAlpha();s.toneMapping=te,s.toneMappingExposure=1,s.outputEncoding=$t;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var f=Math.max(p.r,p.g,p.b),m=Math.min(Math.max(Math.ceil(Math.log2(f)),-128),127);p=p.multiplyScalar(Math.pow(2,-m));var g=(m+128)/255;s.setClearColor(p,g),e.background=null}for(var v=0;v<6;v++){var y=v%3;0==y?(i.up.set(0,a[v],0),i.lookAt(o[v],0,0)):1==y?(i.up.set(0,0,a[v]),i.lookAt(0,o[v],0)):(i.up.set(0,a[v],0),i.lookAt(0,0,o[v])),Ep(r,y*hp,v>2?hp:0,hp,hp),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=l,s.toneMappingExposure=u,s.outputEncoding=c,s.setClearColor(h,d)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Lp()):null==this._equirectShader&&(this._equirectShader=Ap());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new ca(gp[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=fp[e.encoding],a.outputEncoding.value=fp[t.texture.encoding],Ep(t,0,0,3*hp,2*hp),n.setRenderTarget(t),n.render(i,mp)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<pp;r++){var i=Math.sqrt(yp[r]*yp[r]-yp[r-1]*yp[r-1]),a=wp[(r-1)%wp.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new ca(gp[r],c),u=c.uniforms,h=vp[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);for(var m=[],g=0,v=0;v<20;++v){var y=v/p,x=Math.exp(-y*y/2);m.push(x),0==v?g+=x:v<f&&(g+=2*x)}for(v=0;v<m.length;v++)m[v]=m[v]/g;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=fp[e.texture.encoding],u.outputEncoding.value=fp[e.texture.encoding];var b=vp[r];Ep(t,y=3*Math.max(0,hp-2*b),(0===r?0:2*hp)+2*b*(r>4?r-8+4:0),3*b,2*b),s.setRenderTarget(t),s.render(l,mp)}};var Op=0,Dp=1,Ip=0,Np=1,Fp=2;function Bp(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function Hp(e){return void 0===e&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function Up(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Bc(e,t)}function zp(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new tc(e)}function Gp(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Bc(e,t)}function kp(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function Vp(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function jp(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function Wp(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new $n(e,t,n)}function qp(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Si(e,t).setUsage(Rn)}function Xp(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ei(e,t)}function Yp(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ai(e,t)}function Zp(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Li(e,t)}function Jp(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ri(e,t)}function Kp(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Pi(e,t)}function Qp(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ci(e,t)}function $p(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Oi(e,t)}function ef(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Di(e,t)}function tf(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Ii(e,t)}function nf(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ku.call(this,e),this.type="catmullrom",this.closed=!0}function rf(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ku.call(this,e),this.type="catmullrom"}function af(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Ku.call(this,e),this.type="catmullrom"}function of(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new up(e)}function sf(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new rp(e,t)}function cf(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Pc(new Kl(e.geometry),new _c({color:void 0!==t?t:16777215}))}function lf(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Pc(new Vc(e.geometry),new _c({color:void 0!==t?t:16777215}))}function uf(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Fu(e)}function hf(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Uu(e)}function df(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Sa(e,n)}Vu.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Vu.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(lh.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new ma,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new $n(i.x,i.y,i.z||0))}return t}}),Object.assign(uh.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),nf.prototype=Object.create(Ku.prototype),rf.prototype=Object.create(Ku.prototype),af.prototype=Object.create(Ku.prototype),Object.assign(af.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),qd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},zd.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Iu.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Ah.extractUrlBase(e)}}),Iu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(Oh.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Pd.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(zr.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Vr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Ra.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Dd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Gn,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Gn.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Gn.ceilPowerOfTwo(e)}}),Object.assign(Vn.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(sr.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new $n).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)}}),ti.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Jn.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Kr.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(di.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(di,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),di.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),di.getNormal(e,t,n,r)}}),Object.assign(hh.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Fl(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Yl(this,e)}}),Object.assign(kn.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign($n.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Xn.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ma.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(Sr.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Sr.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(ca.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(ca.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Jt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(uc.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(fc.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),hc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Vu.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Ma.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(dh.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Si.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Rn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Rn)}}}),Object.assign(Si.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Rn:Ln),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(ji.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Si(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ji.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Lh.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(Td.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(Hs.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Rn},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(Hs.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Rn:Ln),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Bl.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(wd.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(wi.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new gi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===x}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(lu.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(_a.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Ns.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Ns.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?en:$t}}}),Object.defineProperties(Es.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Yn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(td.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Vh).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),sd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ta.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var pf={merge:function(e,t,n){var r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};function ff(){console.error("THREE.CanvasRenderer has been removed")}function mf(){console.error("THREE.JSONLoader has been removed.")}jn.crossOrigin=void 0,jn.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new ku;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},jn.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Gu;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},jn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},jn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var gf={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function vf(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:r}}))},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r,i=function(e,t){var n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)},a=function(e){return e*(Math.PI/180)},o=function(e,t,n){for(var r,i=t.split(/[ ,]+/g),a=0;a<i.length;a+=1)r=i[a],e.addEventListener?e.addEventListener(r,n,!1):e.attachEvent&&e.attachEvent(r,n)},s=function(e,t,n){for(var r,i=t.split(/[ ,]+/g),a=0;a<i.length;a+=1)r=i[a],e.removeEventListener?e.removeEventListener(r,n):e.detachEvent&&e.detachEvent(r,n)},c=function(e){return e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e},l=function(){return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},u=function(e,t){t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},h=function(e,t,n){var r=d(e);for(var i in r)if(r.hasOwnProperty(i))if("string"==typeof t)r[i]=t+" "+n;else{for(var a="",o=0,s=t.length;o<s;o+=1)a+=t[o]+" "+n+", ";r[i]=a.slice(0,-2)}return r},d=function(e){var t={};return t[e]="",["webkit","Moz","o"].forEach((function(n){t[n+e.charAt(0).toUpperCase()+e.slice(1)]=""})),t},p=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},f=function(e,t){if(e.length)for(var n=0,r=e.length;n<r;n+=1)t(e[n]);else t(e)},m=!!("ontouchstart"in window),g=!!window.PointerEvent,v=!!window.MSPointerEvent,y={start:"mousedown",move:"mousemove",end:"mouseup"},x={};function b(){}g?r={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:v?r={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:m?(r={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},x=y):r=y,b.prototype.on=function(e,t){var n,r=e.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var i=0;i<r.length;i+=1)n=r[i],this._handlers_[n]=this._handlers_[n]||[],this._handlers_[n].push(t);return this},b.prototype.off=function(e,t){return this._handlers_=this._handlers_||{},void 0===e?this._handlers_={}:void 0===t?this._handlers_[e]=null:this._handlers_[e]&&this._handlers_[e].indexOf(t)>=0&&this._handlers_[e].splice(this._handlers_[e].indexOf(t),1),this},b.prototype.trigger=function(e,t){var n,r=this,i=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var a=0;a<i.length;a+=1)n=i[a],r._handlers_[n]&&r._handlers_[n].length&&r._handlers_[n].forEach((function(e){e.call(r,{type:n,target:r},t)}))},b.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=function(e,t){var n={};for(var r in e)e.hasOwnProperty(r)&&t.hasOwnProperty(r)?n[r]=t[r]:e.hasOwnProperty(r)&&(n[r]=e[r]);return n}(this.options,e))},b.prototype.bindEvt=function(e,t){var n=this;return n._domHandlers_=n._domHandlers_||{},n._domHandlers_[t]=function(){"function"==typeof n["on"+t]?n["on"+t].apply(n,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},o(e,r[t],n._domHandlers_[t]),x[t]&&o(e,x[t],n._domHandlers_[t]),n},b.prototype.unbindEvt=function(e,t){return this._domHandlers_=this._domHandlers_||{},s(e,r[t],this._domHandlers_[t]),x[t]&&s(e,x[t],this._domHandlers_[t]),delete this._domHandlers_[t],this};var _=b;function w(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=w.id,w.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}w.prototype=new _,w.constructor=w,w.id=0,w.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},w.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=function(e,t){var n=d("borderRadius");for(var r in n)n.hasOwnProperty(r)&&(n[r]="50%");return n}(),n=h("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:this.options.color,opacity:".5"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:this.options.color,opacity:".5"},p(r.el,n),p(r.back,t),p(r.front,t),this.applyStyles(r),this},w.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var n in e[t])this.ui[t].style[n]=e[t][n];return this},w.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},w.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},w.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},w.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout((function(){t.ui.el.style.opacity=1}),0),t.showTimeout=setTimeout((function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)}),t.options.fadeTime)),t},w.prototype.hide=function(e){var t=this;return t.options.dataOnly||(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout((function(){var n="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=n,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)}),t.options.fadeTime),t.options.restJoystick&&t.setPosition(e,{x:0,y:0})),t},w.prototype.setPosition=function(e,t){var n=this;n.frontPosition={x:t.x,y:t.y};var r=n.options.fadeTime+"ms",i={};i.front=h("transition",["top","left"],r);var a={front:{}};a.front={left:n.frontPosition.x+"px",top:n.frontPosition.y+"px"},n.applyStyles(i),n.applyStyles(a),n.restTimeout=setTimeout((function(){"function"==typeof e&&e.call(n),n.restCallback()}),n.options.fadeTime)},w.prototype.restCallback=function(){var e={};e.front=h("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},w.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},w.prototype.computeDirection=function(e){var t,n,r,i=e.angle.radian,a=Math.PI/4,o=Math.PI/2;if(i>a&&i<3*a&&!e.lockX?t="up":i>-a&&i<=a&&!e.lockY?t="left":i>3*-a&&i<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=i>-o&&i<o?"left":"right"),e.lockX||(r=i>0?"up":"down"),e.force>this.options.threshold){var s,c={};for(s in this.direction)this.direction.hasOwnProperty(s)&&(c[s]=this.direction[s]);var l={};for(s in this.direction={x:n,y:r,angle:t},e.direction=this.direction,c)c[s]===this.direction[s]&&(l[s]=!0);if(l.x&&l.y&&l.angle)return e;l.x&&l.y||this.trigger("plain",e),l.x||this.trigger("plain:"+n,e),l.y||this.trigger("plain:"+r,e),l.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var M=w;function T(e,t){return this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=T.id,T.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:.5,lockX:!1,lockY:!1,dynamicPage:!1},this.config(t),"static"!==this.options.mode&&"semi"!==this.options.mode||(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}T.prototype=new _,T.constructor=T,T.id=0,T.prototype.prepareNipples=function(){var e=this.nipples;e.on=this.on.bind(this),e.off=this.off.bind(this),e.options=this.options,e.destroy=this.destroy.bind(this),e.ids=this.ids,e.id=this.id,e.processOnMove=this.processOnMove.bind(this),e.processOnEnd=this.processOnEnd.bind(this),e.get=function(t){if(void 0===t)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===t)return e[n];return!1}},T.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},T.prototype.begin=function(){var e=this.options;if("static"===e.mode){var t=this.createNipple(e.position,this.manager.getIdentifier());t.add(),this.idles.push(t)}},T.prototype.createNipple=function(e,t){var n=l(),r={},i=this.options;if(e.x&&e.y)r={x:e.x-(n.x+this.box.left),y:e.y-(n.y+this.box.top)};else if(e.top||e.right||e.bottom||e.left){var a=document.createElement("DIV");a.style.display="hidden",a.style.top=e.top,a.style.right=e.right,a.style.bottom=e.bottom,a.style.left=e.left,a.style.position="absolute",i.zone.appendChild(a);var o=a.getBoundingClientRect();i.zone.removeChild(a),r=e,e={x:o.left+n.x,y:o.top+n.y}}var s=new M(this,{color:i.color,size:i.size,threshold:i.threshold,fadeTime:i.fadeTime,dataOnly:i.dataOnly,restJoystick:i.restJoystick,restOpacity:i.restOpacity,mode:i.mode,identifier:t,position:e,zone:i.zone,frontPosition:{x:0,y:0}});return i.dataOnly||(u(s.ui.el,r),u(s.ui.front,s.frontPosition)),this.nipples.push(s),this.trigger("added "+s.identifier+":added",s),this.manager.trigger("added "+s.identifier+":added",s),this.bindNipple(s),s},T.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},T.prototype.bindNipple=function(e){var t,n=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,n.trigger(t,r)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},T.prototype.pressureFn=function(e,t,n){var r=this,i=0;clearInterval(r.pressureIntervals[n]),r.pressureIntervals[n]=setInterval(function(){var n=e.force||e.pressure||e.webkitForce||0;n!==i&&(t.trigger("pressure",n),r.trigger("pressure "+t.identifier+":pressure",n),i=n)}.bind(r),100)},T.prototype.onstart=function(e){var t=this,n=t.options,r=e;return e=c(e),t.updateBox(),f(e,(function(i){t.actives.length<n.maxNumberOfNipples?t.processOnStart(i):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach((function(n){if(Object.values(r.touches).findIndex((function(e){return e.identifier===n}))<0){var i=[e[0]];i.identifier=n,t.processOnEnd(i)}})),t.actives.length<n.maxNumberOfNipples&&t.processOnStart(i))})),t.manager.bindDocument(),!1},T.prototype.processOnStart=function(e){var t,n=this,r=n.options,a=n.manager.getIdentifier(e),o=e.force||e.pressure||e.webkitForce||0,s={x:e.pageX,y:e.pageY},c=n.getOrCreate(a,s);c.identifier!==a&&n.manager.removeIdentifier(c.identifier),c.identifier=a;var l=function(t){t.trigger("start",t),n.trigger("start "+t.id+":start",t),t.show(),o>0&&n.pressureFn(e,t,t.identifier),n.processOnMove(e)};if((t=n.idles.indexOf(c))>=0&&n.idles.splice(t,1),n.actives.push(c),n.ids.push(c.identifier),"semi"!==r.mode)l(c);else{if(!(i(s,c.position)<=r.catchDistance))return c.destroy(),void n.processOnStart(e);l(c)}return c},T.prototype.getOrCreate=function(e,t){var n,r=this.options;return/(semi|static)/.test(r.mode)?(n=this.idles[0])?(this.idles.splice(0,1),n):"semi"===r.mode?this.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1):n=this.createNipple(t,e)},T.prototype.processOnMove=function(e){var t=this.options,n=this.manager.getIdentifier(e),r=this.nipples.get(n);if(function(e){return isNaN(e.buttons)?0!==e.pressure:0!==e.buttons}(e)){if(!r)return console.error("Found zombie joystick with ID "+n),void this.manager.removeIdentifier(n);if(t.dynamicPage){var o=l();c=r.el.getBoundingClientRect(),r.position={x:o.x+c.left,y:o.y+c.top}}r.identifier=n;var s=r.options.size/2,c={x:e.pageX,y:e.pageY};t.lockX&&(c.y=r.position.y),t.lockY&&(c.x=r.position.x);var h,d,p,f,m,g,v,y,x=i(c,r.position),b=(h=c,p=(d=r.position).x-h.x,f=d.y-h.y,function(e){return e*(180/Math.PI)}(Math.atan2(f,p))),_=a(b),w=x/s,M={distance:x,position:c};x>s&&(x=s,m=r.position,g=x,y={x:0,y:0},v=a(v=b),y.x=m.x-g*Math.cos(v),y.y=m.y-g*Math.sin(v),c=y);var T=c.x-r.position.x,S=c.y-r.position.y;r.frontPosition={x:T,y:S},t.dataOnly||u(r.ui.front,r.frontPosition);var E={identifier:r.identifier,position:c,force:w,pressure:e.force||e.pressure||e.webkitForce||0,distance:x,angle:{radian:_,degree:b},vector:{x:T/s,y:-S/s},raw:M,instance:r,lockX:t.lockX,lockY:t.lockY};(E=r.computeDirection(E)).angle={radian:a(180-b),degree:180-b},r.trigger("move",E),this.trigger("move "+r.id+":move",E)}else this.processOnEnd(e)},T.prototype.processOnEnd=function(e){var t=this,n=t.options,r=t.manager.getIdentifier(e),i=t.nipples.get(r),a=t.manager.removeIdentifier(i.identifier);i&&(n.dataOnly||i.hide((function(){"dynamic"===n.mode&&(i.trigger("removed",i),t.trigger("removed "+i.id+":removed",i),t.manager.trigger("removed "+i.id+":removed",i),i.destroy())})),clearInterval(t.pressureIntervals[i.identifier]),i.resetDirection(),i.trigger("end",i),t.trigger("end "+i.id+":end",i),t.ids.indexOf(i.identifier)>=0&&t.ids.splice(t.ids.indexOf(i.identifier),1),t.actives.indexOf(i)>=0&&t.actives.splice(t.actives.indexOf(i),1),/(semi|static)/.test(n.mode)?t.idles.push(i):t.nipples.indexOf(i)>=0&&t.nipples.splice(t.nipples.indexOf(i),1),t.manager.unbindDocument(),/(semi|static)/.test(n.mode)&&(t.manager.ids[a.id]=a.identifier))},T.prototype.onDestroyed=function(e,t){this.nipples.indexOf(t)>=0&&this.nipples.splice(this.nipples.indexOf(t),1),this.actives.indexOf(t)>=0&&this.actives.splice(this.actives.indexOf(t),1),this.idles.indexOf(t)>=0&&this.idles.splice(this.idles.indexOf(t),1),this.ids.indexOf(t.identifier)>=0&&this.ids.splice(this.ids.indexOf(t.identifier),1),this.manager.removeIdentifier(t.identifier),this.manager.unbindDocument()},T.prototype.destroy=function(){for(var e in this.unbindEvt(this.options.zone,"start"),this.nipples.forEach((function(e){e.destroy()})),this.pressureIntervals)this.pressureIntervals.hasOwnProperty(e)&&clearInterval(this.pressureIntervals[e]);this.trigger("destroyed",this.nipples),this.manager.unbindDocument(),this.off()};var S=T;function E(e){var t,n=this;return n.ids={},n.index=0,n.collections=[],n.config(e),n.prepareCollections(),o(window,"resize",(function(e){clearTimeout(t),t=setTimeout((function(){var e,t=l();n.collections.forEach((function(n){n.forEach((function(n){e=n.el.getBoundingClientRect(),n.position={x:t.x+e.left,y:t.y+e.top}}))}))}),100)})),n.collections}E.prototype=new _,E.constructor=E,E.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var n;return e.collections.every((function(e){return!(n=e.get(t))})),n}},E.prototype.create=function(e){return this.createCollection(e)},E.prototype.createCollection=function(e){var t=new S(this,e);return this.bindCollection(t),this.collections.push(t),t},E.prototype.bindCollection=function(e){var t,n=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,n.trigger(t,r)};e.on("destroyed",n.onDestroyed.bind(n)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},E.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},E.prototype.unbindDocument=function(e){Object.keys(this.ids).length&&!0!==e||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},E.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},E.prototype.removeIdentifier=function(e){var t={};for(var n in this.ids)if(this.ids[n]===e){t.id=n,t.identifier=this.ids[n],delete this.ids[n];break}return t},E.prototype.onmove=function(e){return this.onAny("move",e),!1},E.prototype.onend=function(e){return this.onAny("end",e),!1},E.prototype.oncancel=function(e){return this.onAny("end",e),!1},E.prototype.onAny=function(e,t){var n,r=this,i="processOn"+e.charAt(0).toUpperCase()+e.slice(1);return t=c(t),f(t,(function(e){n=r.getIdentifier(e),f(r.collections,function(e,t,n){n.ids.indexOf(t)>=0&&(n[i](e),e._found_=!0)}.bind(null,e,n)),e._found_||r.removeIdentifier(n)})),!1},E.prototype.destroy=function(){this.unbindDocument(!0),this.ids={},this.index=0,this.collections.forEach((function(e){e.destroy()})),this.off()},E.prototype.onDestroyed=function(e,t){if(this.collections.indexOf(t)<0)return!1;this.collections.splice(this.collections.indexOf(t),1)};var A=new E;t.default={create:function(e){return A.create(e)},factory:A}}]).default},function(e,t,n){"use strict";n.r(t);var r=n(0),i=function(){function e(e){r.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(r.Loader.prototype),{constructor:e,load:function(e,t,n,i){var a,o=this;a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),o.manager.itemStart(e);var s=function(t){i?i(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)},c=new r.FileLoader(o.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),"use-credentials"===o.crossOrigin&&c.setWithCredentials(!0),c.load(e,(function(n){try{o.parse(n,a,(function(n){t(n),o.manager.itemEnd(e)}),s)}catch(e){s(e)}}),n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,l,u){var f,v={};if("string"==typeof e)f=e;else if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===c){try{v[n.KHR_BINARY_GLTF]=new h(e)}catch(e){return void(u&&u(e))}f=v[n.KHR_BINARY_GLTF].content}else f=r.LoaderUtils.decodeText(new Uint8Array(e));var y=JSON.parse(f);if(void 0===y.asset||y.asset.version[0]<2)u&&u(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(y.extensionsUsed)for(var x=0;x<y.extensionsUsed.length;++x){var b=y.extensionsUsed[x],_=y.extensionsRequired||[];switch(b){case n.KHR_LIGHTS_PUNCTUAL:v[b]=new a(y);break;case n.KHR_MATERIALS_CLEARCOAT:v[b]=new s;break;case n.KHR_MATERIALS_UNLIT:v[b]=new o;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[b]=new m;break;case n.KHR_DRACO_MESH_COMPRESSION:v[b]=new d(y,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:v[b]=new i(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:v[b]=new p;break;case n.KHR_MESH_QUANTIZATION:v[b]=new g;break;default:_.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var w=new G(y,v,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(l,u)}}});var n={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function a(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function o(){this.name=n.KHR_MATERIALS_UNLIT}function s(){this.name=n.KHR_MATERIALS_CLEARCOAT}a.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new r.Color(16777215);void 0!==n.color&&i.fromArray(n.color);var a=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new r.DirectionalLight(i)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new r.PointLight(i)).distance=a;break;case"spot":(t=new r.SpotLight(i)).distance=a,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},o.prototype.getMaterialType=function(){return r.MeshBasicMaterial},o.prototype.extendParams=function(e,t,n){var i=[];e.color=new r.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var o=a.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}void 0!==a.baseColorTexture&&i.push(n.assignTexture(e,"map",a.baseColorTexture))}return Promise.all(i)},s.prototype.getMaterialType=function(){return r.MeshPhysicalMaterial},s.prototype.extendParams=function(e,t,n){var i=[],a=t.extensions[this.name];if(void 0!==a.clearcoatFactor&&(e.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(e.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var o=a.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new r.Vector2(o,o)}return Promise.all(i)};var c="glTF",l=1313821514,u=5130562;function h(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==c)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=new DataView(e,12),a=0;a<i.byteLength;){var o=i.getUint32(a,!0);a+=4;var s=i.getUint32(a,!0);if(a+=4,s===l){var h=new Uint8Array(e,12+a,o);this.content=r.LoaderUtils.decodeText(h)}else if(s===u){var d=12+a;this.body=e.slice(d,d+o)}a+=o}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function p(){this.name=n.KHR_TEXTURE_TRANSFORM}function f(e){r.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),a=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),s={specular:{value:(new r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var r in s)e.uniforms[r]=s[r];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",t),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function m(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return f},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new r.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(i.diffuseFactor)){var o=i.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==i.diffuseTexture&&a.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var s=i.specularGlossinessTexture;a.push(n.assignTexture(e,"glossinessMap",s)),a.push(n.assignTexture(e,"specularMap",s))}return Promise.all(a)},createMaterial:function(e){var t=new f(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=r.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function g(){this.name=n.KHR_MESH_QUANTIZATION}function v(e,t,n,i){r.Interpolant.call(this,e,t,n,i)}d.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(var l in a){var u=R[l]||l.toLowerCase();o[u]=a[l]}for(l in e.attributes){u=R[l]||l.toLowerCase();if(void 0!==a[l]){var h=n.accessors[e.attributes[l]],d=S[h.componentType];c[u]=d,s[u]=!0===h.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];void 0!==i&&(r.normalized=i)}t(e)}),o,c)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},f.prototype=Object.create(r.MeshStandardMaterial.prototype),f.prototype.constructor=f,f.prototype.copy=function(e){return r.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(r.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,c=3*o,l=r-t,u=(n-t)/l,h=u*u,d=h*u,p=e*c,f=p-c,m=-2*d+3*h,g=d-h,v=1-m,y=g-h+u,x=0;x!==o;x++){var b=a[f+x+o],_=a[f+x+s]*l,w=a[p+x+o],M=a[p+x]*l;i[x]=v*b+y*_+m*w+g*M}return i};var y=0,x=1,b=2,_=3,w=4,M=5,T=6,S={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},E={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},A={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},L={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},R={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},P={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},C={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},O="OPAQUE",D="MASK",I="BLEND",N={"image/png":r.RGBAFormat,"image/jpeg":r.RGBFormat};function F(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function B(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function H(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function U(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function z(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function G(e,n,i){this.json=e||{},this.extensions=n||{},this.options=i||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.textureLoader=new r.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function k(e,t,n){var i=t.attributes,a=[];function o(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var s in i){var c=R[s]||s.toLowerCase();c in e.attributes||a.push(o(i[s],c))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));a.push(l)}return H(e,t),function(e,t,n){var i=t.attributes,a=new r.Box3;if(void 0!==i.POSITION){var o=(f=n.json.accessors[i.POSITION]).min,s=f.max;if(void 0!==o&&void 0!==s){a.set(new r.Vector3(o[0],o[1],o[2]),new r.Vector3(s[0],s[1],s[2]));var c=t.targets;if(void 0!==c){for(var l=new r.Vector3,u=new r.Vector3,h=0,d=c.length;h<d;h++){var p=c[h];if(void 0!==p.POSITION){var f;o=(f=n.json.accessors[p.POSITION]).min,s=f.max;void 0!==o&&void 0!==s?(u.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),u.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),u.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),l.max(u)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(l)}e.boundingBox=a;var m=new r.Sphere;a.getCenter(m.center),m.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(a).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,a=0,o=t.length;a<o;a++){if(void 0!==(l=t[a]).POSITION&&(r=!0),void 0!==l.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(e);var s=[],c=[];for(a=0,o=t.length;a<o;a++){var l=t[a];if(r){var u=void 0!==l.POSITION?n.getDependency("accessor",l.POSITION):e.attributes.position;s.push(u)}if(i){u=void 0!==l.NORMAL?n.getDependency("accessor",l.NORMAL):e.attributes.normal;c.push(u)}}return Promise.all([Promise.all(s),Promise.all(c)]).then((function(t){var n=t[0],a=t[1];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function V(e,t){var n=e.getIndex();if(null===n){var i=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<a.count;o++)i.push(o);e.setIndex(i),n=e.getIndex()}var s=n.count-2,c=[];if(t===r.TriangleFanDrawMode)for(o=1;o<=s;o++)c.push(n.getX(0)),c.push(n.getX(o)),c.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(c.push(n.getX(o)),c.push(n.getX(o+1)),c.push(n.getX(o+2))):(c.push(n.getX(o+2)),c.push(n.getX(o+1)),c.push(n.getX(o)));c.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(c),l}return G.prototype.parse=function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};B(i,a,r),H(a,r),e(a)})).catch(t)},G.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r={},i={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,c=0,l=s.length;c<l;c++)e[s[c]].isBone=!0;for(var u=0,h=e.length;u<h;u++){var d=e[u];void 0!==d.mesh&&(void 0===r[d.mesh]&&(r[d.mesh]=i[d.mesh]=0),r[d.mesh]++,void 0!==d.skin&&(n[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=i},G.prototype.getDependency=function(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this.loadMesh(t);break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this.loadBufferView(t);break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this.loadMaterial(t);break;case"texture":i=this.loadTexture(t);break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;case"light":i=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,i)}return i},G.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t},G.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(F(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},G.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))},G.prototype.loadAccessor=function(e){var t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return Promise.resolve(null);var a=[];return void 0!==i.bufferView?a.push(this.getDependency("bufferView",i.bufferView)):a.push(null),void 0!==i.sparse&&(a.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(a).then((function(e){var a,o,s=e[0],c=L[i.type],l=S[i.componentType],u=l.BYTES_PER_ELEMENT,h=u*c,d=i.byteOffset||0,p=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,f=!0===i.normalized;if(p&&p!==h){var m=Math.floor(d/p),g="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count,v=t.cache.get(g);v||(a=new l(s,m*p,i.count*p/u),v=new r.InterleavedBuffer(a,p/u),t.cache.add(g,v)),o=new r.InterleavedBufferAttribute(v,c,d%p/u,f)}else a=null===s?new l(i.count*c):new l(s,d,i.count*c),o=new r.BufferAttribute(a,c,f);if(void 0!==i.sparse){var y=L.SCALAR,x=S[i.sparse.indices.componentType],b=i.sparse.indices.byteOffset||0,_=i.sparse.values.byteOffset||0,w=new x(e[1],b,i.sparse.count*y),M=new l(e[2],_,i.sparse.count*c);null!==s&&(o=new r.BufferAttribute(o.array.slice(),o.itemSize,o.normalized));for(var T=0,E=w.length;T<E;T++){var A=w[T];if(o.setX(A,M[T*c]),c>=2&&o.setY(A,M[T*c+1]),c>=3&&o.setZ(A,M[T*c+2]),c>=4&&o.setW(A,M[T*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},G.prototype.loadTexture=function(e){var t,i=this,a=this.json,o=this.options,s=this.textureLoader,c=self.URL||self.webkitURL,l=a.textures[e],u=l.extensions||{},h=(t=u[n.MSFT_TEXTURE_DDS]?a.images[u[n.MSFT_TEXTURE_DDS].source]:a.images[l.source]).uri,d=!1;return void 0!==t.bufferView&&(h=i.getDependency("bufferView",t.bufferView).then((function(e){d=!0;var n=new Blob([e],{type:t.mimeType});return h=c.createObjectURL(n)}))),Promise.resolve(h).then((function(e){var t=o.manager.getHandler(e);return t||(t=u[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(n,r){t.load(F(e,o.path),n,void 0,r)}))})).then((function(n){!0===d&&c.revokeObjectURL(h),n.flipY=!1,l.name&&(n.name=l.name),t.mimeType in N&&(n.format=N[t.mimeType]);var o=(a.samplers||{})[l.sampler]||{};return n.magFilter=E[o.magFilter]||r.LinearFilter,n.minFilter=E[o.minFilter]||r.LinearMipmapLinearFilter,n.wrapS=A[o.wrapS]||r.RepeatWrapping,n.wrapT=A[o.wrapT]||r.RepeatWrapping,i.associations.set(n,{type:"textures",index:e}),n}))},G.prototype.assignTexture=function(e,t,i){var a=this;return this.getDependency("texture",i.index).then((function(o){if(!o.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":o.format=r.RGBFormat}if(void 0===i.texCoord||0==i.texCoord||"aoMap"===t&&1==i.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),a.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var c=a.associations.get(o);o=a.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),a.associations.set(o,c)}}e[t]=o}))},G.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=void 0!==t.attributes.tangent,a=void 0!==t.attributes.color,o=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,c=Object.keys(t.morphAttributes).length>0,l=c&&void 0!==t.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+n.uuid,h=this.cache.get(u);h||(h=new r.PointsMaterial,r.Material.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(u,h)),n=h}else if(e.isLine){u="LineBasicMaterial:"+n.uuid;var d=this.cache.get(u);d||(d=new r.LineBasicMaterial,r.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(u,d)),n=d}if(i||a||o||s||c){u="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),s&&(u+="skinning:"),i&&(u+="vertex-tangents:"),a&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");var p=this.cache.get(u);p||(p=n.clone(),s&&(p.skinning=!0),i&&(p.vertexTangents=!0),a&&(p.vertexColors=!0),o&&(p.flatShading=!0),c&&(p.morphTargets=!0),l&&(p.morphNormals=!0),this.cache.add(u,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!i&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!i&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},G.prototype.loadMaterial=function(e){var t,i=this,a=this.json,o=this.extensions,s=a.materials[e],c={},l=s.extensions||{},u=[];if(l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),u.push(h.extendParams(c,s,i))}else if(l[n.KHR_MATERIALS_UNLIT]){var d=o[n.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),u.push(d.extendParams(c,s,i))}else{t=r.MeshStandardMaterial;var p=s.pbrMetallicRoughness||{};if(c.color=new r.Color(1,1,1),c.opacity=1,Array.isArray(p.baseColorFactor)){var m=p.baseColorFactor;c.color.fromArray(m),c.opacity=m[3]}void 0!==p.baseColorTexture&&u.push(i.assignTexture(c,"map",p.baseColorTexture)),c.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,c.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(u.push(i.assignTexture(c,"metalnessMap",p.metallicRoughnessTexture)),u.push(i.assignTexture(c,"roughnessMap",p.metallicRoughnessTexture)))}!0===s.doubleSided&&(c.side=r.DoubleSide);var g=s.alphaMode||O;if(g===I?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,g===D&&(c.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&t!==r.MeshBasicMaterial&&(u.push(i.assignTexture(c,"normalMap",s.normalTexture)),c.normalScale=new r.Vector2(1,1),void 0!==s.normalTexture.scale&&c.normalScale.set(s.normalTexture.scale,s.normalTexture.scale)),void 0!==s.occlusionTexture&&t!==r.MeshBasicMaterial&&(u.push(i.assignTexture(c,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(c.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&t!==r.MeshBasicMaterial&&(c.emissive=(new r.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&t!==r.MeshBasicMaterial&&u.push(i.assignTexture(c,"emissiveMap",s.emissiveTexture)),l[n.KHR_MATERIALS_CLEARCOAT]){var v=o[n.KHR_MATERIALS_CLEARCOAT];t=v.getMaterialType(),u.push(v.extendParams(c,{extensions:l},i))}return Promise.all(u).then((function(){var a;return a=t===f?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new t(c),s.name&&(a.name=s.name),a.map&&(a.map.encoding=r.sRGBEncoding),a.emissiveMap&&(a.emissiveMap.encoding=r.sRGBEncoding),H(a,s),i.associations.set(a,{type:"materials",index:e}),s.extensions&&B(o,a,s),a}))},G.prototype.loadGeometries=function(e){var t=this,i=this.extensions,a=this.primitiveCache;function o(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return k(n,e,t)}))}for(var s,c,l=[],u=0,h=e.length;u<h;u++){var d,p=e[u],f=(c=void 0,(c=(s=p).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+z(c.attributes):s.indices+":"+z(s.attributes)+":"+s.mode),m=a[f];if(m)l.push(m.promise);else d=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(p):k(new r.BufferGeometry,p,t),a[f]={primitive:p,promise:d},l.push(d)}return Promise.all(l)},G.prototype.loadMesh=function(e){for(var t,n=this,i=this.json.meshes[e],a=i.primitives,o=[],s=0,c=a.length;s<c;s++){var l=void 0===a[s].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),t.DefaultMaterial):this.getDependency("material",a[s].material);o.push(l)}return o.push(n.loadGeometries(a)),Promise.all(o).then((function(t){for(var o=t.slice(0,t.length-1),s=t[t.length-1],c=[],l=0,u=s.length;l<u;l++){var h,d=s[l],p=a[l],f=o[l];if(p.mode===w||p.mode===M||p.mode===T||void 0===p.mode)!0!==(h=!0===i.isSkinnedMesh?new r.SkinnedMesh(d,f):new r.Mesh(d,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),p.mode===M?h.geometry=V(h.geometry,r.TriangleStripDrawMode):p.mode===T&&(h.geometry=V(h.geometry,r.TriangleFanDrawMode));else if(p.mode===x)h=new r.LineSegments(d,f);else if(p.mode===_)h=new r.Line(d,f);else if(p.mode===b)h=new r.LineLoop(d,f);else{if(p.mode!==y)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new r.Points(d,f)}Object.keys(h.geometry.morphAttributes).length>0&&U(h,i),h.name=i.name||"mesh_"+e,s.length>1&&(h.name+="_"+l),H(h,i),n.assignFinalMaterial(h),c.push(h)}if(1===c.length)return c[0];var m=new r.Group;for(l=0,u=c.length;l<u;l++)m.add(c[l]);return m}))},G.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new r.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=n.name),H(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},G.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},G.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],i=[],a=[],o=[],s=[],c=0,l=t.channels.length;c<l;c++){var u=t.channels[c],h=t.samplers[u.sampler],d=u.target,p=void 0!==d.node?d.node:d.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input,m=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),i.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",m)),o.push(h),s.push(d)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(s)]).then((function(n){for(var i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=[],u=0,h=i.length;u<h;u++){var d=i[u],p=a[u],f=o[u],m=s[u],g=c[u];if(void 0!==d){var y;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,P[g.path]){case P.weights:y=r.NumberKeyframeTrack;break;case P.rotation:y=r.QuaternionKeyframeTrack;break;case P.position:case P.scale:default:y=r.VectorKeyframeTrack}var x=d.name?d.name:d.uuid,b=void 0!==m.interpolation?C[m.interpolation]:r.InterpolateLinear,_=[];P[g.path]===P.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&_.push(e.name?e.name:e.uuid)})):_.push(x);var w=f.array;if(f.normalized){var M;if(w.constructor===Int8Array)M=1/127;else if(w.constructor===Uint8Array)M=1/255;else if(w.constructor==Int16Array)M=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");M=1/65535}for(var T=new Float32Array(w.length),S=0,E=w.length;S<E;S++)T[S]=w[S]*M;w=T}for(S=0,E=_.length;S<E;S++){var A=new y(_[S]+"."+P[g.path],p.array,w,b);"CUBICSPLINE"===m.interpolation&&(A.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(A)}}}var L=t.name?t.name:"animation_"+e;return new r.AnimationClip(L,void 0,l)}))},G.prototype.loadNode=function(e){var t,i=this.json,a=this.extensions,o=this,s=i.meshReferences,c=i.meshUses,l=i.nodes[e];return(t=[],void 0!==l.mesh&&t.push(o.getDependency("mesh",l.mesh).then((function(e){var t;if(s[l.mesh]>1){var n=c[l.mesh]++;(t=e.clone()).name+="_instance_"+n}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=l.weights.length;t<n;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&t.push(o.getDependency("camera",l.camera)),l.extensions&&l.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&t.push(o.getDependency("light",l.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(t){var n;if((n=!0===l.isBone?new r.Bone:t.length>1?new r.Group:1===t.length?t[0]:new r.Object3D)!==t[0])for(var i=0,s=t.length;i<s;i++)n.add(t[i]);if(l.name&&(n.userData.name=l.name,n.name=r.PropertyBinding.sanitizeNodeName(l.name)),H(n,l),l.extensions&&B(a,n,l),void 0!==l.matrix){var c=new r.Matrix4;c.fromArray(l.matrix),n.applyMatrix4(c)}else void 0!==l.translation&&n.position.fromArray(l.translation),void 0!==l.rotation&&n.quaternion.fromArray(l.rotation),void 0!==l.scale&&n.scale.fromArray(l.scale);return o.associations.set(n,{type:"nodes",index:e}),n}))},G.prototype.loadScene=function(){function e(t,n,i,a){var o=i.nodes[t];return a.getDependency("node",t).then((function(e){return void 0===o.skin?e:a.getDependency("skin",o.skin).then((function(e){for(var n=[],r=0,i=(t=e).joints.length;r<i;r++)n.push(a.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],a=[],o=0,s=n.length;o<s;o++){var c=n[o];if(c){i.push(c);var l=new r.Matrix4;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*o),a.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new r.Skeleton(i,a),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var r=[];if(o.children)for(var s=o.children,c=0,l=s.length;c<l;c++){var u=s[c];r.push(e(u,t,i,a))}return Promise.all(r)}))}return function(t){var n=this.json,i=this.extensions,a=this.json.scenes[t],o=new r.Group;a.name&&(o.name=a.name),H(o,a),a.extensions&&B(i,o,a);for(var s=a.nodes||[],c=[],l=0,u=s.length;l<u;l++)c.push(e(s[l],o,n,this));return Promise.all(c).then((function(){return o}))}}(),e}(),a=function(e,t){var n,i,a,o,s;void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new r.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=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.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},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.getPolarAngle=function(){return m.phi},this.getAzimuthalAngle=function(){return m.theta},this.saveState=function(){c.target0.copy(c.target),c.position0.copy(c.object.position),c.zoom0=c.object.zoom},this.reset=function(){c.target.copy(c.target0),c.object.position.copy(c.position0),c.object.zoom=c.zoom0,c.object.updateProjectionMatrix(),c.dispatchEvent(l),c.update(),p=d.NONE},this.update=(n=new r.Vector3,i=(new r.Quaternion).setFromUnitVectors(e.up,new r.Vector3(0,1,0)),a=i.clone().inverse(),o=new r.Vector3,s=new r.Quaternion,function(){var e=c.object.position;return n.copy(e).sub(c.target),n.applyQuaternion(i),m.setFromVector3(n),c.autoRotate&&p===d.NONE&&P(2*Math.PI/60/60*c.autoRotateSpeed),c.enableDamping?(m.theta+=g.theta*c.dampingFactor,m.phi+=g.phi*c.dampingFactor):(m.theta+=g.theta,m.phi+=g.phi),m.theta=Math.max(c.minAzimuthAngle,Math.min(c.maxAzimuthAngle,m.theta)),m.phi=Math.max(c.minPolarAngle,Math.min(c.maxPolarAngle,m.phi)),m.makeSafe(),m.radius*=v,m.radius=Math.max(c.minDistance,Math.min(c.maxDistance,m.radius)),!0===c.enableDamping?c.target.addScaledVector(y,c.dampingFactor):c.target.add(y),n.setFromSpherical(m),n.applyQuaternion(a),e.copy(c.target).add(n),c.object.lookAt(c.target),!0===c.enableDamping?(g.theta*=1-c.dampingFactor,g.phi*=1-c.dampingFactor,y.multiplyScalar(1-c.dampingFactor)):(g.set(0,0,0),y.set(0,0,0)),v=1,!!(x||o.distanceToSquared(c.object.position)>f||8*(1-s.dot(c.object.quaternion))>f)&&(c.dispatchEvent(l),o.copy(c.object.position),s.copy(c.object.quaternion),x=!1,!0)}),this.dispose=function(){c.domElement.removeEventListener("contextmenu",ee,!1),c.domElement.removeEventListener("mousedown",q,!1),c.domElement.removeEventListener("wheel",Z,!1),c.domElement.removeEventListener("touchstart",K,!1),c.domElement.removeEventListener("touchend",$,!1),c.domElement.removeEventListener("touchmove",Q,!1),document.removeEventListener("mousemove",X,!1),document.removeEventListener("mouseup",Y,!1),c.domElement.removeEventListener("keydown",J,!1)};var c=this,l={type:"change"},u={type:"start"},h={type:"end"},d={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},p=d.NONE,f=1e-6,m=new r.Spherical,g=new r.Spherical,v=1,y=new r.Vector3,x=!1,b=new r.Vector2,_=new r.Vector2,w=new r.Vector2,M=new r.Vector2,T=new r.Vector2,S=new r.Vector2,E=new r.Vector2,A=new r.Vector2,L=new r.Vector2;function R(){return Math.pow(.95,c.zoomSpeed)}function P(e){g.theta-=e}function C(e){g.phi-=e}var O,D=(O=new r.Vector3,function(e,t){O.setFromMatrixColumn(t,0),O.multiplyScalar(-e),y.add(O)}),I=function(){var e=new r.Vector3;return function(t,n){!0===c.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(c.object.up,e)),e.multiplyScalar(t),y.add(e)}}(),N=function(){var e=new r.Vector3;return function(t,n){var r=c.domElement;if(c.object.isPerspectiveCamera){var i=c.object.position;e.copy(i).sub(c.target);var a=e.length();a*=Math.tan(c.object.fov/2*Math.PI/180),D(2*t*a/r.clientHeight,c.object.matrix),I(2*n*a/r.clientHeight,c.object.matrix)}else c.object.isOrthographicCamera?(D(t*(c.object.right-c.object.left)/c.object.zoom/r.clientWidth,c.object.matrix),I(n*(c.object.top-c.object.bottom)/c.object.zoom/r.clientHeight,c.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),c.enablePan=!1)}}();function F(e){c.object.isPerspectiveCamera?v/=e:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom*e)),c.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function B(e){c.object.isPerspectiveCamera?v*=e:c.object.isOrthographicCamera?(c.object.zoom=Math.max(c.minZoom,Math.min(c.maxZoom,c.object.zoom/e)),c.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),c.enableZoom=!1)}function H(e){b.set(e.clientX,e.clientY)}function U(e){M.set(e.clientX,e.clientY)}function z(e){if(1==e.touches.length)b.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);b.set(t,n)}}function G(e){if(1==e.touches.length)M.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);M.set(t,n)}}function k(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);E.set(0,r)}function V(e){if(1==e.touches.length)_.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);_.set(t,n)}w.subVectors(_,b).multiplyScalar(c.rotateSpeed);var r=c.domElement;P(2*Math.PI*w.x/r.clientHeight),C(2*Math.PI*w.y/r.clientHeight),b.copy(_)}function j(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),n=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,n)}S.subVectors(T,M).multiplyScalar(c.panSpeed),N(S.x,S.y),M.copy(T)}function W(e){var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,r=Math.sqrt(t*t+n*n);A.set(0,r),L.set(0,Math.pow(A.y/E.y,c.zoomSpeed)),F(L.y),E.copy(A)}function q(e){if(!1!==c.enabled){var t;switch(e.preventDefault(),c.domElement.focus?c.domElement.focus():window.focus(),e.button){case 0:t=c.mouseButtons.LEFT;break;case 1:t=c.mouseButtons.MIDDLE;break;case 2:t=c.mouseButtons.RIGHT;break;default:t=-1}switch(t){case r.MOUSE.DOLLY:if(!1===c.enableZoom)return;!function(e){E.set(e.clientX,e.clientY)}(e),p=d.DOLLY;break;case r.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===c.enablePan)return;U(e),p=d.PAN}else{if(!1===c.enableRotate)return;H(e),p=d.ROTATE}break;case r.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===c.enableRotate)return;H(e),p=d.ROTATE}else{if(!1===c.enablePan)return;U(e),p=d.PAN}break;default:p=d.NONE}p!==d.NONE&&(document.addEventListener("mousemove",X,!1),document.addEventListener("mouseup",Y,!1),c.dispatchEvent(u))}}function X(e){if(!1!==c.enabled)switch(e.preventDefault(),p){case d.ROTATE:if(!1===c.enableRotate)return;!function(e){_.set(e.clientX,e.clientY),w.subVectors(_,b).multiplyScalar(c.rotateSpeed);var t=c.domElement;P(2*Math.PI*w.x/t.clientHeight),C(2*Math.PI*w.y/t.clientHeight),b.copy(_),c.update()}(e);break;case d.DOLLY:if(!1===c.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),L.subVectors(A,E),L.y>0?F(R()):L.y<0&&B(R()),E.copy(A),c.update()}(e);break;case d.PAN:if(!1===c.enablePan)return;!function(e){T.set(e.clientX,e.clientY),S.subVectors(T,M).multiplyScalar(c.panSpeed),N(S.x,S.y),M.copy(T),c.update()}(e)}}function Y(e){!1!==c.enabled&&(document.removeEventListener("mousemove",X,!1),document.removeEventListener("mouseup",Y,!1),c.dispatchEvent(h),p=d.NONE)}function Z(e){!1===c.enabled||!1===c.enableZoom||p!==d.NONE&&p!==d.ROTATE||(e.preventDefault(),e.stopPropagation(),c.dispatchEvent(u),function(e){e.deltaY<0?B(R()):e.deltaY>0&&F(R()),c.update()}(e),c.dispatchEvent(h))}function J(e){!1!==c.enabled&&!1!==c.enableKeys&&!1!==c.enablePan&&function(e){var t=!1;switch(e.keyCode){case c.keys.UP:N(0,c.keyPanSpeed),t=!0;break;case c.keys.BOTTOM:N(0,-c.keyPanSpeed),t=!0;break;case c.keys.LEFT:N(c.keyPanSpeed,0),t=!0;break;case c.keys.RIGHT:N(-c.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),c.update())}(e)}function K(e){if(!1!==c.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(c.touches.ONE){case r.TOUCH.ROTATE:if(!1===c.enableRotate)return;z(e),p=d.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===c.enablePan)return;G(e),p=d.TOUCH_PAN;break;default:p=d.NONE}break;case 2:switch(c.touches.TWO){case r.TOUCH.DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(e){c.enableZoom&&k(e),c.enablePan&&G(e)}(e),p=d.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(e){c.enableZoom&&k(e),c.enableRotate&&z(e)}(e),p=d.TOUCH_DOLLY_ROTATE;break;default:p=d.NONE}break;default:p=d.NONE}p!==d.NONE&&c.dispatchEvent(u)}}function Q(e){if(!1!==c.enabled)switch(e.preventDefault(),e.stopPropagation(),p){case d.TOUCH_ROTATE:if(!1===c.enableRotate)return;V(e),c.update();break;case d.TOUCH_PAN:if(!1===c.enablePan)return;j(e),c.update();break;case d.TOUCH_DOLLY_PAN:if(!1===c.enableZoom&&!1===c.enablePan)return;!function(e){c.enableZoom&&W(e),c.enablePan&&j(e)}(e),c.update();break;case d.TOUCH_DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(e){c.enableZoom&&W(e),c.enableRotate&&V(e)}(e),c.update();break;default:p=d.NONE}}function $(e){!1!==c.enabled&&(c.dispatchEvent(h),p=d.NONE)}function ee(e){!1!==c.enabled&&e.preventDefault()}c.domElement.addEventListener("contextmenu",ee,!1),c.domElement.addEventListener("mousedown",q,!1),c.domElement.addEventListener("wheel",Z,!1),c.domElement.addEventListener("touchstart",K,!1),c.domElement.addEventListener("touchend",$,!1),c.domElement.addEventListener("touchmove",Q,!1),c.domElement.addEventListener("keydown",J,!1),-1===c.domElement.tabIndex&&(c.domElement.tabIndex=0),this.update()};(a.prototype=Object.create(r.EventDispatcher.prototype)).constructor=a;var o=function(e,t){a.call(this,e,t),this.mouseButtons.LEFT=r.MOUSE.PAN,this.mouseButtons.RIGHT=r.MOUSE.ROTATE,this.touches.ONE=r.TOUCH.PAN,this.touches.TWO=r.TOUCH.DOLLY_ROTATE};(o.prototype=Object.create(r.EventDispatcher.prototype)).constructor=o;const s="hull",c="hacd",l="vhacd",u="mesh",h="all",d="manual",p=function(){const e=new r.Vector3,t=new r.Matrix4;return function(n,r,i,a={}){if(a.type=s,f(a),a.fit===d)return console.warn("cannot use fit: manual with type: hull"),null;y(n,r);const o=new Ammo.btVector3,c=new Ammo.btConvexHullShape;c.setMargin(a.margin);let l=0;for(let e=0;e<n.length;e++)l+=n[e].length/3;const u=a.hullMaxVertices||1e5;l>u&&console.warn(`too many vertices for hull shape; sampling ~${u} from ~${l} vertices`);const h=Math.min(1,u/l);for(let i=0;i<n.length;i++){const a=n[i];t.fromArray(r[i]);for(let r=0;r<a.length;r+=3){const s=i===n.length-1&&r===a.length-3;(Math.random()<=h||s)&&(e.set(a[r],a[r+1],a[r+2]).applyMatrix4(t),o.setValue(e.x,e.y,e.z),c.addPoint(o,s))}}let p=c;if(c.getNumVertices()>=100){const e=new Ammo.btShapeHull(c);e.buildHull(a.margin),Ammo.destroy(c),p=new Ammo.btConvexHullShape(Ammo.getPointer(e.getVertexPointer()),e.numVertices()),Ammo.destroy(e)}return Ammo.destroy(o),m(p,a,v(i,a)),p}}();(function(){const e=new r.Vector3,t=new r.Vector3,n=new r.Matrix4})(),function(){const e=new r.Vector3,t=new r.Vector3,n=new r.Matrix4}(),function(){const e=new r.Vector3,t=new r.Vector3,n=new r.Vector3,i=new r.Matrix4}();function f(e){e.fit=e.hasOwnProperty("fit")?e.fit:h,e.type=e.type||s,e.minHalfExtent=e.hasOwnProperty("minHalfExtent")?e.minHalfExtent:0,e.maxHalfExtent=e.hasOwnProperty("maxHalfExtent")?e.maxHalfExtent:Number.POSITIVE_INFINITY,e.cylinderAxis=e.cylinderAxis||"y",e.margin=e.hasOwnProperty("margin")?e.margin:.01,e.includeInvisible=!!e.hasOwnProperty("includeInvisible")&&e.includeInvisible,e.offset||(e.offset=new r.Vector3),e.orientation||(e.orientation=new r.Quaternion)}const m=function(e,t,n){e.type=t.type,e.setMargin(t.margin),e.destroy=()=>{for(let t of e.resources||[])Ammo.destroy(t);e.heightfieldData&&Ammo._free(e.heightfieldData),Ammo.destroy(e)};const r=new Ammo.btTransform,i=new Ammo.btQuaternion;if(r.setIdentity(),r.getOrigin().setValue(t.offset.x,t.offset.y,t.offset.z),i.setValue(t.orientation.x,t.orientation.y,t.orientation.z,t.orientation.w),r.setRotation(i),Ammo.destroy(i),n){const t=new Ammo.btVector3(n.x,n.y,n.z);e.setLocalScaling(t),Ammo.destroy(t)}e.localTransform=r},g=function(){const e=new r.Matrix4;return function(t,n,i){e.getInverse(t.matrixWorld);(new r.Vector3).setFromMatrixScale(t.matrixWorld),t.traverse(a=>{const o=new r.Matrix4;a.isMesh&&"Sky"!==a.name&&(n.includeInvisible||a.el&&a.el.object3D.visible||a.visible)&&(a===t?o.identity():(a.updateWorldMatrix(!0),o.multiplyMatrices(e,a.matrixWorld)),i(a.geometry.isBufferGeometry?a.geometry.attributes.position.array:a.geometry.vertices,o.elements,a.geometry.index?a.geometry.index.array:null))})}}(),v=function(){const e=new r.Matrix4;return function(t,n={}){const i=new r.Vector3(1,1,1);return n.fit===h&&(e.fromArray(t),i.setFromMatrixScale(e)),i}}(),y=(function(){const e=new r.Vector3}(),function(e,t){const n=new r.Box3;let i=1/0,a=1/0,o=1/0,s=-1/0,c=-1/0,l=-1/0;return n.min.set(0,0,0),n.max.set(0,0,0),x(e,t,e=>{e.x<i&&(i=e.x),e.y<a&&(a=e.y),e.z<o&&(o=e.z),e.x>s&&(s=e.x),e.y>c&&(c=e.y),e.z>l&&(l=e.z)}),n.min.set(i,a,o),n.max.set(s,c,l),n}),x=function(){const e=new r.Vector3,t=new r.Matrix4;return function(n,r,i){for(let a=0;a<n.length;a++){t.fromArray(r[a]);for(let r=0;r<n[a].length;r+=3)e.set(n[a][r],n[a][r+1],n[a][r+2]).applyMatrix4(t),i(e)}}}();window.THREE=n(0);var b,_,w,M,T,S,E,A,L=[],R={};function P(e,t){var n=R[e];if(n)return n[t]}window.AMMO_USER_DATA=R,window.getUserData=P;const C=new class{constructor(){this.scene=new THREE.Scene,this.camera=new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,1e3),this.renderer=new THREE.WebGLRenderer,this.loader=new i,this.camera.position.z=100,this.camera.position.y=70,this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.autoUpdate=!0,this.renderer.shadowMap.type=THREE.PCFSoftShadowMap,this.renderer.shadowMap.needsUpdate=!0,this.renderer.setClearColor(3489865),this.renderer.gammaInput=!0,this.renderer.gammaOutput=!0,this.renderer.gammaFactor=1,this.renderer.toneMapping=THREE.ReinhardToneMapping,this.renderer.toneMappingExposure=2,this.renderer.physicallyCorrectLights=!0,document.body.appendChild(this.renderer.domElement),Ammo=Ammo(),THREE.AmmoDebugDrawer=function(e,t,n){n=n||{},this.debugObject=new THREE.Object3D,this.scene=e,this.world=t,this.enabled=!1,this.lineCache={},this.colors=[],this.debugDrawer=new Ammo.DebugDrawer,this.debugDrawer.drawLine=this.drawLine.bind(this),this.debugDrawer.drawContactPoint=this.drawContactPoint.bind(this),this.debugDrawer.reportErrorWarning=this.reportErrorWarning.bind(this),this.debugDrawer.draw3dText=this.draw3dText.bind(this),this.debugDrawer.setDebugMode=this.setDebugMode.bind(this),this.debugDrawer.getDebugMode=this.getDebugMode.bind(this),this.debugDrawer.enable=this.enable.bind(this),this.debugDrawer.disable=this.disable.bind(this),this.debugDrawer.update=this.update.bind(this),this.debugDrawMode=n.debugDrawMode||1,this.drawOnTop=n.drawOnTop||!1,this.clearDebug=!1,this.world.setDebugDrawer(this.debugDrawer)},THREE.AmmoDebugDrawer.prototype=function(){return this.debugDrawer},THREE.AmmoDebugDrawer.prototype.enable=function(){this.enabled=!0,this.scene.add(this.debugObject)},THREE.AmmoDebugDrawer.prototype.disable=function(){this.enabled=!1,this.scene.remove(this.debugObject)},THREE.AmmoDebugDrawer.prototype.update=function(){this.enabled&&(this.world.debugDrawWorld(),this.clearDebug=!0)},THREE.AmmoDebugDrawer.prototype.drawLine=function(e,t,n){if(this.clearDebug){for(var r=0;r<this.colors.length;r++)for(var i=this.colors[r];this.lineCache[i].geometry.vertices.length>0;)this.lineCache[i].geometry.vertices.pop();this.clearDebug=!1}if(this.enabled){var a=Ammo.wrapPointer(n,Ammo.btVector3);if(!this.lineCache.hasOwnProperty(n)){this.colors.push(n);var o=new THREE.LineBasicMaterial({color:new THREE.Color(a.x(),a.y(),a.z()),depthTest:!this.drawOnTop}),s=new THREE.Geometry;this.lineCache[n]=new THREE.LineSegments(s,o),this.drawOnTop&&(this.lineCache[n].renderOrder=1),this.debugObject.add(this.lineCache[n])}var c=Ammo.wrapPointer(e,Ammo.btVector3),l=new THREE.Vector3(c.x(),c.y(),c.z());this.lineCache[n].geometry.vertices.push(l);var u=Ammo.wrapPointer(t,Ammo.btVector3),h=new THREE.Vector3(u.x(),u.y(),u.z());this.lineCache[n].geometry.vertices.push(h),this.lineCache[n].geometry.verticesNeedUpdate=!0}},THREE.AmmoDebugDrawer.prototype.drawContactPoint=function(e,t,n,r,i){console.log("drawContactPoint")},THREE.AmmoDebugDrawer.prototype.reportErrorWarning=function(e){console.warn(e)},THREE.AmmoDebugDrawer.prototype.draw3dText=function(e,t){console.log("draw3dText",e,t)},THREE.AmmoDebugDrawer.prototype.setDebugMode=function(e){this.debugDrawMode=e},THREE.AmmoDebugDrawer.prototype.getDebugMode=function(){return this.debugDrawMode},b=new Ammo.btSoftBodyRigidBodyCollisionConfiguration,_=new Ammo.btCollisionDispatcher(b),w=new Ammo.btDbvtBroadphase,M=new Ammo.btSequentialImpulseConstraintSolver,T=new Ammo.btDefaultSoftBodySolver,(S=new Ammo.btSoftRigidDynamicsWorld(_,w,M,b,T)).setGravity(new Ammo.btVector3(0,-19.8,0)),S.getWorldInfo().set_m_gravity(new Ammo.btVector3(0,-19.8,0)),E=new Ammo.btTransform,this.physicsWorld=S,this.dispatcher=_,this.rigidBodies=L,this.ammo_debug=new THREE.AmmoDebugDrawer(this.scene,S,{}),this.ammo_debug.enable(),this.pressed_keys={},window.addEventListener("keydown",e=>{this.pressed_keys[e.keyCode]=!0}),window.addEventListener("keyup",e=>{delete this.pressed_keys[e.keyCode]}),this._update()}_update(e){if(void 0!==A){var t=(e-A)/1e3;this.update_physics(t)}this.update&&this.update(t),this.debug_physics&&this.ammo_debug.update();const n=this.renderer.domElement;n.style.width=window.innerWidth+"px",n.style.height=window.innerHeight+"px",this.renderer.setSize(window.innerWidth,window.innerHeight),this.camera.aspect=n.clientWidth/n.clientHeight,this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera),A=e,requestAnimationFrame(this._update.bind(this))}update_physics(e){S.stepSimulation(e,20);for(var t=0,n=L.length;t<n;t++){var r=L[t],i=r.userData.physicsBody.getMotionState();if(i){i.getWorldTransform(E);var a=E.getOrigin(),o=E.getRotation();r.position.set(a.x(),a.y(),a.z()),r.quaternion.set(o.x(),o.y(),o.z(),o.w())}}for(t=0,n=this.dispatcher.getNumManifolds();t<n;t++){var s=this.dispatcher.getManifoldByIndexInternal(t);if(s.getNumContacts()>0){var c=s.getBody0(),l=s.getBody1(),u=P(c.J,"object"),h=P(l.J,"object");u.onCollide&&u.onCollide(h,s),h.onCollide&&h.onCollide(u,s)}}}createRigidBody(e,t,n,r,i){var a=new Ammo.btTransform;a.setIdentity(),a.setOrigin(new Ammo.btVector3(r.x,r.y,r.z)),a.setRotation(new Ammo.btQuaternion(i.x,i.y,i.z,i.w));var o=new Ammo.btDefaultMotionState(a),s=new Ammo.btVector3(0,0,0);t.calculateLocalInertia(n,s);var c,l,u,h=new Ammo.btRigidBodyConstructionInfo(n,o,t,s),d=new Ammo.btRigidBody(h);c=d.J,l="object",u=e,c in R||(R[c]={}),R[c][l]=u,e.userData.physicsBody=d,n>0&&(this.rigidBodies.push(e),d.setActivationState(4)),this.physicsWorld.addRigidBody(d)}removeRigidBody(e){var t=e.userData.physicsBody;delete e.userData.physicsBody;var n=this.rigidBodies.indexOf(e);n>-1&&(this.rigidBodies.splice(n,1),this.physicsWorld.removeRigidBody(t))}};var O=function(){var e,t,n,i,a=new r.Vector3;function o(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new u,this.unassigned=new u,this.vertices=[]}function s(){this.normal=new r.Vector3,this.midpoint=new r.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=0,this.edge=null}function c(e,t){this.vertex=e,this.prev=null,this.next=null,this.twin=null,this.face=t}function l(e){this.point=e,this.prev=null,this.next=null,this.face=null}function u(){this.head=null,this.tail=null}return Object.assign(o.prototype,{setFromPoints:function(e){!0!==Array.isArray(e)&&console.error("THREE.ConvexHull: Points parameter is not an array."),e.length<4&&console.error("THREE.ConvexHull: The algorithm needs at least four points."),this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.vertices.push(new l(e[t]));return this.compute(),this},setFromObject:function(e){var t=[];return e.updateMatrixWorld(!0),e.traverse((function(e){var n,i,a,o=e.geometry;if(void 0!==o)if(o.isGeometry){var s=o.vertices;for(n=0,i=s.length;n<i;n++)(a=s[n].clone()).applyMatrix4(e.matrixWorld),t.push(a)}else if(o.isBufferGeometry){var c=o.attributes.position;if(void 0!==c)for(n=0,i=c.count;n<i;n++)(a=new r.Vector3).fromBufferAttribute(c,n).applyMatrix4(e.matrixWorld),t.push(a)}})),this.setFromPoints(t)},containsPoint:function(e){for(var t=this.faces,n=0,r=t.length;n<r;n++){if(t[n].distanceToPoint(e)>this.tolerance)return!1}return!0},intersectRay:function(e,t){for(var n=this.faces,r=-1/0,i=1/0,a=0,o=n.length;a<o;a++){var s=n[a],c=s.distanceToPoint(e.origin),l=s.normal.dot(e.direction);if(c>0&&l>=0)return null;var u=0!==l?-c/l:0;if(!(u<=0)&&(l>0?i=Math.min(u,i):r=Math.max(u,r),r>i))return null}return r!==-1/0?e.at(r,t):e.at(i,t),t},intersectsRay:function(e){return null!==this.intersectRay(e,a)},makeEmpty:function(){return this.faces=[],this.vertices=[],this},addVertexToFace:function(e,t){return e.face=t,null===t.outside?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this},removeVertexFromFace:function(e,t){return e===t.outside&&(null!==e.next&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this},removeAllVerticesFromFace:function(e){if(null!==e.outside){for(var t=e.outside,n=e.outside;null!==n.next&&n.next.face===e;)n=n.next;return this.assigned.removeSubList(t,n),t.prev=n.next=null,e.outside=null,t}},deleteFaceVertices:function(e,t){var n=this.removeAllVerticesFromFace(e);if(void 0!==n)if(void 0===t)this.unassigned.appendChain(n);else{var r=n;do{var i=r.next;t.distanceToPoint(r.point)>this.tolerance?this.addVertexToFace(r,t):this.unassigned.append(r),r=i}while(null!==r)}return this},resolveUnassignedPoints:function(e){if(!1===this.unassigned.isEmpty()){var t=this.unassigned.first();do{for(var n=t.next,r=this.tolerance,i=null,a=0;a<e.length;a++){var o=e[a];if(0===o.mark){var s=o.distanceToPoint(t.point);if(s>r&&(r=s,i=o),r>1e3*this.tolerance)break}}null!==i&&this.addVertexToFace(t,i),t=n}while(null!==t)}return this},computeExtremes:function(){var e,t,n,i=new r.Vector3,a=new r.Vector3,o=[],s=[];for(e=0;e<3;e++)o[e]=s[e]=this.vertices[0];for(i.copy(this.vertices[0].point),a.copy(this.vertices[0].point),e=0,t=this.vertices.length;e<t;e++){var c=this.vertices[e],l=c.point;for(n=0;n<3;n++)l.getComponent(n)<i.getComponent(n)&&(i.setComponent(n,l.getComponent(n)),o[n]=c);for(n=0;n<3;n++)l.getComponent(n)>a.getComponent(n)&&(a.setComponent(n,l.getComponent(n)),s[n]=c)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(i.x),Math.abs(a.x))+Math.max(Math.abs(i.y),Math.abs(a.y))+Math.max(Math.abs(i.z),Math.abs(a.z))),{min:o,max:s}},computeInitialHull:function(){void 0===e&&(e=new r.Line3,t=new r.Plane,n=new r.Vector3);var i,a,o,c,l,u,h,d,p,f=this.vertices,m=this.computeExtremes(),g=m.min,v=m.max,y=0,x=0;for(u=0;u<3;u++)(p=v[u].point.getComponent(u)-g[u].point.getComponent(u))>y&&(y=p,x=u);for(a=g[x],o=v[x],y=0,e.set(a.point,o.point),u=0,h=this.vertices.length;u<h;u++)(i=f[u])!==a&&i!==o&&(e.closestPointToPoint(i.point,!0,n),(p=n.distanceToSquared(i.point))>y&&(y=p,c=i));for(y=-1,t.setFromCoplanarPoints(a.point,o.point,c.point),u=0,h=this.vertices.length;u<h;u++)(i=f[u])!==a&&i!==o&&i!==c&&(p=Math.abs(t.distanceToPoint(i.point)))>y&&(y=p,l=i);var b=[];if(t.distanceToPoint(l.point)<0)for(b.push(s.create(a,o,c),s.create(l,o,a),s.create(l,c,o),s.create(l,a,c)),u=0;u<3;u++)d=(u+1)%3,b[u+1].getEdge(2).setTwin(b[0].getEdge(d)),b[u+1].getEdge(1).setTwin(b[d+1].getEdge(0));else for(b.push(s.create(a,c,o),s.create(l,a,o),s.create(l,o,c),s.create(l,c,a)),u=0;u<3;u++)d=(u+1)%3,b[u+1].getEdge(2).setTwin(b[0].getEdge((3-u)%3)),b[u+1].getEdge(0).setTwin(b[d+1].getEdge(1));for(u=0;u<4;u++)this.faces.push(b[u]);for(u=0,h=f.length;u<h;u++)if((i=f[u])!==a&&i!==o&&i!==c&&i!==l){y=this.tolerance;var _=null;for(d=0;d<4;d++)(p=this.faces[d].distanceToPoint(i.point))>y&&(y=p,_=this.faces[d]);null!==_&&this.addVertexToFace(i,_)}return this},reindexFaces:function(){for(var e=[],t=0;t<this.faces.length;t++){var n=this.faces[t];0===n.mark&&e.push(n)}return this.faces=e,this},nextVertexToAdd:function(){if(!1===this.assigned.isEmpty()){var e,t=0,n=this.assigned.first().face,r=n.outside;do{var i=n.distanceToPoint(r.point);i>t&&(t=i,e=r),r=r.next}while(null!==r&&r.face===n);return e}},computeHorizon:function(e,t,n,r){var i;this.deleteFaceVertices(n),n.mark=1,i=null===t?t=n.getEdge(0):t.next;do{var a=i.twin,o=a.face;0===o.mark&&(o.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,a,o,r):r.push(i)),i=i.next}while(i!==t);return this},addAdjoiningFace:function(e,t){var n=s.create(e,t.tail(),t.head());return this.faces.push(n),n.getEdge(-1).setTwin(t.twin),n.getEdge(0)},addNewFaces:function(e,t){this.newFaces=[];for(var n=null,r=null,i=0;i<t.length;i++){var a=t[i],o=this.addAdjoiningFace(e,a);null===n?n=o:o.next.setTwin(r),this.newFaces.push(o.face),r=o}return n.next.setTwin(r),this},addVertexToHull:function(e){var t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this},cleanup:function(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this},compute:function(){var e;for(this.computeInitialHull();void 0!==(e=this.nextVertexToAdd());)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}),Object.assign(s,{create:function(e,t,n){var r=new s,i=new c(e,r),a=new c(t,r),o=new c(n,r);return i.next=o.prev=a,a.next=i.prev=o,o.next=a.prev=i,r.edge=i,r.compute()}}),Object.assign(s.prototype,{getEdge:function(e){for(var t=this.edge;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t},compute:function(){void 0===i&&(i=new r.Triangle);var e=this.edge.tail(),t=this.edge.head(),n=this.edge.next.head();return i.set(e.point,t.point,n.point),i.getNormal(this.normal),i.getMidpoint(this.midpoint),this.area=i.getArea(),this.constant=this.normal.dot(this.midpoint),this},distanceToPoint:function(e){return this.normal.dot(e)-this.constant}}),Object.assign(c.prototype,{head:function(){return this.vertex},tail:function(){return this.prev?this.prev.vertex:null},length:function(){var e=this.head(),t=this.tail();return null!==t?t.point.distanceTo(e.point):-1},lengthSquared:function(){var e=this.head(),t=this.tail();return null!==t?t.point.distanceToSquared(e.point):-1},setTwin:function(e){return this.twin=e,e.twin=this,this}}),Object.assign(u.prototype,{first:function(){return this.head},last:function(){return this.tail},clear:function(){return this.head=this.tail=null,this},insertBefore:function(e,t){return t.prev=e.prev,t.next=e,null===t.prev?this.head=t:t.prev.next=t,e.prev=t,this},insertAfter:function(e,t){return t.prev=e,t.next=e.next,null===t.next?this.tail=t:t.next.prev=t,e.next=t,this},append:function(e){return null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this},appendChain:function(e){for(null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail;null!==e.next;)e=e.next;return this.tail=e,this},remove:function(e){return null===e.prev?this.head=e.next:e.prev.next=e.next,null===e.next?this.tail=e.prev:e.next.prev=e.prev,this},removeSubList:function(e,t){return null===e.prev?this.head=t.next:e.prev.next=t.next,null===t.next?this.tail=e.prev:t.next.prev=e.prev,this},isEmpty:function(){return null===this.head}}),o}();window.THREE=n(0);var D={};function I(e){return e in D||(D[e]=new THREE.LineBasicMaterial({color:e})),D[e]}function N(e,t){return[e.x-t.x,e.y-t.y,e.z-t.z]}function F(e,t,n,r){return Math.abs((i=[N(e,t),N(t,n),N(n,r)])[0][0]*(i[1][1]*i[2][2]-i[1][2]*i[2][1])-i[1][0]*(i[0][1]*i[2][2]-i[0][2]*i[2][1])+i[2][0]*(i[0][1]*i[1][2]-i[0][2]*i[1][1]))/6;var i}function B(e){var t=new O;t.setFromObject(e);let n=0,i=e.getWorldPosition(new r.Vector3(0,0,0));for(let e=0;e<t.faces.length;e++){const r=t.faces[e];n+=F(i,r.edge.tail().point,r.edge.head().point,r.edge.next.head().point)}return n}function H(e,t){if(e<0&&t>0||t<0&&e>0)return 0;var n=1;return e+t<0&&(n=-1),Math.min(Math.abs(e),Math.abs(t))*n}var U,z=n(1),G=n.n(z);window.THREE=n(0),window.addEventListener("gamepadconnected",(function(e){var t=navigator.getGamepads()[e.gamepad.index];window.gamepad_index=e.gamepad.index,console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",t.index,t.id,t.buttons.length,t.axes.length)})),window.addEventListener("load",(function(e){window.left_touch=G.a.create({zone:document.querySelector(".left")}),window.right_touch=G.a.create({zone:document.querySelector(".right")})}));class k{constructor(e){this.ball=C.scene.getObjectByName("ball_collider"),this.ball_display=C.scene.getObjectByName("ball_display"),this.prince=C.scene.getObjectByName("prince_armature"),this.sun=C.scene.getObjectByName("sun"),this.animations={},this.ball_radius=2,this.heading=new r.Vector3(0,0,1),this.last_position=new r.Vector3(0,0,0),this.strafe_left=0,this.strafe_right=0,this.volume=29.26,this.ball.material.visible=!1;var t=this.ball_display.scale.x/this.ball.scale.x;this.ball_display.parent=this.ball,this.ball_display.position.copy(new r.Vector3(0,0,0)),this.ball_display.scale.set(t,t,t),this.ball.userData.physicsBody.setFriction(10),this.ball.userData.physicsBody.setDamping(.1,.2),this.ball.onCollide=this.on_collide.bind(this),this.mixer=new THREE.AnimationMixer(this.prince),e.forEach(e=>{var t=this.mixer.clipAction(e);this.animations[e.name]=t,t.setEffectiveTimeScale(1),t.setEffectiveWeight(0),t.play()})}rebuild_shell(){var e;this.ball_radius=(e=this.volume,Math.cbrt(3*e/(4*Math.PI)));var t=new THREE.Raycaster,n=this.ball,i=n.geometry.attributes.position,a=!1;for(let e=0;e<i.count;e++){var o=new r.Vector3(i.array[3*e],i.array[3*e+1],i.array[3*e+2]);o=n.localToWorld(o.multiply(new THREE.Vector3(30,30,30)));var s=n.position.clone().sub(o).normalize();t.set(o,s),t.far=n.position.distanceTo(o);var c=t.intersectObjects(n.children);if(c[0]&&c[0].object!=n){var l=n.worldToLocal(c[0].point),u=Math.min(l.length(),1.1*this.ball_radius,n.position.distanceTo(c[0].object.position));l.normalize().multiplyScalar(u),i.array[3*e]=l.x,i.array[3*e+1]=l.y,i.array[3*e+2]=l.z,i.needsUpdate=!0,a=!0}(o=new r.Vector3(i.array[3*e],i.array[3*e+1],i.array[3*e+2])).length()<player.ball_radius&&(a=!0,o.normalize().multiplyScalar(player.ball_radius),i.array[3*e]=o.x,i.array[3*e+1]=o.y,i.array[3*e+2]=o.z)}if(a){const e=new THREE.Matrix4;var h=[],d=[],f=[],m=n.children;n.children=[],g(n,{},(e,t,n)=>{h.push(e),d.push(t),f.push(n)}),n.children=m;var v=p(h,d,e.elements);v.setLocalScaling(new Ammo.btVector3(n.scale.x,n.scale.y,n.scale.z)),n.userData.physicsBody.setCollisionShape(v)}}on_collide(e,t){if(!e.userData.static&&e.userData.physicsBody&&e.userData.volume<.3*this.volume){this.volume+=e.userData.volume;e.userData.physicsBody.getCollisionShape();this.ball.attach(e),C.removeRigidBody(e);var n=this.rebuild_shell.bind(this);setTimeout((function(){n()}),1)}}update(e){var t,n=this.ball.userData.physicsBody,i=0,a=0,o=0,s=0;if(74 in C.pressed_keys&&(o=-1),76 in C.pressed_keys&&(o=1),73 in C.pressed_keys&&(s=1),75 in C.pressed_keys&&(s=-1),65 in C.pressed_keys&&(i=-1),68 in C.pressed_keys&&(i=1),87 in C.pressed_keys&&(a=1),83 in C.pressed_keys&&(a=-1),null!=window.gamepad_index){var c=navigator.getGamepads()[window.gamepad_index];c.buttons.forEach(e=>{e.pressed}),i=c.axes[0],a=-c.axes[1],o=c.axes[2],s=-c.axes[3]}left_touch.ids.length>0&&(a=-(t=left_touch.get(left_touch.ids[0])).frontPosition.y/50,i=t.frontPosition.x/50);right_touch.ids.length>0&&(s=-(t=right_touch.get(right_touch.ids[0])).frontPosition.y/50,o=t.frontPosition.x/50);var l=200*H(s,a);n.applyForce(new Ammo.btVector3(this.heading.x*-l,0,this.heading.z*-l));var u=player.heading.clone().applyEuler(new THREE.Euler(0,90,0)),h=200*H(o,i);n.applyForce(new Ammo.btVector3(u.x*h,0,u.z*h));var d=s-a;Math.abs(d)>1&&this.heading.applyEuler(new THREE.Euler(0,d*e,0));var p=player.ball.position.clone().sub(this.last_position.clone()),f=player.prince.worldToLocal(p.clone().add(player.prince.position));this.sun.position.copy(new r.Vector3(4,51,-33).add(this.ball.position));var m=function(e,t){var n=new THREE.Raycaster(e,t,0,1e3).intersectObjects(C.scene.children,!0);for(let e=0;e<n.length;e++)if(n[e].object.userData.static)return n[e]}(this.ball.position.clone().add(this.heading.clone().multiplyScalar(5)),new r.Vector3(0,-1,0));m&&this.prince.position.lerp(m.point,.5),this.prince.lookAt(new r.Vector3(this.ball.position.x,this.prince.position.y,this.ball.position.z)),this.prince.rotateY(3.14159);var g=this.ball.position.clone().add(this.heading.clone().multiplyScalar(15+2*this.ball_radius).add(new r.Vector3(0,10,0)));C.camera.position.lerp(g,.2),C.camera.lookAt(this.ball.position);var v=-5*f.z;this.animations.push.setEffectiveWeight(v),this.animations.pull.setEffectiveWeight(-v),this.animations.idle.setEffectiveWeight(1-Math.abs(v)),this.animations.idle.setEffectiveTimeScale(.1),this.animations.push.setEffectiveTimeScale(1.5*v),this.animations.pull.setEffectiveTimeScale(1.5*v),(H(o,i)<-.2||d>1)&&(this.strafe_left=Math.min(1,this.strafe_left+.1)),(H(o,i)>.2||d<-1)&&(this.strafe_right=Math.min(1,this.strafe_right+.1)),this.animations.strafe.setEffectiveWeight(this.strafe_left+this.strafe_right),this.animations.strafe.setEffectiveTimeScale(4*(this.strafe_left+-this.strafe_right)),this.strafe_left*=.9,this.strafe_right*=.9,this.mixer.update(e),this.last_position=player.ball.position.clone()}}window.THREE=n(0),window.nipplejs=G.a,window.Main=C,window.gizmos=new class{constructor(e){this.scene=e,this.line_objects=[],this.sphere_objects=[],this.line_pool=[],this.sphere_pool=[]}line(e,t,n){var r,i=I(n||255);this.line_pool.length>0?((r=this.line_pool.pop()).material=i,r.geometry.attributes.position.array[0]=e.x,r.geometry.attributes.position.array[1]=e.y,r.geometry.attributes.position.array[2]=e.z,r.geometry.attributes.position.array[3]=t.x,r.geometry.attributes.position.array[4]=t.y,r.geometry.attributes.position.array[5]=t.z,r.geometry.attributes.position.needsUpdate=!0):r=new THREE.Line((new THREE.BufferGeometry).setFromPoints([e,t]),i),this.line_objects.push(r),this.scene.add(r)}sphere(e,t,n){var r,i=I(n||255);this.sphere_pool.length>0?(r=this.sphere_pool.pop()).material=i:r=new THREE.Mesh(new THREE.SphereGeometry(1,12,12),i),r.position.copy(e),r.scale.set(t+t,t+t,t+t),this.sphere_objects.push(r),this.scene.add(r)}clear(){this.line_objects.forEach(e=>{this.scene.remove(e),this.line_pool.push(e)}),this.sphere_objects.forEach(e=>{this.scene.remove(e),this.sphere_pool.push(e)}),this.line_objects=[],this.sphere_objects=[]}}(C.scene),window.ConvexHull=O,C.loader.load("gltf/player.glb",(function(e){var t=e.animations;C.scene.add(e.scene),C.loader.load("gltf/test-scene.glb",(function(e){C.scene.add(new THREE.AmbientLight(3489865)),C.scene.add(e.scene),C.scene.traverse((function(e){e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,function(e){if(["prince","ball_display"].includes(e.name))return;e.userData.volume=B(e);var t=["floor","box"].includes(e.name);t&&(e.userData.static=!0);var n=t?0:5;const r=new THREE.Matrix4;var i=[],a=[],o=[];g(e,{},(e,t,n)=>{i.push(e),a.push(t),o.push(n)});var s=p(i,a,r.elements);s.setLocalScaling(new Ammo.btVector3(e.scale.x,e.scale.y,e.scale.z)),C.createRigidBody(e,s,n,e.position,e.quaternion)}(e)),e.isLight&&"sun"==e.parent.name&&(e.castShadow=!0,e.shadow.camera.left=-100,e.shadow.camera.right=100,e.shadow.camera.top=100,e.shadow.camera.bottom=-100,e.shadow.camera.far=1e3,e.shadow.mapSize.set(4096,4096),C.scene.add(new THREE.CameraHelper(e.shadow.camera)),e.shadow.bias=-9e-5)})),U=new k(t),window.player=U}))})),window.compute_volume=B,C.update=e=>{U&&U.update(e)},C.scene.onAfterRender=function(e,t,n){gizmos.clear()}}]);