text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Phaser")):"function"==typeof define&&define.amd?define(["Phaser"],t):"object"==typeof exports?exports.ENABLE3D=t(require("Phaser")):e.ENABLE3D=t(e.Phaser)}(window,(function(e){return 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=49)}([function(e,t){!function(e,t){for(var n in t)e[n]=t[n]}(t,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=1)}([function(e,t,n){"use strict";n.r(t),n.d(t,"ACESFilmicToneMapping",(function(){return oe})),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 jh})),n.d(t,"AnimationClip",(function(){return Ll})),n.d(t,"AnimationLoader",(function(){return Bl})),n.d(t,"AnimationMixer",(function(){return bp})),n.d(t,"AnimationObjectGroup",(function(){return yp})),n.d(t,"AnimationUtils",(function(){return ml})),n.d(t,"ArcCurve",(function(){return jl})),n.d(t,"ArrayCamera",(function(){return Rs})),n.d(t,"ArrowHelper",(function(){return cd})),n.d(t,"Audio",(function(){return ep})),n.d(t,"AudioAnalyser",(function(){return ap})),n.d(t,"AudioContext",(function(){return kh})),n.d(t,"AudioListener",(function(){return $h})),n.d(t,"AudioLoader",(function(){return Vh})),n.d(t,"AxesHelper",(function(){return ud})),n.d(t,"AxisHelper",(function(){return nf})),n.d(t,"BackSide",(function(){return g})),n.d(t,"BasicDepthPacking",(function(){return cn})),n.d(t,"BasicShadowMap",(function(){return p})),n.d(t,"BinaryTextureLoader",(function(){return cf})),n.d(t,"Bone",(function(){return mc})),n.d(t,"BooleanKeyframeTrack",(function(){return wl})),n.d(t,"BoundingBoxHelper",(function(){return rf})),n.d(t,"Box2",(function(){return Pp})),n.d(t,"Box3",(function(){return Gr})),n.d(t,"Box3Helper",(function(){return rd})),n.d(t,"BoxBufferGeometry",(function(){return yo})),n.d(t,"BoxGeometry",(function(){return go})),n.d(t,"BoxHelper",(function(){return nd})),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 Rl})),n.d(t,"Camera",(function(){return Mo})),n.d(t,"CameraHelper",(function(){return $p})),n.d(t,"CanvasRenderer",(function(){return hf})),n.d(t,"CanvasTexture",(function(){return kc})),n.d(t,"CatmullRomCurve3",(function(){return Jl})),n.d(t,"CineonToneMapping",(function(){return ie})),n.d(t,"CircleBufferGeometry",(function(){return nl})),n.d(t,"CircleGeometry",(function(){return tl})),n.d(t,"ClampToEdgeWrapping",(function(){return me})),n.d(t,"Clock",(function(){return Yh})),n.d(t,"ClosedSplineCurve3",(function(){return $d})),n.d(t,"Color",(function(){return vi})),n.d(t,"ColorKeyframeTrack",(function(){return _l})),n.d(t,"CompressedTexture",(function(){return Gc})),n.d(t,"CompressedTextureLoader",(function(){return Fl})),n.d(t,"ConeBufferGeometry",(function(){return el})),n.d(t,"ConeGeometry",(function(){return $u})),n.d(t,"CubeCamera",(function(){return So})),n.d(t,"CubeGeometry",(function(){return go})),n.d(t,"CubeReflectionMapping",(function(){return se})),n.d(t,"CubeRefractionMapping",(function(){return ce})),n.d(t,"CubeTexture",(function(){return Zo})),n.d(t,"CubeTextureLoader",(function(){return Gl})),n.d(t,"CubeUVReflectionMapping",(function(){return pe})),n.d(t,"CubeUVRefractionMapping",(function(){return de})),n.d(t,"CubicBezierCurve",(function(){return eh})),n.d(t,"CubicBezierCurve3",(function(){return th})),n.d(t,"CubicInterpolant",(function(){return gl})),n.d(t,"CullFaceBack",(function(){return s})),n.d(t,"CullFaceFront",(function(){return c})),n.d(t,"CullFaceFrontBack",(function(){return u})),n.d(t,"CullFaceNone",(function(){return a})),n.d(t,"Curve",(function(){return Vl})),n.d(t,"CurvePath",(function(){return ch})),n.d(t,"CustomBlending",(function(){return E})),n.d(t,"CylinderBufferGeometry",(function(){return Qu})),n.d(t,"CylinderGeometry",(function(){return Ku})),n.d(t,"Cylindrical",(function(){return Ap})),n.d(t,"DataTexture",(function(){return Ao})),n.d(t,"DataTexture2DArray",(function(){return Jo})),n.d(t,"DataTexture3D",(function(){return Ko})),n.d(t,"DataTextureLoader",(function(){return zl})),n.d(t,"DecrementStencilOp",(function(){return vn})),n.d(t,"DecrementWrapStencilOp",(function(){return yn})),n.d(t,"DefaultLoadingManager",(function(){return Ol})),n.d(t,"DepthFormat",(function(){return We})),n.d(t,"DepthStencilFormat",(function(){return qe})),n.d(t,"DepthTexture",(function(){return Vc})),n.d(t,"DirectionalLight",(function(){return bh})),n.d(t,"DirectionalLightHelper",(function(){return Jp})),n.d(t,"DirectionalLightShadow",(function(){return xh})),n.d(t,"DiscreteInterpolant",(function(){return xl})),n.d(t,"DodecahedronBufferGeometry",(function(){return tu})),n.d(t,"DodecahedronGeometry",(function(){return eu})),n.d(t,"DoubleSide",(function(){return y})),n.d(t,"DstAlphaFactor",(function(){return z})),n.d(t,"DstColorFactor",(function(){return G})),n.d(t,"DynamicBufferAttribute",(function(){return Hd})),n.d(t,"DynamicCopyUsage",(function(){return Nn})),n.d(t,"DynamicDrawUsage",(function(){return Pn})),n.d(t,"DynamicReadUsage",(function(){return On})),n.d(t,"EdgesGeometry",(function(){return Ju})),n.d(t,"EdgesHelper",(function(){return of})),n.d(t,"EllipseCurve",(function(){return Hl})),n.d(t,"EqualDepth",(function(){return X})),n.d(t,"EqualStencilFunc",(function(){return _n})),n.d(t,"EquirectangularReflectionMapping",(function(){return ue})),n.d(t,"EquirectangularRefractionMapping",(function(){return le})),n.d(t,"Euler",(function(){return lr})),n.d(t,"EventDispatcher",(function(){return Fn})),n.d(t,"ExtrudeBufferGeometry",(function(){return Bu})),n.d(t,"ExtrudeGeometry",(function(){return Nu})),n.d(t,"Face3",(function(){return bi})),n.d(t,"Face4",(function(){return Ld})),n.d(t,"FaceColors",(function(){return Od})),n.d(t,"FileLoader",(function(){return Nl})),n.d(t,"FlatShading",(function(){return x})),n.d(t,"Float32Attribute",(function(){return Kd})),n.d(t,"Float32BufferAttribute",(function(){return Di})),n.d(t,"Float64Attribute",(function(){return Qd})),n.d(t,"Float64BufferAttribute",(function(){return Ii})),n.d(t,"FloatType",(function(){return De})),n.d(t,"Fog",(function(){return Fs})),n.d(t,"FogExp2",(function(){return Bs})),n.d(t,"Font",(function(){return zh})),n.d(t,"FontLoader",(function(){return Gh})),n.d(t,"FrontFaceDirectionCCW",(function(){return h})),n.d(t,"FrontFaceDirectionCW",(function(){return l})),n.d(t,"FrontSide",(function(){return v})),n.d(t,"Frustum",(function(){return Ro})),n.d(t,"GammaEncoding",(function(){return tn})),n.d(t,"Geometry",(function(){return vo})),n.d(t,"GeometryUtils",(function(){return lf})),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 Wp})),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 jp})),n.d(t,"HemisphereLightProbe",(function(){return Hh})),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 Ul})),n.d(t,"ImageUtils",(function(){return jn})),n.d(t,"ImmediateRenderObject",(function(){return Dp})),n.d(t,"IncrementStencilOp",(function(){return mn})),n.d(t,"IncrementWrapStencilOp",(function(){return gn})),n.d(t,"InstancedBufferAttribute",(function(){return Lh})),n.d(t,"InstancedBufferGeometry",(function(){return Ah})),n.d(t,"InstancedInterleavedBuffer",(function(){return _p})),n.d(t,"InstancedMesh",(function(){return bc})),n.d(t,"Int16Attribute",(function(){return Xd})),n.d(t,"Int16BufferAttribute",(function(){return Pi})),n.d(t,"Int32Attribute",(function(){return Zd})),n.d(t,"Int32BufferAttribute",(function(){return Ci})),n.d(t,"Int8Attribute",(function(){return jd})),n.d(t,"Int8BufferAttribute",(function(){return Ei})),n.d(t,"IntType",(function(){return Ce})),n.d(t,"InterleavedBuffer",(function(){return zs})),n.d(t,"InterleavedBufferAttribute",(function(){return ks})),n.d(t,"Interpolant",(function(){return vl})),n.d(t,"InterpolateDiscrete",(function(){return Vt})),n.d(t,"InterpolateLinear",(function(){return Ht})),n.d(t,"InterpolateSmooth",(function(){return jt})),n.d(t,"InvertStencilOp",(function(){return xn})),n.d(t,"JSONLoader",(function(){return pf})),n.d(t,"KeepStencilOp",(function(){return dn})),n.d(t,"KeyframeTrack",(function(){return bl})),n.d(t,"LOD",(function(){return lc})),n.d(t,"LatheBufferGeometry",(function(){return qu})),n.d(t,"LatheGeometry",(function(){return Wu})),n.d(t,"Layers",(function(){return hr})),n.d(t,"LensFlare",(function(){return ff})),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 wn})),n.d(t,"Light",(function(){return hh})),n.d(t,"LightProbe",(function(){return Th})),n.d(t,"LightShadow",(function(){return dh})),n.d(t,"Line",(function(){return Ac})),n.d(t,"Line3",(function(){return Op})),n.d(t,"LineBasicMaterial",(function(){return wc})),n.d(t,"LineCurve",(function(){return nh})),n.d(t,"LineCurve3",(function(){return rh})),n.d(t,"LineDashedMaterial",(function(){return dl})),n.d(t,"LineLoop",(function(){return Cc})),n.d(t,"LinePieces",(function(){return Rd})),n.d(t,"LineSegments",(function(){return Rc})),n.d(t,"LineStrip",(function(){return Pd})),n.d(t,"LinearEncoding",(function(){return $t})),n.d(t,"LinearFilter",(function(){return _e})),n.d(t,"LinearInterpolant",(function(){return yl})),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 Dl})),n.d(t,"LoaderUtils",(function(){return Eh})),n.d(t,"LoadingManager",(function(){return Cl})),n.d(t,"LogLuvEncoding",(function(){return rn})),n.d(t,"LoopOnce",(function(){return Ut})),n.d(t,"LoopPingPong",(function(){return kt})),n.d(t,"LoopRepeat",(function(){return Gt})),n.d(t,"LuminanceAlphaFormat",(function(){return He})),n.d(t,"LuminanceFormat",(function(){return Ve})),n.d(t,"MOUSE",(function(){return i})),n.d(t,"Material",(function(){return _i})),n.d(t,"MaterialLoader",(function(){return Sh})),n.d(t,"Math",(function(){return kn})),n.d(t,"MathUtils",(function(){return kn})),n.d(t,"Matrix3",(function(){return Hn})),n.d(t,"Matrix4",(function(){return sr})),n.d(t,"MaxEquation",(function(){return C})),n.d(t,"Mesh",(function(){return co})),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 Id})),n.d(t,"MeshLambertMaterial",(function(){return hl})),n.d(t,"MeshMatcapMaterial",(function(){return pl})),n.d(t,"MeshNormalMaterial",(function(){return ll})),n.d(t,"MeshPhongMaterial",(function(){return cl})),n.d(t,"MeshPhysicalMaterial",(function(){return sl})),n.d(t,"MeshStandardMaterial",(function(){return al})),n.d(t,"MeshToonMaterial",(function(){return ul})),n.d(t,"MinEquation",(function(){return R})),n.d(t,"MirroredRepeatWrapping",(function(){return ve})),n.d(t,"MixOperation",(function(){return Q})),n.d(t,"MultiMaterial",(function(){return Nd})),n.d(t,"MultiplyBlending",(function(){return S})),n.d(t,"MultiplyOperation",(function(){return K})),n.d(t,"NearestFilter",(function(){return ge})),n.d(t,"NearestMipMapLinearFilter",(function(){return we})),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 H})),n.d(t,"NeverStencilFunc",(function(){return bn})),n.d(t,"NoBlending",(function(){return w})),n.d(t,"NoColors",(function(){return Cd})),n.d(t,"NoToneMapping",(function(){return ee})),n.d(t,"NormalAnimationBlendMode",(function(){return Yt})),n.d(t,"NormalBlending",(function(){return _})),n.d(t,"NotEqualDepth",(function(){return J})),n.d(t,"NotEqualStencilFunc",(function(){return Sn})),n.d(t,"NumberKeyframeTrack",(function(){return Ml})),n.d(t,"Object3D",(function(){return Sr})),n.d(t,"ObjectLoader",(function(){return Ch})),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 k})),n.d(t,"OneMinusSrcAlphaFactor",(function(){return F})),n.d(t,"OneMinusSrcColorFactor",(function(){return N})),n.d(t,"OrthographicCamera",(function(){return yh})),n.d(t,"PCFShadowMap",(function(){return d})),n.d(t,"PCFSoftShadowMap",(function(){return f})),n.d(t,"PMREMGenerator",(function(){return _d})),n.d(t,"ParametricBufferGeometry",(function(){return Wc})),n.d(t,"ParametricGeometry",(function(){return jc})),n.d(t,"Particle",(function(){return Fd})),n.d(t,"ParticleBasicMaterial",(function(){return Gd})),n.d(t,"ParticleSystem",(function(){return zd})),n.d(t,"ParticleSystemMaterial",(function(){return kd})),n.d(t,"Path",(function(){return uh})),n.d(t,"PerspectiveCamera",(function(){return To})),n.d(t,"Plane",(function(){return ti})),n.d(t,"PlaneBufferGeometry",(function(){return No})),n.d(t,"PlaneGeometry",(function(){return Io})),n.d(t,"PlaneHelper",(function(){return id})),n.d(t,"PointCloud",(function(){return Bd})),n.d(t,"PointCloudMaterial",(function(){return Ud})),n.d(t,"PointLight",(function(){return gh})),n.d(t,"PointLightHelper",(function(){return Gp})),n.d(t,"Points",(function(){return Fc})),n.d(t,"PointsMaterial",(function(){return Oc})),n.d(t,"PolarGridHelper",(function(){return qp})),n.d(t,"PolyhedronBufferGeometry",(function(){return Xc})),n.d(t,"PolyhedronGeometry",(function(){return qc})),n.d(t,"PositionalAudio",(function(){return op})),n.d(t,"PropertyBinding",(function(){return gp})),n.d(t,"PropertyMixer",(function(){return sp})),n.d(t,"QuadraticBezierCurve",(function(){return ih})),n.d(t,"QuadraticBezierCurve3",(function(){return oh})),n.d(t,"Quaternion",(function(){return Jn})),n.d(t,"QuaternionKeyframeTrack",(function(){return Sl})),n.d(t,"QuaternionLinearInterpolant",(function(){return Tl})),n.d(t,"REVISION",(function(){return r})),n.d(t,"RGBADepthPacking",(function(){return un})),n.d(t,"RGBAFormat",(function(){return ke})),n.d(t,"RGBAIntegerFormat",(function(){return Qe})),n.d(t,"RGBA_ASTC_10x10_Format",(function(){return wt})),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 _t})),n.d(t,"RGBA_ASTC_12x12_Format",(function(){return Mt})),n.d(t,"RGBA_ASTC_4x4_Format",(function(){return lt})),n.d(t,"RGBA_ASTC_5x4_Format",(function(){return ht})),n.d(t,"RGBA_ASTC_5x5_Format",(function(){return pt})),n.d(t,"RGBA_ASTC_6x5_Format",(function(){return dt})),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 vt})),n.d(t,"RGBA_ASTC_8x8_Format",(function(){return gt})),n.d(t,"RGBA_BPTC_Format",(function(){return Tt})),n.d(t,"RGBA_ETC2_EAC_Format",(function(){return ut})),n.d(t,"RGBA_PVRTC_2BPPV1_Format",(function(){return at})),n.d(t,"RGBA_PVRTC_4BPPV1_Format",(function(){return ot})),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 Ge})),n.d(t,"RGBIntegerFormat",(function(){return Ke})),n.d(t,"RGBM16Encoding",(function(){return an})),n.d(t,"RGBM7Encoding",(function(){return on})),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 ol})),n.d(t,"Ray",(function(){return Kr})),n.d(t,"Raycaster",(function(){return Mp})),n.d(t,"RectAreaLight",(function(){return _h})),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 P})),n.d(t,"RingBufferGeometry",(function(){return ju})),n.d(t,"RingGeometry",(function(){return Hu})),n.d(t,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return Bt})),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 Ft})),n.d(t,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return zt})),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 Pt})),n.d(t,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return Rt})),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 df})),n.d(t,"ShaderChunk",(function(){return Bo})),n.d(t,"ShaderLib",(function(){return Fo})),n.d(t,"ShaderMaterial",(function(){return _o})),n.d(t,"ShadowMaterial",(function(){return il})),n.d(t,"Shape",(function(){return lh})),n.d(t,"ShapeBufferGeometry",(function(){return Yu})),n.d(t,"ShapeGeometry",(function(){return Xu})),n.d(t,"ShapePath",(function(){return Fh})),n.d(t,"ShapeUtils",(function(){return Ou})),n.d(t,"ShortType",(function(){return Pe})),n.d(t,"Skeleton",(function(){return fc})),n.d(t,"SkeletonHelper",(function(){return Up})),n.d(t,"SkinnedMesh",(function(){return hc})),n.d(t,"SmoothShading",(function(){return b})),n.d(t,"Sphere",(function(){return Hr})),n.d(t,"SphereBufferGeometry",(function(){return Vu})),n.d(t,"SphereGeometry",(function(){return ku})),n.d(t,"Spherical",(function(){return Ep})),n.d(t,"SphericalHarmonics3",(function(){return Mh})),n.d(t,"SphericalReflectionMapping",(function(){return he})),n.d(t,"Spline",(function(){return tf})),n.d(t,"SplineCurve",(function(){return ah})),n.d(t,"SplineCurve3",(function(){return ef})),n.d(t,"SpotLight",(function(){return mh})),n.d(t,"SpotLightHelper",(function(){return Np})),n.d(t,"SpotLightShadow",(function(){return fh})),n.d(t,"Sprite",(function(){return tc})),n.d(t,"SpriteMaterial",(function(){return Vs})),n.d(t,"SrcAlphaFactor",(function(){return B})),n.d(t,"SrcAlphaSaturateFactor",(function(){return V})),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 Xh})),n.d(t,"StreamCopyUsage",(function(){return Bn})),n.d(t,"StreamDrawUsage",(function(){return Rn})),n.d(t,"StreamReadUsage",(function(){return Dn})),n.d(t,"StringKeyframeTrack",(function(){return El})),n.d(t,"SubtractEquation",(function(){return L})),n.d(t,"SubtractiveBlending",(function(){return T})),n.d(t,"TOUCH",(function(){return o})),n.d(t,"TangentSpaceNormalMap",(function(){return ln})),n.d(t,"TetrahedronBufferGeometry",(function(){return Zc})),n.d(t,"TetrahedronGeometry",(function(){return Yc})),n.d(t,"TextBufferGeometry",(function(){return Gu})),n.d(t,"TextGeometry",(function(){return Uu})),n.d(t,"Texture",(function(){return qn})),n.d(t,"TextureLoader",(function(){return kl})),n.d(t,"TorusBufferGeometry",(function(){return su})),n.d(t,"TorusGeometry",(function(){return au})),n.d(t,"TorusKnotBufferGeometry",(function(){return ou})),n.d(t,"TorusKnotGeometry",(function(){return iu})),n.d(t,"Triangle",(function(){return pi})),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 ru})),n.d(t,"TubeGeometry",(function(){return nu})),n.d(t,"UVMapping",(function(){return ae})),n.d(t,"Uint16Attribute",(function(){return Yd})),n.d(t,"Uint16BufferAttribute",(function(){return Ri})),n.d(t,"Uint32Attribute",(function(){return Jd})),n.d(t,"Uint32BufferAttribute",(function(){return Oi})),n.d(t,"Uint8Attribute",(function(){return Wd})),n.d(t,"Uint8BufferAttribute",(function(){return Ai})),n.d(t,"Uint8ClampedAttribute",(function(){return qd})),n.d(t,"Uint8ClampedBufferAttribute",(function(){return Li})),n.d(t,"Uncharted2ToneMapping",(function(){return re})),n.d(t,"Uniform",(function(){return wp})),n.d(t,"UniformsLib",(function(){return Co})),n.d(t,"UniformsUtils",(function(){return wo})),n.d(t,"UnsignedByteType",(function(){return Ae})),n.d(t,"UnsignedInt248Type",(function(){return ze})),n.d(t,"UnsignedIntType",(function(){return Oe})),n.d(t,"UnsignedShort4444Type",(function(){return Ne})),n.d(t,"UnsignedShort5551Type",(function(){return Be})),n.d(t,"UnsignedShort565Type",(function(){return Fe})),n.d(t,"UnsignedShortType",(function(){return Re})),n.d(t,"VSMShadowMap",(function(){return m})),n.d(t,"Vector2",(function(){return Vn})),n.d(t,"Vector3",(function(){return $n})),n.d(t,"Vector4",(function(){return Xn})),n.d(t,"VectorKeyframeTrack",(function(){return Al})),n.d(t,"Vertex",(function(){return Vd})),n.d(t,"VertexColors",(function(){return Dd})),n.d(t,"VideoTexture",(function(){return Uc})),n.d(t,"WebGLCubeRenderTarget",(function(){return Eo})),n.d(t,"WebGLMultisampleRenderTarget",(function(){return Zn})),n.d(t,"WebGLRenderTarget",(function(){return Yn})),n.d(t,"WebGLRenderTargetCube",(function(){return uf})),n.d(t,"WebGLRenderer",(function(){return Ns})),n.d(t,"WebGLUtils",(function(){return Ps})),n.d(t,"WireframeGeometry",(function(){return Hc})),n.d(t,"WireframeHelper",(function(){return af})),n.d(t,"WrapAroundEnding",(function(){return Xt})),n.d(t,"XHRLoader",(function(){return sf})),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 pn})),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==0&&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},o={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},a=0,s=1,c=2,u=3,l=0,h=1,p=0,d=1,f=2,m=3,v=0,g=1,y=2,x=1,b=2,w=0,_=1,M=2,T=3,S=4,E=5,A=100,L=101,P=102,R=103,C=104,O=200,D=201,I=202,N=203,B=204,F=205,z=206,U=207,G=208,k=209,V=210,H=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,oe=5,ae=300,se=301,ce=302,ue=303,le=304,he=305,pe=306,de=307,fe=1e3,me=1001,ve=1002,ge=1003,ye=1004,xe=1004,be=1005,we=1005,_e=1006,Me=1007,Te=1007,Se=1008,Ee=1008,Ae=1009,Le=1010,Pe=1011,Re=1012,Ce=1013,Oe=1014,De=1015,Ie=1016,Ne=1017,Be=1018,Fe=1019,ze=1020,Ue=1021,Ge=1022,ke=1023,Ve=1024,He=1025,je=ke,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,ot=35842,at=35843,st=36196,ct=37492,ut=37496,lt=37808,ht=37809,pt=37810,dt=37811,ft=37812,mt=37813,vt=37814,gt=37815,yt=37816,xt=37817,bt=37818,wt=37819,_t=37820,Mt=37821,Tt=36492,St=37840,Et=37841,At=37842,Lt=37843,Pt=37844,Rt=37845,Ct=37846,Ot=37847,Dt=37848,It=37849,Nt=37850,Bt=37851,Ft=37852,zt=37853,Ut=2200,Gt=2201,kt=2202,Vt=2300,Ht=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,on=3004,an=3005,sn=3006,cn=3200,un=3201,ln=0,hn=1,pn=0,dn=7680,fn=7681,mn=7682,vn=7683,gn=34055,yn=34056,xn=5386,bn=512,wn=513,_n=514,Mn=515,Tn=516,Sn=517,En=518,An=519,Ln=35044,Pn=35048,Rn=35040,Cn=35045,On=35049,Dn=35041,In=35046,Nn=35050,Bn=35042;function Fn(){}Object.assign(Fn.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 zn=[],Un=0;Un<256;Un++)zn[Un]=(Un<16?"0":"")+Un.toString(16);var Gn,kn={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(zn[255&e]+zn[e>>8&255]+zn[e>>16&255]+zn[e>>24&255]+"-"+zn[255&t]+zn[t>>8&255]+"-"+zn[t>>16&15|64]+zn[t>>24&255]+"-"+zn[63&n|128]+zn[n>>8&255]+"-"+zn[n>>16&255]+zn[n>>24&255]+zn[255&r]+zn[r>>8&255]+zn[r>>16&255]+zn[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*kn.DEG2RAD},radToDeg:function(e){return e*kn.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 o=Math.cos,a=Math.sin,s=o(n/2),c=a(n/2),u=o((t+r)/2),l=a((t+r)/2),h=o((t-r)/2),p=a((t-r)/2),d=o((r-t)/2),f=a((r-t)/2);switch(i){case"XYX":e.set(s*l,c*h,c*p,s*u);break;case"YZY":e.set(c*p,s*l,c*h,s*u);break;case"ZXZ":e.set(c*h,c*p,s*l,s*u);break;case"XZX":e.set(s*l,c*f,c*d,s*u);break;case"YXY":e.set(c*d,s*l,c*f,s*u);break;case"ZYZ":e.set(c*f,c*d,s*l,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};function Vn(e,t){this.x=e||0,this.y=t||0}function Hn(){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(Vn.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(Vn.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,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(Hn.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,o,a,s,c){var u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(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,o=n[0],a=n[3],s=n[6],c=n[1],u=n[4],l=n[7],h=n[2],p=n[5],d=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=o*f+a*g+s*b,i[3]=o*m+a*y+s*w,i[6]=o*v+a*x+s*_,i[1]=c*f+u*g+l*b,i[4]=c*m+u*y+l*w,i[7]=c*v+u*x+l*_,i[2]=h*f+p*g+d*b,i[5]=h*m+p*y+d*w,i[8]=h*v+p*x+d*_,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],o=e[4],a=e[5],s=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*i*u+n*a*s+r*i*c-r*o*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],o=n[1],a=n[2],s=n[3],c=n[4],u=n[5],l=n[6],h=n[7],p=n[8],d=p*c-u*h,f=u*l-p*s,m=h*s-c*l,v=i*d+o*f+a*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return r[0]=d*g,r[1]=(a*h-p*o)*g,r[2]=(u*o-a*c)*g,r[3]=f*g,r[4]=(p*i-a*l)*g,r[5]=(a*s-u*i)*g,r[6]=m*g,r[7]=(o*l-h*i)*g,r[8]=(c*i-o*s)*g,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,o,a){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*o+c*a)+o+e,-r*c,r*s,-r*(-c*o+s*a)+a+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],o=r[3],a=r[6],s=r[1],c=r[4],u=r[7];return r[0]=t*i+n*s,r[3]=t*o+n*c,r[6]=t*a+n*u,r[1]=-n*i+t*s,r[4]=-n*o+t*c,r[7]=-n*a+t*u,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===Gn&&(Gn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Gn.width=e.width,Gn.height=e.height;var n=Gn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Gn}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,o,a,s,c,u){Object.defineProperty(this,"id",{value:Wn++}),this.uuid=kn.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:_e,this.minFilter=void 0!==o?o:Se,this.anisotropy=void 0!==c?c:1,this.format=void 0!==a?a:ke,this.internalFormat=null,this.type=void 0!==s?s:Ae,this.offset=new Vn(0,0),this.repeat=new Vn(1,1),this.center=new Vn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Hn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:$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:_e,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=ae,qn.prototype=Object.assign(Object.create(Fn.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=kn.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var o=0,a=r.length;o<a;o++)i.push(jn.getDataURL(r[o]))}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!==ae)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 ve: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 ve: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,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[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,o=e.elements,a=o[0],s=o[4],c=o[8],u=o[1],l=o[5],h=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(c-p)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+p)<.1&&Math.abs(h+d)<.1&&Math.abs(a+l+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+u)/4,x=(c+p)/4,b=(h+d)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=x/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(v)),i=b/r):g<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=b/i),this.set(n,r,i,t),this}var w=Math.sqrt((d-h)*(d-h)+(c-p)*(c-p)+(u-s)*(u-s));return Math.abs(w)<.001&&(w=1),this.x=(d-h)/w,this.y=(c-p)/w,this.z=(u-s)/w,this.w=Math.acos((a+l+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(Fn.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,o,a){var s=n[r+0],c=n[r+1],u=n[r+2],l=n[r+3],h=i[o+0],p=i[o+1],d=i[o+2],f=i[o+3];if(l!==f||s!==h||c!==p||u!==d){var m=1-a,v=s*h+c*p+u*d+l*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+h*w,c=c*m+p*w,u=u*m+d*w,l=l*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+u*u+l*l);s*=_,c*=_,u*=_,l*=_}}e[t]=s,e[t+1]=c,e[t+2]=u,e[t+3]=l},multiplyQuaternionsFlat:function(e,t,n,r,i,o){var a=n[r],s=n[r+1],c=n[r+2],u=n[r+3],l=i[o],h=i[o+1],p=i[o+2],d=i[o+3];return e[t]=a*d+u*l+s*p-c*h,e[t+1]=s*d+u*h+c*l-a*p,e[t+2]=c*d+u*p+a*h-s*l,e[t+3]=u*d-a*l-s*h-c*p,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,o=e.order,a=Math.cos,s=Math.sin,c=a(n/2),u=a(r/2),l=a(i/2),h=s(n/2),p=s(r/2),d=s(i/2);switch(o){case"XYZ":this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d;break;case"YXZ":this._x=h*u*l+c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d;break;case"ZXY":this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l-h*p*d;break;case"ZYX":this._x=h*u*l-c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l+h*p*d;break;case"YZX":this._x=h*u*l+c*p*d,this._y=c*p*l+h*u*d,this._z=c*u*d-h*p*l,this._w=c*u*l-h*p*d;break;case"XZY":this._x=h*u*l-c*p*d,this._y=c*p*l-h*u*d,this._z=c*u*d+h*p*l,this._w=c*u*l+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=n[8],a=n[1],s=n[5],c=n[9],u=n[2],l=n[6],h=n[10],p=r+s+h;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-u)*t,this._z=(a-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(l-c)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+u)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(o-u)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(a-i)/t,this._x=(o+u)/t,this._y=(c+l)/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(kn.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,o=e._w,a=t._x,s=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-i*s,this._y=r*u+o*s+i*a-n*c,this._z=i*u+o*c+n*s-r*a,this._w=o*u-n*a-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,o=this._w,a=o*e._w+n*e._x+r*e._y+i*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=1-a*a;if(s<=Number.EPSILON){var c=1-t;return this._w=c*o+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 u=Math.sqrt(s),l=Math.atan2(u,a),h=Math.sin((1-t)*l)/u,p=Math.sin(t*l)/u;return this._w=o*h+this._w*p,this._x=n*h+this._x*p,this._y=r*h+this._y*p,this._z=i*h+this._z*p,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,o=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])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*r-a*n,u=s*n+a*t-i*r,l=s*r+i*n-o*t,h=-i*t-o*n-a*r;return this.x=c*s+h*-i+u*-a-l*-o,this.y=u*s+h*-o+l*-i-c*-a,this.z=l*s+h*-a+c*-o-u*-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,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,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(kn.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,or=new $n,ar=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,o,a,s,c,u,l,h,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=u,v[10]=l,v[14]=h,v[3]=p,v[7]=d,v[11]=f,v[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(),o=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]*o,t[9]=n[9]*o,t[10]=n[10]*o,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,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),c=Math.sin(r),u=Math.cos(i),l=Math.sin(i);if("XYZ"===e.order){var h=o*u,p=o*l,d=a*u,f=a*l;t[0]=s*u,t[4]=-s*l,t[8]=c,t[1]=p+d*c,t[5]=h-f*c,t[9]=-a*s,t[2]=f-h*c,t[6]=d+p*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*u,v=s*l,g=c*u,y=c*l;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*l,t[5]=o*u,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order)m=s*u,v=s*l,g=c*u,y=c*l,t[0]=m-y*a,t[4]=-o*l,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*u,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s;else if("ZYX"===e.order)h=o*u,p=o*l,d=a*u,f=a*l,t[0]=s*u,t[4]=d*c-p,t[8]=h*c+f,t[1]=s*l,t[5]=f*c+h,t[9]=p*c-d,t[2]=-c,t[6]=a*s,t[10]=o*s;else if("YZX"===e.order){var x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*u,t[4]=_-x*l,t[8]=w*l+b,t[1]=l,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=b*l+w,t[10]=x-_*l}else"XZY"===e.order&&(x=o*s,b=o*c,w=a*s,_=a*c,t[0]=s*u,t[4]=-l,t[8]=c*u,t[1]=x*l+_,t[5]=o*u,t[9]=b*l-w,t[2]=w*l-b,t[6]=a*u,t[10]=_*l+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 ar.subVectors(e,t),0===ar.lengthSq()&&(ar.z=1),ar.normalize(),ir.crossVectors(n,ar),0===ir.lengthSq()&&(1===Math.abs(n.z)?ar.x+=1e-4:ar.z+=1e-4,ar.normalize(),ir.crossVectors(n,ar)),ir.normalize(),or.crossVectors(ar,ir),r[0]=ir.x,r[4]=or.x,r[8]=ar.x,r[1]=ir.y,r[5]=or.y,r[9]=ar.y,r[2]=ir.z,r[6]=or.z,r[10]=ar.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,o=n[0],a=n[4],s=n[8],c=n[12],u=n[1],l=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],T=r[12],S=r[1],E=r[5],A=r[9],L=r[13],P=r[2],R=r[6],C=r[10],O=r[14],D=r[3],I=r[7],N=r[11],B=r[15];return i[0]=o*w+a*S+s*P+c*D,i[4]=o*_+a*E+s*R+c*I,i[8]=o*M+a*A+s*C+c*N,i[12]=o*T+a*L+s*O+c*B,i[1]=u*w+l*S+h*P+p*D,i[5]=u*_+l*E+h*R+p*I,i[9]=u*M+l*A+h*C+p*N,i[13]=u*T+l*L+h*O+p*B,i[2]=d*w+f*S+m*P+v*D,i[6]=d*_+f*E+m*R+v*I,i[10]=d*M+f*A+m*C+v*N,i[14]=d*T+f*L+m*O+v*B,i[3]=g*w+y*S+x*P+b*D,i[7]=g*_+y*E+x*R+b*I,i[11]=g*M+y*A+x*C+b*N,i[15]=g*T+y*L+x*O+b*B,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],o=e[1],a=e[5],s=e[9],c=e[13],u=e[2],l=e[6],h=e[10],p=e[14];return e[3]*(+i*s*l-r*c*l-i*a*h+n*c*h+r*a*p-n*s*p)+e[7]*(+t*s*p-t*c*h+i*o*h-r*o*p+r*c*u-i*s*u)+e[11]*(+t*c*l-t*a*p-i*o*l+n*o*p+i*a*u-n*c*u)+e[15]*(-r*a*u-t*s*l+t*a*h+r*o*l-n*o*h+n*s*u)},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],o=r[1],a=r[2],s=r[3],c=r[4],u=r[5],l=r[6],h=r[7],p=r[8],d=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],b=d*y*h-g*f*h+g*l*m-u*y*m-d*l*x+u*f*x,w=v*f*h-p*y*h-v*l*m+c*y*m+p*l*x-c*f*x,_=p*g*h-v*d*h+v*u*m-c*g*m-p*u*x+c*d*x,M=v*d*l-p*g*l-v*u*f+c*g*f+p*u*y-c*d*y,T=i*b+o*w+a*_+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]=(g*f*s-d*y*s-g*a*m+o*y*m+d*a*x-o*f*x)*S,n[2]=(u*y*s-g*l*s+g*a*h-o*y*h-u*a*x+o*l*x)*S,n[3]=(d*l*s-u*f*s-d*a*h+o*f*h+u*a*m-o*l*m)*S,n[4]=w*S,n[5]=(p*y*s-v*f*s+v*a*m-i*y*m-p*a*x+i*f*x)*S,n[6]=(v*l*s-c*y*s-v*a*h+i*y*h+c*a*x-i*l*x)*S,n[7]=(c*f*s-p*l*s+p*a*h-i*f*h-c*a*m+i*l*m)*S,n[8]=_*S,n[9]=(v*d*s-p*g*s-v*o*m+i*g*m+p*o*x-i*d*x)*S,n[10]=(c*g*s-v*u*s+v*o*h-i*g*h-c*o*x+i*u*x)*S,n[11]=(p*u*s-c*d*s-p*o*h+i*d*h+c*o*m-i*u*m)*S,n[12]=M*S,n[13]=(p*g*a-v*d*a+v*o*f-i*g*f-p*o*y+i*d*y)*S,n[14]=(v*u*a-c*g*a-v*o*l+i*g*l+c*o*y-i*u*y)*S,n[15]=(c*d*a-p*u*a+p*o*l-i*d*l-c*o*f+i*u*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,o=e.x,a=e.y,s=e.z,c=i*o,u=i*a;return this.set(c*o+n,c*a-r*s,c*s+r*a,0,c*a+r*s,u*a+n,u*s-r*o,0,c*s-r*a,u*s+r*o,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,o=t._y,a=t._z,s=t._w,c=i+i,u=o+o,l=a+a,h=i*c,p=i*u,d=i*l,f=o*u,m=o*l,v=a*l,g=s*c,y=s*u,x=s*l,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+v))*b,r[1]=(p+x)*b,r[2]=(d-y)*b,r[3]=0,r[4]=(p-x)*w,r[5]=(1-(h+v))*w,r[6]=(m+g)*w,r[7]=0,r[8]=(d+y)*_,r[9]=(m-g)*_,r[10]=(1-(h+f))*_,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(),o=er.set(r[4],r[5],r[6]).length(),a=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/o,u=1/a;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]*=u,tr.elements[9]*=u,tr.elements[10]*=u,t.setFromRotationMatrix(tr),n.x=i,n.y=o,n.z=a,this},makePerspective:function(e,t,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(t-e),c=2*i/(n-r),u=(t+e)/(t-e),l=(n+r)/(n-r),h=-(o+i)/(o-i),p=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(e,t,n,r,i,o){var a=this.elements,s=1/(t-e),c=1/(n-r),u=1/(o-i),l=(t+e)*s,h=(n+r)*c,p=(o+i)*u;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[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,ur=new Jn;function lr(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||lr.DefaultOrder}function hr(){this.mask=1}lr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],lr.DefaultOrder="XYZ",Object.defineProperties(lr.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(lr.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=kn.clamp,i=e.elements,o=i[0],a=i[4],s=i[8],c=i[1],u=i[5],l=i[9],h=i[2],p=i[6],d=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(-l,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,o));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,d),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 ur.setFromEuler(this),this.setFromQuaternion(ur,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 pr=0;const dr=new $n,fr=new Jn,mr=new sr,vr=new $n,gr=new $n,yr=new $n,xr=new Jn,br=new $n(1,0,0),wr=new $n(0,1,0),_r=new $n(0,0,1),Mr={type:"added"},Tr={type:"removed"};function Sr(){Object.defineProperty(this,"id",{value:pr++}),this.uuid=kn.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Sr.DefaultUp.clone();var e=new $n,t=new lr,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 Hn}}),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(Fn.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(wr,e)},rotateZ:function(e){return this.rotateOnAxis(_r,e)},translateOnAxis:function(e,t){return dr.copy(e).applyQuaternion(this.quaternion),this.position.add(dr.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(br,e)},translateY:function(e){return this.translateOnAxis(wr,e)},translateZ:function(e){return this.translateOnAxis(_r,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?vr.copy(e):vr.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),gr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mr.lookAt(gr,vr,this.up):mr.lookAt(vr,gr,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(gr,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(gr,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,o=r.length;i<o;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 o=this.geometry.parameters;if(void 0!==o&&void 0!==o.shapes){var a=o.shapes;if(Array.isArray(a))for(var s=0,c=a.length;s<c;s++){var u=a[s];i(e.shapes,u)}else i(e.shapes,a)}}if(void 0!==this.material)if(Array.isArray(this.material)){var l=[];for(s=0,c=this.material.length;s<c;s++)l.push(i(e.materials,this.material[s]));r.material=l}else r.material=i(e.materials,this.material);if(this.children.length>0)for(r.children=[],s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object);if(t){var h=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);a=m(e.shapes),h.length>0&&(n.geometries=h),p.length>0&&(n.materials=p),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),a.length>0&&(n.shapes=a)}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,Pr=new Gr,Rr=new $n,Cr=new $n,Or=new $n,Dr=new $n,Ir=new $n,Nr=new $n,Br=new $n,Fr=new $n,zr=new $n,Ur=new $n;function Gr(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 kr(e,t,n,r,i){var o,a;for(o=0,a=e.length-3;o<=a;o+=3){Ur.fromArray(e,o);var s=i.x*Math.abs(Ur.x)+i.y*Math.abs(Ur.y)+i.z*Math.abs(Ur.z),c=t.dot(Ur),u=n.dot(Ur),l=r.dot(Ur);if(Math.max(-Math.max(c,u,l),Math.min(c,u,l))>s)return!1}return!0}Object.assign(Gr.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,o=-1/0,a=-1/0,s=0,c=e.length;s<c;s+=3){var u=e[s],l=e[s+1],h=e[s+2];u<t&&(t=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(t,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;s<c;s++){var u=e.getX(s),l=e.getY(s),h=e.getZ(s);u<t&&(t=u),l<n&&(n=l),h<r&&(r=h),u>i&&(i=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(t,n,r),this.max.set(i,o,a),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(),Pr.copy(t.boundingBox),Pr.applyMatrix4(e.matrixWorld),this.union(Pr));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(Br),Fr.subVectors(this.max,Br),Rr.subVectors(e.a,Br),Cr.subVectors(e.b,Br),Or.subVectors(e.c,Br),Dr.subVectors(Cr,Rr),Ir.subVectors(Or,Cr),Nr.subVectors(Rr,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!!kr(t,Rr,Cr,Or,Fr)&&!!kr(t=[1,0,0,0,1,0,0,0,1],Rr,Cr,Or,Fr)&&(zr.crossVectors(Dr,Ir),kr(t=[zr.x,zr.y,zr.z],Rr,Cr,Or,Fr))},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 Vr=new Gr;function Hr(e,t){this.center=void 0!==e?e:new $n,this.radius=void 0!==t?t:-1}Object.assign(Hr.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):Vr.setFromPoints(e).getCenter(n);for(var r=0,i=0,o=e.length;i<o;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 Gr),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,o,a,s,c=.5*e.distanceTo(t),u=-this.direction.dot(qr),l=Xr.dot(this.direction),h=-Xr.dot(qr),p=Xr.lengthSq(),d=Math.abs(1-u*u);if(d>0)if(o=u*l-h,s=c*d,(i=u*h-l)>=0)if(o>=-s)if(o<=s){var f=1/d;a=(i*=f)*(i+u*(o*=f)+2*l)+o*(u*i+o+2*h)+p}else o=c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;else o=-c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;else o<=-s?a=-(i=Math.max(0,-(-u*c+l)))*i+(o=i>0?-c:Math.min(Math.max(-c,-h),c))*(o+2*h)+p:o<=s?(i=0,a=(o=Math.min(Math.max(-c,-h),c))*(o+2*h)+p):a=-(i=Math.max(0,-(u*c+l)))*i+(o=i>0?c:Math.min(Math.max(-c,-h),c))*(o+2*h)+p;else o=u>0?-c:c,a=-(i=Math.max(0,-(u*o+l)))*i+o*(o+2*h)+p;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(qr).multiplyScalar(o).add(Wr),a},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 o=Math.sqrt(i-r),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,t):this.at(a,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,o,a,s,c=1/this.direction.x,u=1/this.direction.y,l=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),u>=0?(i=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),l>=0?(a=(e.min.z-h.z)*l,s=(e.max.z-h.z)*l):(a=(e.max.z-h.z)*l,s=(e.min.z-h.z)*l),n>s||a>r?null:((a>n||n!=n)&&(n=a),(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 o,a=this.direction.dot(Jr);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Xr.subVectors(this.origin,e);var s=o*this.direction.dot(Zr.crossVectors(Xr,Zr));if(s<0)return null;var c=o*this.direction.dot(Yr.cross(Xr));if(c<0)return null;if(s+c>a)return null;var u=-o*Xr.dot(Jr);return u<0?null:this.at(u/a,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 Hn;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,oi=new $n,ai=new $n,si=new $n,ci=new $n,ui=new $n,li=new $n,hi=new $n;function pi(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(pi,{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 o=ni.dot(ni),a=ni.dot(ri),s=ni.dot(ii),c=ri.dot(ri),u=ri.dot(ii),l=o*c-a*a;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new $n),0===l)return i.set(-2,-1,-1);var h=1/l,p=(c*s-a*u)*h,d=(o*u-a*s)*h;return i.set(1-p-d,d,p)},containsPoint:function(e,t,n,r){return pi.getBarycoord(e,t,n,r,oi),oi.x>=0&&oi.y>=0&&oi.x+oi.y<=1},getUV:function(e,t,n,r,i,o,a,s){return this.getBarycoord(e,t,n,r,oi),s.set(0,0),s.addScaledVector(i,oi.x),s.addScaledVector(o,oi.y),s.addScaledVector(a,oi.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(pi.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 pi.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 pi.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return pi.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return pi.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return pi.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,o=this.b,a=this.c;ai.subVectors(o,i),si.subVectors(a,i),ui.subVectors(e,i);var s=ai.dot(ui),c=si.dot(ui);if(s<=0&&c<=0)return t.copy(i);li.subVectors(e,o);var u=ai.dot(li),l=si.dot(li);if(u>=0&&l<=u)return t.copy(o);var h=s*l-u*c;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(ai,n);hi.subVectors(e,a);var p=ai.dot(hi),d=si.dot(hi);if(d>=0&&p<=d)return t.copy(a);var f=p*c-s*d;if(f<=0&&c>=0&&d<=0)return r=c/(c-d),t.copy(i).addScaledVector(si,r);var m=u*d-p*l;if(m<=0&&l-u>=0&&p-d>=0)return ci.subVectors(a,o),r=(l-u)/(l-u+(p-d)),t.copy(o).addScaledVector(ci,r);var v=1/(m+f+h);return n=f*v,r=h*v,t.copy(i).addScaledVector(ai,n).addScaledVector(si,r)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var di={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 vi(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function gi(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,o){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 vi,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}Object.assign(vi.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=kn.euclideanModulo(e,1),t=kn.clamp(t,0,1),n=kn.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=gi(i,r,e+1/3),this.g=gi(i,r,e),this.b=gi(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],o=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(o))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(o))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(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u=n[1],l=u.length;if(3===l)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=di[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,o=this.b,a=Math.max(r,i,o),s=Math.min(r,i,o),c=(s+a)/2;if(s===a)t=0,n=0;else{var u=a-s;switch(n=c<=.5?u/(a+s):u/(2-a-s),a){case r:t=(i-o)/u+(i<o?6:0);break;case i:t=(o-r)/u+2;break;case o:t=(r-i)/u+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=kn.lerp(fi.h,mi.h,t),r=kn.lerp(fi.s,mi.s,t),i=kn.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()}}),vi.NAMES=di,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 wi=0;function _i(){Object.defineProperty(this,"id",{value:wi++}),this.uuid=kn.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=_,this.side=v,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=B,this.blendDst=F,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=dn,this.stencilZFail=dn,this.stencilZPass=dn,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){_i.call(this),this.type="MeshBasicMaterial",this.color=new vi(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)}_i.prototype=Object.assign(Object.create(Fn.prototype),{constructor:_i,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!==_&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==v&&(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),o=r(e.images);i.length>0&&(n.textures=i),o.length>0&&(n.images=o)}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(_i.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Mi.prototype=Object.create(_i.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isMeshBasicMaterial=!0,Mi.prototype.copy=function(e){return _i.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 Pi(e,t,n){Si.call(this,new Int16Array(e),t,n)}function Ri(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 Bi(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 o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),o=new vi),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new Vn),t[n++]=o.x,t[n++]=o.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),o=new $n),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var o=e[r];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),o=new Xn),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.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,Pi.prototype=Object.create(Si.prototype),Pi.prototype.constructor=Pi,Ri.prototype=Object.create(Si.prototype),Ri.prototype.constructor=Ri,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,o=0;o<i.length;o++){var a=i[o];a.materialIndex!==r&&(r=a.materialIndex,void 0!==t&&(t.count=3*o-t.start,n.push(t)),t={start:3*o,materialIndex:r})}void 0!==t&&(t.count=3*o-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,o=i[0]&&i[0].length>0,a=i[1]&&i[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var u=0;u<c;u++)t[u]={name:s[u].name,data:[]};this.morphTargets.position=t}var l,h=e.morphNormals,p=h.length;if(p>0){for(l=[],u=0;u<p;u++)l[u]={name:h[u].name,data:[]};this.morphTargets.normal=l}var d=e.skinIndices,f=e.skinWeights,m=d.length===r.length,v=f.length===r.length;for(r.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported."),u=0;u<n.length;u++){var g=n[u];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}!0===o&&(void 0!==(b=i[0][u])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",u),this.uvs.push(new Vn,new Vn,new Vn))),!0===a&&(void 0!==(b=i[1][u])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",u),this.uvs2.push(new Vn,new Vn,new Vn)));for(var M=0;M<c;M++){var T=s[M].vertices;t[M].data.push(T[g.a],T[g.b],T[g.c])}for(M=0;M<p;M++){var S=h[M].vertexNormals[u];l[M].data.push(S.a,S.b,S.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.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 Fi=1,zi=new sr,Ui=new Sr,Gi=new $n,ki=new Gr,Vi=new Gr,Hi=new $n;function ji(){Object.defineProperty(this,"id",{value:Fi+=2}),this.uuid=kn.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(Fn.prototype),{constructor:ji,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Bi(e)>65535?Oi:Ri)(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 Hn).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 zi.makeRotationX(e),this.applyMatrix4(zi),this},rotateY:function(e){return zi.makeRotationY(e),this.applyMatrix4(zi),this},rotateZ:function(e){return zi.makeRotationZ(e),this.applyMatrix4(zi),this},translate:function(e,t,n){return zi.makeTranslation(e,t,n),this.applyMatrix4(zi),this},scale:function(e,t,n){return zi.makeScale(e,t,n),this.applyMatrix4(zi),this},lookAt:function(e){return Ui.lookAt(e),Ui.updateMatrix(),this.applyMatrix4(Ui.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Gi).negate(),this.translate(Gi.x,Gi.y,Gi.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 o=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Si(o,2).copyVector2sArray(e.uvs2))}for(var a in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[a],u=0,l=c.length;u<l;u++){var h=c[u],p=new Di(3*h.data.length,3);p.name=h.name,s.push(p.copyVector3sArray(h.data))}this.morphAttributes[a]=s}if(e.skinIndices.length>0){var d=new Di(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.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 Gr);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];ki.setFromBufferAttribute(i),this.morphTargetsRelative?(Hi.addVectors(this.boundingBox.min,ki.min),this.boundingBox.expandByPoint(Hi),Hi.addVectors(this.boundingBox.max,ki.max),this.boundingBox.expandByPoint(Hi)):(this.boundingBox.expandByPoint(ki.min),this.boundingBox.expandByPoint(ki.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 Hr);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(ki.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var o=t[r];Vi.setFromBufferAttribute(o),this.morphTargetsRelative?(Hi.addVectors(ki.min,Vi.min),ki.expandByPoint(Hi),Hi.addVectors(ki.max,Vi.max),ki.expandByPoint(Hi)):(ki.expandByPoint(Vi.min),ki.expandByPoint(Vi.max))}ki.getCenter(n);var a=0;for(r=0,i=e.count;r<i;r++)Hi.fromBufferAttribute(e,r),a=Math.max(a,n.distanceToSquared(Hi));if(t)for(r=0,i=t.length;r<i;r++){o=t[r];for(var s=this.morphTargetsRelative,c=0,u=o.count;c<u;c++)Hi.fromBufferAttribute(o,c),s&&(Gi.fromBufferAttribute(e,c),Hi.add(Gi)),a=Math.max(a,n.distanceToSquared(Hi))}this.boundingSphere.radius=Math.sqrt(a),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,o=r.length;i<o;i++)r[i]=0;var a,s,c,u=t.normal.array,l=new $n,h=new $n,p=new $n,d=new $n,f=new $n;if(e){var m=e.array;for(i=0,o=e.count;i<o;i+=3)a=3*m[i+0],s=3*m[i+1],c=3*m[i+2],l.fromArray(n,a),h.fromArray(n,s),p.fromArray(n,c),d.subVectors(p,h),f.subVectors(l,h),d.cross(f),u[a]+=d.x,u[a+1]+=d.y,u[a+2]+=d.z,u[s]+=d.x,u[s+1]+=d.y,u[s+2]+=d.z,u[c]+=d.x,u[c+1]+=d.y,u[c+2]+=d.z}else for(i=0,o=n.length;i<o;i+=9)l.fromArray(n,i),h.fromArray(n,i+3),p.fromArray(n,i+6),d.subVectors(p,h),f.subVectors(l,h),d.cross(f),u[i]=d.x,u[i+1]=d.y,u[i+2]=d.z,u[i+3]=d.x,u[i+4]=d.y,u[i+5]=d.z,u[i+6]=d.x,u[i+7]=d.y,u[i+8]=d.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,o=e.attributes[r],a=o.array,s=o.itemSize*t,c=Math.min(a.length,i.length-s),u=0,l=s;u<c;u++,l++)i[l]=a[u];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++)Hi.x=e.getX(t),Hi.y=e.getY(t),Hi.z=e.getZ(t),Hi.normalize(),e.setXYZ(t,Hi.x,Hi.y,Hi.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,o=new n.constructor(t.length*r),a=0,s=0,c=0,u=t.length;c<u;c++){a=t[c]*r;for(var l=0;l<r;l++)o[s++]=n[a++]}return new Si(o,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 o=e(r[i],n);t.setAttribute(i,o)}var a=this.morphAttributes;for(i in a){for(var s=[],c=a[i],u=0,l=c.length;u<l;u++)o=e(c[u],n),s.push(o);t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var h=this.groups,p=(u=0,h.length);u<p;u++){var d=h[u];t.addGroup(d.start,d.count,d.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 o=(p=i[n]).toJSON();""!==p.name&&(o.name=p.name),e.data.attributes[n]=o}var a={},s=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],u=[],l=0,h=c.length;l<h;l++){var p;o=(p=c[l]).toJSON(),""!==p.name&&(o.name=p.name),u.push(o)}u.length>0&&(a[n]=u,s=!0)}s&&(e.data.morphAttributes=a,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));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 o=e.attributes;for(t in o){var a=o[t];this.setAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],u=s[t];for(n=0,r=u.length;n<r;n++)c.push(u[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var l=e.groups;for(n=0,r=l.length;n<r;n++){var h=l[n];this.addGroup(h.start,h.count,h.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.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 Hr,Yi=new $n,Zi=new $n,Ji=new $n,Ki=new $n,Qi=new $n,$i=new $n,eo=new $n,to=new $n,no=new $n,ro=new Vn,io=new Vn,oo=new Vn,ao=new $n,so=new $n;function co(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 uo(e,t,n,r,i,o,a,s){if(null===(t.side===g?r.intersectTriangle(a,o,i,!0,s):r.intersectTriangle(i,o,a,t.side!==y,s)))return null;so.copy(s),so.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(so);return c<n.near||c>n.far?null:{distance:c,point:so.clone(),object:e}}function lo(e,t,n,r,i,o,a,s,c,u,l,h){Yi.fromBufferAttribute(i,u),Zi.fromBufferAttribute(i,l),Ji.fromBufferAttribute(i,h);var p=e.morphTargetInfluences;if(t.morphTargets&&o&&p){eo.set(0,0,0),to.set(0,0,0),no.set(0,0,0);for(var d=0,f=o.length;d<f;d++){var m=p[d],v=o[d];0!==m&&(Ki.fromBufferAttribute(v,u),Qi.fromBufferAttribute(v,l),$i.fromBufferAttribute(v,h),a?(eo.addScaledVector(Ki,m),to.addScaledVector(Qi,m),no.addScaledVector($i,m)):(eo.addScaledVector(Ki.sub(Yi),m),to.addScaledVector(Qi.sub(Zi),m),no.addScaledVector($i.sub(Ji),m)))}Yi.add(eo),Zi.add(to),Ji.add(no)}e.isSkinnedMesh&&(e.boneTransform(u,Yi),e.boneTransform(l,Zi),e.boneTransform(h,Ji));var g=uo(e,t,n,r,Yi,Zi,Ji,ao);if(g){s&&(ro.fromBufferAttribute(s,u),io.fromBufferAttribute(s,l),oo.fromBufferAttribute(s,h),g.uv=pi.getUV(ao,Yi,Zi,Ji,ro,io,oo,new Vn)),c&&(ro.fromBufferAttribute(c,u),io.fromBufferAttribute(c,l),oo.fromBufferAttribute(c,h),g.uv2=pi.getUV(ao,Yi,Zi,Ji,ro,io,oo,new Vn));var y=new bi(u,l,h);pi.getNormal(Yi,Zi,Ji,y.normal),g.face=y}return g}co.prototype=Object.assign(Object.create(Sr.prototype),{constructor:co,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,o=Object.keys(i);if(o.length>0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[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,o=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),Xi.copy(r.boundingSphere),Xi.applyMatrix4(o),!1!==e.ray.intersectsSphere(Xi)&&(Wi.getInverse(o),qi.copy(e.ray).applyMatrix4(Wi),null===r.boundingBox||!1!==qi.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var a,s,c,u,l,h,p,d,f,m=r.index,v=r.attributes.position,g=r.morphAttributes.position,y=r.morphTargetsRelative,x=r.attributes.uv,b=r.attributes.uv2,w=r.groups,_=r.drawRange;if(null!==m)if(Array.isArray(i))for(u=0,h=w.length;u<h;u++)for(f=i[(d=w[u]).materialIndex],l=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);l<p;l+=3)a=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(n=lo(this,f,e,qi,v,g,y,x,b,a,s,c))&&(n.faceIndex=Math.floor(l/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(u=Math.max(0,_.start),h=Math.min(m.count,_.start+_.count);u<h;u+=3)a=m.getX(u),s=m.getX(u+1),c=m.getX(u+2),(n=lo(this,i,e,qi,v,g,y,x,b,a,s,c))&&(n.faceIndex=Math.floor(u/3),t.push(n));else if(void 0!==v)if(Array.isArray(i))for(u=0,h=w.length;u<h;u++)for(f=i[(d=w[u]).materialIndex],l=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);l<p;l+=3)(n=lo(this,f,e,qi,v,g,y,x,b,a=l,s=l+1,c=l+2))&&(n.faceIndex=Math.floor(l/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(u=Math.max(0,_.start),h=Math.min(v.count,_.start+_.count);u<h;u+=3)(n=lo(this,i,e,qi,v,g,y,x,b,a=u,s=u+1,c=u+2))&&(n.faceIndex=Math.floor(u/3),t.push(n))}else if(r.isGeometry){var M,T,S,E,A=Array.isArray(i),L=r.vertices,P=r.faces,R=r.faceVertexUvs[0];R.length>0&&(E=R);for(var C=0,O=P.length;C<O;C++){var D=P[C],I=A?i[D.materialIndex]:i;if(void 0!==I&&(M=L[D.a],T=L[D.b],S=L[D.c],n=uo(this,I,e,qi,M,T,S,ao))){if(E&&E[C]){var N=E[C];ro.copy(N[0]),io.copy(N[1]),oo.copy(N[2]),n.uv=pi.getUV(ao,M,T,S,ro,io,oo,new Vn)}n.face=D,n.faceIndex=C,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var ho=0,po=new sr,fo=new Sr,mo=new $n;function vo(){Object.defineProperty(this,"id",{value:ho+=2}),this.uuid=kn.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}vo.prototype=Object.assign(Object.create(Fn.prototype),{constructor:vo,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Hn).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 o=0,a=i.vertexNormals.length;o<a;o++)i.vertexNormals[o].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 po.makeRotationX(e),this.applyMatrix4(po),this},rotateY:function(e){return po.makeRotationY(e),this.applyMatrix4(po),this},rotateZ:function(e){return po.makeRotationZ(e),this.applyMatrix4(po),this},translate:function(e,t,n){return po.makeTranslation(e,t,n),this.applyMatrix4(po),this},scale:function(e,t,n){return po.makeScale(e,t,n),this.applyMatrix4(po),this},lookAt:function(e){return fo.lookAt(e),fo.updateMatrix(),this.applyMatrix4(fo.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,o=void 0!==r.normal?r.normal.array:void 0,a=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 u=0;u<i.length;u+=3)t.vertices.push((new $n).fromArray(i,u)),void 0!==a&&t.colors.push((new vi).fromArray(a,u));function l(e,n,r,i){var u=void 0===a?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],l=new bi(e,n,r,void 0===o?[]:[(new $n).fromArray(o,3*e),(new $n).fromArray(o,3*n),(new $n).fromArray(o,3*r)],u,i);t.faces.push(l),void 0!==s&&t.faceVertexUvs[0].push([(new Vn).fromArray(s,2*e),(new Vn).fromArray(s,2*n),(new Vn).fromArray(s,2*r)]),void 0!==c&&t.faceVertexUvs[1].push([(new Vn).fromArray(c,2*e),(new Vn).fromArray(c,2*n),(new Vn).fromArray(c,2*r)])}var h=e.groups;if(h.length>0)for(u=0;u<h.length;u++)for(var p=h[u],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==n?l(n[f],n[f+1],n[f+2],p.materialIndex):l(f,f+1,f+2,p.materialIndex);else if(void 0!==n)for(u=0;u<n.length;u+=3)l(n[u],n[u+1],n[u+2]);else for(u=0;u<i.length/3;u+=3)l(u,u+1,u+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(mo).negate(),this.translate(mo.x,mo.y,mo.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],o=this.vertices[i.a],a=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,a),t.subVectors(o,a),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,o,a;for(void 0===e&&(e=!0),a=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)a[t]=new $n;if(e){var s,c,u,l=new $n,h=new $n;for(r=0,i=this.faces.length;r<i;r++)o=this.faces[r],s=this.vertices[o.a],c=this.vertices[o.b],u=this.vertices[o.c],l.subVectors(u,c),h.subVectors(s,c),l.cross(h),a[o.a].add(l),a[o.b].add(l),a[o.c].add(l)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a[(o=this.faces[r]).a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(t=0,n=this.vertices.length;t<n;t++)a[t].normalize();for(r=0,i=this.faces.length;r<i;r++){var p=(o=this.faces[r]).vertexNormals;3===p.length?(p[0].copy(a[o.a]),p[1].copy(a[o.b]),p[2].copy(a[o.c])):(p[0]=a[o.a].clone(),p[1]=a[o.b].clone(),p[2]=a[o.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 o=new vo;for(o.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 a=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,r=this.faces.length;n<r;n++)c=new $n,u={a:new $n,b:new $n,c:new $n},a.push(c),s.push(u)}var c,u,l=this.morphNormals[e];for(o.vertices=this.morphTargets[e].vertices,o.computeFaceNormals(),o.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=l.faceNormals[n],u=l.vertexNormals[n],c.copy(i.normal),u.a.copy(i.vertexNormals[0]),u.b.copy(i.vertexNormals[1]),u.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 Gr),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Hr),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,c=e.faces,u=this.colors,l=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new Hn).getNormalMatrix(t));for(var h=0,p=a.length;h<p;h++){var d=a[h].clone();void 0!==t&&d.applyMatrix4(t),o.push(d)}for(h=0,p=l.length;h<p;h++)u.push(l[h].clone());for(h=0,p=c.length;h<p;h++){var f,m,v,g=c[h],y=g.vertexNormals,x=g.vertexColors;(f=new bi(g.a+i,g.b+i,g.c+i)).normal.copy(g.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==r&&m.applyMatrix3(r).normalize(),f.vertexNormals.push(m);for(f.color.copy(g.color),b=0,w=x.length;b<w;b++)v=x[b],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+n,s.push(f)}for(h=0,p=e.faceVertexUvs.length;h<p;h++){var _=e.faceVertexUvs[h];for(void 0===this.faceVertexUvs[h]&&(this.faceVertexUvs[h]=[]),b=0,w=_.length;b<w;b++){for(var M=_[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,o,a,s,c={},u=[],l=[],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,u.push(this.vertices[n]),l[n]=u.length-1):l[n]=l[c[t]];var p=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=l[i.a],i.b=l[i.b],i.c=l[i.c],o=[i.a,i.b,i.c];for(var d=0;d<3;d++)if(o[d]===o[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-u.length;return this.vertices=u,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,o=this.faceVertexUvs[0],a=this.faceVertexUvs[1];for(o&&o.length===t&&(r=[]),a&&a.length===t&&(i=[]),n=0;n<t;n++){var s=e[n]._id;r&&r.push(o[s]),i&&i.push(a[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 o=this.vertices[i];r.push(o.x,o.y,o.z)}var a=[],s=[],c={},u=[],l={},h=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.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,v),x=M(x,6,g),x=M(x,7,y),a.push(x),a.push(d.a,d.b,d.c),a.push(d.materialIndex),f){var b=this.faceVertexUvs[0][i];a.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&a.push(T(d.normal)),v){var w=d.vertexNormals;a.push(T(w[0]),T(w[1]),T(w[2]))}if(g&&a.push(S(d.color)),y){var _=d.vertexColors;a.push(S(_[0]),S(_[1]),S(_[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!==l[t]||(l[t]=u.length,u.push(e.getHex())),l[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=h.length/2,h.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=r,e.data.normals=s,u.length>0&&(e.data.colors=u),h.length>0&&(e.data.uvs=[h]),e.data.faces=a,e},clone:function(){return(new vo).copy(this)},copy:function(e){var t,n,r,i,o,a;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 u=e.faces;for(t=0,n=u.length;t<n;t++)this.faces.push(u[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var l=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=l.length;r<i;r++){var h=l[r],p=[];for(o=0,a=h.length;o<a;o++){var d=h[o];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}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 v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],r=0,i=v[t].vertexNormals.length;r<i;r++){var y=v[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],r=0,i=v[t].faceNormals.length;r<i;r++)g.faceNormals.push(v[t].faceNormals[r].clone());this.morphNormals.push(g)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[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 go extends vo{constructor(e,t,n,r,i,o){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new yo(e,t,n,r,i,o)),this.mergeVertices()}}class yo extends ji{constructor(e,t,n,r,i,o){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const a=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;const s=[],c=[],u=[],l=[];let h=0,p=0;function d(e,t,n,r,i,o,d,f,m,v,g){const y=o/m,x=d/v,b=o/2,w=d/2,_=f/2,M=m+1,T=v+1;let S=0,E=0;const A=new $n;for(let o=0;o<T;o++){const a=o*x-w;for(let s=0;s<M;s++){const h=s*y-b;A[e]=h*r,A[t]=a*i,A[n]=_,c.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,u.push(A.x,A.y,A.z),l.push(s/m),l.push(1-o/v),S+=1}}for(let e=0;e<v;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),o=h+(t+1)+M*e;s.push(n,r,o),s.push(r,i,o),E+=6}a.addGroup(p,E,g),p+=E,h+=S}d("z","y","x",-1,-1,n,t,e,o,i,0),d("z","y","x",1,-1,n,t,-e,o,i,1),d("x","z","y",1,1,e,n,t,r,o,2),d("x","z","y",1,-1,e,n,-t,r,o,3),d("x","y","z",1,-1,e,t,n,r,i,4),d("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(u,3)),this.setAttribute("uv",new Di(l,2))}}function xo(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 bo(e){for(var t={},n=0;n<e.length;n++){var r=xo(e[n]);for(var i in r)t[i]=r[i]}return t}var wo={clone:xo,merge:bo};function _o(e){_i.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 Mo(){Sr.call(this),this.type="Camera",this.matrixWorldInverse=new sr,this.projectionMatrix=new sr,this.projectionMatrixInverse=new sr}function To(e,t,n,r){Mo.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()}function So(e,t,n){if(Sr.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var r=new To(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 To(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 o=new To(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 a=new To(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 s=new To(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 To(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 u=e.xr.enabled,l=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,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(l),e.xr.enabled=u},this.clear=function(e,t,r,i){for(var o=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(n,a),e.clear(t,r,i);e.setRenderTarget(o)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Eo(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 Ao(e,t,n,r,i,o,a,s,c,u,l,h){qn.call(this,null,o,a,s,c,u,r,i,l,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==c?c:ge,this.minFilter=void 0!==u?u:ge,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}_o.prototype=Object.create(_i.prototype),_o.prototype.constructor=_o,_o.prototype.isShaderMaterial=!0,_o.prototype.copy=function(e){return _i.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=xo(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},_o.prototype.toJSON=function(e){var t=_i.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 o in this.extensions)!0===this.extensions[o]&&(i[o]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},Mo.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Mo,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)}}),To.prototype=Object.assign(Object.create(Mo.prototype),{constructor:To,isPerspectiveCamera:!0,copy:function(e,t){return Mo.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*kn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*kn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*kn.RAD2DEG*Math.atan(Math.tan(.5*kn.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,o){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=o,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*kn.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;i+=o.offsetX*r/a,t-=o.offsetY*n/s,r*=o.width/a,n*=o.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}}),So.prototype=Object.create(Sr.prototype),So.prototype.constructor=So,Eo.prototype=Object.create(Yn.prototype),Eo.prototype.constructor=Eo,Eo.prototype.isWebGLCubeRenderTarget=!0,Eo.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 _o({type:"CubemapFromEquirect",uniforms:xo(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:g,blending:w});i.uniforms.tEquirect.value=t;var o=new co(new yo(5,5,5),i);return n.add(o),new So(1,10,this).update(e,n),o.geometry.dispose(),o.material.dispose(),this},Ao.prototype=Object.create(qn.prototype),Ao.prototype.constructor=Ao,Ao.prototype.isDataTexture=!0;var Lo=new Hr,Po=new $n;function Ro(e,t,n,r,i,o){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!==o?o:new ti]}Object.assign(Ro.prototype,{set:function(e,t,n,r,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),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],o=n[2],a=n[3],s=n[4],c=n[5],u=n[6],l=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-r,l-s,f-h,y-m).normalize(),t[1].setComponents(a+r,l+s,f+h,y+m).normalize(),t[2].setComponents(a+i,l+c,f+p,y+v).normalize(),t[3].setComponents(a-i,l-c,f-p,y-v).normalize(),t[4].setComponents(a-o,l-u,f-d,y-g).normalize(),t[5].setComponents(a+o,l+u,f+d,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Lo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Lo)},intersectsSprite:function(e){return Lo.center.set(0,0,0),Lo.radius=.7071067811865476,Lo.applyMatrix4(e.matrixWorld),this.intersectsSphere(Lo)},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(Po.x=r.normal.x>0?e.max.x:e.min.x,Po.y=r.normal.y>0?e.max.y:e.min.y,Po.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Po)<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 Co={common:{diffuse:{value:new vi(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Hn},uv2Transform:{value:new Hn},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 Vn(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 vi(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 vi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Hn}},sprite:{diffuse:{value:new vi(15658734)},opacity:{value:1},center:{value:new Vn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Hn}}};function Oo(){var e=null,t=!1,n=null;function r(i,o){!1!==t&&(n(i,o),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 Do(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 o=r.get(t);void 0===o?r.set(t,function(t,n){var r=t.array,i=t.usage,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();var a=5126;return r instanceof Float32Array?a=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?a=5123:r instanceof Int16Array?a=5122:r instanceof Uint32Array?a=5125:r instanceof Int32Array?a=5124:r instanceof Int8Array?a=5120:r instanceof Uint8Array&&(a=5121),{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(function(t,r,i){var o=r.array,a=r.updateRange;e.bindBuffer(i,t),-1===a.count?e.bufferSubData(i,0,o):(n?e.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):e.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,t,i),o.version=t.version)}}}function Io(e,t,n,r){vo.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new No(e,t,n,r)),this.mergeVertices()}function No(e,t,n,r){ji.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,o,a=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,u=Math.floor(r)||1,l=c+1,h=u+1,p=e/c,d=t/u,f=[],m=[],v=[],g=[];for(o=0;o<h;o++){var y=o*d-s;for(i=0;i<l;i++){var x=i*p-a;m.push(x,-y,0),v.push(0,0,1),g.push(i/c),g.push(1-o/u)}}for(o=0;o<u;o++)for(i=0;i<c;i++){var b=i+l*o,w=i+l*(o+1),_=i+1+l*(o+1),M=i+1+l*o;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new Di(m,3)),this.setAttribute("normal",new Di(v,3)),this.setAttribute("uv",new Di(g,2))}Io.prototype=Object.create(vo.prototype),Io.prototype.constructor=Io,No.prototype=Object.create(ji.prototype),No.prototype.constructor=No;var Bo={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}"},Fo={basic:{uniforms:bo([Co.common,Co.specularmap,Co.envmap,Co.aomap,Co.lightmap,Co.fog]),vertexShader:Bo.meshbasic_vert,fragmentShader:Bo.meshbasic_frag},lambert:{uniforms:bo([Co.common,Co.specularmap,Co.envmap,Co.aomap,Co.lightmap,Co.emissivemap,Co.fog,Co.lights,{emissive:{value:new vi(0)}}]),vertexShader:Bo.meshlambert_vert,fragmentShader:Bo.meshlambert_frag},phong:{uniforms:bo([Co.common,Co.specularmap,Co.envmap,Co.aomap,Co.lightmap,Co.emissivemap,Co.bumpmap,Co.normalmap,Co.displacementmap,Co.fog,Co.lights,{emissive:{value:new vi(0)},specular:{value:new vi(1118481)},shininess:{value:30}}]),vertexShader:Bo.meshphong_vert,fragmentShader:Bo.meshphong_frag},standard:{uniforms:bo([Co.common,Co.envmap,Co.aomap,Co.lightmap,Co.emissivemap,Co.bumpmap,Co.normalmap,Co.displacementmap,Co.roughnessmap,Co.metalnessmap,Co.fog,Co.lights,{emissive:{value:new vi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bo.meshphysical_vert,fragmentShader:Bo.meshphysical_frag},toon:{uniforms:bo([Co.common,Co.specularmap,Co.aomap,Co.lightmap,Co.emissivemap,Co.bumpmap,Co.normalmap,Co.displacementmap,Co.gradientmap,Co.fog,Co.lights,{emissive:{value:new vi(0)},specular:{value:new vi(1118481)},shininess:{value:30}}]),vertexShader:Bo.meshtoon_vert,fragmentShader:Bo.meshtoon_frag},matcap:{uniforms:bo([Co.common,Co.bumpmap,Co.normalmap,Co.displacementmap,Co.fog,{matcap:{value:null}}]),vertexShader:Bo.meshmatcap_vert,fragmentShader:Bo.meshmatcap_frag},points:{uniforms:bo([Co.points,Co.fog]),vertexShader:Bo.points_vert,fragmentShader:Bo.points_frag},dashed:{uniforms:bo([Co.common,Co.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bo.linedashed_vert,fragmentShader:Bo.linedashed_frag},depth:{uniforms:bo([Co.common,Co.displacementmap]),vertexShader:Bo.depth_vert,fragmentShader:Bo.depth_frag},normal:{uniforms:bo([Co.common,Co.bumpmap,Co.normalmap,Co.displacementmap,{opacity:{value:1}}]),vertexShader:Bo.normal_vert,fragmentShader:Bo.normal_frag},sprite:{uniforms:bo([Co.sprite,Co.fog]),vertexShader:Bo.sprite_vert,fragmentShader:Bo.sprite_frag},background:{uniforms:{uvTransform:{value:new Hn},t2D:{value:null}},vertexShader:Bo.background_vert,fragmentShader:Bo.background_frag},cube:{uniforms:bo([Co.envmap,{opacity:{value:1}}]),vertexShader:Bo.cube_vert,fragmentShader:Bo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bo.equirect_vert,fragmentShader:Bo.equirect_frag},distanceRGBA:{uniforms:bo([Co.common,Co.displacementmap,{referencePosition:{value:new $n},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bo.distanceRGBA_vert,fragmentShader:Bo.distanceRGBA_frag},shadow:{uniforms:bo([Co.lights,Co.fog,{color:{value:new vi(0)},opacity:{value:1}}]),vertexShader:Bo.shadow_vert,fragmentShader:Bo.shadow_frag}};function zo(e,t,n,r){var i,o,a=new vi(0),s=0,c=null,u=0,l=null;function h(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}return{getClearColor:function(){return a},setClearColor:function(e,t){a.set(e),h(a,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){h(a,s=e)},render:function(t,r,p,d){var f=r.background,m=e.xr,y=m.getSession&&m.getSession();if(y&&"additive"===y.environmentBlendMode&&(f=null),null===f?h(a,s):f&&f.isColor&&(h(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||f.mapping===pe)){void 0===o&&((o=new co(new yo(1,1,1),new _o({type:"BackgroundCubeMaterial",uniforms:xo(Fo.cube.uniforms),vertexShader:Fo.cube.vertexShader,fragmentShader:Fo.cube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(o));var x=f.isWebGLCubeRenderTarget?f.texture:f;o.material.uniforms.envMap.value=x,o.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,c===f&&u===x.version&&l===e.toneMapping||(o.material.needsUpdate=!0,c=f,u=x.version,l=e.toneMapping),t.unshift(o,o.geometry,o.material,0,0,null)}else f&&f.isTexture&&(void 0===i&&((i=new co(new No(2,2),new _o({type:"BackgroundMaterial",uniforms:xo(Fo.background.uniforms),vertexShader:Fo.background.vertexShader,fragmentShader:Fo.background.fragmentShader,side:v,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&&u===f.version&&l===e.toneMapping||(i.material.needsUpdate=!0,c=f,u=f.version,l=e.toneMapping),t.unshift(i,i.geometry,i.material,0,0,null))}}}function Uo(e,t,n,r){var i,o=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,a,s,c){if(0!==c){var u,l;if(o)u=e,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[l](i,a,s,c),n.update(s,i,c)}}}function Go(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 o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===n.logarithmicDepthBuffer,u=e.getParameter(34930),l=e.getParameter(35660),h=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=l>0,y=o||!!t.get("OES_texture_float");return{isWebGL2:o,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:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:o?e.getParameter(36183):0}}function ko(){var e=this,t=null,n=0,r=!1,i=!1,o=new ti,a=new Hn,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(t,n,r,i){var c=null!==t?t.length:0,u=null;if(0!==c){if(u=s.value,!0!==i||null===u){var l=r+4*c,h=n.matrixWorldInverse;a.getNormalMatrix(h),(null===u||u.length<l)&&(u=new Float32Array(l));for(var p=0,d=r;p!==c;++p,d+=4)o.copy(t[p]).applyMatrix4(h,a),o.normal.toArray(u,d),u[d+3]=o.constant}s.value=u,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,u}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,o){var a=0!==e.length||i||0!==n||r;return r=i,t=u(e,o,0),n=e.length,a},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,o,a,l,h,p){if(!r||null===e||0===e.length||i&&!a)i?u(null):c();else{var d=i?0:n,f=4*d,m=h.clippingState||null;s.value=m,m=u(e,l,f,p);for(var v=0;v!==f;++v)m[v]=t[v];h.clippingState=m,this.numIntersection=o?this.numPlanes:0,this.numPlanes+=d}}}function Vo(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 Ho(e,t,n){var r=new WeakMap,i=new WeakMap;function o(e){var a=e.target,s=r.get(a);for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);a.removeEventListener("dispose",o),r.delete(a);var u=i.get(s);u&&(t.remove(u),i.delete(s)),n.memory.geometries--}function a(e){var n=[],r=e.index,o=e.attributes.position,a=0;if(null!==r){var s=r.array;a=r.version;for(var c=0,u=s.length;c<u;c+=3){var l=s[c+0],h=s[c+1],p=s[c+2];n.push(l,h,h,p,p,l)}}else for(s=o.array,a=o.version,c=0,u=s.length/3-1;c<u;c+=3)l=c+0,h=c+1,p=c+2,n.push(l,h,h,p,p,l);var d=new(Bi(n)>65535?Oi:Ri)(n,1);d.version=a,t.update(d,34963);var f=i.get(e);f&&t.remove(f),i.set(e,d)}return{get:function(e,t){var i=r.get(t);return i||(t.addEventListener("dispose",o),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 o=e.morphAttributes;for(var i in o)for(var a=o[i],s=0,c=a.length;s<c;s++)t.update(a[s],34962)},getWireframeAttribute:function(e){var t=i.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return i.get(e)}}}function jo(e,t,n,r){var i,o,a,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){o=e.type,a=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,o,t*a),n.update(r,i)},this.renderInstances=function(r,c,u,l){if(0!==l){var h,p;if(s)h=e,p="drawElementsInstanced";else if(p="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[p](i,u,o,c*a,l),n.update(u,i,l)}}}function Wo(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 qo(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Xo(e){var t={},n=new Float32Array(8);return{update:function(r,i,o,a){var s=r.morphTargetInfluences,c=void 0===s?0:s.length,u=t[i.id];if(void 0===u){u=[];for(var l=0;l<c;l++)u[l]=[l,0];t[i.id]=u}var h=o.morphTargets&&i.morphAttributes.position,p=o.morphNormals&&i.morphAttributes.normal;for(l=0;l<c;l++)0!==(f=u[l])[1]&&(h&&i.deleteAttribute("morphTarget"+l),p&&i.deleteAttribute("morphNormal"+l));for(l=0;l<c;l++)(f=u[l])[0]=l,f[1]=s[l];u.sort(qo);var d=0;for(l=0;l<8;l++){var f;if(f=u[l]){var m=f[0],v=f[1];if(v){h&&i.setAttribute("morphTarget"+l,h[m]),p&&i.setAttribute("morphNormal"+l,p[m]),n[l]=v,d+=v;continue}}n[l]=0}var g=i.morphTargetsRelative?1:1-d;a.getUniforms().setValue(e,"morphTargetBaseInfluence",g),a.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Yo(e,t,n,r){var i=new WeakMap;return{update:function(e){var o=r.render.frame,a=e.geometry,s=t.get(e,a);return i.get(s)!==o&&(a.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,o)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){i=new WeakMap}}}function Zo(e,t,n,r,i,o,a,s,c,u){e=void 0!==e?e:[],t=void 0!==t?t:se,a=void 0!==a?a:Ge,qn.call(this,e,t,n,r,i,o,a,s,c,u),this.flipY=!1}function Jo(e,t,n,r){qn.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=ge,this.minFilter=ge,this.wrapR=me,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Ko(e,t,n,r){qn.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=ge,this.minFilter=ge,this.wrapR=me,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Fo.physical={uniforms:bo([Fo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Vn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new vi(0)},transparency:{value:0}}]),vertexShader:Bo.meshphysical_vert,fragmentShader:Bo.meshphysical_frag},Zo.prototype=Object.create(qn.prototype),Zo.prototype.constructor=Zo,Zo.prototype.isCubeTexture=!0,Object.defineProperty(Zo.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Jo.prototype=Object.create(qn.prototype),Jo.prototype.constructor=Jo,Jo.prototype.isDataTexture2DArray=!0,Ko.prototype=Object.create(qn.prototype),Ko.prototype.constructor=Ko,Ko.prototype.isDataTexture3D=!0;var Qo=new qn,$o=new Jo,ea=new Ko,ta=new Zo,na=[],ra=[],ia=new Float32Array(16),oa=new Float32Array(9),aa=new Float32Array(4);function sa(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,o=na[i];if(void 0===o&&(o=new Float32Array(i),na[i]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function ca(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 ua(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function la(e,t){var n=ra[t];void 0===n&&(n=new Int32Array(t),ra[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function ha(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function pa(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(ca(n,t))return;e.uniform2fv(this.addr,t),ua(n,t)}}function da(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(ca(n,t))return;e.uniform3fv(this.addr,t),ua(n,t)}}function fa(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(ca(n,t))return;e.uniform4fv(this.addr,t),ua(n,t)}}function ma(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ca(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ua(n,t)}else{if(ca(n,r))return;aa.set(r),e.uniformMatrix2fv(this.addr,!1,aa),ua(n,r)}}function va(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ca(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ua(n,t)}else{if(ca(n,r))return;oa.set(r),e.uniformMatrix3fv(this.addr,!1,oa),ua(n,r)}}function ga(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ca(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ua(n,t)}else{if(ca(n,r))return;ia.set(r),e.uniformMatrix4fv(this.addr,!1,ia),ua(n,r)}}function ya(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||Qo,i)}function xa(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||$o,i)}function ba(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||ea,i)}function wa(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||ta,i)}function _a(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Ma(e,t){var n=this.cache;ca(n,t)||(e.uniform2iv(this.addr,t),ua(n,t))}function Ta(e,t){var n=this.cache;ca(n,t)||(e.uniform3iv(this.addr,t),ua(n,t))}function Sa(e,t){var n=this.cache;ca(n,t)||(e.uniform4iv(this.addr,t),ua(n,t))}function Ea(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Aa(e,t){e.uniform1fv(this.addr,t)}function La(e,t){e.uniform1iv(this.addr,t)}function Pa(e,t){e.uniform2iv(this.addr,t)}function Ra(e,t){e.uniform3iv(this.addr,t)}function Ca(e,t){e.uniform4iv(this.addr,t)}function Oa(e,t){var n=sa(t,this.size,2);e.uniform2fv(this.addr,n)}function Da(e,t){var n=sa(t,this.size,3);e.uniform3fv(this.addr,n)}function Ia(e,t){var n=sa(t,this.size,4);e.uniform4fv(this.addr,n)}function Na(e,t){var n=sa(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Ba(e,t){var n=sa(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Fa(e,t){var n=sa(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function za(e,t,n){var r=t.length,i=la(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.safeSetTexture2D(t[o]||Qo,i[o])}function Ua(e,t,n){var r=t.length,i=la(n,r);e.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.safeSetTextureCube(t[o]||ta,i[o])}function Ga(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return ha;case 35664:return pa;case 35665:return da;case 35666:return fa;case 35674:return ma;case 35675:return va;case 35676:return ga;case 5124:case 35670:return _a;case 35667:case 35671:return Ma;case 35668:case 35672:return Ta;case 35669:case 35673:return Sa;case 5125:return Ea;case 35678:case 36198:case 36298:case 36306:case 35682:return ya;case 35679:case 36299:case 36307:return ba;case 35680:case 36300:case 36308:case 36293:return wa;case 36289:case 36303:case 36311:case 36292:return xa}}(t.type)}function ka(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Aa;case 35664:return Oa;case 35665:return Da;case 35666:return Ia;case 35674:return Na;case 35675:return Ba;case 35676:return Fa;case 5124:case 35670:return La;case 35667:case 35671:return Pa;case 35668:case 35672:return Ra;case 35669:case 35673:return Ca;case 35678:case 36198:case 36298:case 36306:case 35682:return za;case 35680:case 36300:case 36308:case 36293:return Ua}}(t.type)}function Va(e){this.id=e,this.seq=[],this.map={}}ka.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ua(t,e)},Va.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,o=r.length;i!==o;++i){var a=r[i];a.setValue(e,t[a.id],n)}};var Ha=/([\w\d_]+)(\])?(\[|\.)?/g;function ja(e,t){e.seq.push(t),e.map[t.id]=t}function Wa(e,t,n){var r=e.name,i=r.length;for(Ha.lastIndex=0;;){var o=Ha.exec(r),a=Ha.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===i){ja(n,void 0===u?new Ga(s,e,t):new ka(s,e,t));break}var l=n.map[s];void 0===l&&ja(n,l=new Va(s)),n=l}}function qa(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Wa(i,e.getUniformLocation(t,i.name),this)}}function Xa(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}qa.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},qa.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},qa.upload=function(e,t,n,r){for(var i=0,o=t.length;i!==o;++i){var a=t[i],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,r)}},qa.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var o=e[r];o.id in t&&n.push(o)}return n};var Ya=0;function Za(e){switch(e){case $t:return["Linear","( value )"];case en:return["sRGB","( value )"];case nn:return["RGBE","( value )"];case on:return["RGBM","( value, 7.0 )"];case an: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 Ja(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 Ka(e,t){var n=Za(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Qa(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 oe:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function $a(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=Bo[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return rs(n)}var os=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,as=/#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(as,us).replace(os,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."),us(e,t,n,r)}function us(e,t,n,r){for(var i="",o=parseInt(t);o<parseInt(n);o++)i+=r.replace(/\[ i \]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return i}function ls(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,o,a,s=e.getContext(),c=n.defines,u=n.vertexShader,l=n.fragmentShader,h=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===d?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===f?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===m&&(t="SHADOWMAP_TYPE_VSM"),t}(n),p=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case se:case ce:t="ENVMAP_TYPE_CUBE";break;case pe:case de:t="ENVMAP_TYPE_CUBE_UV";break;case ue:case le: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 le:t="ENVMAP_MODE_REFRACTION"}return t}(n),g=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),y=e.gammaFactor>0?e.gammaFactor:1,x=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($a).join("\n")}(n),b=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),w=s.createProgram();if(n.isRawShaderMaterial?((r=[b].filter($a).join("\n")).length>0&&(r+="\n"),(i=[x,b].filter($a).join("\n")).length>0&&(i+="\n")):(r=[ls(n),"#define SHADER_NAME "+n.shaderName,b,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+y,"#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 "+h:"",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($a).join("\n"),i=[x,ls(n),"#define SHADER_NAME "+n.shaderName,b,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+y,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 "+p:"",n.envMap?"#define "+v:"",n.envMap?"#define "+g:"",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 "+h:"",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?Bo.tonemapping_pars_fragment:"",n.toneMapping!==ee?Qa("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?Bo.encodings_pars_fragment:"",n.mapEncoding?Ka("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Ka("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Ka("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ka("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Ka("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?("linearToOutputTexel",o=n.outputEncoding,a=Za(o),"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+a[0]+a[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($a).join("\n")),u=ts(u=es(u=rs(u),n),n),l=ts(l=es(l=rs(l),n),n),u=ss(u),l=ss(l),n.isWebGL2&&!n.isRawShaderMaterial){var _=!1,M=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==u.match(M)&&null!==l.match(M)&&(_=!0,u=u.replace(M,""),l=l.replace(M,"")),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",_?"":"out highp vec4 pc_fragColor;",_?"":"#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 T,S,E=i+l,A=Xa(s,35633,r+u),L=Xa(s,35632,E);if(s.attachShader(w,A),s.attachShader(w,L),void 0!==n.index0AttributeName?s.bindAttribLocation(w,0,n.index0AttributeName):!0===n.morphTargets&&s.bindAttribLocation(w,0,"position"),s.linkProgram(w),e.debug.checkShaderErrors){var P=s.getProgramInfoLog(w).trim(),R=s.getShaderInfoLog(A).trim(),C=s.getShaderInfoLog(L).trim(),O=!0,D=!0;if(!1===s.getProgramParameter(w,35714)){O=!1;var I=Ja(s,A,"vertex"),N=Ja(s,L,"fragment");console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(w,35715),"gl.getProgramInfoLog",P,I,N)}else""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==R&&""!==C||(D=!1);D&&(this.diagnostics={runnable:O,programLog:P,vertexShader:{log:R,prefix:r},fragmentShader:{log:C,prefix:i}})}return s.deleteShader(A),s.deleteShader(L),this.getUniforms=function(){return void 0===T&&(T=new qa(s,w)),T},this.getAttributes=function(){return void 0===S&&(S=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var o=e.getActiveAttrib(t,i).name;n[o]=e.getAttribLocation(t,o)}return n}(s,w)),S},this.destroy=function(){s.deleteProgram(w),this.program=void 0},this.name=n.shaderName,this.id=Ya++,this.cacheKey=t,this.usedTimes=1,this.program=w,this.vertexShader=A,this.fragmentShader=L,this}function ps(e,t,n){var r=[],i=n.isWebGL2,o=n.logarithmicDepthBuffer,a=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,u=n.vertexTextures,l={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 p(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,d,f,m,v,x){var b=f.fog,w=r.isMeshStandardMaterial?f.environment:null,_=r.envMap||w,M=l[r.type],T=x.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(a)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=Fo[t];n={name:e.type,uniforms:wo.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:u,outputEncoding:null!==E?p(E.texture):e.outputEncoding,map:!!r.map,mapEncoding:p(r.map),matcap:!!r.matcap,matcapEncoding:p(r.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:p(_),envMapCubeUV:!!_&&(_.mapping===pe||_.mapping===de),lightMap:!!r.lightMap,lightMapEncoding:p(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:p(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:r.normalMapType===hn,tangentSpaceNormalMap:r.normalMapType===ln,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:o,skinning:r.skinning&&T>0,maxBones:T,useVertexTexture:a,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:v,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.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===g,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,o=0,a=r.length;o<a;o++){var s=r[o];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 ds(){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 vs(){var e=[],t=0,n=[],r=[],i={id:-1};function o(n,r,o,a,s,c){var u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:r,material:o,program:o.program||i,groupOrder:a,renderOrder:n.renderOrder,z:s,group:c},e[t]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=o,u.program=o.program||i,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=s,u.group=c),t++,u}return{opaque:n,transparent:r,init:function(){t=0,n.length=0,r.length=0},push:function(e,t,i,a,s,c){var u=o(e,t,i,a,s,c);(!0===i.transparent?r:n).push(u)},unshift:function(e,t,i,a,s,c){var u=o(e,t,i,a,s,c);(!0===i.transparent?r:n).unshift(u)},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 gs(){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,o=e.get(n);return void 0===o?(i=new vs,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):void 0===(i=o.get(r))&&(i=new vs,o.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 vi};break;case"SpotLight":n={position:new $n,direction:new $n,color:new vi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new $n,color:new vi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new $n,skyColor:new vi,groundColor:new vi};break;case"RectAreaLight":n={color:new vi,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 ws(){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 Vn};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new Vn,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 o=new $n,a=new sr,s=new sr;return{setup:function(e,i,c){for(var u=0,l=0,h=0,p=0;p<9;p++)r.probe[p].set(0,0,0);var d=0,f=0,m=0,v=0,g=0,y=0,x=0,b=0,w=c.matrixWorldInverse;e.sort(bs),p=0;for(var _=e.length;p<_;p++){var M=e[p],T=M.color,S=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)u+=T.r*S,l+=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),o.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(o),C.direction.transformDirection(w),M.castShadow){var P=M.shadow;(R=n.get(M)).shadowBias=P.bias,R.shadowRadius=P.radius,R.shadowMapSize=P.mapSize,r.directionalShadow[d]=R,r.directionalShadowMap[d]=A,r.directionalShadowMatrix[d]=M.shadow.matrix,y++}r.directional[d]=C,d++}else if(M.isSpotLight)(C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(T).multiplyScalar(S),C.distance=E,C.direction.setFromMatrixPosition(M.matrixWorld),o.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(o),C.direction.transformDirection(w),C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow&&(P=M.shadow,(R=n.get(M)).shadowBias=P.bias,R.shadowRadius=P.radius,R.shadowMapSize=P.mapSize,r.spotShadow[m]=R,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(w),s.identity(),a.copy(M.matrixWorld),a.premultiply(w),s.extractRotation(a),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[v]=C,v++;else if(M.isPointLight){var R;if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(M.color).multiplyScalar(M.intensity),C.distance=M.distance,C.decay=M.decay,M.castShadow)P=M.shadow,(R=n.get(M)).shadowBias=P.bias,R.shadowRadius=P.radius,R.shadowMapSize=P.mapSize,R.shadowCameraNear=P.camera.near,R.shadowCameraFar=P.camera.far,r.pointShadow[f]=R,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(w),C.direction.normalize(),C.skyColor.copy(M.color).multiplyScalar(S),C.groundColor.copy(M.groundColor).multiplyScalar(S),r.hemi[g]=C,g++}}r.ambient[0]=u,r.ambient[1]=l,r.ambient[2]=h;var O=r.hash;O.directionalLength===d&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===v&&O.hemiLength===g&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===b||(r.directional.length=d,r.spot.length=m,r.rectArea.length=v,r.point.length=f,r.hemi.length=g,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=d,O.pointLength=f,O.spotLength=m,O.rectAreaLength=v,O.hemiLength=g,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=b,r.version=xs++)},state:r}}function _s(){var e=new ws,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 _s,e.set(n,new WeakMap),e.get(n).set(r,i),n.addEventListener("dispose",t)):!1===e.get(n).has(r)?(i=new _s,e.get(n).set(r,i)):i=e.get(n).get(r),i},dispose:function(){e=new WeakMap}}}function Ts(e){_i.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){_i.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)}function Es(e,t,n){var r=new Ro,i=new Vn,o=new Vn,a=new Xn,s=[],c=[],u={},l={0:g,1:v,2:y},h=new _o({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vn},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}"}),p=h.clone();p.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 co(f,h),b=this;function _(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),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,p,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:un,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,o,a,s){var c=null,h=M,p=t.customDepthMaterial;if(!0===i.isPointLight&&(h=T,p=t.customDistanceMaterial),void 0===p){var d=!1;!0===r.morphTargets&&(d=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(d,f,!0===t.isInstancedMesh)}else c=p;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var v=c.uuid,g=r.uuid,y=u[v];void 0===y&&(y={},u[v]=y);var x=y[g];void 0===x&&(x=c.clone(),y[g]=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:l[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=o,c.farDistance=a),c}function E(n,i,o,a,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(o.matrixWorldInverse,n.matrixWorld);var c=t.update(n),u=n.material;if(Array.isArray(u))for(var l=c.groups,h=0,p=l.length;h<p;h++){var d=l[h],f=u[d.materialIndex];if(f&&f.visible){var v=S(n,c,f,a,o.near,o.far,s);e.renderBufferDirect(o,null,c,v,n,d)}}else u.visible&&(v=S(n,c,u,a,o.near,o.far,s),e.renderBufferDirect(o,null,c,v,n,null))}for(var g=n.children,y=0,x=g.length;y<x;y++)E(g[y],i,o,a,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=d,this.render=function(t,s,c){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==t.length){var u=e.getRenderTarget(),l=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.state;p.setBlending(w),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var d=0,f=t.length;d<f;d++){var v=t[d],g=v.shadow;if(void 0!==g){i.copy(g.mapSize);var y=g.getFrameExtents();if(i.multiply(y),o.copy(g.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(o.x=Math.floor(n/y.x),i.x=o.x*y.x,g.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/y.y),i.y=o.y*y.y,g.mapSize.y=o.y)),null===g.map&&!g.isPointLightShadow&&this.type===m){var x={minFilter:_e,magFilter:_e,format:ke};g.map=new Yn(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.mapPass=new Yn(i.x,i.y,x),g.camera.updateProjectionMatrix()}null===g.map&&(x={minFilter:ge,magFilter:ge,format:ke},g.map=new Yn(i.x,i.y,x),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()),e.setRenderTarget(g.map),e.clear();for(var M=g.getViewportCount(),T=0;T<M;T++){var S=g.getViewport(T);a.set(o.x*S.x,o.y*S.y,o.x*S.z,o.y*S.w),p.viewport(a),g.updateMatrices(v,T),r=g.getFrustum(),E(s,c,g.camera,v,this.type)}g.isPointLightShadow||this.type!==m||_(g,c)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}b.needsUpdate=!1,e.setRenderTarget(u,l,h)}}}function As(e,t,n){var r=n.isWebGL2,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,o,a,s){!0===s&&(t*=a,r*=a,o*=a),n.set(t,r,o,a),!1===i.equals(n)&&(e.clearColor(t,r,o,a),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},o=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 H: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}}},u=new function(){var t=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=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,a){r===t&&i===n&&o===a||(e.stencilFunc(t,n,a),r=t,i=n,o=a)},setOp:function(t,n,r){a===t&&s===n&&c===r||(e.stencilOp(t,n,r),a=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,a=null,s=null,c=null,u=null}}},l=e.getParameter(34921),h=new Uint8Array(l),p=new Uint8Array(l),d=new Uint8Array(l),f={},m=null,v=null,x=null,b=null,K=null,Q=null,$=null,ee=null,te=null,ne=!1,re=null,ie=null,oe=null,ae=null,se=null,ce=e.getParameter(35661),ue=!1,le=0,he=e.getParameter(7938);-1!==he.indexOf("WebGL")?(le=parseFloat(/^WebGL\ ([0-9])/.exec(he)[1]),ue=le>=1):-1!==he.indexOf("OpenGL ES")&&(le=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(he)[1]),ue=le>=2);var pe=null,de={},fe=new Xn,me=new Xn;function ve(t,n,r){var i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;a<r;a++)e.texImage2D(n+a,0,6408,1,1,0,6408,5121,i);return o}var ge={};function ye(n,i){h[n]=1,0===p[n]&&(e.enableVertexAttribArray(n),p[n]=1),d[n]!==i&&((r?e:t.get("ANGLE_instanced_arrays"))[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),d[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)}ge[3553]=ve(3553,3553,1),ge[34067]=ve(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),u.setClear(0),xe(2929),o.setFunc(q),Se(!1),Ee(s),xe(2884),Te(w);var we={[A]:32774,[L]:32778,[P]:32779};if(r)we[R]=32775,we[C]=32776;else{var _e=t.get("EXT_blend_minmax");null!==_e&&(we[R]=_e.MIN_EXT,we[C]=_e.MAX_EXT)}var Me={[O]:0,[D]:1,[I]:768,[B]:770,[V]:776,[G]:774,[z]:772,[N]:769,[F]:771,[k]:775,[U]:773};function Te(t,n,r,i,o,a,s,c){if(t!==w){if(v||(xe(3042),v=!0),t===E)o=o||n,a=a||r,s=s||i,n===b&&o===$||(e.blendEquationSeparate(we[n],we[o]),b=n,$=o),r===K&&i===Q&&a===ee&&s===te||(e.blendFuncSeparate(Me[r],Me[i],Me[a],Me[s]),K=r,Q=i,ee=a,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 _: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 _: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 v&&(be(3042),v=!1)}function Se(t){re!==t&&(t?e.frontFace(2304):e.frontFace(2305),re=t)}function Ee(t){t!==a?(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),ae===n&&se===r||(e.polygonOffset(n,r),ae=n,se=r)):be(32823)}function Le(t){void 0===t&&(t=33984+ce-1),pe!==t&&(e.activeTexture(t),pe=t)}return{buffers:{color:i,depth:o,stencil:u},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=p.length;t!==n;++t)p[t]!==h[t]&&(e.disableVertexAttribArray(t),p[t]=0)},vertexAttribPointer:function(t,n,i,o,a,s){!0!==r||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,o,a,s):e.vertexAttribIPointer(t,n,i,o,a,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===g;t&&(n=!n),Se(n),e.blending===_&&!1===e.transparent?Te(w):Te(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),i.setMask(e.colorWrite);var r=e.stencilWrite;u.setTest(r),r&&(u.setMask(e.stencilWriteMask),u.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),u.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Ae(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Se,setCullFace:Ee,setLineWidth:function(t){t!==oe&&(ue&&e.lineWidth(t),oe=t)},setPolygonOffset:Ae,setScissorTest:function(e){e?xe(3089):be(3089)},activeTexture:Le,bindTexture:function(t,n){null===pe&&Le();var r=de[pe];void 0===r&&(r={type:void 0,texture:void 0},de[pe]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||ge[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=de[pe];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<p.length;t++)1===p[t]&&(e.disableVertexAttribArray(t),p[t]=0);f={},pe=null,de={},m=null,x=null,re=null,ie=null,i.reset(),o.reset(),u.reset()}}}function Ls(e,t,n,r,i,o,a){var s,c=i.isWebGL2,u=i.maxTextures,l=i.maxCubemapSize,h=i.maxTextureSize,p=i.maxSamples,d=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 v(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 o=t?kn.floorPowerOfTwo:Math.floor,a=o(i*e.width),c=o(i*e.height);void 0===s&&(s=m(a,c));var u=n?m(a,c):s;return u.width=a,u.height=c,u.getContext("2d").drawImage(e,0,0,a,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+c+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return kn.isPowerOfTwo(e.width)&&kn.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==ge&&e.minFilter!==_e}function x(t,n,i,o){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,o))*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 o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function w(e){return e===ge||e===ye||e===be?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=r.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),r.remove(t))}(n),n.isVideoTexture&&d.delete(n),a.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){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);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),a.memory.textures--}var T=0;function S(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=a.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var o=e.image;if(void 0===o)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==o.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 a=r.get(t);if(t.version>0&&a.__version!==t.version){C(a,t),n.activeTexture(33984+i),n.bindTexture(34067,a.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),u=t.image[0]&&t.image[0].isDataTexture,h=[],p=0;p<6;p++)h[p]=s||u?u?t.image[p].image:t.image[p]:v(t.image[p],!1,!0,l);var d,f=h[0],m=g(f)||c,w=o.convert(t.format),_=o.convert(t.type),M=b(t.internalFormat,w,_);if(R(34067,t,m),s){for(p=0;p<6;p++){d=h[p].mipmaps;for(var T=0;T<d.length;T++){var S=d[T];t.format!==ke&&t.format!==Ge?null!==w?n.compressedTexImage2D(34069+p,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+p,T,M,S.width,S.height,0,w,_,S.data)}}a.__maxMipLevel=d.length-1}else{for(d=t.mipmaps,p=0;p<6;p++)if(u)for(n.texImage2D(34069+p,0,M,h[p].width,h[p].height,0,w,_,h[p].data),T=0;T<d.length;T++){var E=(S=d[T]).image[p].image;n.texImage2D(34069+p,T+1,M,E.width,E.height,0,w,_,E.data)}else for(n.texImage2D(34069+p,0,M,w,_,h[p]),T=0;T<d.length;T++)S=d[T],n.texImage2D(34069+p,T+1,M,w,_,S.image[p]);a.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),a.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+i),n.bindTexture(34067,a.__webglTexture)}}function A(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)}var L={[fe]:10497,[me]:33071,[ve]:33648},P={[ge]:9728,[ye]:9984,[be]:9986,[_e]:9729,[Me]:9985,[Se]:9987};function R(n,o,a){a?(e.texParameteri(n,10242,L[o.wrapS]),e.texParameteri(n,10243,L[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,L[o.wrapR]),e.texParameteri(n,10240,P[o.magFilter]),e.texParameteri(n,10241,P[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),o.wrapS===me&&o.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,w(o.magFilter)),e.texParameteri(n,10241,w(o.minFilter)),o.minFilter!==ge&&o.minFilter!==_e&&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(o.type===De&&null===t.get("OES_texture_float_linear"))return;if(o.type===Ie&&null===(c||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function C(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),a.memory.textures++)}function O(t,r,i){var a=3553;r.isDataTexture2DArray&&(a=35866),r.isDataTexture3D&&(a=32879),C(t,r),n.activeTexture(33984+i),n.bindTexture(a,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!==ge&&e.minFilter!==_e)}(r)&&!1===g(r.image),u=v(r.image,s,!1,h),l=g(u)||c,p=o.convert(r.format),d=o.convert(r.type),f=b(r.internalFormat,p,d);R(a,r,l);var m,w=r.mipmaps;if(r.isDepthTexture)f=6402,c?f=r.type===De?36012:r.type===Oe?33190:r.type===ze?35056:33189:r.type===De&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===We&&6402===f&&r.type!==Re&&r.type!==Oe&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Re,d=o.convert(r.type)),r.format===qe&&6402===f&&(f=34041,r.type!==ze&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=ze,d=o.convert(r.type))),n.texImage2D(3553,0,f,u.width,u.height,0,p,d,null);else if(r.isDataTexture)if(w.length>0&&l){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);r.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,u.width,u.height,0,p,d,u.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],r.format!==ke&&r.format!==Ge?null!==p?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=w.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,f,u.width,u.height,u.depth,0,p,d,u.data),t.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,f,u.width,u.height,u.depth,0,p,d,u.data),t.__maxMipLevel=0;else if(w.length>0&&l){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,p,d,m);r.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,p,d,u),t.__maxMipLevel=0;y(r,l)&&x(a,r,u.width,u.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function D(t,i,a,s){var c=o.convert(i.texture.format),u=o.convert(i.texture.type),l=b(i.texture.internalFormat,c,u);n.texImage2D(s,0,l,i.width,i.height,0,c,u,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,a,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 a=n.depthTexture;a&&a.isDepthTexture&&(a.type===De?i=36012:a.type===Oe&&(i=33190));var s=N(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)r?(s=N(n),e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t);else{var c=o.convert(n.texture.format),u=o.convert(n.texture.type);i=b(n.texture.internalFormat,c,u),r?(s=N(n),e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)):e.renderbufferStorage(36161,i,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(e){return c&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var B=!1,F=!1;this.allocateTextureUnit=function(){var e=T;return e>=u&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+u),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(),a.memory.textures++;var u=!0===t.isWebGLCubeRenderTarget,l=!0===t.isWebGLMultisampleRenderTarget,h=g(t)||c;if(!c||t.texture.format!==Ge||t.texture.type!==De&&t.texture.type!==Ie||(t.texture.format=ke,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){i.__webglFramebuffer=[];for(var p=0;p<6;p++)i.__webglFramebuffer[p]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),l)if(c){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var d=o.convert(t.texture.format),f=o.convert(t.texture.type),m=b(t.texture.internalFormat,d,f),v=N(t);e.renderbufferStorageMultisample(36161,v,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(u){for(n.bindTexture(34067,s.__webglTexture),R(34067,t.texture,h),p=0;p<6;p++)D(i.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,h)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),R(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&&function(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 o=0;o<6;o++)e.bindFramebuffer(36160,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=e.createRenderbuffer(),I(n.__webglDepthbuffer[o],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),I(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||c)){var i=e.isWebGLCubeRenderTarget?34067:3553,o=r.get(t).__webglTexture;n.bindTexture(i,o),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,o=t.height,a=16384;t.depthBuffer&&(a|=256),t.stencilBuffer&&(a|=1024),e.blitFramebuffer(0,0,i,o,0,0,i,o,a,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===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):A(e,t)}}function Ps(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===Be)return 32820;if(e===Fe)return 33635;if(e===Le)return 5120;if(e===Pe)return 5122;if(e===Re)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===Ge)return 6407;if(e===ke)return 6408;if(e===Ve)return 6409;if(e===He)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===ot||e===at){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===ot)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===at)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===ut)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(e===ct)return n.COMPRESSED_RGB8_ETC2;if(e===ut)return n.COMPRESSED_RGBA8_ETC2_EAC}return e===lt||e===ht||e===pt||e===dt||e===ft||e===mt||e===vt||e===gt||e===yt||e===xt||e===bt||e===wt||e===_t||e===Mt||e===St||e===Et||e===At||e===Lt||e===Pt||e===Rt||e===Ct||e===Ot||e===Dt||e===It||e===Nt||e===Bt||e===Ft||e===zt?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:e===Tt?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:e===ze?r?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Rs(e){To.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,o=null,a="local-floor",s=null,c=[],u=new Map,l=new To;l.layers.enable(1),l.viewport=new Xn;var h=new To;h.layers.enable(2),h.viewport=new Xn;var p=[l,h],d=new Rs;d.layers.enable(1),d.layers.enable(2);var f=null,m=null;function v(e){var t=u.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function g(){u.forEach((function(e,t){e.disconnect(t)})),u.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),T.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){o=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++)u.set(t[n],c[n]);for(n=0;n<e.removed.length;n++){var i=e.removed[n];(o=u.get(i))&&(o.dispatchEvent({type:"disconnected",data:i}),u.delete(i))}for(n=0;n<e.added.length;n++){var o;i=e.added[n],(o=u.get(i))&&o.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){a=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getSession=function(){return r},this.setSession=function(e){if(null!==(r=e)){r.addEventListener("select",v),r.addEventListener("selectstart",v),r.addEventListener("selectend",v),r.addEventListener("squeeze",v),r.addEventListener("squeezestart",v),r.addEventListener("squeezeend",v),r.addEventListener("end",g);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var o={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(r,t,o);r.updateRenderState({baseLayer:s}),r.requestReferenceSpace(a).then(y),r.addEventListener("inputsourceschange",x)}};var b=new $n,w=new $n;function _(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){d.near=h.near=l.near=e.near,d.far=h.far=l.far=e.far,f===d.near&&m===d.far||(r.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);var t=e.parent,n=d.cameras;_(d,t);for(var i=0;i<n.length;i++)_(n[i],t);e.matrixWorld.copy(d.matrixWorld);for(var o=e.children,a=(i=0,o.length);i<a;i++)o[i].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var r=b.distanceTo(w),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],u=(i[9]-1)/i[5],l=(i[8]-1)/i[0],h=(o[8]+1)/o[0],p=a*l,d=a*h,f=r/(-l+h),m=f*-l;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 v=a+f,g=s+f,y=p-m,x=d+(r-m),_=c*s/g*v,M=u*s/g*v;e.projectionMatrix.makePerspective(y,x,_,M,v,g)}(d,l,h):d.projectionMatrix.copy(l.projectionMatrix),d};var M=null,T=new Oo;T.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(o))){var i=s.views,a=r.renderState.baseLayer;e.setFramebuffer(a.framebuffer);var u=!1;i.length!==d.cameras.length&&(d.cameras.length=0,u=!0);for(var l=0;l<i.length;l++){var h=i[l],f=a.getViewport(h),m=p[l];m.matrix.fromArray(h.transform.matrix),m.projectionMatrix.fromArray(h.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===l&&d.matrix.copy(m.matrix),!0===u&&d.cameras.push(m)}}var v=r.inputSources;for(l=0;l<c.length;l++){var g=c[l],y=v[l];g.update(y,n,o)}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,o,a=n.envMap||r;a&&(t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(a).__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?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),t.uv2Transform.value.copy(o.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===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&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,o,a){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===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&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===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&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===g&&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===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&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===g&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===g&&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){var i;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),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,o,a):r.isSpriteMaterial?function(e,t){var n;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),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,o=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",l=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,h=null,p=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 d,f,m,v,g,y,x,b,w,_,M,T,S,E,A,L,P,R,C,O=this,D=!1,I=null,N=0,B=0,F=null,z=null,U=-1,G={geometry:null,program:null,wireframe:!1},k=null,V=null,H=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 Ro,ne=new ko,re=!1,ie=!1,oe=new sr,ae=new $n;function se(){return null===F?Y:1}try{var ce={alpha:r,depth:i,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:l};if(t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",de,!1),null===(d=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===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ue(){f=new Vo(d),!1===(m=new Go(d,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 Ps(d,f,m),(v=new As(d,f,m)).scissor(j.copy(Q).multiplyScalar(Y).floor()),v.viewport(H.copy(K).multiplyScalar(Y).floor()),g=new Wo(d),y=new ds,x=new Ls(d,f,v,y,m,C,g),b=new Do(d,m),w=new Ho(d,b,g),_=new Yo(d,w,b,g),L=new Xo(d),M=new ps(O,f,m),T=new Is(y),S=new gs,E=new Ms,A=new zo(O,v,_,s),P=new Uo(d,f,g,m),R=new jo(d,f,g,m),g.programs=M.programs,O.capabilities=m,O.extensions=f,O.properties=y,O.renderLists=S,O.state=v,O.info=g}ue();var le=new Ds(O,d);this.xr=le;var he=new Es(O,_,m.maxTextureSize);function pe(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1,ue()}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 d},this.getContextAttributes=function(){return d.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 Vn),e.set(q,X)},this.setSize=function(e,n,r){le.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 Vn),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(H)},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),v.viewport(H.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),v.scissor(j.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){v.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),d.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",pe,!1),t.removeEventListener("webglcontextrestored",de,!1),S.dispose(),E.dispose(),y.dispose(),_.dispose(),le.dispose(),ye.stop()},this.renderBufferImmediate=function(e,t){v.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=d.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=d.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=d.createBuffer()),e.hasColors&&!n.color&&(n.color=d.createBuffer());var r=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,n.position),d.bufferData(34962,e.positionArray,35048),v.enableAttribute(r.position),d.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,n.normal),d.bufferData(34962,e.normalArray,35048),v.enableAttribute(r.normal),d.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,n.uv),d.bufferData(34962,e.uvArray,35048),v.enableAttribute(r.uv),d.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,n.color),d.bufferData(34962,e.colorArray,35048),v.enableAttribute(r.color),d.vertexAttribPointer(r.color,3,5126,!1,0,0)),v.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var ve=new Er;this.renderBufferDirect=function(e,t,n,r,i,o){null===t&&(t=ve);var a=i.isMesh&&i.matrixWorld.determinant()<0,s=Me(e,t,r,i);v.setMaterial(r,a);var c=!1;G.geometry===n.id&&G.program===s.id&&G.wireframe===(!0===r.wireframe)||(G.geometry=n.id,G.program=s.id,G.wireframe=!0===r.wireframe,c=!0),(r.morphTargets||r.morphNormals)&&(L.update(i,n,r,s),c=!0),!0===i.isInstancedMesh&&(c=!0);var u=n.index,l=n.attributes.position;if(null===u){if(void 0===l||0===l.count)return}else if(0===u.count)return;var h,p=1;!0===r.wireframe&&(u=w.getWireframeAttribute(n),p=2);var g=P;null!==u&&(h=b.get(u),(g=R).setIndex(h)),c&&(function(e,t,n,r){if(!1!==m.isWebGL2||!e.isInstancedMesh&&!t.isInstancedBufferGeometry||null!==f.get("ANGLE_instanced_arrays")){v.initAttributes();var i=t.attributes,o=r.getAttributes(),a=n.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var u=i[s];if(void 0!==u){var l=u.normalized,h=u.itemSize;if(void 0===(M=b.get(u)))continue;var p=M.buffer,g=M.type,y=M.bytesPerElement;if(u.isInterleavedBufferAttribute){var x=u.data,w=x.stride,_=u.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(c,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):v.enableAttribute(c),d.bindBuffer(34962,p),v.vertexAttribPointer(c,h,g,l,w*y,_*y)}else u.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=u.meshPerAttribute*u.count)):v.enableAttribute(c),d.bindBuffer(34962,p),v.vertexAttribPointer(c,h,g,l,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;p=M.buffer,g=M.type,v.enableAttributeAndDivisor(c+0,1),v.enableAttributeAndDivisor(c+1,1),v.enableAttributeAndDivisor(c+2,1),v.enableAttributeAndDivisor(c+3,1),d.bindBuffer(34962,p),d.vertexAttribPointer(c+0,4,g,!1,64,0),d.vertexAttribPointer(c+1,4,g,!1,64,16),d.vertexAttribPointer(c+2,4,g,!1,64,32),d.vertexAttribPointer(c+3,4,g,!1,64,48)}else if(void 0!==a){var T=a[s];if(void 0!==T)switch(T.length){case 2:d.vertexAttrib2fv(c,T);break;case 3:d.vertexAttrib3fv(c,T);break;case 4:d.vertexAttrib4fv(c,T);break;default:d.vertexAttrib1fv(c,T)}}}}v.disableUnusedAttributes()}}(i,n,r,s),null!==u&&d.bindBuffer(34963,h.buffer));var y=null!==u?u.count:l.count,x=n.drawRange.start*p,_=n.drawRange.count*p,M=null!==o?o.start*p:0,T=null!==o?o.count*p:1/0,S=Math.max(x,M),E=Math.min(y,x+_,M+T)-1,A=Math.max(0,E-S+1);if(0!==A){if(i.isMesh)!0===r.wireframe?(v.setLineWidth(r.wireframeLinewidth*se()),g.setMode(1)):g.setMode(4);else if(i.isLine){var C=r.linewidth;void 0===C&&(C=1),v.setLineWidth(C*se()),i.isLineSegments?g.setMode(1):i.isLineLoop?g.setMode(2):g.setMode(3)}else i.isPoints?g.setMode(0):i.isSprite&&g.setMode(4);if(i.isInstancedMesh)g.renderInstances(n,S,A,i.count);else if(n.isInstancedBufferGeometry){var O=Math.min(n.instanceCount,n._maxInstanceCount);g.renderInstances(n,S,A,O)}else g.render(S,A)}},this.compile=function(e,t){(p=E.get(e,t)).init(),e.traverse((function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))})),p.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 o=r[i];o.uuid in n==0&&(_e(o,e,t),n[o.uuid]=!0)}else r.uuid in n==0&&(_e(r,e,t),n[r.uuid]=!0)}))};var ge=null,ye=new Oo;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)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||te.intersectsSprite(e)){r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);var i=_.update(e);(o=e.material).visible&&h.push(e,i,o,n,ae.z,null)}}else if(e.isImmediateRenderObject)r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe),h.push(e,null,e.material,n,ae.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==g.render.frame&&(e.skeleton.update(),e.skeleton.frame=g.render.frame),!e.frustumCulled||te.intersectsObject(e))){r&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe),i=_.update(e);var o=e.material;if(Array.isArray(o))for(var a=i.groups,s=0,c=a.length;s<c;s++){var u=a[s],l=o[u.materialIndex];l&&l.visible&&h.push(e,i,l,n,ae.z,u)}else o.visible&&h.push(e,i,o,n,ae.z,null)}var d=e.children;for(s=0,c=d.length;s<c;s++)xe(d[s],t,n,r)}}function be(e,t,n,r){for(var i=0,o=e.length;i<o;i++){var a=e[i],s=a.object,c=a.geometry,u=void 0===r?a.material:r,l=a.group;if(n.isArrayCamera){V=n;for(var h=n.cameras,d=0,f=h.length;d<f;d++){var m=h[d];s.layers.test(m.layers)&&(v.viewport(H.copy(m.viewport)),p.setupLights(m),we(s,t,m,c,u,l))}}else V=null,we(s,t,n,c,u,l)}}function we(e,t,n,r,i,o){if(e.onBeforeRender(O,t,n,r,i,o),p=E.get(t,V||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var a=Me(n,t,i,e);v.setMaterial(i),G.geometry=null,G.program=null,G.wireframe=!1,function(e,t){e.render((function(e){O.renderBufferImmediate(e,t)}))}(e,a)}else O.renderBufferDirect(n,t,r,i,e,o);e.onAfterRender(O,t,n,r,i,o),p=E.get(t,V||n)}function _e(e,t,n){var r=y.get(e),i=p.state.lights,o=p.state.shadowsArray,a=i.state.version,s=M.getParameters(e,i.state,o,t,ne.numPlanes,ne.numIntersection,n),c=M.getProgramCacheKey(s),u=r.program,l=!0;if(void 0===u)e.addEventListener("dispose",fe);else if(u.cacheKey!==c)me(e);else if(r.lightsStateVersion!==a)r.lightsStateVersion=a,l=!1;else{if(void 0!==s.shaderID)return;l=!1}l&&(u=M.acquireProgram(s,c),r.program=u,r.uniforms=s.uniforms,r.outputEncoding=s.outputEncoding,e.program=u);var h=u.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<O.maxMorphTargets;d++)h["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals)for(e.numSupportedMorphNormals=0,d=0;d<O.maxMorphNormals;d++)h["morphNormal"+d]>=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=a,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(),v=qa.seqWithValue(m.seq,f);r.uniformsList=v}function Me(e,t,n,r){x.resetTextureUnits();var i=t.fog,o=n.isMeshStandardMaterial?t.environment:null,a=null===F?O.outputEncoding:F.texture.encoding,s=y.get(n),c=p.state.lights;if(re&&(ie||e!==k)){var u=e===k&&n.id===U;ne.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,u)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==i||s.environment!==o||s.needsLights&&s.lightsStateVersion!==c.state.version?_e(n,t,r):void 0===s.numClippingPlanes||s.numClippingPlanes===ne.numPlanes&&s.numIntersection===ne.numIntersection?s.outputEncoding!==a&&_e(n,t,r):_e(n,t,r):(_e(n,t,r),s.__version=n.version);var l,h,f=!1,g=!1,b=!1,w=s.program,_=w.getUniforms(),M=s.uniforms;if(v.useProgram(w.program)&&(f=!0,g=!0,b=!0),n.id!==U&&(U=n.id,g=!0),f||k!==e){if(_.setValue(d,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&_.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),k!==e&&(k=e,g=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var S=_.map.cameraPosition;void 0!==S&&S.setValue(d,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&_.setValue(d,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){_.setOptional(d,r,"bindMatrix"),_.setOptional(d,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=kn.ceilPowerOfTwo(L),L=Math.max(L,4);var P=new Float32Array(L*L*4);P.set(E.boneMatrices);var R=new Ao(P,L,L,ke,De);E.boneMatrices=P,E.boneTexture=R,E.boneTextureSize=L}_.setValue(d,"boneTexture",E.boneTexture,x),_.setValue(d,"boneTextureSize",E.boneTextureSize)}else _.setOptional(d,E,"boneMatrices")}}return(g||s.receiveShadow!==r.receiveShadow)&&(s.receiveShadow=r.receiveShadow,_.setValue(d,"receiveShadow",r.receiveShadow)),g&&(_.setValue(d,"toneMappingExposure",O.toneMappingExposure),_.setValue(d,"toneMappingWhitePoint",O.toneMappingWhitePoint),s.needsLights&&(h=b,(l=M).ambientLightColor.needsUpdate=h,l.lightProbe.needsUpdate=h,l.directionalLights.needsUpdate=h,l.directionalLightShadows.needsUpdate=h,l.pointLights.needsUpdate=h,l.pointLightShadows.needsUpdate=h,l.spotLights.needsUpdate=h,l.spotLightShadows.needsUpdate=h,l.rectAreaLights.needsUpdate=h,l.hemisphereLights.needsUpdate=h),i&&n.fog&&T.refreshFogUniforms(M,i),T.refreshMaterialUniforms(M,n,o,Y,X),void 0!==M.ltc_1&&(M.ltc_1.value=Co.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=Co.LTC_2),qa.upload(d,s.uniformsList,M,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(qa.upload(d,s.uniformsList,M,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(d,"center",r.center),_.setValue(d,"modelViewMatrix",r.modelViewMatrix),_.setValue(d,"normalMatrix",r.normalMatrix),_.setValue(d,"modelMatrix",r.matrixWorld),w}ye.setAnimationLoop((function(e){le.isPresenting||ge&&ge(e)})),"undefined"!=typeof window&&ye.setContext(window),this.setAnimationLoop=function(e){ge=e,le.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){G.geometry=null,G.program=null,G.wireframe=!1,U=-1,k=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),le.enabled&&le.isPresenting&&(t=le.getCamera(t)),e.onBeforeRender(O,e,t,n||F),(p=E.get(e,t)).init(),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),te.setFromProjectionMatrix(oe),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=p.state.shadowsArray;he.render(i,e,t),p.setupLights(t),re&&ne.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),A.render(h,e,t,r);var o=h.opaque,a=h.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;o.length&&be(o,e,t,s),a.length&&be(a,e,t,s)}else o.length&&be(o,e,t),a.length&&be(a,e,t);e.onAfterRender(O,e,t),null!==F&&(x.updateRenderTargetMipmap(F),x.updateMultisampleRenderTarget(F)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),h=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){I!==e&&null===F&&d.bindFramebuffer(36160,e),I=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return B},this.getRenderTarget=function(){return F},this.setRenderTarget=function(e,t,n){F=e,N=t,B=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var r=I,i=!1;if(e){var o=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=o[t||0],i=!0):r=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:o,H.copy(e.viewport),j.copy(e.scissor),W=e.scissorTest}else H.copy(K).multiplyScalar(Y).floor(),j.copy(Q).multiplyScalar(Y).floor(),W=$;if(z!==r&&(d.bindFramebuffer(36160,r),z=r),v.viewport(H),v.scissor(j),v.setScissorTest(W),i){var a=y.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),a.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,r,i,o,a){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var c=!1;s!==z&&(d.bindFramebuffer(36160,s),c=!0);try{var u=e.texture,l=u.format,h=u.type;if(l!==ke&&C.convert(l)!==d.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(h===Ae||C.convert(h)===d.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===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&d.readPixels(t,n,r,i,C.convert(l),C.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{c&&d.bindFramebuffer(36160,z)}}}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),o=Math.floor(t.image.height*r),a=C.convert(t.format);x.setTexture2D(t,0),d.copyTexImage2D(3553,n,a,e.x,e.y,i,o,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){void 0===r&&(r=0);var i=t.image.width,o=t.image.height,a=C.convert(n.format),s=C.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(3553,r,e.x,e.y,i,o,a,s,t.image.data):t.isCompressedTexture?d.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):d.texSubImage2D(3553,r,e.x,e.y,a,s,t.image),0===r&&n.generateMipmaps&&d.generateMipmap(3553),v.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Bs(e,t){this.name="",this.color=new vi(e),this.density=void 0!==t?t:25e-5}function Fs(e,t,n){this.name="",this.color=new vi(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function zs(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}Ts.prototype=Object.create(_i.prototype),Ts.prototype.constructor=Ts,Ts.prototype.isMeshDepthMaterial=!0,Ts.prototype.copy=function(e){return _i.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(_i.prototype),Ss.prototype.constructor=Ss,Ss.prototype.isMeshDistanceMaterial=!0,Ss.prototype.copy=function(e){return _i.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},Rs.prototype=Object.assign(Object.create(To.prototype),{constructor:Rs,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,o=this._targetRay,a=this._grip;return e&&(null!==o&&null!==(r=t.getPose(e.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),null!==a&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),this}}),Object.assign(Ds.prototype,Fn.prototype),Object.assign(Bs.prototype,{isFogExp2:!0,clone:function(){return new Bs(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Fs.prototype,{isFog:!0,clone:function(){return new Fs(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(zs.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(zs.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,Gs=new $n;function ks(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Vs(e){_i.call(this),this.type="SpriteMaterial",this.color=new vi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(ks.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(ks.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Gs.x=this.getX(t),Gs.y=this.getY(t),Gs.z=this.getZ(t),Gs.applyMatrix4(e),this.setXYZ(t,Gs.x,Gs.y,Gs.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}}}),Vs.prototype=Object.create(_i.prototype),Vs.prototype.constructor=Vs,Vs.prototype.isSpriteMaterial=!0,Vs.prototype.copy=function(e){return _i.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 Hs=new $n,js=new $n,Ws=new $n,qs=new Vn,Xs=new Vn,Ys=new sr,Zs=new $n,Js=new $n,Ks=new $n,Qs=new Vn,$s=new Vn,ec=new Vn;function tc(e){if(Sr.call(this),this.type="Sprite",void 0===Us){Us=new ji;var t=new zs(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 ks(t,3,0,!1)),Us.setAttribute("uv",new ks(t,2,3,!1))}this.geometry=Us,this.material=void 0!==e?e:new Vs,this.center=new Vn(.5,.5)}function nc(e,t,n,r,i,o){qs.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Xs.x=o*qs.x-i*qs.y,Xs.y=i*qs.x+o*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 o=this.center;nc(Zs.set(-.5,-.5,0),Ws,o,js,n,r),nc(Js.set(.5,-.5,0),Ws,o,js,n,r),nc(Ks.set(.5,.5,0),Ws,o,js,n,r),Qs.set(0,0),$s.set(1,0),ec.set(1,1);var a=e.ray.intersectTriangle(Zs,Js,Ks,!1,Hs);if(null!==a||(nc(Js.set(-.5,.5,0),Ws,o,js,n,r),$s.set(0,1),null!==(a=e.ray.intersectTriangle(Zs,Ks,Js,!1,Hs)))){var s=e.ray.origin.distanceTo(Hs);s<e.near||s>e.far||t.push({distance:s,point:Hs.clone(),uv:pi.getUV(Hs,Zs,Js,Ks,Qs,$s,ec,new Vn),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,oc,ac,sc,cc=new $n,uc=new $n;function lc(){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."),co.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new sr,this.bindMatrixInverse=new sr}lc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:lc,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),uc.setFromMatrixPosition(this.matrixWorld);var n=cc.distanceTo(uc)/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 o=n[r];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}),hc.prototype=Object.assign(Object.create(co.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){co.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,oc=new Xn,ac=new $n,sc=new sr,function(e,t){var n=this.skeleton,r=this.geometry;ic.fromBufferAttribute(r.attributes.skinIndex,e),oc.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 o=oc.getComponent(i);if(0!==o){var a=ic.getComponent(i);sc.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(ac.copy(rc).applyMatrix4(sc),o)}}return t.applyMatrix4(this.bindMatrixInverse)})});var pc=new sr,dc=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,o=e.length;i<o;i++){var a=e[i]?e[i].matrixWorld:dc;pc.multiplyMatrices(a,t[i]),pc.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 vc=new sr,gc=new sr,yc=[],xc=new co;function bc(e,t,n){co.call(this,e,t),this.instanceMatrix=new Si(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function wc(e){_i.call(this),this.type="LineBasicMaterial",this.color=new vi(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}bc.prototype=Object.assign(Object.create(co.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,vc),gc.multiplyMatrices(n,vc),xc.matrixWorld=gc,xc.raycast(e,yc);for(var o=0,a=yc.length;o<a;o++){var s=yc[o];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(){}}),wc.prototype=Object.create(_i.prototype),wc.prototype.constructor=wc,wc.prototype.isLineBasicMaterial=!0,wc.prototype.copy=function(e){return _i.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 _c=new $n,Mc=new $n,Tc=new sr,Sc=new Kr,Ec=new Hr;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 wc,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++)_c.fromBufferAttribute(t,r-1),Mc.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=_c.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 o=e.vertices;for((n=e.lineDistances)[0]=0,r=1,i=o.length;r<i;r++)n[r]=n[r-1],n[r]+=o[r-1].distanceTo(o[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 o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,s=new $n,c=new $n,u=new $n,l=new $n,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];s.fromArray(d,3*g),c.fromArray(d,3*y),Sc.distanceSqToSegment(s,c,l,u)>a||(l.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(l))<e.near||w>e.far||t.push({distance:w,point:u.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,v=d.length/3-1;m<v;m+=h)s.fromArray(d,3*m),c.fromArray(d,3*m+3),Sc.distanceSqToSegment(s,c,l,u)>a||(l.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(l))<e.near||w>e.far||t.push({distance:w,point:u.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 w;Sc.distanceSqToSegment(x[m],x[m+1],l,u)>a||(l.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(l))<e.near||w>e.far||t.push({distance:w,point:u.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,o=Object.keys(i);if(o.length>0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[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,Pc=new $n;function Rc(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){_i.call(this),this.type="PointsMaterial",this.color=new vi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Rc.prototype=Object.assign(Object.create(Ac.prototype),{constructor:Rc,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),Pc.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Lc.distanceTo(Pc);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 o=e.vertices;for(n=e.lineDistances,r=0,i=o.length;r<i;r+=2)Lc.copy(o[r]),Pc.copy(o[r+1]),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Lc.distanceTo(Pc)}return this}}),Cc.prototype=Object.assign(Object.create(Ac.prototype),{constructor:Cc,isLineLoop:!0}),Oc.prototype=Object.create(_i.prototype),Oc.prototype.constructor=Oc,Oc.prototype.isPointsMaterial=!0,Oc.prototype.copy=function(e){return _i.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 Hr,Bc=new $n;function Fc(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 zc(e,t,n,r,i,o,a){var s=Ic.distanceSqToPoint(e);if(s<n){var c=new $n;Ic.closestPointToPoint(e,c),c.applyMatrix4(r);var u=i.ray.origin.distanceTo(c);if(u<i.near||u>i.far)return;o.push({distance:u,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:a})}}function Uc(e,t,n,r,i,o,a,s,c){qn.call(this,e,t,n,r,i,o,a,s,c),this.format=void 0!==a?a:Ge,this.minFilter=void 0!==o?o:_e,this.magFilter=void 0!==i?i:_e,this.generateMipmaps=!1}function Gc(e,t,n,r,i,o,a,s,c,u,l,h){qn.call(this,null,o,a,s,c,u,r,i,l,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function kc(e,t,n,r,i,o,a,s,c){qn.call(this,e,t,n,r,i,o,a,s,c),this.needsUpdate=!0}function Vc(e,t,n,r,i,o,a,s,c,u){if((u=void 0!==u?u:We)!==We&&u!==qe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&u===We&&(n=Re),void 0===n&&u===qe&&(n=ze),qn.call(this,null,r,i,o,a,s,u,n,c),this.image={width:e,height:t},this.magFilter=void 0!==a?a:ge,this.minFilter=void 0!==s?s:ge,this.flipY=!1,this.generateMipmaps=!1}function Hc(e){ji.call(this),this.type="WireframeGeometry";var t,n,r,i,o,a,s,c,u,l,h=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],c=v[f[(n+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]})}for(u in d)a=d[u],l=e.vertices[a.index1],h.push(l.x,l.y,l.z),l=e.vertices[a.index2],h.push(l.x,l.y,l.z)}else if(e&&e.isBufferGeometry){var g,y,x,b,w,_,M;if(l=new $n,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,o=x.length;i<o;++i)for(t=w=(b=x[i]).start,r=w+b.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[u=p[0]+","+p[1]]&&(d[u]={index1:p[0],index2:p[1]});for(u in d)a=d[u],l.fromBufferAttribute(g,a.index1),h.push(l.x,l.y,l.z),l.fromBufferAttribute(g,a.index2),h.push(l.x,l.y,l.z)}else for(t=0,r=(g=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)_=3*t+n,l.fromBufferAttribute(g,_),h.push(l.x,l.y,l.z),M=3*t+(n+1)%3,l.fromBufferAttribute(g,M),h.push(l.x,l.y,l.z)}this.setAttribute("position",new Di(h,3))}function jc(e,t,n){vo.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,o=[],a=[],s=[],c=[],u=1e-5,l=new $n,h=new $n,p=new $n,d=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 v=r/n;for(i=0;i<=t;i++){var g=i/t;e(g,v,h),a.push(h.x,h.y,h.z),g-u>=0?(e(g-u,v,p),d.subVectors(h,p)):(e(g+u,v,p),d.subVectors(p,h)),v-u>=0?(e(g,v-u,p),f.subVectors(h,p)):(e(g,v+u,p),f.subVectors(p,h)),l.crossVectors(d,f).normalize(),s.push(l.x,l.y,l.z),c.push(g,v)}}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,w=(r+1)*m+i;o.push(y,x,w),o.push(x,b,w)}this.setIndex(o),this.setAttribute("position",new Di(a,3)),this.setAttribute("normal",new Di(s,3)),this.setAttribute("uv",new Di(c,2))}function qc(e,t,n,r){vo.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=[],o=[];function a(e,t,n,r){var i,o,a=Math.pow(2,r),c=[];for(i=0;i<=a;i++){c[i]=[];var u=e.clone().lerp(n,i/a),l=t.clone().lerp(n,i/a),h=a-i;for(o=0;o<=h;o++)c[i][o]=0===o&&i===a?u:u.clone().lerp(l,o/h)}for(i=0;i<a;i++)for(o=0;o<2*(a-i)-1;o++){var p=Math.floor(o/2);o%2==0?(s(c[i][p+1]),s(c[i+1][p]),s(c[i][p])):(s(c[i][p+1]),s(c[i+1][p+1]),s(c[i+1][p]))}}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 u(e,t,n,r){r<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=r/2/Math.PI+.5)}function l(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,o=0;o<t.length;o+=3)c(t[o+0],n),c(t[o+1],r),c(t[o+2],i),a(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=l(e)/2/Math.PI+.5,r=h(e)/Math.PI+.5;o.push(n,1-r)}(function(){for(var e=new $n,t=new $n,n=new $n,r=new $n,a=new Vn,s=new Vn,c=new Vn,h=0,p=0;h<i.length;h+=9,p+=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]),a.set(o[p+0],o[p+1]),s.set(o[p+2],o[p+3]),c.set(o[p+4],o[p+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=l(r);u(a,p+0,e,d),u(s,p+2,t,d),u(c,p+4,n,d)}})(),function(){for(var e=0;e<o.length;e+=6){var t=o[e+0],n=o[e+2],r=o[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);i>.9&&a<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new Di(i,3)),this.setAttribute("normal",new Di(i.slice(),3)),this.setAttribute("uv",new Di(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Yc(e,t){vo.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){vo.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){vo.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 eu(e,t){vo.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new tu(e,t)),this.mergeVertices()}function tu(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 nu(e,t,n,r,i,o){vo.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new ru(e,t,n,r,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function ru(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 o=e.computeFrenetFrames(t,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new $n,u=new $n,l=new Vn,h=new $n,p=[],d=[],f=[],m=[];function v(i){h=e.getPointAt(i/t,h);var a=o.normals[i],l=o.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);u.x=v*a.x+m*l.x,u.y=v*a.y+m*l.y,u.z=v*a.z+m*l.z,u.normalize(),d.push(u.x,u.y,u.z),c.x=h.x+n*u.x,c.y=h.y+n*u.y,c.z=h.z+n*u.z,p.push(c.x,c.y,c.z)}}!function(){for(a=0;a<t;a++)v(a);v(!1===i?t:0),function(){for(a=0;a<=t;a++)for(s=0;s<=r;s++)l.x=a/t,l.y=s/r,f.push(l.x,l.y)}(),function(){for(s=1;s<=t;s++)for(a=1;a<=r;a++){var e=(r+1)*(s-1)+(a-1),n=(r+1)*s+(a-1),i=(r+1)*s+a,o=(r+1)*(s-1)+a;m.push(e,n,o),m.push(n,i,o)}}()}(),this.setIndex(m),this.setAttribute("position",new Di(p,3)),this.setAttribute("normal",new Di(d,3)),this.setAttribute("uv",new Di(f,2))}function iu(e,t,n,r,i,o,a){vo.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new ou(e,t,n,r,i,o)),this.mergeVertices()}function ou(e,t,n,r,i,o){ji.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,o=o||3;var a,s,c=[],u=[],l=[],h=[],p=new $n,d=new $n,f=new $n,m=new $n,v=new $n,g=new $n,y=new $n;for(a=0;a<=n;++a){var x=a/n*i*Math.PI*2;for(A(x,i,o,e,f),A(x+.01,i,o,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*v.x),p.y=f.y+(w*y.y+_*v.y),p.z=f.z+(w*y.z+_*v.z),u.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),l.push(d.x,d.y,d.z),h.push(a/n),h.push(s/r)}}for(s=1;s<=n;s++)for(a=1;a<=r;a++){var M=(r+1)*(s-1)+(a-1),T=(r+1)*s+(a-1),S=(r+1)*s+a,E=(r+1)*(s-1)+a;c.push(M,T,E),c.push(T,S,E)}function A(e,t,n,r,i){var o=Math.cos(e),a=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*o,i.y=r*(2+c)*a*.5,i.z=r*Math.sin(s)*.5}this.setIndex(c),this.setAttribute("position",new Di(u,3)),this.setAttribute("normal",new Di(l,3)),this.setAttribute("uv",new Di(h,2))}function au(e,t,n,r,i){vo.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new su(e,t,n,r,i)),this.mergeVertices()}function su(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 o,a,s=[],c=[],u=[],l=[],h=new $n,p=new $n,d=new $n;for(o=0;o<=n;o++)for(a=0;a<=r;a++){var f=a/r*i,m=o/n*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),c.push(p.x,p.y,p.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),d.subVectors(p,h).normalize(),u.push(d.x,d.y,d.z),l.push(a/r),l.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=r;a++){var v=(r+1)*o+a-1,g=(r+1)*(o-1)+a-1,y=(r+1)*(o-1)+a,x=(r+1)*o+a;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute("position",new Di(c,3)),this.setAttribute("normal",new Di(u,3)),this.setAttribute("uv",new Di(l,2))}Fc.prototype=Object.assign(Object.create(Sr.prototype),{constructor:Fc,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 o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){var s=n.index,c=n.attributes.position.array;if(null!==s)for(var u=s.array,l=0,h=u.length;l<h;l++){var p=u[l];Bc.fromArray(c,3*p),zc(Bc,p,a,r,e,t,this)}else{l=0;for(var d=c.length/3;l<d;l++)Bc.fromArray(c,3*l),zc(Bc,l,a,r,e,t,this)}}else{var f=n.vertices;for(l=0,d=f.length;l<d;l++)zc(f[l],l,a,r,e,t,this)}}},updateMorphTargets:function(){var e,t,n,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,o=Object.keys(i);if(o.length>0){var a=i[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e<t;e++)n=a[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)}}),Gc.prototype=Object.create(qn.prototype),Gc.prototype.constructor=Gc,Gc.prototype.isCompressedTexture=!0,kc.prototype=Object.create(qn.prototype),kc.prototype.constructor=kc,kc.prototype.isCanvasTexture=!0,Vc.prototype=Object.create(qn.prototype),Vc.prototype.constructor=Vc,Vc.prototype.isDepthTexture=!0,Hc.prototype=Object.create(ji.prototype),Hc.prototype.constructor=Hc,jc.prototype=Object.create(vo.prototype),jc.prototype.constructor=jc,Wc.prototype=Object.create(ji.prototype),Wc.prototype.constructor=Wc,qc.prototype=Object.create(vo.prototype),qc.prototype.constructor=qc,Xc.prototype=Object.create(ji.prototype),Xc.prototype.constructor=Xc,Yc.prototype=Object.create(vo.prototype),Yc.prototype.constructor=Yc,Zc.prototype=Object.create(Xc.prototype),Zc.prototype.constructor=Zc,Jc.prototype=Object.create(vo.prototype),Jc.prototype.constructor=Jc,Kc.prototype=Object.create(Xc.prototype),Kc.prototype.constructor=Kc,Qc.prototype=Object.create(vo.prototype),Qc.prototype.constructor=Qc,$c.prototype=Object.create(Xc.prototype),$c.prototype.constructor=$c,eu.prototype=Object.create(vo.prototype),eu.prototype.constructor=eu,tu.prototype=Object.create(Xc.prototype),tu.prototype.constructor=tu,nu.prototype=Object.create(vo.prototype),nu.prototype.constructor=nu,ru.prototype=Object.create(ji.prototype),ru.prototype.constructor=ru,ru.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},iu.prototype=Object.create(vo.prototype),iu.prototype.constructor=iu,ou.prototype=Object.create(ji.prototype),ou.prototype.constructor=ou,au.prototype=Object.create(vo.prototype),au.prototype.constructor=au,su.prototype=Object.create(ji.prototype),su.prototype.constructor=su;function cu(e,t,n,r,i){var o,a;if(i===function(e,t,n,r){for(var i=0,o=t,a=n-r;o<n;o+=r)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}(e,t,n,r)>0)for(o=t;o<n;o+=r)a=Pu(o,e[o],e[o+1],a);else for(o=n-r;o>=t;o-=r)a=Pu(o,e[o],e[o+1],a);return a&&Mu(a,a.next)&&(Ru(a),a=a.next),a}function uu(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Mu(r,r.next)&&0!==_u(r.prev,r,r.next))r=r.next;else{if(Ru(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function lu(e,t,n,r,i,o,a){if(e){!a&&o&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=yu(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,o,a,s,c,u=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;t<u&&(s++,r=r.nextZ);t++);for(c=u;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--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,u*=2}while(a>1)}(i)}(e,r,i,o);for(var s,c,u=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?pu(e,r,i,o):hu(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Ru(e),e=c.next,u=c.next;else if((e=c)===u){a?1===a?lu(e=du(uu(e),t,n),t,n,r,i,o,2):2===a&&fu(e,t,n,r,i,o):lu(uu(e),t,n,r,i,o,1);break}}}function hu(e){var t=e.prev,n=e,r=e.next;if(_u(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(bu(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&_u(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function pu(e,t,n,r){var i=e.prev,o=e,a=e.next;if(_u(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,c=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,u=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,l=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=yu(s,c,t,n,r),p=yu(u,l,t,n,r),d=e.prevZ,f=e.nextZ;d&&d.z>=h&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&bu(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&_u(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&bu(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&_u(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&bu(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&_u(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&bu(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&_u(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function du(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!Mu(i,o)&&Tu(i,r,r.next,o)&&Au(i,o)&&Au(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),Ru(r),Ru(r.next),r=e=o),r=r.next}while(r!==e);return uu(r)}function fu(e,t,n,r,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&wu(a,s)){var c=Lu(a,s);return a=uu(a,a.next),c=uu(c,c.next),lu(a,t,n,r,i,o),void lu(c,t,n,r,i,o)}s=s.next}a=a.next}while(a!==e)}function mu(e,t){return e.x-t.x}function vu(e,t){if(t=function(e,t){var n,r=t,i=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a){if(a=s,s===i){if(o===r.y)return r;if(o===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===a)return n;var c,u=n,l=n.x,h=n.y,p=1/0;r=n;do{i>=r.x&&r.x>=l&&i!==r.x&&bu(o<h?i:a,o,l,h,o<h?a:i,o,r.x,r.y)&&(c=Math.abs(o-r.y)/(i-r.x),Au(r,e)&&(c<p||c===p&&(r.x>n.x||r.x===n.x&&gu(n,r)))&&(n=r,p=c)),r=r.next}while(r!==u);return n}(e,t)){var n=Lu(t,e);uu(t,t.next),uu(n,n.next)}}function gu(e,t){return _u(e.prev,e,t.prev)<0&&_u(t.next,e,e.next)<0}function yu(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 xu(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 bu(e,t,n,r,i,o,a,s){return(i-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function wu(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&&Tu(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Au(e,t)&&Au(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(_u(e.prev,e,t.prev)||_u(e,t.prev,t))||Mu(e,t)&&_u(e.prev,e,e.next)>0&&_u(t.prev,t,t.next)>0)}function _u(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Mu(e,t){return e.x===t.x&&e.y===t.y}function Tu(e,t,n,r){var i=Eu(_u(e,t,n)),o=Eu(_u(e,t,r)),a=Eu(_u(n,r,e)),s=Eu(_u(n,r,t));return i!==o&&a!==s||!(0!==i||!Su(e,n,t))||!(0!==o||!Su(e,r,t))||!(0!==a||!Su(n,e,r))||!(0!==s||!Su(n,t,r))}function Su(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 Eu(e){return e>0?1:e<0?-1:0}function Au(e,t){return _u(e.prev,e,e.next)<0?_u(e,t,e.next)>=0&&_u(e,e.prev,t)>=0:_u(e,t,e.prev)<0||_u(e,e.next,t)<0}function Lu(e,t){var n=new Cu(e.i,e.x,e.y),r=new Cu(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Pu(e,t,n,r){var i=new Cu(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 Ru(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 Cu(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 Ou={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 Ou.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Du(e),Iu(n,e);var o=e.length;t.forEach(Du);for(var a=0;a<t.length;a++)r.push(o),o+=t[a].length,Iu(n,t[a]);var s=function(e,t,n){n=n||2;var r,i,o,a,s,c,u,l=t&&t.length,h=l?t[0]*n:e.length,p=cu(e,0,h,n,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(e,t,n,r){var i,o,a,s=[];for(i=0,o=t.length;i<o;i++)(a=cu(e,t[i]*r,i<o-1?t[i+1]*r:e.length,r,!1))===a.next&&(a.steiner=!0),s.push(xu(a));for(s.sort(mu),i=0;i<s.length;i++)vu(s[i],n),n=uu(n,n.next);return n}(e,t,p,n)),e.length>80*n){r=o=e[0],i=a=e[1];for(var f=n;f<h;f+=n)(s=e[f])<r&&(r=s),(c=e[f+1])<i&&(i=c),s>o&&(o=s),c>a&&(a=c);u=0!==(u=Math.max(o-r,a-i))?1/u:0}return lu(p,d,n,r,i,u),d}(n,r);for(a=0;a<s.length;a+=3)i.push(s.slice(a,a+3));return i}};function Du(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Iu(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Nu(e,t){vo.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Bu(e,t)),this.mergeVertices()}function Bu(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=[],o=0,a=e.length;o<a;o++)s(e[o]);function s(e){var o=[],a=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,c=void 0!==t.depth?t.depth:100,u=void 0===t.bevelEnabled||t.bevelEnabled,l=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:l-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:Fu;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);var v,g,y,x,b,w,_,M,T=!1;f&&(v=f.getSpacedPoints(s),T=!0,u=!1,g=f.computeFrenetFrames(s,!1),y=new $n,x=new $n,b=new $n),u||(d=0,l=0,h=0,p=0);var S=e.extractPoints(a),E=S.shape,A=S.holes;if(!Ou.isClockWise(E))for(E=E.reverse(),_=0,M=A.length;_<M;_++)w=A[_],Ou.isClockWise(w)&&(A[_]=w.reverse());var L=Ou.triangulateShape(E,A),P=E;for(_=0,M=A.length;_<M;_++)w=A[_],E=E.concat(w);function R(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,B,F=E.length,z=L.length;function U(e,t,n){var r,i,o,a=e.x-t.x,s=e.y-t.y,c=n.x-e.x,u=n.y-e.y,l=a*a+s*s,h=a*u-s*c;if(Math.abs(h)>Number.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+u*u),f=t.x-s/p,m=t.y+a/p,v=((n.x-u/d-f)*u-(n.y+c/d-m)*c)/(a*u-s*c),g=(r=f+a*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new Vn(r,i);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=a,o=Math.sqrt(l)):(r=a,i=s,o=Math.sqrt(l/2))}return new Vn(r/o,i/o)}for(var G=[],k=0,V=P.length,H=V-1,j=k+1;k<V;k++,H++,j++)H===V&&(H=0),j===V&&(j=0),G[k]=U(P[k],P[H],P[j]);var W,q,X=[],Y=G.concat();for(_=0,M=A.length;_<M;_++){for(w=A[_],W=[],k=0,H=(V=w.length)-1,j=k+1;k<V;k++,H++,j++)H===V&&(H=0),j===V&&(j=0),W[k]=U(w[k],w[H],w[j]);X.push(W),Y=Y.concat(W)}for(C=0;C<d;C++){for(D=C/d,I=l*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+p,k=0,V=P.length;k<V;k++)J((N=R(P[k],G[k],O)).x,N.y,-I);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],k=0,V=w.length;k<V;k++)J((N=R(w[k],W[k],O)).x,N.y,-I)}for(O=h+p,k=0;k<F;k++)N=u?R(E[k],Y[k],O):E[k],T?(x.copy(g.normals[0]).multiplyScalar(N.x),y.copy(g.binormals[0]).multiplyScalar(N.y),b.copy(v[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(k=0;k<F;k++)N=u?R(E[k],Y[k],O):E[k],T?(x.copy(g.normals[q]).multiplyScalar(N.x),y.copy(g.binormals[q]).multiplyScalar(N.y),b.copy(v[q]).add(x).add(y),J(b.x,b.y,b.z)):J(N.x,N.y,c/s*q);for(C=d-1;C>=0;C--){for(D=C/d,I=l*Math.cos(D*Math.PI/2),O=h*Math.sin(D*Math.PI/2)+p,k=0,V=P.length;k<V;k++)J((N=R(P[k],G[k],O)).x,N.y,c+I);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],k=0,V=w.length;k<V;k++)N=R(w[k],W[k],O),T?J(N.x,N.y+v[s-1].y,v[s-1].x+I):J(N.x,N.y,c+I)}function Z(e,t){var n,r;for(k=e.length;--k>=0;){n=k,(r=k-1)<0&&(r=e.length-1);var i=0,o=s+2*d;for(i=0;i<o;i++){var a=F*i,c=F*(i+1);Q(t+n+a,t+r+a,t+r+c,t+n+c)}}}function J(e,t,n){o.push(e),o.push(t),o.push(n)}function K(e,t,i){$(e),$(t),$(i);var o=r.length/3,a=m.generateTopUV(n,r,o-3,o-2,o-1);ee(a[0]),ee(a[1]),ee(a[2])}function Q(e,t,i,o){$(e),$(t),$(o),$(t),$(i),$(o);var a=r.length/3,s=m.generateSideWallUV(n,r,a-6,a-3,a-2,a-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){r.push(o[3*e+0]),r.push(o[3*e+1]),r.push(o[3*e+2])}function ee(e){i.push(e.x),i.push(e.y)}!function(){var e=r.length/3;if(u){var t=0,i=F*t;for(k=0;k<z;k++)K((B=L[k])[2]+i,B[1]+i,B[0]+i);for(i=F*(t=s+2*d),k=0;k<z;k++)K((B=L[k])[0]+i,B[1]+i,B[2]+i)}else{for(k=0;k<z;k++)K((B=L[k])[2],B[1],B[0]);for(k=0;k<z;k++)K((B=L[k])[0]+F*s,B[1]+F*s,B[2]+F*s)}n.addGroup(e,r.length/3-e,0)}(),function(){var e=r.length/3,t=0;for(Z(P,t),t+=P.length,_=0,M=A.length;_<M;_++)Z(w=A[_],t),t+=w.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()}Nu.prototype=Object.create(vo.prototype),Nu.prototype.constructor=Nu,Nu.prototype.toJSON=function(){var e=vo.prototype.toJSON.call(this);return zu(this.parameters.shapes,this.parameters.options,e)},Bu.prototype=Object.create(ji.prototype),Bu.prototype.constructor=Bu,Bu.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return zu(this.parameters.shapes,this.parameters.options,e)};var Fu={generateTopUV:function(e,t,n,r,i){var o=t[3*n],a=t[3*n+1],s=t[3*r],c=t[3*r+1],u=t[3*i],l=t[3*i+1];return[new Vn(o,a),new Vn(s,c),new Vn(u,l)]},generateSideWallUV:function(e,t,n,r,i,o){var a=t[3*n],s=t[3*n+1],c=t[3*n+2],u=t[3*r],l=t[3*r+1],h=t[3*r+2],p=t[3*i],d=t[3*i+1],f=t[3*i+2],m=t[3*o],v=t[3*o+1],g=t[3*o+2];return Math.abs(s-l)<.01?[new Vn(a,1-c),new Vn(u,1-h),new Vn(p,1-f),new Vn(m,1-g)]:[new Vn(s,1-c),new Vn(l,1-h),new Vn(d,1-f),new Vn(v,1-g)]}};function zu(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var o=e[r];n.shapes.push(o.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Uu(e,t){vo.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Gu(e,t)),this.mergeVertices()}function Gu(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 vo;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),Bu.call(this,r,t),this.type="TextBufferGeometry"}function ku(e,t,n,r,i,o,a){vo.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Vu(e,t,n,r,i,o,a)),this.mergeVertices()}function Vu(e,t,n,r,i,o,a){ji.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},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,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,c,u=Math.min(o+a,Math.PI),l=0,h=[],p=new $n,d=new $n,f=[],m=[],v=[],g=[];for(c=0;c<=n;c++){var y=[],x=c/n,b=0;for(0==c&&0==o?b=.5/t:c==n&&u==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var w=s/t;p.x=-e*Math.cos(r+w*i)*Math.sin(o+x*a),p.y=e*Math.cos(o+x*a),p.z=e*Math.sin(r+w*i)*Math.sin(o+x*a),m.push(p.x,p.y,p.z),d.copy(p).normalize(),v.push(d.x,d.y,d.z),g.push(w+b,1-x),y.push(l++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var _=h[c][s+1],M=h[c][s],T=h[c+1][s],S=h[c+1][s+1];(0!==c||o>0)&&f.push(_,M,S),(c!==n-1||u<Math.PI)&&f.push(M,T,S)}this.setIndex(f),this.setAttribute("position",new Di(m,3)),this.setAttribute("normal",new Di(v,3)),this.setAttribute("uv",new Di(g,2))}function Hu(e,t,n,r,i,o){vo.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new ju(e,t,n,r,i,o)),this.mergeVertices()}function ju(e,t,n,r,i,o){ji.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},e=e||.5,t=t||1,i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var a,s,c,u=[],l=[],h=[],p=[],d=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new $n,v=new Vn;for(s=0;s<=r;s++){for(c=0;c<=n;c++)a=i+c/n*o,m.x=d*Math.cos(a),m.y=d*Math.sin(a),l.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,p.push(v.x,v.y);d+=f}for(s=0;s<r;s++){var g=s*(n+1);for(c=0;c<n;c++){var y=a=c+g,x=a+n+1,b=a+n+2,w=a+1;u.push(y,x,w),u.push(x,b,w)}}this.setIndex(u),this.setAttribute("position",new Di(l,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(p,2))}function Wu(e,t,n,r){vo.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new qu(e,t,n,r)),this.mergeVertices()}function qu(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=kn.clamp(r,0,2*Math.PI);var i,o,a,s=[],c=[],u=[],l=1/t,h=new $n,p=new Vn;for(o=0;o<=t;o++){var d=n+o*l*r,f=Math.sin(d),m=Math.cos(d);for(a=0;a<=e.length-1;a++)h.x=e[a].x*f,h.y=e[a].y,h.z=e[a].x*m,c.push(h.x,h.y,h.z),p.x=o/t,p.y=a/(e.length-1),u.push(p.x,p.y)}for(o=0;o<t;o++)for(a=0;a<e.length-1;a++){var v=i=a+o*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute("position",new Di(c,3)),this.setAttribute("uv",new Di(u,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,w=new $n,_=new $n,M=new $n;for(i=t*e.length*3,o=0,a=0;o<e.length;o++,a+=3)w.x=b[a+0],w.y=b[a+1],w.z=b[a+2],_.x=b[i+a+0],_.y=b[i+a+1],_.z=b[i+a+2],M.addVectors(w,_).normalize(),b[a+0]=b[i+a+0]=M.x,b[a+1]=b[i+a+1]=M.y,b[a+2]=b[i+a+2]=M.z}}function Xu(e,t){vo.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 Yu(e,t)),this.mergeVertices()}function Yu(e,t){ji.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],o=[],a=0,s=0;if(!1===Array.isArray(e))u(e);else for(var c=0;c<e.length;c++)u(e[c]),this.addGroup(a,s,c),a+=s,s=0;function u(e){var a,c,u,l=r.length/3,h=e.extractPoints(t),p=h.shape,d=h.holes;for(!1===Ou.isClockWise(p)&&(p=p.reverse()),a=0,c=d.length;a<c;a++)u=d[a],!0===Ou.isClockWise(u)&&(d[a]=u.reverse());var f=Ou.triangulateShape(p,d);for(a=0,c=d.length;a<c;a++)u=d[a],p=p.concat(u);for(a=0,c=p.length;a<c;a++){var m=p[a];r.push(m.x,m.y,0),i.push(0,0,1),o.push(m.x,m.y)}for(a=0,c=f.length;a<c;a++){var v=f[a],g=v[0]+l,y=v[1]+l,x=v[2]+l;n.push(g,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(o,2))}function Zu(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 Ju(e,t){ji.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,o,a=[],s=Math.cos(kn.DEG2RAD*t),c=[0,0],u={},l=["a","b","c"];e.isBufferGeometry?(o=new vo).fromBufferGeometry(e):o=e.clone(),o.mergeVertices(),o.computeFaceNormals();for(var h=o.vertices,p=o.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)n=m[l[v]],r=m[l[(v+1)%3]],c[0]=Math.min(n,r),c[1]=Math.max(n,r),void 0===u[i=c[0]+","+c[1]]?u[i]={index1:c[0],index2:c[1],face1:d,face2:void 0}:u[i].face2=d;for(i in u){var g=u[i];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=h[g.index1];a.push(y.x,y.y,y.z),y=h[g.index2],a.push(y.x,y.y,y.z)}}this.setAttribute("position",new Di(a,3))}function Ku(e,t,n,r,i,o,a,s){vo.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new Qu(e,t,n,r,i,o,a,s)),this.mergeVertices()}function Qu(e,t,n,r,i,o,a,s){ji.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,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,o=void 0!==o&&o,a=void 0!==a?a:0,s=void 0!==s?s:2*Math.PI;var u=[],l=[],h=[],p=[],d=0,f=[],m=n/2,v=0;function g(n){var i,o,f,g=new Vn,y=new $n,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(o=d,i=1;i<=r;i++)l.push(0,m*w,0),h.push(0,w,0),p.push(.5,.5),d++;for(f=d,i=0;i<=r;i++){var _=i/r*s+a,M=Math.cos(_),T=Math.sin(_);y.x=b*T,y.y=m*w,y.z=b*M,l.push(y.x,y.y,y.z),h.push(0,w,0),g.x=.5*M+.5,g.y=.5*T*w+.5,p.push(g.x,g.y),d++}for(i=0;i<r;i++){var S=o+i,E=f+i;!0===n?u.push(E,E+1,S):u.push(E+1,E,S),x+=3}c.addGroup(v,x,!0===n?1:2),v+=x}!function(){var o,g,y=new $n,x=new $n,b=0,w=(t-e)/n;for(g=0;g<=i;g++){var _=[],M=g/i,T=M*(t-e)+e;for(o=0;o<=r;o++){var S=o/r,E=S*s+a,A=Math.sin(E),L=Math.cos(E);x.x=T*A,x.y=-M*n+m,x.z=T*L,l.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),h.push(y.x,y.y,y.z),p.push(S,1-M),_.push(d++)}f.push(_)}for(o=0;o<r;o++)for(g=0;g<i;g++){var P=f[g][o],R=f[g+1][o],C=f[g+1][o+1],O=f[g][o+1];u.push(P,R,O),u.push(R,C,O),b+=6}c.addGroup(v,b,0),v+=b}(),!1===o&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(u),this.setAttribute("position",new Di(l,3)),this.setAttribute("normal",new Di(h,3)),this.setAttribute("uv",new Di(p,2))}function $u(e,t,n,r,i,o,a){Ku.call(this,0,e,t,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function el(e,t,n,r,i,o,a){Qu.call(this,0,e,t,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function tl(e,t,n,r){vo.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new nl(e,t,n,r)),this.mergeVertices()}function nl(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,o,a=[],s=[],c=[],u=[],l=new $n,h=new Vn;for(s.push(0,0,0),c.push(0,0,1),u.push(.5,.5),o=0,i=3;o<=t;o++,i+=3){var p=n+o/t*r;l.x=e*Math.cos(p),l.y=e*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,u.push(h.x,h.y)}for(i=1;i<=t;i++)a.push(i,i+1,0);this.setIndex(a),this.setAttribute("position",new Di(s,3)),this.setAttribute("normal",new Di(c,3)),this.setAttribute("uv",new Di(u,2))}Uu.prototype=Object.create(vo.prototype),Uu.prototype.constructor=Uu,Gu.prototype=Object.create(Bu.prototype),Gu.prototype.constructor=Gu,ku.prototype=Object.create(vo.prototype),ku.prototype.constructor=ku,Vu.prototype=Object.create(ji.prototype),Vu.prototype.constructor=Vu,Hu.prototype=Object.create(vo.prototype),Hu.prototype.constructor=Hu,ju.prototype=Object.create(ji.prototype),ju.prototype.constructor=ju,Wu.prototype=Object.create(vo.prototype),Wu.prototype.constructor=Wu,qu.prototype=Object.create(ji.prototype),qu.prototype.constructor=qu,Xu.prototype=Object.create(vo.prototype),Xu.prototype.constructor=Xu,Xu.prototype.toJSON=function(){var e=vo.prototype.toJSON.call(this);return Zu(this.parameters.shapes,e)},Yu.prototype=Object.create(ji.prototype),Yu.prototype.constructor=Yu,Yu.prototype.toJSON=function(){var e=ji.prototype.toJSON.call(this);return Zu(this.parameters.shapes,e)},Ju.prototype=Object.create(ji.prototype),Ju.prototype.constructor=Ju,Ku.prototype=Object.create(vo.prototype),Ku.prototype.constructor=Ku,Qu.prototype=Object.create(ji.prototype),Qu.prototype.constructor=Qu,$u.prototype=Object.create(Ku.prototype),$u.prototype.constructor=$u,el.prototype=Object.create(Qu.prototype),el.prototype.constructor=el,tl.prototype=Object.create(vo.prototype),tl.prototype.constructor=tl,nl.prototype=Object.create(ji.prototype),nl.prototype.constructor=nl;var rl=Object.freeze({__proto__:null,WireframeGeometry:Hc,ParametricGeometry:jc,ParametricBufferGeometry:Wc,TetrahedronGeometry:Yc,TetrahedronBufferGeometry:Zc,OctahedronGeometry:Jc,OctahedronBufferGeometry:Kc,IcosahedronGeometry:Qc,IcosahedronBufferGeometry:$c,DodecahedronGeometry:eu,DodecahedronBufferGeometry:tu,PolyhedronGeometry:qc,PolyhedronBufferGeometry:Xc,TubeGeometry:nu,TubeBufferGeometry:ru,TorusKnotGeometry:iu,TorusKnotBufferGeometry:ou,TorusGeometry:au,TorusBufferGeometry:su,TextGeometry:Uu,TextBufferGeometry:Gu,SphereGeometry:ku,SphereBufferGeometry:Vu,RingGeometry:Hu,RingBufferGeometry:ju,PlaneGeometry:Io,PlaneBufferGeometry:No,LatheGeometry:Wu,LatheBufferGeometry:qu,ShapeGeometry:Xu,ShapeBufferGeometry:Yu,ExtrudeGeometry:Nu,ExtrudeBufferGeometry:Bu,EdgesGeometry:Ju,ConeGeometry:$u,ConeBufferGeometry:el,CylinderGeometry:Ku,CylinderBufferGeometry:Qu,CircleGeometry:tl,CircleBufferGeometry:nl,BoxGeometry:go,BoxBufferGeometry:yo});function il(e){_i.call(this),this.type="ShadowMaterial",this.color=new vi(0),this.transparent=!0,this.setValues(e)}function ol(e){_o.call(this,e),this.type="RawShaderMaterial"}function al(e){_i.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new vi(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 vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ln,this.normalScale=new Vn(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 sl(e){al.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Vn(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function cl(e){_i.call(this),this.type="MeshPhongMaterial",this.color=new vi(16777215),this.specular=new vi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ln,this.normalScale=new Vn(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 ul(e){_i.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new vi(16777215),this.specular=new vi(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 vi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ln,this.normalScale=new Vn(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 ll(e){_i.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ln,this.normalScale=new Vn(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 hl(e){_i.call(this),this.type="MeshLambertMaterial",this.color=new vi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new vi(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 pl(e){_i.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new vi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ln,this.normalScale=new Vn(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 dl(e){wc.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}il.prototype=Object.create(_i.prototype),il.prototype.constructor=il,il.prototype.isShadowMaterial=!0,il.prototype.copy=function(e){return _i.prototype.copy.call(this,e),this.color.copy(e.color),this},ol.prototype=Object.create(_o.prototype),ol.prototype.constructor=ol,ol.prototype.isRawShaderMaterial=!0,al.prototype=Object.create(_i.prototype),al.prototype.constructor=al,al.prototype.isMeshStandardMaterial=!0,al.prototype.copy=function(e){return _i.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},sl.prototype=Object.create(al.prototype),sl.prototype.constructor=sl,sl.prototype.isMeshPhysicalMaterial=!0,sl.prototype.copy=function(e){return al.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 vi).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},cl.prototype=Object.create(_i.prototype),cl.prototype.constructor=cl,cl.prototype.isMeshPhongMaterial=!0,cl.prototype.copy=function(e){return _i.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},ul.prototype=Object.create(_i.prototype),ul.prototype.constructor=ul,ul.prototype.isMeshToonMaterial=!0,ul.prototype.copy=function(e){return _i.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},ll.prototype=Object.create(_i.prototype),ll.prototype.constructor=ll,ll.prototype.isMeshNormalMaterial=!0,ll.prototype.copy=function(e){return _i.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},hl.prototype=Object.create(_i.prototype),hl.prototype.constructor=hl,hl.prototype.isMeshLambertMaterial=!0,hl.prototype.copy=function(e){return _i.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},pl.prototype=Object.create(_i.prototype),pl.prototype.constructor=pl,pl.prototype.isMeshMatcapMaterial=!0,pl.prototype.copy=function(e){return _i.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},dl.prototype=Object.create(wc.prototype),dl.prototype.constructor=dl,dl.prototype.isLineDashedMaterial=!0,dl.prototype.copy=function(e){return wc.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var fl=Object.freeze({__proto__:null,ShadowMaterial:il,SpriteMaterial:Vs,RawShaderMaterial:ol,ShaderMaterial:_o,PointsMaterial:Oc,MeshPhysicalMaterial:sl,MeshStandardMaterial:al,MeshPhongMaterial:cl,MeshToonMaterial:ul,MeshNormalMaterial:ll,MeshLambertMaterial:hl,MeshDepthMaterial:Ts,MeshDistanceMaterial:Ss,MeshBasicMaterial:Mi,MeshMatcapMaterial:pl,LineDashedMaterial:dl,LineBasicMaterial:wc,Material:_i}),ml={arraySlice:function(e,t,n){return ml.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),o=0,a=0;a!==r;++o)for(var s=n[o]*t,c=0;c!==t;++c)i[a++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,o=e[0];void 0!==o&&void 0===o[r];)o=e[i++];if(void 0!==o){var a=o[r];if(void 0!==a)if(Array.isArray(a))do{void 0!==(a=o[r])&&(t.push(o.time),n.push.apply(n,a)),o=e[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{void 0!==(a=o[r])&&(t.push(o.time),a.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{void 0!==(a=o[r])&&(t.push(o.time),n.push(a)),o=e[i++]}while(void 0!==o)}},subclip:function(e,t,n,r,i){i=i||30;var o=e.clone();o.name=t;for(var a=[],s=0;s<o.tracks.length;++s){for(var c=o.tracks[s],u=c.getValueSize(),l=[],h=[],p=0;p<c.times.length;++p){var d=c.times[p]*i;if(!(d<n||d>=r)){l.push(c.times[p]);for(var f=0;f<u;++f)h.push(c.values[p*u+f])}}0!==l.length&&(c.times=ml.convertArray(l,c.times.constructor),c.values=ml.convertArray(h,c.values.constructor),a.push(c))}o.tracks=a;var m=1/0;for(s=0;s<o.tracks.length;++s)m>o.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(s=0;s<o.tracks.length;++s)o.tracks[s].shift(-1*m);return o.resetDuration(),o},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,o=t/r,a=0;a<i;++a){var s=n.tracks[a],c=s.ValueTypeName;if("bool"!==c&&"string"!==c){var u=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===c}));if(void 0!==u){var l,h=s.getValueSize(),p=s.times.length-1;if(o<=s.times[0])l=ml.arraySlice(s.values,0,s.valueSize);else if(o>=s.times[p]){var d=p*h;l=ml.arraySlice(s.values,d)}else{var f=s.createInterpolant();f.evaluate(o),l=f.resultBuffer}"quaternion"===c&&new Jn(l[0],l[1],l[2],l[3]).normalize().conjugate().toArray(l);for(var m=u.times.length,v=0;v<m;++v){var g=v*h;if("quaternion"===c)Jn.multiplyQuaternionsFlat(u.values,g,l,0,u.values,g);else for(var y=0;y<h;++y)u.values[g+y]-=l[y]}}}}return e.blendMode=Zt,e}};function vl(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 gl(e,t,n,r){vl.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function yl(e,t,n,r){vl.call(this,e,t,n,r)}function xl(e,t,n,r){vl.call(this,e,t,n,r)}function bl(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=ml.convertArray(t,this.TimeBufferType),this.values=ml.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function wl(e,t,n){bl.call(this,e,t,n)}function _l(e,t,n,r){bl.call(this,e,t,n,r)}function Ml(e,t,n,r){bl.call(this,e,t,n,r)}function Tl(e,t,n,r){vl.call(this,e,t,n,r)}function Sl(e,t,n,r){bl.call(this,e,t,n,r)}function El(e,t,n,r){bl.call(this,e,t,n,r)}function Al(e,t,n,r){bl.call(this,e,t,n,r)}function Ll(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=kn.generateUUID(),this.duration<0&&this.resetDuration()}function Pl(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 Ml;case"vector":case"vector2":case"vector3":case"vector4":return Al;case"color":return _l;case"quaternion":return Sl;case"bool":case"boolean":return wl;case"string":return El}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];ml.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(vl.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var o;n:{r:if(!(e<r)){for(var a=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===a)break;if(i=r,e<(r=t[++n]))break t}o=t.length;break n}if(e>=i)break e;var s=t[1];for(e<s&&(n=2,i=s),a=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===a)break;if(r=i,e>=(i=t[--n-1]))break t}o=n,n=0}for(;n<o;){var c=n+o>>>1;e<t[c]?o=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,o=0;o!==r;++o)t[o]=n[i+o];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(vl.prototype,{beforeStart_:vl.prototype.copySampleValue_,afterEnd_:vl.prototype.copySampleValue_}),gl.prototype=Object.assign(Object.create(vl.prototype),{constructor:gl,DefaultSettings_:{endingStart:Wt,endingEnd:Wt},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,o=e+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case qt:i=e,a=2*t-n;break;case Xt:a=t+r[i=r.length-2]-r[i+1];break;default:i=e,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case qt:o=e,s=2*n-t;break;case Xt:o=1,s=n+r[1]-r[0];break;default:o=e-1,s=t}var c=.5*(n-t),u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(s-n),this._offsetPrev=i*u,this._offsetNext=o*u},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,u=this._offsetPrev,l=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-t)/(r-t),f=d*d,m=f*d,v=-h*m+2*h*f-h*d,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==a;++b)i[b]=v*o[u+b]+g*o[c+b]+y*o[s+b]+x*o[l+b];return i}}),yl.prototype=Object.assign(Object.create(vl.prototype),{constructor:yl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=s-a,u=(n-t)/(r-t),l=1-u,h=0;h!==a;++h)i[h]=o[c+h]*l+o[s+h]*u;return i}}),xl.prototype=Object.assign(Object.create(vl.prototype),{constructor:xl,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(bl,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:ml.convertArray(e.times,Array),values:ml.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(bl.prototype,{constructor:bl,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Ht,InterpolantFactoryMethodDiscrete:function(e){return new xl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new yl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new gl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Vt:t=this.InterpolantFactoryMethodDiscrete;break;case Ht: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 Vt;case this.InterpolantFactoryMethodLinear:return Ht;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,o=r-1;i!==r&&n[i]<e;)++i;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==i||o!==r){i>=o&&(i=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=ml.arraySlice(n,i,o),this.values=ml.arraySlice(this.values,i*a,o*a)}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 o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&ml.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var u=r[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}}return e},optimize:function(){for(var e=ml.arraySlice(this.times),t=ml.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===jt,i=1,o=e.length-1,a=1;a<o;++a){var s=!1,c=e[a];if(c!==e[a+1]&&(1!==a||c!==c[0]))if(r)s=!0;else for(var u=a*n,l=u-n,h=u+n,p=0;p!==n;++p){var d=t[u+p];if(d!==t[l+p]||d!==t[h+p]){s=!0;break}}if(s){if(a!==i){e[i]=e[a];var f=a*n,m=i*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++i}}if(o>0){for(e[i]=e[o],f=o*n,m=i*n,p=0;p!==n;++p)t[m+p]=t[f+p];++i}return i!==e.length?(this.times=ml.arraySlice(e,0,i),this.values=ml.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=ml.arraySlice(this.times,0),t=ml.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),wl.prototype=Object.assign(Object.create(bl.prototype),{constructor:wl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Vt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),_l.prototype=Object.assign(Object.create(bl.prototype),{constructor:_l,ValueTypeName:"color"}),Ml.prototype=Object.assign(Object.create(bl.prototype),{constructor:Ml,ValueTypeName:"number"}),Tl.prototype=Object.assign(Object.create(vl.prototype),{constructor:Tl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=e*a,c=(n-t)/(r-t),u=s+a;s!==u;s+=4)Jn.slerpFlat(i,0,o,s-a,o,s,c);return i}}),Sl.prototype=Object.assign(Object.create(bl.prototype),{constructor:Sl,ValueTypeName:"quaternion",DefaultInterpolation:Ht,InterpolantFactoryMethodLinear:function(e){return new Tl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),El.prototype=Object.assign(Object.create(bl.prototype),{constructor:El,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Vt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Al.prototype=Object.assign(Object.create(bl.prototype),{constructor:Al,ValueTypeName:"vector"}),Object.assign(Ll,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,o=n.length;i!==o;++i)t.push(Pl(n[i]).scale(r));return new Ll(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,o=n.length;i!==o;++i)t.push(bl.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,o=[],a=0;a<i;a++){var s=[],c=[];s.push((a+i-1)%i,a,(a+1)%i),c.push(0,1,0);var u=ml.getKeyframeOrder(s);s=ml.sortedArray(s,1,u),c=ml.sortedArray(c,1,u),r||0!==s[0]||(s.push(i),c.push(c[0])),o.push(new Ml(".morphTargetInfluences["+t[a].name+"]",s,c).scale(1/n))}return new Ll(e,-1,o)},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]+)$/,o=0,a=e.length;o<a;o++){var s=e[o],c=s.name.match(i);if(c&&c.length>1){var u=r[h=c[1]];u||(r[h]=u=[]),u.push(s)}}var l=[];for(var h in r)l.push(Ll.CreateFromMorphTargetSequence(h,r[h],t,n));return l},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 o=[],a=[];ml.flattenJSON(n,o,a,r),0!==o.length&&i.push(new e(t,o,a))}},r=[],i=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.blendMode,c=e.hierarchy||[],u=0;u<c.length;u++){var l=c[u].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},p=0;p<l.length;p++)if(l[p].morphTargets)for(var d=0;d<l[p].morphTargets.length;d++)h[l[p].morphTargets[d]]=-1;for(var f in h){var m=[],v=[];for(d=0;d!==l[p].morphTargets.length;++d){var g=l[p];m.push(g.time),v.push(g.morphTarget===f?1:0)}r.push(new Ml(".morphTargetInfluence["+f+"]",m,v))}o=h.length*(a||1)}else{var y=".bones["+t[u].name+"]";n(Al,y+".position",l,"pos",r),n(Sl,y+".quaternion",l,"rot",r),n(Al,y+".scale",l,"scl",r)}}return 0===r.length?null:new Ll(i,o,r,s)}}),Object.assign(Ll.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 Ll(this.name,this.duration,e,this.blendMode)}});var Rl={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 Cl(e,t,n){var r=this,i=!1,o=0,a=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===i&&void 0!==r.onStart&&r.onStart(e,o,a),i=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,a),o===a&&(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 Ol=new Cl;function Dl(e){this.manager=void 0!==e?e:Ol,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(Dl.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 Il={};function Nl(e){Dl.call(this,e)}function Bl(e){Dl.call(this,e)}function Fl(e){Dl.call(this,e)}function zl(e){Dl.call(this,e)}function Ul(e){Dl.call(this,e)}function Gl(e){Dl.call(this,e)}function kl(e){Dl.call(this,e)}function Vl(){this.type="Curve",this.arcLengthDivisions=200}function Hl(e,t,n,r,i,o,a,s){Vl.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=o||2*Math.PI,this.aClockwise=a||!1,this.aRotation=s||0}function jl(e,t,n,r,i,o){Hl.call(this,e,t,n,n,r,i,o),this.type="ArcCurve"}function Wl(){var e=0,t=0,n=0,r=0;function i(i,o,a,s){e=i,t=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(e,t,n,r,o){i(t,n,o*(n-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,o,a,s){var c=(t-e)/o-(n-e)/(o+a)+(n-t)/a,u=(n-t)/a-(r-t)/(a+s)+(r-n)/s;i(t,n,c*=a,u*=a)},calc:function(i){var o=i*i;return e+t*i+n*o+r*(o*i)}}}Nl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Nl,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,o=Rl.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;if(void 0===Il[e]){var a=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(a){var s=a[1],c=!!a[2],u=a[3];u=decodeURIComponent(u),c&&(u=atob(u));try{var l,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var p=new Uint8Array(u.length),d=0;d<u.length;d++)p[d]=u.charCodeAt(d);l="blob"===h?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;l=f.parseFromString(u,s);break;case"json":l=JSON.parse(u);break;default:l=u}setTimeout((function(){t&&t(l),i.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}),0)}}else{Il[e]=[],Il[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var v in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,r=Il[e];if(delete Il[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Rl.add(e,n);for(var o=0,a=r.length;o<a;o++)(s=r[o]).onLoad&&s.onLoad(n);i.manager.itemEnd(e)}else{for(o=0,a=r.length;o<a;o++){var s;(s=r[o]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=Il[e],r=0,i=n.length;r<i;r++){var o=n[r];o.onProgress&&o.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=Il[e];delete Il[e];for(var r=0,o=n.length;r<o;r++){var a=n[r];a.onError&&a.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=Il[e];delete Il[e];for(var r=0,o=n.length;r<o;r++){var a=n[r];a.onError&&a.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(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(e),m}Il[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}}),Bl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Bl,load:function(e,t,n,r){var i=this,o=new Nl(i.manager);o.setPath(i.path),o.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=Ll.parse(e[n]);t.push(r)}return t}}),Fl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Fl,load:function(e,t,n,r){var i=this,o=[],a=new Gc;a.image=o;var s=new Nl(this.manager);function c(c){s.load(e[c],(function(e){var n=i.parse(e,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(u+=1)&&(1===n.mipmapCount&&(a.minFilter=_e),a.format=n.format,a.needsUpdate=!0,t&&t(a))}),n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var u=0,l=0,h=e.length;l<h;++l)c(l);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++){o[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=_e),a.format=n.format,a.needsUpdate=!0,t&&t(a)}),n,r);return a}}),zl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:zl,load:function(e,t,n,r){var i=this,o=new Ao,a=new Nl(this.manager);return a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(e,(function(e){var n=i.parse(e);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:me,o.wrapT=void 0!==n.wrapT?n.wrapT:me,o.magFilter=void 0!==n.magFilter?n.magFilter:_e,o.minFilter=void 0!==n.minFilter?n.minFilter:_e,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=Se),1===n.mipmapCount&&(o.minFilter=_e),o.needsUpdate=!0,t&&t(o,n))}),n,r),o}}),Ul.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Ul,load:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,o=Rl.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){a.removeEventListener("load",s,!1),a.removeEventListener("error",c,!1),Rl.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){a.removeEventListener("load",s,!1),a.removeEventListener("error",c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return a.addEventListener("load",s,!1),a.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),i.manager.itemStart(e),a.src=e,a}}),Gl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Gl,load:function(e,t,n,r){var i=new Zo,o=new Ul(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);var a=0;function s(n){o.load(e[n],(function(e){i.images[n]=e,6==++a&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}}),kl.prototype=Object.assign(Object.create(Dl.prototype),{constructor:kl,load:function(e,t,n,r){var i=new qn,o=new Ul(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(n){i.image=n;var r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?Ge:ke,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(Vl.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),o=0;for(r.push(0),n=1;n<=e;n++)o+=(t=this.getPoint(n/e)).distanceTo(i),r.push(o),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,o=r.length;n=t||e*r[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(a>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(o-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(o-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),o=this.getPoint(r),a=t||(i.isVector2?new Vn:new $n);return a.copy(o).sub(i).normalize(),a},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,r,i,o=new $n,a=[],s=[],c=[],u=new $n,l=new sr;for(n=0;n<=e;n++)r=n/e,a[n]=this.getTangentAt(r,new $n),a[n].normalize();s[0]=new $n,c[0]=new $n;var h=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=h&&(h=p,o.set(1,0,0)),d<=h&&(h=d,o.set(0,1,0)),f<=h&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),c[0].crossVectors(a[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),i=Math.acos(kn.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(l.makeRotationAxis(u,i))),c[n].crossVectors(a[n],s[n]);if(!0===t)for(i=Math.acos(kn.clamp(s[0].dot(s[e]),-1,1)),i/=e,a[0].dot(u.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(l.makeRotationAxis(a[n],i*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,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}}),Hl.prototype=Object.create(Vl.prototype),Hl.prototype.constructor=Hl,Hl.prototype.isEllipseCurve=!0,Hl.prototype.getPoint=function(e,t){for(var n=t||new Vn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,o=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);var a=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){var u=Math.cos(this.aRotation),l=Math.sin(this.aRotation),h=s-this.aX,p=c-this.aY;s=h*u-p*l+this.aX,c=h*l+p*u+this.aY}return n.set(s,c)},Hl.prototype.copy=function(e){return Vl.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},Hl.prototype.toJSON=function(){var e=Vl.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},Hl.prototype.fromJSON=function(e){return Vl.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},jl.prototype=Object.create(Hl.prototype),jl.prototype.constructor=jl,jl.prototype.isArcCurve=!0;var ql=new $n,Xl=new Wl,Yl=new Wl,Zl=new Wl;function Jl(e,t,n,r){Vl.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Kl(e,t,n,r,i){var o=.5*(r-t),a=.5*(i-n),s=e*e;return(2*n-2*r+o+a)*(e*s)+(-3*n+3*r-2*o-a)*s+o*e+n}function Ql(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 $l(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 eh(e,t,n,r){Vl.call(this),this.type="CubicBezierCurve",this.v0=e||new Vn,this.v1=t||new Vn,this.v2=n||new Vn,this.v3=r||new Vn}function th(e,t,n,r){Vl.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 nh(e,t){Vl.call(this),this.type="LineCurve",this.v1=e||new Vn,this.v2=t||new Vn}function rh(e,t){Vl.call(this),this.type="LineCurve3",this.v1=e||new $n,this.v2=t||new $n}function ih(e,t,n){Vl.call(this),this.type="QuadraticBezierCurve",this.v0=e||new Vn,this.v1=t||new Vn,this.v2=n||new Vn}function oh(e,t,n){Vl.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new $n,this.v1=t||new $n,this.v2=n||new $n}function ah(e){Vl.call(this),this.type="SplineCurve",this.points=e||[]}Jl.prototype=Object.create(Vl.prototype),Jl.prototype.constructor=Jl,Jl.prototype.isCatmullRomCurve3=!0,Jl.prototype.getPoint=function(e,t){var n,r,i,o,a=t||new $n,s=this.points,c=s.length,u=(c-(this.closed?0:1))*e,l=Math.floor(u),h=u-l;if(this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/c)+1)*c:0===h&&l===c-1&&(l=c-2,h=1),this.closed||l>0?n=s[(l-1)%c]:(ql.subVectors(s[0],s[1]).add(s[0]),n=ql),r=s[l%c],i=s[(l+1)%c],this.closed||l+2<c?o=s[(l+2)%c]:(ql.subVectors(s[c-1],s[c-2]).add(s[c-1]),o=ql),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(r),p),f=Math.pow(r.distanceToSquared(i),p),m=Math.pow(i.distanceToSquared(o),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),Xl.initNonuniformCatmullRom(n.x,r.x,i.x,o.x,d,f,m),Yl.initNonuniformCatmullRom(n.y,r.y,i.y,o.y,d,f,m),Zl.initNonuniformCatmullRom(n.z,r.z,i.z,o.z,d,f,m)}else"catmullrom"===this.curveType&&(Xl.initCatmullRom(n.x,r.x,i.x,o.x,this.tension),Yl.initCatmullRom(n.y,r.y,i.y,o.y,this.tension),Zl.initCatmullRom(n.z,r.z,i.z,o.z,this.tension));return a.set(Xl.calc(h),Yl.calc(h),Zl.calc(h)),a},Jl.prototype.copy=function(e){Vl.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},Jl.prototype.toJSON=function(){var e=Vl.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},Jl.prototype.fromJSON=function(e){Vl.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},eh.prototype=Object.create(Vl.prototype),eh.prototype.constructor=eh,eh.prototype.isCubicBezierCurve=!0,eh.prototype.getPoint=function(e,t){var n=t||new Vn,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set($l(e,r.x,i.x,o.x,a.x),$l(e,r.y,i.y,o.y,a.y)),n},eh.prototype.copy=function(e){return Vl.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},eh.prototype.toJSON=function(){var e=Vl.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},eh.prototype.fromJSON=function(e){return Vl.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},th.prototype=Object.create(Vl.prototype),th.prototype.constructor=th,th.prototype.isCubicBezierCurve3=!0,th.prototype.getPoint=function(e,t){var n=t||new $n,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set($l(e,r.x,i.x,o.x,a.x),$l(e,r.y,i.y,o.y,a.y),$l(e,r.z,i.z,o.z,a.z)),n},th.prototype.copy=function(e){return Vl.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=Vl.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 Vl.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(Vl.prototype),nh.prototype.constructor=nh,nh.prototype.isLineCurve=!0,nh.prototype.getPoint=function(e,t){var n=t||new Vn;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},nh.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},nh.prototype.getTangent=function(e,t){return(t||new Vn).copy(this.v2).sub(this.v1).normalize()},nh.prototype.copy=function(e){return Vl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},nh.prototype.toJSON=function(){var e=Vl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},nh.prototype.fromJSON=function(e){return Vl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},rh.prototype=Object.create(Vl.prototype),rh.prototype.constructor=rh,rh.prototype.isLineCurve3=!0,rh.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},rh.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},rh.prototype.copy=function(e){return Vl.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},rh.prototype.toJSON=function(){var e=Vl.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},rh.prototype.fromJSON=function(e){return Vl.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ih.prototype=Object.create(Vl.prototype),ih.prototype.constructor=ih,ih.prototype.isQuadraticBezierCurve=!0,ih.prototype.getPoint=function(e,t){var n=t||new Vn,r=this.v0,i=this.v1,o=this.v2;return n.set(Ql(e,r.x,i.x,o.x),Ql(e,r.y,i.y,o.y)),n},ih.prototype.copy=function(e){return Vl.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ih.prototype.toJSON=function(){var e=Vl.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ih.prototype.fromJSON=function(e){return Vl.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(Vl.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,o=this.v2;return n.set(Ql(e,r.x,i.x,o.x),Ql(e,r.y,i.y,o.y),Ql(e,r.z,i.z,o.z)),n},oh.prototype.copy=function(e){return Vl.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=Vl.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 Vl.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ah.prototype=Object.create(Vl.prototype),ah.prototype.constructor=ah,ah.prototype.isSplineCurve=!0,ah.prototype.getPoint=function(e,t){var n=t||new Vn,r=this.points,i=(r.length-1)*e,o=Math.floor(i),a=i-o,s=r[0===o?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],l=r[o>r.length-3?r.length-1:o+2];return n.set(Kl(a,s.x,c.x,u.x,l.x),Kl(a,s.y,c.y,u.y,l.y)),n},ah.prototype.copy=function(e){Vl.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},ah.prototype.toJSON=function(){var e=Vl.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},ah.prototype.fromJSON=function(e){Vl.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 Vn).fromArray(r))}return this};var sh=Object.freeze({__proto__:null,ArcCurve:jl,CatmullRomCurve3:Jl,CubicBezierCurve:eh,CubicBezierCurve3:th,EllipseCurve:Hl,LineCurve:nh,LineCurve3:rh,QuadraticBezierCurve:ih,QuadraticBezierCurve3:oh,SplineCurve:ah});function ch(){Vl.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function uh(e){ch.call(this),this.type="Path",this.currentPoint=new Vn,e&&this.setFromPoints(e)}function lh(e){uh.call(this,e),this.uuid=kn.generateUUID(),this.type="Shape",this.holes=[]}function hh(e,t){Sr.call(this),this.type="Light",this.color=new vi(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function ph(e,t,n){hh.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Sr.DefaultUp),this.updateMatrix(),this.groundColor=new vi(t)}function dh(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Vn(512,512),this.map=null,this.mapPass=null,this.matrix=new sr,this._frustum=new Ro,this._frameExtents=new Vn(1,1),this._viewportCount=1,this._viewports=[new Xn(0,0,1,1)]}function fh(){dh.call(this,new To(50,1,.5,500))}function mh(e,t,n,r,i,o){hh.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!==o?o:1,this.shadow=new fh}function vh(){dh.call(this,new To(90,1,.5,500)),this._frameExtents=new Vn(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 gh(e,t,n,r){hh.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 yh(e,t,n,r,i,o){Mo.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!==o?o:2e3,this.updateProjectionMatrix()}function xh(){dh.call(this,new yh(-5,5,5,-5,.5,500))}function bh(e,t){hh.call(this,e,t),this.type="DirectionalLight",this.position.copy(Sr.DefaultUp),this.updateMatrix(),this.target=new Sr,this.shadow=new xh}function wh(e,t){hh.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function _h(e,t,n,r){hh.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Mh(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new $n)}function Th(e,t){hh.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new Mh}function Sh(e){Dl.call(this,e),this.textures={}}ch.prototype=Object.assign(Object.create(Vl.prototype),{constructor:ch,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 nh(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,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.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 o=i[r],a=o&&o.isEllipseCurve?2*e:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,s=o.getPoints(a),c=0;c<s.length;c++){var u=s[c];t&&t.equals(u)||(n.push(u),t=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Vl.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=Vl.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){Vl.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 sh[r.type]).fromJSON(r))}return this}}),uh.prototype=Object.assign(Object.create(ch.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 nh(this.currentPoint.clone(),new Vn(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new ih(this.currentPoint.clone(),new Vn(e,t),new Vn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,o){var a=new eh(this.currentPoint.clone(),new Vn(e,t),new Vn(n,r),new Vn(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this},splineThru:function(e){var t=new ah([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,o){var a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+a,t+s,n,r,i,o),this},absarc:function(e,t,n,r,i,o){return this.absellipse(e,t,n,n,r,i,o),this},ellipse:function(e,t,n,r,i,o,a,s){var c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,i,o,a,s),this},absellipse:function(e,t,n,r,i,o,a,s){var c=new Hl(e,t,n,r,i,o,a,s);if(this.curves.length>0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var l=c.getPoint(1);return this.currentPoint.copy(l),this},copy:function(e){return ch.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ch.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ch.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),lh.prototype=Object.assign(Object.create(uh.prototype),{constructor:lh,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}}),hh.prototype=Object.assign(Object.create(Sr.prototype),{constructor:hh,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(hh.prototype),{constructor:ph,isHemisphereLight:!0,copy:function(e){return hh.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(dh.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,o=this._lightPositionWorld;o.setFromMatrixPosition(e.matrixWorld),t.position.copy(o),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}}),fh.prototype=Object.assign(Object.create(dh.prototype),{constructor:fh,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*kn.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()),dh.prototype.updateMatrices.call(this,e)}}),mh.prototype=Object.assign(Object.create(hh.prototype),{constructor:mh,isSpotLight:!0,copy:function(e){return hh.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(dh.prototype),{constructor:vh,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,o=this._lookTarget,a=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),o.copy(n.position),o.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(o),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),a.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(a)}}),gh.prototype=Object.assign(Object.create(hh.prototype),{constructor:gh,isPointLight:!0,copy:function(e){return hh.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),yh.prototype=Object.assign(Object.create(Mo.prototype),{constructor:yh,isOrthographicCamera:!0,copy:function(e,t){return Mo.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,o){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=o,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,o=n+e,a=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o=(i+=c*this.view.offsetX)+c*this.view.width,s=(a-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(i,o,a,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}}),xh.prototype=Object.assign(Object.create(dh.prototype),{constructor:xh,isDirectionalLightShadow:!0,updateMatrices:function(e){dh.prototype.updateMatrices.call(this,e)}}),bh.prototype=Object.assign(Object.create(hh.prototype),{constructor:bh,isDirectionalLight:!0,copy:function(e){return hh.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),wh.prototype=Object.assign(Object.create(hh.prototype),{constructor:wh,isAmbientLight:!0}),_h.prototype=Object.assign(Object.create(hh.prototype),{constructor:_h,isRectAreaLight:!0,copy:function(e){return hh.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=hh.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(Mh.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,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*i),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*r*1.092548),t.addScaledVector(o[5],r*i*1.092548),t.addScaledVector(o[6],.315392*(3*i*i-1)),t.addScaledVector(o[7],n*i*1.092548),t.addScaledVector(o[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*r),t.addScaledVector(o[2],1.023328*i),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*r),t.addScaledVector(o[5],.858086*r*i),t.addScaledVector(o[6],.743125*i*i-.247708),t.addScaledVector(o[7],.858086*n*i),t.addScaledVector(o[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(Mh,{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)}}),Th.prototype=Object.assign(Object.create(hh.prototype),{constructor:Th,isLightProbe:!0,copy:function(e){return hh.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=hh.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),Sh.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Sh,load:function(e,t,n,r){var i=this,o=new Nl(i.manager);o.setPath(i.path),o.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 fl[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 vi).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 o=e.uniforms[i];switch(r.uniforms[i]={},o.type){case"t":r.uniforms[i].value=n(o.value);break;case"c":r.uniforms[i].value=(new vi).setHex(o.value);break;case"v2":r.uniforms[i].value=(new Vn).fromArray(o.value);break;case"v3":r.uniforms[i].value=(new $n).fromArray(o.value);break;case"v4":r.uniforms[i].value=(new Xn).fromArray(o.value);break;case"m3":r.uniforms[i].value=(new Hn).fromArray(o.value);case"m4":r.uniforms[i].value=(new sr).fromArray(o.value);break;default:r.uniforms[i].value=o.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 a in e.extensions)r.extensions[a]=e.extensions[a];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 Vn).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 Vn).fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}});var Eh={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 Ah(){ji.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Lh(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){Dl.call(this,e)}Ah.prototype=Object.assign(Object.create(ji.prototype),{constructor:Ah,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}}),Lh.prototype=Object.assign(Object.create(Si.prototype),{constructor:Lh,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(Dl.prototype),{constructor:Ph,load:function(e,t,n,r){var i=this,o=new Nl(i.manager);o.setPath(i.path),o.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 Ah:new ji,n=e.data.index;if(void 0!==n){var r=new Rh[n.type](n.array);t.setIndex(new Si(r,1))}var i=e.data.attributes;for(var o in i){var a=i[o],s=(r=new Rh[a.type](a.array),new(a.isInstancedBufferAttribute?Lh:Si)(r,a.itemSize,a.normalized));void 0!==a.name&&(s.name=a.name),t.setAttribute(o,s)}var c=e.data.morphAttributes;if(c)for(var o in c){for(var u=c[o],l=[],h=0,p=u.length;h<p;h++)a=u[h],s=new Si(r=new Rh[a.type](a.array),a.itemSize,a.normalized),void 0!==a.name&&(s.name=a.name),l.push(s);t.morphAttributes[o]=l}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){h=0;for(var f=d.length;h!==f;++h){var m=d[h];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new $n;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new Hr(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var Rh={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ch(e){Dl.call(this,e)}Ch.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Ch,load:function(e,t,n,r){var i=this,o=""===this.path?Eh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;var a=new Nl(i.manager);a.setPath(this.path),a.load(e,(function(n){var o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?i.parse(o,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)})),o=this.parseTextures(e.textures,i),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,r,a);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 lh).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,o=e.length;i<o;i++){var a,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new rl[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new rl[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new rl[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new rl[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new rl[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new rl[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":a=new rl[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new rl[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new rl[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new rl[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":a=new rl[s.type]((new sh[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":a=new rl[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":a=new rl[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],u=0,l=s.shapes.length;u<l;u++){var h=t[s.shapes[u]];c.push(h)}a=new rl[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],u=0,l=s.shapes.length;u<l;u++)h=t[s.shapes[u]],c.push(h);var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new sh[p.type]).fromJSON(p)),a=new rl[s.type](c,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":a=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}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),!0===a.isBufferGeometry&&void 0!==s.userData&&(a.userData=s.userData),n[s.uuid]=a}return n},parseMaterials:function(e,t){var n={},r={};if(void 0!==e){var i=new Sh;i.setTextures(t);for(var o=0,a=e.length;o<a;o++){var s=e[o];if("MultiMaterial"===s.type){for(var c=[],u=0;u<s.materials.length;u++){var l=s.materials[u];void 0===n[l.uuid]&&(n[l.uuid]=i.parse(l)),c.push(n[l.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=Ll.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),o.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 o=new Ul(new Cl(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a<s;a++){var c=e[a],u=c.url;if(Array.isArray(u)){r[c.uuid]=[];for(var l=0,h=u.length;l<h;l++){var p=u[l],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;r[c.uuid].push(i(d))}}else d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url,r[c.uuid]=i(d)}}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,o=e.length;i<o;i++){var a,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),(a=Array.isArray(t[s.image])?new Zo(t[s.image]):new qn(t[s.image])).needsUpdate=!0,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=n(s.mapping,Dh)),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=n(s.wrap[0],Ih),a.wrapT=n(s.wrap[1],Ih)),void 0!==s.format&&(a.format=s.format),void 0!==s.type&&(a.type=s.type),void 0!==s.encoding&&(a.encoding=s.encoding),void 0!==s.minFilter&&(a.minFilter=n(s.minFilter,Nh)),void 0!==s.magFilter&&(a.magFilter=n(s.magFilter,Nh)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),r[s.uuid]=a}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 o(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var o=e[r];void 0===n[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),t.push(n[o])}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 vi(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new Fs(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new Bs(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new To(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 yh(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 bh(e.color,e.intensity);break;case"PointLight":r=new gh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new _h(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new mh(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 Th).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":r=new co(a=i(e.geometry),s=o(e.material));break;case"InstancedMesh":var a=i(e.geometry),s=o(e.material),c=e.count,u=e.instanceMatrix;(r=new bc(a,s,c)).instanceMatrix=new Si(new Float32Array(u.array),16);break;case"LOD":r=new lc;break;case"Line":r=new Ac(i(e.geometry),o(e.material),e.mode);break;case"LineLoop":r=new Cc(i(e.geometry),o(e.material));break;case"LineSegments":r=new Rc(i(e.geometry),o(e.material));break;case"PointCloud":case"Points":r=new Fc(i(e.geometry),o(e.material));break;case"Sprite":r=new tc(o(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 l=e.children,h=0;h<l.length;h++)r.add(this.parseObject(l[h],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(r.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=r.getObjectByProperty("uuid",f.object);void 0!==m&&r.addLevel(m,f.distance)}}return r}});var Oh,Dh={UVMapping:ae,CubeReflectionMapping:se,CubeRefractionMapping:ce,EquirectangularReflectionMapping:ue,EquirectangularRefractionMapping:le,SphericalReflectionMapping:he,CubeUVReflectionMapping:pe,CubeUVRefractionMapping:de},Ih={RepeatWrapping:fe,ClampToEdgeWrapping:me,MirroredRepeatWrapping:ve},Nh={NearestFilter:ge,NearestMipmapNearestFilter:ye,NearestMipmapLinearFilter:be,LinearFilter:_e,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."),Dl.call(this,e),this.options=void 0}function Fh(){this.type="ShapePath",this.color=new vi,this.subPaths=[],this.currentPath=null}function zh(e){this.type="Font",this.data=e}function Uh(e,t,n,r,i){var o=i.glyphs[e]||i.glyphs["?"];if(o){var a,s,c,u,l,h,p,d,f=new Fh;if(o.o)for(var m=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),v=0,g=m.length;v<g;)switch(m[v++]){case"m":a=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(a,s);break;case"l":a=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(a,s);break;case"q":c=m[v++]*t+n,u=m[v++]*t+r,l=m[v++]*t+n,h=m[v++]*t+r,f.quadraticCurveTo(l,h,c,u);break;case"b":c=m[v++]*t+n,u=m[v++]*t+r,l=m[v++]*t+n,h=m[v++]*t+r,p=m[v++]*t+n,d=m[v++]*t+r,f.bezierCurveTo(l,h,p,d,c,u)}return{offsetX:o.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".")}function Gh(e){Dl.call(this,e)}Bh.prototype=Object.assign(Object.create(Dl.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,o=Rl.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;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){Rl.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(Fh.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,o){return this.currentPath.bezierCurveTo(e,t,n,r,i,o),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],o=new lh;o.curves=i.curves,t.push(o)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,o=0;o<n;i=o++){var a=t[i],s=t[o],c=s.x-a.x,u=s.y-a.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(a=t[o],c=-c,s=t[i],u=-u),e.y<a.y||e.y>s.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=u*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r}var i=Ou.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return n(o);var a,s,c,u=[];if(1===o.length)return s=o[0],(c=new lh).curves=s.curves,u.push(c),u;var l=!i(o[0].getPoints());l=e?!l:l;var h,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g<y;g++)a=i(h=(s=o[g]).getPoints()),(a=e?!a:a)?(!l&&f[v]&&v++,f[v]={s:new lh,p:h},f[v].s.curves=s.curves,l&&v++,m[v]=[]):m[v].push({h:s,p:h[0]});if(!f[0])return n(o);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],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)&&(w!==A&&b.push({froms:w,tos:A,hole:T}),E?(E=!1,d[A].push(S)):x=!0);E&&d[w].push(S)}b.length>0&&(x||(m=d))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,u.push(c);for(var P=0,R=(p=m[g]).length;P<R;P++)c.holes.push(p[P].h)}return u}}),Object.assign(zh.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,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,a=[],s=0,c=0,u=0;u<r.length;u++){var l=r[u];if("\n"===l)s=0,c-=o;else{var h=Uh(l,i,s,c,n);s+=h.offsetX,a.push(h.path)}}return a}(e,t,this.data),i=0,o=r.length;i<o;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Gh.prototype=Object.assign(Object.create(Dl.prototype),{constructor:Gh,load:function(e,t,n,r){var i=this,o=new Nl(this.manager);o.setPath(this.path),o.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 zh(e)}});var kh={getContext:function(){return void 0===Oh&&(Oh=new(window.AudioContext||window.webkitAudioContext)),Oh},setContext:function(e){Oh=e}};function Vh(e){Dl.call(this,e)}function Hh(e,t,n){Th.call(this,void 0,n);var r=(new vi).set(e),i=(new vi).set(t),o=new $n(r.r,r.g,r.b),a=new $n(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}function jh(e,t){Th.call(this,void 0,t);var n=(new vi).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(Dl.prototype),{constructor:Vh,load:function(e,t,n,r){var i=this,o=new Nl(i.manager);o.setResponseType("arraybuffer"),o.setPath(i.path),o.load(e,(function(n){try{var o=n.slice(0);kh.getContext().decodeAudioData(o,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}),Hh.prototype=Object.assign(Object.create(Th.prototype),{constructor:Hh,isHemisphereLightProbe:!0,copy:function(e){return Th.prototype.copy.call(this,e),this},toJSON:function(e){return Th.prototype.toJSON.call(this,e)}}),jh.prototype=Object.assign(Object.create(Th.prototype),{constructor:jh,isAmbientLightProbe:!0,copy:function(e){return Th.prototype.copy.call(this,e),this},toJSON:function(e){return Th.prototype.toJSON.call(this,e)}});var Wh=new sr,qh=new sr;function Xh(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new To,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new To,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 Yh(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Xh.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(),o=t.eyeSep/2,a=o*t.near/t.focus,s=t.near*Math.tan(kn.DEG2RAD*t.fov*.5)/t.zoom;qh.elements[12]=-o,Wh.elements[12]=o,n=-s*t.aspect+a,r=s*t.aspect+a,i.elements[0]=2*t.near/(r-n),i.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(i),n=-s*t.aspect-a,r=s*t.aspect-a,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(qh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Wh)}}),Object.assign(Yh.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 Zh=new $n,Jh=new Jn,Kh=new $n,Qh=new $n;function $h(){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 Yh}function ep(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=[]}$h.prototype=Object.assign(Object.create(Sr.prototype),{constructor:$h,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(Zh,Jh,Kh),Qh.set(0,0,-1).applyQuaternion(Jh),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Zh.x,r),t.positionY.linearRampToValueAtTime(Zh.y,r),t.positionZ.linearRampToValueAtTime(Zh.z,r),t.forwardX.linearRampToValueAtTime(Qh.x,r),t.forwardY.linearRampToValueAtTime(Qh.y,r),t.forwardZ.linearRampToValueAtTime(Qh.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(Zh.x,Zh.y,Zh.z),t.setOrientation(Qh.x,Qh.y,Qh.z,n.x,n.y,n.z)}}),ep.prototype=Object.assign(Object.create(Sr.prototype),{constructor:ep,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 tp=new $n,np=new Jn,rp=new $n,ip=new $n;function op(e){ep.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function ap(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 sp(e,t,n){var r,i,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}op.prototype=Object.assign(Object.create(ep.prototype),{constructor:op,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(tp,np,rp),ip.set(0,0,1).applyQuaternion(np);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(tp.x,n),t.positionY.linearRampToValueAtTime(tp.y,n),t.positionZ.linearRampToValueAtTime(tp.z,n),t.orientationX.linearRampToValueAtTime(ip.x,n),t.orientationY.linearRampToValueAtTime(ip.y,n),t.orientationZ.linearRampToValueAtTime(ip.z,n)}else t.setPosition(tp.x,tp.y,tp.z),t.setOrientation(ip.x,ip.y,ip.z)}}}),Object.assign(ap.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(sp.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==r;++a)n[i+a]=n[a];o=t}else{var s=t/(o+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=o},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,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,u=t+t;c!==u;++c)if(n[c]!==n[c+t]){a.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,o=r;i!==o;++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 o=0;o!==i;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,r){Jn.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var o=this._workIndex*i;Jn.multiplyQuaternionsFlat(e,o,e,t,e,n),Jn.slerpFlat(e,t,e,t,e,o,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*r}},_lerpAdditive:function(e,t,n,r,i){for(var o=0;o!==i;++o){var a=t+o;e[a]=e[a]+e[n+o]*r}}});var cp=new RegExp("[\\[\\]\\.:\\/]","g"),up="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",lp=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),hp=/(WCOD+)?/.source.replace("WCOD",up),pp=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),dp=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fp=new RegExp("^"+lp+hp+pp+dp+"$"),mp=["material","materials","bones"];function vp(e,t,n){var r=n||gp.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function gp(e,t,n){this.path=t,this.parsedPath=n||gp.parseTrackName(t),this.node=gp.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function yp(){this.uuid=kn.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 xp(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,o=i.length,a=new Array(o),s={endingStart:Wt,endingEnd:Wt},c=0;c!==o;++c){var u=i[c].createInterpolant(null);a[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Gt,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 bp(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function wp(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function _p(e,t,n){zs.call(this,e,t),this.meshPerAttribute=n||1}function Mp(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 Tp(e,t){return e.distance-t.distance}function Sp(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,o=0,a=i.length;o<a;o++)Sp(i[o],t,n,!0)}function Ep(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 Ap(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(vp.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(gp,{Composite:vp,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new gp.Composite(e,t,n):new gp(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(cp,"")},parseTrackName:function(e){var t=fp.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!==mp.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 o=r(i.children);if(o)return o}return null},i=r(e.children);if(i)return i}return null}}),Object.assign(gp.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=gp.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var o=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 a=0;a<e.length;a++)if(e[a].name===o){o=a;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!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}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 u=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])}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}else{var l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+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(gp.prototype,{_getValue_unbound:gp.prototype.getValue,_setValue_unbound:gp.prototype.setValue}),Object.assign(yp.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,o=this._parsedPaths,a=this._bindings,s=a.length,c=void 0,u=0,l=arguments.length;u!==l;++u){var h=arguments[u],p=h.uuid,d=r[p];if(void 0===d){d=t++,r[p]=d,e.push(h);for(var f=0,m=s;f!==m;++f)a[f].push(new gp(h,i[f],o[f]))}else if(d<n){c=e[d];var v=--n,g=e[v];for(r[g.uuid]=d,e[d]=g,r[p]=v,e[v]=h,f=0,m=s;f!==m;++f){var y=a[f],x=y[v],b=y[d];y[d]=x,void 0===b&&(b=new gp(h,i[f],o[f])),y[v]=b}}else e[d]!==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,o=0,a=arguments.length;o!==a;++o){var s=arguments[o],c=s.uuid,u=n[c];if(void 0!==u&&u>=t){var l=t++,h=e[l];n[h.uuid]=u,e[u]=h,n[c]=l,e[l]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[l],v=f[u];f[u]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,o=i.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],u=c.uuid,l=r[u];if(void 0!==l)if(delete r[u],l<n){var h=--n,p=e[h],d=e[y=--t];r[p.uuid]=l,e[l]=p,r[d.uuid]=h,e[h]=d,e.pop();for(var f=0,m=o;f!==m;++f){var v=(x=i[f])[h],g=x[y];x[l]=v,x[h]=g,x.pop()}}else{var y;for(r[(d=e[y=--t]).uuid]=l,e[l]=d,e.pop(),f=0,m=o;f!==m;++f){var x;(x=i[f])[l]=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 o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,l=new Array(c);r=i.length,n[e]=r,o.push(e),a.push(t),i.push(l);for(var h=u,p=s.length;h!==p;++h){var d=s[h];l[h]=new gp(d,e,t)}return l},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}}),Object.assign(xp.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,o=i/r,a=r/i;e.warp(1,o,t),this.warp(a,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,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/a,c[1]=t/a,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 o=(e-i)*n;if(o<0||0===n)return;this._startTime=null,t=n*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case Zt:for(var l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].accumulateAdditive(s);break;case Yt:default:for(l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].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;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,o=r===kt;if(0===e)return-1===i?t:o&&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,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,i+=Math.abs(a);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,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&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,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this}}),bp.prototype=Object.assign(Object.create(Fn.prototype),{constructor:bp,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var l=0;l!==i;++l){var h=r[l],p=h.name,d=u[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;++(d=new sp(gp.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.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,o=0,a=i.length;o!==a;++o){var s=i[o];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,o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{var a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.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,o=this._actionsByClip,a=o[i],s=a.knownActions,c=s[s.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),e._byClipCacheIndex=null,delete a.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete o[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],o=this._bindings;void 0===i&&(i={},r[t]=i),i[n]=e,e._cacheIndex=o.length,o.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete a[i],0===Object.keys(a).length&&delete o[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 yl(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,o="string"==typeof e?Ll.findByName(r,e):e,a=null!==o?o.uuid:e,s=this._actionsByClip[a],c=null;if(void 0===n&&(n=null!==o?o.blendMode:Yt),void 0!==s){var u=s.actionByRoot[i];if(void 0!==u&&u.blendMode===n)return u;c=s.knownActions[0],null===o&&(o=c._clip)}if(null===o)return null;var l=new xp(this,o,t,n);return this._bindAction(l,c),this._addInactiveAction(l,a,i),l},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Ll.findByName(n,e):e,o=i?i.uuid:e,a=this._actionsByClip[o];return void 0!==a&&a.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),o=this._accuIndex^=1,a=0;a!==n;++a)t[a]._update(r,e,i,o);var s=this._bindings,c=this._nActiveBindings;for(a=0;a!==c;++a)s[a].apply(o);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 o=i.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,l=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=u,t[u]=l,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 o=this._bindingsByRootAndName[t];if(void 0!==o)for(var a in o){var s=o[a];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),wp.prototype.clone=function(){return new wp(void 0===this.value.clone?this.value:this.value.clone())},_p.prototype=Object.assign(Object.create(zs.prototype),{constructor:_p,isInstancedInterleavedBuffer:!0,copy:function(e){return zs.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(Mp.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 Sp(e,this,r,t),r.sort(Tp),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,o=e.length;i<o;i++)Sp(e[i],this,r,t);return r.sort(Tp),r}}),Object.assign(Ep.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(kn.clamp(t/this.radius,-1,1))),this}}),Object.assign(Ap.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 Lp=new Vn;function Pp(e,t){this.min=void 0!==e?e:new Vn(1/0,1/0),this.max=void 0!==t?t:new Vn(-1/0,-1/0)}Object.assign(Pp.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=Lp.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 Vn),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 Vn),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 Vn),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 Vn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Lp.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 Rp=new $n,Cp=new $n;function Op(e,t){this.start=void 0!==e?e:new $n,this.end=void 0!==t?t:new $n}function Dp(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(Op.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){Rp.subVectors(e,this.start),Cp.subVectors(this.end,this.start);var n=Cp.dot(Cp),r=Cp.dot(Rp)/n;return t&&(r=kn.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)}}),Dp.prototype=Object.create(Sr.prototype),Dp.prototype.constructor=Dp,Dp.prototype.isImmediateRenderObject=!0;var Ip=new $n;function Np(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,o=1;i<32;i++,o++){var a=i/32*Math.PI*2,s=o/32*Math.PI*2;r.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Di(r,3));var c=new wc({fog:!1,toneMapped:!1});this.cone=new Rc(n,c),this.add(this.cone),this.update()}Np.prototype=Object.create(Sr.prototype),Np.prototype.constructor=Np,Np.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Np.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),Ip.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ip),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Bp=new $n,Fp=new sr,zp=new sr;function Up(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=[],o=new vi(0,0,1),a=new vi(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(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}n.setAttribute("position",new Di(r,3)),n.setAttribute("color",new Di(i,3));var u=new wc({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Rc.call(this,n,u),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Gp(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Vu(t,4,2),i=new Mi({wireframe:!0,fog:!1,toneMapped:!1});co.call(this,r,i),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Up.prototype=Object.create(Rc.prototype),Up.prototype.constructor=Up,Up.prototype.isSkeletonHelper=!0,Up.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");zp.getInverse(this.root.matrixWorld);for(var i=0,o=0;i<t.length;i++){var a=t[i];a.parent&&a.parent.isBone&&(Fp.multiplyMatrices(zp,a.matrixWorld),Bp.setFromMatrixPosition(Fp),r.setXYZ(o,Bp.x,Bp.y,Bp.z),Fp.multiplyMatrices(zp,a.parent.matrixWorld),Bp.setFromMatrixPosition(Fp),r.setXYZ(o+1,Bp.x,Bp.y,Bp.z),o+=2)}n.getAttribute("position").needsUpdate=!0,Sr.prototype.updateMatrixWorld.call(this,e)},Gp.prototype=Object.create(co.prototype),Gp.prototype.constructor=Gp,Gp.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Gp.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var kp=new $n,Vp=new vi,Hp=new vi;function jp(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"),o=new Float32Array(3*i.count);r.setAttribute("color",new Si(o,3)),this.add(new co(r,this.material)),this.update()}function Wp(e,t,n,r){e=e||10,t=t||10,n=new vi(void 0!==n?n:4473924),r=new vi(void 0!==r?r:8947848);for(var i=t/2,o=e/t,a=e/2,s=[],c=[],u=0,l=0,h=-a;u<=t;u++,h+=o){s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a);var p=u===i?n:r;p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3,p.toArray(c,l),l+=3}var d=new ji;d.setAttribute("position",new Di(s,3)),d.setAttribute("color",new Di(c,3));var f=new wc({vertexColors:!0,toneMapped:!1});Rc.call(this,d,f),this.type="GridHelper"}function qp(e,t,n,r,i,o){e=e||10,t=t||16,n=n||8,r=r||64,i=new vi(void 0!==i?i:4473924),o=new vi(void 0!==o?o:8947848);var a,s,c,u,l,h,p,d=[],f=[];for(u=0;u<=t;u++)c=u/t*(2*Math.PI),a=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(a,0,s),p=1&u?i:o,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(u=0;u<=n;u++)for(p=1&u?i:o,h=e-e/n*u,l=0;l<r;l++)c=l/r*(2*Math.PI),a=Math.sin(c)*h,s=Math.cos(c)*h,d.push(a,0,s),f.push(p.r,p.g,p.b),c=(l+1)/r*(2*Math.PI),a=Math.sin(c)*h,s=Math.cos(c)*h,d.push(a,0,s),f.push(p.r,p.g,p.b);var m=new ji;m.setAttribute("position",new Di(d,3)),m.setAttribute("color",new Di(f,3));var v=new wc({vertexColors:!0,toneMapped:!1});Rc.call(this,m,v),this.type="PolarGridHelper"}jp.prototype=Object.create(Sr.prototype),jp.prototype.constructor=jp,jp.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},jp.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");Vp.copy(this.light.color),Hp.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?Vp:Hp;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(kp.setFromMatrixPosition(this.light.matrixWorld).negate())},Wp.prototype=Object.assign(Object.create(Rc.prototype),{constructor:Wp,copy:function(e){return Rc.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),qp.prototype=Object.create(Rc.prototype),qp.prototype.constructor=qp;var Xp=new $n,Yp=new $n,Zp=new $n;function Jp(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 wc({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()}Jp.prototype=Object.create(Sr.prototype),Jp.prototype.constructor=Jp,Jp.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Jp.prototype.update=function(){Xp.setFromMatrixPosition(this.light.matrixWorld),Yp.setFromMatrixPosition(this.light.target.matrixWorld),Zp.subVectors(Yp,Xp),this.lightPlane.lookAt(Yp),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(Yp),this.targetLine.scale.z=Zp.length()};var Kp=new $n,Qp=new Mo;function $p(e){var t=new ji,n=new wc({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={},a=new vi(16755200),s=new vi(16711680),c=new vi(43775),u=new vi(16777215),l=new vi(3355443);function h(e,t,n){p(e,n),p(t,n)}function p(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),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",u),h("p","c",l),h("cn1","cn2",l),h("cn3","cn4",l),h("cf1","cf2",l),h("cf3","cf4",l),t.setAttribute("position",new Di(r,3)),t.setAttribute("color",new Di(i,3)),Rc.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=o,this.update()}function ed(e,t,n,r,i,o,a){Kp.set(i,o,a).unproject(r);var s=t[e];if(void 0!==s)for(var c=n.getAttribute("position"),u=0,l=s.length;u<l;u++)c.setXYZ(s[u],Kp.x,Kp.y,Kp.z)}$p.prototype=Object.create(Rc.prototype),$p.prototype.constructor=$p,$p.prototype.update=function(){var e=this.geometry,t=this.pointMap;Qp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ed("c",t,e,Qp,0,0,-1),ed("t",t,e,Qp,0,0,1),ed("n1",t,e,Qp,-1,-1,-1),ed("n2",t,e,Qp,1,-1,-1),ed("n3",t,e,Qp,-1,1,-1),ed("n4",t,e,Qp,1,1,-1),ed("f1",t,e,Qp,-1,-1,1),ed("f2",t,e,Qp,1,-1,1),ed("f3",t,e,Qp,-1,1,1),ed("f4",t,e,Qp,1,1,1),ed("u1",t,e,Qp,.7,1.1,-1),ed("u2",t,e,Qp,-.7,1.1,-1),ed("u3",t,e,Qp,0,2,-1),ed("cf1",t,e,Qp,-1,0,1),ed("cf2",t,e,Qp,1,0,1),ed("cf3",t,e,Qp,0,-1,1),ed("cf4",t,e,Qp,0,1,1),ed("cn1",t,e,Qp,-1,0,-1),ed("cn2",t,e,Qp,1,0,-1),ed("cn3",t,e,Qp,0,-1,-1),ed("cn4",t,e,Qp,0,1,-1),e.getAttribute("position").needsUpdate=!0};var td=new Gr;function nd(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)),Rc.call(this,i,new wc({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function rd(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)),Rc.call(this,r,new wc({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function id(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 wc({color:r,toneMapped:!1})),this.type="PlaneHelper";var o=new ji;o.setAttribute("position",new Di([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.add(new co(o,new Mi({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}nd.prototype=Object.create(Rc.prototype),nd.prototype.constructor=nd,nd.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&td.setFromObject(this.object),!td.isEmpty()){var t=td.min,n=td.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()}},nd.prototype.setFromObject=function(e){return this.object=e,this.update(),this},nd.prototype.copy=function(e){return Rc.prototype.copy.call(this,e),this.object=e.object,this},nd.prototype.clone=function(){return(new this.constructor).copy(this)},rd.prototype=Object.create(Rc.prototype),rd.prototype.constructor=rd,rd.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))},id.prototype=Object.create(Ac.prototype),id.prototype.constructor=id,id.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?g:v,this.lookAt(this.plane.normal),Sr.prototype.updateMatrixWorld.call(this,e)};var od,ad,sd=new $n;function cd(e,t,n,r,i,o){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===o&&(o=.2*i),void 0===od&&((od=new ji).setAttribute("position",new Di([0,0,0,0,1,0],3)),(ad=new Qu(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Ac(od,new wc({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new co(ad,new Mi({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,o)}function ud(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 wc({vertexColors:!0,toneMapped:!1});Rc.call(this,n,r),this.type="AxesHelper"}cd.prototype=Object.create(Sr.prototype),cd.prototype.constructor=cd,cd.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{sd.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(sd,t)}},cd.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()},cd.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},cd.prototype.copy=function(e){return Sr.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},cd.prototype.clone=function(){return(new this.constructor).copy(this)},ud.prototype=Object.create(Rc.prototype),ud.prototype.constructor=ud;var ld=Math.pow(2,8),hd=[.125,.215,.35,.446,.526,.582],pd=5+hd.length,dd={[$t]:0,[en]:1,[nn]:2,[on]:3,[an]:4,[sn]:5,[tn]:6},fd=new yh,{_lodPlanes:md,_sizeLods:vd,_sigmas:gd}=function(){for(var e=[],t=[],n=[],r=8,i=0;i<pd;i++){var o=Math.pow(2,r);t.push(o);var a=1/o;i>4?a=hd[i-8+4-1]:0==i&&(a=0),n.push(a);for(var s=1/(o-1),c=-s/2,u=1+s/2,l=[c,c,u,c,u,u,c,c,u,u,c,u],h=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),p.set(l,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new ji;x.setAttribute("position",new Si(h,3)),x.setAttribute("uv",new Si(p,2)),x.setAttribute("faceIndex",new Si(d,1)),e.push(x),r>4&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),yd=null,xd=(1+Math.sqrt(5))/2,bd=1/xd,wd=[new $n(1,1,1),new $n(-1,1,1),new $n(1,1,-1),new $n(-1,1,-1),new $n(0,xd,bd),new $n(0,xd,-bd),new $n(bd,0,xd),new $n(-bd,0,xd),new $n(xd,bd,0),new $n(-xd,bd,0)];function _d(e){var t;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(20,(t=new ol({defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new $n(0,1,0)},inputEncoding:{value:dd[$t]},outputEncoding:{value:dd[$t]}},vertexShader:"\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",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\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\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:w,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",t),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function Md(e){return void 0!==e&&e.type===Ae&&(e.encoding===$t||e.encoding===en||e.encoding===tn)}function Td(e){var t=new Yn(3*ld,3*ld,e);return t.texture.mapping=pe,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Sd(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Ed(){var e=new ol({uniforms:{envMap:{value:null},texelSize:{value:new Vn(1,1)},inputEncoding:{value:dd[$t]},outputEncoding:{value:dd[$t]}},vertexShader:"\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",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n\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\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:w,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function Ad(){var e=new ol({uniforms:{envMap:{value:null},inputEncoding:{value:dd[$t]},outputEncoding:{value:dd[$t]}},vertexShader:"\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",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n\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\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:w,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Ld(e,t,n,r,i,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new bi(e,t,n,i,o,a)}_d.prototype={constructor:_d,fromScene:function(e,t=0,n=.1,r=100){yd=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=ge,e.minFilter=ge,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){yd=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=Ad(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=Ed(),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<md.length;e++)md[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(yd),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:ge,minFilter:ge,generateMipmaps:!1,type:Ae,format:je,encoding:Md(e)?e.encoding:nn,depthBuffer:!1,stencilBuffer:!1},n=Td(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Td(t),n},_compileMaterial:function(e){var t=new co(md[0],e);this._renderer.compile(t,fd)},_sceneToCubeUV:function(e,t,n,r){var i=new To(90,1,t,n),o=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],s=this._renderer,c=s.outputEncoding,u=s.toneMapping,l=s.toneMappingExposure,h=s.getClearColor(),p=s.getClearAlpha();s.toneMapping=te,s.toneMappingExposure=1,s.outputEncoding=$t;var d=e.background;if(d&&d.isColor){d.convertSRGBToLinear();var f=Math.max(d.r,d.g,d.b),m=Math.min(Math.max(Math.ceil(Math.log2(f)),-128),127);d=d.multiplyScalar(Math.pow(2,-m));var v=(m+128)/255;s.setClearColor(d,v),e.background=null}for(var g=0;g<6;g++){var y=g%3;0==y?(i.up.set(0,o[g],0),i.lookAt(a[g],0,0)):1==y?(i.up.set(0,0,o[g]),i.lookAt(0,a[g],0)):(i.up.set(0,o[g],0),i.lookAt(0,0,a[g])),Sd(r,y*ld,g>2?ld:0,ld,ld),s.setRenderTarget(r),s.render(e,i)}s.toneMapping=u,s.toneMappingExposure=l,s.outputEncoding=c,s.setClearColor(h,p)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ad()):null==this._equirectShader&&(this._equirectShader=Ed());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new co(md[0],r),o=r.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=dd[e.encoding],o.outputEncoding.value=dd[t.texture.encoding],Sd(t,0,0,3*ld,2*ld),n.setRenderTarget(t),n.render(i,fd)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<pd;r++){var i=Math.sqrt(gd[r]*gd[r]-gd[r-1]*gd[r-1]),o=wd[(r-1)%wd.length];this._blur(e,r-1,r,i,o)}t.autoClear=n},_blur:function(e,t,n,r,i){var o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",i),this._halfBlur(o,e,n,n,r,"longitudinal",i)},_halfBlur:function(e,t,n,r,i,o,a){var s=this._renderer,c=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new co(md[r],c),l=c.uniforms,h=vd[n]-1,p=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,d=i/p,f=isFinite(i)?1+Math.floor(3*d):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=[],v=0,g=0;g<20;++g){var y=g/d,x=Math.exp(-y*y/2);m.push(x),0==g?v+=x:g<f&&(v+=2*x)}for(g=0;g<m.length;g++)m[g]=m[g]/v;l.envMap.value=e.texture,l.samples.value=f,l.weights.value=m,l.latitudinal.value="latitudinal"===o,a&&(l.poleAxis.value=a),l.dTheta.value=p,l.mipInt.value=8-n,l.inputEncoding.value=dd[e.texture.encoding],l.outputEncoding.value=dd[e.texture.encoding];var b=vd[r];Sd(t,y=3*Math.max(0,ld-2*b),(0===r?0:2*ld)+2*b*(r>4?r-8+4:0),3*b,2*b),s.setRenderTarget(t),s.render(u,fd)}};var Pd=0,Rd=1,Cd=0,Od=1,Dd=2;function Id(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function Nd(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 Bd(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Fc(e,t)}function Fd(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new tc(e)}function zd(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Fc(e,t)}function Ud(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function Gd(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function kd(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Oc(e)}function Vd(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new $n(e,t,n)}function Hd(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Si(e,t).setUsage(Pn)}function jd(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Ei(e,t)}function Wd(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ai(e,t)}function qd(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Li(e,t)}function Xd(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Pi(e,t)}function Yd(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Ri(e,t)}function Zd(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Ci(e,t)}function Jd(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Oi(e,t)}function Kd(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Di(e,t)}function Qd(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Ii(e,t)}function $d(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Jl.call(this,e),this.type="catmullrom",this.closed=!0}function ef(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Jl.call(this,e),this.type="catmullrom"}function tf(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Jl.call(this,e),this.type="catmullrom"}function nf(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new ud(e)}function rf(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new nd(e,t)}function of(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Rc(new Ju(e.geometry),new wc({color:void 0!==t?t:16777215}))}function af(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Rc(new Hc(e.geometry),new wc({color:void 0!==t?t:16777215}))}function sf(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Nl(e)}function cf(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new zl(e)}function uf(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Eo(e,n)}Vl.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Vl.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(ch.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 vo,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)}}),$d.prototype=Object.create(Jl.prototype),ef.prototype=Object.create(Jl.prototype),tf.prototype=Object.create(Jl.prototype),Object.assign(tf.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.")}}),Wp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Up.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(Dl.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Eh.extractUrlBase(e)}}),Dl.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(Ch.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Pp.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(Gr.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(Hr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Ro.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Op.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(kn,{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()."),kn.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),kn.ceilPowerOfTwo(e)}}),Object.assign(Hn.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,o){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,o)}}),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(pi.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(pi,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),pi.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),pi.getNormal(e,t,n,r)}}),Object.assign(lh.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 Nu(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Xu(this,e)}}),Object.assign(Vn.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(vo.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(co.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(co.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(lc.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(Vl.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}}),To.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(hh.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===Pn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Pn)}}}),Object.assign(Si.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Pn: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(Ah.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(Mp.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(zs.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Pn},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(zs.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Pn:Ln),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Bu.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(wp.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(_i.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 vi}},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(cl.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(_o.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(ep.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 ).")}}}),ap.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},So.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var lf={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 hf(){console.error("THREE.CanvasRenderer has been removed")}function pf(){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 kl;i.setCrossOrigin(this.crossOrigin);var o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},jn.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Gl;i.setCrossOrigin(this.crossOrigin);var o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},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 df={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 ff(){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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(0));var r=n(10);t.ConvexBufferGeometry=r.ConvexBufferGeometry;var i=n(8);t.FBXLoader=i.FBXLoader;var o=n(2);t.GLTFLoader=o.GLTFLoader;var a=n(3);t.SVGLoader=a.SVGLoader;var s=n(4);t.VRButton=s.VRButton;var c=n(11);t.AnimationAction=c.AnimationAction;var u=n(5);t.Sky=u.Sky;var l=n(9);t.Water=l.Water;var h=n(6);t.OrbitControls=h.OrbitControls;var p=n(7);t.WEBGL=p.WEBGL},function(e,t,n){"use strict";n.r(t),n.d(t,"GLTFLoader",(function(){return i}));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 o,a=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),a.manager.itemStart(e);var s=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},c=new r.FileLoader(a.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),"use-credentials"===a.crossOrigin&&c.setWithCredentials(!0),c.load(e,(function(n){try{a.parse(n,o,(function(n){t(n),a.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,p,m){var v,g={};if("string"==typeof e)v=e;else if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===c){try{g[n.KHR_BINARY_GLTF]=new u(e)}catch(e){return void(m&&m(e))}v=g[n.KHR_BINARY_GLTF].content}else v=r.LoaderUtils.decodeText(new Uint8Array(e));var y=JSON.parse(v);if(void 0===y.asset||y.asset.version[0]<2)m&&m(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],w=y.extensionsRequired||[];switch(b){case n.KHR_LIGHTS_PUNCTUAL:g[b]=new o(y);break;case n.KHR_MATERIALS_CLEARCOAT:g[b]=new s;break;case n.KHR_MATERIALS_UNLIT:g[b]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:g[b]=new d;break;case n.KHR_DRACO_MESH_COMPRESSION:g[b]=new l(y,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:g[b]=new i(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:g[b]=new h;break;case n.KHR_MESH_QUANTIZATION:g[b]=new f;break;default:w.indexOf(b)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+b+'".')}}var _=new P(y,g,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});_.fileLoader.setRequestHeader(this.requestHeader),_.parse(p,m)}}});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 o(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}function s(){this.name=n.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new r.Color(16777215);void 0!==n.color&&i.fromArray(n.color);var o=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=o;break;case"spot":(t=new r.SpotLight(i)).distance=o,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)},a.prototype.getMaterialType=function(){return r.MeshBasicMaterial},a.prototype.extendParams=function(e,t,n){var i=[];e.color=new r.Color(1,1,1),e.opacity=1;var o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var a=o.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==o.baseColorTexture&&i.push(n.assignTexture(e,"map",o.baseColorTexture))}return Promise.all(i)},s.prototype.getMaterialType=function(){return r.MeshPhysicalMaterial},s.prototype.extendParams=function(e,t,n){var i=[],o=t.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var a=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new r.Vector2(a,a)}return Promise.all(i)};var c="glTF";function u(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),o=0;o<i.byteLength;){var a=i.getUint32(o,!0);o+=4;var s=i.getUint32(o,!0);if(o+=4,1313821514===s){var u=new Uint8Array(e,12+o,a);this.content=r.LoaderUtils.decodeText(u)}else if(5130562===s){var l=12+o;this.body=e.slice(l,l+a)}o+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function l(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 h(){this.name=n.KHR_TEXTURE_TRANSFORM}function p(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"),o=["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"),a=["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>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",a)},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 d(){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 p},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new r.Color(1,1,1),e.opacity=1;var o=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==i.diffuseTexture&&o.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;o.push(n.assignTexture(e,"glossinessMap",s)),o.push(n.assignTexture(e,"specularMap",s))}return Promise.all(o)},createMaterial:function(e){var t=new p(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 f(){this.name=n.KHR_MESH_QUANTIZATION}function m(e,t,n,i){r.Interpolant.call(this,e,t,n,i)}l.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},s={},c={};for(var u in o){var l=b[u]||u.toLowerCase();a[l]=o[u]}for(u in e.attributes)if(l=b[u]||u.toLowerCase(),void 0!==o[u]){var h=n.accessors[e.attributes[u]],p=v[h.componentType];c[l]=p,s[l]=!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)}),a,c)}))}))},h.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},p.prototype=Object.create(r.MeshStandardMaterial.prototype),p.prototype.constructor=p,p.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},m.prototype=Object.create(r.Interpolant.prototype),m.prototype.constructor=m,m.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,o=0;o!==r;o++)t[o]=n[i+o];return t},m.prototype.beforeStart_=m.prototype.copySampleValue_,m.prototype.afterEnd_=m.prototype.copySampleValue_,m.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,c=3*a,u=r-t,l=(n-t)/u,h=l*l,p=h*l,d=e*c,f=d-c,m=-2*p+3*h,v=p-h,g=1-m,y=v-h+l,x=0;x!==a;x++){var b=o[f+x+a],w=o[f+x+s]*u,_=o[d+x+a],M=o[d+x]*u;i[x]=g*b+y*w+m*_+v*M}return i};var v={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},g={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},y={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},b={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},w={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},_={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},M={"image/png":r.RGBAFormat,"image/jpeg":r.RGBFormat};function T(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 S(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 E(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 A(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)for(e.morphTargetDictionary={},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 L(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 P(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 R(e,t,n){var i=t.attributes,o=[];function a(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var s in i){var c=b[s]||s.toLowerCase();c in e.attributes||o.push(a(i[s],c))}if(void 0!==t.indices&&!e.index){var u=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(u)}return E(e,t),function(e,t,n){var i=t.attributes,o=new r.Box3;if(void 0!==i.POSITION){var a=(d=n.json.accessors[i.POSITION]).min,s=d.max;if(void 0!==a&&void 0!==s){o.set(new r.Vector3(a[0],a[1],a[2]),new r.Vector3(s[0],s[1],s[2]));var c=t.targets;if(void 0!==c){for(var u=new r.Vector3,l=new r.Vector3,h=0,p=c.length;h<p;h++){var d,f=c[h];if(void 0!==f.POSITION)a=(d=n.json.accessors[f.POSITION]).min,s=d.max,void 0!==a&&void 0!==s?(l.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),l.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),l.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),u.max(l)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}o.expandByVector(u)}e.boundingBox=o;var m=new r.Sphere;o.getCenter(m.center),m.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=m}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(o).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,o=0,a=t.length;o<a&&(void 0!==(u=t[o]).POSITION&&(r=!0),void 0!==u.NORMAL&&(i=!0),!r||!i);o++);if(!r&&!i)return Promise.resolve(e);var s=[],c=[];for(o=0,a=t.length;o<a;o++){var u=t[o];if(r){var l=void 0!==u.POSITION?n.getDependency("accessor",u.POSITION):e.attributes.position;s.push(l)}i&&(l=void 0!==u.NORMAL?n.getDependency("accessor",u.NORMAL):e.attributes.normal,c.push(l))}return Promise.all([Promise.all(s),Promise.all(c)]).then((function(t){var n=t[0],o=t[1];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function C(e,t){var n=e.getIndex();if(null===n){var i=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<o.count;a++)i.push(a);e.setIndex(i),n=e.getIndex()}var s=n.count-2,c=[];if(t===r.TriangleFanDrawMode)for(a=1;a<=s;a++)c.push(n.getX(0)),c.push(n.getX(a)),c.push(n.getX(a+1));else for(a=0;a<s;a++)a%2==0?(c.push(n.getX(a)),c.push(n.getX(a+1)),c.push(n.getX(a+2))):(c.push(n.getX(a+2)),c.push(n.getX(a+1)),c.push(n.getX(a)));c.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=e.clone();return u.setIndex(c),u}return P.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 o={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};S(i,o,r),E(o,r),e(o)})).catch(t)},P.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r={},i={},o=0,a=t.length;o<a;o++)for(var s=t[o].joints,c=0,u=s.length;c<u;c++)e[s[c]].isBone=!0;for(var l=0,h=e.length;l<h;l++){var p=e[l];void 0!==p.mesh&&(void 0===r[p.mesh]&&(r[p.mesh]=i[p.mesh]=0),r[p.mesh]++,void 0!==p.skin&&(n[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=i},P.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},P.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},P.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(T(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},P.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)}))},P.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 o=[];return void 0!==i.bufferView?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),void 0!==i.sparse&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then((function(e){var o,a,s=e[0],c=x[i.type],u=v[i.componentType],l=u.BYTES_PER_ELEMENT,h=l*c,p=i.byteOffset||0,d=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,f=!0===i.normalized;if(d&&d!==h){var m=Math.floor(p/d),g="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+m+":"+i.count,y=t.cache.get(g);y||(o=new u(s,m*d,i.count*d/l),y=new r.InterleavedBuffer(o,d/l),t.cache.add(g,y)),a=new r.InterleavedBufferAttribute(y,c,p%d/l,f)}else o=null===s?new u(i.count*c):new u(s,p,i.count*c),a=new r.BufferAttribute(o,c,f);if(void 0!==i.sparse){var b=x.SCALAR,w=v[i.sparse.indices.componentType],_=i.sparse.indices.byteOffset||0,M=i.sparse.values.byteOffset||0,T=new w(e[1],_,i.sparse.count*b),S=new u(e[2],M,i.sparse.count*c);null!==s&&(a=new r.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(var E=0,A=T.length;E<A;E++){var L=T[E];if(a.setX(L,S[E*c]),c>=2&&a.setY(L,S[E*c+1]),c>=3&&a.setZ(L,S[E*c+2]),c>=4&&a.setW(L,S[E*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))},P.prototype.loadTexture=function(e){var t,i=this,o=this.json,a=this.options,s=this.textureLoader,c=self.URL||self.webkitURL,u=o.textures[e],l=u.extensions||{},h=(t=l[n.MSFT_TEXTURE_DDS]?o.images[l[n.MSFT_TEXTURE_DDS].source]:o.images[u.source]).uri,p=!1;return void 0!==t.bufferView&&(h=i.getDependency("bufferView",t.bufferView).then((function(e){p=!0;var n=new Blob([e],{type:t.mimeType});return h=c.createObjectURL(n)}))),Promise.resolve(h).then((function(e){var t=a.manager.getHandler(e);return t||(t=l[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(n,r){t.load(T(e,a.path),n,void 0,r)}))})).then((function(n){!0===p&&c.revokeObjectURL(h),n.flipY=!1,u.name&&(n.name=u.name),t.mimeType in M&&(n.format=M[t.mimeType]);var a=(o.samplers||{})[u.sampler]||{};return n.magFilter=g[a.magFilter]||r.LinearFilter,n.minFilter=g[a.minFilter]||r.LinearMipmapLinearFilter,n.wrapS=y[a.wrapS]||r.RepeatWrapping,n.wrapT=y[a.wrapT]||r.RepeatWrapping,i.associations.set(n,{type:"textures",index:e}),n}))},P.prototype.assignTexture=function(e,t,i){var o=this;return this.getDependency("texture",i.index).then((function(a){if(!a.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.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."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var c=o.associations.get(a);a=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,c)}}e[t]=a}))},P.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=void 0!==t.attributes.tangent,o=void 0!==t.attributes.color,a=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,c=Object.keys(t.morphAttributes).length>0,u=c&&void 0!==t.morphAttributes.normal;if(e.isPoints){var l="PointsMaterial:"+n.uuid,h=this.cache.get(l);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(l,h)),n=h}else if(e.isLine){l="LineBasicMaterial:"+n.uuid;var p=this.cache.get(l);p||(p=new r.LineBasicMaterial,r.Material.prototype.copy.call(p,n),p.color.copy(n.color),this.cache.add(l,p)),n=p}if(i||o||a||s||c){l="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(l+="specular-glossiness:"),s&&(l+="skinning:"),i&&(l+="vertex-tangents:"),o&&(l+="vertex-colors:"),a&&(l+="flat-shading:"),c&&(l+="morph-targets:"),u&&(l+="morph-normals:");var d=this.cache.get(l);d||(d=n.clone(),s&&(d.skinning=!0),i&&(d.vertexTangents=!0),o&&(d.vertexColors=!0),a&&(d.flatShading=!0),c&&(d.morphTargets=!0),u&&(d.morphNormals=!0),this.cache.add(l,d),this.associations.set(d,this.associations.get(n))),n=d}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},P.prototype.loadMaterial=function(e){var t,i=this,o=this.json,a=this.extensions,s=o.materials[e],c={},u=s.extensions||{},l=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),l.push(h.extendParams(c,s,i))}else if(u[n.KHR_MATERIALS_UNLIT]){var d=a[n.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),l.push(d.extendParams(c,s,i))}else{t=r.MeshStandardMaterial;var f=s.pbrMetallicRoughness||{};if(c.color=new r.Color(1,1,1),c.opacity=1,Array.isArray(f.baseColorFactor)){var m=f.baseColorFactor;c.color.fromArray(m),c.opacity=m[3]}void 0!==f.baseColorTexture&&l.push(i.assignTexture(c,"map",f.baseColorTexture)),c.metalness=void 0!==f.metallicFactor?f.metallicFactor:1,c.roughness=void 0!==f.roughnessFactor?f.roughnessFactor:1,void 0!==f.metallicRoughnessTexture&&(l.push(i.assignTexture(c,"metalnessMap",f.metallicRoughnessTexture)),l.push(i.assignTexture(c,"roughnessMap",f.metallicRoughnessTexture)))}!0===s.doubleSided&&(c.side=r.DoubleSide);var v=s.alphaMode||"OPAQUE";if("BLEND"===v?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,"MASK"===v&&(c.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&t!==r.MeshBasicMaterial&&(l.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&&(l.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&&l.push(i.assignTexture(c,"emissiveMap",s.emissiveTexture)),u[n.KHR_MATERIALS_CLEARCOAT]){var g=a[n.KHR_MATERIALS_CLEARCOAT];t=g.getMaterialType(),l.push(g.extendParams(c,{extensions:u},i))}return Promise.all(l).then((function(){var o;return o=t===p?a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(c):new t(c),s.name&&(o.name=s.name),o.map&&(o.map.encoding=r.sRGBEncoding),o.emissiveMap&&(o.emissiveMap.encoding=r.sRGBEncoding),E(o,s),i.associations.set(o,{type:"materials",index:e}),s.extensions&&S(a,o,s),o}))},P.prototype.loadGeometries=function(e){var t=this,i=this.extensions,o=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return R(n,e,t)}))}for(var s,c,u=[],l=0,h=e.length;l<h;l++){var p,d=e[l],f=(void 0,(c=(s=d).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+L(c.attributes):s.indices+":"+L(s.attributes)+":"+s.mode),m=o[f];m?u.push(m.promise):(p=d.extensions&&d.extensions[n.KHR_DRACO_MESH_COMPRESSION]?a(d):R(new r.BufferGeometry,d,t),o[f]={primitive:d,promise:p},u.push(p))}return Promise.all(u)},P.prototype.loadMesh=function(e){for(var t,n=this,i=this.json.meshes[e],o=i.primitives,a=[],s=0,c=o.length;s<c;s++){var u=void 0===o[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",o[s].material);a.push(u)}return a.push(n.loadGeometries(o)),Promise.all(a).then((function(t){for(var a=t.slice(0,t.length-1),s=t[t.length-1],c=[],u=0,l=s.length;u<l;u++){var h,p=s[u],d=o[u],f=a[u];if(4===d.mode||5===d.mode||6===d.mode||void 0===d.mode)!0!==(h=!0===i.isSkinnedMesh?new r.SkinnedMesh(p,f):new r.Mesh(p,f)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),5===d.mode?h.geometry=C(h.geometry,r.TriangleStripDrawMode):6===d.mode&&(h.geometry=C(h.geometry,r.TriangleFanDrawMode));else if(1===d.mode)h=new r.LineSegments(p,f);else if(3===d.mode)h=new r.Line(p,f);else if(2===d.mode)h=new r.LineLoop(p,f);else{if(0!==d.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);h=new r.Points(p,f)}Object.keys(h.geometry.morphAttributes).length>0&&A(h,i),h.name=i.name||"mesh_"+e,s.length>1&&(h.name+="_"+u),E(h,i),n.assignFinalMaterial(h),c.push(h)}if(1===c.length)return c[0];var m=new r.Group;for(u=0,l=c.length;u<l;u++)m.add(c[u]);return m}))},P.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),E(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},P.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}))},P.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],i=[],o=[],a=[],s=[],c=0,u=t.channels.length;c<u;c++){var l=t.channels[c],h=t.samplers[l.sampler],p=l.target,d=void 0!==p.node?p.node:p.id,f=void 0!==t.parameters?t.parameters[h.input]:h.input,v=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",f)),o.push(this.getDependency("accessor",v)),a.push(h),s.push(p)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a),Promise.all(s)]).then((function(n){for(var i=n[0],o=n[1],a=n[2],s=n[3],c=n[4],u=[],l=0,h=i.length;l<h;l++){var p=i[l],d=o[l],f=a[l],v=s[l],g=c[l];if(void 0!==p){var y;switch(p.updateMatrix(),p.matrixAutoUpdate=!0,w[g.path]){case w.weights:y=r.NumberKeyframeTrack;break;case w.rotation:y=r.QuaternionKeyframeTrack;break;case w.position:case w.scale:default:y=r.VectorKeyframeTrack}var x=p.name?p.name:p.uuid,b=void 0!==v.interpolation?_[v.interpolation]:r.InterpolateLinear,M=[];w[g.path]===w.weights?p.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&M.push(e.name?e.name:e.uuid)})):M.push(x);var T=f.array;if(f.normalized){var S;if(T.constructor===Int8Array)S=1/127;else if(T.constructor===Uint8Array)S=1/255;else if(T.constructor==Int16Array)S=1/32767;else{if(T.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var E=new Float32Array(T.length),A=0,L=T.length;A<L;A++)E[A]=T[A]*S;T=E}for(A=0,L=M.length;A<L;A++){var P=new y(M[A]+"."+w[g.path],d.array,T,b);"CUBICSPLINE"===v.interpolation&&(P.createInterpolant=function(e){return new m(this.times,this.values,this.getValueSize()/3,e)},P.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(P)}}}var R=t.name?t.name:"animation_"+e;return new r.AnimationClip(R,void 0,u)}))},P.prototype.loadNode=function(e){var t,i=this.json,o=this.extensions,a=this,s=i.meshReferences,c=i.meshUses,u=i.nodes[e];return(t=[],void 0!==u.mesh&&t.push(a.getDependency("mesh",u.mesh).then((function(e){var t;if(s[u.mesh]>1){var n=c[u.mesh]++;(t=e.clone()).name+="_instance_"+n}else t=e;return void 0!==u.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=u.weights.length;t<n;t++)e.morphTargetInfluences[t]=u.weights[t]})),t}))),void 0!==u.camera&&t.push(a.getDependency("camera",u.camera)),u.extensions&&u.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==u.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&t.push(a.getDependency("light",u.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(t){var n;if((n=!0===u.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(u.name&&(n.userData.name=u.name,n.name=r.PropertyBinding.sanitizeNodeName(u.name)),E(n,u),u.extensions&&S(o,n,u),void 0!==u.matrix){var c=new r.Matrix4;c.fromArray(u.matrix),n.applyMatrix4(c)}else void 0!==u.translation&&n.position.fromArray(u.translation),void 0!==u.rotation&&n.quaternion.fromArray(u.rotation),void 0!==u.scale&&n.scale.fromArray(u.scale);return a.associations.set(n,{type:"nodes",index:e}),n}))},P.prototype.loadScene=function(){function e(t,n,i,o){var a=i.nodes[t];return o.getDependency("node",t).then((function(e){return void 0===a.skin?e:o.getDependency("skin",a.skin).then((function(e){for(var n=[],r=0,i=(t=e).joints.length;r<i;r++)n.push(o.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],o=[],a=0,s=n.length;a<s;a++){var c=n[a];if(c){i.push(c);var u=new r.Matrix4;void 0!==t.inverseBindMatrices&&u.fromArray(t.inverseBindMatrices.array,16*a),o.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new r.Skeleton(i,o),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var r=[];if(a.children)for(var s=a.children,c=0,u=s.length;c<u;c++){var l=s[c];r.push(e(l,t,i,o))}return Promise.all(r)}))}return function(t){var n=this.json,i=this.extensions,o=this.json.scenes[t],a=new r.Group;o.name&&(a.name=o.name),E(a,o),o.extensions&&S(i,a,o);for(var s=o.nodes||[],c=[],u=0,l=s.length;u<l;u++)c.push(e(s[u],a,n,this));return Promise.all(c).then((function(){return a}))}}(),e}()},function(e,t,n){"use strict";n.r(t),n.d(t,"SVGLoader",(function(){return w}));var r,i,o,a,s,c,u,l,h,p,d,f,m,v,g,y,x,b=n(0),w=function(e){b.Loader.call(this,e),this.defaultDPI=90,this.defaultUnit="px"};w.prototype=Object.assign(Object.create(b.Loader.prototype),{constructor:w,load:function(e,t,n,r){var i=this,o=new b.FileLoader(i.manager);o.setPath(i.path),o.load(e,(function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)},parse:function(e){var t=this;function n(e,t,n,i,o,a,s,c){i=i*Math.PI/180,t=Math.abs(t),n=Math.abs(n);var u=(s.x-c.x)/2,l=(s.y-c.y)/2,h=Math.cos(i)*u+Math.sin(i)*l,p=-Math.sin(i)*u+Math.cos(i)*l,d=t*t,f=n*n,m=h*h,v=p*p,g=m/d+v/f;if(g>1){var y=Math.sqrt(g);d=(t*=y)*t,f=(n*=y)*n}var x=d*v+f*m,b=(d*f-x)/x,w=Math.sqrt(Math.max(0,b));o===a&&(w=-w);var _=w*t*p/n,M=-w*n*h/t,T=Math.cos(i)*_-Math.sin(i)*M+(s.x+c.x)/2,S=Math.sin(i)*_+Math.cos(i)*M+(s.y+c.y)/2,E=r(1,0,(h-_)/t,(p-M)/n),A=r((h-_)/t,(p-M)/n,(-h-_)/t,(-p-M)/n)%(2*Math.PI);e.currentPath.absellipse(T,S,t,n,E,E+A,0===a,i)}function r(e,t,n,r){var i=e*n+t*r,o=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),a=Math.acos(Math.max(-1,Math.min(1,i/o)));return e*r-t*n<0&&(a=-a),a}function i(e,t){t=Object.assign({},t);var n={};if(e.hasAttribute("class"))for(var r=e.getAttribute("class").split(/\s/).filter(Boolean).map(e=>e.trim()),i=0;i<r.length;i++)n=Object.assign(n,d["."+r[i]]);function o(r,i,o){void 0===o&&(o=function(e){return e}),e.hasAttribute(r)&&(t[i]=o(e.getAttribute(r))),n[r]&&(t[i]=o(n[r])),e.style&&""!==e.style[r]&&(t[i]=o(e.style[r]))}function a(e){return Math.max(0,Math.min(1,u(e)))}function s(e){return Math.max(0,u(e))}return e.hasAttribute("id")&&(n=Object.assign(n,d["#"+e.getAttribute("id")])),o("fill","fill"),o("fill-opacity","fillOpacity",a),o("opacity","opacity",a),o("stroke","stroke"),o("stroke-opacity","strokeOpacity",a),o("stroke-width","strokeWidth",s),o("stroke-linejoin","strokeLineJoin"),o("stroke-linecap","strokeLineCap"),o("stroke-miterlimit","strokeMiterLimit",s),o("visibility","visibility"),t}function o(e,t){return e-(t-e)}function a(e){for(var t=e.split(/[\s,]+|(?=\s?[+\-])/),n=0;n<t.length;n++){var r=t[n];if(r.indexOf(".")!==r.lastIndexOf("."))for(var i=r.split("."),o=2;o<i.length;o++)t.splice(n+o-1,0,"0."+i[o]);t[n]=u(r)}return t}var s=["mm","cm","in","pt","pc","px"],c={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function u(e){var n="px";if("string"==typeof e||e instanceof String)for(var r=0,i=s.length;r<i;r++){var o=s[r];if(e.endsWith(o)){n=o,e=e.substring(0,e.length-o.length);break}}var a=void 0;return"px"===n&&"px"!==t.defaultUnit?a=c.in[t.defaultUnit]/t.defaultDPI:(a=c[n][t.defaultUnit])<0&&(a=c[n].in*t.defaultDPI),a*parseFloat(e)}function l(e){var t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function h(e){var t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}var p=[],d={},f=[],m=new b.Matrix3,v=new b.Matrix3,g=new b.Matrix3,y=new b.Matrix3,x=new b.Vector2,w=new b.Vector3,_=new b.Matrix3,M=(new DOMParser).parseFromString(e,"image/svg+xml");return function e(t,r){if(1===t.nodeType){var s=function(e){if(!e.hasAttribute("transform"))return null;var t=function(e){for(var t=new b.Matrix3,n=m,r=e.getAttribute("transform").split(")"),i=r.length-1;i>=0;i--){var o=r[i].trim();if(""!==o){var s=o.indexOf("("),c=o.length;if(s>0&&s<c){var u=o.substr(0,s),l=a(o.substr(s+1,c-s-1));switch(n.identity(),u){case"translate":if(l.length>=1){var h=l[0],p=h;l.length>=2&&(p=l[1]),n.translate(h,p)}break;case"rotate":if(l.length>=1){var d,f=0,x=0;d=-l[0]*Math.PI/180,l.length>=3&&(f=l[1],x=l[2]),v.identity().translate(-f,-x),g.identity().rotate(d),y.multiplyMatrices(g,v),v.identity().translate(f,x),n.multiplyMatrices(v,y)}break;case"scale":if(l.length>=1){var w=l[0],_=w;l.length>=2&&(_=l[1]),n.scale(w,_)}break;case"skewX":1===l.length&&n.set(1,Math.tan(l[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":1===l.length&&n.set(1,0,0,Math.tan(l[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":6===l.length&&n.set(l[0],l[2],l[4],l[1],l[3],l[5],0,0,1)}}t.premultiply(n)}}return t}(e);return f.length>0&&t.premultiply(f[f.length-1]),_.copy(t),f.push(t),t}(t),c=null;switch(t.nodeName){case"svg":break;case"style":!function(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(var t=0;t<e.sheet.cssRules.length;t++){var n=e.sheet.cssRules[t];if(1===n.type)for(var r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim()),i=0;i<r.length;i++)d[r[i]]=Object.assign(d[r[i]]||{},n.style)}}(t);break;case"g":r=i(t,r);break;case"path":r=i(t,r),t.hasAttribute("d")&&(c=function(e){for(var t=new b.ShapePath,r=new b.Vector2,i=new b.Vector2,s=new b.Vector2,c=!0,u=!1,l=e.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi),h=0,p=l.length;h<p;h++){var d=l[h],f=d.charAt(0),m=d.substr(1).trim();switch(!0===c&&(u=!0,c=!1),f){case"M":for(var v=a(m),g=0,y=v.length;g<y;g+=2)r.x=v[g+0],r.y=v[g+1],i.x=r.x,i.y=r.y,0===g?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"H":for(g=0,y=(v=a(m)).length;g<y;g++)r.x=v[g],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"V":for(g=0,y=(v=a(m)).length;g<y;g++)r.y=v[g],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"L":for(g=0,y=(v=a(m)).length;g<y;g+=2)r.x=v[g+0],r.y=v[g+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"C":for(g=0,y=(v=a(m)).length;g<y;g+=6)t.bezierCurveTo(v[g+0],v[g+1],v[g+2],v[g+3],v[g+4],v[g+5]),i.x=v[g+2],i.y=v[g+3],r.x=v[g+4],r.y=v[g+5],0===g&&!0===u&&s.copy(r);break;case"S":for(g=0,y=(v=a(m)).length;g<y;g+=4)t.bezierCurveTo(o(r.x,i.x),o(r.y,i.y),v[g+0],v[g+1],v[g+2],v[g+3]),i.x=v[g+0],i.y=v[g+1],r.x=v[g+2],r.y=v[g+3],0===g&&!0===u&&s.copy(r);break;case"Q":for(g=0,y=(v=a(m)).length;g<y;g+=4)t.quadraticCurveTo(v[g+0],v[g+1],v[g+2],v[g+3]),i.x=v[g+0],i.y=v[g+1],r.x=v[g+2],r.y=v[g+3],0===g&&!0===u&&s.copy(r);break;case"T":for(g=0,y=(v=a(m)).length;g<y;g+=2){var x=o(r.x,i.x),w=o(r.y,i.y);t.quadraticCurveTo(x,w,v[g+0],v[g+1]),i.x=x,i.y=w,r.x=v[g+0],r.y=v[g+1],0===g&&!0===u&&s.copy(r)}break;case"A":for(g=0,y=(v=a(m)).length;g<y;g+=7){var _=r.clone();r.x=v[g+5],r.y=v[g+6],i.x=r.x,i.y=r.y,n(t,v[g],v[g+1],v[g+2],v[g+3],v[g+4],_,r),0===g&&!0===u&&s.copy(r)}break;case"m":for(g=0,y=(v=a(m)).length;g<y;g+=2)r.x+=v[g+0],r.y+=v[g+1],i.x=r.x,i.y=r.y,0===g?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"h":for(g=0,y=(v=a(m)).length;g<y;g++)r.x+=v[g],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"v":for(g=0,y=(v=a(m)).length;g<y;g++)r.y+=v[g],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"l":for(g=0,y=(v=a(m)).length;g<y;g+=2)r.x+=v[g+0],r.y+=v[g+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y),0===g&&!0===u&&s.copy(r);break;case"c":for(g=0,y=(v=a(m)).length;g<y;g+=6)t.bezierCurveTo(r.x+v[g+0],r.y+v[g+1],r.x+v[g+2],r.y+v[g+3],r.x+v[g+4],r.y+v[g+5]),i.x=r.x+v[g+2],i.y=r.y+v[g+3],r.x+=v[g+4],r.y+=v[g+5],0===g&&!0===u&&s.copy(r);break;case"s":for(g=0,y=(v=a(m)).length;g<y;g+=4)t.bezierCurveTo(o(r.x,i.x),o(r.y,i.y),r.x+v[g+0],r.y+v[g+1],r.x+v[g+2],r.y+v[g+3]),i.x=r.x+v[g+0],i.y=r.y+v[g+1],r.x+=v[g+2],r.y+=v[g+3],0===g&&!0===u&&s.copy(r);break;case"q":for(g=0,y=(v=a(m)).length;g<y;g+=4)t.quadraticCurveTo(r.x+v[g+0],r.y+v[g+1],r.x+v[g+2],r.y+v[g+3]),i.x=r.x+v[g+0],i.y=r.y+v[g+1],r.x+=v[g+2],r.y+=v[g+3],0===g&&!0===u&&s.copy(r);break;case"t":for(g=0,y=(v=a(m)).length;g<y;g+=2)x=o(r.x,i.x),w=o(r.y,i.y),t.quadraticCurveTo(x,w,r.x+v[g+0],r.y+v[g+1]),i.x=x,i.y=w,r.x=r.x+v[g+0],r.y=r.y+v[g+1],0===g&&!0===u&&s.copy(r);break;case"a":for(g=0,y=(v=a(m)).length;g<y;g+=7)_=r.clone(),r.x+=v[g+5],r.y+=v[g+6],i.x=r.x,i.y=r.y,n(t,v[g],v[g+1],v[g+2],v[g+3],v[g+4],_,r),0===g&&!0===u&&s.copy(r);break;case"Z":case"z":t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(r.copy(s),t.currentPath.currentPoint.copy(r),c=!0);break;default:console.warn(d)}u=!1}return t}(t));break;case"rect":r=i(t,r),c=function(e){var t=u(e.getAttribute("x")||0),n=u(e.getAttribute("y")||0),r=u(e.getAttribute("rx")||0),i=u(e.getAttribute("ry")||0),o=u(e.getAttribute("width")),a=u(e.getAttribute("height")),s=new b.ShapePath;return s.moveTo(t+2*r,n),s.lineTo(t+o-2*r,n),(0!==r||0!==i)&&s.bezierCurveTo(t+o,n,t+o,n,t+o,n+2*i),s.lineTo(t+o,n+a-2*i),(0!==r||0!==i)&&s.bezierCurveTo(t+o,n+a,t+o,n+a,t+o-2*r,n+a),s.lineTo(t+2*r,n+a),(0!==r||0!==i)&&s.bezierCurveTo(t,n+a,t,n+a,t,n+a-2*i),s.lineTo(t,n+2*i),(0!==r||0!==i)&&s.bezierCurveTo(t,n,t,n,t+2*r,n),s}(t);break;case"polygon":r=i(t,r),c=function(e){var t=new b.ShapePath,n=0;return e.getAttribute("points").replace(/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,(function(e,r,i){var o=u(r),a=u(i);0===n?t.moveTo(o,a):t.lineTo(o,a),n++})),t.currentPath.autoClose=!0,t}(t);break;case"polyline":r=i(t,r),c=function(e){var t=new b.ShapePath,n=0;return e.getAttribute("points").replace(/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,(function(e,r,i){var o=u(r),a=u(i);0===n?t.moveTo(o,a):t.lineTo(o,a),n++})),t.currentPath.autoClose=!1,t}(t);break;case"circle":r=i(t,r),c=function(e){var t=u(e.getAttribute("cx")),n=u(e.getAttribute("cy")),r=u(e.getAttribute("r")),i=new b.Path;i.absarc(t,n,r,0,2*Math.PI);var o=new b.ShapePath;return o.subPaths.push(i),o}(t);break;case"ellipse":r=i(t,r),c=function(e){var t=u(e.getAttribute("cx")),n=u(e.getAttribute("cy")),r=u(e.getAttribute("rx")),i=u(e.getAttribute("ry")),o=new b.Path;o.absellipse(t,n,r,i,0,2*Math.PI);var a=new b.ShapePath;return a.subPaths.push(o),a}(t);break;case"line":r=i(t,r),c=function(e){var t=u(e.getAttribute("x1")),n=u(e.getAttribute("y1")),r=u(e.getAttribute("x2")),i=u(e.getAttribute("y2")),o=new b.ShapePath;return o.moveTo(t,n),o.lineTo(r,i),o.currentPath.autoClose=!1,o}(t)}c&&(void 0!==r.fill&&"none"!==r.fill&&c.color.setStyle(r.fill),function(e,t){function n(e){w.set(e.x,e.y,1).applyMatrix3(t),e.set(w.x,w.y)}for(var r=function(e){return 0!==e.elements[1]||0!==e.elements[3]}(t),i=e.subPaths,o=0,a=i.length;o<a;o++)for(var s=i[o].curves,c=0;c<s.length;c++){var u=s[c];u.isLineCurve?(n(u.v1),n(u.v2)):u.isCubicBezierCurve?(n(u.v0),n(u.v1),n(u.v2),n(u.v3)):u.isQuadraticBezierCurve?(n(u.v0),n(u.v1),n(u.v2)):u.isEllipseCurve&&(r&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),x.set(u.aX,u.aY),n(x),u.aX=x.x,u.aY=x.y,u.xRadius*=l(t),u.yRadius*=h(t))}}(c,_),p.push(c),c.userData={node:t,style:r});for(var M=t.childNodes,T=0;T<M.length;T++)e(M[T],r);s&&(f.pop(),f.length>0?_.copy(f[f.length-1]):_.identity())}}(M.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:p,xml:M.documentElement}}}),w.getStrokeStyle=function(e,t,n,r,i){return{strokeColor:t=void 0!==t?t:"#000",strokeWidth:e=void 0!==e?e:1,strokeLineJoin:n=void 0!==n?n:"miter",strokeLineCap:r=void 0!==r?r:"butt",strokeMiterLimit:i=void 0!==i?i:4}},w.pointsToStroke=function(e,t,n,r){var i=[],o=[],a=[];if(0===w.pointsToStrokeWithBuffers(e,t,n,r,i,o,a))return null;var s=new b.BufferGeometry;return s.setAttribute("position",new b.Float32BufferAttribute(i,3)),s.setAttribute("normal",new b.Float32BufferAttribute(o,3)),s.setAttribute("uv",new b.Float32BufferAttribute(a,2)),s},w.pointsToStrokeWithBuffers=(r=new b.Vector2,i=new b.Vector2,o=new b.Vector2,a=new b.Vector2,s=new b.Vector2,c=new b.Vector2,u=new b.Vector2,l=new b.Vector2,h=new b.Vector2,p=new b.Vector2,d=new b.Vector2,f=new b.Vector2,m=new b.Vector2,v=new b.Vector2,g=new b.Vector2,y=new b.Vector2,x=new b.Vector2,function(e,t,n,b,w,_,M,T){n=void 0!==n?n:12,b=void 0!==b?b:.001,T=void 0!==T?T:0;var S=(e=function(e){for(var t=!1,n=1,r=e.length-1;n<r;n++)if(e[n].distanceTo(e[n+1])<b){t=!0;break}if(!t)return e;var i=[];for(i.push(e[0]),n=1,r=e.length-1;n<r;n++)e[n].distanceTo(e[n+1])>=b&&i.push(e[n]);return i.push(e[e.length-1]),i}(e)).length;if(S<2)return 0;var E,A,L,P,R,C=e[0].equals(e[S-1]),O=e[0],D=t.strokeWidth/2,I=1/(S-1),N=0,B=!1,F=0,z=3*T,U=2*T;K(e[0],e[1],r).multiplyScalar(D),l.copy(e[0]).sub(r),h.copy(e[0]).add(r),p.copy(l),d.copy(h);for(var G=1;G<S;G++){E=e[G],A=G===S-1?C?e[1]:void 0:e[G+1];var k=r;K(O,E,k),o.copy(k).multiplyScalar(D),f.copy(E).sub(o),m.copy(E).add(o);var V=N+I;if(L=!1,void 0!==A){K(E,A,i),o.copy(i).multiplyScalar(D),v.copy(E).sub(o),g.copy(E).add(o),P=!0,o.subVectors(A,O),k.dot(o)<0&&(P=!1),1===G&&(B=P),o.subVectors(A,E),o.normalize();var H=Math.abs(k.dot(o));if(0!==H){var j=D/H;o.multiplyScalar(-j),a.subVectors(E,O),s.copy(a).setLength(j).add(o),y.copy(s).negate();var W=s.length(),q=a.length();a.divideScalar(q),c.subVectors(A,E);var X=c.length();switch(c.divideScalar(X),a.dot(y)<q&&c.dot(y)<X&&(L=!0),x.copy(s).add(E),y.add(E),R=!1,L?P?(g.copy(y),m.copy(y)):(v.copy(y),f.copy(y)):ee(),t.strokeLineJoin){case"bevel":te(P,L,V);break;case"round":ne(P,L),P?$(E,f,v,V,0):$(E,g,m,V,1);break;case"miter":case"miter-clip":default:var Y=D*t.strokeMiterLimit/W;if(Y<1){if("miter-clip"!==t.strokeLineJoin){te(P,L,V);break}ne(P,L),P?(c.subVectors(x,f).multiplyScalar(Y).add(f),u.subVectors(x,v).multiplyScalar(Y).add(v),Q(f,V,0),Q(c,V,0),Q(E,V,.5),Q(E,V,.5),Q(c,V,0),Q(u,V,0),Q(E,V,.5),Q(u,V,0),Q(v,V,0)):(c.subVectors(x,m).multiplyScalar(Y).add(m),u.subVectors(x,g).multiplyScalar(Y).add(g),Q(m,V,1),Q(c,V,1),Q(E,V,.5),Q(E,V,.5),Q(c,V,1),Q(u,V,1),Q(E,V,.5),Q(u,V,1),Q(g,V,1))}else L?(P?(Q(h,N,1),Q(l,N,0),Q(x,V,0),Q(h,N,1),Q(x,V,0),Q(y,V,1)):(Q(h,N,1),Q(l,N,0),Q(x,V,1),Q(l,N,0),Q(y,V,0),Q(x,V,1)),P?v.copy(x):g.copy(x)):P?(Q(f,V,0),Q(x,V,0),Q(E,V,.5),Q(E,V,.5),Q(x,V,0),Q(v,V,0)):(Q(m,V,1),Q(x,V,1),Q(E,V,.5),Q(E,V,.5),Q(x,V,1),Q(g,V,1)),R=!0}}else ee()}else ee();C||G!==S-1||re(e[0],p,d,P,!0,N),N=V,O=E,l.copy(v),h.copy(g)}if(C){if(L&&w){var Z=x,J=y;B!==P&&(Z=y,J=x),P?(R||B)&&(J.toArray(w,0),J.toArray(w,9),R&&Z.toArray(w,3)):!R&&B||(J.toArray(w,3),J.toArray(w,9),R&&Z.toArray(w,0))}}else re(E,f,m,P,!1,V);return F;function K(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function Q(e,t,n){w&&(w[z]=e.x,w[z+1]=e.y,w[z+2]=0,_&&(_[z]=0,_[z+1]=0,_[z+2]=1),z+=3,M&&(M[U]=t,M[U+1]=n,U+=2)),F+=3}function $(e,t,s,c,u){r.copy(t).sub(e).normalize(),i.copy(s).sub(e).normalize();var l=Math.PI,h=r.dot(i);Math.abs(h)<1&&(l=Math.abs(Math.acos(h))),l/=n,o.copy(t);for(var p=0,d=n-1;p<d;p++)a.copy(o).rotateAround(e,l),Q(o,c,u),Q(a,c,u),Q(e,c,.5),o.copy(a);Q(a,c,u),Q(s,c,u),Q(e,c,.5)}function ee(){Q(h,N,1),Q(l,N,0),Q(f,V,0),Q(h,N,1),Q(f,V,1),Q(m,V,0)}function te(e,t,n){t?e?(Q(h,N,1),Q(l,N,0),Q(f,V,0),Q(h,N,1),Q(f,V,0),Q(y,V,1),Q(f,n,0),Q(v,n,0),Q(y,n,.5)):(Q(h,N,1),Q(l,N,0),Q(m,V,1),Q(l,N,0),Q(y,V,0),Q(m,V,1),Q(m,n,1),Q(g,n,0),Q(y,n,.5)):e?(Q(f,n,0),Q(v,n,0),Q(E,n,.5)):(Q(m,n,1),Q(g,n,0),Q(E,n,.5))}function ne(e,t){t&&(e?(Q(h,N,1),Q(l,N,0),Q(f,V,0),Q(h,N,1),Q(f,V,0),Q(y,V,1),Q(f,N,0),Q(E,V,.5),Q(y,V,1),Q(E,V,.5),Q(v,N,0),Q(y,V,1)):(Q(h,N,1),Q(l,N,0),Q(m,V,1),Q(l,N,0),Q(y,V,0),Q(m,V,1),Q(m,N,1),Q(y,V,0),Q(E,V,.5),Q(E,V,.5),Q(y,V,0),Q(g,N,1)))}function re(e,n,s,c,u,l){switch(t.strokeLineCap){case"round":u?$(e,s,n,l,.5):$(e,n,s,l,.5);break;case"square":if(u)r.subVectors(n,e),i.set(r.y,-r.x),o.addVectors(r,i).add(e),a.subVectors(i,r).add(e),c?(o.toArray(w,3),a.toArray(w,0),a.toArray(w,9)):(o.toArray(w,3),o.toArray(w,9),a.toArray(w,0));else{r.subVectors(s,e),i.set(r.y,-r.x),o.addVectors(r,i).add(e),a.subVectors(i,r).add(e);var h=w.length;c?(o.toArray(w,h-3),a.toArray(w,h-6),a.toArray(w,h-12)):(o.toArray(w,h-6),a.toArray(w,h-3),a.toArray(w,h-12))}}}})},function(e,t,n){"use strict";n.r(t),n.d(t,"VRButton",(function(){return r}));var r={createButton:function(e,t){function n(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if(t&&console.error('THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.'),"xr"in navigator){var r=document.createElement("button");return r.style.display="none",n(r),navigator.xr.isSessionSupported("immersive-vr").then((function(t){t?function(){var t=null;function n(n){n.addEventListener("end",i),e.xr.setSession(n),r.textContent="EXIT VR",t=n}function i(){t.removeEventListener("end",i),r.textContent="ENTER VR",t=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 50px)",r.style.width="100px",r.textContent="ENTER VR",r.onmouseenter=function(){r.style.opacity="1.0"},r.onmouseleave=function(){r.style.opacity="0.5"},r.onclick=function(){null===t?navigator.xr.requestSession("immersive-vr",{optionalFeatures:["local-floor","bounded-floor"]}).then(n):t.end()}}():(r.style.display="",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null,r.textContent="VR NOT SUPPORTED")})),r}var i=document.createElement("a");return!1===window.isSecureContext?(i.href=document.location.href.replace(/^http:/,"https:"),i.innerHTML="WEBXR NEEDS HTTPS"):(i.href="https://immersiveweb.dev/",i.innerHTML="WEBXR NOT AVAILABLE"),i.style.left="calc(50% - 90px)",i.style.width="180px",i.style.textDecoration="none",n(i),i}}},function(e,t,n){"use strict";n.r(t),n.d(t,"Sky",(function(){return i}));var r=n(0),i=function(){var e=i.SkyShader,t=new r.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:r.UniformsUtils.clone(e.uniforms),side:r.BackSide,depthWrite:!1});r.Mesh.call(this,new r.BoxBufferGeometry(1,1,1),t)};i.prototype=Object.create(r.Mesh.prototype),i.SkyShader={uniforms:{luminance:{value:1},turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new r.Vector3},up:{value:new r.Vector3(0,1,0)}},vertexShader:["uniform vec3 sunPosition;","uniform float rayleigh;","uniform float turbidity;","uniform float mieCoefficient;","uniform vec3 up;","varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunfade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","const float e = 2.71828182845904523536028747135266249775724709369995957;","const float pi = 3.141592653589793238462643383279502884197169;","const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );","const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );","const float v = 4.0;","const vec3 K = vec3( 0.686, 0.678, 0.666 );","const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );","const float cutoffAngle = 1.6110731556870734;","const float steepness = 1.5;","const float EE = 1000.0;","float sunIntensity( float zenithAngleCos ) {","\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );","\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );","}","vec3 totalMie( float T ) {","\tfloat c = ( 0.2 * T ) * 10E-18;","\treturn 0.434 * c * MieConst;","}","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tgl_Position.z = gl_Position.w;","\tvSunDirection = normalize( sunPosition );","\tvSunE = sunIntensity( dot( vSunDirection, up ) );","\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );","\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );","\tvBetaR = totalRayleigh * rayleighCoefficient;","\tvBetaM = totalMie( turbidity ) * mieCoefficient;","}"].join("\n"),fragmentShader:["varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunfade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","uniform float luminance;","uniform float mieDirectionalG;","uniform vec3 up;","const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );","const float pi = 3.141592653589793238462643383279502884197169;","const float n = 1.0003;","const float N = 2.545E25;","const float rayleighZenithLength = 8.4E3;","const float mieZenithLength = 1.25E3;","const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;","const float THREE_OVER_SIXTEENPI = 0.05968310365946075;","const float ONE_OVER_FOURPI = 0.07957747154594767;","float rayleighPhase( float cosTheta ) {","\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );","}","float hgPhase( float cosTheta, float g ) {","\tfloat g2 = pow( g, 2.0 );","\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );","\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );","}","const float A = 0.15;","const float B = 0.50;","const float C = 0.10;","const float D = 0.20;","const float E = 0.02;","const float F = 0.30;","const float whiteScale = 1.0748724675633854;","vec3 Uncharted2Tonemap( vec3 x ) {","\treturn ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;","}","void main() {","\tvec3 direction = normalize( vWorldPosition - cameraPos );","\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );","\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );","\tfloat sR = rayleighZenithLength * inverse;","\tfloat sM = mieZenithLength * inverse;","\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );","\tfloat cosTheta = dot( direction, vSunDirection );","\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );","\tvec3 betaRTheta = vBetaR * rPhase;","\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );","\tvec3 betaMTheta = vBetaM * mPhase;","\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );","\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );","\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]","\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]","\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );","\tvec3 L0 = vec3( 0.1 ) * Fex;","\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );","\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;","\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );","\tvec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );","\tvec3 color = curr * whiteScale;","\tvec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );","\tgl_FragColor = vec4( retColor, 1.0 );","}"].join("\n")}},function(e,t,n){"use strict";n.r(t),n.d(t,"OrbitControls",(function(){return i})),n.d(t,"MapControls",(function(){return o}));var r=n(0),i=function(e,t){var n,i,o,a,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(u),c.update(),d=p.NONE},this.update=(n=new r.Vector3,i=(new r.Quaternion).setFromUnitVectors(e.up,new r.Vector3(0,1,0)),o=i.clone().inverse(),a=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&&d===p.NONE&&R(2*Math.PI/60/60*c.autoRotateSpeed),c.enableDamping?(m.theta+=v.theta*c.dampingFactor,m.phi+=v.phi*c.dampingFactor):(m.theta+=v.theta,m.phi+=v.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*=g,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(o),e.copy(c.target).add(n),c.object.lookAt(c.target),!0===c.enableDamping?(v.theta*=1-c.dampingFactor,v.phi*=1-c.dampingFactor,y.multiplyScalar(1-c.dampingFactor)):(v.set(0,0,0),y.set(0,0,0)),g=1,!!(x||a.distanceToSquared(c.object.position)>f||8*(1-s.dot(c.object.quaternion))>f)&&(c.dispatchEvent(u),a.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,u={type:"change"},l={type:"start"},h={type:"end"},p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=p.NONE,f=1e-6,m=new r.Spherical,v=new r.Spherical,g=1,y=new r.Vector3,x=!1,b=new r.Vector2,w=new r.Vector2,_=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 P(){return Math.pow(.95,c.zoomSpeed)}function R(e){v.theta-=e}function C(e){v.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 o=e.length();o*=Math.tan(c.object.fov/2*Math.PI/180),D(2*t*o/r.clientHeight,c.object.matrix),I(2*n*o/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 B(e){c.object.isPerspectiveCamera?g/=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 F(e){c.object.isPerspectiveCamera?g*=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 z(e){b.set(e.clientX,e.clientY)}function U(e){M.set(e.clientX,e.clientY)}function G(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 k(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 V(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 H(e){if(1==e.touches.length)w.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);w.set(t,n)}_.subVectors(w,b).multiplyScalar(c.rotateSpeed);var r=c.domElement;R(2*Math.PI*_.x/r.clientHeight),C(2*Math.PI*_.y/r.clientHeight),b.copy(w)}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)),B(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),d=p.DOLLY;break;case r.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===c.enablePan)return;U(e),d=p.PAN}else{if(!1===c.enableRotate)return;z(e),d=p.ROTATE}break;case r.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===c.enableRotate)return;z(e),d=p.ROTATE}else{if(!1===c.enablePan)return;U(e),d=p.PAN}break;default:d=p.NONE}d!==p.NONE&&(document.addEventListener("mousemove",X,!1),document.addEventListener("mouseup",Y,!1),c.dispatchEvent(l))}}function X(e){if(!1!==c.enabled)switch(e.preventDefault(),d){case p.ROTATE:if(!1===c.enableRotate)return;!function(e){w.set(e.clientX,e.clientY),_.subVectors(w,b).multiplyScalar(c.rotateSpeed);var t=c.domElement;R(2*Math.PI*_.x/t.clientHeight),C(2*Math.PI*_.y/t.clientHeight),b.copy(w),c.update()}(e);break;case p.DOLLY:if(!1===c.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),L.subVectors(A,E),L.y>0?B(P()):L.y<0&&F(P()),E.copy(A),c.update()}(e);break;case p.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),d=p.NONE)}function Z(e){!1===c.enabled||!1===c.enableZoom||d!==p.NONE&&d!==p.ROTATE||(e.preventDefault(),e.stopPropagation(),c.dispatchEvent(l),function(e){e.deltaY<0?F(P()):e.deltaY>0&&B(P()),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;G(e),d=p.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===c.enablePan)return;k(e),d=p.TOUCH_PAN;break;default:d=p.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&&V(e),c.enablePan&&k(e)}(e),d=p.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(e){c.enableZoom&&V(e),c.enableRotate&&G(e)}(e),d=p.TOUCH_DOLLY_ROTATE;break;default:d=p.NONE}break;default:d=p.NONE}d!==p.NONE&&c.dispatchEvent(l)}}function Q(e){if(!1!==c.enabled)switch(e.preventDefault(),e.stopPropagation(),d){case p.TOUCH_ROTATE:if(!1===c.enableRotate)return;H(e),c.update();break;case p.TOUCH_PAN:if(!1===c.enablePan)return;j(e),c.update();break;case p.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 p.TOUCH_DOLLY_ROTATE:if(!1===c.enableZoom&&!1===c.enableRotate)return;!function(e){c.enableZoom&&W(e),c.enableRotate&&H(e)}(e),c.update();break;default:d=p.NONE}}function $(e){!1!==c.enabled&&(c.dispatchEvent(h),d=p.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()};i.prototype=Object.create(r.EventDispatcher.prototype),i.prototype.constructor=i;var o=function(e,t){i.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),o.prototype.constructor=o},function(e,t,n){"use strict";n.r(t),n.d(t,"WEBGL",(function(){return r}));var r={isWebGLAvailable:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},isWebGL2Available:function(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}},getWebGLErrorMessage:function(){return this.getErrorMessage(1)},getWebGL2ErrorMessage:function(){return this.getErrorMessage(2)},getErrorMessage:function(e){var t={1:window.WebGLRenderingContext,2:window.WebGL2RenderingContext},n='Your $0 does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">$1</a>',r=document.createElement("div");return r.id="webglmessage",r.style.fontFamily="monospace",r.style.fontSize="13px",r.style.fontWeight="normal",r.style.textAlign="center",r.style.background="#fff",r.style.color="#000",r.style.padding="1.5em",r.style.width="400px",r.style.margin="5em auto 0",n=(n=t[e]?n.replace("$0","graphics card"):n.replace("$0","browser")).replace("$1",{1:"WebGL",2:"WebGL 2"}[e]),r.innerHTML=n,r}}},function(e,t,n){"use strict";n.r(t),n.d(t,"FBXLoader",(function(){return H}));var r=n(0),i={},o=i;
  /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */function a(e,t){var n,r=e.split("."),i=o;!(r[0]in i)&&i.execScript&&i.execScript("var "+r[0]);for(;r.length&&(n=r.shift());)r.length||void 0===t?i=i[n]?i[n]:i[n]={}:i[n]=t}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function c(e){var t,n,r,i,o,a,c,u,l,h,p=e.length,d=0,f=Number.POSITIVE_INFINITY;for(u=0;u<p;++u)e[u]>d&&(d=e[u]),e[u]<f&&(f=e[u]);for(t=1<<d,n=new(s?Uint32Array:Array)(t),r=1,i=0,o=2;r<=d;){for(u=0;u<p;++u)if(e[u]===r){for(a=0,c=i,l=0;l<r;++l)a=a<<1|1&c,c>>=1;for(h=r<<16|u,l=a;l<t;l+=o)n[l]=h;++i}++r,i<<=1,o<<=1}return[n,d,f]}function u(e,t){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=s?new Uint8Array(e):e,this.m=!1,this.i=h,this.r=!1,!t&&(t={})||(t.index&&(this.a=t.index),t.bufferSize&&(this.h=t.bufferSize),t.bufferType&&(this.i=t.bufferType),t.resize&&(this.r=t.resize)),this.i){case l:this.b=32768,this.c=new(s?Uint8Array:Array)(32768+this.h+258);break;case h:this.b=0,this.c=new(s?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var l=0,h=1,p={t:l,s:h};u.prototype.k=function(){for(;!this.m;){var e=C(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var t=this.input,n=this.a,r=this.c,i=this.b,o=t.length,a=void 0,u=r.length,p=void 0;if(this.d=this.f=0,n+1>=o)throw Error("invalid uncompressed block header: LEN");if(a=t[n++]|t[n++]<<8,n+1>=o)throw Error("invalid uncompressed block header: NLEN");if(a===~(t[n++]|t[n++]<<8))throw Error("invalid uncompressed block header: length verify");if(n+a>t.length)throw Error("input buffer is broken");switch(this.i){case l:for(;i+a>r.length;){if(a-=p=u-i,s)r.set(t.subarray(n,n+p),i),i+=p,n+=p;else for(;p--;)r[i++]=t[n++];this.b=i,r=this.e(),i=this.b}break;case h:for(;i+a>r.length;)r=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(s)r.set(t.subarray(n,n+a),i),i+=a,n+=a;else for(;a--;)r[i++]=t[n++];this.a=n,this.b=i,this.c=r;break;case 1:this.j(L,R);break;case 2:var d,f,m,g,y=C(this,5)+257,x=C(this,5)+1,b=C(this,4)+4,w=new(s?Uint8Array:Array)(v.length),_=void 0,M=void 0,T=void 0,S=void 0,E=void 0;for(E=0;E<b;++E)w[v[E]]=C(this,3);if(!s)for(E=b,b=w.length;E<b;++E)w[v[E]]=0;for(d=c(w),_=new(s?Uint8Array:Array)(y+x),E=0,g=y+x;E<g;)switch(M=O(this,d),M){case 16:for(S=3+C(this,2);S--;)_[E++]=T;break;case 17:for(S=3+C(this,3);S--;)_[E++]=0;T=0;break;case 18:for(S=11+C(this,7);S--;)_[E++]=0;T=0;break;default:T=_[E++]=M}f=c(s?_.subarray(0,y):_.slice(0,y)),m=c(s?_.subarray(y):_.slice(y)),this.j(f,m);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var d,f,m=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v=s?new Uint16Array(m):m,g=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],y=s?new Uint16Array(g):g,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],b=s?new Uint8Array(x):x,w=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],_=s?new Uint16Array(w):w,M=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=s?new Uint8Array(M):M,S=new(s?Uint8Array:Array)(288);for(d=0,f=S.length;d<f;++d)S[d]=143>=d?8:255>=d?9:279>=d?7:8;var E,A,L=c(S),P=new(s?Uint8Array:Array)(30);for(E=0,A=P.length;E<A;++E)P[E]=5;var R=c(P);function C(e,t){for(var n,r=e.f,i=e.d,o=e.input,a=e.a,s=o.length;i<t;){if(a>=s)throw Error("input buffer is broken");r|=o[a++]<<i,i+=8}return n=r&(1<<t)-1,e.f=r>>>t,e.d=i-t,e.a=a,n}function O(e,t){for(var n,r,i=e.f,o=e.d,a=e.input,s=e.a,c=a.length,u=t[0],l=t[1];o<l&&!(s>=c);)i|=a[s++]<<o,o+=8;if((r=(n=u[i&(1<<l)-1])>>>16)>o)throw Error("invalid code length: "+r);return e.f=i>>r,e.d=o-r,e.a=s,65535&n}function D(e,t){var n,r;switch(this.input=e,this.a=0,!t&&(t={})||(t.index&&(this.a=t.index),t.verify&&(this.A=t.verify)),n=e[this.a++],r=e[this.a++],15&n){case I:this.method=I;break;default:throw Error("unsupported compression method")}if(0!=((n<<8)+r)%31)throw Error("invalid fcheck flag:"+((n<<8)+r)%31);if(32&r)throw Error("fdict flag is not supported");this.q=new u(e,{index:this.a,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}u.prototype.j=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,a,s,c=n.length-258;256!==(i=O(this,e));)if(256>i)r>=c&&(this.b=r,n=this.e(),r=this.b),n[r++]=i;else for(s=y[o=i-257],0<b[o]&&(s+=C(this,b[o])),i=O(this,t),a=_[i],0<T[i]&&(a+=C(this,T[i])),r>=c&&(this.b=r,n=this.e(),r=this.b);s--;)n[r]=n[r++-a];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},u.prototype.w=function(e,t){var n=this.c,r=this.b;this.o=e;for(var i,o,a,s,c=n.length;256!==(i=O(this,e));)if(256>i)r>=c&&(c=(n=this.e()).length),n[r++]=i;else for(s=y[o=i-257],0<b[o]&&(s+=C(this,b[o])),i=O(this,t),a=_[i],0<T[i]&&(a+=C(this,T[i])),r+s>c&&(c=(n=this.e()).length);s--;)n[r]=n[r++-a];for(;8<=this.d;)this.d-=8,this.a--;this.b=r},u.prototype.e=function(){var e,t,n=new(s?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.c;if(s)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;e<t;++e)n[e]=i[e+32768];if(this.g.push(n),this.l+=n.length,s)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},u.prototype.z=function(e){var t,n,r,i=this.input.length/this.a+1|0,o=this.input,a=this.c;return e&&("number"==typeof e.p&&(i=e.p),"number"==typeof e.u&&(i+=e.u)),n=2>i?(r=(o.length-this.a)/this.o[2]/2*258|0)<a.length?a.length+r:a.length<<1:a.length*i,s?(t=new Uint8Array(n)).set(a):t=a,this.c=t},u.prototype.n=function(){var e,t,n,r,i,o=0,a=this.c,c=this.g,u=new(s?Uint8Array:Array)(this.l+(this.b-32768));if(0===c.length)return s?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(t=0,n=c.length;t<n;++t)for(r=0,i=(e=c[t]).length;r<i;++r)u[o++]=e[r];for(t=32768,n=this.b;t<n;++t)u[o++]=a[t];return this.g=[],this.buffer=u},u.prototype.v=function(){var e,t=this.b;return s?this.r?(e=new Uint8Array(t)).set(this.c.subarray(0,t)):e=this.c.subarray(0,t):(this.c.length>t&&(this.c.length=t),e=this.c),this.buffer=e},D.prototype.k=function(){var e,t,n=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){t=(n[this.a++]<<24|n[this.a++]<<16|n[this.a++]<<8|n[this.a++])>>>0;var r=e;if("string"==typeof r){var i,o,a=r.split("");for(i=0,o=a.length;i<o;i++)a[i]=(255&a[i].charCodeAt(0))>>>0;r=a}for(var s,c=1,u=0,l=r.length,h=0;0<l;){l-=s=1024<l?1024:l;do{u+=c+=r[h++]}while(--s);c%=65521,u%=65521}if(t!==(u<<16|c)>>>0)throw Error("invalid adler-32 checksum")}return e};var I=8;a("Zlib.Inflate",D),a("Zlib.Inflate.prototype.decompress",D.prototype.k);var N,B,F,z,U={ADAPTIVE:p.s,BLOCK:p.t};if(Object.keys)N=Object.keys(U);else for(B in N=[],F=0,U)N[F++]=B;for(F=0,z=N.length;F<z;++F)a("Zlib.Inflate.BufferType."+(B=N[F]),U[B]);var G=i.Zlib,k={findSpan:function(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,o=r,a=Math.floor((i+o)/2);t<n[a]||t>=n[a+1];)t<n[a]?o=a:i=a,a=Math.floor((i+o)/2);return a},calcBasisFunctions:function(e,t,n,r){var i=[],o=[],a=[];i[0]=1;for(var s=1;s<=n;++s){o[s]=t-r[e+1-s],a[s]=r[e+s]-t;for(var c=0,u=0;u<s;++u){var l=a[u+1],h=o[s-u],p=i[u]/(l+h);i[u]=c+l*p,c=h*p}i[s]=c}return i},calcBSplinePoint:function(e,t,n,i){for(var o=this.findSpan(e,i,t),a=this.calcBasisFunctions(o,i,e,t),s=new r.Vector4(0,0,0,0),c=0;c<=e;++c){var u=n[o-e+c],l=a[c],h=u.w*l;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*l}return s},calcBasisFunctionDerivatives:function(e,t,n,r,i){for(var o=[],a=0;a<=n;++a)o[a]=0;var s=[];for(a=0;a<=r;++a)s[a]=o.slice(0);var c=[];for(a=0;a<=n;++a)c[a]=o.slice(0);c[0][0]=1;for(var u=o.slice(0),l=o.slice(0),h=1;h<=n;++h){u[h]=t-i[e+1-h],l[h]=i[e+h]-t;for(var p=0,d=0;d<h;++d){var f=l[d+1],m=u[h-d];c[h][d]=f+m;var v=c[d][h-1]/c[h][d];c[d][h]=p+f*v,p=m*v}c[h][h]=p}for(h=0;h<=n;++h)s[0][h]=c[h][n];for(d=0;d<=n;++d){var g=0,y=1,x=[];for(a=0;a<=n;++a)x[a]=o.slice(0);x[0][0]=1;for(var b=1;b<=r;++b){var w=0,_=d-b,M=n-b;d>=b&&(x[y][0]=x[g][0]/c[M+1][_],w=x[y][0]*c[_][M]);var T=d-1<=M?b-1:n-d;for(h=_>=-1?1:-_;h<=T;++h)x[y][h]=(x[g][h]-x[g][h-1])/c[M+1][_+h],w+=x[y][h]*c[_+h][M];d<=M&&(x[y][b]=-x[g][b-1]/c[M+1][d],w+=x[y][b]*c[d][M]),s[b][d]=w,h=g,g=y,y=h}}for(d=n,b=1;b<=r;++b){for(h=0;h<=n;++h)s[b][h]*=d;d*=n-b}return s},calcBSplineDerivatives:function(e,t,n,i,o){for(var a=o<e?o:e,s=[],c=this.findSpan(e,i,t),u=this.calcBasisFunctionDerivatives(c,i,e,a,t),l=[],h=0;h<n.length;++h){var p=(f=n[h].clone()).w;f.x*=p,f.y*=p,f.z*=p,l[h]=f}for(var d=0;d<=a;++d){for(var f=l[c-e].clone().multiplyScalar(u[d][0]),m=1;m<=e;++m)f.add(l[c-e+m].clone().multiplyScalar(u[d][m]));s[d]=f}for(d=a+1;d<=o+1;++d)s[d]=new r.Vector4(0,0,0);return s},calcKoverI:function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;var i=1;for(r=2;r<=t;++r)i*=r;for(r=2;r<=e-t;++r)i*=r;return n/i},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],i=[],o=0;o<t;++o){var a=e[o];n[o]=new r.Vector3(a.x,a.y,a.z),i[o]=a.w}for(var s=[],c=0;c<t;++c){var u=n[c].clone();for(o=1;o<=c;++o)u.sub(s[c-o].clone().multiplyScalar(this.calcKoverI(c,o)*i[o]));s[c]=u.divideScalar(i[0])}return s},calcNURBSDerivatives:function(e,t,n,r,i){var o=this.calcBSplineDerivatives(e,t,n,r,i);return this.calcRationalCurveDerivatives(o)},calcSurfacePoint:function(e,t,n,i,o,a,s,c){for(var u=this.findSpan(e,a,n),l=this.findSpan(t,s,i),h=this.calcBasisFunctions(u,a,e,n),p=this.calcBasisFunctions(l,s,t,i),d=[],f=0;f<=t;++f){d[f]=new r.Vector4(0,0,0,0);for(var m=0;m<=e;++m){var v=o[u-e+m][l-t+f].clone(),g=v.w;v.x*=g,v.y*=g,v.z*=g,d[f].add(v.multiplyScalar(h[m]))}}var y=new r.Vector4(0,0,0,0);for(f=0;f<=t;++f)y.add(d[f].multiplyScalar(p[f]));y.divideScalar(y.w),c.set(y.x,y.y,y.z)}},V=function(e,t,n,i,o){r.Curve.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=o||this.knots.length-1;for(var a=0;a<n.length;++a){var s=n[a];this.controlPoints[a]=new r.Vector4(s.x,s.y,s.z,s.w)}};(V.prototype=Object.create(r.Curve.prototype)).constructor=V,V.prototype.getPoint=function(e,t){var n=t||new r.Vector3,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),o=k.calcBSplinePoint(this.degree,this.knots,this.controlPoints,i);return 1!=o.w&&o.divideScalar(o.w),n.set(o.x,o.y,o.z)},V.prototype.getTangent=function(e,t){var n=t||new r.Vector3,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),o=k.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,i,1);return n.copy(o[1]).normalize(),n};var H=function(){var e,t,n;function i(e){r.Loader.call(this,e)}function o(e,t){this.textureLoader=e,this.manager=t}function a(){}function s(){}function c(){}function u(){}function l(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=void 0===t||t}function h(){}function p(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function d(e){return e/46186158e3}i.prototype=Object.assign(Object.create(r.Loader.prototype),{constructor:i,load:function(e,t,n,i){var o=this,a=""===o.path?r.LoaderUtils.extractUrlBase(e):o.path,s=new r.FileLoader(this.manager);s.setPath(o.path),s.setResponseType("arraybuffer"),s.load(e,(function(n){try{t(o.parse(n,a))}catch(t){i?i(t):console.error(t),o.manager.itemError(e)}}),n,i)},parse:function(t,n){if(s="Kaydara FBX Binary  \0",(a=t).byteLength>=s.length&&s===w(a,0,s.length))e=(new u).parse(t);else{var i=w(t);if(!function(e){for(var t,n=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,i=0;i<n.length;++i)if(void 0,t=e[1-1],e=e.slice(r+1),r++,t===n[i])return!1;return!0}(i))throw new Error("THREE.FBXLoader: Unknown format.");if(p(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+p(i));e=(new c).parse(i)}var a,s;return new o(new r.TextureLoader(this.manager).setPath(this.resourcePath||n).setCrossOrigin(this.crossOrigin),this.manager).parse(e)}}),o.prototype={constructor:o,parse:function(){t=this.parseConnections();var e=this.parseImages(),r=this.parseTextures(e),i=this.parseMaterials(r),o=this.parseDeformers(),s=(new a).parse(o);return this.parseScene(o,s,i),n},parseConnections:function(){var t=new Map;return"Connections"in e&&e.Connections.connections.forEach((function(e){var n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});var o={ID:r,relationship:i};t.get(n).parents.push(o),t.has(r)||t.set(r,{parents:[],children:[]});var a={ID:n,relationship:i};t.get(r).children.push(a)})),t},parseImages:function(){var t={},n={};if("Video"in e.Objects){var r=e.Objects.Video;for(var i in r){var o=r[i];if(t[u=parseInt(i)]=o.RelativeFilename||o.Filename,"Content"in o){var a=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,s="string"==typeof o.Content&&""!==o.Content;if(a||s){var c=this.parseImage(r[i]);n[o.RelativeFilename||o.Filename]=c}}}}for(var u in t){var l=t[u];void 0!==n[l]?t[u]=n[l]:t[u]=t[u].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var r=e.Objects.Texture;for(var i in r){var o=this.parseTexture(r[i],t);n.set(parseInt(i),o)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var i=e.WrapModeU,o=e.WrapModeV,a=void 0!==i?i.value:0,s=void 0!==o?o.value:0;if(n.wrapS=0===a?r.RepeatWrapping:r.ClampToEdgeWrapping,n.wrapT=0===s?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in e){var c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}return n},loadTexture:function(e,n){var i,o,a=this.textureLoader.path,s=t.get(e.id).children;void 0!==s&&s.length>0&&void 0!==n[s[0].ID]&&(0!==(i=n[s[0].ID]).indexOf("blob:")&&0!==i.indexOf("data:")||this.textureLoader.setPath(void 0));var c=e.FileName.slice(-3).toLowerCase();if("tga"===c){var u=this.manager.getHandler(".tga");null===u?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new r.Texture):o=u.load(i)}else"psd"===c?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new r.Texture):o=this.textureLoader.load(i);return this.textureLoader.setPath(a),o},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var r=e.Objects.Material;for(var i in r){var o=this.parseMaterial(r[i],t);null!==o&&n.set(parseInt(i),o)}}return n},parseMaterial:function(e,n){var i=e.id,o=e.attrName,a=e.ShadingModel;if("object"==typeof a&&(a=a.value),!t.has(i))return null;var s,c=this.parseParameters(e,n,i);switch(a.toLowerCase()){case"phong":s=new r.MeshPhongMaterial;break;case"lambert":s=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),s=new r.MeshPhongMaterial}return s.setValues(c),s.name=o,s},parseParameters:function(e,n,i){var o={};e.BumpFactor&&(o.bumpScale=e.BumpFactor.value),e.Diffuse?o.color=(new r.Color).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(o.color=(new r.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(o.displacementScale=e.DisplacementFactor.value),e.Emissive?o.emissive=(new r.Color).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(o.emissive=(new r.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(o.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(o.opacity=parseFloat(e.Opacity.value)),o.opacity<1&&(o.transparent=!0),e.ReflectionFactor&&(o.reflectivity=e.ReflectionFactor.value),e.Shininess&&(o.shininess=e.Shininess.value),e.Specular?o.specular=(new r.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(o.specular=(new r.Color).fromArray(e.SpecularColor.value));var a=this;return t.get(i).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":o.bumpMap=a.getTexture(n,e.ID);break;case"Maya|TEX_ao_map":o.aoMap=a.getTexture(n,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":o.map=a.getTexture(n,e.ID),o.map.encoding=r.sRGBEncoding;break;case"DisplacementColor":o.displacementMap=a.getTexture(n,e.ID);break;case"EmissiveColor":o.emissiveMap=a.getTexture(n,e.ID),o.emissiveMap.encoding=r.sRGBEncoding;break;case"NormalMap":case"Maya|TEX_normal_map":o.normalMap=a.getTexture(n,e.ID);break;case"ReflectionColor":o.envMap=a.getTexture(n,e.ID),o.envMap.mapping=r.EquirectangularReflectionMapping,o.envMap.encoding=r.sRGBEncoding;break;case"SpecularColor":o.specularMap=a.getTexture(n,e.ID),o.specularMap.encoding=r.sRGBEncoding;break;case"TransparentColor":case"TransparencyFactor":o.alphaMap=a.getTexture(n,e.ID),o.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),o},getTexture:function(n,r){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=t.get(r).children[0].ID),n.get(r)},parseDeformers:function(){var n={},r={};if("Deformer"in e.Objects){var i=e.Objects.Deformer;for(var o in i){var a=i[o],s=t.get(parseInt(o));if("Skin"===a.attrType){var c=this.parseSkeleton(s,i);c.ID=o,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),c.geometryID=s.parents[0].ID,n[o]=c}else if("BlendShape"===a.attrType){var u={id:o};u.rawTargets=this.parseMorphTargets(s,i),u.id=o,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[o]=u}}}return{skeletons:n,morphTargets:r}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var i=t[e.ID];if("Cluster"===i.attrType){var o={ID:e.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),n.push(o)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var r=[],i=0;i<e.children.length;i++){var o=e.children[i],a=n[o.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=t.get(parseInt(o.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r},parseScene:function(i,o,a){n=new r.Group;var c=this.parseModels(i.skeletons,o,a),u=e.Objects.Model,l=this;c.forEach((function(e){var r=u[e.ID];l.setLookAtProperties(e,r),t.get(e.ID).parents.forEach((function(t){var n=c.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&n.add(e)})),this.bindSkeleton(i.skeletons,o,c),this.createAmbientLight(),this.setupMorphMaterials(),n.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrixWorld=e.parent.matrix);var t=y(e.userData.transformData);e.applyMatrix4(t)}}));var h=(new s).parse();1===n.children.length&&n.children[0].isGroup&&(n.children[0].animations=h,n=n.children[0]),n.animations=h},parseModels:function(n,i,o){var a=new Map,s=e.Objects.Model;for(var c in s){var u=parseInt(c),l=s[c],h=t.get(u),p=this.buildSkeleton(h,n,u,l.attrName);if(!p){switch(l.attrType){case"Camera":p=this.createCamera(h);break;case"Light":p=this.createLight(h);break;case"Mesh":p=this.createMesh(h,i,o);break;case"NurbsCurve":p=this.createCurve(h,i);break;case"LimbNode":case"Root":p=new r.Bone;break;case"Null":default:p=new r.Group}p.name=l.attrName?r.PropertyBinding.sanitizeNodeName(l.attrName):"",p.ID=u}this.getTransformData(p,l),a.set(u,p)}return a},buildSkeleton:function(e,t,n,i){var o=null;return e.parents.forEach((function(e){for(var a in t){var s=t[a];s.rawBones.forEach((function(t,a){if(t.ID===e.ID){var c=o;(o=new r.Bone).matrixWorld.copy(t.transformLink),o.name=i?r.PropertyBinding.sanitizeNodeName(i):"",o.ID=n,s.bones[a]=o,null!==c&&o.add(c)}}))}})),o},createCamera:function(t){var n,i;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(i=n)})),void 0===i)n=new r.Object3D;else{var o=0;void 0!==i.CameraProjectionType&&1===i.CameraProjectionType.value&&(o=1);var a=1;void 0!==i.NearPlane&&(a=i.NearPlane.value/1e3);var s=1e3;void 0!==i.FarPlane&&(s=i.FarPlane.value/1e3);var c=window.innerWidth,u=window.innerHeight;void 0!==i.AspectWidth&&void 0!==i.AspectHeight&&(c=i.AspectWidth.value,u=i.AspectHeight.value);var l=c/u,h=45;void 0!==i.FieldOfView&&(h=i.FieldOfView.value);var p=i.FocalLength?i.FocalLength.value:null;switch(o){case 0:n=new r.PerspectiveCamera(h,l,a,s),null!==p&&n.setFocalLength(p);break;case 1:n=new r.OrthographicCamera(-c/2,c/2,u/2,-u/2,a,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+o+"."),n=new r.Object3D}}return n},createLight:function(t){var n,i;if(t.children.forEach((function(t){var n=e.Objects.NodeAttribute[t.ID];void 0!==n&&(i=n)})),void 0===i)n=new r.Object3D;else{var o;o=void 0===i.LightType?0:i.LightType.value;var a=16777215;void 0!==i.Color&&(a=(new r.Color).fromArray(i.Color.value));var s=void 0===i.Intensity?1:i.Intensity.value/100;void 0!==i.CastLightOnObject&&0===i.CastLightOnObject.value&&(s=0);var c=0;switch(void 0!==i.FarAttenuationEnd&&(c=void 0!==i.EnableFarAttenuation&&0===i.EnableFarAttenuation.value?0:i.FarAttenuationEnd.value),o){case 0:n=new r.PointLight(a,s,c,1);break;case 1:n=new r.DirectionalLight(a,s);break;case 2:var u=Math.PI/3;void 0!==i.InnerAngle&&(u=r.MathUtils.degToRad(i.InnerAngle.value));var l=0;void 0!==i.OuterAngle&&(l=r.MathUtils.degToRad(i.OuterAngle.value),l=Math.max(l,1)),n=new r.SpotLight(a,s,c,u,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),n=new r.PointLight(a,s)}void 0!==i.CastShadows&&1===i.CastShadows.value&&(n.castShadow=!0)}return n},createMesh:function(e,t,n){var i,o=null,a=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(o=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),s.length>1?a=s:s.length>0?a=s[0]:(a=new r.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in o.attributes&&s.forEach((function(e){e.vertexColors=!0})),o.FBX_Deformer?(s.forEach((function(e){e.skinning=!0})),(i=new r.SkinnedMesh(o,a)).normalizeSkinWeights()):i=new r.Mesh(o,a),i},createCurve:function(e,t){var n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),i=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(n,i)},getTransformData:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?x(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n},setLookAtProperties:function(i,o){"LookAtProperty"in o&&t.get(i.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var o=e.Objects.Model[t.ID];if("Lcl_Translation"in o){var a=o.Lcl_Translation.value;void 0!==i.target?(i.target.position.fromArray(a),n.add(i.target)):i.lookAt((new r.Vector3).fromArray(a))}}}))},bindSkeleton:function(e,n,i){var o=this.parsePoseNodes();for(var a in e){var s=e[a];t.get(parseInt(s.ID)).parents.forEach((function(e){if(n.has(e.ID)){var a=e.ID;t.get(a).parents.forEach((function(e){i.has(e.ID)&&i.get(e.ID).bind(new r.Skeleton(s.bones),o[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var i in n)if("BindPose"===n[i].attrType){var o=n[i].PoseNode;Array.isArray(o)?o.forEach((function(e){t[e.Node]=(new r.Matrix4).fromArray(e.Matrix.a)})):t[o.Node]=(new r.Matrix4).fromArray(o.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,i=t[0],o=t[1],a=t[2];if(0!==i||0!==o||0!==a){var s=new r.Color(i,o,a);n.add(new r.AmbientLight(s,1))}}},setupMorphMaterials:function(){var e=this;n.traverse((function(t){t.isMesh&&t.geometry.morphAttributes.position&&t.geometry.morphAttributes.position.length&&(Array.isArray(t.material)?t.material.forEach((function(n,r){e.setupMorphMaterial(t,n,r)})):e.setupMorphMaterial(t,t.material))}))},setupMorphMaterial:function(e,t,r){var i=e.uuid,o=t.uuid,a=!1;if(n.traverse((function(e){e.isMesh&&(Array.isArray(e.material)?e.material.forEach((function(t){t.uuid===o&&e.uuid!==i&&(a=!0)})):e.material.uuid===o&&e.uuid!==i&&(a=!0))})),!0===a){var s=t.clone();s.morphTargets=!0,void 0===r?e.material=s:e.material[r]=s}else t.morphTargets=!0}},a.prototype={constructor:a,parse:function(n){var r=new Map;if("Geometry"in e.Objects){var i=e.Objects.Geometry;for(var o in i){var a=t.get(parseInt(o)),s=this.parseGeometry(a,i[o],n);r.set(parseInt(o),s)}}return r},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,r){var i=r.skeletons,o=[],a=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==a.length){var s=t.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null);t.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])}));var c=a[0],u={};"RotationOrder"in c&&(u.eulerOrder=x(c.RotationOrder.value)),"InheritType"in c&&(u.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(u.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(u.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(u.scale=c.GeometricScaling.value);var l=y(u);return this.genGeometry(n,s,o,l)}},genGeometry:function(e,t,n,i){var o=new r.BufferGeometry;e.attrName&&(o.name=e.attrName);var a=this.parseGeoNode(e,t),s=this.genBuffers(a),c=new r.Float32BufferAttribute(s.vertex,3);if(c.applyMatrix4(i),o.setAttribute("position",c),s.colors.length>0&&o.setAttribute("color",new r.Float32BufferAttribute(s.colors,3)),t&&(o.setAttribute("skinIndex",new r.Uint16BufferAttribute(s.weightsIndices,4)),o.setAttribute("skinWeight",new r.Float32BufferAttribute(s.vertexWeights,4)),o.FBX_Deformer=t),s.normal.length>0){var u=(new r.Matrix3).getNormalMatrix(i),l=new r.Float32BufferAttribute(s.normal,3);l.applyNormalMatrix(u),o.setAttribute("normal",l)}if(s.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),o.setAttribute(n,new r.Float32BufferAttribute(s.uvs[t],2))})),a.material&&"AllSame"!==a.material.mappingType){var h=s.materialIndex[0],p=0;if(s.materialIndex.forEach((function(e,t){e!==h&&(o.addGroup(p,t-p,h),h=e,p=t)})),o.groups.length>0){var d=o.groups[o.groups.length-1],f=d.start+d.count;f!==s.materialIndex.length&&o.addGroup(f,s.materialIndex.length-f,h)}0===o.groups.length&&o.addGroup(0,s.materialIndex.length,s.materialIndex[0])}return this.addMorphTargets(o,e,n,i),o},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,o=[],a=[],s=[],c=[],u=[],l=[],h=this;return e.vertexIndices.forEach((function(p,d){var f=!1;p<0&&(p^=-1,f=!0);var v=[],g=[];if(o.push(3*p,3*p+1,3*p+2),e.color){var y=m(d,n,p,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[p]&&e.weightTable[p].forEach((function(e){g.push(e.weight),v.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var x=[0,0,0,0],b=[0,0,0,0];g.forEach((function(e,t){var n=e,r=v[t];b.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var o=x[t];x[t]=r,r=o}}))})),v=x,g=b}for(;g.length<4;)g.push(0),v.push(0);for(var w=0;w<4;++w)u.push(g[w]),l.push(v[w])}if(e.normal&&(y=m(d,n,p,e.normal),a.push(y[0],y[1],y[2])),e.material&&"AllSame"!==e.material.mappingType)var _=m(d,n,p,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var r=m(d,n,p,e);void 0===c[t]&&(c[t]=[]),c[t].push(r[0]),c[t].push(r[1])})),r++,f&&(h.genFace(t,e,o,_,a,s,c,u,l,r),n++,r=0,o=[],a=[],s=[],c=[],u=[],l=[])})),t},genFace:function(e,t,n,r,i,o,a,s,c,u){for(var l=2;l<u;l++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(l-1)]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+2]]),e.vertex.push(t.vertexPositions[n[3*l]]),e.vertex.push(t.vertexPositions[n[3*l+1]]),e.vertex.push(t.vertexPositions[n[3*l+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(l-1)]),e.vertexWeights.push(s[4*(l-1)+1]),e.vertexWeights.push(s[4*(l-1)+2]),e.vertexWeights.push(s[4*(l-1)+3]),e.vertexWeights.push(s[4*l]),e.vertexWeights.push(s[4*l+1]),e.vertexWeights.push(s[4*l+2]),e.vertexWeights.push(s[4*l+3]),e.weightsIndices.push(c[0]),e.weightsIndices.push(c[1]),e.weightsIndices.push(c[2]),e.weightsIndices.push(c[3]),e.weightsIndices.push(c[4*(l-1)]),e.weightsIndices.push(c[4*(l-1)+1]),e.weightsIndices.push(c[4*(l-1)+2]),e.weightsIndices.push(c[4*(l-1)+3]),e.weightsIndices.push(c[4*l]),e.weightsIndices.push(c[4*l+1]),e.weightsIndices.push(c[4*l+2]),e.weightsIndices.push(c[4*l+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(l-1)]),e.colors.push(o[3*(l-1)+1]),e.colors.push(o[3*(l-1)+2]),e.colors.push(o[3*l]),e.colors.push(o[3*l+1]),e.colors.push(o[3*l+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(l-1)]),e.normal.push(i[3*(l-1)+1]),e.normal.push(i[3*(l-1)+2]),e.normal.push(i[3*l]),e.normal.push(i[3*l+1]),e.normal.push(i[3*l+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(a[n][0]),e.uvs[n].push(a[n][1]),e.uvs[n].push(a[n][2*(l-1)]),e.uvs[n].push(a[n][2*(l-1)+1]),e.uvs[n].push(a[n][2*l]),e.uvs[n].push(a[n][2*l+1])}))},addMorphTargets:function(t,n,r,i){if(0!==r.length){t.morphTargetsRelative=!0,t.morphAttributes.position=[];var o=this;r.forEach((function(r){r.rawTargets.forEach((function(r){var a=e.Objects.Geometry[r.geoID];void 0!==a&&o.genMorphGeometry(t,n,a,i,r.name)}))}))}},genMorphGeometry:function(e,t,n,i,o){for(var a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],s=void 0!==n.Vertices?n.Vertices.a:[],c=void 0!==n.Indexes?n.Indexes.a:[],u=3*e.attributes.position.count,l=new Float32Array(u),h=0;h<c.length;h++){var p=3*c[h];l[p]=s[3*h],l[p+1]=s[3*h+1],l[p+2]=s[3*h+2]}var d={vertexIndices:a,vertexPositions:l},f=this.genBuffers(d),m=new r.Float32BufferAttribute(f.vertex,3);m.name=o||n.attrName,m.applyMatrix4(i),e.morphAttributes.position.push(m)},parseNormals:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}},parseUVs:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}},parseVertexColors:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];return"IndexToDirect"===n&&(i=e.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}},parseMaterialIndices:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],o=0;o<r.length;++o)i.push(o);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}},parseNurbsGeometry:function(e){if(void 0===V)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new r.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new r.BufferGeometry;for(var n,i,o=t-1,a=e.KnotVector.a,s=[],c=e.Points.a,u=0,l=c.length;u<l;u+=4)s.push((new r.Vector4).fromArray(c,u));if("Closed"===e.Form)s.push(s[0]);else if("Periodic"===e.Form)for(n=o,i=a.length-1-n,u=0;u<o;++u)s.push(s[u]);var h=new V(o,a,s,n,i).getPoints(7*s.length),p=new Float32Array(3*h.length);h.forEach((function(e,t){e.toArray(p,3*t)}));var d=new r.BufferGeometry;return d.setAttribute("position",new r.BufferAttribute(p,3)),d}},s.prototype={constructor:s,parse:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e},parseClips:function(){if(void 0!==e.Objects.AnimationCurve){var t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);var n=this.parseAnimationLayers(t);return this.parseAnimStacks(n)}},parseAnimationCurveNodes:function(){var t=e.Objects.AnimationCurveNode,n=new Map;for(var r in t){var i=t[r];if(null!==i.attrName.match(/S|R|T|DeformPercent/)){var o={id:i.id,attr:i.attrName,curves:{}};n.set(o.id,o)}}return n},parseAnimationCurves:function(n){var r=e.Objects.AnimationCurve;for(var i in r){var o={id:r[i].id,times:r[i].KeyTime.a.map(d),values:r[i].KeyValueFloat.a},a=t.get(o.id);if(void 0!==a){var s=a.parents[0].ID,c=a.parents[0].relationship;c.match(/X/)?n.get(s).curves.x=o:c.match(/Y/)?n.get(s).curves.y=o:c.match(/Z/)?n.get(s).curves.z=o:c.match(/d|DeformPercent/)&&n.has(s)&&(n.get(s).curves.morph=o)}}},parseAnimationLayers:function(i){var o=e.Objects.AnimationLayer,a=new Map;for(var s in o){var c=[],u=t.get(parseInt(s));void 0!==u&&(u.children.forEach((function(o,a){if(i.has(o.ID)){var s=i.get(o.ID);if(void 0!==s.curves.x||void 0!==s.curves.y||void 0!==s.curves.z){if(void 0===c[a]&&void 0!==(f=t.get(o.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID)){if(void 0===(l=e.Objects.Model[f.toString()]))return void console.warn("THREE.FBXLoader: Encountered a unused curve.",o);var u={modelName:l.attrName?r.PropertyBinding.sanitizeNodeName(l.attrName):"",ID:l.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};n.traverse((function(e){e.ID===l.id&&(u.transform=e.matrix,e.userData.transformData&&(u.eulerOrder=e.userData.transformData.eulerOrder))})),u.transform||(u.transform=new r.Matrix4),"PreRotation"in l&&(u.preRotation=l.PreRotation.value),"PostRotation"in l&&(u.postRotation=l.PostRotation.value),c[a]=u}c[a]&&(c[a][s.attr]=s)}else if(void 0!==s.curves.morph){if(void 0===c[a]){var l,h=t.get(o.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,p=t.get(h).parents[0].ID,d=t.get(p).parents[0].ID,f=t.get(d).parents[0].ID;u={modelName:(l=e.Objects.Model[f]).attrName?r.PropertyBinding.sanitizeNodeName(l.attrName):"",morphName:e.Objects.Deformer[h].attrName},c[a]=u}c[a][s.attr]=s}}})),a.set(parseInt(s),c))}return a},parseAnimStacks:function(n){var r=e.Objects.AnimationStack,i={};for(var o in r){var a=t.get(parseInt(o)).children;a.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=n.get(a[0].ID);i[o]={name:r[o].attrName,layer:s}}return i},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new r.AnimationClip(e.name,-1,t)},generateTracks:function(e){var t=[],n=new r.Vector3,i=new r.Quaternion,o=new r.Vector3;if(e.transform&&e.transform.decompose(n,i,o),n=n.toArray(),i=(new r.Euler).setFromQuaternion(i,e.eulerOrder).toArray(),o=o.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==a&&t.push(a)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var s=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);void 0!==s&&t.push(s)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var c=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");void 0!==c&&t.push(c)}if(void 0!==e.DeformPercent){var u=this.generateMorphTrack(e);void 0!==u&&t.push(u)}return t},generateVectorTrack:function(e,t,n,i){var o=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(o,t,n);return new r.VectorKeyframeTrack(e+"."+i,o,a)},generateRotationTrack:function(e,t,n,i,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(r.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(r.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(r.MathUtils.degToRad));var s=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(s,t,n);void 0!==i&&((i=i.map(r.MathUtils.degToRad)).push(a),i=(new r.Euler).fromArray(i),i=(new r.Quaternion).setFromEuler(i)),void 0!==o&&((o=o.map(r.MathUtils.degToRad)).push(a),o=(new r.Euler).fromArray(o),o=(new r.Quaternion).setFromEuler(o).inverse());for(var u=new r.Quaternion,l=new r.Euler,h=[],p=0;p<c.length;p+=3)l.set(c[p],c[p+1],c[p+2],a),u.setFromEuler(l),void 0!==i&&u.premultiply(i),void 0!==o&&u.multiply(o),u.toArray(h,p/3*4);return new r.QuaternionKeyframeTrack(e+".quaternion",s,h)},generateMorphTrack:function(e){var t=e.DeformPercent.curves.morph,i=t.values.map((function(e){return e/100})),o=n.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new r.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+o+"]",t.times,i)},getTimesForAllAxes:function(e){var t=[];return void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t.sort((function(e,t){return e-t})).filter((function(e,t,n){return n.indexOf(e)==t}))},getKeyframeTrackValues:function(e,t,n){var r=n,i=[],o=-1,a=-1,s=-1;return e.forEach((function(e){if(t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o){var n=t.x.values[o];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==a){var c=t.y.values[a];i.push(c),r[1]=c}else i.push(r[1]);if(-1!==s){var u=t.z.values[s];i.push(u),r[2]=u}else i.push(r[2])})),i},interpolateRotations:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var o=i/180,a=r/o,s=n+a,c=e.times[t-1],u=(e.times[t]-c)/o,l=c+u,h=[],p=[];l<e.times[t];)h.push(l),l+=u,p.push(s),s+=a;e.times=_(e.times,t,h),e.values=_(e.values,t,p)}}}},c.prototype={constructor:c,getPrevNode:function(){return this.nodeStack[this.currentIndent-2]},getCurrentNode:function(){return this.nodeStack[this.currentIndent-1]},getCurrentProp:function(){return this.currentProp},pushStack:function(e){this.nodeStack.push(e),this.currentIndent+=1},popStack:function(){this.nodeStack.pop(),this.currentIndent-=1},setCurrentProp:function(e,t){this.currentProp=e,this.currentPropName=t},parse:function(e){this.currentIndent=0,this.allNodes=new h,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),o=e.match(/^[\s\t]*$/);if(!i&&!o){var a=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=e.match("^\\t{"+(t.currentIndent-1)+"}}");a?t.parseNodeBegin(e,a):s?t.parseNodeProperty(e,s,n[++r]):c?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes},parseNodeBegin:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},o=this.parseNodeAttr(r),a=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in a?("PoseNode"===n?a.PoseNode.push(i):void 0!==a[n].id&&(a[n]={},a[n][a[n].id]=a[n]),""!==o.id&&(a[n][o.id]=i)):"number"==typeof o.id?(a[n]={},a[n][o.id]=i):"Properties70"!==n&&(a[n]="PoseNode"===n?[i]:i),"number"==typeof o.id&&(i.id=o.id),""!==o.name&&(i.attrName=o.name),""!==o.type&&(i.attrType=o.type),this.pushStack(i)},parseNodeAttr:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}},parseNodeProperty:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){var a=i.split(",").slice(1),s=parseInt(a[0]),c=parseInt(a[1]),u=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[s,c],u=u.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===o[r]&&(o[r]=[])}"Node"===r&&(o.id=i),r in o&&Array.isArray(o[r])?o[r].push(i):"a"!==r?o[r]=i:o.a=i,this.setCurrentProp(o,r),"a"===r&&","!==i.slice(-1)&&(o.a=b(i))}else this.parseNodeSpecialProperty(e,r,i)},parseNodePropertyContinued:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=b(t.a))},parseNodeSpecialProperty:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],o=r[1],a=r[2],s=r[3],c=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=b(c)}this.getPrevNode()[i]={type:o,type2:a,flag:s,value:c},this.setCurrentProp(this.getPrevNode(),i)}},u.prototype={constructor:u,parse:function(e){var t=new l(e);t.skip(23);var n=t.getUint32();console.log("THREE.FBXLoader: FBX binary version: "+n);for(var r=new h;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r},endOfContent:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var o=e.getUint8(),a=e.getString(o);if(0===r)return null;for(var s=[],c=0;c<i;c++)s.push(this.parseProperty(e));var u=s.length>0?s[0]:"",l=s.length>1?s[1]:"",h=s.length>2?s[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var p=this.parseNode(e,t);null!==p&&this.parseSubNode(a,n,p)}return n.propertyList=s,"number"==typeof u&&(n.id=u),""!==l&&(n.attrName=l),""!==h&&(n.attrType=h),""!==a&&(n.name=a),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name)Object.keys(n).forEach((function(e){t[e]=n[e]}));else if("Properties70"===e&&"P"===n.name){var o,a=n.propertyList[0],s=n.propertyList[1],c=n.propertyList[2],u=n.propertyList[3];0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),o="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[a]={type:s,type2:c,flag:u,value:o}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===G&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var a=new l(new G.Inflate(new Uint8Array(e.getArrayBuffer(o))).decompress().buffer);switch(t){case"b":case"c":return a.getBooleanArray(r);case"d":return a.getFloat64Array(r);case"f":return a.getFloat32Array(r);case"i":return a.getInt32Array(r);case"l":return a.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},l.prototype={constructor:l,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1==(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t},getUint8:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e},getInt16:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e},getInt32:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e},getInt32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t},getUint32:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e},getInt64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295==(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e},getInt64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t},getUint64:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e},getFloat32:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e},getFloat32Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t},getFloat64:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e},getFloat64Array:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t},getArrayBuffer:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t},getString:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),r.LoaderUtils.decodeText(new Uint8Array(t))}},h.prototype={constructor:h,add:function(e,t){this[e]=t}};var f=[];function m(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var o=i*r.dataSize,a=o+r.dataSize;return function(e,t,n,r){for(var i=n,o=0;i<r;i++,o++)e[o]=t[i];return e}(f,r.buffer,o,a)}var v=new r.Euler,g=new r.Vector3;function y(e){var t,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,a=new r.Matrix4,s=new r.Matrix4,c=new r.Matrix4,u=new r.Matrix4,l=new r.Matrix4,h=new r.Matrix4,p=new r.Matrix4,d=new r.Matrix4,f=e.inheritType?e.inheritType:0;e.translation&&n.setPosition(g.fromArray(e.translation)),e.preRotation&&((t=e.preRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(v.fromArray(t))),e.rotation&&((t=e.rotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),o.makeRotationFromEuler(v.fromArray(t))),e.postRotation&&((t=e.postRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(v.fromArray(t))),e.scale&&s.scale(g.fromArray(e.scale)),e.scalingOffset&&u.setPosition(g.fromArray(e.scalingOffset)),e.scalingPivot&&c.setPosition(g.fromArray(e.scalingPivot)),e.rotationOffset&&l.setPosition(g.fromArray(e.rotationOffset)),e.rotationPivot&&h.setPosition(g.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(p=e.parentMatrixWorld);var m=i.multiply(o).multiply(a),y=new r.Matrix4;p.extractRotation(y),(new r.Matrix4).copyPosition(p);var x=new r.Matrix4;x.getInverse(y).multiply(p);var b=new r.Matrix4;if(0===f)b.copy(y).multiply(m).multiply(x).multiply(s);else if(1===f)b.copy(y).multiply(x).multiply(m).multiply(s);else{var w=(new r.Matrix4).getInverse(s),_=(new r.Matrix4).multiply(x).multiply(w);b.copy(y).multiply(m).multiply(_).multiply(s)}var M=(new r.Matrix4).getInverse(h),T=(new r.Matrix4).getInverse(c),S=new r.Matrix4;S.copy(n).multiply(l).multiply(h).multiply(i).multiply(o).multiply(a).multiply(M).multiply(u).multiply(c).multiply(s).multiply(T);var E=(new r.Matrix4).copyPosition(S),A=(new r.Matrix4).copy(p).multiply(E);return d.copyPosition(A),(new r.Matrix4).multiply(d).multiply(b)}function x(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function b(e){return e.split(",").map((function(e){return parseFloat(e)}))}function w(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function _(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}return i}()},function(e,t,n){"use strict";n.r(t),n.d(t,"Water",(function(){return a}));var r=n(0),i=function(e,t){r.Mesh.call(this,e),this.type="Reflector";var n=this,o=void 0!==(t=t||{}).color?new r.Color(t.color):new r.Color(8355711),a=t.textureWidth||512,s=t.textureHeight||512,c=t.clipBias||0,u=t.shader||i.ReflectorShader,l=void 0!==t.encoding?t.encoding:r.LinearEncoding,h=new r.Plane,p=new r.Vector3,d=new r.Vector3,f=new r.Vector3,m=new r.Matrix4,v=new r.Vector3(0,0,-1),g=new r.Vector4,y=new r.Vector3,x=new r.Vector3,b=new r.Vector4,w=new r.Matrix4,_=new r.PerspectiveCamera,M={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,stencilBuffer:!1,encoding:l},T=new r.WebGLRenderTarget(a,s,M);r.MathUtils.isPowerOfTwo(a)&&r.MathUtils.isPowerOfTwo(s)||(T.texture.generateMipmaps=!1);var S=new r.ShaderMaterial({uniforms:r.UniformsUtils.clone(u.uniforms),fragmentShader:u.fragmentShader,vertexShader:u.vertexShader});S.uniforms.tDiffuse.value=T.texture,S.uniforms.color.value=o,S.uniforms.textureMatrix.value=w,this.material=S,this.onBeforeRender=function(e,t,r){if(d.setFromMatrixPosition(n.matrixWorld),f.setFromMatrixPosition(r.matrixWorld),m.extractRotation(n.matrixWorld),p.set(0,0,1),p.applyMatrix4(m),y.subVectors(d,f),!(y.dot(p)>0)){y.reflect(p).negate(),y.add(d),m.extractRotation(r.matrixWorld),v.set(0,0,-1),v.applyMatrix4(m),v.add(f),x.subVectors(d,v),x.reflect(p).negate(),x.add(d),_.position.copy(y),_.up.set(0,1,0),_.up.applyMatrix4(m),_.up.reflect(p),_.lookAt(x),_.far=r.far,_.updateMatrixWorld(),_.projectionMatrix.copy(r.projectionMatrix),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(_.projectionMatrix),w.multiply(_.matrixWorldInverse),w.multiply(n.matrixWorld),h.setFromNormalAndCoplanarPoint(p,d),h.applyMatrix4(_.matrixWorldInverse),g.set(h.normal.x,h.normal.y,h.normal.z,h.constant);var i=_.projectionMatrix;b.x=(Math.sign(g.x)+i.elements[8])/i.elements[0],b.y=(Math.sign(g.y)+i.elements[9])/i.elements[5],b.z=-1,b.w=(1+i.elements[10])/i.elements[14],g.multiplyScalar(2/g.dot(b)),i.elements[2]=g.x,i.elements[6]=g.y,i.elements[10]=g.z+1-c,i.elements[14]=g.w,n.visible=!1;var o=e.getRenderTarget(),a=e.xr.enabled,s=e.shadowMap.autoUpdate;e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(T),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,_),e.xr.enabled=a,e.shadowMap.autoUpdate=s,e.setRenderTarget(o);var u=r.viewport;void 0!==u&&e.state.viewport(u),n.visible=!0}},this.getRenderTarget=function(){return T}};i.prototype=Object.create(r.Mesh.prototype),i.prototype.constructor=i,i.ReflectorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:["uniform mat4 textureMatrix;","varying vec4 vUv;","void main() {","\tvUv = textureMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec4 vUv;","float blendOverlay( float base, float blend ) {","\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );","}","vec3 blendOverlay( vec3 base, vec3 blend ) {","\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );","}","void main() {","\tvec4 base = texture2DProj( tDiffuse, vUv );","\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );","}"].join("\n")};var o=function(e,t){r.Mesh.call(this,e),this.type="Refractor";var n=this,i=void 0!==(t=t||{}).color?new r.Color(t.color):new r.Color(8355711),a=t.textureWidth||512,s=t.textureHeight||512,c=t.clipBias||0,u=t.shader||o.RefractorShader,l=void 0!==t.encoding?t.encoding:r.LinearEncoding,h=new r.PerspectiveCamera;h.matrixAutoUpdate=!1,h.userData.refractor=!0;var p=new r.Plane,d=new r.Matrix4,f={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,stencilBuffer:!1,encoding:l},m=new r.WebGLRenderTarget(a,s,f);r.MathUtils.isPowerOfTwo(a)&&r.MathUtils.isPowerOfTwo(s)||(m.texture.generateMipmaps=!1),this.material=new r.ShaderMaterial({uniforms:r.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,transparent:!0}),this.material.uniforms.color.value=i,this.material.uniforms.tDiffuse.value=m.texture,this.material.uniforms.textureMatrix.value=d;var v,g,y,x,b,w,_,M,T=(v=new r.Vector3,g=new r.Vector3,y=new r.Matrix4,x=new r.Vector3,b=new r.Vector3,function(e){return v.setFromMatrixPosition(n.matrixWorld),g.setFromMatrixPosition(e.matrixWorld),x.subVectors(v,g),y.extractRotation(n.matrixWorld),b.set(0,0,1),b.applyMatrix4(y),x.dot(b)<0}),S=function(){var e=new r.Vector3,t=new r.Vector3,i=new r.Quaternion,o=new r.Vector3;return function(){n.matrixWorld.decompose(t,i,o),e.set(0,0,1).applyQuaternion(i).normalize(),e.negate(),p.setFromNormalAndCoplanarPoint(e,t)}}(),E=(w=new r.Plane,_=new r.Vector4,M=new r.Vector4,function(e){h.matrixWorld.copy(e.matrixWorld),h.matrixWorldInverse.getInverse(h.matrixWorld),h.projectionMatrix.copy(e.projectionMatrix),h.far=e.far,w.copy(p),w.applyMatrix4(h.matrixWorldInverse),_.set(w.normal.x,w.normal.y,w.normal.z,w.constant);var t=h.projectionMatrix;M.x=(Math.sign(_.x)+t.elements[8])/t.elements[0],M.y=(Math.sign(_.y)+t.elements[9])/t.elements[5],M.z=-1,M.w=(1+t.elements[10])/t.elements[14],_.multiplyScalar(2/_.dot(M)),t.elements[2]=_.x,t.elements[6]=_.y,t.elements[10]=_.z+1-c,t.elements[14]=_.w});this.onBeforeRender=function(e,t,r){!0!==r.userData.refractor&&1!=!T(r)&&(S(),function(e){d.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),d.multiply(e.projectionMatrix),d.multiply(e.matrixWorldInverse),d.multiply(n.matrixWorld)}(r),E(r),function(e,t,r){n.visible=!1;var i=e.getRenderTarget(),o=e.xr.enabled,a=e.shadowMap.autoUpdate;e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(m),!1===e.autoClear&&e.clear(),e.render(t,h),e.xr.enabled=o,e.shadowMap.autoUpdate=a,e.setRenderTarget(i);var s=r.viewport;void 0!==s&&e.state.viewport(s),n.visible=!0}(e,t,r))},this.getRenderTarget=function(){return m}};o.prototype=Object.create(r.Mesh.prototype),o.prototype.constructor=o,o.RefractorShader={uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:["uniform mat4 textureMatrix;","varying vec4 vUv;","void main() {","\tvUv = textureMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec4 vUv;","float blendOverlay( float base, float blend ) {","\treturn( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );","}","vec3 blendOverlay( vec3 base, vec3 blend ) {","\treturn vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );","}","void main() {","\tvec4 base = texture2DProj( tDiffuse, vUv );","\tgl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );","}"].join("\n")};var a=function(e,t){r.Mesh.call(this,e),this.type="Water";var n=this,s=void 0!==(t=t||{}).color?new r.Color(t.color):new r.Color(16777215),c=t.textureWidth||512,u=t.textureHeight||512,l=t.clipBias||0,h=t.flowDirection||new r.Vector2(1,0),p=t.flowSpeed||.03,d=t.reflectivity||.02,f=t.scale||1,m=t.shader||a.WaterShader,v=void 0!==t.encoding?t.encoding:r.LinearEncoding,g=new r.TextureLoader,y=t.flowMap||void 0,x=t.normalMap0||g.load("textures/water/Water_1_M_Normal.jpg"),b=t.normalMap1||g.load("textures/water/Water_2_M_Normal.jpg"),w=new r.Matrix4,_=new r.Clock;if(void 0!==i)if(void 0!==o){var M=new i(e,{textureWidth:c,textureHeight:u,clipBias:l,encoding:v}),T=new o(e,{textureWidth:c,textureHeight:u,clipBias:l,encoding:v});M.matrixAutoUpdate=!1,T.matrixAutoUpdate=!1,this.material=new r.ShaderMaterial({uniforms:r.UniformsUtils.merge([r.UniformsLib.fog,m.uniforms]),vertexShader:m.vertexShader,fragmentShader:m.fragmentShader,transparent:!0,fog:!0}),void 0!==y?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:y}):this.material.uniforms.flowDirection={type:"v2",value:h},x.wrapS=x.wrapT=r.RepeatWrapping,b.wrapS=b.wrapT=r.RepeatWrapping,this.material.uniforms.tReflectionMap.value=M.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=T.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=x,this.material.uniforms.tNormalMap1.value=b,this.material.uniforms.color.value=s,this.material.uniforms.reflectivity.value=d,this.material.uniforms.textureMatrix.value=w,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=.075,this.material.uniforms.config.value.z=.075,this.material.uniforms.config.value.w=f,this.onBeforeRender=function(e,t,r){var i,o;!function(e){w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(e.projectionMatrix),w.multiply(e.matrixWorldInverse),w.multiply(n.matrixWorld)}(r),i=_.getDelta(),(o=n.material.uniforms.config).value.x+=p*i,o.value.y=o.value.x+.075,o.value.x>=.15?(o.value.x=0,o.value.y=.075):o.value.y>=.15&&(o.value.y=o.value.y-.15),n.visible=!1,M.matrixWorld.copy(n.matrixWorld),T.matrixWorld.copy(n.matrixWorld),M.onBeforeRender(e,t,r),T.onBeforeRender(e,t,r),n.visible=!0}}else console.error("THREE.Water: Required component Refractor not found.");else console.error("THREE.Water: Required component Reflector not found.")};a.prototype=Object.create(r.Mesh.prototype),a.prototype.constructor=a,a.WaterShader={uniforms:{color:{type:"c",value:null},reflectivity:{type:"f",value:0},tReflectionMap:{type:"t",value:null},tRefractionMap:{type:"t",value:null},tNormalMap0:{type:"t",value:null},tNormalMap1:{type:"t",value:null},textureMatrix:{type:"m4",value:null},config:{type:"v4",value:new r.Vector4}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","uniform mat4 textureMatrix;","varying vec4 vCoord;","varying vec2 vUv;","varying vec3 vToEye;","void main() {","\tvUv = uv;","\tvCoord = textureMatrix * vec4( position, 1.0 );","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvToEye = cameraPosition - worldPosition.xyz;","\tvec4 mvPosition =  viewMatrix * worldPosition;","\tgl_Position = projectionMatrix * mvPosition;","\t#include <logdepthbuf_vertex>","\t#include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform sampler2D tReflectionMap;","uniform sampler2D tRefractionMap;","uniform sampler2D tNormalMap0;","uniform sampler2D tNormalMap1;","#ifdef USE_FLOWMAP","\tuniform sampler2D tFlowMap;","#else","\tuniform vec2 flowDirection;","#endif","uniform vec3 color;","uniform float reflectivity;","uniform vec4 config;","varying vec4 vCoord;","varying vec2 vUv;","varying vec3 vToEye;","void main() {","\t#include <logdepthbuf_fragment>","\tfloat flowMapOffset0 = config.x;","\tfloat flowMapOffset1 = config.y;","\tfloat halfCycle = config.z;","\tfloat scale = config.w;","\tvec3 toEye = normalize( vToEye );","\tvec2 flow;","\t#ifdef USE_FLOWMAP","\t\tflow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;","\t#else","\t\tflow = flowDirection;","\t#endif","\tflow.x *= - 1.0;","\tvec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );","\tvec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );","\tfloat flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;","\tvec4 normalColor = mix( normalColor0, normalColor1, flowLerp );","\tvec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b,  normalColor.g * 2.0 - 1.0 ) );","\tfloat theta = max( dot( toEye, normal ), 0.0 );","\tfloat reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );","\tvec3 coord = vCoord.xyz / vCoord.w;","\tvec2 uv = coord.xy + coord.z * normal.xz * 0.05;","\tvec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );","\tvec4 refractColor = texture2D( tRefractionMap, uv );","\tgl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );","\t#include <tonemapping_fragment>","\t#include <encodings_fragment>","\t#include <fog_fragment>","}"].join("\n")}},function(e,t,n){"use strict";n.r(t),n.d(t,"ConvexGeometry",(function(){return o})),n.d(t,"ConvexBufferGeometry",(function(){return a}));var r=n(0),i=function(){var e,t,n,i,o=new r.Vector3;function a(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new l,this.unassigned=new l,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 u(e){this.point=e,this.prev=null,this.next=null,this.face=null}function l(){this.head=null,this.tail=null}return Object.assign(a.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 u(e[t]));return this.compute(),this},setFromObject:function(e){var t=[];return e.updateMatrixWorld(!0),e.traverse((function(e){var n,i,o,a=e.geometry;if(void 0!==a)if(a.isGeometry){var s=a.vertices;for(n=0,i=s.length;n<i;n++)(o=s[n].clone()).applyMatrix4(e.matrixWorld),t.push(o)}else if(a.isBufferGeometry){var c=a.attributes.position;if(void 0!==c)for(n=0,i=c.count;n<i;n++)(o=new r.Vector3).fromBufferAttribute(c,n).applyMatrix4(e.matrixWorld),t.push(o)}})),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,o=0,a=n.length;o<a;o++){var s=n[o],c=s.distanceToPoint(e.origin),u=s.normal.dot(e.direction);if(c>0&&u>=0)return null;var l=0!==u?-c/u:0;if(!(l<=0)&&(u>0?i=Math.min(l,i):r=Math.max(l,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,o)},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,o=0;o<e.length;o++){var a=e[o];if(0===a.mark){var s=a.distanceToPoint(t.point);if(s>r&&(r=s,i=a),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,o=new r.Vector3,a=[],s=[];for(e=0;e<3;e++)a[e]=s[e]=this.vertices[0];for(i.copy(this.vertices[0].point),o.copy(this.vertices[0].point),e=0,t=this.vertices.length;e<t;e++){var c=this.vertices[e],u=c.point;for(n=0;n<3;n++)u.getComponent(n)<i.getComponent(n)&&(i.setComponent(n,u.getComponent(n)),a[n]=c);for(n=0;n<3;n++)u.getComponent(n)>o.getComponent(n)&&(o.setComponent(n,u.getComponent(n)),s[n]=c)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(i.x),Math.abs(o.x))+Math.max(Math.abs(i.y),Math.abs(o.y))+Math.max(Math.abs(i.z),Math.abs(o.z))),{min:a,max:s}},computeInitialHull:function(){void 0===e&&(e=new r.Line3,t=new r.Plane,n=new r.Vector3);var i,o,a,c,u,l,h,p,d,f=this.vertices,m=this.computeExtremes(),v=m.min,g=m.max,y=0,x=0;for(l=0;l<3;l++)(d=g[l].point.getComponent(l)-v[l].point.getComponent(l))>y&&(y=d,x=l);for(o=v[x],a=g[x],y=0,e.set(o.point,a.point),l=0,h=this.vertices.length;l<h;l++)(i=f[l])!==o&&i!==a&&(e.closestPointToPoint(i.point,!0,n),(d=n.distanceToSquared(i.point))>y&&(y=d,c=i));for(y=-1,t.setFromCoplanarPoints(o.point,a.point,c.point),l=0,h=this.vertices.length;l<h;l++)(i=f[l])!==o&&i!==a&&i!==c&&(d=Math.abs(t.distanceToPoint(i.point)))>y&&(y=d,u=i);var b=[];if(t.distanceToPoint(u.point)<0)for(b.push(s.create(o,a,c),s.create(u,a,o),s.create(u,c,a),s.create(u,o,c)),l=0;l<3;l++)p=(l+1)%3,b[l+1].getEdge(2).setTwin(b[0].getEdge(p)),b[l+1].getEdge(1).setTwin(b[p+1].getEdge(0));else for(b.push(s.create(o,c,a),s.create(u,o,a),s.create(u,a,c),s.create(u,c,o)),l=0;l<3;l++)p=(l+1)%3,b[l+1].getEdge(2).setTwin(b[0].getEdge((3-l)%3)),b[l+1].getEdge(0).setTwin(b[p+1].getEdge(1));for(l=0;l<4;l++)this.faces.push(b[l]);for(l=0,h=f.length;l<h;l++)if((i=f[l])!==o&&i!==a&&i!==c&&i!==u){y=this.tolerance;var w=null;for(p=0;p<4;p++)(d=this.faces[p].distanceToPoint(i.point))>y&&(y=d,w=this.faces[p]);null!==w&&this.addVertexToFace(i,w)}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 o=i.twin,a=o.face;0===a.mark&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,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 o=t[i],a=this.addAdjoiningFace(e,o);null===n?n=a:a.next.setTwin(r),this.newFaces.push(a.face),r=a}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),o=new c(t,r),a=new c(n,r);return i.next=a.prev=o,o.next=i.prev=a,a.next=o.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(l.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}}),a}(),o=function(e){r.Geometry.call(this),this.fromBufferGeometry(new a(e)),this.mergeVertices()};o.prototype=Object.create(r.Geometry.prototype),o.prototype.constructor=o;var a=function(e){r.BufferGeometry.call(this);var t=[],n=[];void 0===i&&console.error("THREE.ConvexBufferGeometry: ConvexBufferGeometry relies on ConvexHull");for(var o=(new i).setFromPoints(e).faces,a=0;a<o.length;a++){var s=o[a],c=s.edge;do{var u=c.head().point;t.push(u.x,u.y,u.z),n.push(s.normal.x,s.normal.y,s.normal.z),c=c.next}while(c!==s.edge)}this.setAttribute("position",new r.Float32BufferAttribute(t,3)),this.setAttribute("normal",new r.Float32BufferAttribute(n,3))};a.prototype=Object.create(r.BufferGeometry.prototype),a.prototype.constructor=a},function(e,t,n){"use strict";function r(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,o=i.length,a=new Array(o),s={endingStart:2400,endingEnd:2400},c=0;c!==o;++c){var u=i[c].createInterpolant(null);a[c]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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}n.r(t),n.d(t,"AnimationAction",(function(){return r})),Object.assign(r.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,o=i/r,a=r/i;e.warp(1,o,t),this.warp(a,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,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/a,c[1]=t/a,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 o=(e-i)*n;if(o<0||0===n)return;this._startTime=null,t=n*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case 2501:for(var l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].accumulateAdditive(s);break;case 2500:default:for(l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].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;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,o=2202===r;if(0===e)return-1===i?t:o&&1==(1&i)?n-t:t;if(2200===r){-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,o)):this._setEndings(0===this.repetitions,!0,o)),t>=n||t<0){var a=Math.floor(t/n);t-=n*a,i+=Math.abs(a);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,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=t;if(o&&1==(1&i))return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this}})}]))},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(38));t.Loaders=o.default;var a=r(n(39));t.Lights=a.default;var s=r(n(13));t.Factories=s.default;var c=r(n(40));t.CSG=c.default;var u=r(n(41));t.HeightMap=u.default;var l=r(n(42));t.WarpSpeed=l.default;var h=r(n(43));t.Mixers=h.default;var p=i(n(44));t.Misc=p.default,t.TextureCube=p.TextureCube;var d=r(n(46));t.Transform=d.default;var f=r(n(47));t.WebXR=f.default;var m=r(n(48));t.HaveSomeFun=m.default;var v=r(n(10));t.Cameras=v.default},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=n(4);t.ExtendedObject3D=r.ExtendedObject3D;var i=n(5);t.ExtendedMesh=i.ExtendedMesh;var o=n(0);t.AnimationMixer=o.AnimationMixer,t.AnimationClip=o.AnimationClip,t.AnimationAction=o.AnimationAction,t.Object3D=o.Object3D,t.Mesh=o.Mesh,t.Material=o.Material,t.Line=o.Line,t.Points=o.Points,t.Group=o.Group},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){console.error("%c [enable3d] "+e+" ","background: #222; color: #bada55")}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(e){function t(){var t=e.call(this)||this;return t.vector3=new o.Vector3,t.isGroup=!1,t.hasBody=!1,t.anims={},t._currentAnimation="",t._animationActions=new Map,t.name="object-"+t.id,t}return i(t,e),t.prototype.setAction=function(e){console.warn("[enable3d] setAction(name) is deprecated. Use animation.play(name) instead!"),this.animationPlay(e)},Object.defineProperty(t.prototype,"world",{get:function(){return{theta:this.worldTheta,phi:this.worldPhi}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"worldTheta",{get:function(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"worldPhi",{get:function(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animation",{get:function(){var e=this;return{current:this._currentAnimation,add:function(t,n){return e.animationAdd(t,n)},play:function(t,n,r){return void 0===n&&(n=500),void 0===r&&(r=!0),e.animationPlay(t,n,r)},mixer:this.animationMixer}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animationMixer",{get:function(){return this._animationMixer||(this._animationMixer=new o.AnimationMixer(this)),this._animationMixer},set:function(e){this._animationMixer=e},enumerable:!0,configurable:!0}),t.prototype.animationAdd=function(e,t){this._animationActions.set(e,this.animationMixer.clipAction(t))},t.prototype.animationPlay=function(e,t,n){void 0===t&&(t=500),void 0===n&&(n=!0);var r=this._animationActions.get(e),i=this._animationActions.get(this._currentAnimation);r&&(r.reset(),i&&(r.crossFadeFrom(i,t/1e3,!0),r.clampWhenFinished=!0),n||r.setLoop(o.LoopOnce,0),r.play()),this._currentAnimation=e},t}(o.Object3D);t.ExtendedObject3D=a,t.default=a},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.vector3=new o.Vector3,r.isGroup=!1,r.hasBody=!1,r.name="object-"+r.id,r}return i(t,e),Object.defineProperty(t.prototype,"world",{get:function(){return{theta:this.worldTheta,phi:this.worldPhi}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"worldTheta",{get:function(){return this.getWorldDirection(this.vector3),Math.atan2(this.vector3.x,this.vector3.z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"worldPhi",{get:function(){return this.getWorldDirection(this.vector3),Math.acos(this.vector3.y)},enumerable:!0,configurable:!0}),t}(o.Mesh);t.ExtendedMesh=a},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(8));t.PhysicsLoader=function(e,t){"undefined"!=typeof window&&(window.__loadPhysics=!0),i.default(e,(function(){Ammo().then((function(){t()}))}))}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){var t=e.call(this)||this;return t.isMesh=!1,t.hasBody=!1,t.name="object-"+t.id,t}return i(t,e),t}(n(0).Group);t.ExtendedGroup=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}return!1}(),i=function(e,t){var n=document.createElement("script");n.onload=function(){t()},n.onerror=function(){throw new Error("failed to load "+e)},n.async=!0,n.src=e,document.head.appendChild(n)};t.default=function(e,t){i(r?e+"/ammo.wasm.js":e+"/ammo.js",(function(){return t()}))}},function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=n(22);t.ThreeGraphics=i.ThreeGraphics;var o=n(6);t.PhysicsLoader=o.PhysicsLoader;var a=r(n(0));t.THREE=a;var s=r(n(2));t.Types=s;var c=n(0);t.WebGLRenderer=c.WebGLRenderer,t.Texture=c.Texture,t.RGBAFormat=c.RGBAFormat,t.GLTFLoader=c.GLTFLoader,t.FBXLoader=c.FBXLoader,t.Object3D=c.Object3D,t.Vector2=c.Vector2,t.Vector3=c.Vector3,t.MathUtils=c.MathUtils},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(){}return e.prototype.perspectiveCamera=function(t){return void 0===t&&(t={}),e.Perspective(t)},e.prototype.orthographicCamera=function(t){return void 0===t&&(t={}),e.Orthographic(t)},e.Perspective=function(e){void 0===e&&(e={});var t=e.fov,n=void 0===t?50:t,i=e.aspect,o=void 0===i?window.innerWidth/window.innerHeight:i,a=e.near,s=void 0===a?.1:a,c=e.far,u=void 0===c?2e3:c,l=e.x,h=void 0===l?0:l,p=e.y,d=void 0===p?0:p,f=e.z,m=void 0===f?0:f,v=new r.PerspectiveCamera(n,o,s,u);return v.position.set(h,d,m),v},e.Orthographic=function(e){void 0===e&&(e={});var t=window.innerWidth,n=window.innerHeight,i=e.left,o=void 0===i?t/-100:i,a=e.right,s=void 0===a?t/100:a,c=e.top,u=void 0===c?n/100:c,l=e.bottom,h=void 0===l?n/-100:l,p=e.near,d=void 0===p?1:p,f=e.far,m=void 0===f?1e3:f,v=e.x,g=void 0===v?0:v,y=e.y,x=void 0===y?0:y,b=e.z,w=void 0===b?0:b,_=new r.OrthographicCamera(o,s,u,h,d,m);return _.position.set(g,x,w),_},e}();t.default=i},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,o),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},u.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,a),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,r);break;default:if(!c)for(p=1,c=new Array(h-1);p<h;p++)c[p-1]=arguments[p];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return c(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||c(this,o);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==t||r&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[o]=1===u.length?u[0]:u:c(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&c(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,o),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},u.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,a),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,r);break;default:if(!c)for(p=1,c=new Array(h-1);p<h;p++)c[p-1]=arguments[p];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return c(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||r&&!a.once||n&&a.context!==n||c(this,o);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==t||r&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[o]=1===u.length?u[0]:u:c(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&c(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),s=n(5),c=o(n(3)),u=o(n(14)),l=function(){function e(e){this.scene=e,this.isHeadless="headless"===e,this.defaultMaterial=new u.default}return Object.defineProperty(e.prototype,"make",{get:function(){var e=this;return{plane:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makePlane(t,n)},box:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makeBox(t,n)},sphere:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makeSphere(t,n)},cylinder:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makeCylinder(t,n)},cone:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makeCone(t,n)},torus:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.makeTorus(t,n)},extrude:function(t,n){return void 0===n&&(n={}),e.makeExtrude(t,n)}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"add",{get:function(){var e=this;return{mesh:function(t){return e.addMesh(t)},existing:function(t){return e.addExisting(t)},plane:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addPlane(t,n)},box:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addBox(t,n)},ground:function(t,n){return void 0===n&&(n={}),e.addGround(t,n)},sphere:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addSphere(t,n)},cylinder:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addCylinder(t,n)},cone:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addCone(t,n)},torus:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.addTorus(t,n)},extrude:function(t,n){return void 0===n&&(n={}),e.addExtrude(t,n)},material:function(t){return void 0===t&&(t={}),e.addMaterial(t)}}},enumerable:!0,configurable:!0}),e.prototype.addExisting=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];"headless"!==this.scene&&(e=this.scene).add.apply(e,t)},e.prototype.addMesh=function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.addExisting(e[t]);else this.addExisting(e);return this},e.prototype.createMesh=function(e,t,n){var r,i=n.x,o=void 0===i?0:i,c=n.y,u=void 0===c?0:c,l=n.z,h=void 0===l?0:l;switch(!Array.isArray(t)&&t.type){case"LineBasicMaterial":r=new a.Line(e,t);break;case"PointsMaterial":r=new a.Points(e,t);break;default:r=new s.ExtendedMesh(e,t)}return r.position.set(o,u,h),r.castShadow=r.receiveShadow=!0,r},e.prototype.makeExtrude=function(e,t){var n=e.x,o=e.y,s=e.z,c=e.name,u=e.shape,l=e.autoCenter,h=void 0===l||l,p=e.breakable,d=void 0!==p&&p,f=e.bufferGeometry,m=void 0===f||f,v=i(e,["x","y","z","name","shape","autoCenter","breakable","bufferGeometry"]),g=v.depth,y=void 0===g?1:g,x=v.bevelEnabled,b=void 0!==x&&x,w=m||d||this.isHeadless?new a.ExtrudeBufferGeometry(u,r({depth:y,bevelEnabled:b},v)):new a.ExtrudeGeometry(u,r({depth:y,bevelEnabled:b},v)),_=this.addMaterial(t),M=this.createMesh(w,_,{x:n,y:o,z:s});return h&&M.geometry.center(),M.name=c||"body_id_"+M.id,M.shape="extrude",M},e.prototype.addExtrude=function(e,t){void 0===t&&(t={});var n=this.makeExtrude(e,t);return this.addExisting(n),n},e.prototype.makePlane=function(e,t){var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=h||u||this.isHeadless?new a.PlaneBufferGeometry(p.width||1,p.height||1,p.widthSegments||1,p.heightSegments||1):new a.PlaneGeometry(p.width||1,p.height||1,p.widthSegments||1,p.heightSegments||1),f=this.addMaterial(t);f.side=a.DoubleSide;var m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="plane",m},e.prototype.addPlane=function(e,t){var n=this.makePlane(e,t);return this.addExisting(n),n},e.prototype.makeSphere=function(e,t){var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=h||u||this.isHeadless?new a.SphereBufferGeometry(p.radius||1,p.widthSegments||16,p.heightSegments||12,p.phiStart||void 0,p.phiLength||void 0,p.thetaStart||void 0,p.thetaLength||void 0):new a.SphereGeometry(p.radius||1,p.widthSegments||16,p.heightSegments||12,p.phiStart||void 0,p.phiLength||void 0,p.thetaStart||void 0,p.thetaLength||void 0),f=this.addMaterial(t),m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="sphere",m},e.prototype.addSphere=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.makeSphere(e,t);return this.addExisting(n),n},e.prototype.makeBox=function(e,t){var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=h||u||this.isHeadless?new a.BoxBufferGeometry(p.width||1,p.height||1,p.depth||1,p.widthSegments||void 0,p.heightSegments||void 0,p.depthSegments||void 0):new a.BoxGeometry(p.width||1,p.height||1,p.depth||1,p.widthSegments||void 0,p.heightSegments||void 0,p.depthSegments||void 0),f=this.addMaterial(t),m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="box",m},e.prototype.addBox=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.makeBox(e,t);return this.addExisting(n),n},e.prototype.addGround=function(e,t){void 0===t&&(t={});var n=this.makeBox(e,t);return n.rotateX(a.MathUtils.degToRad(90)),this.addExisting(n),n},e.prototype.makeCylinder=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=h||u||this.isHeadless?new a.CylinderBufferGeometry(p.radiusTop||1,p.radiusBottom||1,p.height||1,p.radiusSegments||void 0,p.heightSegments||void 0,p.openEnded||void 0,p.thetaStart||void 0,p.thetaLength||void 0):new a.CylinderGeometry(p.radiusTop||1,p.radiusBottom||1,p.height||1,p.radiusSegments||void 0,p.heightSegments||void 0,p.openEnded||void 0,p.thetaStart||void 0,p.thetaLength||void 0),f=this.addMaterial(t),m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="cylinder",m},e.prototype.addCylinder=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.makeCylinder(e,t);return this.addExisting(n),n},e.prototype.makeCone=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=(h||u||this.isHeadless,new a.ConeBufferGeometry(p.radius||1,p.height||1,p.radiusSegments||8,p.heightSegments||1,p.openEnded||!1,p.thetaStart||0,p.thetaLength||2*Math.PI)),f=this.addMaterial(t),m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="cone",m},e.prototype.addCone=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.makeCone(e,t);return this.addExisting(n),n},e.prototype.makeTorus=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.x,r=e.y,o=e.z,s=e.name,c=e.breakable,u=void 0!==c&&c,l=e.bufferGeometry,h=void 0===l||l,p=i(e,["x","y","z","name","breakable","bufferGeometry"]),d=h||u||this.isHeadless?new a.TorusBufferGeometry(p.radius||void 0,p.tube||void 0,p.radialSegments||void 0,p.tubularSegments||void 0,p.arc||void 0):new a.TorusGeometry(p.radius||void 0,p.tube||void 0,p.radialSegments||void 0,p.tubularSegments||void 0,p.arc||void 0),f=this.addMaterial(t),m=this.createMesh(d,f,{x:n,y:r,z:o});return m.name=s||"body_id_"+m.id,m.shape="torus",m},e.prototype.addTorus=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.makeTorus(e,t);return this.addExisting(n),n},e.prototype.addMaterial=function(e){void 0===e&&(e={});var t,n=Object.keys(e)[0];if("headless"===this.scene)return this.defaultMaterial.get();switch(n){case"basic":t=new a.MeshBasicMaterial(e.basic);break;case"normal":t=new a.MeshNormalMaterial(e.normal);break;case"standard":t=new a.MeshStandardMaterial(e.standard);break;case"lambert":t=new a.MeshLambertMaterial(e.lambert);break;case"phong":t=new a.MeshPhongMaterial(e.phong);break;case"physical":void 0!==e.physical?t=new a.MeshPhysicalMaterial(e.physical):(c.default("You need to pass parameters to the physical material. (Fallback to default material)"),t=this.defaultMaterial.get());break;case"toon":t=new a.MeshToonMaterial(e.toon);break;case"line":t=new a.LineBasicMaterial(e.line);break;case"points":t=new a.PointsMaterial(e.points);break;case"custom":t=e.custom||this.defaultMaterial.get();break;default:t=this.defaultMaterial.get()}return t},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(){this._defaultMaterial=new r.MeshLambertMaterial({color:13421772})}return e.prototype.get=function(){return this._defaultMaterial},e}();t.default=i},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);t.default=function(e){void 0===e&&(e={});var t=e.antialias,n=void 0!==t&&t,o=e.parent,a=void 0===o?void 0:o,s=e.canvasId,c=void 0===s?"myCustomCanvas":s,u=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");u.id=c;var l=a?document.getElementById(a):document.body;l?l.appendChild(u):console.error('[enable3d] parent "'+a+'" not found!');var h={antialias:n},p=r({alpha:!1,depth:!1,antialias:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!1,failIfMajorPerformanceCaveat:!1,powerPreference:"default"},{alpha:void 0!==h.alpha&&h.alpha,depth:void 0===h.depth||h.depth,stencil:void 0===h.stencil||h.stencil,antialias:void 0!==h.antialias&&h.antialias,premultipliedAlpha:void 0===h.premultipliedAlpha||h.premultipliedAlpha,preserveDrawingBuffer:void 0!==h.preserveDrawingBuffer&&h.preserveDrawingBuffer,powerPreference:void 0!==h.powerPreference?h.powerPreference:"default",failIfMajorPerformanceCaveat:void 0!==h.failIfMajorPerformanceCaveat&&h.failIfMajorPerformanceCaveat,xrCompatible:!0}),d=i.WEBGL.isWebGL2Available()?"webgl2":"webgl",f=u.getContext(d,p);return{canvas:u,context:f}}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.id=-1,t}return i(t,e),Object.defineProperty(t.prototype,"add",{get:function(){var e=this;return{axis:function(t){return void 0===t&&(t={}),e.addAxis(t)},button:function(t){return void 0===t&&(t={}),e.addButton(t)}}},enumerable:!0,configurable:!0}),t.prototype.addAxis=function(e){var t=this;void 0===e&&(e={}),this.id++;var n=e.styles,r=void 0===n?{left:35,bottom:35,size:100}:n,i=this.circle({styles:r}),o=this.thumb({styles:r});i.appendChild(o),document.body.appendChild(i);var a=e.maxRadius,s=void 0===a?40:a,c=e.rotationDamping,u=void 0===c?.06:c,l=e.moveDamping,h=void 0===l?.01:l,p={id:this.id,domElement:o,maxRadius:s,maxRadiusSquared:s*s,origin:{left:o.offsetLeft,top:o.offsetTop},offset:{x:0,y:0},rotationDamping:u,moveDamping:h};if(null==p?void 0:p.domElement){var d=p.domElement;"ontouchstart"in window?d.addEventListener("touchstart",(function(e){e.preventDefault(),t.tap(e,p),e.stopPropagation()})):d.addEventListener("mousedown",(function(e){e.preventDefault(),t.tap(e,p),e.stopPropagation()}))}return{onMove:function(e){t.on("axis_onmove_"+p.id,(function(t){e(t)}))}}},t.prototype.addButton=function(e){var t=this;void 0===e&&(e={}),this.id++;var n=e.styles,r=void 0===n?{right:35,bottom:35,size:80}:n,i=e.letter,o=void 0===i?"A":i,a=this.circle({styles:r}),s=this.letter({letter:o});a.appendChild(s),document.body.appendChild(a);var c={id:this.id,domElement:a,offset:{x:0,y:0}};return(null==c?void 0:c.domElement)&&this.click(c),{onClick:function(e){t.on("button_onclick_"+c.id,(function(t){e(t)}))},onRelease:function(e){t.on("button_onrelease_"+c.id,(function(t){e(t)}))}}},t.prototype.circle=function(e){void 0===e&&(e={});var t=e.styles,n=t.top,r=t.right,i=t.bottom,o=t.left,a=t.size,s=document.createElement("div"),c="position:absolute; width:"+a+"px; height:"+a+"px; background:rgba(126, 126, 126, 0.5); border:#444 solid medium; border-radius:50%; cursor: pointer; ";return n&&(c+="top:"+n+"px; "),r&&(c+="right:"+r+"px; "),i&&(c+="bottom:"+i+"px; "),o&&(c+="left:"+o+"px; "),s.style.cssText=c,s},t.prototype.thumb=function(e){void 0===e&&(e={});var t=e.styles.size,n=document.createElement("div");return n.style.cssText="position: absolute; left: "+t/4+"px; top: "+t/4+"px; width: "+t/2+"px; height: "+t/2+"px; border-radius: 50%; background: #fff; ",n},t.prototype.letter=function(e){void 0===e&&(e={});var t=e.letter,n=document.createElement("span");return n.innerText=t,n.style.cssText="position: absolute; text-align: center; top: 4px; width: 80px; height: 80px; font-size: 64px; color: #fff; ",n},t.prototype.click=function(e){var t=this,n=e.id,r=e.domElement;"ontouchstart"in window?(r.addEventListener("touchstart",(function(e){e.preventDefault(),t.emit("button_onclick_"+n)})),r.addEventListener("touchend",(function(e){e.preventDefault(),t.emit("button_onrelease_"+n)}))):(r.addEventListener("mousedown",(function(e){e.preventDefault(),t.emit("button_onclick_"+n),e.stopPropagation()})),r.addEventListener("mouseup",(function(e){e.preventDefault(),t.emit("button_onrelease_"+n),e.stopPropagation()})))},t.prototype.tap=function(e,t){var n=this;e=e||window.event,t.offset=this.getMousePosition(e),"ontouchstart"in window?(document.ontouchmove=function(e){e.target===t.domElement&&n.move(e,t)},document.ontouchend=function(e){e.target===t.domElement&&n.up(t)}):(document.onmousemove=function(e){e.target===t.domElement&&n.move(e,t)},document.onmouseup=function(e){n.up(t)})},t.prototype.move=function(e,t){var n=t.domElement,r=t.maxRadius,i=t.maxRadiusSquared,o=t.origin,a=t.offset,s=t.id;e=e||window.event;var c=this.getMousePosition(e),u=c.x-a.x,l=c.y-a.y,h=u*u+l*l;if(h>i){var p=Math.sqrt(h);u/=p,l/=p,u*=r,l*=r}n.style.top=l+n.clientHeight/2+"px",n.style.left=u+n.clientWidth/2+"px";var d=-(l-o.top+n.clientHeight/2)/r,f=(u-o.left+n.clientWidth/2)/r;this.emit("axis_onmove_"+s,{top:d,right:f})},t.prototype.up=function(e){var t=e.domElement,n=e.origin,r=e.id;"ontouchstart"in window?(document.ontouchmove=null,document.touchend=null):(document.onmousemove=null,document.onmouseup=null),t.style.top=n.top+"px",t.style.left=n.left+"px",this.emit("axis_onmove_"+r,{top:0,right:0})},t.prototype.getMousePosition=function(e){return{x:e.targetTouches?e.targetTouches[0].pageX:e.clientX,y:e.targetTouches?e.targetTouches[0].pageY:e.clientY}},t}(o(n(11)).default);t.JoyStick=a},function(e,t,n){"use strict";
  /**
   * @description  This code has originally been copied from Sketchbook
   *
   * @author       swift502 <blaha.j502@gmail.com> (http://jblaha.art/)
   * @copyright    Copyright (c) 2018 swift502; Project Url: https://github.com/swift502/Sketchbook
   * @license      {@link https://github.com/swift502/Sketchbook/blob/master/LICENSE|GPL-3.0}
   *
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e,t,n){this.camera=e,this.target=t,this.config=n;var i=n.offset,o=void 0===i?new r.Vector3(0,0,0):i,a=n.sensitivity,s=void 0===a?new r.Vector2(1,1):a,c=n.radius,u=void 0===c?8:c,l=n.targetRadius,h=void 0===l?10:l,p=n.interpolationFactor,d=void 0===p?.05:p,f=(n.pointerLock,n.autoUpdate,n.theta),m=void 0===f?0:f,v=n.phi,g=void 0===v?0:v;this.offset=o,this.sensitivity=s,this.radius=u,this.targetRadius=h,this.interpolationFactor=d,this.theta=m,this.phi=g}return e.prototype.update=function(e,t){var n=this.target.position.clone().add(this.offset);this.theta-=e*(this.sensitivity.x/2),this.theta%=360,this.phi+=t*(this.sensitivity.y/2),this.phi=Math.min(85,Math.max(-85,this.phi)),this.radius=r.MathUtils.lerp(this.radius,this.targetRadius,this.interpolationFactor),this.camera.position.x=n.x+this.radius*Math.sin(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.position.y=n.y+this.radius*Math.sin(this.phi*Math.PI/180),this.camera.position.z=n.z+this.radius*Math.cos(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.updateMatrix(),this.camera.lookAt(n)},e}();t.ThirdPersonControls=i},function(e,t,n){"use strict";
  /**
   * @description  This code has originally been copied from Sketchbook
   *
   * @author       swift502 <blaha.j502@gmail.com> (http://jblaha.art/)
   * @copyright    Copyright (c) 2018 swift502; Project Url: https://github.com/swift502/Sketchbook
   * @license      {@link https://github.com/swift502/Sketchbook/blob/master/LICENSE|GPL-3.0}
   *
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e,t,n){this.camera=e,this.target=t,this.config=n;var i=n.offset,o=void 0===i?new r.Vector3(0,0,0):i,a=n.sensitivity,s=void 0===a?new r.Vector2(1,1):a,c=n.radius,u=void 0===c?8:c,l=n.targetRadius,h=void 0===l?10:l,p=n.interpolationFactor,d=void 0===p?.05:p;n.pointerLock,n.autoUpdate;this.offset=o,this.sensitivity=s,this.radius=u,this.targetRadius=h,this.interpolationFactor=d,this.theta=0,this.phi=0}return e.prototype.update=function(e,t){var n=this.target.position.clone().add(this.offset);this.camera.position.copy(n),this.theta-=e*(this.sensitivity.x/2),this.theta%=360,this.phi+=t*(-this.sensitivity.y/2),this.phi=Math.min(85,Math.max(-85,this.phi));var i=new r.Vector3;i.x=n.x+this.radius*Math.sin(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),i.y=n.y+this.radius*Math.sin(this.phi*Math.PI/180),i.z=n.z+this.radius*Math.cos(this.theta*Math.PI/180)*Math.cos(this.phi*Math.PI/180),this.camera.updateMatrix(),this.camera.lookAt(i)},e}();t.FirstPersonControls=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){void 0===t&&(t=!0),this._element=e,this._isRunning=!1,t&&this.request()}return e.prototype.isLocked=function(){return!!document.pointerLockElement},e.prototype.exit=function(){this._isRunning=!1,document.exitPointerLock(),this.removeListeners()},e.prototype.removeListeners=function(){var e=this;document.removeEventListener("pointerlockchange",(function(){return e.pointerLockChangeHandler()})),this._element.removeEventListener("pointerdown",(function(){return e.pointerDownHandlerHandler()}))},e.prototype.pointerLockChangeHandler=function(){this._isRunning&&this._request()},e.prototype.pointerDownHandlerHandler=function(){this._isRunning&&this._element.requestPointerLock()},e.prototype.request=function(){this._isRunning=!0,this._request()},e.prototype._request=function(){var e=this;document.addEventListener("pointerlockchange",(function(){return e.pointerLockChangeHandler()}),{once:!0}),document.pointerLockElement||this._element.addEventListener("pointerdown",(function(){return e.pointerDownHandlerHandler()}),{once:!0})},e}();t.PointerLock=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){void 0===t&&(t=!0),this._element=e,this._isRunning=!1,this._position={x:0,y:0},this._delta={x:0,y:0},this._onMoveCallback=function(){},this._isPointerDown=!1,t&&this.start()}return Object.defineProperty(e.prototype,"isTouchDevice",{get:function(){return"ontouchstart"in window},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPointerDown",{get:function(){return this._isPointerDown},enumerable:!0,configurable:!0}),e.prototype.start=function(){var e=this;this._isRunning||(this._isRunning=!0,this.isTouchDevice?(this._element.addEventListener("touchstart",(function(t){return e.onTouchStart(t)})),this._element.addEventListener("touchend",(function(t){return e.onTouchEnd(t)})),this._element.addEventListener("touchmove",(function(t){return e.onTouchMove(t)}))):(this._element.addEventListener("pointerdown",(function(t){return e.onPointerDown(t)})),this._element.addEventListener("pointerup",(function(t){return e.onPointerUp(t)})),this._element.addEventListener("pointerleave",(function(t){return e.onPointerLeave(t)})),this._element.addEventListener("pointerover",(function(t){return e.onPointerOver(t)})),this._element.addEventListener("pointermove",(function(t){return e.onPointerMove(t)}))))},e.prototype.stop=function(){var e=this;this.isTouchDevice?(this._element.removeEventListener("touchstart",(function(t){return e.onTouchStart(t)})),this._element.removeEventListener("touchend",(function(t){return e.onTouchEnd(t)})),this._element.removeEventListener("touchmove",(function(t){return e.onTouchMove(t)}))):(this._element.removeEventListener("pointerdown",(function(t){return e.onPointerDown(t)})),this._element.removeEventListener("pointerleave",(function(t){return e.onPointerLeave(t)})),this._element.removeEventListener("pointerup",(function(t){return e.onPointerUp(t)})),this._element.removeEventListener("pointerover",(function(t){return e.onPointerOver(t)})),this._element.removeEventListener("pointermove",(function(t){return e.onPointerMove(t)}))),this._isRunning=!1},e.prototype.removeListeners=function(){this.stop()},e.prototype.onMove=function(e){this._onMoveCallback=e},e.prototype.onPointerDown=function(e){this._isPointerDown=!0},e.prototype.onPointerUp=function(e){this._isPointerDown=!1},e.prototype.onPointerLeave=function(e){this._isPointerDown=!1},e.prototype.onPointerMove=function(e){var t=e.movementX,n=e.movementY;this._delta={x:t,y:n},this._onMoveCallback(this._delta)},e.prototype.onPointerOver=function(e){},e.prototype.onTouchStart=function(e){var t=e.touches[0].clientX,n=e.touches[0].clientY;this._position={x:t,y:n}},e.prototype.onTouchEnd=function(e){this._position={x:0,y:0},this._delta={x:0,y:0},this._onMoveCallback(this._delta)},e.prototype.onTouchMove=function(e){var t=e.touches[0].clientX,n=e.touches[0].clientY;this._delta={x:t-this._position.x,y:n-this._position.y},this._onMoveCallback(this._delta),this._position={x:t,y:n}},e}();t.PointerDrag=r},function(t,n){t.exports=e},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),a=i(n(10)),s=n(23),c=function(e){void 0===e&&(e={}),this.threeGraphicsConfig=e;var t=e.anisotropy,n=void 0===t?1:t,r=e.camera,i=void 0===r?a.default.Perspective({z:25,y:5}):r,c=e.antialias,u=void 0!==c&&c,l=e.usePhysics,h=void 0===l||l,p=e.renderer;this.textureAnisotropy=n,this.camera=i,this.scene=new o.Scene,this.renderer=p||new o.WebGLRenderer({antialias:u}),this.renderer.outputEncoding=o.GammaEncoding,this.renderer.gammaFactor=1,this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=o.PCFSoftShadowMap,this.composer=null,this.cache=o.Cache,this.cache.enabled=!0,h&&("undefined"!=typeof Ammo?this.physics=new s.AmmoPhysics(this.scene,e):console.log("[enable3d]: Are you sure you included ammo.js?"))};t.ThreeGraphics=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},c=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var u=s(n(3)),l=s(n(25)),h=n(4);t.ExtendedObject3D=h.ExtendedObject3D;var p=n(5);t.ExtendedMesh=p.ExtendedMesh;var d=n(7);t.ExtendedGroup=d.ExtendedGroup;var f=s(n(26)),m=s(n(27)),v=s(n(12)),g=n(0),y=n(28),x=n(29),b=s(n(13)),w=n(30),_=n(0),M=s(n(31)),T=n(32),S=n(6);t.PhysicsLoader=S.PhysicsLoader;var E=s(n(14)),A=c(n(2));t.Types=A;var L=n(33);t.ClosestRaycaster=L.ClosestRaycaster,t.AllHitsRaycaster=L.AllHitsRaycaster;var P=n(37);t.Clock=P.Clock;var R=function(e){function t(t,n){void 0===n&&(n={});var r=e.call(this)||this;if(r.scene=t,r.config=n,r.rigidBodies=[],r.objectsAmmo={},r.earlierDetectedCollisions=[],r.gravity=n.gravity||{x:0,y:-9.81,z:0},r.isHeadless="headless"===t,r.tmpEuler=new g.Euler,r.tmpQuaternion=new g.Quaternion,r.tmpVector3=new g.Vector3,r.tmpBtVector3=new Ammo.btVector3,r.tmpBtQuaternion=new Ammo.btQuaternion(0,0,0,1),r.emptyV3=new g.Vector3,r.impactPoint=new g.Vector3,r.impactNormal=new g.Vector3,"headless"!==t){r.defaultMaterial=new E.default;var i="three.js version "+_.REVISION;console.log("%c %c %c %c %c "+i+" %c https://threejs.org/","background: #ff0000","background: #ffff00","background: #00ff00","background: #00ffff","color: #fff; background: #000000;","background: none")}return r.start(),r}return i(t,e),t.prototype.destroy=function(e){var t,n=Object.keys(e).includes("body")?e.body:e;if(void 0!==(null==n?void 0:n.ammo)){var r=Object.values(n.ammo)[0],i=Object.values(n.ammo)[1],o=this.objectsAmmo[r];if(r&&i&&o&&(null===(t=null==o?void 0:o.body)||void 0===t?void 0:t.ammo)){this.physicsWorld.removeRigidBody(o.body.ammo),o.body.destructor(),o.body=void 0,o.hasBody=!1,delete this.objectsAmmo[r];for(var a=0;a<this.rigidBodies.length;a++)this.rigidBodies[a].name===i&&(this.rigidBodies.splice(a,1),a--)}"headless"===this.scene&&o&&(o=null)}},t.prototype.setup=function(){var e=this;if(this.setupPhysicsWorld(),"headless"!==this.scene){this.convexBreaker=new T.ConvexObjectBreaker,this.objectsToRemove=[],this.numObjectsToRemove=0;for(var t=0;t<500;t++)this.objectsToRemove[t]=null}this.collisionEvents=new w.CollisionEvents,this.factory=new b.default(this.scene),this.shapes=new f.default(this.factory,(function(t,n){return e.addExisting(t,n)})),this.constraints=new m.default(this.tmpTrans,this.physicsWorld),"headless"!==this.scene&&(this.debugDrawer=new M.default(this.scene,this.physicsWorld,{}))},t.prototype.updateDebugger=function(){"headless"!==this.scene&&this.debugDrawer&&this.debugDrawer.enabled&&this.debugDrawer.update()},t.prototype.setupPhysicsWorld=function(){var e=this.gravity,t=new Ammo.btDefaultCollisionConfiguration,n=new Ammo.btCollisionDispatcher(t),r=new Ammo.btDbvtBroadphase,i=new Ammo.btSequentialImpulseConstraintSolver;this.physicsWorld=new Ammo.btDiscreteDynamicsWorld(n,r,i,t),this.physicsWorld.setGravity(new Ammo.btVector3(e.x,e.y,e.z)),this.dispatcher=n,this.tmpTrans=new Ammo.btTransform},t.prototype.createDebrisFromBreakableObject=function(e,t){"headless"!==this.scene&&(e.material=this.defaultMaterial.get(),e.shape="hull",e.fragmentDepth=t.fragmentDepth+1,this.scene.add(e),this.addExisting(e),e.body.breakable=!1,setTimeout((function(){e.body.breakable=!0}),2500))},t.prototype.removeDebris=function(e){"headless"!==this.scene&&(this.scene.remove(e),this.physicsWorld.removeRigidBody(e.body.ammo),delete this.objectsAmmo[e.ptr])},t.prototype.update=function(e){var t,n,r=this;this.impactPoint.set(0,0,0),this.impactNormal.set(0,0,0);var i=[],o=e/1e3;this.physicsWorld.stepSimulation(o,this.config.maxSubSteps||4,this.config.fixedTimeStep||1/60);for(var s=0,c=this.rigidBodies.length;s<c;s++){var u=this.rigidBodies[s],l=u.body.ammo.getMotionState();if(l)if(l.getWorldTransform(this.tmpTrans),u.body.didUpdate&&(u.body._emitUpdateEvents&&u.body.eventEmitter.emit("update"),u.body.didUpdate=!1),u.body.ammo.isKinematicObject()&&u.body.needUpdate)u.getWorldQuaternion(this.tmpQuaternion),u.getWorldPosition(this.tmpVector3),this.tmpBtVector3.setValue(this.tmpVector3.x,this.tmpVector3.y,this.tmpVector3.z),this.tmpBtQuaternion.setValue(this.tmpQuaternion.x,this.tmpQuaternion.y,this.tmpQuaternion.z,this.tmpQuaternion.w),this.tmpTrans.setOrigin(this.tmpBtVector3),this.tmpTrans.setRotation(this.tmpBtQuaternion),l.setWorldTransform(this.tmpTrans),u.body.needUpdate=!1;else{var h=this.tmpTrans.getOrigin(),p=this.tmpTrans.getRotation(),d=u.body.offset;u.position.set(h.x()+d.x,h.y()+d.y,h.z()+d.z),u.quaternion.set(p.x(),p.y(),p.z(),p.w())}}for(s=0,c=this.dispatcher.getNumManifolds();s<c;s++){var f=this.dispatcher.getManifoldByIndexInternal(s),m=Object.keys(f.getBody0())[0],v=Ammo.castObject(f.getBody0(),Ammo.btRigidBody),g=Ammo.castObject(f.getBody1(),Ammo.btRigidBody);if(""!==v.name||""!==g.name){var y=v[m],x=g[m],b=this.objectsAmmo[y],w=this.objectsAmmo[x];if(b&&w){var _=b.body.breakable,M=w.body.breakable,T=null===(t=b.body)||void 0===t?void 0:t.checkCollisions,S=null===(n=w.body)||void 0===n?void 0:n.checkCollisions;if(T||S||_||M){for(var E=!1,A=0,L="start",P=function(e,t){var n=f.getContactPoint(e);if(n.getDistance()<=0){E=!0;var r=n.getAppliedImpulse(),o=n.get_m_positionWorldOnB(),a=n.get_m_normalWorldOnB();if(T||S){var s=[b.name,w.name].sort(),c=s[0]+"__"+s[1];R.earlierDetectedCollisions.find((function(e){return e.combinedName===c}))&&(L="collision"),i.find((function(e){return e.combinedName===c}))||(i.push({combinedName:c,collision:!0}),R.collisionEvents.emit("collision",{bodies:[b,w],event:L}))}return r>=A&&(A=r,(_||M)&&(R.impactPoint.set(o.x(),o.y(),o.z()),R.impactNormal.set(a.x(),a.y(),a.z()))),"break"}},R=this,C=0,O=f.getNumContacts();C<O;C++){if("break"===P(C))break}if(E&&(_||M)){if(this.emptyV3.set(0,0,0),b.userData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:_,physicsBody:v},w.userData={mass:1,velocity:this.emptyV3,angularVelocity:this.emptyV3,breakable:M,physicsBody:g},void 0===b.fragmentDepth&&(b.fragmentDepth=0),void 0===w.fragmentDepth&&(w.fragmentDepth=0),_&&A>5&&b.fragmentDepth<2){var D=(B=this.convexBreaker.subdivideByImpact(b,this.impactPoint,this.impactNormal,1,2)).length;for(C=0;C<D;C++){var I=v.getLinearVelocity(),N=v.getAngularVelocity();(F=B[C]).userData.velocity.set(I.x(),I.y(),I.z()),F.userData.angularVelocity.set(N.x(),N.y(),N.z()),this.createDebrisFromBreakableObject(F,b)}this.objectsToRemove[this.numObjectsToRemove++]=b}if(M&&A>5&&w.fragmentDepth<2){var B;for(D=(B=this.convexBreaker.subdivideByImpact(w,this.impactPoint,this.impactNormal,1,2)).length,C=0;C<D;C++){var F;I=g.getLinearVelocity(),N=g.getAngularVelocity();(F=B[C]).userData.velocity.set(I.x(),I.y(),I.z()),F.userData.angularVelocity.set(N.x(),N.y(),N.z()),this.createDebrisFromBreakableObject(F,w)}this.objectsToRemove[this.numObjectsToRemove++]=w}}}}}}for(s=0;s<this.numObjectsToRemove;s++)this.removeDebris(this.objectsToRemove[s]);this.numObjectsToRemove=0,this.earlierDetectedCollisions.forEach((function(e){var t=e.combinedName;if(!i.find((function(e){return e.combinedName===t}))){var n=t.split("__"),o=r.rigidBodies.find((function(e){return e.name===n[0]})),a=r.rigidBodies.find((function(e){return e.name===n[1]}));o&&a&&r.collisionEvents.emit("collision",{bodies:[o,a],event:"end"})}})),this.earlierDetectedCollisions=a(i)},t.prototype.setGravity=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=-9.8),void 0===n&&(n=0),this.tmpBtVector3.setValue(e,t,n),this.physicsWorld.setGravity(this.tmpBtVector3)},Object.defineProperty(t.prototype,"debug",{get:function(){var e=this;return this.isHeadless?null:{enable:function(){e.debugDrawer.enable()},mode:function(t){void 0===t&&(t=1),e.debugDrawer.setDebugMode(t)},disable:function(){e.debugDrawer.disable()}}},enumerable:!0,configurable:!0}),t.prototype.start=function(){var e=this;"undefined"!=typeof Ammo?"function"==typeof Ammo?Ammo().then((function(){e.setup()})):this.setup():u.default("Are you sure you included ammo.js?")},Object.defineProperty(t.prototype,"add",{get:function(){var e=this;return{collider:function(t,n,r){return e.collisionEvents.addCollider(t,n,r)},constraints:this.constraints.addConstraints,existing:function(t,n){return e.addExisting(t,n)},plane:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addPlane(t,n)},sphere:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addSphere(t,n)},ground:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addGround(t,n)},box:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addBox(t,n)},cylinder:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addCylinder(t,n)},cone:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addCone(t,n)},torus:function(t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e.shapes.addTorus(t,n)},extrude:function(t,n){return void 0===n&&(n={}),e.shapes.addExtrude(t,n)},raycaster:function(t){return void 0===t&&(t="closest"),"closest"===t?new L.ClosestRaycaster(e):new L.AllHitsRaycaster(e)}}},enumerable:!0,configurable:!0}),t.prototype.prepareThreeObjectForCollisionShape=function(e,t){var n,r;void 0===t&&(t={});e.position,e.quaternion,e.hasBody;var i=t.autoCenter,a=void 0!==i&&i,s={width:1,height:1,depth:1,radius:1,radiusTop:1,radiusBottom:1,tube:.4,tubularSegments:6},c="unknown",l=(null===(n=e.geometry)||void 0===n?void 0:n.type)||"unknown";/box/i.test(l)?c="box":/cone/i.test(l)?c="cone":/cylinder/i.test(l)?c="cylinder":/extrude/i.test(l)?c="extrude":/plane/i.test(l)?c="plane":/sphere/i.test(l)?c="sphere":/torus/i.test(l)&&(c="torus");var h=o(o({},s),null===(r=null==e?void 0:e.geometry)||void 0===r?void 0:r.parameters);return t.shape?(h=o(o({},s),t),c=t.shape):e.shape&&(c=e.shape),Object.keys(h).forEach((function(e){void 0===h[e]&&s[e]&&(h[e]=s[e])})),a&&e.geometry.center(),"extrude"===c&&(c="hacd"),"mesh"!==c&&"convex"!==c||(c="convexMesh"),"concave"===c&&(c="concaveMesh"),"unknown"===c&&(u.default("Shape for "+(null==e?void 0:e.name)+" not recognized! Will fallback to box."),c="box"),{shape:c,params:h,object:e}},t.prototype.createCollisionShape=function(e,t,n){var r,i=(null==n?void 0:n.quaternion)?null==n?void 0:n.quaternion:new g.Quaternion(0,0,0,1);switch(e){case"box":r=new Ammo.btBoxShape(new Ammo.btVector3(t.width/2,t.height/2,t.depth/2));break;case"sphere":r=new Ammo.btSphereShape(t.radius);break;case"cylinder":r=new Ammo.btCylinderShape(new Ammo.btVector3(t.radiusTop,t.height/2,0));break;case"cone":r=new Ammo.btConeShape(t.radius,t.height);break;case"torus":r=x.addTorusShape(t,i);break;case"capsule":r=new Ammo.btCapsuleShape(t.radius,t.height);break;case"plane":r=y.createCollisionShapes(n,{type:"mesh",concave:!1});break;case"hull":r=y.createCollisionShapes(n,{type:"hull"});break;case"hacd":r=y.createCollisionShapes(n,{type:"hacd"});break;case"vhacd":r=y.createCollisionShapes(n,{type:"vhacd"});break;case"convexMesh":r=y.createCollisionShapes(n,{type:"mesh",concave:!1});break;case"concaveMesh":r=y.createCollisionShapes(n,{type:"mesh",concave:!0})}var o=t.x,a=t.y,s=t.z;return(o||a||s)&&(r.offset={x:o||0,y:a||0,z:s||0}),Array.isArray(r)&&(r=this.mergeCollisionShapesToCompoundShape(r)),r},t.prototype.mergeCollisionShapesToCompoundShape=function(e){var t=new Ammo.btCompoundShape;return e.forEach((function(e){var n=e.offset,r=new Ammo.btTransform;r.setIdentity(),n&&r.setOrigin(new Ammo.btVector3(n.x||0,n.y||0,n.z||0)),t.addChildShape(r,e)})),t},t.prototype.addExisting=function(e,t){var n=this;if(void 0===t&&(t={}),e.hasBody)console.warn('[Enable3d]: Object "'+e.name+'" already has a physical body!');else{var r=e.position,i=e.quaternion,o=t.shape,a=void 0===o?"unknown":o,s=t.compound,c=void 0===s?[]:s,u=t.mass,l=void 0===u?1:u,h=t.collisionFlags,p=void 0===h?0:h,d=t.offset,f=void 0===d?void 0:d,m=t.breakable,v=void 0!==m&&m,g=t.addChildren,y=void 0===g||g;if(c.length>=1){var x=c.map((function(e){return n.createCollisionShape(e.shape,e)})),b=this.mergeCollisionShapesToCompoundShape(x),w=this.collisionShapeToRigidBody(b,e.position,e.quaternion,1);this.addRigidBodyToWorld(e,w)}else{var _=[];if("unknown"!==a||e.isMesh){var M=this.prepareThreeObjectForCollisionShape(e,t),T=this.createCollisionShape(M.shape,M.params,M.object);_.push(T)}if("unknown"===a&&y&&e.children.length>=1&&e.children.forEach((function(e){if(e.isMesh){var t=n.prepareThreeObjectForCollisionShape(e),r=n.createCollisionShape(t.shape,t.params,t.object);r.offset=e.position.clone(),_.push(r)}})),0===_.length){M=this.prepareThreeObjectForCollisionShape(e,t),T=this.createCollisionShape(M.shape,M.params,M.object);_.push(T)}var S=1===_.length?_[0]:this.mergeCollisionShapesToCompoundShape(_),E=this.collisionShapeToRigidBody(S,r,i,l);this.addRigidBodyToWorld(e,E,p,v,f)}}},t.prototype.addRigidBodyToWorld=function(e,t,n,r,i){void 0===n&&(n=0),this.rigidBodies.push(e),this.physicsWorld.addRigidBody(t);var a=Object.values(t)[0];t.name=e.name,e.body=new l.default(this,t),e.hasBody=!0,e.ptr=a,this.objectsAmmo[a]=e,r&&(e.body.breakable=!0),i&&(e.body.offset=o({x:0,y:0,z:0},i)),e.body.setCollisionFlags(n)},t.prototype.collisionShapeToRigidBody=function(e,t,n,r){void 0===r&&(r=1);var i=new Ammo.btTransform;i.setIdentity(),i.setOrigin(new Ammo.btVector3(t.x,t.y,t.z)),i.setRotation(new Ammo.btQuaternion(n.x,n.y,n.z,n.w));var o=new Ammo.btDefaultMotionState(i),a=new Ammo.btVector3(0,0,0);r>0&&e.calculateLocalInertia(r,a);var s=new Ammo.btRigidBodyConstructionInfo(r,o,e,a),c=new Ammo.btRigidBody(s);return r>0&&c.setActivationState(4),c},t}(v.default);t.AmmoPhysics=R},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(11)),o=n(0),a=function(){function e(e,t){this.physics=e,this.ammo=t,this.offset={x:0,y:0,z:0},this.errors=[],this.checkCollisions=!1,this.breakable=!1,this.didUpdate=!1,this._emitUpdateEvents=!1,this._needUpdate=!1,this.tmpEuler=new o.Euler,this.tmpQuaternion=new o.Quaternion,this.tmpBtVector3=new Ammo.btVector3,this.tmpBtVector3_1=new Ammo.btVector3,this.tmpBtQuaternion=new Ammo.btQuaternion(0,0,0,1),this.name=t.name}return e.prototype.destructor=function(){this.eventEmitter&&this.eventEmitter.removeAllListeners(),Ammo.destroy(this.tmpBtVector3),Ammo.destroy(this.tmpBtVector3_1),Ammo.destroy(this.tmpBtQuaternion)},e.prototype.setupEventEmitter=function(){void 0===this.eventEmitter&&(this.eventEmitter=new i.default)},Object.defineProperty(e.prototype,"needUpdate",{get:function(){return this._needUpdate},set:function(e){!e&&this._needUpdate&&(this.didUpdate=!0),this._needUpdate=e},enumerable:!0,configurable:!0}),e.prototype.onUpdateEvent=function(e,t){void 0===t&&(t=!1),this.setupEventEmitter(),this._emitUpdateEvents=!0,t?this.eventEmitter.once("update",(function(){e()})):this.eventEmitter.on("update",(function(){e()}))},Object.defineProperty(e.prototype,"on",{get:function(){var e=this;return{update:function(t){return e.onUpdateEvent(t)},collision:function(t){return e.onCollision(t)}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){var e=this;return{update:function(t){return e.onUpdateEvent(t,!0)}}},enumerable:!0,configurable:!0}),e.prototype.onCollision=function(e){var t=this;this.checkCollisions=!0,this.physics.collisionEvents.on("collision",(function(n){var r=n.bodies,i=n.event;r[0].name===t.name?e(r[1],i):r[1].name===t.name&&e(r[0],i)}))},e.prototype.transform=function(){var e=this.physics.tmpTrans;this.ammo.getMotionState().getWorldTransform(e)},e.prototype.refresh=function(){var e=this.physics.tmpTrans;this.ammo.getMotionState().setWorldTransform(e)},e.prototype.setRotation=function(e,t,n){var r=this.tmpEuler.set(e,t,n),i=this.tmpQuaternion.set(0,0,0,1);i.setFromEuler(r),this.tmpBtQuaternion.setValue(0,0,0,1);var o=this.tmpBtQuaternion;o.setValue(i.x,i.y,i.z,i.w),this.physics.tmpTrans.setRotation(o)},Object.defineProperty(e.prototype,"rotation",{get:function(){var e=this.physics.tmpTrans.getRotation(),t=this.tmpQuaternion.set(e.x(),e.y(),e.z(),e.w()),n=t.x,r=t.y,i=t.z,o=t.w,a=2*Math.acos(o);return{x:n/Math.sqrt(1-o*o)*a||0,y:r/Math.sqrt(1-o*o)*a||0,z:i/Math.sqrt(1-o*o)*a||0}},enumerable:!0,configurable:!0}),e.prototype.setPosition=function(e,t,n){this.physics.tmpTrans.getOrigin().setValue(e,t,n)},Object.defineProperty(e.prototype,"position",{get:function(){var e=this.physics.tmpTrans;return{x:e.getOrigin().x(),y:e.getOrigin().y(),z:e.getOrigin().z()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"velocity",{get:function(){return{x:this.ammo.getLinearVelocity().x(),y:this.ammo.getLinearVelocity().y(),z:this.ammo.getLinearVelocity().z()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"angularVelocity",{get:function(){return{x:this.ammo.getAngularVelocity().x(),y:this.ammo.getAngularVelocity().y(),z:this.ammo.getAngularVelocity().z()}},enumerable:!0,configurable:!0}),e.prototype.setVelocity=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.setLinearVelocity(this.tmpBtVector3)},e.prototype.setVelocityX=function(e){this.tmpBtVector3.setValue(e,this.velocity.y,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)},e.prototype.setVelocityY=function(e){this.tmpBtVector3.setValue(this.velocity.x,e,this.velocity.z),this.ammo.setLinearVelocity(this.tmpBtVector3)},e.prototype.setVelocityZ=function(e){this.tmpBtVector3.setValue(this.velocity.x,this.velocity.y,e),this.ammo.setLinearVelocity(this.tmpBtVector3)},e.prototype.setAngularVelocity=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.setAngularVelocity(this.tmpBtVector3)},e.prototype.setAngularVelocityX=function(e){this.tmpBtVector3.setValue(e,this.angularVelocity.y,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)},e.prototype.setAngularVelocityY=function(e){this.tmpBtVector3.setValue(this.angularVelocity.x,e,this.angularVelocity.z),this.ammo.setAngularVelocity(this.tmpBtVector3)},e.prototype.setAngularVelocityZ=function(e){this.tmpBtVector3.setValue(this.angularVelocity.x,this.angularVelocity.y,e),this.ammo.setAngularVelocity(this.tmpBtVector3)},e.prototype.applyForce=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)},e.prototype.applyForceX=function(e){this.tmpBtVector3.setValue(e,0,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)},e.prototype.applyForceY=function(e){this.tmpBtVector3.setValue(0,e,0),this.ammo.applyCentralImpulse(this.tmpBtVector3)},e.prototype.applyForceZ=function(e){this.tmpBtVector3.setValue(0,0,e),this.ammo.applyCentralImpulse(this.tmpBtVector3)},e.prototype.applyCentralForce=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyCentralForce(this.tmpBtVector3)},e.prototype.applyCentralImpulse=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyCentralImpulse(this.tmpBtVector3)},e.prototype.applyCentralLocalForce=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyCentralLocalForce(this.tmpBtVector3)},e.prototype.applyImpulse=function(e,t){this.tmpBtVector3.setValue(e.x||0,e.y||0,e.z||0),this.tmpBtVector3_1.setValue(t.x||0,t.y||0,t.z||0),this.ammo.applyImpulse(this.tmpBtVector3,this.tmpBtVector3_1)},e.prototype.applyLocalTorque=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyLocalTorque(this.tmpBtVector3)},e.prototype.applyTorque=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyTorque(this.tmpBtVector3)},e.prototype.applyTorqueImpulse=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.applyTorqueImpulse(this.tmpBtVector3)},e.prototype.setCollisionFlags=function(e){this.ammo.setCollisionFlags(e)},e.prototype.getCollisionFlags=function(){return this.ammo.getCollisionFlags()},e.prototype.setRestitution=function(e){this.ammo.setRestitution(e)},e.prototype.setBounciness=function(e){this.setRestitution(e)},e.prototype.setFriction=function(e){this.ammo.setFriction(e)},e.prototype.setGravity=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.setGravity(this.tmpBtVector3)},e.prototype.setLinearFactor=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.setLinearFactor(this.tmpBtVector3)},e.prototype.setAngularFactor=function(e,t,n){this.tmpBtVector3.setValue(e,t,n),this.ammo.setAngularFactor(this.tmpBtVector3)},e.prototype.setCcdMotionThreshold=function(e){this.ammo.setCcdMotionThreshold(e)},e.prototype.setCcdSweptSphereRadius=function(e){this.ammo.setCcdSweptSphereRadius(e)},e}();t.default=a},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.factory=e,this.addExisting=t}return e.prototype.addPlane=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.plane(e,t);return this.addExisting(n,e),n},e.prototype.addSphere=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.sphere(e,t);return this.addExisting(n,e),n},e.prototype.addBox=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.box(e,t);return this.addExisting(n,e),n},e.prototype.addGround=function(e,t){void 0===t&&(t={});var n=this.factory.add.ground(e,t),i=r(r({},e),{mass:0,collisionFlags:1});return this.addExisting(n,i),n},e.prototype.addCylinder=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.cylinder(e,t);return this.addExisting(n,e),n},e.prototype.addCone=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.cone(e,t);return this.addExisting(n,e),n},e.prototype.addTorus=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=this.factory.add.torus(e,t);return this.addExisting(n,e),n},e.prototype.addExtrude=function(e,t){void 0===t&&(t={});var n=this.factory.add.extrude(e,t);return n.translateX(1),this.addExisting(n),n},e}();t.default=i},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.tmpTrans=e,this.physicsWorld=t,this.tmpBtVector3=new Ammo.btVector3}return e.prototype.toAmmoV3=function(e,t){return void 0===t&&(t=0),new Ammo.btVector3(void 0!==(null==e?void 0:e.x)?e.x:t,void 0!==(null==e?void 0:e.y)?e.y:t,void 0!==(null==e?void 0:e.z)?e.z:t)},Object.defineProperty(e.prototype,"addConstraints",{get:function(){var e=this;return{lock:function(t,n){return e.lock(t,n)},fixed:function(t,n){return e.fixed(t,n)},pointToPoint:function(t,n,r){return e.pointToPoint(t,n,r)},hinge:function(t,n,r){return e.hinge(t,n,r)},slider:function(t,n,r){return void 0===r&&(r={}),e.slider(t,n,r)},spring:function(t,n,r){return void 0===r&&(r={}),e.spring(t,n,r)},coneTwist:function(t,n,r,i){return void 0===r&&(r={}),void 0===i&&(i={}),e.coneTwist(t,n,r,i)},dof:function(t,n,r){return e.dof(t,n,r)}}},enumerable:!0,configurable:!0}),e.prototype.getTransform=function(e,t,n,i){void 0===n&&(n={x:0,y:0,z:0}),void 0===i&&(i=!1),n=r({x:0,y:0,z:0},n);var o,a,s,c,u,l=new Ammo.btTransform;if(l.setIdentity(),i){var h,p=(o=e.getWorldTransform().getOrigin(),a=t.getWorldTransform().getOrigin(),s=(o.x()-a.x())/2+n.x,c=(o.y()-a.y())/2+n.y,u=(o.z()-a.z())/2+n.z,new Ammo.btVector3(s,c,u)),d=new Ammo.btTransform;return d.setIdentity(),d.setOrigin(p),(h=e.getCenterOfMassTransform().inverse().op_mul(t.getWorldTransform())).op_mul(d),{transformA:h,transformB:d}}return l.setOrigin(new Ammo.btVector3(n.x,n.y,n.z)),{transformA:h=e.getCenterOfMassTransform().inverse().op_mul(t.getWorldTransform()).op_mul(l),transformB:l}},e.prototype.lock=function(e,t){var n={x:0,y:0,z:0};return this.dof(e,t,{angularLowerLimit:n,angularUpperLimit:n})},e.prototype.fixed=function(e,t){var n=this.getTransform(e.ammo,t.ammo);n.transformA.setRotation(e.ammo.getWorldTransform().getRotation()),n.transformB.setRotation(t.ammo.getWorldTransform().getRotation());var r=new Ammo.btFixedConstraint(e.ammo,t.ammo,n.transformA,n.transformB);return this.physicsWorld.addConstraint(r),r},e.prototype.pointToPoint=function(e,t,n){void 0===n&&(n={});var r=n.pivotA,i=n.pivotB,o=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),a=new Ammo.btVector3((null==i?void 0:i.x)||0,(null==i?void 0:i.y)||0,(null==i?void 0:i.z)||0),s=new Ammo.btPoint2PointConstraint(e.ammo,t.ammo,o,a);return this.physicsWorld.addConstraint(s),s},e.prototype.hinge=function(e,t,n){void 0===n&&(n={});var r=n.pivotA,i=n.pivotB,o=n.axisA,a=n.axisB,s=new Ammo.btVector3((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0),c=new Ammo.btVector3((null==i?void 0:i.x)||0,(null==i?void 0:i.y)||0,(null==i?void 0:i.z)||0),u=new Ammo.btVector3((null==o?void 0:o.x)||0,(null==o?void 0:o.y)||0,(null==o?void 0:o.z)||0),l=new Ammo.btVector3((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0,(null==a?void 0:a.z)||0),h=new Ammo.btHingeConstraint(e.ammo,t.ammo,s,c,u,l,!0);return this.physicsWorld.addConstraint(h),h},e.prototype.slider=function(e,t,n){void 0===n&&(n={});var r=this.getTransform(e.ammo,t.ammo),i=n.frameA,o=void 0===i?{}:i,a=n.frameB,s=void 0===a?{}:a,c=n.linearLowerLimit,u=void 0===c?0:c,l=n.linearUpperLimit,h=void 0===l?0:l,p=n.angularLowerLimit,d=void 0===p?0:p,f=n.angularUpperLimit,m=void 0===f?0:f,v=r.transformA.getRotation();v.setEulerZYX(o.x||0,o.y||0,o.z||0),r.transformA.setRotation(v);var g=r.transformB.getRotation();g.setEulerZYX(s.x||0,s.y||0,s.z||0),r.transformB.setRotation(g);var y=new Ammo.btSliderConstraint(e.ammo,t.ammo,r.transformA,r.transformB,!0);return y.setLowerLinLimit(u),y.setUpperLinLimit(h),y.setLowerAngLimit(d),y.setUpperAngLimit(m),this.physicsWorld.addConstraint(y),y},e.prototype.spring=function(e,t,n){void 0===n&&(n={});var r=n.stiffness,i=void 0===r?50:r,o=n.damping,a=void 0===o?.01:o,s=n.angularLock,c=void 0!==s&&s,u=n.linearLowerLimit,l=void 0===u?{}:u,h=n.linearUpperLimit,p=void 0===h?{}:h,d=this.getTransform(e.ammo,t.ammo),f=new Ammo.btGeneric6DofSpringConstraint(e.ammo,t.ammo,d.transformA,d.transformB,!0);this.tmpBtVector3.setValue(l.x||0,l.y||0,l.z||0),f.setLinearLowerLimit(this.tmpBtVector3),this.tmpBtVector3.setValue(p.x||0,p.y||0,p.z||0),f.setLinearUpperLimit(this.tmpBtVector3),c&&(this.tmpBtVector3.setValue(0,0,0),f.setAngularLowerLimit(this.tmpBtVector3),f.setAngularUpperLimit(this.tmpBtVector3));for(var m=0;m<3;m++)f.enableSpring(m,!0),f.setStiffness(m,i),f.setDamping(m,a);return this.physicsWorld.addConstraint(f),f},e.prototype.coneTwist=function(e,t,n,r){void 0===n&&(n={}),void 0===r&&(r={});var i=new Ammo.btTransform;i.setIdentity(),i.getOrigin().setValue((null==n?void 0:n.x)||0,(null==n?void 0:n.y)||0,(null==n?void 0:n.z)||0);var o=new Ammo.btTransform;o.setIdentity(),o.getOrigin().setValue((null==r?void 0:r.x)||0,(null==r?void 0:r.y)||0,(null==r?void 0:r.z)||0);this.getTransform(e.ammo,t.ammo);var a=new Ammo.btConeTwistConstraint(t.ammo,e.ammo,i,o);return a.setAngularOnly(!0),this.physicsWorld.addConstraint(a),a},e.prototype.dof=function(e,t,n){void 0===n&&(n={});var i=n.offset,o=n.center,a=void 0!==o&&o,s=r({x:0,y:0,z:0},i),c=this.getTransform(e.ammo,t.ammo,s,a),u=new Ammo.btGeneric6DofConstraint(e.ammo,t.ammo,c.transformA,c.transformB,!0),l=n.linearLowerLimit,h=n.linearUpperLimit,p=n.angularLowerLimit,d=n.angularUpperLimit,f=this.toAmmoV3(l),m=this.toAmmoV3(h),v=this.toAmmoV3(p,-Math.PI),g=this.toAmmoV3(d,Math.PI);return u.setLinearLowerLimit(f),u.setLinearUpperLimit(m),u.setAngularLowerLimit(v),u.setAngularUpperLimit(g),Ammo.destroy(f),Ammo.destroy(m),Ammo.destroy(v),Ammo.destroy(g),this.physicsWorld.addConstraint(u,!1),u},e}();t.default=i},function(e,t,n){"use strict";
  /**
   * @author       Kevin Lee (https://github.com/InfiniteLee)
   * @copyright    Copyright (c) 2019 Kevin Lee; Project Url: https://github.com/InfiniteLee/three-to-ammo
   * @license      {@link https://github.com/InfiniteLee/three-to-ammo/blob/master/LICENSE|MPL-2.0}
   */var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i,o,a,s,c,u="box",l="cylinder",h="sphere",p="capsule",d="cone",f="hull",m="hacd",v="vhacd",g="mesh",y="heightfield",x="all",b="manual",w=r(n(4)),_=n(0),M=r(n(3)),T=w.default.prototype.hasOwnProperty("updateMatrices");function S(e){e.fit=e.hasOwnProperty("fit")?e.fit:x,e.type=e.type||f,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:.05,e.includeInvisible=!!e.hasOwnProperty("includeInvisible")&&e.includeInvisible,e.offset||(e.offset=new _.Vector3),e.orientation||(e.orientation=new _.Quaternion)}t.createCollisionShapes=function(e,n){switch(n.type){case u:return t.createBoxShape(e,n);case l:return t.createCylinderShape(e,n);case p:return t.createCapsuleShape(e,n);case d:return t.createConeShape(e,n);case h:return t.createSphereShape(e,n);case f:return t.createHullShape(e,n);case m:return t.createHACDShapes(e,n);case v:return t.createVHACDShapes(e,n);case g:return t.createTriMeshShape(e,n);case y:return t.createHeightfieldTerrainShape(e,n);default:return M.default(n.type+" is not currently supported"),[]}},t.createBoxShape=function(e,t){t.type=u,S(t),t.fit===x&&(t.halfExtents=I(e,N(e,t),t.minHalfExtent,t.maxHalfExtent));var n=new Ammo.btVector3(t.halfExtents.x,t.halfExtents.y,t.halfExtents.z),r=new Ammo.btBoxShape(n);return Ammo.destroy(n),R(r,t,O(e,t)),r},t.createCylinderShape=function(e,t){t.type=l,S(t),t.fit===x&&(t.halfExtents=I(e,N(e,t),t.minHalfExtent,t.maxHalfExtent));var n=new Ammo.btVector3(t.halfExtents.x,t.halfExtents.y,t.halfExtents.z),r=function(){switch(t.cylinderAxis){case"y":return new Ammo.btCylinderShape(n);case"x":return new Ammo.btCylinderShapeX(n);case"z":return new Ammo.btCylinderShapeZ(n)}return null}();return Ammo.destroy(n),R(r,t,O(e,t)),r},t.createCapsuleShape=function(e,t){t.type=p,S(t),t.fit===x&&(t.halfExtents=I(e,N(e,t),t.minHalfExtent,t.maxHalfExtent));var n=t.halfExtents,r=n.x,i=n.y,o=n.z,a=function(){switch(t.cylinderAxis){case"y":return new Ammo.btCapsuleShape(Math.max(r,o),2*i);case"x":return new Ammo.btCapsuleShapeX(Math.max(i,o),2*r);case"z":return new Ammo.btCapsuleShapeZ(Math.max(r,i),2*o)}return null}();return R(a,t,O(e,t)),a},t.createConeShape=function(e,t){t.type=d,S(t),t.fit===x&&(t.halfExtents=I(e,N(e,t),t.minHalfExtent,t.maxHalfExtent));var n=t.halfExtents,r=n.x,i=n.y,o=n.z,a=function(){switch(t.cylinderAxis){case"y":return new Ammo.btConeShape(Math.max(r,o),2*i);case"x":return new Ammo.btConeShapeX(Math.max(i,o),2*r);case"z":return new Ammo.btConeShapeZ(Math.max(r,i),2*o)}return null}();return R(a,t,O(e,t)),a},t.createSphereShape=function(e,t){var n;t.type=h,S(t),n=t.fit!==b||isNaN(t.sphereRadius)?D(e,t,N(e,t)):t.sphereRadius;var r=new Ammo.btSphereShape(n);return R(r,t,O(e,t)),r},t.createHullShape=(i=new _.Vector3,o=new _.Vector3,function(e,t){if(t.type=f,S(t),t.fit===b)return console.warn("cannot use fit: manual with type: hull"),null;var n=N(e,t),r=new Ammo.btVector3,a=new Ammo.btConvexHullShape;a.setMargin(t.margin),o.addVectors(n.max,n.min).multiplyScalar(.5);var s=0;C(e,t,(function(e){s+=e.attributes.position.array.length/3}));var c=t.hullMaxVertices||1e5;s>c&&console.warn("too many vertices for hull shape; sampling ~"+c+" from ~"+s+" vertices");var u=Math.min(1,c/s);C(e,t,(function(e,t){B(e,t);for(var n=e.attributes.position.array,s=0;s<n.length;s+=3)Math.random()<=u&&(i.set(n[s],n[s+1],n[s+2]).applyMatrix4(t).sub(o),r.setValue(i.x,i.y,i.z),a.addPoint(r,s===n.length-3))}));var l=a;if(a.getNumVertices()>=100){var h=new Ammo.btShapeHull(a);h.buildHull(t.margin),Ammo.destroy(a),l=new Ammo.btConvexHullShape(Ammo.getPointer(h.getVertexPointer()),h.numVertices()),Ammo.destroy(h)}return Ammo.destroy(r),R(l,t,O(e,t)),l}),t.createHACDShapes=function(){var e=new _.Vector3,t=new _.Vector3;return function(n,r){if(r.type=m,S(r),r.fit===b)return console.warn("cannot use fit: manual with type: hacd"),[];if(!Ammo.hasOwnProperty("HACD"))return console.warn("HACD unavailable in included build of Ammo.js. Visit https://github.com/mozillareality/ammo.js for the latest version."),[];var i=N(n),o=O(n,r),a=0,s=0;t.addVectors(i.max,i.min).multiplyScalar(.5),C(n,r,(function(e){a+=e.attributes.position.array.length/3,e.index?s+=e.index.array.length/3:s+=e.attributes.position.array.length/9}));var c=new Ammo.HACD;r.hasOwnProperty("compacityWeight")&&c.SetCompacityWeight(r.compacityWeight),r.hasOwnProperty("volumeWeight")&&c.SetVolumeWeight(r.volumeWeight),r.hasOwnProperty("nClusters")&&c.SetNClusters(r.nClusters),r.hasOwnProperty("nVerticesPerCH")&&c.SetNVerticesPerCH(r.nVerticesPerCH),r.hasOwnProperty("concavity")&&c.SetConcavity(r.concavity);var u=Ammo._malloc(3*a*8),l=Ammo._malloc(3*s*4);c.SetPoints(u),c.SetTriangles(l),c.SetNPoints(a),c.SetNTriangles(s);var h=u/8,p=l/4;C(n,r,(function(n,r){B(n,r);for(var i=n.attributes.position.array,o=n.index?n.index.array:null,a=0;a<i.length;a+=3)e.set(i[a+0],i[a+1],i[a+2]).applyMatrix4(r).sub(t),Ammo.HEAPF64[h+a+0]=e.x,Ammo.HEAPF64[h+a+1]=e.y,Ammo.HEAPF64[h+a+2]=e.z;if(o)for(a=0;a<o.length;a++)Ammo.HEAP32[p+a]=o[a];else for(a=0;a<i.length/3;a++)Ammo.HEAP32[p+a]=a})),c.Compute(),Ammo._free(u),Ammo._free(l);for(var d=c.GetNClusters(),f=[],v=0;v<d;v++){var g=new Ammo.btConvexHullShape;g.setMargin(r.margin);var y=c.GetNPointsCH(v),x=c.GetNTrianglesCH(v),w=Ammo._malloc(3*y*8),_=Ammo._malloc(3*x*4);c.GetCH(v,w,_);for(var M=w/8,T=0;T<y;T++){var E=new Ammo.btVector3,A=Ammo.HEAPF64[M+3*T+0],L=Ammo.HEAPF64[M+3*T+1],P=Ammo.HEAPF64[M+3*T+2];E.setValue(A,L,P),g.addPoint(E,T===y-1),Ammo.destroy(E)}R(g,r,o),f.push(g)}return f}}(),t.createVHACDShapes=function(){var e=new _.Vector3,t=new _.Vector3;return function(n,r){if(r.type=v,S(r),r.fit===b)return console.warn("cannot use fit: manual with type: vhacd"),[];if(!Ammo.hasOwnProperty("VHACD"))return console.warn("VHACD unavailable in included build of Ammo.js. Visit https://github.com/mozillareality/ammo.js for the latest version."),[];var i=N(n,r),o=O(n,r),a=0,s=0;t.addVectors(i.max,i.min).multiplyScalar(.5),C(n,r,(function(e){a+=e.attributes.position.count,e.index?s+=e.index.count/3:s+=e.attributes.position.count/3}));var c=new Ammo.VHACD,u=new Ammo.Parameters;r.hasOwnProperty("resolution")&&u.set_m_resolution(r.resolution),r.hasOwnProperty("depth")&&u.set_m_depth(r.depth),r.hasOwnProperty("concavity")&&u.set_m_concavity(r.concavity),r.hasOwnProperty("planeDownsampling")&&u.set_m_planeDownsampling(r.planeDownsampling),r.hasOwnProperty("convexhullDownsampling")&&u.set_m_convexhullDownsampling(r.convexhullDownsampling),r.hasOwnProperty("alpha")&&u.set_m_alpha(r.alpha),r.hasOwnProperty("beta")&&u.set_m_beta(r.beta),r.hasOwnProperty("gamma")&&u.set_m_gamma(r.gamma),r.hasOwnProperty("pca")&&u.set_m_pca(r.pca),r.hasOwnProperty("mode")&&u.set_m_mode(r.mode),r.hasOwnProperty("maxNumVerticesPerCH")&&u.set_m_maxNumVerticesPerCH(r.maxNumVerticesPerCH),r.hasOwnProperty("minVolumePerCH")&&u.set_m_minVolumePerCH(r.minVolumePerCH),r.hasOwnProperty("convexhullApproximation")&&u.set_m_convexhullApproximation(r.convexhullApproximation),r.hasOwnProperty("oclAcceleration")&&u.set_m_oclAcceleration(r.oclAcceleration);var l=Ammo._malloc(3*a*8),h=Ammo._malloc(3*s*4),p=l/8,d=h/4;C(n,r,(function(n,r){B(n,r);for(var i=n.attributes.position.array,o=n.index?n.index.array:null,a=0;a<i.length;a+=3)e.set(i[a+0],i[a+1],i[a+2]).applyMatrix4(r).sub(t),Ammo.HEAPF64[p+0]=e.x,Ammo.HEAPF64[p+1]=e.y,Ammo.HEAPF64[p+2]=e.z,p+=3;if(o)for(a=0;a<o.length;a++)Ammo.HEAP32[d]=o[a],d++;else for(a=0;a<i.length/3;a++)Ammo.HEAP32[d]=a,d++})),c.Compute(l,3,a,h,3,s,u),Ammo._free(l),Ammo._free(h);for(var f=c.GetNConvexHulls(),m=[],g=new Ammo.ConvexHull,y=0;y<f;y++){c.GetConvexHull(y,g);var x=g.get_m_nPoints(),w=(g.get_m_points(),new Ammo.btConvexHullShape);w.setMargin(r.margin);for(var _=0;_<x;_++){var M=new Ammo.btVector3,T=g.get_m_points(3*_+0),E=g.get_m_points(3*_+1),A=g.get_m_points(3*_+2);M.setValue(T,E,A),w.addPoint(M,_===x-1),Ammo.destroy(M)}R(w,r,o),m.push(w)}return Ammo.destroy(g),Ammo.destroy(c),m}}(),t.createTriMeshShape=(a=new _.Vector3,s=new _.Vector3,c=new _.Vector3,function(e,t){if(t.type=g,S(t),t.fit===b)return console.warn("cannot use fit: manual with type: mesh"),null;var n,r=O(e,t),i=new Ammo.btVector3,o=new Ammo.btVector3,u=new Ammo.btVector3,l=new Ammo.btTriangleMesh(!0,!1);return C(e,t,(function(e,t){var n=e.attributes.position.array;if(e.index)for(var r=0;r<e.index.count;r+=3){var h=3*e.index.array[r],p=3*e.index.array[r+1],d=3*e.index.array[r+2];a.set(n[h],n[h+1],n[h+2]).applyMatrix4(t),s.set(n[p],n[p+1],n[p+2]).applyMatrix4(t),c.set(n[d],n[d+1],n[d+2]).applyMatrix4(t),i.setValue(a.x,a.y,a.z),o.setValue(s.x,s.y,s.z),u.setValue(c.x,c.y,c.z),l.addTriangle(i,o,u,!1)}else for(r=0;r<n.length;r+=9)a.set(n[r+0],n[r+1],n[r+2]).applyMatrix4(t),s.set(n[r+3],n[r+4],n[r+5]).applyMatrix4(t),c.set(n[r+6],n[r+7],n[r+8]).applyMatrix4(t),i.setValue(a.x,a.y,a.z),o.setValue(s.x,s.y,s.z),u.setValue(c.x,c.y,c.z),l.addTriangle(i,o,u,!1)})),(n=t.concave?new Ammo.btBvhTriangleMeshShape(l,!0,!0):new Ammo.btConvexTriangleMeshShape(l,!0)).resources=[l],Ammo.destroy(i),Ammo.destroy(o),Ammo.destroy(u),R(n,t,r),n}),t.createHeightfieldTerrainShape=function(e,t){if(S(t),t.fit===x)return console.warn("cannot use fit: all with type: heightfield"),null;for(var n=t.heightfieldDistance||1,r=t.heightfieldData||[],i=t.heightScale||0,o=t.hasOwnProperty("upAxis")?t.upAxis:1,a=function(){switch(t.heightDataType){case"short":return Ammo.PHY_SHORT;case"float":default:return Ammo.PHY_FLOAT}}(),s=!t.hasOwnProperty("flipQuadEdges")||t.flipQuadEdges,c=r.length,u=c>0?r[0].length:0,l=Ammo._malloc(c*u*4),h=l/4,p=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,f=0,m=0;m<c;m++)for(var v=0;v<u;v++){var g=r[m][v];Ammo.HEAPF32[h+f]=g,f++,p=Math.min(p,g),d=Math.max(d,g)}var y=new Ammo.btHeightfieldTerrainShape(u,c,l,i,p,d,o,a,s),b=new Ammo.btVector3(n,1,n);return y.setLocalScaling(b),Ammo.destroy(b),y.heightfieldData=l,R(y,t),y};var E,A,L,P,R=function(e,t,n){if(e.type=t.type,e.setMargin(t.margin),e.destroy=function(){for(var t=0,n=e.resources||[];t<n.length;t++){var r=n[t];Ammo.destroy(r)}e.heightfieldData&&Ammo._free(e.heightfieldData),Ammo.destroy(e)},n){var r=new Ammo.btVector3(n.x,n.y,n.z);e.setLocalScaling(r),Ammo.destroy(r)}},C=(E=new _.Matrix4,A=new _.Matrix4,L=new _.BufferGeometry,function(e,t,n){A.getInverse(e.matrixWorld),e.traverse((function(t){t.isMesh&&(t===e?E.identity():(T&&t.updateMatrices(),E.multiplyMatrices(A,t.matrixWorld)),n(t.geometry.isBufferGeometry?t.geometry:L.fromGeometry(t.geometry),E))}))}),O=function(e,t){return e.scale},D=function(){var e=new _.Vector3,t=new _.Vector3;return function(n,r,i){var o=0,a=i.getCenter(t),s=a.x,c=a.y,u=a.z;return C(n,r,(function(t,n){for(var r=t.attributes.position.array,i=0;i<r.length;i+=3){e.set(r[i],r[i+1],r[i+2]).applyMatrix4(n);var a=s-e.x,l=c-e.y,h=u-e.z;o=Math.max(o,a*a+l*l+h*h)}})),Math.sqrt(o)}}(),I=function(e,t,n,r){return(new _.Vector3).subVectors(t.max,t.min).multiplyScalar(.5).clampScalar(n,r)},N=(P=new _.Vector3,function(e,t){var n=new _.Box3,r=1/0,i=1/0,o=1/0,a=-1/0,s=-1/0,c=-1/0;return n.min.set(0,0,0),n.max.set(0,0,0),C(e,t,(function(e,t){for(var n=e.attributes.position.array,u=0;u<n.length;u+=3)P.set(n[u],n[u+1],n[u+2]).applyMatrix4(t),P.x<r&&(r=P.x),P.y<i&&(i=P.y),P.z<o&&(o=P.z),P.x>a&&(a=P.x),P.y>s&&(s=P.y),P.z>c&&(c=P.z)})),n.min.set(r,i,o),n.max.set(a,s,c),n}),B=function(e,t){e.computeBoundingBox();var n=new _.Vector3;e.boundingBox.getCenter(n),t.makeTranslation(n.x,n.y,n.z)}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0}),t.addTorusShape=function(e,t){var n=e.radius,r=void 0===n?1:n,i=e.tube,o=void 0===i?.4:i,a=e.tubularSegments,s=void 0===a?8:a,c=Math.PI,u=s,l=Math.sqrt(2*o*o-2*o*o*Math.cos(2*c/u)),h=new Ammo.btVector3(o,c/u+.5*l,o),p=new Ammo.btCylinderShape(h);p.setMargin(.05);for(var d=new Ammo.btCompoundShape,f=new Ammo.btVector3(0,0,1),m=new Ammo.btVector3(0,r,0),v=new Ammo.btQuaternion(t.x,t.y,t.z,t.w),g=0;g<u;g++){var y=2*g*c/u,x=m.rotate(f,y),b=new Ammo.btTransform;v.setRotation(f,y+Math.PI/2),b.setIdentity(),b.setOrigin(x),b.setRotation(v),d.addChildShape(b,p)}return d}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.addCollider=function(e,t,n){e.body&&t.body&&(e.body.checkCollisions=!0,t.body.checkCollisions=!0,this.on("collision",(function(r){var i,o,a=r.bodies,s=r.event;(null===(i=a[0])||void 0===i?void 0:i.name)&&(null===(o=a[1])||void 0===o?void 0:o.name)&&(null==e?void 0:e.name)&&(null==t?void 0:t.name)&&(a[0].name===e.name&&a[1].name===t.name||a[1].name===e.name&&a[0].name===t.name)&&n(s)})))},t}(o(n(12)).default);t.CollisionEvents=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});
  /**
   * @author       Kevin Lee (https://github.com/InfiniteLee)
   * @copyright    Copyright (c) 2019 Kevin Lee; Project Url: https://github.com/InfiniteLee/ammo-debug-drawer
   * @license      {@link https://github.com/InfiniteLee/ammo-debug-drawer/blob/master/LICENSE|MPL-2.0}
   */
  var r=n(0),i=1,o=32768,a=function(){function e(e,t,n){void 0===n&&(n={}),this.scene=e,this.world=t,this.options=n,this.debugDrawMode=n.debugDrawMode||i;var a=this.debugDrawMode&o||!1,s=n.maxBufferSize||1e6;this.geometry=new r.BufferGeometry;var c=new Float32Array(3*s),u=new Float32Array(3*s);this.geometry.setAttribute("position",new r.BufferAttribute(c,3).setUsage(r.StaticDrawUsage)),this.geometry.setAttribute("color",new r.BufferAttribute(u,3).setUsage(r.StaticDrawUsage)),this.index=0;var l=new r.LineBasicMaterial({vertexColors:!0,depthTest:!a});this.mesh=new r.LineSegments(this.geometry,l),a&&(this.mesh.renderOrder=999),this.mesh.frustumCulled=!1,this.enabled=!1,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.world.setDebugDrawer(this.debugDrawer)}return e.prototype.enable=function(){this.enabled=!0,this.scene.add(this.mesh)},e.prototype.disable=function(){this.enabled=!1,this.scene.remove(this.mesh)},e.prototype.update=function(){this.enabled&&(0!=this.index&&(this.geometry.attributes.position.needsUpdate=!0,this.geometry.attributes.color.needsUpdate=!0),this.index=0,this.world.debugDrawWorld(),this.geometry.setDrawRange(0,this.index))},e.prototype.drawLine=function(e,t,n){var r=Ammo.HEAPF32,i=r[(n+0)/4],o=r[(n+4)/4],a=r[(n+8)/4],s=r[(e+0)/4],c=r[(e+4)/4],u=r[(e+8)/4];this.geometry.attributes.position.setXYZ(this.index,s,c,u),this.geometry.attributes.color.setXYZ(this.index++,i,o,a);var l=r[(t+0)/4],h=r[(t+4)/4],p=r[(t+8)/4];this.geometry.attributes.position.setXYZ(this.index,l,h,p),this.geometry.attributes.color.setXYZ(this.index++,i,o,a)},e.prototype.drawContactPoint=function(e,t,n,r,i){var o=Ammo.HEAPF32,a=o[(i+0)/4],s=o[(i+4)/4],c=o[(i+8)/4],u=o[(e+0)/4],l=o[(e+4)/4],h=o[(e+8)/4];this.geometry.attributes.position.setXYZ(this.index,u,l,h),this.geometry.attributes.color.setXYZ(this.index++,a,s,c);var p=o[(t+0)/4]*n,d=o[(t+4)/4]*n,f=o[(t+8)/4]*n;this.geometry.attributes.position.setXYZ(this.index,u+p,l+d,h+f),this.geometry.attributes.color.setXYZ(this.index++,a,s,c)},e.prototype.reportErrorWarning=function(e){Ammo.hasOwnProperty("Pointer_stringify")?console.warn(Ammo.Pointer_stringify(e)):this.warnedOnce||(this.warnedOnce=!0,console.warn("Cannot print warningString, please rebuild Ammo.js using 'debug' flag"))},e.prototype.draw3dText=function(e,t){console.warn("TODO: draw3dText")},e.prototype.setDebugMode=function(e){this.debugDrawMode=e},e.prototype.getDebugMode=function(){return this.debugDrawMode},e}();t.default=a},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(0),a=n(0),s=r(n(3)),c=function(e,t){this.minSizeForBreak=e||1.4,this.smallDelta=t||1e-4,this.tempLine1=new o.Line3,this.tempPlane1=new o.Plane,this.tempPlane2=new o.Plane,this.tempPlane_Cut=new o.Plane,this.tempCM1=new o.Vector3,this.tempCM2=new o.Vector3,this.tempVector3=new o.Vector3,this.tempVector3_2=new o.Vector3,this.tempVector3_3=new o.Vector3,this.tempVector3_P0=new o.Vector3,this.tempVector3_P1=new o.Vector3,this.tempVector3_P2=new o.Vector3,this.tempVector3_N0=new o.Vector3,this.tempVector3_N1=new o.Vector3,this.tempVector3_AB=new o.Vector3,this.tempVector3_CB=new o.Vector3,this.tempResultObjects={object1:null,object2:null},this.segments=[];for(var n=0;n<900;n++)this.segments[n]=!1};t.ConvexObjectBreaker=c,c.prototype={constructor:c,prepareBreakableObject:function(e,t,n,r,i){e.geometry.isBufferGeometry||console.error("THREE.ConvexObjectBreaker.prepareBreakableObject(): Parameter object must have a BufferGeometry.");var o=e.userData;o.mass=t,o.velocity=n.clone(),o.angularVelocity=r.clone(),o.breakable=i},subdivideByImpact:function(e,t,n,r,i){var o=[],a=this.tempPlane1,s=this.tempPlane2;this.tempVector3.addVectors(t,n),a.setFromCoplanarPoints(t,e.position,this.tempVector3);var c=i+r,u=this;return function i(l,h,p,d){if(Math.random()<.05*d||d>c)o.push(l);else{var f=Math.PI;0===d?(s.normal.copy(a.normal),s.constant=a.constant):d<=r?(f=(p-h)*(.2+.6*Math.random())+h,u.tempVector3_2.copy(e.position).sub(t).applyAxisAngle(n,f).add(t),s.setFromCoplanarPoints(t,u.tempVector3,u.tempVector3_2)):(f=(.5*(1&d)+.2*(2-Math.random()))*Math.PI,u.tempVector3_2.copy(t).sub(l.position).applyAxisAngle(n,f).add(l.position),u.tempVector3_3.copy(n).add(l.position),s.setFromCoplanarPoints(l.position,u.tempVector3_3,u.tempVector3_2)),u.cutByPlane(l,s,u.tempResultObjects);var m=u.tempResultObjects.object1,v=u.tempResultObjects.object2;m&&i(m,h,f,d+1),v&&i(v,f,p,d+1)}}(e,0,2*Math.PI,0),o},cutByPlane:function(e,t,n){var r=e.geometry,i=r.attributes.position.array,u=r.attributes.normal.array,l=i.length/3,h=l/3,p=r.getIndex();function d(e,t){var n=3*e+t;return p?p[n]:n}p&&(h=(p=p.array).length/3);for(var f=[],m=[],v=this.smallDelta,g=l*l,y=0;y<g;y++)this.segments[y]=!1;var x=this.tempVector3_P0,b=this.tempVector3_P1,w=this.tempVector3_N0,_=this.tempVector3_N1;for(y=0;y<h-1;y++){var M=d(y,0),T=d(y,1),S=d(y,2);w.set(u[M],u[M]+1,u[M]+2);for(var E=y+1;E<h;E++){var A=d(E,0),L=d(E,1),P=d(E,2);_.set(u[A],u[A]+1,u[A]+2),1-w.dot(_)<v&&(M===A||M===L||M===P?T===A||T===L||T===P?(this.segments[M*l+T]=!0,this.segments[T*l+M]=!0):(this.segments[S*l+M]=!0,this.segments[M*l+S]=!0):T!==A&&T!==L&&T!==P||(this.segments[S*l+T]=!0,this.segments[T*l+S]=!0))}}var R=this.tempPlane_Cut;e.updateMatrix(),c.transformPlaneToLocalSpace(t,e.matrix,R);for(y=0;y<h;y++)for(var C=d(y,0),O=d(y,1),D=d(y,2),I=0;I<3;I++){var N=0===I?C:1===I?O:D,B=0===I?O:1===I?D:C;if(!this.segments[N*l+B]){this.segments[N*l+B]=!0,this.segments[B*l+N]=!0,x.set(i[3*N],i[3*N+1],i[3*N+2]),b.set(i[3*B],i[3*B+1],i[3*B+2]);var F=0;(z=R.distanceToPoint(x))>v?(F=2,m.push(x.clone())):z<-v?(F=1,f.push(x.clone())):(F=3,f.push(x.clone()),m.push(x.clone()));var z,U=0;if((z=R.distanceToPoint(b))>v?(U=2,m.push(b.clone())):z<-v?(U=1,f.push(b.clone())):(U=3,f.push(b.clone()),m.push(b.clone())),1===F&&2===U||2===F&&1===U){this.tempLine1.start.copy(x),this.tempLine1.end.copy(b);var G=new o.Vector3;if(void 0===(G=R.intersectLine(this.tempLine1,G)))return console.error("Internal error: segment does not intersect plane."),n.segmentedObject1=null,n.segmentedObject2=null,0;f.push(G),m.push(G.clone())}}}var k=.5*e.userData.mass;this.tempCM1.set(0,0,0);var V=0,H=f.length;if(H>0){for(y=0;y<H;y++)this.tempCM1.add(f[y]);this.tempCM1.divideScalar(H);for(y=0;y<H;y++){(q=f[y]).sub(this.tempCM1),V=Math.max(V,q.x,q.y,q.z)}this.tempCM1.add(e.position)}this.tempCM2.set(0,0,0);var j=0,W=m.length;if(W>0){for(y=0;y<W;y++)this.tempCM2.add(m[y]);this.tempCM2.divideScalar(W);for(y=0;y<W;y++){var q;(q=m[y]).sub(this.tempCM2),j=Math.max(j,q.x,q.y,q.z)}this.tempCM2.add(e.position)}var X=null,Y=null,Z=0;if(H>4)try{(X=new o.Mesh(new a.ConvexBufferGeometry(f),e.material)).position.copy(this.tempCM1),X.quaternion.copy(e.quaternion),this.prepareBreakableObject(X,k,e.userData.velocity,e.userData.angularVelocity,2*V>this.minSizeForBreak),Z++}catch(e){s.default("Error in ConvexObjectBreaker.ts")}if(W>4)try{(Y=new o.Mesh(new a.ConvexBufferGeometry(m),e.material)).position.copy(this.tempCM2),Y.quaternion.copy(e.quaternion),this.prepareBreakableObject(Y,k,e.userData.velocity,e.userData.angularVelocity,2*j>this.minSizeForBreak),Z++}catch(e){s.default("Error in ConvexObjectBreaker.ts")}return n.object1=X,n.object2=Y,Z}},c.transformFreeVector=function(e,t){var n=e.x,r=e.y,i=e.z,o=t.elements;return e.x=o[0]*n+o[4]*r+o[8]*i,e.y=o[1]*n+o[5]*r+o[9]*i,e.z=o[2]*n+o[6]*r+o[10]*i,e},c.transformFreeVectorInverse=function(e,t){var n=e.x,r=e.y,i=e.z,o=t.elements;return e.x=o[0]*n+o[1]*r+o[2]*i,e.y=o[4]*n+o[5]*r+o[6]*i,e.z=o[8]*n+o[9]*r+o[10]*i,e},c.transformTiedVectorInverse=function(e,t){var n=e.x,r=e.y,i=e.z,o=t.elements;return e.x=o[0]*n+o[1]*r+o[2]*i-o[12],e.y=o[4]*n+o[5]*r+o[6]*i-o[13],e.z=o[8]*n+o[9]*r+o[10]*i-o[14],e},c.transformPlaneToLocalSpace=(i=new o.Vector3,function(e,t,n){n.normal.copy(e.normal),n.constant=e.constant;var r=c.transformTiedVectorInverse(e.coplanarPoint(i),t);c.transformFreeVectorInverse(n.normal,t),n.constant=-r.dot(n.normal)})},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(34)),o=r(n(35)),a=r(n(36)),s=function(){function e(e){this.physics=e}return e.prototype.setRayFromWorld=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this._btRayFrom.setValue(e,t,n)},e.prototype.setRayToWorld=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this._btRayTo.setValue(e,t,n)},e.prototype.hasHit=function(){return this._btRayCallback.hasHit()},e.prototype.rayTest=function(){void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback),this._btRayCallback="closest"===this.type?new Ammo.ClosestRayResultCallback(this._btRayFrom,this._btRayTo):new Ammo.AllHitsRayResultCallback(this._btRayFrom,this._btRayTo),this.physics.physicsWorld.rayTest(this._btRayFrom,this._btRayTo,this._btRayCallback)},e.prototype.destroy=function(){void 0!==this._btRayFrom&&Ammo.destroy(this._btRayFrom),void 0!==this._btRayTo&&Ammo.destroy(this._btRayTo),void 0!==this._btRayCallback&&Ammo.destroy(this._btRayCallback)},e}(),c=function(e){this.physics=e,this.type="closest",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)};t.ClosestRaycaster=c;var u=function(e){this.physics=e,this.type="allHits",this._btRayFrom=new Ammo.btVector3(0,0,0),this._btRayTo=new Ammo.btVector3(0,0,0)};t.AllHitsRaycaster=u,i.default(c,[s,o.default]),i.default(u,[s,a.default])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,t){t.forEach((function(t){Object.getOwnPropertyNames(t.prototype).forEach((function(n){Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))}))}))}},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.physics=e}return e.prototype.getHitPointWorld=function(){var e=this._btRayCallback.get_m_hitPointWorld();return{x:e.x(),y:e.y(),z:e.z()}},e.prototype.getHitNormalWorld=function(){var e=this._btRayCallback.get_m_hitNormalWorld();return{x:e.x(),y:e.y(),z:e.z()}},e.prototype.getCollisionObject=function(){var e,t=(e=this._btRayCallback.get_m_collisionObject(),Object.values(e)[0]);return this.physics.objectsAmmo[t]},e}();t.default=r},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.physics=e}return e.prototype.getHitPointsWorld=function(){for(var e=this._btRayCallback.get_m_hitPointWorld(),t=[],n=e.size()-1;n>=0;n--){var r=e.at(n);t.push({x:r.x(),y:r.y(),z:r.z()})}return t},e.prototype.getHitPointWorld=function(){return console.warn("[enable3d] Use getHitPointsWorld() instead of getHitPointWorld() for the AllHitsRayCaster!"),this.getHitPointsWorld()},e.prototype.getHitNormalsWorld=function(){for(var e=this._btRayCallback.get_m_hitNormalWorld(),t=[],n=e.size()-1;n>=0;n--){var r=e.at(n);t.push({x:r.x(),y:r.y(),z:r.z()})}return t},e.prototype.getCollisionObjects=function(){for(var e,t=[],n=this._btRayCallback.get_m_collisionObjects(),r=n.size()-1;r>=0;r--){var i=(e=n.at(r),Object.values(e)[0]);t.push(this.physics.objectsAmmo[i])}return t},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){void 0===e&&(e=!0),this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return e.prototype.start=function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},e.prototype.stop=function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},e.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},e.prototype.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},e}();t.Clock=r},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(){function e(e,t){this.cache=e,this.textureAnisotropy=t}return Object.defineProperty(e.prototype,"fileLoader",{get:function(){return this._fileLoader||(this._fileLoader=new o.FileLoader),this._fileLoader},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageLoader",{get:function(){return this._imgLoader||(this._imgLoader=new o.ImageLoader),this._imgLoader},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"svgLoader",{get:function(){return this._svgLoader||(this._svgLoader=new o.SVGLoader),this._svgLoader},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureLoader",{get:function(){return this._textureLoader||(this._textureLoader=new o.TextureLoader),this._textureLoader},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gltfLoader",{get:function(){return this._gltfLoader||(this._gltfLoader=new o.GLTFLoader),this._gltfLoader},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fbxLoader",{get:function(){return this._fbxLoader||(this._fbxLoader=new o.FBXLoader),this._fbxLoader},enumerable:!0,configurable:!0}),e.prototype.preload=function(e,t){return r(this,void 0,void 0,(function(){var n=this;return i(this,(function(r){return this.cache.add(e,t),[2,new Promise((function(e){var r=/\.fbx$|\.glb$|\.gltf$/.test(t);/\.jpe?g$|\.png$/.test(t)?n.textureLoader.load(t,(function(t){return e(t)})):(r&&n.fileLoader.setResponseType("arraybuffer"),n.fileLoader.load(t,(function(t){return e(t)})))}))]}))}))},e.prototype.file=function(e){var t=this,n=this.cache.get(e);return e=n||e,new Promise((function(n){t.fileLoader.load(e,(function(e){return n(e)}))}))},e.prototype.svg=function(e){var t=this,n=this.cache.get(e);return e=n||e,new Promise((function(n){t.svgLoader.load(e,(function(e){return n(e)}))}))},e.prototype.texture=function(e){var t=this,n=this.cache.get(e);return e=n||e,new Promise((function(n){t.textureLoader.load(e,(function(e){e.anisotropy=t.textureAnisotropy,e.format=o.RGBAFormat,e.needsUpdate=!0,e.anisotropy=t.textureAnisotropy,n(e)}))}))},e.prototype.gltf=function(e){var t=this,n=this.cache.get(e);return e=n||e,new Promise((function(n){t.gltfLoader.load(e,(function(e){n(e)}))}))},e.prototype.fbx=function(e){var t=this,n=this.cache.get(e);return e=n||e,new Promise((function(n){t.fbxLoader.load(e,(function(e){n(e)}))}))},e}();t.default=a},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=n(0),s=n(0),c=function(e){function t(t,n,r,i){var a=e.call(this)||this;return a.scene=t,a.light=n,a.size=r,a.color=i,a.geo=new o.SphereBufferGeometry(r||.2,16,8),a.mat=new o.MeshBasicMaterial({color:i||n.color}),a.mesh=new o.Mesh(a.geo,a.mat),a.add(a.mesh),n.add(a),a}return i(t,e),t.prototype.dispose=function(){this.mesh.geometry.dispose(),Array.isArray(this.mesh.material)?this.mesh.material.forEach((function(e){return e.dispose()})):this.mesh.material.dispose(),this.remove(this.mesh)},t.prototype.update=function(){},t}(o.Object3D),u=function(){function e(e){this.scene=e}return Object.defineProperty(e.prototype,"helper",{get:function(){var e=this;return{directionalLightHelper:function(t,n,r){var i=new s.DirectionalLightHelper(t,n,r);return e.scene.add(i),i},spotLightHelper:function(t,n){var r=new s.SpotLightHelper(t,n);return e.scene.add(r),r},pointLightHelper:function(t,n,r){return new c(e.scene,t,n,r)}}},enumerable:!0,configurable:!0}),e.prototype.directionalLight=function(e){void 0===e&&(e={});var t=e.color,n=void 0===t?16777215:t,r=e.intensity,i=void 0===r?1:r,o=new a.DirectionalLight(n,i);return o.castShadow=!0,this.scene.add(o),o},e.prototype.hemisphereLight=function(e){void 0===e&&(e={});var t=e.skyColor,n=void 0===t?16777215:t,r=e.groundColor,i=void 0===r?16777215:r,o=e.intensity,s=void 0===o?1:o,c=new a.HemisphereLight(n,i,s);return this.scene.add(c),c},e.prototype.ambientLight=function(e){void 0===e&&(e={});var t=e.color,n=void 0===t?16777215:t,r=e.intensity,i=void 0===r?1:r,o=new a.AmbientLight(n,i);return this.scene.add(o),o},e.prototype.pointLight=function(e){void 0===e&&(e={});var t=e.color,n=void 0===t?16777215:t,r=e.intensity,i=void 0===r?1:r,o=e.distance,s=void 0===o?0:o,c=e.decay,u=void 0===c?1:c,l=new a.PointLight(n,i,s,u);return l.castShadow=!0,this.scene.add(l),l},e.prototype.spotLight=function(e){void 0===e&&(e={});var t=e.color,n=void 0===t?16777215:t,r=e.intensity,i=void 0===r?1:r,o=e.distance,s=void 0===o?0:o,c=e.angle,u=void 0===c?Math.PI/8:c,l=e.penumbra,h=void 0===l?0:l,p=e.decay,d=void 0===p?1:p,f=new a.SpotLight(n,i,s,u,h,d);return f.castShadow=!0,this.scene.add(f),f},e.prototype.rectAreaLight=function(e){void 0===e&&(e={});var t=e.color,n=void 0===t?16777215:t,r=e.intensity,i=void 0===r?1:r,o=e.width,s=void 0===o?10:o,c=e.height,u=void 0===c?10:c,l=new a.RectAreaLight(n,i,s,u);return this.scene.add(l),l},e}();t.default=u},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=function(){function e(e,t){this.scene=e,this.transform=t}return e.prototype.toGeometry=function(e,t){e.geometry=this.transform.bufferGeometryToGeometry(e.geometry),t.geometry=this.transform.bufferGeometryToGeometry(t.geometry)},e.prototype.toBufferGeometry=function(e){e.geometry=this.transform.geometryToBufferGeometry(e.geometry)},e.prototype.union=function(e,t){this.toGeometry(e,t);var n=this.doCSG(e,t,"union");return this.toBufferGeometry(n),this.scene.add(n),n},e.prototype.subtract=function(e,t){this.toGeometry(e,t);var n=this.doCSG(e,t,"subtract");return this.toBufferGeometry(n),this.scene.add(n),n},e.prototype.intersect=function(e,t){this.toGeometry(e,t);var n=this.doCSG(e,t,"intersect");return this.toBufferGeometry(n),this.scene.add(n),n},e.prototype.doCSG=function(e,t,n){e.updateMatrix(),t.updateMatrix();var r=s.fromMesh(e),i=s.fromMesh(t),o=r[n](i);return s.toMesh(o,e.matrix)},e}();t.default=a;var s=function(){function e(){this.polygons=[]}return e.fromPolygons=function(t){var n=new e;return n.polygons=t,n},e.fromGeometry=function(t){t.isBufferGeometry&&(t=(new o.Geometry).fromBufferGeometry(t));for(var n=t.faces,r=t.vertices,i=[],a=["a","b","c"],s=0;s<n.length;s++){for(var c=n[s],l=[],p=0;p<3;p++){var d=void 0!==t.faceVertexUvs[0][s]&&void 0!==t.faceVertexUvs[0][s][p]?t.faceVertexUvs[0][s][p]:void 0;l.push(new u(r[c[a[p]]],c.vertexNormals[p],d))}i.push(new h(l))}return e.fromPolygons(i)},e.fromMesh=function(t){var n=e.fromGeometry(t.geometry);e._tmpm3.getNormalMatrix(t.matrix);for(var r=0,i=n.polygons;r<i.length;r++)for(var o=0,a=i[r].vertices;o<a.length;o++){var s=a[o];s.pos.applyMatrix4(t.matrix),s.normal.applyMatrix3(e._tmpm3)}return n},e.toMesh=function(e,t){for(var n=new o.Geometry,r=e.polygons,i=n.vertices,a=n.faceVertexUvs[0],s=0,c=r;s<c.length;s++){for(var u=c[s],l=u.vertices,h=i.length,p=l.length,d=0,f=l;d<f.length;d++){var m=f[d];i.push((new o.Vector3).copy(m.pos))}for(var v=3;v<=p;v++){var g=new o.Face3(h,h+v-2,h+v-1),y=[];a.push(y);var x=g.vertexNormals;x.push((new o.Vector3).copy(l[0].normal)),x.push((new o.Vector3).copy(l[v-2].normal)),x.push((new o.Vector3).copy(l[v-1].normal)),l[0].uv&&l[v-2].uv&&l[v-1].uv&&(y.push((new o.Vector3).copy(l[0].uv)),y.push((new o.Vector3).copy(l[v-2].uv)),y.push((new o.Vector3).copy(l[v-1].uv))),g.normal=(new o.Vector3).copy(u.plane.normal),n.faces.push(g)}}var b=(new o.Matrix4).getInverse(t);n.applyMatrix4(b),n.verticesNeedUpdate=n.elementsNeedUpdate=n.normalsNeedUpdate=!0,n.computeBoundingSphere(),n.computeBoundingBox();var w=new o.Mesh(n);return w.matrix.copy(t),w.matrix.decompose(w.position,w.rotation,w.scale),w.updateMatrixWorld(),w},e.iEval=function(t,n){var r;if(void 0===n&&(n=0),"string"==typeof t)e.currentOp=t;else if(t instanceof Array)for(var i=0,o=t;i<o.length;i++){var a=o[i];e.iEval(a,0)}else if("object"==typeof t){var s=e.currentOp;t.updateMatrix(),t.updateMatrixWorld(),e.sourceMesh?(e.nextPrim=e.fromMesh(t),e.currentPrim=e.currentPrim[s](e.nextPrim)):e.currentPrim=e.fromMesh(e.sourceMesh=t),e.doRemove&&(null===(r=null==t?void 0:t.parent)||void 0===r||r.remove(t))}},e.eval=function(t,n){delete e.currentOp,delete e.sourceMesh,e.doRemove=n,e.iEval(t);var r=e.toMesh(e.currentPrim,e.sourceMesh.matrix);return r.material=e.sourceMesh.material,r.castShadow=r.receiveShadow=!0,r},e.prototype.clone=function(){var t=new e;return t.polygons=this.polygons.map((function(e){return e.clone()})),t},e.prototype.toPolygons=function(){return this.polygons},e.prototype.union=function(t){var n=new p(this.clone().polygons),r=new p(t.clone().polygons);return n.clipTo(r),r.clipTo(n),r.invert(),r.clipTo(n),r.invert(),n.build(r.allPolygons()),e.fromPolygons(n.allPolygons())},e.prototype.subtract=function(t){var n=new p(this.clone().polygons),r=new p(t.clone().polygons);return n.invert(),n.clipTo(r),r.clipTo(n),r.invert(),r.clipTo(n),r.invert(),n.build(r.allPolygons()),n.invert(),e.fromPolygons(n.allPolygons())},e.prototype.intersect=function(t){var n=new p(this.clone().polygons),r=new p(t.clone().polygons);return n.invert(),r.clipTo(n),r.invert(),n.clipTo(r),r.clipTo(n),n.build(r.allPolygons()),n.invert(),e.fromPolygons(n.allPolygons())},e.prototype.inverse=function(){var e=this.clone();return e.polygons.map((function(e){e.flip()})),e},e._tmpm3=new o.Matrix3,e}(),c=function(e){function t(t,n,r){var i=this;if(3===arguments.length)i=e.call(this,t,n,r)||this;else if(Array.isArray(t))i=e.call(this,t[0],t[1],t[2])||this;else{if("object"!=typeof t)throw new Error("Invalid constructor to vector");i.copy(t)}return i}return i(t,e),t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.negated=function(){return this.clone().multiplyScalar(-1)},t.prototype.plus=function(e){return this.clone().add(e)},t.prototype.minus=function(e){return this.clone().sub(e)},t.prototype.times=function(e){return this.clone().multiplyScalar(e)},t.prototype.dividedBy=function(e){return this.clone().divideScalar(e)},t.prototype.lerp=function(e,t){return this.plus(e.minus(this).times(t))},t.prototype.unit=function(){return this.dividedBy(this.length())},t.prototype.cross=function(e,t){return o.Vector3.prototype.cross.call(this.clone(),e)},t}(o.Vector3),u=function(){function e(e,t,n){this.pos=new c(e.x,e.y,e.z),this.normal=new c(t.x,t.y,t.z),n&&(this.uv=new c(n.x,n.y,n.z))}return e.prototype.clone=function(){return new e(this.pos.clone(),this.normal.clone(),this.uv?this.uv.clone():void 0)},e.prototype.flip=function(){this.normal=this.normal.negated()},e.prototype.interpolate=function(t,n){return new e(this.pos.lerp(t.pos,n),this.normal.lerp(t.normal,n),this.uv?this.uv.lerp(t.uv,n):void 0)},e}(),l=function(){function e(e,t){this.normal=e,this.w=t}return e.fromPoints=function(t,n,r){var i=n.minus(t).cross(r.minus(t)).unit();return new e(i,i.dot(t))},e.prototype.clone=function(){return new e(this.normal.clone(),this.w)},e.prototype.flip=function(){this.normal=this.normal.negated(),this.w=-this.w},e.prototype.splitPolygon=function(t,n,r,i,o){for(var a=0,s=[],c=0,u=t.vertices;c<u.length;c++){var l=u[c],p=(w=this.normal.dot(l.pos)-this.w)<-e.EPSILON?2:w>e.EPSILON?1:0;a|=p,s.push(p)}switch(a){case 0:(this.normal.dot(t.plane.normal)>0?n:r).push(t);break;case 1:i.push(t);break;case 2:o.push(t);break;case 3:for(var d=[],f=[],m=0;m<t.vertices.length;m++){var v=(m+1)%t.vertices.length,g=s[m],y=s[v],x=t.vertices[m],b=t.vertices[v];if(2!==g&&d.push(x),1!==g&&f.push(2!==g?x.clone():x),3==(g|y)){var w=(this.w-this.normal.dot(x.pos))/this.normal.dot(b.pos.minus(x.pos)),_=x.interpolate(b,w);d.push(_),f.push(_.clone())}}d.length>=3&&i.push(new h(d,t.shared)),f.length>=3&&o.push(new h(f,t.shared))}},e.EPSILON=1e-5,e}(),h=function(){function e(e,t){void 0===t&&(t=null),this.vertices=e,this.shared=t,this.plane=l.fromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map((function(e){return e.clone()})),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map((function(e){e.flip()})),this.plane.flip()},e}(),p=function(){function e(e){delete this.plane,delete this.front,delete this.back,this.polygons=[],e&&this.build(e)}return e.prototype.clone=function(){var t=new e;return t.plane=this.plane&&this.plane.clone(),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t.polygons=this.polygons.map((function(e){return e.clone()})),t},e.prototype.invert=function(){for(var e=0,t=this.polygons;e<t.length;e++){t[e].flip()}this.plane.flip(),this.front&&this.front.invert(),this.back&&this.back.invert();var n=this.front;this.front=this.back,this.back=n},e.prototype.clipPolygons=function(e){if(!this.plane)return e.slice();for(var t=[],n=[],r=0,i=e;r<i.length;r++){var o=i[r];this.plane.splitPolygon(o,t,n,t,n)}return this.front&&(t=this.front.clipPolygons(t)),n=this.back?this.back.clipPolygons(n):[],t.concat(n)},e.prototype.clipTo=function(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)},e.prototype.allPolygons=function(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e},e.prototype.build=function(t){if(t.length){this.plane||(this.plane=t[0].plane.clone());for(var n=[],r=[],i=0,o=t;i<o.length;i++){var a=o[i];this.plane.splitPolygon(a,this.polygons,this.polygons,n,r)}n.length&&(this.front||(this.front=new e),this.front.build(n)),r.length&&(this.back||(this.back=new e),this.back.build(r))}},e}()},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),a=n(2),s=i(n(3)),c=function(){function e(e){this.scene=e}return e.prototype.add=function(e,t){void 0===t&&(t={});var n=this.make(e,t);return n?this.scene.add(n):s.default("Could not make heightmap"),n},e.prototype.make=function(e,t){void 0===t&&(t={});var n=e.image,i=n.width,s=n.height,c=t.colorScale,u=document.createElement("canvas");u.width=i,u.height=s;var l=u.getContext("2d");if(l){l.drawImage(e.image,0,0);var h=l.getImageData(0,0,i,s),p=new o.PlaneGeometry(10,10,i-1,s-1),d={color:13421772,side:o.DoubleSide};c&&(d=r(r({},d),{vertexColors:o.FaceColors}));var f=new o.MeshPhongMaterial(d),m=new a.ExtendedMesh(p,f);m.receiveShadow=m.castShadow=!0,m.shape="concave";for(var v=m.geometry,g=0;g<v.vertices.length;g++)v.vertices[g].z=h.data[4*g]/120;return c&&v.faces.forEach((function(e){return e.color=new o.Color(c(function(e,t){var n=e.vertices[t.a].z,r=e.vertices[t.b].z,i=e.vertices[t.c].z;return Math.max(n,r,i)}(v,e)).hex())})),m.rotateX(-Math.PI/2),m.updateMatrix(),p.computeFaceNormals(),p.computeVertexNormals(),m.name="heightmap",m}},e}();t.default=c},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),c=a(n(0)),u=function(){function e(e,t,n,r,i,o,a){this.scene=e,this.renderer=t,this.camera=n,this.lights=r,this.physics=i,this.load=o,this.factories=a}return e.prototype.warpSpeed=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){var t,n,i,a,u,l,h,p,d,f,m,v,g,y,x,b,w;return o(this,(function(o){switch(o.label){case 0:return t={},n=e.filter((function(e){return/^-\w+/.test(e)})),i=n.length>0,(0===e.length||i)&&(e=["light","camera","lookAtCenter","ground","grid","orbitControls","fog","sky"]),i&&n.map((function(e){return e.substr(1)})).forEach((function(t){var n=e.indexOf(t);e.splice(n,1)})),e.includes("fog"),e.includes("sky")&&((a=new s.Sky).scale.setScalar(45e4),this.scene.add(a),(u=new c.Mesh(new c.SphereBufferGeometry(2e4,16,8),new c.MeshBasicMaterial({color:16777215}))).position.y=-7e5,u.visible=!1,this.scene.add(u),l={turbidity:10,rayleigh:2,mieCoefficient:.005,mieDirectionalG:.8,luminance:1,inclination:.25,azimuth:.25,sun:!1},4e5,(h=a.material.uniforms).turbidity.value=l.turbidity,h.rayleigh.value=l.rayleigh,h.mieCoefficient.value=l.mieCoefficient,h.mieDirectionalG.value=l.mieDirectionalG,h.luminance.value=l.luminance,p=Math.PI*(l.inclination-.5),d=2*Math.PI*(l.azimuth-.5),u.position.x=4e5*Math.cos(d),u.position.y=4e5*Math.sin(d)*Math.sin(p),u.position.z=4e5*Math.sin(d)*Math.cos(p),u.visible=l.sun,h.sunPosition.value.copy(u.position)),e.includes("camera")&&(this.camera.position.set(5,5,10),t=r({camera:this.camera},t)),e.includes("light")&&(f=this.lights.ambientLight({color:13421772}),(m=this.lights.directionalLight({color:16777215,intensity:.5})).position.set(-10,18,5),20,m.shadow.camera.top=20,m.shadow.camera.bottom=-20,m.shadow.camera.left=-20,m.shadow.camera.right=20,m.shadow.mapSize.set(1024,1024),t=r({lights:{ambientLight:f,directionalLight:m}},t)),e.includes("lookAtCenter")&&this.camera.lookAt(this.scene.position),e.includes("ground")?(v=e.includes("grid"),"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOnAAADusBZ+q87AAAAJtJREFUeJzt0EENwDAAxLDbNP6UOxh+NEYQ5dl2drFv286598GrA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAu37AD8eaBH5JQdVbAAAAAElFTkSuQmCC",[4,this.load.texture("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOnAAADusBZ+q87AAAAJtJREFUeJzt0EENwDAAxLDbNP6UOxh+NEYQ5dl2drFv286598GrA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAa4AO0BqgA7QG6ACtATpAu37AD8eaBH5JQdVbAAAAAElFTkSuQmCC")]):[3,2];case 1:(g=o.sent()).wrapS=g.wrapT=c.RepeatWrapping,g.repeat.set(21,21),y={name:"ground",width:21,height:21,depth:1,y:-.5},x={phong:{map:v?g:null,transparent:!0,opacity:.8,color:16777215}},b=void 0,window.__loadPhysics?(b=this.physics.add.ground(y,x)).body.setRestitution(1):b=this.factories.add.ground(y,x),b.receiveShadow=!0,t=r({ground:b},t),o.label=2;case 2:return e.includes("orbitControls")&&(w=new s.OrbitControls(this.camera,this.renderer.domElement),t=r({orbitControls:w},t)),[2,t]}}))}))},e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),i=function(){function e(){this._mixers=[]}return e.prototype.animationMixer=function(e){var t=new r.AnimationMixer(e);return this.mixers.add(t),t},Object.defineProperty(e.prototype,"mixers",{get:function(){var e=this;return{create:function(t){return e.animationMixer(t)},add:function(t){return e._mixers.push(t)},get:function(){return e._mixers},update:function(t){var n;return null===(n=e._mixers)||void 0===n?void 0:n.forEach((function(e){return e.update(t/1e3)}))}}},enumerable:!0,configurable:!0}),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45),i=n(0),o=function(){function e(e,t,n){this.scene=e,this.renderer=t,this.factories=n}return e.prototype.water=function(e){void 0===e&&(e={}),r.addWater(this.scene,this.renderer,e)},e.prototype.textureCube=function(e){var t=this;6!==e.length&&console.log("[enable3d] You need to pass 6 urls to textureCube()");var n=new a;return e.forEach((function(e,r){e.wrapS=e.wrapT=i.RepeatWrapping;var o=t.factories.add.material({phong:{map:e}});n.materials[r]=o})),n},e}();t.default=o;var a=function(){function e(){this.materials=new Array(6)}return Object.defineProperty(e.prototype,"texture",{get:function(){return{left:this.getTexture(0),right:this.getTexture(1),up:this.getTexture(2),down:this.getTexture(3),front:this.getTexture(4),back:this.getTexture(5)}},enumerable:!0,configurable:!0}),e.prototype.getTexture=function(e){return this.materials[e].map},e}();t.TextureCube=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.addWater=function(e,t,n){void 0===n&&(n={});var i=n.width,o=void 0===i?20:i,a=n.height,s=void 0===a?20:a,c=n.x,u=void 0===c?0:c,l=n.y,h=void 0===l?0:l,p=n.z,d=void 0===p?0:p,f=n.color,m=void 0===f?"#ffffff":f,v=n.scale,g=void 0===v?4:v,y=n.flowX,x=void 0===y?1:y,b=n.flowY,w=void 0===b?1:b,_=n.normalMap0,M=void 0===_?void 0:_,T=n.normalMap1,S=void 0===T?void 0:T,E=new r.PlaneBufferGeometry(o,s),A=new r.MeshStandardMaterial({color:30654,transparent:!0,opacity:.8}),L=new r.Mesh(E,A);L.position.set(u,h,d),L.rotation.x=-.5*Math.PI,e.add(L);var P=new r.PlaneBufferGeometry(o,s),R=new r.Water(P,{color:m,scale:g,flowDirection:new r.Vector2(x,w),textureWidth:1024,textureHeight:1024,normalMap0:M,normalMap1:S,encoding:t.outputEncoding});return R.position.set(u,h+.1,d),R.rotation.x=-.5*Math.PI,e.add(R),{ground:L,water:R}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(0),o=function(){function e(e,t){this.camera=e,this.renderer=t}return e.prototype.geometryToBufferGeometry=function(e){return e.isGeometry?(new r.BufferGeometry).fromGeometry(e):e},e.prototype.bufferGeometryToGeometry=function(e){return e.isBufferGeometry?(new r.Geometry).fromBufferGeometry(e):e},e.prototype.fromSVGtoShape=function(e,t,n){if(void 0===t&&(t=!1),e){var r=new i.SVGLoader,o=[];return r.parse(e).paths.forEach((function(e){e.toShapes(t,n).forEach((function(e){o.push(e)}))})),o}return[]},e.prototype.from3dto2d=function(e){var t=new r.Vector3(e.x,e.y,e.z),n=this.renderer.domElement;this.camera.updateMatrixWorld(),t.project(this.camera);var i=Math.round((t.x+1)*(n.width/2)),o=Math.round((1-t.y)*(n.height/2));return new r.Vector2(i,o)},e.prototype.from2dto3d=function(e,t,n){void 0===n&&(n=0);var i=this.getPixelsPerSquare(n),o=this.renderer.domElement,a=o.width/2/i,s=o.height/2/i;return new r.Vector3(-(a-e/i),s-t/i,n)},e.prototype.getPixelsPerSquare=function(e){void 0===e&&(e=0);var t=this.from3dto2d(new r.Vector3(0,0,e)),n=this.from3dto2d(new r.Vector3(1,0,e));return Math.abs(t.x-n.x)},e}();t.default=o},function(e,t,n){"use strict";
  /**
   * @author       Yannick Deubel (https://github.com/yandeu)
   * @copyright    Copyright (c) 2020 Yannick Deubel; Project Url: https://github.com/enable3d/enable3d
   * @license      {@link https://github.com/enable3d/enable3d/blob/master/LICENSE|GNU GPLv3}
   */var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(0)),o=function(){function e(e,t,n){this._renderer=e,this._camera=t,this.cameraObject=n}return e.Enable=function(t,n){var r=new i.SphereGeometry(.1),o=new i.MeshLambertMaterial({transparent:!0,opacity:.5,color:16711680}),a=new i.Mesh(r,o);a.position.set(0,5,2),t.xr.enabled=!0;var s=new e(t,n,a);s.addCamera();var c=i.VRButton.createButton(t);return c.style.cssText+="background: rgba(0, 0, 0, 0.8); ",document.body.appendChild(c),s},e.prototype.addCamera=function(){this.cameraObject.add(this._camera)},Object.defineProperty(e.prototype,"isPresenting",{get:function(){var e,t;return!!(null===(t=null===(e=this._renderer)||void 0===e?void 0:e.xr)||void 0===t?void 0:t.isPresenting)},enumerable:!0,configurable:!0}),e.prototype.getController=function(e){return this._renderer.xr.getController(e)},Object.defineProperty(e.prototype,"camera",{get:function(){return this.WebXRCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"WebXRCamera",{get:function(){var e,t=this;return{object3D:this.cameraObject,position:null===(e=this.cameraObject)||void 0===e?void 0:e.position,rotation:this.isPresenting?this._renderer.xr.getCamera(this._camera).rotation:void 0,getWorldDirection:function(e){return t.isPresenting?t._renderer.xr.getCamera(t._camera).getWorldDirection(e):void 0}}},enumerable:!0,configurable:!0}),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e,t){var n,r;if(void 0===e&&(e=20),window.__loadPhysics)for(var i=0;i<e;i++){var o=["standard","basic","normal","phong","line","points"],a=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},s=function(e){return e[Math.floor(Math.random()*e.length)]};Math.random()>.5?t.add.box({x:a(-10,10),y:a(10,20),z:a(-10,10),width:a(1,2)/10,height:a(1,2)/10,depth:a(1,2)/10,mass:1},(n={},n[s(o)]={color:Math.floor(16777215*Math.random())},n)).body.setRestitution(Math.floor(10*Math.random())/20):t.add.sphere({x:a(-10,10),y:a(10,20),z:a(-10,10),radius:a(1,2)/10,mass:1},(r={},r[s(o)]={color:Math.floor(16777215*Math.random())},r)).body.setRestitution(Math.floor(10*Math.random())/20)}else console.log("There is not much fun without physics enabled!")}},function(e,t,n){"use strict";n.r(t),n.d(t,"Scene3D",(function(){return f})),n.d(t,"enable3d",(function(){return g})),n.d(t,"PhysicsLoader",(function(){return y.PhysicsLoader})),n.d(t,"Canvas",(function(){return b.a})),n.d(t,"ExtendedMesh",(function(){return w.ExtendedMesh})),n.d(t,"ExtendedObject3D",(function(){return _.ExtendedObject3D})),n.d(t,"ExtendedGroup",(function(){return M.ExtendedGroup})),n.d(t,"THREE",(function(){return T})),n.d(t,"Types",(function(){return S})),n.d(t,"JoyStick",(function(){return E.JoyStick})),n.d(t,"ThirdPersonControls",(function(){return A.ThirdPersonControls})),n.d(t,"FirstPersonControls",(function(){return L.FirstPersonControls})),n.d(t,"PointerLock",(function(){return P.PointerLock})),n.d(t,"PointerDrag",(function(){return R.PointerDrag}));var r,i=n(9),o=n(1),a=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},c=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},u=function(e){function t(t,n){void 0===n&&(n={});var r=this;n.renderer=new i.WebGLRenderer({canvas:t.sys.game.canvas,context:t.sys.game.context}),r=e.call(this,n)||this;var a=n.enableXR,s=void 0!==a&&a;if(r.isXrEnabled=s,r.renderer.autoClear=!1,r.scene3D=t,s&&(r.webXR=o.WebXR.Enable(r.renderer,r.camera)),r.isXrEnabled){var c=0;r.renderer.setAnimationLoop((function(e){if(r.renderer.xr.isPresenting){var n=e-c;c=e,t.updateLoopXR(e,n),r.renderer.state.reset(),r.renderer.render(r.scene,r.camera)}}))}return r.isXrEnabled||t.events.on("postupdate",(function(e,t){var n,i,o;null===(n=r.animationMixers)||void 0===n||n.update(t),null===(i=r.physics)||void 0===i||i.update(t),null===(o=r.physics)||void 0===o||o.updateDebugger()})),t.add.extern().render=function(e){r.renderer.xr.isPresenting||(t.updateLoopXR(t.sys.game.loop.time,t.sys.game.loop.delta),r.renderer.state.reset(),r.renderer.render(r.scene,r.camera))},r.load=new o.Loaders(r.cache,r.textureAnisotropy),r.lights=new o.Lights(r.scene),r.transform=new o.Transform(r.camera,r.renderer),r.csg=new o.CSG(r.scene,r.transform),r.heightMap=new o.HeightMap(r.scene),r.factories=new o.Factories(r.scene),r.misc=new o.Misc(r.scene,r.renderer,r.factories),r.cameras=new o.Cameras,r.ws=new o.WarpSpeed(r.scene,r.renderer,r.camera,r.lights,r.physics,r.load,r.factories),r.mixers=new o.Mixers,t.events.once("shutdown",(function(){t.events.removeListener("update")})),r}return a(t,e),t.prototype.destroy=function(e){var t;null===(t=this.physics)||void 0===t||t.destroy(e.body),this.scene.remove(e),e=null},t.prototype.warpSpeed=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(this,void 0,void 0,(function(){var t;return c(this,(function(n){switch(n.label){case 0:return[4,(t=this.ws).warpSpeed.apply(t,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.haveSomeFun=function(e){void 0===e&&(e=20),o.HaveSomeFun(e,this.physics)},Object.defineProperty(t.prototype,"animationMixers",{get:function(){var e;return null===(e=this.mixers)||void 0===e?void 0:e.mixers},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"make",{get:function(){return this.factories.make},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"add",{get:function(){return this.factories.add},enumerable:!0,configurable:!0}),t}(i.ThreeGraphics),l=n(21),h=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},f=function(e){function t(t){return e.call(this,t)||this}return h(t,e),t.prototype.warpSpeed=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,(t=this.third).warpSpeed.apply(t,e)];case 1:return[2,n.sent()]}}))}))},t.prototype.haveSomeFun=function(e){void 0===e&&(e=20),this.third.haveSomeFun(e)},t.prototype.requestThirdDimension=function(){console.warn("[enable3d] You do not need requestThirdDimension() anymore. Place accessThirdDimension() inside init() instead!")},t.prototype.accessThirdDimension=function(e){for(var t in void 0===e&&(e={}),this.cameras.main.setBackgroundColor(16777215),this.third)delete this.third[t];delete this.third,this.third=new u(this,e)},t.prototype.updateLoopXR=function(e,t){this.preUpdateXR(e,t),this.updateXR(e,t),this.postUpdateXR(e,t)},t.prototype.preUpdateXR=function(e,t){},t.prototype.updateXR=function(e,t){},t.prototype.postUpdateXR=function(e,t){this.third.isXrEnabled&&(this.time.update(e,t),this.third.physics.update(t),this.third.physics.updateDebugger(),this.third.animationMixers.update(t))},t}(l.Scene),m=n(8),v=n.n(m);window.__loadPhysics=!1,window.__ammoPath="";var g=function(e){return window.setTimeout((function(){window.__loadPhysics?v()(window.__ammoPath,(function(){Ammo().then((function(){e()}))})):e()}),50),{withPhysics:function(e){window.__loadPhysics=!0,window.__ammoPath=e}}},y=n(6),x=n(15),b=n.n(x),w=n(5),_=n(4),M=n(7),T=n(0),S=n(2),E=n(16),A=n(17),L=n(18),P=n(19),R=n(20)}])}));
  //# sourceMappingURL=enable3d.phaserExtension.0.19.1.min.js.map